diff --git a/lefthook.yml b/lefthook.yml index 211156e44..d193d5b25 100644 --- a/lefthook.yml +++ b/lefthook.yml @@ -16,6 +16,24 @@ # Per project policy (`--no-verify` is banned), prefer fixing the # finding over bypassing the hook. +# Commit-message guard: the project voice rule (CLAUDE.md, "Voice and +# privacy") states that commits are authored by the maintainer's git +# identity alone and carry no tooling co-author trailer or session link. +# Editors and CLIs add those trailers by default, and a message that +# picks one up is only removable from the object store by a history +# rewrite — so the check belongs here, before the commit exists, not in +# a review pass afterwards. +commit-msg: + commands: + no-tooling-trailer: + run: | + if grep -qiE '^(Co-Authored-By:.*(claude|anthropic|copilot|gpt|gemini)|Claude-Session:|Generated with)' "{1}"; then + echo "ERROR: the commit message carries a tooling co-author trailer or session link." >&2 + echo "Project policy: commits are authored by the maintainer's git identity alone." >&2 + echo "Remove the offending line(s) from the message and commit again." >&2 + exit 1 + fi + pre-commit: commands: gitleaks: