mirror of
https://github.com/jacobinwwey/obsidian-NotEMD.git
synced 2026-07-22 12:40:25 +00:00
Implements multi-layer protection against bot-related commit pollution: Prevention Layer: - pre-commit hook: blocks commits with bot author names/emails - commit-msg hook: blocks commit messages mentioning bots - Validates author configuration before allowing commits Detection Layer: - verify-author.sh: checks current git configuration - ci-verify-authorship.sh: CI validation for last 10 commits - Scans for patterns: claude, bot, assistant, AI, anthropic Cleanup Layer: - clean-bot-commits.sh: rewrites history to remove bot commits - Creates backup branch before rewriting - Interactive prompts for safety Documentation: - GIT_AUTHOR_HYGIENE.md: quick start guide - docs/maintainer/git-author-hygiene.md: comprehensive reference - Troubleshooting and best practices Protection scope: - Author name validation - Author email validation - Commit message content filtering - CI/CD enforcement Current status: ✓ Last 100 commits verified clean (all by Jacobinwwey) Files: .git/hooks/pre-commit (executable) .git/hooks/commit-msg (executable) scripts/verify-author.sh (executable) scripts/clean-bot-commits.sh (executable) scripts/ci-verify-authorship.sh (executable) GIT_AUTHOR_HYGIENE.md docs/maintainer/git-author-hygiene.md WORK_SUMMARY_2026-06-23.md Testing: All hooks tested and working correctly
53 lines
1.3 KiB
Bash
Executable file
53 lines
1.3 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
# Verify git author configuration before committing
|
|
|
|
set -e
|
|
|
|
author_name=$(git config user.name)
|
|
author_email=$(git config user.email)
|
|
|
|
echo "Git Author Verification"
|
|
echo "======================="
|
|
echo ""
|
|
echo "Current configuration:"
|
|
echo " Name: $author_name"
|
|
echo " Email: $author_email"
|
|
echo ""
|
|
|
|
# Check for bot-related patterns
|
|
issues=()
|
|
|
|
if echo "$author_name" | grep -iE "(claude|bot|assistant|AI)" > /dev/null; then
|
|
issues+=("❌ Author name contains bot-related terms")
|
|
fi
|
|
|
|
if echo "$author_email" | grep -iE "(claude|bot|anthropic|ai-assistant)" > /dev/null; then
|
|
issues+=("❌ Author email contains bot-related terms")
|
|
fi
|
|
|
|
if [ -z "$author_name" ]; then
|
|
issues+=("❌ Author name is not set")
|
|
fi
|
|
|
|
if [ -z "$author_email" ]; then
|
|
issues+=("❌ Author email is not set")
|
|
fi
|
|
|
|
if [ ${#issues[@]} -gt 0 ]; then
|
|
echo "Issues found:"
|
|
for issue in "${issues[@]}"; do
|
|
echo " $issue"
|
|
done
|
|
echo ""
|
|
echo "Fix with:"
|
|
echo " git config user.name 'Your Real Name'"
|
|
echo " git config user.email 'your.email@example.com'"
|
|
echo ""
|
|
echo "Or set globally:"
|
|
echo " git config --global user.name 'Your Real Name'"
|
|
echo " git config --global user.email 'your.email@example.com'"
|
|
exit 1
|
|
else
|
|
echo "✓ Author configuration looks good!"
|
|
exit 0
|
|
fi
|