Repository navigation
feat(hook): add the commit gate core, verify and Claude Code guard - #676
Merged
Merged
Conversation
… guard (#674) Signed-off-by: ajianaz <ajianaz@users.noreply.github.com>
ajianaz
added a commit
that referenced
this pull request
Oct 16, 2026
…in place (#688) ## What Part 2 of 3 for #674 (part 1 is #676). - Hook template v2: `cora hook verify --quiet` first (0 pass, 10 deny), then the fallback `cora review --staged --ci --severity major`; a tooling error is reported as not a pass. - `cora hook install` recognises legacy v1 hooks and upgrades them in place instead of wrapping them a second time. - 12 end-to-end tests with real temporary git repos (agent verdict through MCP, hook, guard, upgrade). ## Why The hook is the fallback when the agent judge was not used, and must not re-review a diff that was already validated. Part of #674. ## Testing - Unit tests for the template and legacy detection. - tests/commit_gate.rs: 12 e2e tests, all passing; fmt, clippy -D warnings and the full suite pass. Signed-off-by: ajianaz <ajianaz@users.noreply.github.com> Co-authored-by: ajianaz <ajianaz@users.noreply.github.com>
ajianaz
added a commit
that referenced
this pull request
Oct 16, 2026
## What Part 3 of 3 for #674 (parts 1 and 2: #676, #688). - `/cora-review` skill: review the staged diff before every commit. - `docs/usage.md`: the three-layer commit gate and the Claude Code guard snippet. - `docs/cli-reference.md`: `cora hook verify` and `cora hook claude-guard`. - CHANGELOG entry. ## Why Agents need to know to review before committing, and users need the setup steps. Closes #674. ## Testing - Docs and skill text only; the skill is embedded in the binary, so the build and full test suite were run (pass). Signed-off-by: ajianaz <ajianaz@users.noreply.github.com> Co-authored-by: ajianaz <ajianaz@users.noreply.github.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.
What
Part 1 of 3 for #674 (split from #675 so each PR fits the review time limit).
engine/commit_gate.rs: change-set fingerprint, marker store under the git dir,check, and a fail-closed parser for agentgit commitcommand lines.cora hook verify(exit 0 validated, 10 blocking, 11 not validated) andcora hook claude-guard(Claude Code PreToolUse).cora review --stagedandcora.review_finalizerecord a verdict marker for the exact staged diff.Why
Agents should always run the judge review before committing; the verdict must be bound to the exact change set. Part of #674. Follow-ups: part 2 (pre-commit hook v2 and e2e tests), part 3 (skill, docs, changelog).
Testing
--no-verifyprefixes,-c core.hooksPath, chained commands, pathspecs).-D warningsand the full test suite pass locally.