Skip to content

fix: directory-aware root detection in CopilotRule.fromFile#1564

Merged
dyoshikawa merged 1 commit intomainfrom
codex/work-on-issue-1544
Apr 27, 2026
Merged

fix: directory-aware root detection in CopilotRule.fromFile#1564
dyoshikawa merged 1 commit intomainfrom
codex/work-on-issue-1544

Conversation

@dyoshikawa
Copy link
Copy Markdown
Owner

Motivation

  • Prevent misclassification of non-root Copilot instruction files that share the same filename as the root file by respecting the provided directory context when available.

Description

  • Make CopilotRule.fromFile() detect root vs non-root using relativeDirPath + relativeFilePath when relativeDirPath is provided, and fall back to filename-only detection for backward compatibility when it's not.
  • Resolve and use resolvedRelativeDirPath for reading non-root files so the directory context is preserved during file I/O and instance creation.
  • Align CopilotRule.forDeletion() root detection to the same directory-aware logic.
  • Add tests to ensure that a file named copilot-instructions.md in a non-root directory is treated as non-root, and that root is detected only when both directory and filename match.

Testing

  • Ran pnpm vitest run src/features/rules/copilot-rule.test.ts and the test file passed (62/62 tests passed).
  • Ran full checks with pnpm cicheck, which completed successfully (format/lint/typecheck passed and the full test suite passed: 5262 tests).

Codex Task

@dyoshikawa dyoshikawa merged commit 987ca20 into main Apr 27, 2026
10 checks passed
@dyoshikawa dyoshikawa deleted the codex/work-on-issue-1544 branch April 27, 2026 03:09
@dyoshikawa
Copy link
Copy Markdown
Owner Author

@dyoshikawa Thank you!

@github-actions github-actions Bot mentioned this pull request Apr 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant