#!/bin/bash
# try.sh <agent_type|-> <command>: pipes the guard the JSON shape Claude Code sends a PreToolUse
# hook for a Bash call (tool_name, tool_input.command, agent_type) and prints ALLOW or BLOCK.
agent="$1"; cmd="$2"
json=$(jq -nc --arg a "$agent" --arg c "$cmd" \
  '{hook_event_name:"PreToolUse", tool_name:"Bash", tool_input:{command:$c}} + (if $a == "-" then {} else {agent_type:$a} end)')
echo "$json" | .claude/hooks/reviewer-bash-guard.sh 2>/dev/null; code=$?
if [ $code -eq 0 ]; then echo "ALLOW   $cmd"; else echo "BLOCK   $cmd   (exit $code)"; fi
