SKILL.md 4.4 KB

name: mr-create description: 完成报告生成后,把当前分支(module-* 后端 / frontend-phase 前端)推到远程并创建 GitLab MR,把 MR iid 回写 docs/08(§ 二 模块行 / § 三 整体 MR)+ URL 回写报告 § ⑫,停下等人工 Approve + Merge。 user-invocable: false

allowed-tools: Read Edit Bash(git *) Bash(bash *)

所有输出必须使用中文。

mr-create

前置条件

  • module-report 已生成报告并 commit 到当前分支
  • test-gate 绿色,test-gate.md 已 commit 到当前分支
  • 当前分支 = module-<module_id>frontend-phase(由 module-start 步骤 3 / frontend-start 步骤 4 切入)

执行步骤

步骤 1:验证当前分支并推断 phase

git branch --show-current

  • 匹配 module-*phase=backendphase_id= 去掉 module- 前缀
  • 等于 frontend-phasephase=frontendphase_id=frontend-phase
  • 其它 → 停下报错(不自动建分支——分支职责在上游 module-start / frontend-start

步骤 2:验证 worktree 干净

git status --porcelain 输出非空 → 停下打印 dirty 文件清单:

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
 [mr-create] ⚠️ worktree 不干净,无法 push

 <git status 输出>

 push 前所有 evidence 必须已 commit。检查点:
 - test-gate 步骤 3 是否已 commit test-gate.md?
 - module-report 步骤 5 是否已 commit 报告 + cross-module log?

 修复:git add <files> && git commit -m "...",然后重跑 /erp-workflow:coding-start。
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

步骤 3:初次 push

git push -u origin <current_branch>——禁用 --no-verify

步骤 4:调脚本创建(或复用)MR

bash "${CLAUDE_SKILL_DIR}/scripts/create-mr.sh" <phase_id> <current_branch> <YYYY-MM-DD>

<phase_id> = 后端模块 id(如 module_sys)或前端常量 frontend-phase。脚本内部完成:加载 .env.local → 探测目标分支 → 取 module_name(后端从 docs/08 § 二,前端使用常量"前端阶段(整体)")→ test-gate.md 取结论 → 渲染 description → 查已有 opened MR → 否则创建新 MR。

输出(stdout):单行 <MR_IID> <MR_URL>,由本步骤捕获供后续步骤使用。失败时脚本写诊断到 stderr 并 exit 1,本 skill 停下。

步骤 5:回写 docs/08 MR 字段并 commit

先于步骤 6 执行——若步骤 6 失败,重跑时步骤 4 脚本能识别已有 MR + docs/08 已含 IID,状态一致。

Edit docs/08-模块任务管理.md

  • phase=backend:在 § 二 中找到当前模块的 - MR: — 改为 - MR: !<MR_IID>
  • phase=frontend:在 § 三 中找到 - 整体 MR: — 改为 - 整体 MR: !<MR_IID>
git add docs/08-模块任务管理.md
git commit -m "chore(<phase_id>): record MR !<MR_IID> in docs/08"

步骤 6:追加 MR URL 到完成报告 § ⑫ 并 commit

Edit docs/superpowers/module-reports/<date>-<phase_id>.md 的 § ⑫,把 {{mr_url}} 替换为 <MR_URL>(已替换则追加一行)。

git add docs/superpowers/module-reports/<date>-<phase_id>.md
git commit -m "docs(<phase_id>): record MR !<MR_IID> link in completion report"

步骤 7:再次 push 同步新 commits

步骤 5、6 产生了两个新 commit,必须再 push 让 MR 自动更新 commit 列表 + diff:

git push origin <current_branch>

步骤 8:打印 MR URL,停下等 Approve + Merge

向会话打印 <MR_URL>,结束本 skill。

  • phase=backend:用户在 GitLab merge 后再运行 /erp-workflow:coding-start;coding-start 重新做后端完成性检查,未完则推进下一模块,全 merged 则路由到 frontend-start(frontend-start 自带 prototype/ 门禁)
  • phase=frontend:用户在 GitLab merge 后再运行 /erp-workflow:coding-start,扫描到 § 三 整体 MR state=merged → 打印"所有阶段已完成"

参考

  • ${CLAUDE_SKILL_DIR}/scripts/create-mr.sh(步骤 4 主流程脚本,按 phase_id 自动选 backend / frontend 行为)
  • ${CLAUDE_SKILL_DIR}/templates/mr-title-template.md
  • ${CLAUDE_SKILL_DIR}/templates/mr-description-template.md
  • 上游:module-report
  • 下游闸门:用户手工 MR Approve + Merge