Repository navigation
fix(repo): inspect records a nested .cursor/rules/*.mdc; two stale comments #200
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
antonwolfy
merged 4 commits into
intel:main
from
antonwolfy:fix/nested-cursor-rules-and-nits
Oct 23, 2026
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
618a61e
fix(repo): inspect records a nested .cursor/rules/*.mdc; two stale co…
antonwolfy 94a88a1
fix(repo): a .cursor/rules below the root is listed with scope unknown
antonwolfy fb445e0
fix(repo): a path under the root .cursor/rules gets one record; neste…
antonwolfy 95ed677
docs(repo): what `directory` means for an instruction record of unkno…
antonwolfy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
8 changes: 8 additions & 0 deletions
8
dokimi/changelog.d/20261023_150000_antonwolfy_nested-cursor-rules.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| ### Fixed | ||
|
|
||
| - **`repo inspect` lists a `.cursor/rules/*.mdc` below the root** — a rule | ||
| file such as `web/.cursor/rules/style.mdc` was not listed in | ||
| `instructions`. It is now a record with `directory` `web`, and with scope | ||
| and activation `unknown`: Cursor's rules docs cover only the root | ||
| `.cursor/rules` (and nested `AGENTS.md`), so whether Cursor reads it is not | ||
| known from the docs. Its note says so. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| # Copyright (C) 2026 Intel Corporation | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| """The instruction-file rules of ``repo inspect``: which harness reads each file, and where it applies.""" | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| from dokimi.repos.environment.instructions import detect_instructions | ||
|
|
||
| INSTRUCTION_TABLE = [ | ||
| (".claude/CLAUDE.md", ('claude-code',), "root", "always", False), | ||
| (".claude/rules/a.md", ('claude-code',), "unknown", "unknown", False), | ||
| (".claude/skills/x/SKILL.md", ('claude-code',), "capability", "on-demand", False), | ||
| (".clinerules", ('cline',), "legacy", "always", True), | ||
| (".clinerules/a.md", ('cline',), "root", "unknown", False), | ||
| (".cursor/rules/a.mdc", ('cursor',), "unknown", "unknown", False), | ||
| (".cursorrules", ('cursor', 'cline'), "legacy", "always", True), | ||
| (".github/agents/a.agent.md", ('github-copilot',), "capability", "manual", False), | ||
| (".github/copilot-instructions.md", ('github-copilot',), "root", "always", False), | ||
| (".github/instructions/a.instructions.md", ('github-copilot',), "path-specific", "path-scoped", False), | ||
| (".roo/rules-code/a.md", ('roo-code',), "mode-specific", "mode-scoped", False), | ||
| (".roo/rules/a.md", ('roo-code',), "root", "always", False), | ||
| (".roomodes", ('roo-code',), "mode-specific", "mode-scoped", False), | ||
| (".roorules", ('roo-code',), "legacy", "always", True), | ||
| (".roorules-code", ('roo-code',), "mode-specific", "mode-scoped", True), | ||
| (".windsurf/rules/a.md", ('windsurf',), "unknown", "unknown", False), | ||
| (".windsurfrules", ('windsurf', 'cline'), "legacy", "always", True), | ||
| ("AGENTS.md", ('codex', 'github-copilot', 'cursor', 'windsurf', 'cline', 'generic'), "root", "always", False), | ||
| ("AGENTS.override.md", ('codex',), "root", "always", False), | ||
| ("CLAUDE.local.md", ('claude-code',), "local-private", "always", False), | ||
| ("CLAUDE.md", ('claude-code', 'github-copilot'), "root", "always", False), | ||
| ("GEMINI.md", ('gemini', 'github-copilot'), "root", "always", False), | ||
| ("sub/.cursor/rules/a.mdc", ('cursor',), "unknown", "unknown", False), | ||
| ("sub/AGENTS.md", ('codex', 'github-copilot', 'cursor', 'windsurf', 'cline', 'generic'), "path-specific", "path-scoped", False), | ||
| ("sub/AGENTS.override.md", ('codex',), "path-specific", "path-scoped", False), | ||
| ("sub/CLAUDE.md", ('claude-code',), "path-specific", "path-scoped", False), | ||
| ("sub/GEMINI.md", ('gemini',), "path-specific", "path-scoped", False), | ||
| ] | ||
|
|
||
|
|
||
| def test_instruction_rule_table(): | ||
| got = [(i.path, tuple(i.harnesses), i.scope, i.activation, i.legacy) | ||
| for i in detect_instructions([row[0] for row in INSTRUCTION_TABLE])] | ||
| assert got == INSTRUCTION_TABLE | ||
|
|
||
|
|
||
| def test_a_nested_cursor_rule_is_listed_with_its_directory_and_no_known_scope(): | ||
| (rule,) = detect_instructions(["pkg/web/.cursor/rules/style.mdc", "pkg/web/.cursor/notes.md"]) | ||
| assert (rule.path, rule.scope, rule.directory) == ("pkg/web/.cursor/rules/style.mdc", "unknown", "pkg/web") | ||
| assert any("Cursor documents only the root .cursor/rules" in note for note in rule.notes) | ||
|
|
||
|
|
||
| def test_a_cursor_rules_path_gets_one_record_and_the_closest_directory(): | ||
| paths = [".cursor/rules/sub/.cursor/rules/b.mdc", "a/.cursor/rules/b/.cursor/rules/c.mdc"] | ||
| got = sorted((i.path, i.directory) for i in detect_instructions(paths)) | ||
| # under the root .cursor/rules: the root rule's only; nested twice: the inner .cursor's directory | ||
| assert got == [(".cursor/rules/sub/.cursor/rules/b.mdc", None), | ||
| ("a/.cursor/rules/b/.cursor/rules/c.mdc", "a/.cursor/rules/b")] |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.