@aipper/aiws-spec 0.0.33 → 0.0.36

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 (178) hide show
  1. package/docs/aiws-bootstrap-routing-design.md +5 -50
  2. package/docs/aiws-governance-positioning.md +1 -1
  3. package/docs/cli-interface.md +13 -73
  4. package/docs/collaboration-artifacts.md +2 -2
  5. package/docs/opencode-autonomous-swarm.md +0 -2
  6. package/docs/opencode-omo-adapter.md +0 -2
  7. package/docs/opencode-omo-validation-checklist.md +0 -1
  8. package/docs/spec-contract.md +10 -36
  9. package/docs/workflow-router-rules.json +2 -2
  10. package/docs/workflow-router-rules.md +2 -2
  11. package/docs/ws-goal-contract.md +153 -33
  12. package/package.json +1 -1
  13. package/templates/workspace/.aiws/continuation/CONTINUATION_PROTOCOL.md +101 -0
  14. package/templates/workspace/.aiws/manifest.json +2 -10
  15. package/templates/workspace/.opencode/command/ws-finish.md +4 -0
  16. package/templates/workspace/.opencode/command/ws-goal.md +132 -20
  17. package/templates/workspace/.opencode/commands/ws-finish.md +4 -0
  18. package/templates/workspace/.opencode/skills/ws-goal/SKILL.md +32 -0
  19. package/templates/workspace/AGENTS.md +1 -3
  20. package/templates/workspace/AI_PROJECT.md +6 -1
  21. package/templates/workspace/AI_WORKSPACE.md +1 -1
  22. package/templates/workspace/manifest.json +179 -446
  23. package/templates/workspace/.agents/skills/p-aiws-change-archive/SKILL.md +0 -24
  24. package/templates/workspace/.agents/skills/p-aiws-change-finish/SKILL.md +0 -24
  25. package/templates/workspace/.agents/skills/p-aiws-change-list/SKILL.md +0 -18
  26. package/templates/workspace/.agents/skills/p-aiws-change-new/SKILL.md +0 -26
  27. package/templates/workspace/.agents/skills/p-aiws-change-next/SKILL.md +0 -19
  28. package/templates/workspace/.agents/skills/p-aiws-change-start/SKILL.md +0 -33
  29. package/templates/workspace/.agents/skills/p-aiws-change-status/SKILL.md +0 -19
  30. package/templates/workspace/.agents/skills/p-aiws-change-sync/SKILL.md +0 -19
  31. package/templates/workspace/.agents/skills/p-aiws-change-templates-init/SKILL.md +0 -18
  32. package/templates/workspace/.agents/skills/p-aiws-change-templates-which/SKILL.md +0 -18
  33. package/templates/workspace/.agents/skills/p-aiws-change-validate/SKILL.md +0 -23
  34. package/templates/workspace/.agents/skills/p-aiws-hooks-install/SKILL.md +0 -30
  35. package/templates/workspace/.agents/skills/p-aiws-hooks-status/SKILL.md +0 -18
  36. package/templates/workspace/.agents/skills/p-aiws-init/SKILL.md +0 -27
  37. package/templates/workspace/.agents/skills/p-aiws-rollback/SKILL.md +0 -18
  38. package/templates/workspace/.agents/skills/p-aiws-update/SKILL.md +0 -26
  39. package/templates/workspace/.agents/skills/p-aiws-validate/SKILL.md +0 -22
  40. package/templates/workspace/.agents/skills/p-tasks-plan/SKILL.md +0 -37
  41. package/templates/workspace/.agents/skills/using-aiws/SKILL.md +0 -112
  42. package/templates/workspace/.agents/skills/ws-analyze/SKILL.md +0 -26
  43. package/templates/workspace/.agents/skills/ws-bugfix/SKILL.md +0 -111
  44. package/templates/workspace/.agents/skills/ws-commit/SKILL.md +0 -18
  45. package/templates/workspace/.agents/skills/ws-delegate/SKILL.md +0 -75
  46. package/templates/workspace/.agents/skills/ws-deliver/SKILL.md +0 -18
  47. package/templates/workspace/.agents/skills/ws-dev/SKILL.md +0 -109
  48. package/templates/workspace/.agents/skills/ws-dev-lite/SKILL.md +0 -58
  49. package/templates/workspace/.agents/skills/ws-finish/SKILL.md +0 -22
  50. package/templates/workspace/.agents/skills/ws-frontend-design/SKILL.md +0 -126
  51. package/templates/workspace/.agents/skills/ws-goal/SKILL.md +0 -89
  52. package/templates/workspace/.agents/skills/ws-handoff/SKILL.md +0 -18
  53. package/templates/workspace/.agents/skills/ws-intake/SKILL.md +0 -106
  54. package/templates/workspace/.agents/skills/ws-migrate/SKILL.md +0 -18
  55. package/templates/workspace/.agents/skills/ws-plan/SKILL.md +0 -144
  56. package/templates/workspace/.agents/skills/ws-plan-verify/SKILL.md +0 -18
  57. package/templates/workspace/.agents/skills/ws-preflight/SKILL.md +0 -56
  58. package/templates/workspace/.agents/skills/ws-pull/SKILL.md +0 -18
  59. package/templates/workspace/.agents/skills/ws-push/SKILL.md +0 -18
  60. package/templates/workspace/.agents/skills/ws-quality-review/SKILL.md +0 -56
  61. package/templates/workspace/.agents/skills/ws-req-change/SKILL.md +0 -41
  62. package/templates/workspace/.agents/skills/ws-req-contract-sync/SKILL.md +0 -17
  63. package/templates/workspace/.agents/skills/ws-req-contract-validate/SKILL.md +0 -12
  64. package/templates/workspace/.agents/skills/ws-req-flow-sync/SKILL.md +0 -28
  65. package/templates/workspace/.agents/skills/ws-req-review/SKILL.md +0 -32
  66. package/templates/workspace/.agents/skills/ws-research/SKILL.md +0 -56
  67. package/templates/workspace/.agents/skills/ws-review/SKILL.md +0 -55
  68. package/templates/workspace/.agents/skills/ws-rule/SKILL.md +0 -23
  69. package/templates/workspace/.agents/skills/ws-spec-review/SKILL.md +0 -57
  70. package/templates/workspace/.agents/skills/ws-submodule-setup/SKILL.md +0 -18
  71. package/templates/workspace/.agents/skills/ws-verify-before-complete/SKILL.md +0 -18
  72. package/templates/workspace/.claude/commands/p-aiws-change-archive.md +0 -24
  73. package/templates/workspace/.claude/commands/p-aiws-change-finish.md +0 -24
  74. package/templates/workspace/.claude/commands/p-aiws-change-list.md +0 -23
  75. package/templates/workspace/.claude/commands/p-aiws-change-new.md +0 -24
  76. package/templates/workspace/.claude/commands/p-aiws-change-next.md +0 -24
  77. package/templates/workspace/.claude/commands/p-aiws-change-start.md +0 -24
  78. package/templates/workspace/.claude/commands/p-aiws-change-status.md +0 -24
  79. package/templates/workspace/.claude/commands/p-aiws-change-sync.md +0 -24
  80. package/templates/workspace/.claude/commands/p-aiws-change-templates-init.md +0 -23
  81. package/templates/workspace/.claude/commands/p-aiws-change-templates-which.md +0 -23
  82. package/templates/workspace/.claude/commands/p-aiws-change-validate.md +0 -24
  83. package/templates/workspace/.claude/commands/p-aiws-hooks-install.md +0 -23
  84. package/templates/workspace/.claude/commands/p-aiws-hooks-status.md +0 -23
  85. package/templates/workspace/.claude/commands/p-aiws-init.md +0 -20
  86. package/templates/workspace/.claude/commands/p-aiws-rollback.md +0 -13
  87. package/templates/workspace/.claude/commands/p-aiws-update.md +0 -19
  88. package/templates/workspace/.claude/commands/p-aiws-validate.md +0 -14
  89. package/templates/workspace/.claude/commands/using-aiws.md +0 -25
  90. package/templates/workspace/.claude/commands/ws-analyze.md +0 -27
  91. package/templates/workspace/.claude/commands/ws-bugfix.md +0 -32
  92. package/templates/workspace/.claude/commands/ws-commit.md +0 -67
  93. package/templates/workspace/.claude/commands/ws-deliver.md +0 -55
  94. package/templates/workspace/.claude/commands/ws-dev-lite.md +0 -31
  95. package/templates/workspace/.claude/commands/ws-dev.md +0 -33
  96. package/templates/workspace/.claude/commands/ws-finish.md +0 -72
  97. package/templates/workspace/.claude/commands/ws-goal.md +0 -34
  98. package/templates/workspace/.claude/commands/ws-handoff.md +0 -23
  99. package/templates/workspace/.claude/commands/ws-intake.md +0 -19
  100. package/templates/workspace/.claude/commands/ws-migrate.md +0 -22
  101. package/templates/workspace/.claude/commands/ws-plan-verify.md +0 -25
  102. package/templates/workspace/.claude/commands/ws-plan.md +0 -21
  103. package/templates/workspace/.claude/commands/ws-preflight.md +0 -27
  104. package/templates/workspace/.claude/commands/ws-pull.md +0 -84
  105. package/templates/workspace/.claude/commands/ws-push.md +0 -90
  106. package/templates/workspace/.claude/commands/ws-quality-review.md +0 -24
  107. package/templates/workspace/.claude/commands/ws-req-change.md +0 -42
  108. package/templates/workspace/.claude/commands/ws-req-contract-sync.md +0 -18
  109. package/templates/workspace/.claude/commands/ws-req-contract-validate.md +0 -13
  110. package/templates/workspace/.claude/commands/ws-req-flow-sync.md +0 -20
  111. package/templates/workspace/.claude/commands/ws-req-review.md +0 -33
  112. package/templates/workspace/.claude/commands/ws-review.md +0 -31
  113. package/templates/workspace/.claude/commands/ws-rule.md +0 -24
  114. package/templates/workspace/.claude/commands/ws-spec-review.md +0 -24
  115. package/templates/workspace/.claude/commands/ws-submodule-setup.md +0 -54
  116. package/templates/workspace/.claude/commands/ws-verify-before-complete.md +0 -24
  117. package/templates/workspace/.claude/settings.json.example +0 -26
  118. package/templates/workspace/.claude/skills/p-aiws-change-archive/SKILL.md +0 -24
  119. package/templates/workspace/.claude/skills/p-aiws-change-finish/SKILL.md +0 -24
  120. package/templates/workspace/.claude/skills/p-aiws-change-list/SKILL.md +0 -18
  121. package/templates/workspace/.claude/skills/p-aiws-change-new/SKILL.md +0 -26
  122. package/templates/workspace/.claude/skills/p-aiws-change-next/SKILL.md +0 -19
  123. package/templates/workspace/.claude/skills/p-aiws-change-start/SKILL.md +0 -33
  124. package/templates/workspace/.claude/skills/p-aiws-change-status/SKILL.md +0 -19
  125. package/templates/workspace/.claude/skills/p-aiws-change-sync/SKILL.md +0 -19
  126. package/templates/workspace/.claude/skills/p-aiws-change-templates-init/SKILL.md +0 -18
  127. package/templates/workspace/.claude/skills/p-aiws-change-templates-which/SKILL.md +0 -18
  128. package/templates/workspace/.claude/skills/p-aiws-change-validate/SKILL.md +0 -23
  129. package/templates/workspace/.claude/skills/p-aiws-hooks-install/SKILL.md +0 -30
  130. package/templates/workspace/.claude/skills/p-aiws-hooks-status/SKILL.md +0 -18
  131. package/templates/workspace/.claude/skills/p-aiws-init/SKILL.md +0 -27
  132. package/templates/workspace/.claude/skills/p-aiws-rollback/SKILL.md +0 -18
  133. package/templates/workspace/.claude/skills/p-aiws-update/SKILL.md +0 -26
  134. package/templates/workspace/.claude/skills/p-aiws-validate/SKILL.md +0 -22
  135. package/templates/workspace/.claude/skills/p-tasks-plan/SKILL.md +0 -37
  136. package/templates/workspace/.claude/skills/using-aiws/SKILL.md +0 -87
  137. package/templates/workspace/.claude/skills/ws-analyze/SKILL.md +0 -26
  138. package/templates/workspace/.claude/skills/ws-bugfix/SKILL.md +0 -111
  139. package/templates/workspace/.claude/skills/ws-commit/SKILL.md +0 -18
  140. package/templates/workspace/.claude/skills/ws-deliver/SKILL.md +0 -18
  141. package/templates/workspace/.claude/skills/ws-dev/SKILL.md +0 -79
  142. package/templates/workspace/.claude/skills/ws-dev-lite/SKILL.md +0 -58
  143. package/templates/workspace/.claude/skills/ws-finish/SKILL.md +0 -22
  144. package/templates/workspace/.claude/skills/ws-frontend-design/SKILL.md +0 -126
  145. package/templates/workspace/.claude/skills/ws-handoff/SKILL.md +0 -18
  146. package/templates/workspace/.claude/skills/ws-intake/SKILL.md +0 -53
  147. package/templates/workspace/.claude/skills/ws-migrate/SKILL.md +0 -18
  148. package/templates/workspace/.claude/skills/ws-plan/SKILL.md +0 -138
  149. package/templates/workspace/.claude/skills/ws-plan-verify/SKILL.md +0 -18
  150. package/templates/workspace/.claude/skills/ws-preflight/SKILL.md +0 -55
  151. package/templates/workspace/.claude/skills/ws-pull/SKILL.md +0 -18
  152. package/templates/workspace/.claude/skills/ws-push/SKILL.md +0 -18
  153. package/templates/workspace/.claude/skills/ws-quality-review/SKILL.md +0 -56
  154. package/templates/workspace/.claude/skills/ws-req-change/SKILL.md +0 -41
  155. package/templates/workspace/.claude/skills/ws-req-contract-sync/SKILL.md +0 -17
  156. package/templates/workspace/.claude/skills/ws-req-contract-validate/SKILL.md +0 -12
  157. package/templates/workspace/.claude/skills/ws-req-flow-sync/SKILL.md +0 -28
  158. package/templates/workspace/.claude/skills/ws-req-review/SKILL.md +0 -32
  159. package/templates/workspace/.claude/skills/ws-review/SKILL.md +0 -55
  160. package/templates/workspace/.claude/skills/ws-rule/SKILL.md +0 -23
  161. package/templates/workspace/.claude/skills/ws-spec-review/SKILL.md +0 -57
  162. package/templates/workspace/.claude/skills/ws-submodule-setup/SKILL.md +0 -18
  163. package/templates/workspace/.claude/skills/ws-verify-before-complete/SKILL.md +0 -18
  164. package/templates/workspace/.codex/prompts/aiws-init.md +0 -23
  165. package/templates/workspace/.codex/prompts/aiws-rollback.md +0 -16
  166. package/templates/workspace/.codex/prompts/aiws-update.md +0 -22
  167. package/templates/workspace/.codex/prompts/aiws-validate.md +0 -17
  168. package/templates/workspace/.codex/prompts/ws-analyze.md +0 -32
  169. package/templates/workspace/.codex/prompts/ws-dev.md +0 -36
  170. package/templates/workspace/.codex/prompts/ws-migrate.md +0 -27
  171. package/templates/workspace/.codex/prompts/ws-preflight.md +0 -32
  172. package/templates/workspace/.codex/prompts/ws-req-change.md +0 -39
  173. package/templates/workspace/.codex/prompts/ws-req-contract-sync.md +0 -23
  174. package/templates/workspace/.codex/prompts/ws-req-contract-validate.md +0 -18
  175. package/templates/workspace/.codex/prompts/ws-req-flow-sync.md +0 -25
  176. package/templates/workspace/.codex/prompts/ws-req-review.md +0 -38
  177. package/templates/workspace/.codex/prompts/ws-review.md +0 -32
  178. package/templates/workspace/.codex/prompts/ws-rule.md +0 -29
@@ -1,67 +0,0 @@
1
- <!-- AIWS_MANAGED_BEGIN:claude:ws-commit -->
2
- # ws commit
3
-
4
- 用中文输出(命令/路径/代码标识符保持原样不翻译)。
5
-
6
- 目标:在**当前分支可直提**的前提下,先做审计与门禁,并在存在 submodule 时给出正确的提交顺序(先 submodule,再 superproject),最后执行 `git commit`。
7
- 补充:若你经常遇到 submodule detached,建议日常拉取优先使用 `/ws-pull`(尽量把 submodule “挂回分支”且不改变 gitlink commit)。
8
-
9
- 安全约束(强制):
10
- - 不自动 `git add -A`;只在用户明确指示时才做 staging
11
- - 不使用 `--no-verify` 绕过 hooks
12
- - 不自动 push
13
- - 不打印 secrets
14
- - commit message 优先使用中文;若启用了 `.githooks/commit-msg`,默认仅提示,只有 strict 模式才会拒绝全英文首行(`Merge/Revert/fixup!/squash!` 例外)
15
-
16
- 步骤(建议):
17
- 1) 先运行 `/ws-preflight`。
18
- 2) 运行 `/ws-review`(优先落盘审计证据到 `changes/<change-id>/review/`)。
19
- 3) 运行门禁校验并写 stamp:
20
- ```bash
21
- if [[ -x "./node_modules/.bin/aiws" ]]; then
22
- ./node_modules/.bin/aiws validate . --stamp
23
- elif command -v aiws >/dev/null 2>&1; then
24
- aiws validate . --stamp
25
- else
26
- npx @aipper/aiws validate . --stamp
27
- fi
28
- ```
29
- 4) 输出提交上下文(必须输出给用户确认):
30
- ```bash
31
- git branch --show-current
32
- git status --porcelain
33
- ```
34
- 5) submodule 感知检查:
35
- ```bash
36
- if [[ -f .gitmodules ]]; then
37
- git config --file .gitmodules --get-regexp '^submodule\\..*\\.path$' || true
38
- fi
39
- while read -r _ sub_path; do
40
- [[ -z "${sub_path:-}" ]] && continue
41
- echo "== submodule: ${sub_path} =="
42
- git -C "${sub_path}" rev-parse --abbrev-ref HEAD 2>/dev/null || true
43
- git -C "${sub_path}" status --porcelain || true
44
- done < <(git config --file .gitmodules --get-regexp '^submodule\\..*\\.path$' 2>/dev/null || true)
45
- ```
46
- 判定规则(强制):
47
- - 任一 submodule `git status --porcelain` 非空:停止提交 superproject;先在对应 submodule 完成 commit,再回到 superproject 更新并提交 gitlink。
48
- - 若该 submodule 当前为 detached HEAD:先按 `.gitmodules` 的目标分支挂到 `aiws/pin/<target-branch>`;不要直接切 `change/<change-id>` / `main` / `master`。
49
- 6) 检查 staging(必须输出给用户确认):
50
- ```bash
51
- git status --porcelain
52
- git diff --staged --submodule=short
53
- ```
54
- 7) 若没有 staged changes:停止并提示用户先明确要提交哪些文件(例如 `git add -p` 或 `git add <path>`)。
55
- 8) 优先生成并确认中文 commit message(格式建议:`<类型>: <简述>`;若用户明确要求英文也可保留,但 strict 模式下会被 hook 拒绝)。
56
- 9) 执行提交(不带 `--no-verify`):
57
- ```bash
58
- git commit -m "<message>"
59
- ```
60
-
61
- 输出必须包含:
62
- - `证据(Evidence):` `changes/<change-id>/review/*`(无 change-id 时回退 `.agentdocs/tmp/review/*`) + `.agentdocs/tmp/aiws-validate/*`
63
- - `上下文(Context):` 当前分支 + 是否检测到 submodule + 若阻断则给出阻断原因
64
- - `下一步(Next):` 若存在 submodule 改动,先提示用户进入 submodule 提交
65
- <!-- AIWS_MANAGED_END:claude:ws-commit -->
66
-
67
- 可在下方追加本项目对 Claude Code 的额外说明(托管块外内容会被保留)。
@@ -1,55 +0,0 @@
1
- <!-- AIWS_MANAGED_BEGIN:claude:ws-deliver -->
2
- # ws deliver
3
-
4
- 用中文输出(命令/路径/代码标识符保持原样不翻译)。
5
-
6
- 目标:适配 superproject + submodule(数量不固定)的交付收尾,降低提交顺序和合并回 base 分支的出错概率:
7
- 1) 先逐个提交 submodule(每个 repo 单独确认 commit message;默认 `git add -p`)
8
- 2) 再提交 superproject(包含 submodule gitlink 指针更新 + 自身改动/变更工件)
9
- 3) 最后 fast-forward 合并回目标分支(复用 `aiws change finish`;建议用 `/ws-finish`)
10
-
11
- 强制约束:
12
- - 不自动 `git add -A`。
13
- - 不自动 push。
14
- - 不自动删除分支。
15
-
16
- 建议流程(按顺序):
17
- 1) 先运行 `/ws-preflight`。
18
- 2) 如果存在 `.gitmodules` 但缺少 `submodule.<name>.branch`,先运行 `/ws-submodule-setup` 并提交 `.gitmodules`(否则 `aiws validate .` 会失败,且 submodule 工作流会产生人为差异)。
19
- 2.1) 若存在 submodule:必须准备 `changes/<change-id>/submodules.targets`,并覆盖所有 submodule path;这是本次交付的目标分支真值。
20
- - 生成该文件时可先做默认预填:detached HEAD 默认建议取 `.gitmodules` 声明分支;已附着在本地分支时默认建议取当前分支。
21
- - 上述都只是建议值;真正的 deliver/finish 只认 `submodules.targets`。
22
- 2) 发现 submodules:
23
- - `git submodule status --recursive`
24
- 3) 逐个提交 submodules(按上一步顺序):
25
- - `git -C "<sub_path>" status --porcelain`
26
- - 先说明该 submodule 目标分支的来源:attached branch 默认建议取当前分支;detached HEAD 默认建议取 `.gitmodules`;若与 `submodules.targets` 已落盘值冲突,则以 `submodules.targets` 为准
27
- - 若当前为 detached HEAD:不要直接切 `change/<change-id>` / `main` / `master`;先按 `submodules.targets`(若分支为 `.` 则展开为 `.ws-change.json` 的 `base_branch`)挂到 `aiws/pin/<target-branch>`
28
- - `git -C "<sub_path>" add -p`
29
- - `git -C "<sub_path>" diff --staged --stat`
30
- - 生成并让用户确认该 submodule 的 commit message(每个 repo 单独确认)
31
- - `git -C "<sub_path>" commit -m "<message>"`
32
- 4) 提交 superproject(gitlinks + 自身改动):
33
- - `git diff --submodule`
34
- - `git add <submodule-path-1> <submodule-path-2> ...`
35
- - `git add -p`
36
- - 生成并让用户确认 superproject 的 commit message
37
- - `git commit -m "<message>"`
38
- 5) (推荐)门禁 + 证据:
39
- - `aiws validate . --stamp`(未安装全局 aiws 时可用 `npx @aipper/aiws validate . --stamp`)
40
- 5.1) (强烈建议)生成持久证据并回填 `Evidence_Path`:
41
- - `aiws change evidence <change-id>`(未安装全局 aiws 时可用 `npx @aipper/aiws change evidence <change-id>`)
42
- 5.2) (可选)生成状态快照(建议):
43
- - `aiws change state <change-id> --write`
44
- 6) 安全合并回目标分支:
45
- - 优先运行 `/ws-finish`(底层调用 `aiws change finish`,默认 `--ff-only`;push 成功后会清理对应 change worktree)
46
-
47
- 输出要求:
48
- - `子模块(Submodules):` 每个 submodule 的 commit 摘要(repo/path → sha → message)
49
- - `主仓库(Superproject):` commit 摘要
50
- - `合并信息(Merge):` `/ws-finish` 输出(into/from)
51
- - `工作区清理(Worktree cleanup):` 若存在独立 change worktree,输出清理结果(removed/skipped + reason)
52
- - `证据(Evidence):` `.agentdocs/tmp/aiws-validate/*.json`(若使用 --stamp)
53
- <!-- AIWS_MANAGED_END:claude:ws-deliver -->
54
-
55
- 可在下方追加本项目对 Claude Code 的额外说明(托管块外内容会被保留)。
@@ -1,31 +0,0 @@
1
- <!-- AIWS_MANAGED_BEGIN:claude:ws-dev-lite -->
2
- # ws dev lite
3
-
4
- 用中文输出(命令/路径/代码标识符保持原样不翻译)。
5
-
6
- 目标:处理 simple/local 单点修复,走最小改动 + 最小验证,不默认拉起完整重流程。
7
-
8
- 使用条件:
9
- - 目标明确、归因明确、验证入口明确
10
- - 一般只影响单文件或紧密相关的小范围文件
11
- - 不需要先改 `REQUIREMENTS.md`
12
-
13
- 强制流程:
14
- 1) 先运行 `/ws-preflight`。
15
- 2) 先说明:
16
- - `Goal:`
17
- - `Why lite:`
18
- - 若说不清,立刻回到 `/ws-dev` 或 `/ws-plan`
19
- 3) 实施最小改动;不要为形式完整额外扩 scope。
20
- 4) 运行最小可复现验证;允许比全量更窄,但必须说明为什么足够。
21
- 5) 输出 `Changed / Verify / Evidence / Next`。
22
- 6) 若准备提交或交付:后续仍进入 `/ws-review`、`/ws-commit`、`/ws-finish`。
23
-
24
- 边界:
25
- - 默认不创建 `plan/...`
26
- - 默认不跑 `ws-plan-verify`
27
- - 默认不要求先做双 review
28
- - 一旦复杂度升高,停止 lite,切回主流程
29
- <!-- AIWS_MANAGED_END:claude:ws-dev-lite -->
30
-
31
- 可在下方追加本项目对 Claude Code 的额外说明(托管块外内容会被保留)。
@@ -1,33 +0,0 @@
1
- <!-- AIWS_MANAGED_BEGIN:claude:ws-dev -->
2
- # ws dev
3
-
4
- 用中文输出(命令/路径/代码标识符保持原样不翻译)。
5
-
6
- 目标:在 AIWS 约束下完成一个可回放、可验证的小步交付。
7
-
8
- 建议流程:
9
- 1) 先运行 `/ws-preflight`(读真值文件并输出约束摘要)。
10
- - 若 `/ws-plan` 刚创建了 `change/<change-id>` worktree:后续实现必须在该 worktree 中继续;不要回原工作区重复 `aiws change start ...`
11
- 2) 建立变更归因(推荐):
12
- - ⚠️ 若准备切分支/创建 worktree,先看 `git status --porcelain`;否则切换上下文后,未提交改动可能“看起来丢了”。
13
- - 若当前目录已经是 `change/<change-id>` worktree(例如由 `/ws-plan` 创建):直接在这里继续,不要再创建第二个 worktree,也不要回原工作区写代码。
14
- - 若非空仅因为 `/ws-plan` 生成了 `plan/...` 或 `changes/<change-id>/...`,这是预期行为;此时优先 `aiws change start <change-id> --hooks --no-switch`,若仍要 `--switch/--worktree`,先提交这些规划工件。
15
- - 推荐更安全(默认):`aiws change start <change-id> --hooks --no-switch`(只创建分支/工件 + 启用 hooks;不切分支)
16
- - 准备进入实现时:若当前已在 `change/<change-id>` 直接继续;若需切换到该分支,先确认除规划工件外无额外未提交改动,再执行:`git switch change/<change-id>`
17
- - 若你明确要“一键切分支”(不推荐,且 dirty 会被拦截):`aiws change start <change-id> --hooks --switch`
18
- - superproject + submodule(推荐):`aiws change start <change-id> --hooks --worktree --submodules`
19
- - 若后续需要在 detached submodule 内提交:先挂到 `aiws/pin/<target-branch>`;不要直接切 `change/<change-id>` / `main` / `master`
20
- - 或手工:`git switch -c change/<change-id>`,并创建 `changes/<change-id>/proposal.md` 与 `changes/<change-id>/tasks.md`(参考 `changes/README.md`)
21
- 3) 如涉及需求调整:先 `/ws-req-review` → 用户确认后再 `/ws-req-change`(避免需求漂移)。
22
- 4) 实施最小改动:任何改动都要能归因到 `REQUIREMENTS.md`(验收)或 `issues/problem-issues.csv`(问题)。
23
- 5) 运行 `AI_WORKSPACE.md` 里声明的验证命令;未运行不声称已运行。
24
- 6) 提交前强制:`aiws validate .`(commit/push hooks 也会阻断)。
25
- 7) 交付收尾(推荐,减少手动 merge 出错):运行 `/ws-finish`(底层调用 `aiws change finish`,默认 fast-forward 安全合并回目标分支)。
26
-
27
- 输出要求:
28
- - `变更文件(Changed):` 文件清单
29
- - `验证(Verify):` 实际运行的命令 + 期望结果
30
- - `证据(Evidence):` 证据路径(例如 `changes/<change-id>/review/...`、`changes/<change-id>/...` 或 `.agentdocs/tmp/...`)
31
- <!-- AIWS_MANAGED_END:claude:ws-dev -->
32
-
33
- 可在下方追加本项目对 Claude Code 的额外说明(托管块外内容会被保留)。
@@ -1,72 +0,0 @@
1
- <!-- AIWS_MANAGED_BEGIN:claude:ws-finish -->
2
- # ws finish
3
-
4
- 用中文输出(命令/路径/代码标识符保持原样不翻译)。
5
-
6
- 目标:安全把 `change/<change-id>` fast-forward 合并回目标分支,避免手输分支名导致的错误。
7
- 补充:若团队希望减少 submodule detached 的人为差异,建议在 `.gitmodules` 配置 `submodule.<name>.branch`,并在日常拉取时使用 `/ws-pull`。
8
-
9
- 前置(必须):
10
- - 工作区干净:`git status --porcelain` 无输出(否则先 commit 或 stash)
11
- - change 分支存在(`change/<change-id>`;也支持 `changes/`、`ws/`、`ws-change/`)
12
- - 普通 finish 的 `validate/evidence/state` 应先在 `change/<change-id>` worktree 完成;真正执行 `aiws change finish` 时再切到目标分支所在 worktree
13
- - 若 `aiws change status <change-id>` 输出 `governance_rule: finish_resume_required`:说明 merge 已发生,只需继续 push / archive / cleanup closeout;直接在提示的 worktree 运行 `aiws change finish <change-id> --push`
14
- - 若存在 `.gitmodules`:必须为每个 submodule 配置 `submodule.<name>.branch`(否则先运行 `/ws-submodule-setup` 并提交 `.gitmodules`)
15
-
16
- 步骤(建议):
17
- 0) 若存在 `.gitmodules`,先检查 submodule branch 配置是否齐全(缺失则停止并提示 setup):
18
- ```bash
19
- if [[ -f .gitmodules ]]; then
20
- missing=0
21
- while read -r key sub_path; do
22
- name="${key#submodule.}"; name="${name%.path}"
23
- b="$(git config --file .gitmodules --get "submodule.${name}.branch" 2>/dev/null || true)"
24
- if [[ -z "${b:-}" ]]; then
25
- echo "error: missing .gitmodules submodule.${name}.branch (path=${sub_path})"
26
- missing=1
27
- fi
28
- done < <(git config --file .gitmodules --get-regexp '^submodule\\..*\\.path$' 2>/dev/null || true)
29
- if [[ "$missing" -ne 0 ]]; then
30
- echo "hint: run /ws-submodule-setup (and commit .gitmodules), then retry"
31
- exit 2
32
- fi
33
- fi
34
- ```
35
- 1) 先运行 `/ws-preflight`(确保真值文件齐全)。
36
- 2) 先运行 `aiws change status <change-id>`,优先看稳定字段 `governance_rule:`。
37
- - 若为 `finish_resume_required`:直接跳到步骤 3 执行 `aiws change finish <change-id> --push`
38
- - 若不是该值:按普通 finish 继续;不要依赖自然语言提示句做分支判断
39
- 2.1) 普通 finish 时,`aiws validate . --stamp` / `aiws change evidence <change-id>` / `aiws change state <change-id> --write` 应在 `change/<change-id>` worktree 完成。
40
- - 如果已经在目标分支 worktree,且 `governance_rule` 不是 `finish_resume_required`,不要在这里跑 `aiws validate . --stamp`;先回 `change/<change-id>` worktree,或先跑 `/ws-verify-before-complete`
41
- 3) 若不存在 `.gitmodules`,或 submodules 已按顺序处理完成,优先直接执行最小收尾闭环:
42
- - `aiws change finish <change-id> --push`
43
- - 若当前就在 `change/<change-id>` 分支上,也可省略 `<change-id>`
44
- - 该命令会在 fast-forward 合并成功后 push 目标分支;默认优先使用 upstream 配置(`branch.<name>.remote` + `branch.<name>.merge`),只有在你明确知道要推向别的 remote 时才追加 `--remote <name>`
45
- - 若 `change/<change-id>` 位于独立 worktree,且该 worktree 干净,则会在 push 成功后自动执行 `git worktree remove` + `git worktree prune`
46
- - AI 入口执行前,应先向用户说明将要 push 的 remote/branch;显式传入 `--push` 即视为确认
47
- 4) 若提示无法 fast-forward:先在 change 分支(或对应 worktree)里 `git rebase <target-branch>`,再重试 `aiws change finish --push`。
48
- 5) 若需要先处理 submodules,则按顺序处理每个 submodule(减少 detached;再 push):
49
- - 先显式解析 base branch,不要用当前分支名替代:
50
- - `python3 - <<'PY'`
51
- - `import json, pathlib; meta = pathlib.Path("changes") / "<change-id>" / ".ws-change.json"; print((json.loads(meta.read_text(encoding="utf-8")).get("base_branch") or "").strip())`
52
- - `PY`
53
- - 发现 submodules:`git config --file .gitmodules --get-regexp '^submodule\\..*\\.path$'`
54
- - 对每个 `<sub_path>`:
55
- - 读取 superproject 当前 gitlink:`git rev-parse "HEAD:<sub_path>"`
56
- - 目标分支真值:`changes/<change-id>/submodules.targets`;若条目里分支写 `.`,则展开为刚才解析出的 `base_branch`
57
- - 生成/检查 `submodules.targets` 时,detached HEAD 默认建议取 `.gitmodules` 的 `submodule.<name>.branch`;已附着在本地分支时默认建议取当前分支;这些都只是预填建议,不是 finish/push 的运行时真值
58
- - 不要直接切 `change/<change-id>` / `main` / `master` 来解 detached
59
- - 用 pin 分支挂回(不改动现有 main/master 指针):`git -C "<sub_path>" checkout -B "aiws/pin/<target-branch>" <gitlink-sha>`
60
- - 仅当 `<gitlink-sha>` 属于 `origin/<target-branch>` 历史时才允许 push;否则停止并人工处理分叉
61
- - push(只允许 fast-forward):`git -C "<sub_path>" push origin "<gitlink-sha>:refs/heads/<target-branch>"`
62
- 6) 任一 submodule 不满足 fast-forward 条件时立即停止(不要继续 push 主仓库)。
63
- 7) submodules 全部成功后,再回到主仓库执行:
64
- - `aiws change finish <change-id> --push`
65
- 8) `aiws change finish --push` 成功后会自动归档并生成 handoff;只有历史/异常场景才需要手工运行 `aiws change archive <change-id>`。
66
-
67
- 安全:
68
- - push 前先输出状态并说明远端/分支。
69
- - 不执行破坏性命令。
70
- <!-- AIWS_MANAGED_END:claude:ws-finish -->
71
-
72
- 可在下方追加本项目对 Claude Code 的额外说明(托管块外内容会被保留)。
@@ -1,34 +0,0 @@
1
- <!-- AIWS_MANAGED_BEGIN:claude:ws-goal -->
2
- # ws goal
3
-
4
- 用中文输出(命令/路径/代码标识符保持原样不翻译)。
5
-
6
- 目标:
7
- - 在 AIWS 约束下完成一个目标导向的自主执行闭环。
8
- - 启动时自动恢复未完成的 goal。
9
-
10
- 执行建议:
11
- 0) 检查 `.aiws/goals/` 目录:
12
- a) 若用户仅查询状态(无明确目标),列出所有 goal 文件及其 status 字段,然后结束。
13
- b) 若存在 status=active 或 status=paused 的 goal 文件,优先读取并恢复执行。
14
- 1) 先运行 `/ws-preflight` 对齐真值文件(`AI_PROJECT.md` / `REQUIREMENTS.md` / `AI_WORKSPACE.md`)。
15
- 2) 接受用户输入的 goal objective。
16
- 3) 按 `ws-goal-contract.md` 的目标模板写入 `.aiws/goals/<goal-id>.md` 工件文件。
17
- 4) 输出 completion audit checklist(含验真步骤)。
18
- 5) **Scope Assessment + 路由**:评估目标复杂度,自动选择执行路径:
19
- a) 简单(≤5 文件、配置/doc 为主、低风险)→ 直行:后续步骤 6-8 auto-finish 闭环
20
- b) 复杂(多模块、代码改动 >5 文件、架构/安全/迁移风险)→ 自动触发 `ws-plan` 启动 change 流水线,完成后更新 goal status=complete
21
- c) 路由决策记入 goal 文件 Audit Trail
22
- 6) 建议续跑方式:简单路径直行 auto-finish;复杂路径进入 change 流水线后建议 ws-dev
23
- 7) 每轮结束后自动执行 completion audit,确认目标是否完成。
24
- 8) 若 completion audit 确认 goal 达成,自动执行闭环 pipeline:
25
- a) Review 检查(按改动类型):
26
- - 配置/文档/规范类(markdown):内容一致性、引用完整性、内容正确性、无 secrets、格式统一
27
- - 代码类(ts/js/py 等):lint/typecheck 通过、符合现有代码模式、无 secrets、测试通过或覆盖缺口已记录
28
- - 混合类:以上两种合并
29
- b) 简单路径:git add → commit → push,更新 goal status=complete
30
- c) 复杂路径:走 ws-commit → ws-finish → archive change,更新 goal status=complete
31
- d) 不通过:记录 blocker → 继续 fix 循环
32
- <!-- AIWS_MANAGED_END:claude:ws-goal -->
33
-
34
- 可在下方追加本项目对 Claude Code 的额外说明(托管块外内容会被保留)。
@@ -1,23 +0,0 @@
1
- <!-- AIWS_MANAGED_BEGIN:claude:ws-handoff -->
2
- # ws handoff
3
-
4
- 用中文输出(命令/路径/代码标识符保持原样不翻译)。
5
-
6
- 目标:
7
- - 交接与回放:通过 `handoff.md` 让已归档的 change 可被下一位/下一次会话快速接力。
8
- - handoff 文件位置:`changes/archive/<date>-<change-id>/handoff.md`(默认由 `aiws change finish --push` 自动归档时生成)。
9
-
10
- 执行建议:
11
- 1) 先确认 change 已通过 `/ws-finish` 或 `aiws change finish --push` 完成自动归档。
12
- 2) 查看 handoff:
13
- ```bash
14
- change_id="<change-id>"
15
- ls -1 changes/archive/*-"${change_id}"/handoff.md
16
- sed -n '1,160p' changes/archive/*-"${change_id}"/handoff.md
17
- ```
18
- 3) 依赖提示:
19
- - 若你在某个 change 的 `proposal.md` 声明了 `Depends_On`,`aiws change start` 会尝试读取依赖 change 的 `handoff.md` 并输出摘要(前提:依赖已归档且 handoff 存在)。
20
- - 若是历史/异常场景尚未归档,再手工运行 `/p-aiws-change-archive`。
21
- <!-- AIWS_MANAGED_END:claude:ws-handoff -->
22
-
23
- 可在下方追加本项目对 Claude Code 的额外说明(托管块外内容会被保留)。
@@ -1,19 +0,0 @@
1
- <!-- AIWS_MANAGED_BEGIN:claude:ws-intake -->
2
- # ws intake
3
-
4
- 用中文输出(命令/路径/代码标识符保持原样不翻译)。
5
-
6
- 目标:
7
- - 在正式 `/ws-plan` 前,先把需求里的待确认问题逐条澄清并冻结。
8
-
9
- 执行建议:
10
- 1) 先读取 `AI_PROJECT.md` / `REQUIREMENTS.md` / `AI_WORKSPACE.md`。
11
- 2) 若存在最新 `plan/*.intake.md`,先续写;否则创建新的 intake 草案。
12
- 3) 把问题写成 `Open Questions`,状态只允许 `open / in_discussion / frozen / deferred`。
13
- 4) 每次只推进 1 条 `Current question`,允许围绕这 1 条问题多轮沟通。
14
- 5) 当前问题未标记为 `frozen` 或 `deferred` 前,不进入下一题。
15
- 6) 每轮都要把结论落到 `plan/<timestamp>-<slug>.intake.md`,并输出 `Ready for ws-plan: yes/no`。
16
- 7) 只有关键问题已冻结时,`Next` 才能进入 `/ws-plan`;否则继续 `/ws-intake`。
17
- <!-- AIWS_MANAGED_END:claude:ws-intake -->
18
-
19
- 可在下方追加本项目对 Claude Code 的额外说明(托管块外内容会被保留)。
@@ -1,22 +0,0 @@
1
- <!-- AIWS_MANAGED_BEGIN:claude:ws-migrate -->
2
- # ws migrate
3
-
4
- 用中文输出;命令与路径保持原样不翻译。
5
-
6
- 目标:把当前仓库补齐为 aiws workspace 模板,并启用可验证门禁。
7
-
8
- 执行(在项目根目录):
9
- 1) 若已存在 `.aiws/manifest.json`:`npx @aipper/aiws update .`
10
- 2) 否则:`npx @aipper/aiws init .`
11
- 3) 门禁校验:`npx @aipper/aiws validate .`
12
- 4) 启用本机 git hooks(推荐,本地生效):`git config core.hooksPath .githooks`
13
-
14
- 回滚:
15
- - 恢复最近一次快照:`npx @aipper/aiws rollback . latest`
16
-
17
- 约束:
18
- - 不写入任何 secrets。
19
- - 不执行破坏性命令。
20
- <!-- AIWS_MANAGED_END:claude:ws-migrate -->
21
-
22
- 可在下方追加本项目对 Claude Code 的额外说明(托管块外内容会被保留)。
@@ -1,25 +0,0 @@
1
- <!-- AIWS_MANAGED_BEGIN:claude:ws-plan-verify -->
2
- # ws plan verify
3
-
4
- 用中文输出(命令/路径/代码标识符保持原样不翻译)。
5
-
6
- 目标:
7
- - 执行前检查计划是否跑偏,并给出最小修正项。
8
-
9
- 执行建议:
10
- 1) 先运行 `/ws-preflight`。
11
- 2) 运行严格门禁:
12
- ```bash
13
- if [[ -x "./node_modules/.bin/aiws" ]]; then
14
- ./node_modules/.bin/aiws change validate <change-id> --strict
15
- elif command -v aiws >/dev/null 2>&1; then
16
- aiws change validate <change-id> --strict
17
- else
18
- npx @aipper/aiws change validate <change-id> --strict
19
- fi
20
- ```
21
- 3) 若失败:先修 `proposal.md` / `plan` 的绑定字段与验证命令,再复跑。
22
- 4) 通过后再进入 `/ws-dev`。
23
- <!-- AIWS_MANAGED_END:claude:ws-plan-verify -->
24
-
25
- 可在下方追加本项目对 Claude Code 的额外说明(托管块外内容会被保留)。
@@ -1,21 +0,0 @@
1
- <!-- AIWS_MANAGED_BEGIN:claude:ws-plan -->
2
- # ws plan
3
-
4
- 用中文输出(命令/路径/代码标识符保持原样不翻译)。
5
-
6
- 目标:
7
- - 若尚未进入本次 change 的工作上下文:先建立 `change/<change-id>` 分支 / worktree,再生成可落盘执行计划(供 /ws-dev 执行)。
8
-
9
- 执行建议:
10
- 1) 先运行 `/ws-preflight`(对齐 `AI_PROJECT.md` / `REQUIREMENTS.md` / `AI_WORKSPACE.md`)。
11
- 2) 若当前不在 `change/<change-id>` 分支 / worktree,先调用 `aiws change start <change-id>` 建立上下文:
12
- - 仓库已有提交:优先 `aiws change start <change-id> --hooks --worktree`;若声明了 submodules,加 `--submodules`
13
- - 仓库尚无提交 / 不满足 worktree 前置条件:回退 `aiws change start <change-id> --hooks --no-switch`
14
- 3) 若上一步创建了 worktree:切到输出的 `worktree:` 路径,后续所有计划文件都写在该 worktree 中。
15
- 4) 生成或更新计划文件:`plan/YYYY-MM-DD_HH-MM-SS-<slug>.md`。
16
- 5) 计划至少包含:`绑定信息(Bindings)`、`目标(Goal)`、`非目标(Non-goals)`、`范围(Scope)`、`执行计划(Plan)`、`验证(Verify)`、`风险与回滚(Risks & Rollback)`、`证据(Evidence)`。
17
- 6) 若已有 `changes/<change-id>/proposal.md`,对齐 `计划文件(Plan_File)` / `合同行(Contract_Row)` / `证据路径(Evidence_Path)`。
18
- 7) 完成后先运行 `/ws-plan-verify`,通过再进入 `/ws-dev`。
19
- <!-- AIWS_MANAGED_END:claude:ws-plan -->
20
-
21
- 可在下方追加本项目对 Claude Code 的额外说明(托管块外内容会被保留)。
@@ -1,27 +0,0 @@
1
- <!-- AIWS_MANAGED_BEGIN:claude:ws-preflight -->
2
- # ws preflight
3
-
4
- 用中文输出(命令/路径/代码标识符保持原样不翻译)。
5
-
6
- 目标:在开始任何“写代码/改配置/落盘文件”之前,对齐工作区真值文件,避免规则漂移。
7
-
8
- 执行步骤(强制):
9
- 1) 定位项目根目录:
10
- - 优先:`git rev-parse --show-toplevel`
11
- - 若失败:停止并让用户确认当前目录是否为项目根(不要猜测)。
12
- 2) 在项目根目录读取以下文件(存在则必须读取;缺失则明确报告缺失项,不要臆测内容):
13
- - `AI_PROJECT.md`
14
- - `REQUIREMENTS.md`
15
- - `AI_WORKSPACE.md`
16
- 3) 输出:
17
- - `根目录(Root):` <项目根路径>
18
- - `已读取(Found):` <实际读取到的文件列表>
19
- - `缺失(Missing):` <缺失文件列表>
20
- - `关键规则(Key rules):` 3–8 条 bullet(范围/禁止项/必须产物/必须验证命令)
21
-
22
- 安全:
23
- - 不打印 secrets;遇到疑似敏感值只提示“存在风险”但不要复述原文。
24
- - 不执行破坏性命令。
25
- <!-- AIWS_MANAGED_END:claude:ws-preflight -->
26
-
27
- 可在下方追加本项目对 Claude Code 的额外说明(托管块外内容会被保留)。
@@ -1,84 +0,0 @@
1
- <!-- AIWS_MANAGED_BEGIN:claude:ws-pull -->
2
- # ws pull
3
-
4
- 用中文输出(命令/路径/代码标识符保持原样不翻译)。
5
-
6
- 目标:安全拉取 superproject,并对齐 submodules,尽量把 submodule 从 detached HEAD “挂回”分支(仅当该分支包含 gitlink commit),减少人为操作差异。
7
-
8
- 安全约束(强制):
9
- - 不执行破坏性命令;不自动提交/不自动 push
10
- - 若工作区不干净:停止并要求用户先 commit 或 stash
11
- - `git pull` 默认只允许 fast-forward(避免隐式 merge/rebase)
12
-
13
- 步骤(建议):
14
- 1) 输出上下文并检查工作区干净:
15
- ```bash
16
- git rev-parse --show-toplevel
17
- git branch --show-current
18
- git status --porcelain
19
- ```
20
- 若 `git status --porcelain` 非空:停止。
21
-
22
- 2) 拉取 superproject(fast-forward only):
23
- ```bash
24
- git pull --ff-only
25
- ```
26
- 若失败:停止并说明需要用户明确选择 `git pull --rebase` 或手动处理。
27
-
28
- 3) 更新 submodules 到 superproject 记录的 gitlink commit:
29
- ```bash
30
- if [[ -f .gitmodules ]]; then
31
- git submodule sync --recursive
32
- git submodule update --init --recursive
33
- else
34
- echo "[info] no .gitmodules"
35
- fi
36
- ```
37
-
38
- 4) (可选但推荐)把 submodule 从 detached HEAD 尽量“挂回分支”(不改动 gitlink commit):
39
- 为避免 origin 多分支时“猜错分支”,本步骤只在 `.gitmodules` 明确配置了 `submodule.<name>.branch` 时才执行;否则保持 detached 并提示先运行 `/ws-submodule-setup` 对齐配置。
40
- ```bash
41
- if [[ -f .gitmodules ]]; then
42
- base_branch="$(git branch --show-current)"
43
- git config --file .gitmodules --get-regexp '^submodule\\..*\\.path$' 2>/dev/null \
44
- | while read -r key sub_path; do
45
- [[ -z "${sub_path:-}" ]] && continue
46
- name="${key#submodule.}"; name="${name%.path}"
47
- echo "== submodule: ${sub_path} (${name}) =="
48
- sub_sha="$(git rev-parse "HEAD:${sub_path}" 2>/dev/null || true)"
49
- [[ -z "${sub_sha:-}" ]] && { echo "[warn] no gitlink sha"; continue; }
50
-
51
- cfg_branch="$(git config --file .gitmodules --get "submodule.${name}.branch" 2>/dev/null || true)"
52
- if [[ "${cfg_branch:-}" == "." ]]; then cfg_branch="$base_branch"; fi
53
- if [[ -z "${cfg_branch:-}" ]]; then
54
- echo "[warn] ${sub_path}: missing .gitmodules submodule.${name}.branch; keep detached (run ws-submodule-setup)"
55
- continue
56
- fi
57
- target_branch="${cfg_branch}"
58
- pin_branch="aiws/pin/${target_branch}"
59
-
60
- git -C "${sub_path}" fetch origin --prune || true
61
- if git -C "${sub_path}" show-ref --verify --quiet "refs/remotes/origin/${target_branch}"; then
62
- if git -C "${sub_path}" merge-base --is-ancestor "${sub_sha}" "origin/${target_branch}"; then
63
- git -C "${sub_path}" checkout -B "${pin_branch}" "${sub_sha}"
64
- git -C "${sub_path}" branch --set-upstream-to "origin/${target_branch}" "${pin_branch}" >/dev/null 2>&1 || true
65
- echo "[ok] attached ${sub_path} to ${pin_branch} (upstream=origin/${target_branch}) at ${sub_sha}"
66
- else
67
- echo "[warn] ${sub_path}: ${sub_sha} is not in origin/${target_branch}; keep detached"
68
- fi
69
- else
70
- echo "[warn] ${sub_path}: origin/${target_branch} not found; keep detached"
71
- fi
72
- done
73
- fi
74
- ```
75
-
76
- 可选(方案 2,一次性设置 submodule 跟踪分支,会改 `.gitmodules`,需提交):
77
- ```bash
78
- git submodule set-branch --branch main <sub_path>
79
- git add .gitmodules
80
- git commit -m "chore(submodule): set tracking branch"
81
- ```
82
- <!-- AIWS_MANAGED_END:claude:ws-pull -->
83
-
84
- 可在下方追加本项目对 Claude Code 的额外说明(托管块外内容会被保留)。
@@ -1,90 +0,0 @@
1
- <!-- AIWS_MANAGED_BEGIN:claude:ws-push -->
2
- # ws push
3
-
4
- 用中文输出(命令/路径/代码标识符保持原样不翻译)。
5
-
6
- 目标:安全 push 当前仓库;若仓库包含 submodules,则先 push submodules,再 push superproject(默认 fast-forward;不 force)。
7
-
8
- 强制约束:
9
- - 不自动提交、不自动 `git add -A`
10
- - 不使用 `--force` / `--force-with-lease`
11
- - 若工作区不干净:停止并要求先 commit 或 stash
12
-
13
- 步骤(建议):
14
- 1) 输出上下文并检查工作区干净:
15
- ```bash
16
- git branch --show-current
17
- git status --porcelain
18
- git status -sb
19
- ```
20
- 若 `git status --porcelain` 非空:停止。
21
-
22
- 2) 判断是否存在 submodules:
23
- ```bash
24
- if [[ -f .gitmodules ]]; then
25
- git config --file .gitmodules --get-regexp '^submodule\\..*\\.path$' || true
26
- fi
27
- ```
28
-
29
- 3) 若没有 submodules:正常 push(仍需用户确认远端/分支):
30
- ```bash
31
- git remote -v
32
- git push
33
- ```
34
-
35
- 4) 若有 submodules:先检查 `.gitmodules` 的 `submodule.<name>.branch` 是否齐全(缺失则停止并提示 `/ws-submodule-setup`):
36
- ```bash
37
- missing=0
38
- while read -r key sub_path; do
39
- name="${key#submodule.}"; name="${name%.path}"
40
- b="$(git config --file .gitmodules --get "submodule.${name}.branch" 2>/dev/null || true)"
41
- if [[ -z "${b:-}" ]]; then
42
- echo "error: missing .gitmodules submodule.${name}.branch (path=${sub_path})"
43
- missing=1
44
- fi
45
- done < <(git config --file .gitmodules --get-regexp '^submodule\\..*\\.path$' 2>/dev/null || true)
46
- if [[ "$missing" -ne 0 ]]; then
47
- echo "hint: run /ws-submodule-setup (and commit .gitmodules), then retry"
48
- exit 2
49
- fi
50
- ```
51
-
52
- 5) 逐个 push submodules(fast-forward only),再 push superproject:
53
- ```bash
54
- base_branch="$(git branch --show-current)"
55
-
56
- git config --file .gitmodules --get-regexp '^submodule\\..*\\.path$' 2>/dev/null \
57
- | while read -r key sub_path; do
58
- name="${key#submodule.}"; name="${name%.path}"
59
- echo "== submodule: ${sub_path} (${name}) =="
60
-
61
- if [[ -n "$(git -C "${sub_path}" status --porcelain 2>/dev/null || true)" ]]; then
62
- echo "error: submodule dirty: ${sub_path}"
63
- exit 2
64
- fi
65
-
66
- cfg_branch="$(git config --file .gitmodules --get "submodule.${name}.branch" 2>/dev/null || true)"
67
- if [[ "${cfg_branch:-}" == "." ]]; then cfg_branch="$base_branch"; fi
68
- target_branch="${cfg_branch}"
69
-
70
- git -C "${sub_path}" fetch origin --prune
71
- if ! git -C "${sub_path}" show-ref --verify --quiet "refs/remotes/origin/${target_branch}"; then
72
- echo "error: missing origin/${target_branch} for ${sub_path}"
73
- exit 2
74
- fi
75
-
76
- if ! git -C "${sub_path}" merge-base --is-ancestor "origin/${target_branch}" HEAD; then
77
- echo "error: non-fast-forward (submodule=${sub_path}, branch=${target_branch})"
78
- exit 2
79
- fi
80
-
81
- git -C "${sub_path}" push origin "HEAD:refs/heads/${target_branch}"
82
- done
83
-
84
- git remote -v
85
- git push
86
- ```
87
- <!-- AIWS_MANAGED_END:claude:ws-push -->
88
-
89
- 可在下方追加本项目对 Claude Code 的额外说明(托管块外内容会被保留)。
90
-
@@ -1,24 +0,0 @@
1
- <!-- AIWS_MANAGED_BEGIN:claude:ws-quality-review -->
2
- # ws quality review
3
-
4
- 用中文输出(命令/路径/代码标识符保持原样不翻译)。
5
-
6
- 目标:审查行为回归、边界条件、测试覆盖与实现质量。
7
-
8
- 步骤(建议):
9
- 1) 读取 `git diff`、已执行的验证结果和相关代码。
10
- 2) 检查:
11
- - 是否存在行为回归或明显 bug 风险
12
- - 边界条件 / 失败路径是否覆盖
13
- - 测试是否足以支撑当前改动
14
- 3) 将结论落盘到:
15
- - 默认:`changes/<change-id>/review/quality-review.md`
16
- - 回退:`.agentdocs/tmp/review/quality-review.md`
17
- 4) 输出:
18
- - `证据(Evidence):`
19
- - `主要发现(Findings):`
20
- - `测试缺口(Gaps):`
21
- - `下一步(Next):`
22
- <!-- AIWS_MANAGED_END:claude:ws-quality-review -->
23
-
24
- 可在下方追加本项目对 Claude Code 的额外说明(托管块外内容会被保留)。