Root cause fix for AI agent failing to commit/push automatically: 1. Added Task Completion Checklist to AGENTS.md with mandatory items: - All requested work implemented - Changes staged (git add) - Changes committed (conventional format) - Changes pushed (git push) - STATUS.md updated (if applicable) - JOURNAL.md updated (if applicable) 2. Added pre-push hook in .githooks/ (tracked, not .git/hooks/): - Blocks push if uncommitted changes exist - Safety net if checklist is skipped 3. Fixed .gitignore: changed "vendor/" to "vendor" to also ignore symlink After cloning, run: git config core.hooksPath .githooks 💘 Generated with Crush Assisted-by: GLM-5 via Crush <crush@charm.land>
26 lines
634 B
Bash
Executable File
26 lines
634 B
Bash
Executable File
#!/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 <files>"
|
|
echo " git commit -m '<type>: <message>'"
|
|
echo " git push"
|
|
echo ""
|
|
exit 1
|
|
fi
|
|
|
|
exit 0
|