用途:在某个仓库中采用 agentloop 插件,把“插件已安装”变成“循环技能可实际运行”。每个仓库运行一次,显式化并复现 sweep/review 技能所依赖的环境(repo-profile、协调标签、验证门禁、可用工具链与 gh 认证)。脚本位于 <plugin_root>/bootstrap/,均为幂等。
主要能力与流程(在目标仓库根目录按顺序执行,PR=<plugin_root>): Step 0 预检:bash "$PR/bootstrap/check-env.sh"。只读探测,报告缺失项并以非零退出,不安装任何东西;缺失工具需由代理按平台安装(macOS→brew,Debian/Ubuntu→apt install -y,bun→其 curl 安装器),重复直到通过。 Step 1 生成 profile:bash "$PR/bootstrap/init-profile.sh",写入 .claude/repo-profile.md(不覆盖)。自动填充 repo_slug、plugin_root、default_branch、package_manager;其余 <FILL: …> 需阅读仓库后填写(工具链命令、UI/后端路径、gate_mode、cli_binary、kb_issue、comment_language、milestones 等)。无法从文件确证的值应保留 <FILL> 交人工,错误值会静默失败。 Step 2 协调标签:bash "$PR/bootstrap/sync-labels.sh"(可加 --dry-run 预览),仅创建 agent:* / needs-* / pr-sweep:* 固定标签集,幂等。 Step 3 验证门禁:bash "$PR/bootstrap/scaffold-verify.sh",生成 .claude/verify/{config,pre-pr,pre-merge}.ts,使用检测到的包管理器与默认分支,含起始 build/test 检查;随后编辑 config.ts 替换为仓库真实 build/lint/type-check/test 命令,并用 bun .claude/verify/pre-pr.ts --only build 验证接线。 Step 4 确认:再次运行 check-env.sh,应全部通过(退出 0)。
脚本职责:init-profile.sh 检测 repo_slug(git remote)、plugin_root、default_branch、package_manager(锁文件),拒绝覆盖(--force 可替换);sync-labels.sh 用 gh label create/edit;scaffold-verify.sh 生成验证目录;check-env.sh 检查 bun/git/gh/jq、gh 认证(真实 REST 探测)、origin 远程、profile 必需键及 plugin_root 有效性,缺失时仅建议安装命令。
适用场景:为仓库接入 agentloop 循环技能前的初始化。限制:不负责调度(cron/CI/云例程由仓库自身基础设施处理,见 docs/scheduling-recipe.md);不安装工具、不修改系统;判断性字段需人工或代理填写。参考实现为 Arc(ArcBlock/arc)。