Skip to content

Commit 4ba06ed

Browse files
committed
chore: stop default AI co-author trailers
1 parent 6a6a15c commit 4ba06ed

5 files changed

Lines changed: 13 additions & 78 deletions

File tree

.githooks/commit-msg

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -15,28 +15,6 @@ if [[ -z "$ROOT_DIR" || ! -d "$ROOT_DIR" ]]; then
1515
exit 0
1616
fi
1717

18-
ensure_trailer_block() {
19-
local file="$1"
20-
shift
21-
local missing=()
22-
local line
23-
24-
for line in "$@"; do
25-
if ! grep -Fqx "$line" "$file"; then
26-
missing+=("$line")
27-
fi
28-
done
29-
30-
if [[ ${#missing[@]} -eq 0 ]]; then
31-
return 0
32-
fi
33-
34-
printf '\n' >>"$file"
35-
for line in "${missing[@]}"; do
36-
printf '%s\n' "$line" >>"$file"
37-
done
38-
}
39-
4018
upsert_trailer() {
4119
local file="$1"
4220
local key="$2"
@@ -72,13 +50,6 @@ upsert_trailer() {
7250
printf '\n%s: %s\n' "$key" "$value" >>"$file"
7351
}
7452

75-
if [[ "${SOPIFY_DISABLE_AI_ATTRIBUTION:-0}" != "1" ]]; then
76-
ensure_trailer_block \
77-
"$MESSAGE_FILE" \
78-
"Co-authored-by: Claude <claude@anthropic.com>" \
79-
"Co-authored-by: ChatGPT <chatgpt@openai.com>"
80-
fi
81-
8253
STATE_FILE="$(git -C "$ROOT_DIR" rev-parse --git-path .sopify-release-sync-state)"
8354

8455
if [[ ! -f "$STATE_FILE" ]]; then

CONTRIBUTING.md

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -98,21 +98,17 @@ Behavior summary:
9898
- `pre-commit` runs `scripts/release-preflight.sh` and then `scripts/release-sync.sh`.
9999
- Release-managed files are re-staged into the same commit when checks pass.
100100
- When `CHANGELOG.md -> [Unreleased]` is empty, `release-sync` auto-drafts grouped notes from the current staged files.
101-
- `commit-msg` appends `Co-authored-by` trailers for Claude and ChatGPT by default, and only appends `Release-Sync`, `Release-Version`, and `Release-Date` when the pre-commit handoff exists.
101+
- `commit-msg` only appends `Release-Sync`, `Release-Version`, and `Release-Date` when the pre-commit handoff exists.
102102

103103
AI attribution:
104104

105-
- Default commit trailers:
106-
- `Co-authored-by: Claude <claude@anthropic.com>`
107-
- `Co-authored-by: ChatGPT <chatgpt@openai.com>`
108-
- Set `SOPIFY_DISABLE_AI_ATTRIBUTION=1` for a single commit when you need to skip the automatic AI attribution footers.
109-
- `SOPIFY_DISABLE_RELEASE_HOOK=1` disables the entire release hook chain and therefore also skips the default AI attribution trailers; use it only for maintainer/debug flows.
110-
- Repository-level AI collaborator acknowledgements live in [CONTRIBUTORS.md](./CONTRIBUTORS.md).
105+
- AI collaboration is acknowledged at the repository level in [CONTRIBUTORS.md](./CONTRIBUTORS.md).
106+
- The repository no longer appends standard `Co-authored-by` trailers for AI assistants by default, so GitHub contributor attribution remains tied to human commit authors unless you add co-author trailers manually.
107+
- `SOPIFY_DISABLE_RELEASE_HOOK=1` disables the entire release hook chain; use it only for maintainer/debug flows.
111108

112109
Common environment toggles:
113110

114111
- `SOPIFY_DISABLE_RELEASE_HOOK=1`
115-
- `SOPIFY_DISABLE_AI_ATTRIBUTION=1`
116112
- `SOPIFY_SKIP_RELEASE_PREFLIGHT=1`
117113
- `SOPIFY_AUTO_DRAFT_CHANGELOG=0`
118114
- `SOPIFY_RELEASE_HOOK_DRY_RUN=1`

CONTRIBUTING_CN.md

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -98,21 +98,17 @@ git config core.hooksPath .githooks
9898
- `pre-commit` 会先运行 `scripts/release-preflight.sh`,再运行 `scripts/release-sync.sh`
9999
- release-managed 文件会在检查通过后自动回到同一个 commit
100100
-`CHANGELOG.md -> [Unreleased]` 为空时,`release-sync` 会根据当前 staged files 自动生成分组草稿
101-
- `commit-msg` 默认会为 Claude 与 ChatGPT 追加 `Co-authored-by` footer;只有存在 pre-commit handoff 时,才会继续追加 `Release-Sync``Release-Version``Release-Date`
101+
- `commit-msg` 只有在存在 pre-commit handoff 时,才会追加 `Release-Sync``Release-Version``Release-Date`
102102

103103
AI attribution 说明:
104104

105-
- 默认追加的 commit trailers:
106-
- `Co-authored-by: Claude <claude@anthropic.com>`
107-
- `Co-authored-by: ChatGPT <chatgpt@openai.com>`
108-
- 若某一次提交需要跳过这些 AI attribution footer,可在该次提交前设置 `SOPIFY_DISABLE_AI_ATTRIBUTION=1`
109-
- `SOPIFY_DISABLE_RELEASE_HOOK=1` 会关闭整条 release hook 链,因此也会一并跳过默认的 AI attribution;只建议在维护/调试场景使用
110105
- 仓库级 AI 协作声明见 [CONTRIBUTORS.md](./CONTRIBUTORS.md)
106+
- 仓库默认不再为 AI 助手追加标准 `Co-authored-by` trailer;除非你手动填写,否则 GitHub contributor attribution 会只归属于人类 commit author
107+
- `SOPIFY_DISABLE_RELEASE_HOOK=1` 会关闭整条 release hook 链;只建议在维护/调试场景使用
111108

112109
常用环境变量:
113110

114111
- `SOPIFY_DISABLE_RELEASE_HOOK=1`
115-
- `SOPIFY_DISABLE_AI_ATTRIBUTION=1`
116112
- `SOPIFY_SKIP_RELEASE_PREFLIGHT=1`
117113
- `SOPIFY_AUTO_DRAFT_CHANGELOG=0`
118114
- `SOPIFY_RELEASE_HOOK_DRY_RUN=1`

CONTRIBUTORS.md

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,8 @@ GitHub's automatic contributor graph only reflects commits tied to GitHub accoun
1515

1616
## Commit-Level Attribution
1717

18-
This repository's `commit-msg` hook appends the following trailers by default:
18+
This repository no longer appends standard AI `Co-authored-by` trailers by default.
1919

20-
```text
21-
Co-authored-by: Claude <claude@anthropic.com>
22-
Co-authored-by: ChatGPT <chatgpt@openai.com>
23-
```
20+
AI participation is acknowledged here at the repository level so GitHub's contributor graph remains tied to human commit authors unless a maintainer explicitly adds co-author trailers by hand.
2421

25-
Set `SOPIFY_DISABLE_AI_ATTRIBUTION=1` for a single commit if you need to skip those trailers locally.
26-
27-
Set `SOPIFY_DISABLE_RELEASE_HOOK=1` only for maintainer/debug scenarios. It disables the entire `commit-msg` hook, which also skips the default AI attribution trailers.
22+
Set `SOPIFY_DISABLE_RELEASE_HOOK=1` only for maintainer/debug scenarios. It disables the entire `commit-msg` hook.

tests/test_release_hooks.py

Lines changed: 3 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ def _init_release_hook_fixture(root: Path, *, missing_claude_targets: bool = Fal
162162

163163

164164
class ReleaseHookTests(unittest.TestCase):
165-
def test_commit_msg_appends_default_ai_attribution_trailers(self) -> None:
165+
def test_commit_msg_leaves_message_unchanged_without_release_state(self) -> None:
166166
with tempfile.TemporaryDirectory() as temp_dir:
167167
root = Path(temp_dir)
168168
_init_release_hook_fixture(root)
@@ -181,33 +181,10 @@ def test_commit_msg_appends_default_ai_attribution_trailers(self) -> None:
181181

182182
self.assertEqual(completed.returncode, 0, msg=completed.stderr)
183183
message = message_file.read_text(encoding="utf-8")
184-
self.assertIn("Co-authored-by: Claude <claude@anthropic.com>", message)
185-
self.assertIn("Co-authored-by: ChatGPT <chatgpt@openai.com>", message)
184+
self.assertEqual(message, "docs: update contribution guide\n")
186185
self.assertNotIn("Release-Sync:", message)
187186

188-
def test_commit_msg_respects_ai_attribution_disable_toggle(self) -> None:
189-
with tempfile.TemporaryDirectory() as temp_dir:
190-
root = Path(temp_dir)
191-
_init_release_hook_fixture(root)
192-
193-
message_file = root / "COMMIT_EDITMSG"
194-
_write(message_file, "docs: update contribution guide\n")
195-
196-
completed = subprocess.run(
197-
["bash", str(root / ".githooks" / "commit-msg"), str(message_file)],
198-
cwd=root,
199-
capture_output=True,
200-
text=True,
201-
check=False,
202-
env={**_git_subprocess_env(), "SOPIFY_DISABLE_AI_ATTRIBUTION": "1"},
203-
)
204-
205-
self.assertEqual(completed.returncode, 0, msg=completed.stderr)
206-
message = message_file.read_text(encoding="utf-8")
207-
self.assertNotIn("Co-authored-by: Claude <claude@anthropic.com>", message)
208-
self.assertNotIn("Co-authored-by: ChatGPT <chatgpt@openai.com>", message)
209-
210-
def test_commit_msg_does_not_duplicate_existing_ai_attribution_trailers(self) -> None:
187+
def test_commit_msg_preserves_manual_coauthor_trailers_without_duplication(self) -> None:
211188
with tempfile.TemporaryDirectory() as temp_dir:
212189
root = Path(temp_dir)
213190
_init_release_hook_fixture(root)

0 commit comments

Comments
 (0)