feat: validation gates stop hook (#7) - #14
Merged
Conversation
Adds validation_gates.py stop hook that auto-detects project stack and runs lint, security, typecheck, and build gates on session end. Returns exit 2 with structured stderr on failures so Claude can invoke the validation-gates agent to fix before finishing. Exit 0 if no modified files, no tools installed, or project unrecognised. Gate config via stopGates in settings.json (lint/security/typecheck/build default on; tests/e2e/ui opt-in). Hook registered in settings.json.example. 26 unit tests covering detection, gate toggle, exit codes, and output format. Co-Authored-By: Claude Sonnet 4.6 <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 #7
Changes
New:
.claude/hooks/stop/validation_gates.pypackage.json,pyproject.toml,go.mod,Cargo.tomlwhichbefore running each gate — skips silently if not installedgit statusshows modified files — no noise on read-only sessionsvalidation-gatesagent to fixNew:
tests/hooks/test_validation_gates.pyunittest)Modified:
.claude/settings.json.examplestopGatesconfig block with all keys and defaultsModified:
README.md+scripts/install.shstopGatesconfigTest plan
stopGates.lint: falsein settings.json → lint gate skippedpython -m unittest discover -s tests/→ 26 tests pass🤖 Generated with Claude Dev Kit