#!/usr/bin/env bash
H=/home/user/.claude/hooks/quietcontext-nudge.sh
run(){ jq -nc --arg c "$1" '{tool_name:"Bash",tool_input:{command:$c}}' | "$H" | grep -q deny && echo DENY || echo ALLOW; }
declare -a T=(
"DENY|grep -rn TODO ."
"DENY|find . -name '*.ts'"
"DENY|grep -r useState src/"
"DENY|git ls-files"
"DENY|cat src/*.ts"
"DENY|ls -R ."
"DENY|find . -name '*.ts' | sort"
"DENY|find . -type f -name '*.md' | xargs grep -l draft"
"ALLOW|find . -name '*.ts' | xargs wc -l | sort -rn | head -5"
"ALLOW|grep -rn TODO --include='*.js' . | wc -l"
"ALLOW|ls *.md | head -3"
"ALLOW|git ls-files | head"
"ALLOW|find . -name '*.ts' | sed -n '1,20p'"
"ALLOW|grep -rn TODO . | awk 'NR<=5'"
"ALLOW|grep -rc TODO src/"
"ALLOW|git ls-files | wc -l"
"ALLOW|find . -name '*.log' -delete"
"ALLOW|git status --short"
"ALLOW|npm run build"
"ALLOW|cat package.json"
"ALLOW|grep -rn TODO . # raw-ok"
"ALLOW|git ls-files | xargs sed -i 's/a/b/g'"
)
p=0;f=0
for t in "${T[@]}"; do
  exp="${t%%|*}"; cmd="${t#*|}"; got=$(run "$cmd")
  if [[ "$exp" == "$got" ]]; then p=$((p+1)); else f=$((f+1)); printf 'FAIL exp=%s got=%s :: %s\n' "$exp" "$got" "$cmd"; fi
done
echo "pass=$p fail=$f"
