Something went wrong. Try again.
A free/open-source launcher and vehicle-data platform for aftermarket Android head units.
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657#!/usr/bin/env bash# commit-msg hook: enforce the Human Voice policy on commit messages.## allow Signed-off-by: Jane Doe <jane@example.com> (required, DCO)# allow Co-Authored-By: Jane Doe <jane@example.com> (human pair)# reject Co-Authored-By: Claude <noreply@anthropic.com># reject "Generated with Claude Code", "🤖 Generated", etc.## See AI_POLICY.md and CONTRIBUTING.md#commits.## Install: ln -sf ../../scripts/hooks/commit-msg .git/hooks/commit-msgset -uo pipefail
MSG_FILE="${1:-}"[ -n "$MSG_FILE" ] && [ -f "$MSG_FILE" ] || exit 0
# Strip comment lines, as git does.BODY=$(grep -v '^#' "$MSG_FILE" | sed '/^[[:space:]]*$/d')
# Nothing to check (e.g. an empty commit message that another hook will reject).[ -n "$BODY" ] || exit 0
# Merges and reverts carry their own generated shapes.case "$BODY" in Merge\ *|Revert\ *) exit 0 ;;esac
AI_NAMES='claude|copilot|chatgpt|gpt-[0-9]|openai|anthropic|gemini|bard|cursor|windsurf|codeium|codex|devin|aider|tabnine|sourcegraph|continue\.dev|\[bot\]|noreply@anthropic|noreply@openai'
fail=0
if echo "$BODY" | grep -qiE "^[[:space:]]*co-authored-by:.*($AI_NAMES)"; then printf 'commit-msg: AI co-author trailer is not allowed.\n' printf ' Your name on the commit is the whole attribution (AI_POLICY.md).\n' fail=1fi
if echo "$BODY" | grep -qiE "(generated (with|by)|written (with|by)|assisted by|powered by)[[:space:]:]+.*($AI_NAMES|claude|copilot)"; then printf 'commit-msg: tool attribution footer is not allowed (AI_POLICY.md).\n' fail=1fi
if echo "$BODY" | grep -q $'\xf0\x9f\xa4\x96'; then printf 'commit-msg: robot-emoji signature is not allowed (AI_POLICY.md).\n' fail=1fi
if ! echo "$BODY" | grep -qE "^[[:space:]]*Signed-off-by: .+ <.+@.+>"; then printf 'commit-msg: missing DCO sign-off.\n' printf ' Use: git commit -s (adds Signed-off-by: Your Name <email>)\n' printf ' See LICENSING.md#contributing-the-dco.\n' fail=1fi
[ "$fail" -eq 0 ] || exit 1exit 0