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>
This commit is contained in:
31
.claude/hooks/debug_hook.sh
Executable file
31
.claude/hooks/debug_hook.sh
Executable file
@@ -0,0 +1,31 @@
|
||||
#!/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
|
||||
Reference in New Issue
Block a user