Skip to content

Commit 56fe95c

Browse files
chore: suppress Claude attribution at project scope
- .claude/settings.json: attribution.commit/pr を空文字で無効化 - .githooks/prepare-commit-msg: safety net として Co-Authored-By/Generated with を自動削除 - README.md: git hooks 有効化手順を Setup セクションに追加
1 parent 5a62c57 commit 56fe95c

3 files changed

Lines changed: 56 additions & 0 deletions

File tree

.claude/settings.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"attribution": {
3+
"commit": "",
4+
"pr": ""
5+
}
6+
}

.githooks/prepare-commit-msg

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/usr/bin/env bash
2+
# Claude Code の attribution / Co-Authored-By trailer をコミット前に削除する safety net
3+
# 有効化: git config core.hooksPath .githooks
4+
5+
set -euo pipefail
6+
7+
MSG_FILE="${1:-}"
8+
if [ -z "$MSG_FILE" ] || [ ! -f "$MSG_FILE" ]; then
9+
exit 0
10+
fi
11+
12+
python3 - "$MSG_FILE" <<'PY'
13+
import re, sys, pathlib
14+
15+
p = pathlib.Path(sys.argv[1])
16+
text = p.read_text(encoding="utf-8", errors="replace")
17+
lines = text.splitlines()
18+
19+
20+
def is_claude_line(line: str) -> bool:
21+
s = line.strip()
22+
if re.match(r"^Generated with(\s+\[Claude Code\])?", s, re.IGNORECASE):
23+
return True
24+
if "claude.ai/code" in s or "code.claude.com" in s:
25+
return True
26+
if re.match(r"^Co-Authored-By:\s*Claude\b", s, re.IGNORECASE):
27+
return True
28+
return False
29+
30+
31+
# 末尾から Claude attribution 行を削除
32+
while lines and (is_claude_line(lines[-1]) or lines[-1].strip() == ""):
33+
if is_claude_line(lines[-1]):
34+
lines.pop()
35+
while lines and lines[-1].strip() == "":
36+
lines.pop()
37+
else:
38+
lines.pop()
39+
40+
out = "\n".join(lines).rstrip() + "\n"
41+
p.write_text(out, encoding="utf-8")
42+
PY
43+
44+
exit 0

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,12 @@ src/ (Rust)
135135
distributions.rs # Posterior sampling distributions
136136
```
137137

138+
## Setup
139+
140+
```bash
141+
git config core.hooksPath .githooks
142+
```
143+
138144
## Running Tests
139145

140146
```bash

0 commit comments

Comments
 (0)