Adds ten cc-7 cases (Darkwing's six wrapper cases plus allow, block, SIGTERM-ignoring gate and inner timeout above the hook timeout), amends rely-on lines 2 to 4, removes the stale cc-1d-block-bare evidence, adds compare.sh, reads SDK_ENTRY from the environment, fixes the cc-5c row and the Pi exit-code sentence. Co-Authored-By: Claude Opus 5.5 <[email protected]>
18 lines
1.0 KiB
Bash
Executable File
18 lines
1.0 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Row S0 probe gate for Claude Code: a PreToolUse command hook. $1 picks the
|
|
# behaviour. Each invocation is logged to $GATE_LOG with the hook input.
|
|
mode=${1:-block}
|
|
input=$(cat)
|
|
printf '%s mode=%s input=%s\n' "$(date -u +%FT%T.%3NZ)" "$mode" "$input" >> "${GATE_LOG:-/dev/null}"
|
|
case "$mode" in
|
|
allow) exit 0 ;;
|
|
block) echo "PROBE-GATE: write is blocked by policy (exit 2)" >&2; exit 2 ;;
|
|
deny-json) printf '{"hookSpecificOutput":{"hookEventName":"PreToolUse","permissionDecision":"deny","permissionDecisionReason":"PROBE-GATE: write is denied by policy (JSON)"}}\n'; exit 0 ;;
|
|
crash) echo "PROBE-GATE crashed (exit 1)" >&2; exit 1 ;;
|
|
crash3) echo "PROBE-GATE crashed (exit 3)" >&2; exit 3 ;;
|
|
hang) sleep 60; echo "PROBE-GATE: blocked after sleeping 60 s" >&2; exit 2 ;;
|
|
hangterm) trap '' TERM; sleep 60; echo "PROBE-GATE: blocked after ignoring SIGTERM for 60 s" >&2; exit 2 ;;
|
|
hang700) sleep 700; echo "PROBE-GATE: blocked after sleeping 700 s" >&2; exit 2 ;;
|
|
*) echo "unknown mode $mode" >&2; exit 1 ;;
|
|
esac
|