--- name: mr-create description: 模块报告完成后,把 module 分支推到远程并创建 GitLab MR,把 MR iid 回写 docs/08 + URL 回写报告 § ⑫,停下等人工 Approve + Merge。 user-invocable: false allowed-tools: Read Edit Bash(git *) Bash(bash *) --- **所有输出必须使用中文。** # mr-create ## 前置条件 - `module-report` 已生成报告并 commit 到 module 分支 - `test-gate` 绿色,test-gate.md 已 commit 到 module 分支 - 当前分支 = `module-`(由 `module-start` 步骤 3 切入) ## 执行步骤 ### 步骤 1:验证当前分支 `git branch --show-current` 必须匹配 `module-*`,否则停下报错(不自动建分支——分支职责在 `module-start` 步骤 3)。从分支名取 `module_id` = 去掉 `module-` 前缀。 ### 步骤 2:验证 worktree 干净 `git status --porcelain` 输出非空 → 停下打印 dirty 文件清单: ``` ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ [mr-create] ⚠️ worktree 不干净,无法 push push 前所有 evidence 必须已 commit。检查点: - test-gate 步骤 3 是否已 commit test-gate.md? - module-report 步骤 5 是否已 commit 报告 + cross-module log? 修复:git add && git commit -m "...",然后重跑 /erp-workflow:coding-start。 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ``` ### 步骤 3:初次 push `git push -u origin `——**禁用 `--no-verify`**。 ### 步骤 4:调脚本创建(或复用)MR ```bash bash "${CLAUDE_SKILL_DIR}/scripts/create-mr.sh" ``` 脚本内部完成:加载 `.env.local` → 探测目标分支 → 从 docs/08 取 `module_name` 与 test-gate.md 取结论 → 渲染 description → 查已有 opened MR → 否则创建新 MR。 输出(stdout):单行 ` `,由本步骤捕获供后续步骤使用。失败时脚本写诊断到 stderr 并 exit 1,本 skill 停下。 ### 步骤 5:回写 docs/08 MR 字段并 commit **先于步骤 6 执行**——若步骤 6 失败,重跑时步骤 4 脚本能识别已有 MR + docs/08 已含 IID,状态一致。 `Edit docs/08-模块任务管理.md`:把当前模块的 ` - MR: —` 改为 ` - MR: !`。 ```bash git add docs/08-模块任务管理.md git commit -m "chore(): record MR ! in docs/08" ``` ### 步骤 6:追加 MR URL 到模块报告 § ⑫ 并 commit `Edit docs/superpowers/module-reports/-.md` 的 § ⑫,把 `{{mr_url}}` 替换为 ``(已替换则追加一行)。 ```bash git add docs/superpowers/module-reports/-.md git commit -m "docs(): record MR ! link in module report" ``` ### 步骤 7:再次 push 同步新 commits 步骤 5、6 产生了两个新 commit,必须再 push 让 MR 自动更新 commit 列表 + diff: `git push origin ` ### 步骤 8:打印 MR URL,停下等 Approve + Merge 向会话打印 ``,结束本 skill。用户在 GitLab merge 后再运行 `/erp-workflow:coding-start`,入口扫描到 `state=merged` 后自动推进下一模块。 ## 参考 - `${CLAUDE_SKILL_DIR}/scripts/create-mr.sh`(步骤 4 主流程脚本) - `${CLAUDE_SKILL_DIR}/templates/mr-title-template.md` - `${CLAUDE_SKILL_DIR}/templates/mr-description-template.md` - 上游:`module-report` - 下游闸门:用户手工 MR Approve + Merge