Complete real-time monitoring dashboard for Claude Code Features: - FastAPI backend with REST API and WebSocket - React + TypeScript frontend with dark theme - SQLite database for event storage - 6 hook scripts for Claude Code events - Docker deployment setup - Real-time event tracking and statistics - Event filtering (ALL, TOOLS, AGENTS, PROMPTS, SESSIONS) - Connection status indicator - Reset stats functionality Tech Stack: - Backend: Python 3.11, FastAPI, SQLAlchemy, WebSockets - Frontend: React 18, TypeScript, Vite - Database: SQLite - Deployment: Docker, Docker Compose 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
89 lines
2.1 KiB
Bash
Executable File
89 lines
2.1 KiB
Bash
Executable File
#!/bin/bash
|
|
# Installation script for Claude Code Monitor hooks
|
|
|
|
set -e
|
|
|
|
echo "Claude Code Monitor - Hook Installation Script"
|
|
echo "================================================"
|
|
echo ""
|
|
|
|
# Get the absolute path to this project
|
|
PROJECT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
HOOKS_DIR="$PROJECT_DIR/.claude/hooks"
|
|
|
|
# Target hooks directory (user's home Claude config)
|
|
TARGET_DIR="$HOME/.claude/hooks"
|
|
|
|
# Create target directory if it doesn't exist
|
|
echo "Creating hooks directory at $TARGET_DIR..."
|
|
mkdir -p "$TARGET_DIR"
|
|
|
|
# Copy all hook scripts
|
|
echo "Installing hook scripts..."
|
|
for hook in pre_tool_use post_tool_use session_start session_end subagent_stop user_prompt; do
|
|
echo " - Installing ${hook}.sh..."
|
|
cp "$HOOKS_DIR/${hook}.sh" "$TARGET_DIR/${hook}.sh"
|
|
chmod +x "$TARGET_DIR/${hook}.sh"
|
|
done
|
|
|
|
echo ""
|
|
echo "Hook scripts installed successfully!"
|
|
echo ""
|
|
echo "Next steps:"
|
|
echo "==========="
|
|
echo ""
|
|
echo "1. Add the following configuration to your ~/.claude/settings.json:"
|
|
echo ""
|
|
cat << EOF
|
|
{
|
|
"hooks": {
|
|
"PreToolUse": [{
|
|
"matcher": "*",
|
|
"hooks": [{
|
|
"type": "command",
|
|
"command": "$TARGET_DIR/pre_tool_use.sh"
|
|
}]
|
|
}],
|
|
"PostToolUse": [{
|
|
"matcher": "*",
|
|
"hooks": [{
|
|
"type": "command",
|
|
"command": "$TARGET_DIR/post_tool_use.sh"
|
|
}]
|
|
}],
|
|
"SessionStart": [{
|
|
"hooks": [{
|
|
"type": "command",
|
|
"command": "$TARGET_DIR/session_start.sh"
|
|
}]
|
|
}],
|
|
"SessionEnd": [{
|
|
"hooks": [{
|
|
"type": "command",
|
|
"command": "$TARGET_DIR/session_end.sh"
|
|
}]
|
|
}],
|
|
"SubagentStop": [{
|
|
"hooks": [{
|
|
"type": "command",
|
|
"command": "$TARGET_DIR/subagent_stop.sh"
|
|
}]
|
|
}],
|
|
"UserPromptSubmit": [{
|
|
"hooks": [{
|
|
"type": "command",
|
|
"command": "$TARGET_DIR/user_prompt.sh"
|
|
}]
|
|
}]
|
|
}
|
|
}
|
|
EOF
|
|
echo ""
|
|
echo "2. Start the Claude Code Monitor backend:"
|
|
echo " cd $PROJECT_DIR && docker-compose up -d"
|
|
echo ""
|
|
echo "3. Open the dashboard in your browser:"
|
|
echo " http://localhost:3000"
|
|
echo ""
|
|
echo "Installation complete!"
|