Hello, I always appreciate rulesync.
Problem
CopilotRule.fromFile() determines whether a file is a "root" rule by comparing only relativeFilePath, without considering relativeDirPath. This may cause incorrect root detection in edge cases, especially in global mode.
Evidence
In src/features/rules/copilot-rule.ts around line 208:
const isRoot = relativeFilePath === paths.root.relativeFilePath;
The comparison is performed against only the file name portion (e.g., "copilot-instructions.md"), without verifying that the directory also matches. In project mode, the root file is .github/copilot-instructions.md, and in global mode it is .copilot/copilot-instructions.md. If a non-root file happens to be named copilot-instructions.md in a different directory, it could be incorrectly classified as a root rule.
Expected Behavior
Root detection should use the full relative path (directory + filename) to unambiguously distinguish root from non-root files.
Proposed Solution
Compare the full path including directory:
const isRoot =
path.join(relativeDirPath, relativeFilePath) ===
path.join(paths.root.relativeDirPath, paths.root.relativeFilePath);
Your consideration would be appreciated.
Hello, I always appreciate rulesync.
Problem
CopilotRule.fromFile()determines whether a file is a "root" rule by comparing onlyrelativeFilePath, without consideringrelativeDirPath. This may cause incorrect root detection in edge cases, especially in global mode.Evidence
In
src/features/rules/copilot-rule.tsaround line 208:The comparison is performed against only the file name portion (e.g.,
"copilot-instructions.md"), without verifying that the directory also matches. In project mode, the root file is.github/copilot-instructions.md, and in global mode it is.copilot/copilot-instructions.md. If a non-root file happens to be namedcopilot-instructions.mdin a different directory, it could be incorrectly classified as a root rule.Expected Behavior
Root detection should use the full relative path (directory + filename) to unambiguously distinguish root from non-root files.
Proposed Solution
Compare the full path including directory:
Your consideration would be appreciated.