Files
harness/scripts/hooks/commit-msg
T
sausheong e10c8d2119 Add a commit-msg hook that rejects AI attribution trailers
Enable per clone with: git config core.hooksPath scripts/hooks
2026-10-03 19:28:07 +08:00

11 lines
536 B
Bash
Executable File

#!/bin/sh
# Rejects commit messages carrying AI attribution: Claude/Anthropic
# co-author trailers or "Generated with Claude Code" lines.
# Install once per clone: git config core.hooksPath scripts/hooks
if grep -v '^#' "$1" | grep -Eiq '^[[:space:]]*co-authored-by:.*(claude|anthropic)|generated (with|by) (\[)?claude'; then
echo "commit-msg: remove the AI attribution line from the commit message:" >&2
grep -v '^#' "$1" | grep -Ein '^[[:space:]]*co-authored-by:.*(claude|anthropic)|generated (with|by) (\[)?claude' >&2
exit 1
fi