#!/bin/bash # Pre-commit hook to automatically comment out volume mounts in docker-compose.override.yaml # This prevents accidental commits of local development configuration echo "🔍 Checking docker-compose.override.yaml for uncommented volume mounts..." OVERRIDE_FILE="docker-compose.override.yaml" if [ ! -f "$OVERRIDE_FILE" ]; then exit 0 fi # Check if there are any uncommented volume mounts if grep -E "^\s*-\s+\.\./minor-projects/" "$OVERRIDE_FILE" > /dev/null; then echo "âš ī¸ Found uncommented volume mounts in $OVERRIDE_FILE" echo "🔧 Automatically commenting them out..." # Create backup cp "$OVERRIDE_FILE" "${OVERRIDE_FILE}.backup" # Comment out the volume mounts sed -i.tmp 's/^\(\s*\)-\s\+\.\./\1# - \.\./' "$OVERRIDE_FILE" rm "${OVERRIDE_FILE}.tmp" 2>/dev/null || true # Re-stage the fixed file git add "$OVERRIDE_FILE" echo "✅ Volume mounts have been commented out automatically" echo "💡 Your local copy has been backed up to ${OVERRIDE_FILE}.backup" echo "💡 Use docker-compose.local.yaml for local development overrides" echo "" fi # Check for modified agent identity files echo "" echo "🤖 Checking modified agent identity files..." AGENTS_DIR=".cursor/agents" MODIFIED_AGENTS=$(git diff --cached --name-only --diff-filter=ACM | grep "^${AGENTS_DIR}/.*\.agent\.md$" || true) if [ -n "$MODIFIED_AGENTS" ]; then echo "📝 Found modified agent files, running quick validation..." if ! bash scripts/agent-identities/lint-agents-quick.sh > /dev/null 2>&1; then echo "❌ Agent identity validation failed!" echo "💡 Run 'cd testing/container-testing && make lint-agents' for detailed errors" exit 1 fi echo "✅ Agent identity validation passed" else echo "â„šī¸ No agent identity files modified" fi echo "" echo "✅ Pre-commit validation passed"