diff --git a/README.en.md b/README.en.md index d8ad003..da90745 100644 --- a/README.en.md +++ b/README.en.md @@ -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 diff --git a/README.md b/README.md index ea14e04..a904cbe 100644 --- a/README.md +++ b/README.md @@ -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 去实现 diff --git a/docs/add-contributors-with-agent.md b/docs/add-contributors-with-agent.md index a8234c7..7828c4f 100644 --- a/docs/add-contributors-with-agent.md +++ b/docs/add-contributors-with-agent.md @@ -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-` → 追加 `activity/contributor-attributions.csv` 记录 → 用带 `Co-Authored-By:` 尾注的提交信息提交。随后按脚本提示推送并开 PR: diff --git a/docs/contributor-catalog.md b/docs/contributor-catalog.md index c24534f..33baa9d 100644 --- a/docs/contributor-catalog.md +++ b/docs/contributor-catalog.md @@ -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" ``` diff --git a/scripts/build_contributors.py b/scripts/build_contributors.py index 7d4b439..c33a33b 100644 --- a/scripts/build_contributors.py +++ b/scripts/build_contributors.py @@ -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 """ @@ -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") @@ -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()