Files
Claude-Code-Game-Studios/.claude/hooks/notify.sh
Donchitos 763ad1f0d1 Add notification hook, directory CLAUDE.md scaffolding
- Wire Notification event in settings.json to new notify.sh hook
- notify.sh: Windows toast notifications via PowerShell balloon tip
- docs/CLAUDE.md: authoring standards for ADRs, TR registry, control manifest, engine reference
- design/CLAUDE.md: GDD directory guidance placeholder
- src/: scaffold with .gitkeep and CLAUDE.md authoring guide

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-16 20:17:53 +11:00

36 lines
1.2 KiB
Bash

#!/usr/bin/env bash
# Notification hook — fires when Claude Code sends a notification
# Shows a Windows toast via PowerShell
# Read notification JSON from stdin
INPUT=$(cat)
# Extract message — try jq first, fall back to grep
if command -v jq &>/dev/null; then
MESSAGE=$(echo "$INPUT" | jq -r '.message // empty' 2>/dev/null)
fi
if [ -z "$MESSAGE" ]; then
MESSAGE=$(echo "$INPUT" | grep -oE '"message":"[^"]*"' | sed 's/"message":"//;s/"//')
fi
if [ -z "$MESSAGE" ]; then
MESSAGE="Claude Code needs your attention"
fi
# Sanitize message for PowerShell string embedding (escape single quotes)
MESSAGE_SAFE=$(echo "$MESSAGE" | sed "s/'/''/g" | head -c 200)
# Show Windows balloon tip notification (works on all Windows 10/11 without extra modules)
powershell.exe -NonInteractive -WindowStyle Hidden -Command "
Add-Type -AssemblyName System.Windows.Forms
\$notify = New-Object System.Windows.Forms.NotifyIcon
\$notify.Icon = [System.Drawing.SystemIcons]::Information
\$notify.BalloonTipTitle = 'Claude Code'
\$notify.BalloonTipText = '$MESSAGE_SAFE'
\$notify.Visible = \$true
\$notify.ShowBalloonTip(5000)
Start-Sleep -Seconds 6
\$notify.Dispose()
" 2>/dev/null &
echo "Notification: $MESSAGE_SAFE"