Skip to content

feat(hook): add the commit gate core, verify and Claude Code guard - #676

Merged
ajianaz merged 2 commits into
developfrom
feat/674-commit-gate-core
Oct 16, 2026
Merged

ajianaz merged 2 commits into
developfrom
feat/674-commit-gate-core

Conversation

@ajianaz

@ajianaz ajianaz commented Oct 16, 2026

Copy link
Copy Markdown
Collaborator

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 agent git commit command lines.
  • cora hook verify (exit 0 validated, 10 blocking, 11 not validated) and cora hook claude-guard (Claude Code PreToolUse).
  • cora review --staged and cora.review_finalize record 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

  • Unit tests for fingerprinting, marker store, bypass parsing (--no-verify prefixes, -c core.hooksPath, chained commands, pathspecs).
  • fmt, clippy -D warnings and the full test suite pass locally.

)

Signed-off-by: ajianaz <ajianaz@users.noreply.github.com>
… guard (#674)

Signed-off-by: ajianaz <ajianaz@users.noreply.github.com>
@ajianaz ajianaz closed this Oct 16, 2026
@ajianaz ajianaz reopened this Oct 16, 2026
@ajianaz
ajianaz merged commit 1035bbf into develop Oct 16, 2026
28 of 30 checks passed
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>
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