Repository navigation
docs(readme): run complexity-hints from the agent hook and as a gate - #58
Merged
Merged
Conversation
The Claude Code hook now runs on Edit, Write and Bash, checks only the files each call changed in the project, and passes what blocks back to the agent. The README also shows the checker as a commit and CI gate, and gives guidance for agent instructions. Tests run the README's hook command against a stand-in install. Closes #45 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Closes #45
Summary
Rewrites the README's "For agents" section around
complexity-hints(#44), so an agent is held only to what its change is responsible for:PostToolUsehook onEdit|Write|Bashruns the checker on the files the call changed:tool_input.file_path, ortool_response.bashEditDiff.changedFilesfor Bash. A block exits 2, which shows the diagnostics to the agent. A check that can't run (nojq, no install, no base branch) exits 1, which the user sees and which doesn't block the agent. A call that changed no project file passes without running the checker.npx --no complexity-hintsbefore each commit, and apull_requestworkflow step withfetch-depth: 0, an install, and--base origin/${{ github.base_ref }}.maxor add disable comments. Also covers notes versus--strict, and one worktree per parallel agent.Changes
bashEditDiff(Claude Code 2.1.269+). The README says it records in every permission mode only withbashEditDiffEnabled: truein user settings, since a project's settings can't turn it on.jq, as before. Files are collected withset --rather thanxargs, which would turn the checker's exit 1 into 123 and break the exit mapping.npx --noavoids fetching an unrelated registry package namedcomplexity-hintswhen the project's own isn't installed.Verification
vp run ready: format, lint, typecheck and 105 tests pass.tests/checker.test.tsextracts the README's hook command and runs it with/bin/shfrom outside the project, withCLAUDE_PROJECT_DIRpointing at a temporary repository whosenode_modules/.bin/complexity-hintsruns the checker from source. It covers:jq, and no install, each exiting 1./refineround; findings applied: the CI install and--no, thejqguard,pull_requestscope, guidance wording, a stronger notes assertion, and running the hook from outside the project.bashEditDifffields, scope and version come from the hooks and settings references.Observations
CLAUDE_PROJECT_DIRand the tool's file paths ever differ in spelling (symlinks), the project filter would skip files without saying so. The reference documents both as absolute paths.