Test prove_it locally
Run prove_it from the repo source (not the Homebrew install) to test hook behavior.
Steps
- •
Identify the test target. If the user didn't specify, use
example/basic/. - •
Set up the PATH shim so
prove_itresolves to the repo'scli.js:bashexport PATH="$(git rev-parse --show-toplevel)/test/bin:$PATH" which prove_it # should show test/bin/prove_it
- •
Run the requested test. Common scenarios:
Test a specific hook event:
bashcd example/basic echo '{"hook_event_name":"Stop","session_id":"test","cwd":"."}' | prove_it hook claude:StopTest SessionStart:
bashecho '{"hook_event_name":"SessionStart","source":"startup","session_id":"test","cwd":"."}' | prove_it hook claude:SessionStartTest PreToolUse (edit protection):
bashecho '{"hook_event_name":"PreToolUse","tool_name":"Edit","tool_input":{"file_path":"src/greet.js"},"session_id":"test","cwd":"."}' | prove_it hook claude:PreToolUseTest PreToolUse (commit gate):
bashecho '{"hook_event_name":"PreToolUse","tool_name":"Bash","tool_input":{"command":"git commit -m test"},"session_id":"test","cwd":"."}' | prove_it hook claude:PreToolUseTest init in a temp directory:
bashtmpdir=$(mktemp -d) cd "$tmpdir" && git init prove_it init --no-default-checks cat .claude/prove_it.json prove_it deinit rm -rf "$tmpdir"
Test diagnose:
bashcd example/basic prove_it diagnose
- •
Report the output and whether the behavior matches expectations.
Notes
- •The shim at
test/bin/prove_itjust doesexec node ../../cli.js "$@" - •All
prove_it builtin:*commands in configs will also resolve through the shim - •This tracks with the current git ref — check out any commit to test that version