Skip to content

Fix Claude hook config and add JSX component CALLS edges#154

Merged
tirth8205 merged 1 commit intotirth8205:mainfrom
GrimoireScribe:fix/claude-hooks-jsx-calls
Apr 11, 2026
Merged

Fix Claude hook config and add JSX component CALLS edges#154
tirth8205 merged 1 commit intotirth8205:mainfrom
GrimoireScribe:fix/claude-hooks-jsx-calls

Conversation

@GrimoireScribe
Copy link
Copy Markdown
Contributor

Summary

This PR does two things:

  1. Fixes Claude Code install/config issues:
  • removes invalid PreCommit hook generation
  • changes PostToolUse to code-review-graph update --skip-flows
  • makes generated Claude/settings/skill file reads and writes explicit UTF-8 for Windows safety
  1. Improves React/TSX graph coverage:
  • emits synthetic CALLS edges for JSX component invocations
  • supports plain component tags like <MarkdownMsg />
  • supports namespace/member usage like <UI.MarkdownMsg />
  • supports nested member chains like <UI.Messages.MarkdownMsg />
  • verifies behavior through parser tests, query_graph callers_of, and impact-radius tests

Why

React codebases often invoke components through JSX instead of normal function-call syntax. Before this PR, those usages produced no CALLS edges, which meant:

  • callers_of could miss component call sites entirely
  • impact radius under-reported React caller relationships
  • flow/impact analysis was weak for component migration work

Separately, Claude Code hook generation was out of sync with valid hook events, and Windows installs could fail on Unicode content due to default-encoding file writes.

Behavioral notes

Current JSX support is intentionally scoped:

  • component-like tags are identified by uppercase names
  • intrinsic DOM tags like <div> are ignored
  • namespace imports can resolve JSX member expressions to module files
  • unresolved member-style components still degrade gracefully

This improves React caller tracing a lot without trying to solve full React semantic analysis in one PR.

Verification

Ran:

uv run --extra dev pytest tests\test_skills.py tests\test_parser.py tests\test_tools.py -q
uv run --extra dev ruff check tests\test_tools.py tests\test_parser.py code_review_graph\parser.py

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.

This bundles two distinct features: (a) hook schema fixes and (b) JSX/TSX component CALLS edges.

The hook fixes overlap with PR #141 and #152 (both already merged/in progress). The JSX parsing piece is unique and valuable — good test coverage and +285 lines to parser.py.

Could you rebase on latest main and consider splitting the JSX CALLS feature into its own PR? The hook fixes are being handled separately. The JSX work stands on its own merit and we'd be happy to merge it.

@GrimoireScribe GrimoireScribe force-pushed the fix/claude-hooks-jsx-calls branch from 495c97a to 4220626 Compare April 9, 2026 16:03
@GrimoireScribe
Copy link
Copy Markdown
Contributor Author

Thanks — I rebased the branch on latest main and force-pushed a JSX-only version of the PR branch.

I removed the overlapping hook/config changes and kept only the JSX component CALLS work plus the parser tests/fixture, so the branch is now focused on the React/TSX caller-tracing feature.

@GrimoireScribe
Copy link
Copy Markdown
Contributor Author

Thanks — I rebased the branch on latest main and force-pushed a JSX-only version of the PR branch.

I removed the overlapping hook/config changes and kept only the JSX component CALLS work plus the parser tests/fixture, so the branch is now focused on the React/TSX caller-tracing feature.

I also verified it locally against a real React component (MarkdownMsg) after rebuilding the graph. The JSX caller tracing is working end to end now. Two follow-up behaviors showed up outside this PR's scope: tests_for needs a query-side fix for TESTED_BY direction/fallbacks, and bare-name resolution benefits from preferring the component/function node over matching test nodes. I fixed those separately on my internal branch and can send them as a separate PR if useful.

@tirth8205 tirth8205 merged commit 302acbb into tirth8205:main Apr 11, 2026
1 check 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.

2 participants