Skip to content

fix: add --quiet/--json CLI flags, fix Claude Code hooks template#100

Closed
gzenz wants to merge 1 commit intotirth8205:mainfrom
gzenz:fix/claude-code-hooks-and-cli-flags
Closed

fix: add --quiet/--json CLI flags, fix Claude Code hooks template#100
gzenz wants to merge 1 commit intotirth8205:mainfrom
gzenz:fix/claude-code-hooks-and-cli-flags

Conversation

@gzenz
Copy link
Copy Markdown
Contributor

@gzenz gzenz commented Apr 4, 2026

Summary

  • Add -q/--quiet flag to build, update, and status CLI commands to suppress stdout output
  • Add --json flag to status command for machine-readable output
  • Fix generate_hooks_config() to produce valid Claude Code settings.json schema:
    • Use nested "hooks": [{"type": "command", ...}] structure (was flat, missing "type")
    • Replace invalid PreCommit hook event with PreToolUse + if: "Bash(git commit*)" filter
    • Add "matcher" field to all hook entries
  • Update docs (COMMANDS.md, FEATURES.md, LLM-OPTIMIZED-REFERENCE.md, architecture.md) and tests

Context

The hooks/hooks.json (MCP plugin path) had the correct Claude Code schema from day one, but generate_hooks_config() in skills.py (used by code-review-graph init) was generating an invalid flat structure. The --quiet and --json flags referenced in the template also didn't exist. This meant anyone using code-review-graph init got a broken settings.json.

Test plan

  • ruff check passes
  • All 565 tests pass (uv run pytest tests/ --tb=short -q)
  • code-review-graph update --quiet produces no output (exit 0)
  • code-review-graph status --json outputs valid JSON
  • code-review-graph build --quiet produces no output

@gzenz
Copy link
Copy Markdown
Contributor Author

gzenz commented Apr 4, 2026

fixes #97

@gzenz gzenz force-pushed the fix/claude-code-hooks-and-cli-flags branch 2 times, most recently from c514e1a to 15db376 Compare April 5, 2026 14:00
- Add -q/--quiet flag to build, update, and status commands
- Add --json flag to status command for machine-readable output
- Fix generate_hooks_config() to use correct Claude Code schema:
  nested "hooks" arrays with "type": "command" on each entry
- Replace invalid PreCommit hook event with PreToolUse +
  if: "Bash(git commit*)" filter
- Update docs and tests to match
@gzenz gzenz force-pushed the fix/claude-code-hooks-and-cli-flags branch from 15db376 to 1270c80 Compare April 5, 2026 14:11
gzenz added a commit to gzenz/code-review-graph that referenced this pull request Apr 6, 2026
…h8205#103

Combine nested hooks format from tirth8205#100 with permissions and enrich hook
from tirth8205#103. Rename PreCommit -> PreToolUse, use nested hooks arrays.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

The hook schema fix portion overlaps with PR #141 (which we're prioritizing since it's more focused). The --quiet/--json CLI flags are useful but would conflict with PR #152 which just removed references to those flags from hook commands.

Suggestion: could you split out just the --quiet/--json flag additions into a separate PR? The hook fix portion is covered by #141.

@tirth8205
Copy link
Copy Markdown
Owner

Review: PR #100 — fix: add --quiet/--json CLI flags, fix Claude Code hooks template

This PR is superseded by PR #158, which incorporates the --quiet/--json flags and the hooks template fix, plus the entire body of improvements.

The owner's review noted that the hook schema fix overlaps with another PR (#141, which was prioritized), and the --quiet/--json flags would conflict with PR #152. Given that #158 is the consolidated replacement from the same author, there is no need to split this further.

Recommendation: Close this PR in favor of #158.

@gzenz
Copy link
Copy Markdown
Contributor Author

gzenz commented Apr 11, 2026

Superseded by #158.

@gzenz gzenz closed this Apr 11, 2026
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