From 907154223963d2971878f07b5c2c1951ed7070a4 Mon Sep 17 00:00:00 2001 From: Brent Miller Date: Wed, 11 Nov 2026 08:33:55 -0600 Subject: [PATCH] fix(tooling): stop a duplicate co-author trailer in commits scripts/internal/commit.sh appends `Co-Authored-By: Claude` itself. A trailer written into the message therefore shipped twice. The script now appends only when the message carries no trailer. AGENTS.md states the rule, and scripts/README.md describes the new behavior. Co-Authored-By: Claude --- AGENTS.md | 4 ++++ scripts/README.md | 2 +- scripts/internal/commit.sh | 9 +++++++-- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index ee28bbb8..910ef04d 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -149,6 +149,10 @@ Apply these questions before you settle a design, and again in review. - Write commit messages in the imperative mood with a concise summary. - Never put an email address in a commit message. No `noreply@` address. No email in any trailer. A `user@example.com` placeholder is allowed. +- Never write a `Co-Authored-By` trailer in a commit message. + `scripts/internal/commit.sh` appends `Co-Authored-By: Claude` itself, so a + hand-written trailer ships as a duplicate line. [duplicate trailer, + PR #150] - Name branches `feature/`, `fix/`, or `refactor/`. - Squash all local commits before push. Ship one clean commit per PR. - Run `scripts/status.sh` before staging. A file staged, added, or removed diff --git a/scripts/README.md b/scripts/README.md index 7689057a..0107585a 100644 --- a/scripts/README.md +++ b/scripts/README.md @@ -113,7 +113,7 @@ These are invoked by skills and agents only — not intended for direct use: | ------------------------------------ | ------------------------------------------------------------------------------------------ | | `internal/analyzer-release-check.sh` | Validate analyzer release files (Unshipped/Shipped) against source DiagnosticId constants | | `internal/analyzer-promote.sh` | Move Unshipped rule rows into a new Shipped release section | -| `internal/commit.sh` | Commit helper: blocks emails in the message, appends a name-only co-author trailer | +| `internal/commit.sh` | Commit helper: blocks emails, adds a name-only co-author trailer unless one is present | | `internal/cr-diff-deliver.sh` | Decide code-review diff delivery mode by size: inline (≤30KB), write (30-40KB), or split (>40KB) | | `internal/cr-target.sh` | Resolve a code-review target to base, changed files, and the reviewers to run | | `internal/mechanical-diff.sh` | Classify each changed file in the working diff as MECHANICAL (namespace rename) or SUBSTANTIVE | diff --git a/scripts/internal/commit.sh b/scripts/internal/commit.sh index e01e61e0..46005892 100755 --- a/scripts/internal/commit.sh +++ b/scripts/internal/commit.sh @@ -42,7 +42,12 @@ if [[ "$SKIP_PRECOMMIT" == false ]]; then fi fi -# Commit with the message plus a name-only co-author trailer (no email — global privacy rule) -git commit -m "$MSG" -m "$COAUTHOR_TRAILER" +# Commit with the message plus a name-only co-author trailer (no email — global privacy rule). +# Skip the append when the message already carries a trailer, so it never ships twice. +if printf '%s\n' "$MSG" | rg -qi '^Co-Authored-By:'; then + git commit -m "$MSG" +else + git commit -m "$MSG" -m "$COAUTHOR_TRAILER" +fi ok "Committed: $MSG"