Skip to content

Commit 7d13167

Browse files
committed
chore: strip Co-authored-by trailers in lefthook hooks
1 parent 64ee464 commit 7d13167

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

lefthook.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,3 +110,18 @@ commit-msg:
110110
echo " full guide: https://www.conventionalcommits.org/"
111111
exit 1
112112
fi
113+
114+
strip-co-authored-by:
115+
run: |
116+
# Strip Co-authored-by: trailers that AI tools (Claude, Cursor, etc.) add.
117+
# This enforces the rule that commits list only the human author.
118+
sed '/^[Cc]o-[Aa]uthored-[Bb]y:/d' "{1}" > "{1}.tmp" && mv "{1}.tmp" "{1}"
119+
120+
# ---------------------------------------------------------------------------
121+
# prepare-commit-msg — strip AI co-author trailers after tools inject them.
122+
# ---------------------------------------------------------------------------
123+
prepare-commit-msg:
124+
commands:
125+
strip-co-authored-by:
126+
run: |
127+
sed '/^[Cc]o-[Aa]uthored-[Bb]y:/d' "{1}" > "{1}.tmp" && mv "{1}.tmp" "{1}"

0 commit comments

Comments
 (0)