#!/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 # # The executable bit is committed (mode 100755), so a clone gets a runnable # hook. Git still will not enable a repo's hooks on its own — deliberately, so # that cloning cannot execute code from the remote — hence the one command. 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