diff --git a/core/llm/rules/getSystemMessageWithRules.ts b/core/llm/rules/getSystemMessageWithRules.ts index 39a30e34d..dc03ad43f 100644 --- a/core/llm/rules/getSystemMessageWithRules.ts +++ b/core/llm/rules/getSystemMessageWithRules.ts @@ -132,7 +132,7 @@ const isFileInDirectory = ( * Checks if a rule is a root-level rule (.continue directory or no file path) */ const isRootLevelRule = (rule: RuleWithSource): boolean => { - return !rule.ruleFile || rule.ruleFile.startsWith(".continue/"); + return !rule.ruleFile || rule.ruleFile.includes(".continue/"); // ruleFile path is absolute - hence we need to check for it in between }; /** diff --git a/core/llm/rules/getSystemMessageWithRules.vitest.ts b/core/llm/rules/getSystemMessageWithRules.vitest.ts index 0b4444cd1..9f350197d 100644 --- a/core/llm/rules/getSystemMessageWithRules.vitest.ts +++ b/core/llm/rules/getSystemMessageWithRules.vitest.ts @@ -69,7 +69,7 @@ describe("Rule colocation glob matching", () => { name: "Root Rule", rule: "Follow project standards", source: "rules-block", - ruleFile: ".continue/rules.md", + ruleFile: "/path/to/repo/.continue/rules.md", // No restriction, should apply to all files }; @@ -212,7 +212,7 @@ describe("Rule policies", () => { name: "Root Rule", rule: "Follow project standards", source: "rules-block", - ruleFile: ".continue/rules.md", + ruleFile: "/my/project/.continue/rules.md", }; // Off policy should override even global rules