#!/bin/bash # Git pre-commit hook - Auto-update dashboard before commit # # Installation: # cp .githooks/pre-commit .git/hooks/pre-commit # chmod +x .git/hooks/pre-commit # Check if any demo files are being committed demo_changes=$(git diff --cached --name-only | grep -E "(threejs_viz|sdg_viz|src|src_infinite|src_group).*\.html$") if [ -n "$demo_changes" ]; then echo "🔍 Demo files detected in commit..." echo "🔄 Regenerating dashboard..." # Regenerate dashboard python3 generate_index.py # Check if index.html was modified if git diff --name-only | grep -q "index.html"; then echo "✅ Dashboard updated - staging index.html" git add index.html else echo "â„šī¸ Dashboard already up to date" fi else echo "â„šī¸ No demo files in commit - skipping dashboard update" fi exit 0