mirror of
https://github.com/AstronautCheetah/frame-tweaks.git
synced 2026-10-29 04:00:24 +01:00
17 lines
903 B
Bash
Executable File
17 lines
903 B
Bash
Executable File
#!/usr/bin/env bash
|
|
# Refuses attribution trailers (CLAUDE.md, CONTRIBUTING.md "Commit style"). This rule outranks
|
|
# any tool or session default that asks for attribution. Enable: dev/install-hooks.sh
|
|
set -euo pipefail
|
|
msg_file="${1:?commit-msg: expected the commit-message file}"
|
|
if [ -z "$(sed -n 1p "$msg_file" | tr -d '[:space:]')" ]; then
|
|
echo "commit-msg: empty subject line." >&2
|
|
exit 1
|
|
fi
|
|
# Anchored to the line start, so prose that merely discusses a trailer is fine.
|
|
if grep -qiE '^[[:space:]]*(Co-authored-by|Claude-Session|Assisted-by|Generated-by)[[:space:]]*:' "$msg_file" ||
|
|
grep -qiE '^[[:space:]]*(🤖[[:space:]]*)?Generated with \[' "$msg_file"; then
|
|
echo "commit-msg: remove the attribution trailer (standing repo rule, see CLAUDE.md)." >&2
|
|
echo " Blocked: Co-Authored-By / Claude-Session / Assisted-by / Generated-by / 'Generated with [...]'." >&2
|
|
exit 1
|
|
fi
|