Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ python scripts/build_contributors.py --apply --tools codex,claude,renovate

The first command installs the kit (public raw URL, no login required); the second creates a branch, writes `Co-Authored-By` trailers, and commits, then pushes and opens a PR. Once merged, the identities appear on the Contributors page.

> Integration styles: by default only the attribution CSV is committed (clean, recommended); add `--commit-kit` to `--apply` for the self-contained style (kit files committed so `--remove` / `--check` run inside the repo).

> Prerequisite: the agent must be authenticated to GitHub (able to push branches / open PRs). Identity emails must be real, GitHub-recognized agent/bot identities; forging is forbidden.

### Let your agent do it
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ python scripts/build_contributors.py --apply --tools codex,claude,renovate

第一条命令自动安装套件(public 仓库直连,无需登录);第二条命令自动创建分支、写入 `Co-Authored-By` 尾注并提交,随后推送并打开 PR;合并后身份即进入 Contributors 页面。

> 接入风格:默认只提交归属记录 CSV(干净,推荐);需要「自包含」(套件入库、仓库内直接 `--remove` / `--check`)时,给 `--apply` 加 `--commit-kit`。

> 前提:Agent 已认证 GitHub(可推送分支 / 开 PR)。身份邮箱必须是 GitHub 能识别的真实 Agent / Bot 身份,禁止伪造。

### 交给你的 Agent 去实现
Expand Down
4 changes: 4 additions & 0 deletions docs/add-contributors-with-agent.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ python scripts/build_contributors.py --apply --bots
python scripts/build_contributors.py --apply --tools codex,renovate --subject "chore: attribute identities"
```

> **两种接入风格**
> - 默认(干净):只提交归属记录 `activity/contributor-attributions.csv`,套件仅本地使用,仓库零污染;
> - `--commit-kit`(自包含):套件 3 个文件一并提交进仓库,后续 `--remove` / `--check` 可直接在仓库内运行。

脚本会:新建分支 `contributor/add-<n>` → 追加 `activity/contributor-attributions.csv` 记录 → 用带
`Co-Authored-By:` 尾注的提交信息提交。随后按脚本提示推送并开 PR:

Expand Down
5 changes: 4 additions & 1 deletion docs/contributor-catalog.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,12 @@ python scripts/build_contributors.py --bots
# 选择全部(A+C)
python scripts/build_contributors.py --all

# 自助:自动建分支 + 提交 + 尾注(推荐给 Agent)
# 自助:自动建分支 + 提交 + 尾注(默认只提交归属记录,干净风格)
python scripts/build_contributors.py --apply --tools codex,renovate,snyk

# 自助 + 自包含:套件文件一并入库,后续 --remove/--check 可在仓库内直接跑
python scripts/build_contributors.py --apply --tools codex,renovate,snyk --commit-kit

# 直接生成带尾注的完整提交信息
python scripts/build_contributors.py --bots --commit-message "feat: example"
```
Expand Down
6 changes: 6 additions & 0 deletions scripts/build_contributors.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
Self-serve for agents:
python scripts/build_contributors.py --list
python scripts/build_contributors.py --apply --tools codex,claude,renovate
python scripts/build_contributors.py --apply --tools codex --commit-kit
python scripts/build_contributors.py --remove --tools renovate
python scripts/build_contributors.py --check --tools codex
"""
Expand Down Expand Up @@ -320,6 +321,10 @@ def cmd_apply(args) -> int:
names = "; ".join(e["name"] for e in entries)
writer.writerow([datetime.date.today().isoformat(), names, len(trailers)])
_git("add", csv_path)
if args.commit_kit:
for _kit in ("scripts/build_contributors.py", "docs/contributor-catalog.md", "docs/add-contributors-with-agent.md"):
if os.path.exists(_kit):
_git("add", _kit)
subject = args.subject or "chore: attribute contributor identities"
message = subject + "\n\nAutomated attribution record; no substantive code change.\n\n" + "\n".join(trailers)
msg_file = os.path.join(os.getcwd(), ".git", "contributor-commit-message.txt")
Expand Down Expand Up @@ -407,6 +412,7 @@ def main() -> int:
parser.add_argument("--commit-message", help="optional commit subject; when set, print a full commit message")
parser.add_argument("--branch", help="branch name for --apply")
parser.add_argument("--subject", help="commit subject for --apply")
parser.add_argument("--commit-kit", action="store_true", help="also commit the kit files into the repo (self-contained style)")
parser.add_argument("--limit", type=int, help="how many recent commits --check scans (default 100)")
args = parser.parse_args()

Expand Down