Files
daniel 65207a5200 feat(hooks): add plan-mode-game hook component
Adds a browser game (Dino Runner, Snake, Flappy Bird) that launches
automatically when Claude enters Plan Mode. Users can play while
Claude thinks, with a live activity panel showing tool calls in real time.

- EnterPlanMode / /plan → starts Node.js server on port 3456, opens browser
- Read/Bash/Edit/etc → streams tool activity to the activity panel
- Write to ~/.claude/plans/ → also triggers the game (for /plan command)
- AskUserQuestion → pauses the game until user responds
- ExitPlanMode → shows "Claude Termino!" overlay with confetti

Features: 3 games with high score persistence, signed score sharing URLs,
pause overlay when Claude needs input, activity feed with tool icons.
Requires Node.js and curl. macOS only (uses 'open' command).
Install globally in ~/.claude/settings.json to work across all projects.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-13 14:21:04 -04:00

36 lines
772 B
Bash

#!/bin/bash
# Start dino game server and open browser
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
PID_FILE="$SCRIPT_DIR/server.pid"
FLAG="$SCRIPT_DIR/.plan-active"
PORT=3456
# Create plan-active flag
touch "$FLAG"
# Check if server is already running
if [ -f "$PID_FILE" ]; then
PID=$(cat "$PID_FILE")
if kill -0 "$PID" 2>/dev/null; then
# Server running, just open browser
open "http://localhost:$PORT" 2>/dev/null
exit 0
else
rm -f "$PID_FILE"
fi
fi
# Start server in background
nohup node "$SCRIPT_DIR/server.js" > /dev/null 2>&1 &
# Wait for server to be ready
for i in {1..20}; do
if curl -s "http://localhost:$PORT/health" > /dev/null 2>&1; then
break
fi
sleep 0.1
done
# Open browser
open "http://localhost:$PORT" 2>/dev/null