Files
claude-code-monitor/.claude/hooks/debug_hook.sh
felix.zoesch 78d4a9d3c0 Add diagnostic tools for hook debugging
Added two helper scripts:
- debug_hook.sh: Logs hook calls and connectivity tests
- diagnose.sh: Comprehensive diagnostic tool for troubleshooting

The diagnose script checks:
- Config file existence and content
- Backend connectivity
- Hook installation and permissions
- Manual hook testing
- settings.json configuration
- Debug logs

Usage: bash .claude/hooks/diagnose.sh

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-16 08:18:18 +01:00

32 lines
903 B
Bash
Executable File

#!/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