@aipper/aiws-spec 0.0.23 → 0.0.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (210) hide show
  1. package/README.md +22 -0
  2. package/docs/aiws-bootstrap-routing-design.md +138 -0
  3. package/docs/aiws-governance-positioning.md +69 -0
  4. package/docs/cli-interface.md +87 -5
  5. package/docs/collaboration-artifacts.md +62 -0
  6. package/docs/opencode-omo-adapter.md +135 -0
  7. package/docs/opencode-omo-validation-checklist.md +90 -0
  8. package/docs/spec-contract.md +26 -11
  9. package/docs/superpowers-collaboration-adoption.md +92 -0
  10. package/docs/workflow-delegation-contracts.json +274 -0
  11. package/docs/workflow-delegation-contracts.md +248 -0
  12. package/docs/workflow-delegation-contracts.schema.json +176 -0
  13. package/docs/workflow-governance-rules.json +294 -0
  14. package/docs/workflow-governance-rules.md +63 -0
  15. package/docs/workflow-governance-rules.schema.json +182 -0
  16. package/docs/workflow-review-gates.json +72 -0
  17. package/docs/workflow-review-gates.md +36 -0
  18. package/docs/workflow-review-gates.schema.json +67 -0
  19. package/docs/workflow-router-rules.json +196 -0
  20. package/docs/workflow-router-rules.md +83 -0
  21. package/docs/workflow-router-rules.schema.json +119 -0
  22. package/docs/workflow-stage-contracts.json +148 -0
  23. package/docs/workflow-stage-contracts.md +70 -0
  24. package/docs/workflow-stage-contracts.schema.json +98 -0
  25. package/package.json +1 -1
  26. package/templates/workspace/.agents/skills/using-aiws/SKILL.md +83 -0
  27. package/templates/workspace/.agents/skills/ws-bugfix/SKILL.md +30 -7
  28. package/templates/workspace/.agents/skills/ws-commit/SKILL.md +26 -1
  29. package/templates/workspace/.agents/skills/ws-delegate/SKILL.md +75 -0
  30. package/templates/workspace/.agents/skills/ws-deliver/SKILL.md +46 -9
  31. package/templates/workspace/.agents/skills/ws-dev/SKILL.md +81 -11
  32. package/templates/workspace/.agents/skills/ws-finish/SKILL.md +101 -60
  33. package/templates/workspace/.agents/skills/ws-frontend-design/SKILL.md +126 -0
  34. package/templates/workspace/.agents/skills/ws-handoff/SKILL.md +22 -1
  35. package/templates/workspace/.agents/skills/ws-plan/SKILL.md +61 -2
  36. package/templates/workspace/.agents/skills/ws-plan-verify/SKILL.md +20 -0
  37. package/templates/workspace/.agents/skills/ws-preflight/SKILL.md +23 -0
  38. package/templates/workspace/.agents/skills/ws-quality-review/SKILL.md +56 -0
  39. package/templates/workspace/.agents/skills/ws-review/SKILL.md +24 -0
  40. package/templates/workspace/.agents/skills/ws-spec-review/SKILL.md +57 -0
  41. package/templates/workspace/.agents/skills/ws-verify-before-complete/SKILL.md +59 -0
  42. package/templates/workspace/.claude/commands/using-aiws.md +24 -0
  43. package/templates/workspace/.claude/commands/ws-bugfix.md +11 -6
  44. package/templates/workspace/.claude/commands/ws-commit.md +2 -1
  45. package/templates/workspace/.claude/commands/ws-deliver.md +6 -2
  46. package/templates/workspace/.claude/commands/ws-dev.md +5 -2
  47. package/templates/workspace/.claude/commands/ws-finish.md +19 -19
  48. package/templates/workspace/.claude/commands/ws-plan.md +9 -5
  49. package/templates/workspace/.claude/commands/ws-quality-review.md +24 -0
  50. package/templates/workspace/.claude/commands/ws-spec-review.md +24 -0
  51. package/templates/workspace/.claude/commands/ws-verify-before-complete.md +24 -0
  52. package/templates/workspace/.claude/skills/p-aiws-change-archive/SKILL.md +24 -0
  53. package/templates/workspace/.claude/skills/p-aiws-change-finish/SKILL.md +24 -0
  54. package/templates/workspace/.claude/skills/p-aiws-change-list/SKILL.md +18 -0
  55. package/templates/workspace/.claude/skills/p-aiws-change-new/SKILL.md +26 -0
  56. package/templates/workspace/.claude/skills/p-aiws-change-next/SKILL.md +19 -0
  57. package/templates/workspace/.claude/skills/p-aiws-change-start/SKILL.md +33 -0
  58. package/templates/workspace/.claude/skills/p-aiws-change-status/SKILL.md +19 -0
  59. package/templates/workspace/.claude/skills/p-aiws-change-sync/SKILL.md +19 -0
  60. package/templates/workspace/.claude/skills/p-aiws-change-templates-init/SKILL.md +18 -0
  61. package/templates/workspace/.claude/skills/p-aiws-change-templates-which/SKILL.md +18 -0
  62. package/templates/workspace/.claude/skills/p-aiws-change-validate/SKILL.md +23 -0
  63. package/templates/workspace/.claude/skills/p-aiws-hooks-install/SKILL.md +30 -0
  64. package/templates/workspace/.claude/skills/p-aiws-hooks-status/SKILL.md +18 -0
  65. package/templates/workspace/.claude/skills/p-aiws-init/SKILL.md +27 -0
  66. package/templates/workspace/.claude/skills/p-aiws-rollback/SKILL.md +18 -0
  67. package/templates/workspace/.claude/skills/p-aiws-update/SKILL.md +26 -0
  68. package/templates/workspace/.claude/skills/p-aiws-validate/SKILL.md +22 -0
  69. package/templates/workspace/.claude/skills/p-tasks-plan/SKILL.md +37 -0
  70. package/templates/workspace/.claude/skills/using-aiws/SKILL.md +83 -0
  71. package/templates/workspace/.claude/skills/ws-analyze/SKILL.md +26 -0
  72. package/templates/workspace/.claude/skills/ws-bugfix/SKILL.md +111 -0
  73. package/templates/workspace/.claude/skills/ws-commit/SKILL.md +127 -0
  74. package/templates/workspace/.claude/skills/ws-deliver/SKILL.md +231 -0
  75. package/templates/workspace/.claude/skills/ws-dev/SKILL.md +168 -0
  76. package/templates/workspace/.claude/skills/ws-finish/SKILL.md +220 -0
  77. package/templates/workspace/.claude/skills/ws-frontend-design/SKILL.md +126 -0
  78. package/templates/workspace/.claude/skills/ws-handoff/SKILL.md +52 -0
  79. package/templates/workspace/.claude/skills/ws-migrate/SKILL.md +54 -0
  80. package/templates/workspace/.claude/skills/ws-plan/SKILL.md +138 -0
  81. package/templates/workspace/.claude/skills/ws-plan-verify/SKILL.md +61 -0
  82. package/templates/workspace/.claude/skills/ws-preflight/SKILL.md +55 -0
  83. package/templates/workspace/.claude/skills/ws-pull/SKILL.md +119 -0
  84. package/templates/workspace/.claude/skills/ws-push/SKILL.md +110 -0
  85. package/templates/workspace/.claude/skills/ws-quality-review/SKILL.md +56 -0
  86. package/templates/workspace/.claude/skills/ws-req-change/SKILL.md +41 -0
  87. package/templates/workspace/.claude/skills/ws-req-contract-sync/SKILL.md +17 -0
  88. package/templates/workspace/.claude/skills/ws-req-contract-validate/SKILL.md +12 -0
  89. package/templates/workspace/.claude/skills/ws-req-flow-sync/SKILL.md +28 -0
  90. package/templates/workspace/.claude/skills/ws-req-review/SKILL.md +32 -0
  91. package/templates/workspace/.claude/skills/ws-review/SKILL.md +50 -0
  92. package/templates/workspace/.claude/skills/ws-rule/SKILL.md +23 -0
  93. package/templates/workspace/.claude/skills/ws-spec-review/SKILL.md +57 -0
  94. package/templates/workspace/.claude/skills/ws-submodule-setup/SKILL.md +65 -0
  95. package/templates/workspace/.claude/skills/ws-verify-before-complete/SKILL.md +59 -0
  96. package/templates/workspace/.codex/prompts/ws-dev.md +5 -1
  97. package/templates/workspace/.githooks/commit-msg +109 -0
  98. package/templates/workspace/.iflow/commands/ws-commit.toml +2 -1
  99. package/templates/workspace/.iflow/commands/ws-deliver.toml +6 -2
  100. package/templates/workspace/.iflow/commands/ws-finish.toml +19 -19
  101. package/templates/workspace/.opencode/command/using-aiws.md +29 -0
  102. package/templates/workspace/.opencode/command/ws-bugfix.md +11 -6
  103. package/templates/workspace/.opencode/command/ws-commit.md +2 -1
  104. package/templates/workspace/.opencode/command/ws-delegate.md +33 -0
  105. package/templates/workspace/.opencode/command/ws-deliver.md +6 -2
  106. package/templates/workspace/.opencode/command/ws-dev.md +5 -2
  107. package/templates/workspace/.opencode/command/ws-finish.md +19 -19
  108. package/templates/workspace/.opencode/command/ws-plan.md +12 -5
  109. package/templates/workspace/.opencode/command/ws-preflight.md +4 -0
  110. package/templates/workspace/.opencode/command/ws-quality-review.md +30 -0
  111. package/templates/workspace/.opencode/command/ws-review.md +3 -0
  112. package/templates/workspace/.opencode/command/ws-spec-review.md +30 -0
  113. package/templates/workspace/.opencode/command/ws-verify-before-complete.md +27 -0
  114. package/templates/workspace/.opencode/commands/p-aiws-change-archive.md +27 -0
  115. package/templates/workspace/.opencode/commands/p-aiws-change-finish.md +27 -0
  116. package/templates/workspace/.opencode/commands/p-aiws-change-list.md +26 -0
  117. package/templates/workspace/.opencode/commands/p-aiws-change-new.md +27 -0
  118. package/templates/workspace/.opencode/commands/p-aiws-change-next.md +27 -0
  119. package/templates/workspace/.opencode/commands/p-aiws-change-start.md +27 -0
  120. package/templates/workspace/.opencode/commands/p-aiws-change-status.md +27 -0
  121. package/templates/workspace/.opencode/commands/p-aiws-change-sync.md +27 -0
  122. package/templates/workspace/.opencode/commands/p-aiws-change-templates-init.md +26 -0
  123. package/templates/workspace/.opencode/commands/p-aiws-change-templates-which.md +26 -0
  124. package/templates/workspace/.opencode/commands/p-aiws-change-validate.md +27 -0
  125. package/templates/workspace/.opencode/commands/p-aiws-hooks-install.md +26 -0
  126. package/templates/workspace/.opencode/commands/p-aiws-hooks-status.md +26 -0
  127. package/templates/workspace/.opencode/commands/p-aiws-init.md +23 -0
  128. package/templates/workspace/.opencode/commands/p-aiws-rollback.md +16 -0
  129. package/templates/workspace/.opencode/commands/p-aiws-update.md +22 -0
  130. package/templates/workspace/.opencode/commands/p-aiws-validate.md +17 -0
  131. package/templates/workspace/.opencode/commands/using-aiws.md +29 -0
  132. package/templates/workspace/.opencode/commands/ws-analyze.md +30 -0
  133. package/templates/workspace/.opencode/commands/ws-bugfix.md +35 -0
  134. package/templates/workspace/.opencode/commands/ws-commit.md +70 -0
  135. package/templates/workspace/.opencode/commands/ws-delegate.md +33 -0
  136. package/templates/workspace/.opencode/commands/ws-deliver.md +58 -0
  137. package/templates/workspace/.opencode/commands/ws-dev.md +36 -0
  138. package/templates/workspace/.opencode/commands/ws-finish.md +71 -0
  139. package/templates/workspace/.opencode/commands/ws-handoff.md +25 -0
  140. package/templates/workspace/.opencode/commands/ws-migrate.md +25 -0
  141. package/templates/workspace/.opencode/commands/ws-plan-verify.md +28 -0
  142. package/templates/workspace/.opencode/commands/ws-plan.md +27 -0
  143. package/templates/workspace/.opencode/commands/ws-preflight.md +34 -0
  144. package/templates/workspace/.opencode/commands/ws-pull.md +87 -0
  145. package/templates/workspace/.opencode/commands/ws-push.md +93 -0
  146. package/templates/workspace/.opencode/commands/ws-quality-review.md +30 -0
  147. package/templates/workspace/.opencode/commands/ws-req-change.md +45 -0
  148. package/templates/workspace/.opencode/commands/ws-req-contract-sync.md +21 -0
  149. package/templates/workspace/.opencode/commands/ws-req-contract-validate.md +16 -0
  150. package/templates/workspace/.opencode/commands/ws-req-flow-sync.md +23 -0
  151. package/templates/workspace/.opencode/commands/ws-req-review.md +36 -0
  152. package/templates/workspace/.opencode/commands/ws-review.md +33 -0
  153. package/templates/workspace/.opencode/commands/ws-rule.md +27 -0
  154. package/templates/workspace/.opencode/commands/ws-spec-review.md +30 -0
  155. package/templates/workspace/.opencode/commands/ws-submodule-setup.md +57 -0
  156. package/templates/workspace/.opencode/commands/ws-verify-before-complete.md +27 -0
  157. package/templates/workspace/.opencode/oh-my-opencode.json.example +17 -0
  158. package/templates/workspace/.opencode/skills/p-aiws-change-archive/SKILL.md +24 -0
  159. package/templates/workspace/.opencode/skills/p-aiws-change-finish/SKILL.md +24 -0
  160. package/templates/workspace/.opencode/skills/p-aiws-change-list/SKILL.md +18 -0
  161. package/templates/workspace/.opencode/skills/p-aiws-change-new/SKILL.md +26 -0
  162. package/templates/workspace/.opencode/skills/p-aiws-change-next/SKILL.md +19 -0
  163. package/templates/workspace/.opencode/skills/p-aiws-change-start/SKILL.md +33 -0
  164. package/templates/workspace/.opencode/skills/p-aiws-change-status/SKILL.md +19 -0
  165. package/templates/workspace/.opencode/skills/p-aiws-change-sync/SKILL.md +19 -0
  166. package/templates/workspace/.opencode/skills/p-aiws-change-templates-init/SKILL.md +18 -0
  167. package/templates/workspace/.opencode/skills/p-aiws-change-templates-which/SKILL.md +18 -0
  168. package/templates/workspace/.opencode/skills/p-aiws-change-validate/SKILL.md +23 -0
  169. package/templates/workspace/.opencode/skills/p-aiws-hooks-install/SKILL.md +30 -0
  170. package/templates/workspace/.opencode/skills/p-aiws-hooks-status/SKILL.md +18 -0
  171. package/templates/workspace/.opencode/skills/p-aiws-init/SKILL.md +27 -0
  172. package/templates/workspace/.opencode/skills/p-aiws-rollback/SKILL.md +18 -0
  173. package/templates/workspace/.opencode/skills/p-aiws-update/SKILL.md +26 -0
  174. package/templates/workspace/.opencode/skills/p-aiws-validate/SKILL.md +22 -0
  175. package/templates/workspace/.opencode/skills/p-tasks-plan/SKILL.md +37 -0
  176. package/templates/workspace/.opencode/skills/using-aiws/SKILL.md +87 -0
  177. package/templates/workspace/.opencode/skills/ws-analyze/SKILL.md +26 -0
  178. package/templates/workspace/.opencode/skills/ws-bugfix/SKILL.md +111 -0
  179. package/templates/workspace/.opencode/skills/ws-commit/SKILL.md +127 -0
  180. package/templates/workspace/.opencode/skills/ws-delegate/SKILL.md +63 -0
  181. package/templates/workspace/.opencode/skills/ws-deliver/SKILL.md +231 -0
  182. package/templates/workspace/.opencode/skills/ws-dev/SKILL.md +168 -0
  183. package/templates/workspace/.opencode/skills/ws-finish/SKILL.md +220 -0
  184. package/templates/workspace/.opencode/skills/ws-frontend-design/SKILL.md +126 -0
  185. package/templates/workspace/.opencode/skills/ws-handoff/SKILL.md +52 -0
  186. package/templates/workspace/.opencode/skills/ws-migrate/SKILL.md +54 -0
  187. package/templates/workspace/.opencode/skills/ws-plan/SKILL.md +148 -0
  188. package/templates/workspace/.opencode/skills/ws-plan-verify/SKILL.md +61 -0
  189. package/templates/workspace/.opencode/skills/ws-preflight/SKILL.md +60 -0
  190. package/templates/workspace/.opencode/skills/ws-pull/SKILL.md +119 -0
  191. package/templates/workspace/.opencode/skills/ws-push/SKILL.md +110 -0
  192. package/templates/workspace/.opencode/skills/ws-quality-review/SKILL.md +63 -0
  193. package/templates/workspace/.opencode/skills/ws-req-change/SKILL.md +41 -0
  194. package/templates/workspace/.opencode/skills/ws-req-contract-sync/SKILL.md +17 -0
  195. package/templates/workspace/.opencode/skills/ws-req-contract-validate/SKILL.md +12 -0
  196. package/templates/workspace/.opencode/skills/ws-req-flow-sync/SKILL.md +28 -0
  197. package/templates/workspace/.opencode/skills/ws-req-review/SKILL.md +32 -0
  198. package/templates/workspace/.opencode/skills/ws-review/SKILL.md +57 -0
  199. package/templates/workspace/.opencode/skills/ws-rule/SKILL.md +23 -0
  200. package/templates/workspace/.opencode/skills/ws-spec-review/SKILL.md +64 -0
  201. package/templates/workspace/.opencode/skills/ws-submodule-setup/SKILL.md +65 -0
  202. package/templates/workspace/.opencode/skills/ws-verify-before-complete/SKILL.md +59 -0
  203. package/templates/workspace/AGENTS.md +72 -29
  204. package/templates/workspace/AI_WORKSPACE.md +4 -4
  205. package/templates/workspace/changes/README.md +26 -2
  206. package/templates/workspace/changes/templates/proposal.md +15 -0
  207. package/templates/workspace/changes/templates/tasks.md +9 -2
  208. package/templates/workspace/manifest.json +279 -2
  209. package/templates/workspace/tools/ws_change_check.py +27 -5
  210. package/templates/workspace/tools/ws_resolve_sub_target.sh +1 -0
@@ -0,0 +1,70 @@
1
+ # workflow-stage-contracts
2
+
3
+ <!-- Generated from packages/spec/docs/workflow-stage-contracts.json by scripts/sync-workflow-stage-contracts.mjs. Do not hand edit. -->
4
+
5
+ ## 目的
6
+
7
+ 这份文档把 `aiws` 核心 `ws-*` workflow 的阶段契约写成统一真值,避免不同工具、不同协作者把同一个入口用成不同语义。
8
+
9
+ 重点不是“命令名长什么样”,而是每个阶段必须收什么输入、产出什么结果、在什么情况下必须停止。
10
+
11
+ ## 标准链路
12
+
13
+ 默认链路:
14
+
15
+ `ws-preflight` -> `ws-plan` -> `ws-plan-verify` -> `ws-dev` -> `ws-review` -> `ws-commit` -> `ws-deliver` -> `ws-finish` -> `ws-handoff`
16
+
17
+ 说明:
18
+ - ws-deliver 用于多 repo / submodule 场景的顺序提交与交付准备。
19
+ - ws-finish 用于 fast-forward 合并、push 和 worktree cleanup。
20
+ - ws-handoff 通常在 archive 后使用,为下一次会话留下交接说明。
21
+ - 若存在独立 change worktree,治理信号应优先读取该 worktree;若 worktree metadata 已 stale,则降级为 warning 并回退到当前 worktree。
22
+
23
+ ## 阶段表
24
+
25
+ | Stage | 目标 | 必需输入 | 必需输出 | 阻断条件 | 下一步 |
26
+ | --- | --- | --- | --- | --- | --- |
27
+ | `ws-preflight` | 对齐真值文件与协作约束 | 项目根;AI_PROJECT.md;REQUIREMENTS.md;AI_WORKSPACE.md | Root / Found / Missing / Key rules / Next | 无法确定项目根;真值缺失 | ws-plan 或 ws-dev |
28
+ | `ws-plan` | 建立 change 绑定并落盘计划 | 任务描述;真值文件;proposal.md(若存在) | plan/...;Bindings;Verify;Risks;Evidence;Next | 绑定不清;dirty 工作区无法安全建 context;无法写盘 | ws-plan-verify |
29
+ | `ws-plan-verify` | 检查计划是否满足严格契约 | plan/...;proposal.md;当前 change | Quality gate;Fix list;可执行最小计划摘要 | strict 校验失败;无法定位 change | 修计划后重跑或进入 ws-dev |
30
+ | `ws-dev` | 实施最小改动并验证 | 真值文件;归因目标;计划(medium/complex) | Changed;Verify;Evidence;Next | 无法归因;没有验证入口;change 上下文不安全 | ws-review / ws-commit |
31
+ | `ws-review` | 审计规范、风险与验证完整性 | 当前 diff;验证结果;真值文件 | review 文件;Top risks;Next | 无改动可审;无法写审计证据 | ws-commit 或修复后重审 |
32
+ | `ws-commit` | 串联 review、validate、commit 确认 | staged diff;review 证据;validate stamp;用户确认的 message | Evidence;Context;Commit | 无 staged changes;submodule dirty;validate 失败;message 未确认 | ws-deliver / ws-finish |
33
+ | `ws-deliver` | 在 submodule 场景下完成顺序提交与证据收敛 | change 上下文;.gitmodules;submodules.targets;各 repo 状态 | submodule 提交摘要;superproject 提交摘要;Evidence | submodule 真值不完整;不在正确 change;commit 未确认 | ws-finish |
34
+ | `ws-finish` | 安全合并、push、cleanup | 干净工作区;已提交的 change;push 目标;submodule 真值(若有) | Merge;Push;Worktree cleanup;Evidence | dirty 工作区;ff 失败;submodule 无法安全 push | ws-handoff 或 archive |
35
+ | `ws-handoff` | 生成可接力的归档交接说明 | 已归档或待归档的 change | changes/archive/.../handoff.md;Next | 无法定位 change;archive 失败;handoff 无法生成 | 新 change 通过 Depends_On 接力 |
36
+
37
+ ## 统一规则
38
+
39
+ - 每个阶段都必须回指真值文件或 change 工件,不能只依赖会话上下文。
40
+ - 每个阶段都必须有明确输出,不能只给“建议继续”而不留下工件或证据。
41
+ - 遇到阻断条件时必须停止,不能为了推进速度跳过门禁。
42
+ - 如果一个阶段没有留下可审计路径,它就不算真正完成。
43
+ - `ws-finish` 只有在 merge、push、cleanup 都完成后才算完成;仅本地 merge 成功不等于可进入 `ws-handoff`。
44
+
45
+ ## 证据约定
46
+
47
+ 最少证据集合:
48
+
49
+ - planning:`plan/...`、`changes/<change-id>/proposal.md`、`tasks.md`
50
+ - review:`changes/<change-id>/review/...` 或 `.agentdocs/tmp/review/...`
51
+ - validate:`.agentdocs/tmp/aiws-validate/*.json`
52
+ - deliver / finish:`changes/<change-id>/evidence/...`、`state`、merge / push 结果
53
+ - handoff:`changes/archive/.../handoff.md`
54
+
55
+ 补充:
56
+ - tmp review 证据可以作为“进入 commit gate”的临时治理信号,但在交付前应通过 `aiws change evidence` 收敛为持久 review 证据。
57
+ - finish 生命周期建议区分“本地开始”和“完整完成”两类信号,避免仅凭本地 merge 就误导到 handoff。
58
+
59
+ ## 与产品定位的关系
60
+
61
+ 这份阶段契约文档是 `aiws` “治理内核”定位的直接落点:
62
+
63
+ - `packages/spec/` 继续作为规则真值层
64
+ - `ws-*` 阶段契约是工作流治理层
65
+ - `docs/workflow-stage-contracts.json` 是运行时阶段契约的机器可读真值
66
+ - `docs/workflow-governance-rules.json` 是运行时阶段推断的机器可读真值
67
+ - CLI / tool-native files 是执行与分发层
68
+ - review / validate / handoff 等工件属于证据与审计层
69
+
70
+ 如果未来要吸收新的 skill、协同角色或外部 workflow,优先判断它能否被映射到这张阶段表;不能稳定映射的能力,不应直接成为核心真值。
@@ -0,0 +1,98 @@
1
+ {
2
+ "type": "object",
3
+ "required": [
4
+ "version",
5
+ "title",
6
+ "description",
7
+ "purpose",
8
+ "standardChain",
9
+ "notes",
10
+ "stages",
11
+ "unifiedRules",
12
+ "evidence",
13
+ "positioning"
14
+ ],
15
+ "properties": {
16
+ "version": { "type": "integer" },
17
+ "title": { "type": "string", "minLength": 1 },
18
+ "description": { "type": "string", "minLength": 1 },
19
+ "purpose": {
20
+ "type": "array",
21
+ "minItems": 1,
22
+ "items": { "type": "string", "minLength": 1 }
23
+ },
24
+ "standardChain": {
25
+ "type": "array",
26
+ "minItems": 1,
27
+ "items": { "type": "string", "minLength": 1, "pattern": "^ws-[a-z0-9-]+$" }
28
+ },
29
+ "notes": {
30
+ "type": "array",
31
+ "minItems": 1,
32
+ "items": { "type": "string", "minLength": 1 }
33
+ },
34
+ "stages": {
35
+ "type": "array",
36
+ "minItems": 1,
37
+ "items": {
38
+ "type": "object",
39
+ "required": ["stage", "goal", "requiredInputs", "requiredOutputs", "blockers", "next"],
40
+ "properties": {
41
+ "stage": { "type": "string", "minLength": 1, "pattern": "^ws-[a-z0-9-]+$" },
42
+ "goal": { "type": "string", "minLength": 1 },
43
+ "requiredInputs": { "type": "string", "minLength": 1 },
44
+ "requiredOutputs": { "type": "string", "minLength": 1 },
45
+ "blockers": { "type": "string", "minLength": 1 },
46
+ "next": { "type": "string", "minLength": 1 }
47
+ },
48
+ "additionalProperties": false
49
+ }
50
+ },
51
+ "unifiedRules": {
52
+ "type": "array",
53
+ "minItems": 1,
54
+ "items": { "type": "string", "minLength": 1 }
55
+ },
56
+ "evidence": {
57
+ "type": "object",
58
+ "required": ["intro", "minimum", "notes"],
59
+ "properties": {
60
+ "intro": { "type": "string", "minLength": 1 },
61
+ "minimum": {
62
+ "type": "array",
63
+ "minItems": 1,
64
+ "items": {
65
+ "type": "object",
66
+ "required": ["label", "value"],
67
+ "properties": {
68
+ "label": { "type": "string", "minLength": 1 },
69
+ "value": { "type": "string", "minLength": 1 }
70
+ },
71
+ "additionalProperties": false
72
+ }
73
+ },
74
+ "notes": {
75
+ "type": "array",
76
+ "minItems": 1,
77
+ "items": { "type": "string", "minLength": 1 }
78
+ }
79
+ },
80
+ "additionalProperties": false
81
+ },
82
+ "positioning": {
83
+ "type": "object",
84
+ "required": ["intro", "layers", "closing"],
85
+ "properties": {
86
+ "intro": { "type": "string", "minLength": 1 },
87
+ "layers": {
88
+ "type": "array",
89
+ "minItems": 1,
90
+ "items": { "type": "string", "minLength": 1 }
91
+ },
92
+ "closing": { "type": "string", "minLength": 1 }
93
+ },
94
+ "additionalProperties": false
95
+ }
96
+ },
97
+ "additionalProperties": false
98
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aipper/aiws-spec",
3
- "version": "0.0.23",
3
+ "version": "0.0.25",
4
4
  "description": "AIWS spec and templates (single source of truth).",
5
5
  "type": "module",
6
6
  "files": [
@@ -0,0 +1,83 @@
1
+ ---
2
+ name: using-aiws
3
+ description: 默认 workflow bootstrap/router:先读真值,再路由到正确的 ws-* 入口
4
+ ---
5
+
6
+ 用中文输出(命令/路径/代码标识符保持原样不翻译)。
7
+
8
+ 目标:
9
+ - 作为默认入口,先读取 `AI_PROJECT.md` / `REQUIREMENTS.md` / `AI_WORKSPACE.md`
10
+ - 先判定当前任务属于哪个 workflow,再进入具体 `ws-*` skill
11
+ - 若任务意图、归因或验证入口不明确:先澄清,不直接进入实现
12
+
13
+ 阶段定位:
14
+ - bootstrap/router 阶段;负责 workflow 分流,而不是直接完成实现。
15
+
16
+ 必需输入:
17
+ - 当前任务描述
18
+ - `AI_PROJECT.md`
19
+ - `REQUIREMENTS.md`
20
+ - `AI_WORKSPACE.md`
21
+ - 若已存在:当前 `change/<change-id>` 上下文、`plan/...`、`changes/<change-id>/...`
22
+
23
+ 必需输出:
24
+ - `Root:` 当前项目根
25
+ - `Found:` 实际读取到的真值文件
26
+ - `Task intent:` 当前任务意图分类
27
+ - `Binding:` `Req_ID` / `Problem_ID` / change 上下文是否清晰
28
+ - `Route:` 选中的下一步 skill
29
+ - `Why:` 选择该 route 的原因
30
+ - `Next:` 进入对应 skill,或先提澄清问题
31
+
32
+ 阻断条件:
33
+ - 无法确定项目根目录
34
+ - 缺失任一真值文件
35
+ - 无法明确当前任务意图
36
+ - 无法明确归因或验证入口,且不能安全推断
37
+
38
+ 完成判定:
39
+ - 已经明确给出单一路由结果,并进入对应 `ws-*` skill;或已提出关键澄清问题并停止。
40
+
41
+ 执行步骤(强制):
42
+ 1) 先遵守 `$ws-preflight` 的真值读取要求:
43
+ - 定位项目根目录
44
+ - 读取 `AI_PROJECT.md` / `REQUIREMENTS.md` / `AI_WORKSPACE.md`
45
+ - 输出 `Root:` / `Found:` / `Missing:`
46
+ 2) 若缺失任一真值文件:
47
+ - 不进入实现
48
+ - 输出下一步:先 `aiws init .`(或 `npx @aipper/aiws init .`),然后重新执行 `$using-aiws`
49
+ - 此时 route 视为 `$ws-preflight`
50
+ 3) 根据 `packages/spec/docs/workflow-router-rules.json` 判定任务属于哪一类:
51
+ - 需求/验收/合同变更:`$ws-req-review`
52
+ - 评审/审计/找风险:`$ws-review`
53
+ - finish / merge / push / cleanup:`$ws-finish`
54
+ - handoff / archive summary:`$ws-handoff`
55
+ - 中大型实现、需要方案、需要 change/worktree:`$ws-plan`
56
+ - 小步明确实现/修复/配置调整:`$ws-dev`
57
+ 4) 若任务意图或归因不明确:
58
+ - 只问 1-3 个关键澄清问题
59
+ - 明确写出缺的是什么:意图、`Req_ID` / `Problem_ID`、verify、change 上下文
60
+ - 然后停止;不要直接写代码
61
+ 5) 若已确定 route:
62
+ - 先输出:
63
+ - `Task intent:`
64
+ - `Binding:`
65
+ - `Route:`
66
+ - `Why:`
67
+ - 然后在同一轮中继续遵循对应 skill 的契约
68
+ 6) 路由约束:
69
+ - router 自己不是实现阶段;不要在给出 route 之前直接改代码
70
+ - 除非用户只想听判断结果,否则给出 route 后应继续按对应 skill 的规则推进
71
+ - 一次只选择一个主 route;不要把 `ws-plan` / `ws-dev` / `ws-review` / `ws-finish` 混成并行终态
72
+ 7) 若执行过程中发现复杂度升高:
73
+ - 从 `$ws-dev` 回退到 `$ws-plan`
74
+ - 从 `$ws-finish` 回退到前置门禁而不是硬推完成
75
+
76
+ 输出模板:
77
+ - `Root:` <path>
78
+ - `Found:` <files>
79
+ - `Task intent:` <分类>
80
+ - `Binding:` <清晰 / 缺失项>
81
+ - `Route:` <$ws-... 或 clarify>
82
+ - `Why:` <一句到三句>
83
+ - `Next:` <继续执行对应 skill,或提出澄清问题>
@@ -19,12 +19,34 @@ description: 缺陷修复(通过禅道 MCP 拉取 bug 与附件,下载图片
19
19
  前置:
20
20
  1) 先运行 `$ws-preflight`。
21
21
  2) 准备 `change-id`(建议:`bug-<bug-id>` 或 `bugfix-<bug-id>-<slug>`)。
22
- 3) 建立变更工件(推荐):
22
+ 3) 建立 change 上下文(推荐先于任何落盘):
23
+ - 若当前还不在 `change/<change-id>` 分支 / worktree,先调用 `aiws change start`
24
+ - 工作区必须先干净;否则不要先写 `changes/<change-id>/bug/` 或 `issues/fix_bus_issues.csv`,避免后续切 worktree 时工件留在原工作区
25
+ - 仓库已有提交:优先 `--worktree`
26
+ - superproject + submodule:优先 `--worktree --submodules`
27
+ - 仓库尚无提交 / 不满足 worktree 前置条件:回退 `--no-switch`
23
28
  ```bash
24
- aiws change start <change-id> --hooks
25
- # superproject + submodule 推荐:
26
- aiws change start <change-id> --hooks --worktree --submodules
29
+ if [[ -n "$(git status --porcelain)" ]]; then
30
+ echo "error: working tree dirty before ws-bugfix creates change context"
31
+ exit 2
32
+ fi
33
+
34
+ if git rev-parse --verify HEAD >/dev/null 2>&1; then
35
+ if [[ -f .gitmodules ]] && git config --file .gitmodules --get-regexp '^submodule\\..*\\.path$' >/dev/null 2>&1; then
36
+ aiws change start <change-id> --hooks --worktree --submodules
37
+ else
38
+ aiws change start <change-id> --hooks --worktree
39
+ fi
40
+ else
41
+ aiws change start <change-id> --hooks --no-switch
42
+ fi
27
43
  ```
44
+ - 若上一步创建了 worktree:后续 bug 证据、CSV 更新、`$ws-dev` 修复都必须在该 worktree 中继续;不要回原工作区重复创建 change
45
+ - 若该 change 涉及 submodule:
46
+ - 优先复用 `$ws-dev` 的 `submodules.targets` 生成/确认流程
47
+ - detached HEAD 时默认建议取 `.gitmodules` 声明的分支
48
+ - 已附着在某个本地分支时默认建议取当前分支
49
+ - 以上都只是建议值,最终必须显式写入 `changes/<change-id>/submodules.targets`
28
50
 
29
51
  建议流程(按顺序):
30
52
 
@@ -36,7 +58,7 @@ aiws change start <change-id> --hooks --worktree --submodules
36
58
  - 若当前环境没有 zentao MCP 工具:立即停止并提示用户先配置,不要猜数据。
37
59
 
38
60
  ## 2) 证据落盘(强制)
39
- `changes/<change-id>/bug/` 下落盘:
61
+ 在当前 active change 上下文的 `changes/<change-id>/bug/` 下落盘:
40
62
  - `zentao-bug-<bug-id>.json`:原始字段快照(避免信息丢失)
41
63
  - `zentao-bug-<bug-id>.md`:人类可读摘要(复现步骤/期望/实际/风险)
42
64
  - `images/<bug-id>/...`:下载的图片附件(保留原扩展名)
@@ -50,7 +72,7 @@ changes/<change-id>/bug/
50
72
  ```
51
73
 
52
74
  ## 3) 汇总到 issues/fix_bus_issues.csv(upsert)
53
- - 目标文件:`issues/fix_bus_issues.csv`
75
+ - 目标文件:当前 active change 上下文中的 `issues/fix_bus_issues.csv`
54
76
  - 若文件不存在,先创建表头:
55
77
  ```csv
56
78
  Bug_ID,Title,Severity,Module,Status,Assigned_To,Change_ID,Image_Count,Image_Paths,Evidence_Path,Verify_Command,Fix_Status,Updated_At,Notes
@@ -66,7 +88,7 @@ Bug_ID,Title,Severity,Module,Status,Assigned_To,Change_ID,Image_Count,Image_Path
66
88
  - `Fix_Status`:`TODO|DOING|DONE|BLOCKED`
67
89
 
68
90
  ## 4) 修复执行与回填
69
- - 进入 `$ws-dev` 做最小改动修复。
91
+ - 进入 `$ws-dev` 做最小改动修复;若 `ws-bugfix` 创建了 worktree,则必须在该 worktree 中继续。
70
92
  - 完成后回填 `issues/fix_bus_issues.csv`:
71
93
  - `Fix_Status`
72
94
  - `Verify_Command`
@@ -83,6 +105,7 @@ aiws validate . --stamp
83
105
 
84
106
  输出要求:
85
107
  - `Change_ID:` `<change-id>`
108
+ - `Change context:` `<当前分支或 worktree 路径>`
86
109
  - `CSV:` `issues/fix_bus_issues.csv` 中对应 `Bug_ID` 行的关键字段
87
110
  - `Evidence:` `changes/<change-id>/bug/zentao-bug-<bug-id>.md` + 图片目录
88
111
  - `Verify:` 实际运行命令与结果(未运行不声称已运行)
@@ -18,7 +18,31 @@ description: 提交(当前分支可直提;submodule 感知;先审计/门
18
18
  - 不自动 push
19
19
  - 不写入任何 secrets
20
20
  - 检测到 submodule 有未提交改动时,不允许直接提交 superproject(先处理 submodule)
21
- - commit message 默认使用中文(命令/路径/代码标识符保持原样不翻译);格式建议:`<类型>: <简述>`(例如 `修复: 登录页空指针`、`功能: 新增 submodule targets 校验`、`重构: 提取共享脚本`)
21
+ - commit message 优先使用中文(命令/路径/代码标识符保持原样不翻译);格式建议:`<类型>: <简述>`(例如 `修复: 登录页空指针`、`功能: 新增 submodule targets 校验`、`重构: 提取共享脚本`)
22
+ - 若启用了 `.githooks/commit-msg`:默认会提示优先中文;只有在 `git config aiws.commitMessagePolicy strict` 时才会拒绝全英文首行(`Merge/Revert/fixup!/squash!` 例外)
23
+
24
+ 阶段定位:
25
+ - commit gate;负责在提交前收敛 review、validate 和 message 确认,不允许跳过 hooks。
26
+
27
+ 必需输入:
28
+ - 当前分支与 staged diff
29
+ - `$ws-review` 生成的审计证据
30
+ - `aiws validate . --stamp` 生成的校验证据
31
+ - 用户确认后的 commit message
32
+
33
+ 必需输出:
34
+ - `证据(Evidence):` review 文件路径 + validate stamp 路径
35
+ - `上下文(Context):` 当前分支、submodule 检测结果、阻断原因(若有)
36
+ - `提交信息(Commit):` 最终提交信息
37
+
38
+ 阻断条件:
39
+ - 没有 staged changes
40
+ - submodule 工作区不干净或 detached 处理不完整
41
+ - 用户未确认 commit message
42
+ - validate 失败
43
+
44
+ 完成判定:
45
+ - 提交已完成,证据路径明确,且没有通过 `--no-verify` 绕过门禁。
22
46
 
23
47
  执行步骤(建议):
24
48
  1) 运行 `$ws-preflight`(确保真值文件就绪)。
@@ -87,6 +111,7 @@ git diff --staged --submodule=short
87
111
  - 类型参考:`功能` / `修复` / `重构` / `文档` / `测试` / `构建` / `杂项`
88
112
  - 简述用一句话概括本次改动的"为什么"而非"改了什么"
89
113
  - 命令/路径/代码标识符保持原样不翻译
114
+ - 若用户给出全英文 message:优先改写成中文;若用户明确要求保留英文,也可以提交(但 strict 模式下会被 hook 拒绝)
90
115
  10) 执行提交(不带 `--no-verify`):
91
116
  ```bash
92
117
  git commit -m "<message>"
@@ -0,0 +1,75 @@
1
+ ---
2
+ name: ws-delegate
3
+ description: 原生多 agent 委托入口(Codex 优先;先定义角色/边界/工件/降级,再决定是否委托)
4
+ ---
5
+
6
+ 用中文输出(命令/路径/代码标识符保持原样不翻译)。
7
+
8
+ 目标:在 AIWS 治理约束下,只有在任务已绑定且 scope 可控时,才使用当前工具的原生多 agent / sub-agent 能力;否则明确降级为单 agent + 协同工件模式。
9
+
10
+ 阶段定位:
11
+ - implementation / review 的辅助入口;它不是独立 workflow 阶段,也不能绕过 `ws-plan`、`ws-dev`、`ws-review`、`ws-finish`。
12
+
13
+ 必需输入:
14
+ - 真值文件:`AI_PROJECT.md` / `REQUIREMENTS.md` / `AI_WORKSPACE.md`
15
+ - delegation contract:`packages/spec/docs/workflow-delegation-contracts.md`
16
+ - 当前任务已绑定 `Req_ID` / change / Verify 入口
17
+ - 拟委托子任务的角色划分、读写边界、artifact 目标与 fallback
18
+
19
+ 必需输出:
20
+ - `Delegation Plan:` 逐项写清 role / task / readScope / writeScope / artifactTargets / fallback
21
+ - `Execution Mode:` 明确是 `native multi-agent` 还是 `fallback single-agent`
22
+ - `Evidence:` 委托产物路径(`analysis/` / `patches/` / `review/` / `evidence/`)
23
+ - `Next:` 收敛后应回到 `ws-dev`、`ws-review`、`ws-commit` 或 `ws-finish`
24
+
25
+ 阻断条件:
26
+ - 无法绑定到 `Req_ID` / change / Verify
27
+ - 没有明确的 `writeScope` / `artifactTargets`
28
+ - 当前工具缺少稳定 native delegation 能力,且你又不能接受降级执行
29
+ - 任务规模太小,引入委托只会增加复杂度
30
+
31
+ 完成判定:
32
+ - 已经明确本次是否适合委托
33
+ - 若适合:delegation plan 已声明并执行,产物回收到 AIWS 约定路径
34
+ - 若不适合:已明确降级原因,并回到单 agent 流程继续执行
35
+
36
+ 步骤(建议):
37
+ 1) 先读取真值文件与 `packages/spec/docs/workflow-delegation-contracts.md`,确认这不是“为了多 agent 而多 agent”。
38
+ 2) 判断当前任务是否真的需要委托:
39
+ - 需要并行的只读探索
40
+ - 需要把实现与审查拆开
41
+ - 有明确、互不重叠的写入边界
42
+ - 委托收益大于协调成本
43
+ 3) 先写 `Delegation Plan:`,至少包含:
44
+ - `role`
45
+ - `task`
46
+ - `readScope`
47
+ - `writeScope`
48
+ - `artifactTargets`
49
+ - `fallback`
50
+ 4) 若当前环境支持原生多 agent:
51
+ - 优先把探索型工作交给 `explorer`
52
+ - 只把显式授权的文件范围交给 `worker`
53
+ - 至少保留一个独立 `reviewer`
54
+ - 由主 agent / `integrator` 统一收敛结果
55
+ 5) 若当前环境不支持,或无法稳定约束 scope:
56
+ - 明确输出 `Execution Mode: fallback single-agent`
57
+ - 仍按 AIWS 协同工件约定执行:
58
+ - `changes/<id>/analysis/`
59
+ - `changes/<id>/patches/`
60
+ - `changes/<id>/review/`
61
+ - `changes/<id>/evidence/`
62
+ 6) 不论是否启用原生多 agent,都不要跳过:
63
+ - 需求归因
64
+ - 验证命令
65
+ - review convergence
66
+ - finish / handoff gate
67
+
68
+ Codex 优先说明:
69
+ - 若当前环境支持原生多 agent / sub-agent,就按 delegation contract 显式拆 role 与 scope。
70
+ - 若不支持,或你无法保证写边界,直接降级,不临时发明新的 runtime/controller。
71
+
72
+ 安全:
73
+ - 不把 `aiws` 变成统一 orchestrator。
74
+ - 不让 delegated agent 越权写未授权文件。
75
+ - 不把 `patches/` 视为“已合并代码”。
@@ -25,11 +25,34 @@ description: 交付(submodules + superproject 分步提交,并安全合并
25
25
  - 该 repo 的 `git diff --staged`
26
26
  并让用户确认 commit message(每个 repo 单独确认)。
27
27
 
28
+ 阶段定位:
29
+ - delivery 阶段;负责在多 repo / submodule 场景下完成顺序提交、证据收敛和最终合并前准备。
30
+
31
+ 必需输入:
32
+ - 当前 `change/<change-id>` 上下文
33
+ - 若存在 submodule:`.gitmodules` + `changes/<change-id>/submodules.targets`
34
+ - 各 repo 当前状态与 staged diff
35
+
36
+ 必需输出:
37
+ - `Submodules:` 每个 submodule 的提交摘要
38
+ - `Superproject:` 主仓库提交摘要
39
+ - `Evidence:` validate stamp 与持久证据路径
40
+ - `Next:` 进入 `$ws-finish` 或 `aiws change finish`
41
+
42
+ 阻断条件:
43
+ - 不在正确的 change 上下文
44
+ - submodule branch / targets 真值不完整
45
+ - 任一 repo 未确认 commit message 或存在未处理冲突
46
+
47
+ 完成判定:
48
+ - submodule 与 superproject 提交都已完成,证据已收敛,且可以安全进入 finish 阶段。
49
+
28
50
  建议流程(按顺序):
29
51
 
30
52
  ## 0) submodule branch 真值检查(减少 detached 与人为差异)
31
53
  如果存在 `.gitmodules` 但缺少 `submodule.<name>.branch`,先运行 `$ws-submodule-setup` 并提交 `.gitmodules`,否则后续 `aiws validate .` 会失败,且 `ws-pull/ws-finish` 无法确定性工作。
32
- > 说明:若同一 superproject 分支内存在“多渠道 submodule 目标分支”的交付需求,可在 `changes/<change-id>/submodules.targets` 额外声明本次 change 的目标分支;交付时会优先使用该文件(不改变 `.gitmodules` 的团队默认真值)。
54
+ > 说明:若同一 superproject 分支内存在多渠道 submodule 目标分支的交付需求,可在 `changes/<change-id>/submodules.targets` 额外声明本次 change 的目标分支;交付时会优先使用该文件(不改变 `.gitmodules` 的团队默认真值)。
55
+ > 生成该文件时,可以按当前状态做默认预填,但必须显式说明来源并让用户确认:detached HEAD 默认建议取 `.gitmodules` 声明分支;已附着在某个本地分支时默认建议取当前分支;finish/push 最终只认 `submodules.targets`。
33
56
  ```bash
34
57
  if [[ -f .gitmodules ]]; then
35
58
  missing=0
@@ -85,15 +108,29 @@ sub_path="<path>"
85
108
  git -C "$sub_path" branch --show-current
86
109
  git -C "$sub_path" status --porcelain
87
110
  ```
88
- 2) submodule 处于 detached HEAD(`branch --show-current` 为空):
111
+ 2) 先确定该 submodule 的目标分支来源,并显式说明给用户:
112
+ - `branch --show-current` 非空:默认建议用当前分支
113
+ - `branch --show-current` 为空(detached HEAD):默认建议用 `.gitmodules` 的 `submodule.<name>.branch`
114
+ - 若建议值与 `changes/<change-id>/submodules.targets` 已落盘值不一致:以 `submodules.targets` 为准,并先提示差异
115
+ 3) 若 submodule 处于 detached HEAD(`branch --show-current` 为空):
89
116
  - 说明:这通常是因为 superproject 的 gitlink checkout(例如 `git submodule update`)导致 detached。
90
- - 不要直接切 `change/<change-id>` / `main` / `master` 来“解 detached”。
117
+ - 不要直接切 `change/<change-id>` / `main` / `master` 来解 detached
91
118
  - 若你要在该 submodule 里提交:先按目标分支挂到 pin 分支 `aiws/pin/<target-branch>`,再在其上提交:
92
119
  - 目标分支真值优先级:`changes/<change-id>/submodules.targets`(若存在)> `.gitmodules submodule.<name>.branch`
93
120
  ```bash
94
121
  change_id="<change-id>"
95
122
  targets="changes/${change_id}/submodules.targets"
96
- base_branch="$(git branch --show-current)"
123
+ sub_name="$(git config --file .gitmodules --get-regexp '^submodule\\..*\\.path$' 2>/dev/null | awk -v p="${sub_path}" '$2==p { name=$1; sub(/^submodule\\./,"",name); sub(/\\.path$/,"",name); print name; exit }')"
124
+ base_branch="$(python3 - <<'PY'
125
+ import json, pathlib
126
+ change_id = "<change-id>"
127
+ meta = pathlib.Path("changes") / change_id / ".ws-change.json"
128
+ data = json.loads(meta.read_text(encoding="utf-8"))
129
+ print((data.get("base_branch") or "").strip())
130
+ PY
131
+ )"
132
+ test -n "${sub_name}"
133
+ test -n "${base_branch}"
97
134
 
98
135
  source tools/ws_resolve_sub_target.sh
99
136
  ws_resolve_sub_target "${sub_path}" "${sub_name}" "${targets}" "${base_branch}" || exit 2
@@ -109,18 +146,18 @@ git -C "$sub_path" checkout -B "aiws/pin/${target_branch}" HEAD
109
146
  git -C "$sub_path" branch --set-upstream-to "${remote}/${target_branch}" "aiws/pin/${target_branch}" >/dev/null 2>&1 || true
110
147
  ```
111
148
  - 若 `origin/<target-branch>` 不存在,或用户明确不想使用 pin 分支:停止,解释风险(提交可能不可追溯/难以推送)。
112
- 3) 选择性 staging(默认用 `-p` 更安全):
149
+ 4) 选择性 staging(默认用 `-p` 更安全):
113
150
  ```bash
114
151
  git -C "$sub_path" add -p
115
152
  git -C "$sub_path" diff --staged --stat
116
153
  git -C "$sub_path" diff --staged
117
154
  ```
118
- 4) AI 生成该 submodule 的 commit message(标题+可选 body),并让用户确认(每个 repo 单独确认)。
119
- 5) 执行提交(不带 `--no-verify`):
155
+ 5) AI 生成该 submodule 的 commit message(标题+可选 body),并让用户确认(每个 repo 单独确认)。
156
+ 6) 执行提交(不带 `--no-verify`):
120
157
  ```bash
121
158
  git -C "$sub_path" commit -m "<message>"
122
159
  ```
123
- 6) 若该 submodule 没有 staged changes:跳过(不要硬提交空 commit)。
160
+ 7) 若该 submodule 没有 staged changes:跳过(不要硬提交空 commit)。
124
161
 
125
162
  ## C) 提交 superproject(更新 gitlinks + 自身改动 + changes 工件)
126
163
  1) 先检查 submodule 指针差异(gitlinks):
@@ -138,7 +175,7 @@ git add -p
138
175
  git diff --staged --stat
139
176
  git diff --staged
140
177
  ```
141
- 3) AI 生成 superproject 的 commit message(应包含 bump submodule <name> -> <sha>” 等关键信息),并让用户确认。
178
+ 3) AI 生成 superproject 的 commit message(应包含 `bump submodule <name> -> <sha>` 等关键信息),并让用户确认。
142
179
  4) 提交:
143
180
  ```bash
144
181
  git commit -m "<message>"