H3 (Husky pre-commit): reject a staged root-level *.png — belt-and-suspenders with the .gitignore screenshot rule so `git add -f` still can't land a review artifact. H9 (append-only decisions.md): new shared hook `.claude/hooks/decisions-guard.sh`, wired into Husky commit-msg (staged mode) and a new blocking `decisions-guard` CI job (range mode). Blocks any commit/PR that deletes or modifies an existing line of docs/decisions.md — detected via `git diff --numstat` deleted-count, robust to markdown `-` list markers — unless the message carries the `[decisions-edit]` token. Pure insertions (a normal new entry) always pass. One implementation for local + CI so they can't drift. Fail-open on any tooling trouble. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
16 lines
716 B
Plaintext
Executable File
16 lines
716 B
Plaintext
Executable File
# Enforce the CLAUDE.md protocol: every commit message must carry a Co-Authored-By
|
|
# trailer. Merge commits are exempt (their MERGE_MSG has no trailer and shouldn't be
|
|
# rewritten).
|
|
if git rev-parse -q --verify MERGE_HEAD >/dev/null 2>&1; then
|
|
exit 0
|
|
fi
|
|
grep -q '^Co-Authored-By:' "$1" || {
|
|
echo 'husky - commit message missing Co-Authored-By trailer'
|
|
exit 1
|
|
}
|
|
|
|
# H9 (ersatztv#303) — docs/decisions.md is append-only. Block a commit that rewrites a settled
|
|
# entry unless the message carries [decisions-edit]. commit-msg runs after the index is final, so
|
|
# the staged diff is what's being committed; the message file ($1) supplies the override token.
|
|
./.claude/hooks/decisions-guard.sh staged "$1" || exit 1
|