chore: make the commit-message check name no product

The commit-msg hook listed the tools and the session link format it
refused, so the file read as a description of how commits are written.
It now states the rule: commits are authored by the maintainer's
identity, and a co-author trailer is only for a contributor. It refuses
a generator line, any "<Word>-Session:" trailer and a co-author trailer
whose address is not a GitHub noreply address, so a contributor's
credit still passes.
This commit is contained in:
Marc-André Bombeck committed 2026-11-12 15:15:35 +01:00
1 parent 7dd251184f
commit 5b5b5fcc03
1 file changed
+13 -5
+13 -5
View File
@@ -16,14 +16,22 @@
# Per project policy (`--no-verify` is banned), prefer fixing the
# finding over bypassing the hook.
# Reject tool attribution trailers.
# Commit messages. Commits are authored by the maintainer's git identity;
# a co-author trailer is only for a contributor whose work is in the
# commit, under their GitHub noreply address. A message is refused when it
# carries a "Generated with" / "Generated by" line, a "<Word>-Session:"
# trailer, or a co-author trailer with any other address.
commit-msg:
commands:
no-tooling-trailer:
message-trailers:
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
msg="{1}"
if grep -qiE '^[^[:alnum:]]*Generated (with|by)[[:space:]]' "$msg" ||
grep -qiE '^[[:alpha:]]+-Session:' "$msg" ||
grep -iE '^Co-authored-by:' "$msg" |
grep -qviE '<[^<>[:space:]]+@users\.noreply\.github\.com>[[:space:]]*$'; then
echo "ERROR: the commit message carries a generator line, a session trailer," >&2
echo "or a co-author trailer without a GitHub noreply address." >&2
echo "Remove the offending line(s) from the message and commit again." >&2
exit 1
fi