#!/bin/bash # # Pre-push hook: Prevents push if uncommitted changes exist # This is a safety net to ensure AI agents commit their work # # Check for uncommitted changes if [[ -n $(git status --porcelain 2>/dev/null) ]]; then echo "" echo "ERROR: Uncommitted changes detected!" echo "" echo "Per AGENTS.md policy, AI agents MUST commit changes before stopping work." echo "" echo "Uncommitted files:" git status --short echo "" echo "Run the following before push:" echo " git add " echo " git commit -m ': '" echo " git push" echo "" exit 1 fi exit 0