From fde7eae70a4e2765ce73f3e690cdf3290d204b45 Mon Sep 17 00:00:00 2001 From: uinstinct <61635505+uinstinct@users.noreply.github.com> Date: Wed, 23 Jul 2025 20:13:31 +0530 Subject: [PATCH] fix: use rules when `alwaysApply` is absent --- core/llm/rules/getSystemMessageWithRules.ts | 2 +- core/llm/rules/getSystemMessageWithRules.vitest.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) 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