#!/bin/bash # Debug hook to verify hooks are being called LOG_FILE="/tmp/claude_monitor_debug.log" # Log timestamp and hook name echo "=== $(date) ===" >> "$LOG_FILE" echo "Hook called from: ${BASH_SOURCE[0]}" >> "$LOG_FILE" # Read input INPUT=$(cat) echo "Input received: $INPUT" >> "$LOG_FILE" # Check config file if [ -f ~/.claude/monitor_url ]; then MONITOR_URL=$(cat ~/.claude/monitor_url) echo "Config file found: $MONITOR_URL" >> "$LOG_FILE" else MONITOR_URL="${CLAUDE_MONITOR_URL:-http://localhost:8000}" echo "Using env/default: $MONITOR_URL" >> "$LOG_FILE" fi # Test backend connectivity echo "Testing connectivity to: $MONITOR_URL/health" >> "$LOG_FILE" RESPONSE=$(curl -s -w "\nHTTP_CODE:%{http_code}" --connect-timeout 2 "$MONITOR_URL/health" 2>&1) echo "Response: $RESPONSE" >> "$LOG_FILE" echo "" >> "$LOG_FILE" # Pass through to actual hook if this is being tested exit 0