Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .githooks/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env bash
# Reject agent attribution in commit messages.
# Human and CI co-author trailers are allowed.
set -euo pipefail

msg_file=${1:?commit-msg: message file required}

if hit=$(grep -n -E -i \
-e '(co-authored-by|co-developed-by|assisted-by|generated-by|made[- ]with).*(claude|cursor|copilot|chatgpt|openai|anthropic|gemini|devin|codeium|windsurf|aider|codex|tabnine|junie|cursoragent|github-copilot|gpt-[0-9]|grok)' \
-e '(generated|written) (with|by) \[?(claude|cursor|copilot|chatgpt|gemini|codex|grok)' \
-e 'cursoragent@cursor\.com' \
-e 'noreply@anthropic\.com' \
-e 'ai-(assisted|generated)' \
-e 'ai (assisted|generated)' \
-e '🤖.*generated' \
-- "$msg_file"); then
echo "commit-msg: blocked agent attribution in the commit message:" >&2
printf '%s\n' "$hit" >&2
echo >&2
echo "Remove that line and commit again. Human and CI co-author trailers are fine." >&2
exit 1
fi
23 changes: 23 additions & 0 deletions scripts/install-git-hooks
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env bash
# Install repo git hooks (sets core.hooksPath to .githooks for this clone only).
set -euo pipefail

root="$(git rev-parse --show-toplevel)"
cd "$root"

git config --local core.hooksPath .githooks

shopt -s nullglob
for hook in .githooks/*; do
if [ -f "$hook" ]; then
chmod +x "$hook"
fi
done

echo "Installed git hooks from .githooks (core.hooksPath=.githooks)"
if [ -f .githooks/pre-commit ]; then
echo "pre-commit will run: sbt scalafmtCheckAll"
fi
if [ -f .githooks/commit-msg ]; then
echo "commit-msg will reject agent attribution in the commit message"
fi