Repository navigation
Description
The gap
kit hooks add context-check installs a pre-push gate that cannot fail when [context] is absent from .kit.toml, says nothing about it at install time, and prints a hint belonging to a different hook. Nothing in kit status reports git-hook state at all, so neither "no gate" nor "a gate that checks nothing" is visible where an operator would look.
context-check is described as: "Block a push when the live CLI context (account/project) does not match .kit.toml [context]. Stops pushes to the wrong org/project." With no [context] block there is nothing to match, and kit context check correctly exits 0 with an informational note — which makes the installed hook a permanent pass.
Measured (6.6.5, macOS, non-root, throwaway repo)
$ git init -q . && printf '[tools]\nnode = "22"\n' > .kit.toml && git add -A && git commit -qm init
$ kit hooks add context-check --non-interactive
kit hooks add context-check (git pre-push)
──────────────────────────────────────────────────
✓ pre-push installed 1 command(s)
Test by staging a file with a fake credential (e.g. sk_test_AAAAAAAAAAAAAAAAAAAA) and
running git commit — the commit should be blocked.
Two defects visible in that output alone:
- No warning that
[context]is missing, i.e. that the gate it just installed will never block anything. - The hint is the wrong hook's. Staging a credential and committing has nothing to do with a pre-push context check — that is
secret-scan's test recipe, printed verbatim here (and forpost-pull-audittoo).
Then the gate itself:
$ printf 'refs/heads/main a refs/heads/main b\n' | .git/hooks/pre-push origin file:///tmp/x
$ echo $?
0 # passes, with no [context] to check
And nothing surfaces it:
$ kit status | grep -iE "hook|context"
○ memory hooks not installed → run `kit memory install`
kit status reports memory hooks and never git hooks — so a repo with no pre-commit gate, and a repo whose installed pre-push gate is unarmed, both read identically: silent.
Why this matters more than its size
README calls git hooks "the agent-agnostic enforcement floor" — the one that fires in any agent or none. An operator who runs kit hooks add context-check has stated an intent ("stop pushes to the wrong org"), gets a green ✓ installed, and is now less safe than they believe, because the check has no declaration to compare against. Same family as:
- 43 command modules still accept unknown flags silently — sweep the flag-validation advisory to zero #488 — a flag that silently does nothing is indistinguishable from a working one;
- Audit: nothing reads the anchor record, so N working trees give N green verdicts and no union view #470 — a green verdict per working tree that no one reads as a whole;
- Git-hook floor can live outside the repo: an absolute core.hooksPath is honored but never reported, and an unrelated rm -rf silently removes the gate #496 — a hook floor that can live outside the repo, unreported.
The pattern: the mechanism works, and the reader is the weak link.
Proposed
kit hooks add context-checkmust refuse or warn loudly when[context]is absent — and point atkit context check, which already prints a ready-to-paste block from the live snapshot (that empty-state hint is good; it is just unreachable unless you already know to run it). "Installed" for a gate that cannot fail is a false green.- Per-hook test hints. The install line should tell you how to exercise that hook — a mismatched remote for
context-check, a merge forpost-pull-audit— instead of secret-scan's recipe for all three. - A git-hook row in
kit status/kit check, listing which of the built-in hooks are installed and whether each is armed (context-checkinstalled + no[context]⇒ warn). Today the only hook row is memory hooks. - Optional but cheap:
kit context checkexiting 0 with no declaration is right for a read-only command, but the hook path could treat "no declaration" asdidNotRunrather than pass, matching kit's rule that coverage which could not run is unknown, not clean.
Related
- Git-hook floor can live outside the repo: an absolute core.hooksPath is honored but never reported, and an unrelated rm -rf silently removes the gate #496 — the same reader problem for hook location (an absolute
core.hooksPathis honored but never reported).
🤖 Generated with Claude Code
Activity
chore(release): 6.7.0 (#499)
feat(config): report config drift — the schema detector gets a caller…
chore(release): 6.8.0 (#516)