Files
sprite-catalog/.githooks/commit-msg
T

32 lines
979 B
Bash

#!/bin/sh
#
# Refuses AI attribution in commit messages.
#
# This repo is public, so history is the first thing an outside contributor
# sees. Attribution cannot be removed retroactively without rewriting every
# commit after it, and clones have already copied it.
#
# Enable after cloning:
#
# git config core.hooksPath .githooks
# chmod +x .githooks/commit-msg
#
# The Gitea web API cannot set the executable bit, so the chmod is required
# on first clone even though the file is committed.
msg_file="$1"
# Co-author trailers naming an assistant.
if grep -qiE 'co-?authored-?by:[[:space:]]*.*(claude|anthropic|copilot|cursor|codex|chatgpt|gpt-|gemini|aider|devin|llm|\bai\b)' "$msg_file"; then
echo "REFUSED: AI co-author trailer in commit message." >&2
exit 1
fi
# Generated-with footers and the robot emoji.
if grep -qiE 'generated with|written by (claude|an? ai)|🤖' "$msg_file"; then
echo "REFUSED: AI attribution in commit message." >&2
exit 1
fi
exit 0