Elffuss BraidHub

kikocis/continue public

improv: constants
Changesetf96bfd141fb650aecda9f5c08b54343c7988660071cd8f3d899d6ae327460d02
AuthorTomasz Stefaniak <tomasz.p.stefaniak@gmail.com> · 2025-06-11 15:00 -07:00
CommitterTomasz Stefaniak <tomasz.p.stefaniak@gmail.com> · 2025-06-11 15:04 -07:00
Parentsa840de7f3a7a

Browse the files at this changeset

4 files changed

modified core/config/markdown/loadCodebaseRules.ts +2 −1
@@ -1,6 +1,7 @@
11 import { ConfigValidationError } from "@continuedev/config-yaml";
22 import { IDE, RuleWithSource } from "../..";
33 import { walkDirs } from "../../indexing/walkDir";
4+import { RULES_MARKDOWN_FILENAME } from "../../llm/rules/constants";
45 import { getUriPathBasename } from "../../util/uri";
56 import { convertMarkdownRuleToContinueRule } from "./parseMarkdownRule";
67
@@ -21,7 +22,7 @@
2122 // Filter to just rules.md files
2223 const rulesMdFiles = allFiles.filter((file) => {
2324 const filename = getUriPathBasename(file);
24- return filename === "rules.md";
25+ return filename === RULES_MARKDOWN_FILENAME;
2526 });
2627
2728 // Process each rules.md file
modified core/core.ts +4 −3
@@ -59,6 +59,7 @@
5959 import { shouldIgnore } from "./indexing/shouldIgnore";
6060 import { walkDirCache } from "./indexing/walkDir";
6161 import { LLMLogger } from "./llm/logger";
62+import { RULES_MARKDOWN_FILENAME } from "./llm/rules/constants";
6263 import { llmStreamChat } from "./llm/streamChat";
6364 import type { FromCoreProtocol, ToCoreProtocol } from "./protocol";
6465 import { OnboardingModes } from "./protocol/core";
@@ -583,7 +584,7 @@
583584 let rulesFileCreated = false;
584585 for (const uri of data.uris) {
585586 const filename = getUriPathBasename(uri);
586- if (filename === "rules.md") {
587+ if (filename === RULES_MARKDOWN_FILENAME) {
587588 rulesFileCreated = true;
588589 break;
589590 }
@@ -614,7 +615,7 @@
614615 let rulesFileDeleted = false;
615616 for (const uri of data.uris) {
616617 const filename = getUriPathBasename(uri);
617- if (filename === "rules.md") {
618+ if (filename === RULES_MARKDOWN_FILENAME) {
618619 rulesFileDeleted = true;
619620 break;
620621 }
@@ -850,7 +851,7 @@
850851 uri.endsWith(".prompt") ||
851852 uri.endsWith(SYSTEM_PROMPT_DOT_FILE) ||
852853 (uri.includes(".continue") && uri.endsWith(".yaml")) ||
853- uri.endsWith("rules.md")
854+ uri.endsWith(RULES_MARKDOWN_FILENAME)
854855 ) {
855856 await this.configHandler.reloadConfig();
856857 } else if (
added core/llm/rules/constants.ts +4 −0
@@ -0,0 +1,4 @@
1+/**
2+ * The filename used for colocated markdown rules
3+ */
4+export const RULES_MARKDOWN_FILENAME = "rules.md";
No newline at the end of the file
modified core/llm/rules/getSystemMessageWithRules.ts +2 −1
@@ -8,6 +8,7 @@
88 import { renderChatMessage } from "../../util/messageContent";
99 import { getCleanUriPath } from "../../util/uri";
1010 import { extractPathsFromCodeBlocks } from "../utils/extractPathsFromCodeBlocks";
11+import { RULES_MARKDOWN_FILENAME } from "./constants";
1112
1213 /**
1314 * Checks if a path matches any of the provided globs
@@ -92,7 +93,7 @@
9293 return (
9394 !rule.ruleFile ||
9495 rule.ruleFile.startsWith(".continue/") ||
95- rule.ruleFile === ".continue/rules.md"
96+ rule.ruleFile === `.continue/${RULES_MARKDOWN_FILENAME}`
9697 );
9798 };
9899