Skip to content

fix: --platform target now filters skills, hooks, and instruction files (#133)#142

Merged
tirth8205 merged 2 commits intotirth8205:mainfrom
sebastianbreguel:fix/133-platform-filter-instructions
Apr 11, 2026
Merged

fix: --platform target now filters skills, hooks, and instruction files (#133)#142
tirth8205 merged 2 commits intotirth8205:mainfrom
sebastianbreguel:fix/133-platform-filter-instructions

Conversation

@sebastianbreguel
Copy link
Copy Markdown
Contributor

Problem

Running `code-review-graph install --platform cursor` (or any non-"all" target) still wrote Claude-specific files and every platform rule file, ignoring the flag:

  • `CLAUDE.md` was injected
  • `.claude/settings.json` hooks were installed
  • `AGENTS.md`, `GEMINI.md`, `.cursorrules`, `.windsurfrules` were all written

This made `--platform` effectively cosmetic — the only thing it actually scoped was the MCP server config.

Fixes #133.

Fix

  • `skills.py`: `inject_platform_instructions` now takes a `target` param and filters files via an ownership map:
    • `AGENTS.md` → `cursor`, `opencode`, `antigravity`
    • `GEMINI.md` → `antigravity`
    • `.cursorrules` → `cursor`
    • `.windsurfrules` → `windsurf`
      Default `target="all"` preserves existing behavior. `target="claude"` writes nothing (CLAUDE.md is handled separately).
  • `cli.py` `_handle_init`: `inject_claude_md` and `install_hooks` are now gated on `target in ("claude", "all")`, and `target` is forwarded to `inject_platform_instructions`.

Note: the fix does not remove stale files from prior runs — e.g. if a user ran with `--platform all` and later re-runs with `--platform cursor`, existing `GEMINI.md` / `.windsurfrules` stay on disk. Deleting user files silently felt unsafe; happy to revisit if you'd prefer a cleanup step.

Testing

  • New `TestInjectPlatformInstructionsFiltering` covers `all`, default, `claude`, `cursor`, `windsurf`, `antigravity`, `opencode`.
  • `uv run pytest` — 618 passed
  • `uv run ruff check` — clean on touched files

@sebastianbreguel
Copy link
Copy Markdown
Contributor Author

@tirth8205 hey! could you review this when you get a chance? it fixes the platform filter for skills, hooks and instruction files (issue #133)

Copy link
Copy Markdown
Owner

@tirth8205 tirth8205 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good fix for #133 — making --platform actually scope generated files. Well-tested.

Please rebase on latest main (there have been recent merges touching skills.py). Once rebased and CI passes, this is ready to merge.

@sebastianbreguel sebastianbreguel force-pushed the fix/133-platform-filter-instructions branch from 352214d to 54216bb Compare April 8, 2026 19:40
@sebastianbreguel
Copy link
Copy Markdown
Contributor Author

@tirth8205 Rebased on latest main, CI is green. Ready to merge when you are!

@sebastianbreguel
Copy link
Copy Markdown
Contributor Author

@tirth8205 up

@tirth8205
Copy link
Copy Markdown
Owner

The code changes here are correct and well-tested — this is exactly the right fix for #133. However the branch now has a merge conflict with main (likely in cli.py, caused by the recently-merged PR #185 which also modified that file).

Please rebase on the latest main and force-push. Once the conflict is resolved, this can be merged immediately.

One minor note: _PLATFORM_INSTRUCTION_FILES is being changed from dict[str, str] to dict[str, tuple[str, ...]], which will break PR #204 if that merges after this one (it iterates the dict as for label, filename in ... expecting filename to be a string). Just flagging this as a heads-up for whoever reviews #204 next.

…es (tirth8205#133)

Previously, 'code-review-graph install --platform cursor' still wrote
CLAUDE.md, installed Claude Code hooks, and injected instructions into
every platform rule file (AGENTS.md, GEMINI.md, .cursorrules, .windsurfrules),
ignoring the selected target.

- skills.py: inject_platform_instructions now takes a target param and
  filters files via an ownership map (AGENTS.md -> cursor/opencode/antigravity,
  GEMINI.md -> antigravity, .cursorrules -> cursor, .windsurfrules -> windsurf).
  Default 'all' preserves existing behavior.
- cli.py _handle_init: inject_claude_md and install_hooks now only run
  when target is 'claude' or 'all'; target is passed to
  inject_platform_instructions.
- tests: new TestInjectPlatformInstructionsFiltering covers all, default,
  claude, cursor, windsurf, antigravity, opencode targets.
@sebastianbreguel sebastianbreguel force-pushed the fix/133-platform-filter-instructions branch from 54216bb to 5e063f7 Compare April 11, 2026 13:28
@sebastianbreguel
Copy link
Copy Markdown
Contributor Author

Rebased on latest main and force-pushed. The conflict in tests/test_skills.py was just an import merge — both inject_platform_instructions (from this PR) and install_git_hook (from #185) are needed. All 43 tests pass. Ready to merge.

@tirth8205 tirth8205 merged commit 9f7ec75 into tirth8205:main Apr 11, 2026
9 checks passed
tirth8205 added a commit that referenced this pull request Apr 11, 2026
Unreleased fixes since v2.2.2 that users are complaining about:
- #208 Claude Code hook schema (fixes #97, #138, #163, #168, #172, #182,
  #188, #191, #201) — v2.2.2 generates an invalid hooks schema and
  timeouts in ms instead of seconds; PreCommit is also not a real event.
- #205 SQLite transaction nesting (fixes #110, #135, #181) — implicit
  transactions from the legacy sqlite3 default caused "cannot start a
  transaction within a transaction" on update.
- #166 Go method receivers resolved from field_identifier.
- #170 UTF-8 decode errors in detect_changes (fixes #169).
- #142 --platform target filters (fixes #133).
- #213 / #183 large-repo community detection hangs.
- #220 CI lint + tomllib on Python 3.10.
- #159 missing pytest-cov dev dep.
- #154 JSX component CALLS edges.

Plus features: #177 Codex, #165 Luau (#153), #217 REFERENCES edge,
#215 recurse_submodules, #185 gitignore default (#175), #171 gitignore
docs (#157).

Verified locally on Python 3.11: ruff clean, mypy clean, bandit clean,
691 tests pass, coverage 73.72%.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@tirth8205 tirth8205 mentioned this pull request Apr 11, 2026
5 tasks
tirth8205 added a commit that referenced this pull request Apr 11, 2026
Unreleased fixes since v2.2.2 that users are complaining about:
- #208 Claude Code hook schema (fixes #97, #138, #163, #168, #172, #182,
  #188, #191, #201) — v2.2.2 generates an invalid hooks schema and
  timeouts in ms instead of seconds; PreCommit is also not a real event.
- #205 SQLite transaction nesting (fixes #110, #135, #181) — implicit
  transactions from the legacy sqlite3 default caused "cannot start a
  transaction within a transaction" on update.
- #166 Go method receivers resolved from field_identifier.
- #170 UTF-8 decode errors in detect_changes (fixes #169).
- #142 --platform target filters (fixes #133).
- #213 / #183 large-repo community detection hangs.
- #220 CI lint + tomllib on Python 3.10.
- #159 missing pytest-cov dev dep.
- #154 JSX component CALLS edges.

Plus features: #177 Codex, #165 Luau (#153), #217 REFERENCES edge,
#215 recurse_submodules, #185 gitignore default (#175), #171 gitignore
docs (#157).

Verified locally on Python 3.11: ruff clean, mypy clean, bandit clean,
691 tests pass, coverage 73.72%.

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

code-review-graph install --platform option seems ignored or partially ignored

2 participants