diff --git a/scripts/hooks/commit-msg b/scripts/hooks/commit-msg new file mode 100755 index 0000000..d12127b --- /dev/null +++ b/scripts/hooks/commit-msg @@ -0,0 +1,10 @@ +#!/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