Skip to content

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

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

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

@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
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
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.

1 participant