@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,19 @@
1
+ ---
2
+ name: p-aiws-change-next
3
+ description: 私有:给出下一步建议(只读)
4
+ ---
5
+
6
+ 目标:
7
+ - 基于当前仓库与 changes 工件状态,输出最小下一步建议
8
+
9
+ 执行(在仓库根目录):
10
+ ```bash
11
+ change_id="<change-id>"
12
+ if [[ -x "./node_modules/.bin/aiws" ]]; then
13
+ ./node_modules/.bin/aiws change next "$change_id"
14
+ elif command -v aiws >/dev/null 2>&1; then
15
+ aiws change next "$change_id"
16
+ else
17
+ npx @aipper/aiws change next "$change_id"
18
+ fi
19
+ ```
@@ -0,0 +1,33 @@
1
+ ---
2
+ name: p-aiws-change-start
3
+ description: 私有:切分支并初始化变更工件(可选安装 hooks)
4
+ ---
5
+
6
+ 目标:
7
+ - 切到分支 `change/<change-id>` 并初始化 `changes/<change-id>/` 工件
8
+ - 若检测到 `.gitmodules`(git submodules),默认优先使用 `--worktree`(失败则回退为 `--no-switch`),避免切走 superproject 分支导致 submodule 状态混乱
9
+
10
+ 要求:
11
+ - 需要 git 仓库;若不是 git 仓库先 `git init`
12
+
13
+ 执行(在仓库根目录):
14
+ ```bash
15
+ change_id="<change-id>"
16
+ if [[ -x "./node_modules/.bin/aiws" ]]; then
17
+ ./node_modules/.bin/aiws change start "$change_id"
18
+ elif command -v aiws >/dev/null 2>&1; then
19
+ aiws change start "$change_id"
20
+ else
21
+ npx @aipper/aiws change start "$change_id"
22
+ fi
23
+ ```
24
+
25
+ 可选参数:
26
+ - `--hooks`:同时执行 `aiws hooks install .`
27
+ - `--title <title>`:写入标题
28
+ - `--no-design`:不生成 design.md
29
+ - `--switch`:显式允许切换 superproject 分支(仅在存在 `.gitmodules` 时有意义)
30
+ - `--no-switch`:不切换当前分支(仅确保 `change/<change-id>` 分支存在并初始化工件);适用于 superproject + submodule 场景
31
+ - `--worktree`:用 `git worktree` 创建独立工作区并在其中 checkout `change/<change-id>`(推荐用于 superproject + submodule)
32
+ - `--worktree-dir <path>`:覆盖 worktree 目录
33
+ - `--submodules`:在 worktree 内执行 `git submodule update --init --recursive`
@@ -0,0 +1,19 @@
1
+ ---
2
+ name: p-aiws-change-status
3
+ description: 私有:查看单个变更工件状态(只读)
4
+ ---
5
+
6
+ 目标:
7
+ - 查看指定 `change-id` 的工件状态与下一步建议
8
+
9
+ 执行(在仓库根目录):
10
+ ```bash
11
+ change_id="<change-id>"
12
+ if [[ -x "./node_modules/.bin/aiws" ]]; then
13
+ ./node_modules/.bin/aiws change status "$change_id"
14
+ elif command -v aiws >/dev/null 2>&1; then
15
+ aiws change status "$change_id"
16
+ else
17
+ npx @aipper/aiws change status "$change_id"
18
+ fi
19
+ ```
@@ -0,0 +1,19 @@
1
+ ---
2
+ name: p-aiws-change-sync
3
+ description: 私有:同步真值基线到 changes/<change-id>(写入 .ws-change.json)
4
+ ---
5
+
6
+ 目标:
7
+ - 将当前真值文件(`AI_PROJECT.md` / `AI_WORKSPACE.md` / `REQUIREMENTS.md`)的 hash 快照同步到 `changes/<change-id>/.ws-change.json`
8
+
9
+ 执行(在仓库根目录):
10
+ ```bash
11
+ change_id="<change-id>"
12
+ if [[ -x "./node_modules/.bin/aiws" ]]; then
13
+ ./node_modules/.bin/aiws change sync "$change_id"
14
+ elif command -v aiws >/dev/null 2>&1; then
15
+ aiws change sync "$change_id"
16
+ else
17
+ npx @aipper/aiws change sync "$change_id"
18
+ fi
19
+ ```
@@ -0,0 +1,18 @@
1
+ ---
2
+ name: p-aiws-change-templates-init
3
+ description: 私有:在仓库内初始化 change templates(写入 changes/templates)
4
+ ---
5
+
6
+ 目标:
7
+ - 初始化 `changes/templates/`(用于在仓库内自定义 proposal/tasks/design 模板)
8
+
9
+ 执行(在仓库根目录):
10
+ ```bash
11
+ if [[ -x "./node_modules/.bin/aiws" ]]; then
12
+ ./node_modules/.bin/aiws change templates init
13
+ elif command -v aiws >/dev/null 2>&1; then
14
+ aiws change templates init
15
+ else
16
+ npx @aipper/aiws change templates init
17
+ fi
18
+ ```
@@ -0,0 +1,18 @@
1
+ ---
2
+ name: p-aiws-change-templates-which
3
+ description: 私有:查看当前 change templates 来源(只读)
4
+ ---
5
+
6
+ 目标:
7
+ - 输出当前仓库 change templates 的解析来源与路径(用于排查模板来自哪里)
8
+
9
+ 执行(在仓库根目录):
10
+ ```bash
11
+ if [[ -x "./node_modules/.bin/aiws" ]]; then
12
+ ./node_modules/.bin/aiws change templates which
13
+ elif command -v aiws >/dev/null 2>&1; then
14
+ aiws change templates which
15
+ else
16
+ npx @aipper/aiws change templates which
17
+ fi
18
+ ```
@@ -0,0 +1,23 @@
1
+ ---
2
+ name: p-aiws-change-validate
3
+ description: 私有:校验 changes 工件(可 strict)
4
+ ---
5
+
6
+ 目标:
7
+ - 校验 `changes/<change-id>/` 工件完整性、归因与 WS:TODO(用于 hooks/CI)
8
+
9
+ 执行(在仓库根目录):
10
+ ```bash
11
+ change_id="<change-id>"
12
+ if [[ -x "./node_modules/.bin/aiws" ]]; then
13
+ ./node_modules/.bin/aiws change validate "$change_id" --strict
14
+ elif command -v aiws >/dev/null 2>&1; then
15
+ aiws change validate "$change_id" --strict
16
+ else
17
+ npx @aipper/aiws change validate "$change_id" --strict
18
+ fi
19
+ ```
20
+
21
+ 说明:
22
+ - `--strict` 会把 `WS:TODO`/缺少归因视为错误,并启用计划质量门(章节完整、步骤粒度、验证命令与预期)
23
+ - 紧急情况下可用 `--allow-truth-drift`(不推荐)
@@ -0,0 +1,30 @@
1
+ ---
2
+ name: p-aiws-hooks-install
3
+ description: 私有:启用 git hooks 门禁(core.hooksPath=.githooks)
4
+ ---
5
+
6
+ 目标:
7
+ - 为当前 git 仓库启用 aiws 门禁 hooks(`git commit`/`git push` 自动跑 `aiws validate .`)
8
+
9
+ 执行(在仓库根目录):
10
+ ```bash
11
+ if [[ -x "./node_modules/.bin/aiws" ]]; then
12
+ ./node_modules/.bin/aiws hooks install .
13
+ elif command -v aiws >/dev/null 2>&1; then
14
+ aiws hooks install .
15
+ else
16
+ npx @aipper/aiws hooks install .
17
+ fi
18
+ ```
19
+
20
+ 验证(可选):
21
+ ```bash
22
+ git config core.hooksPath
23
+ if [[ -x "./node_modules/.bin/aiws" ]]; then
24
+ ./node_modules/.bin/aiws hooks status .
25
+ elif command -v aiws >/dev/null 2>&1; then
26
+ aiws hooks status .
27
+ else
28
+ npx @aipper/aiws hooks status .
29
+ fi
30
+ ```
@@ -0,0 +1,18 @@
1
+ ---
2
+ name: p-aiws-hooks-status
3
+ description: 私有:查看当前仓库 hooks 状态(只读)
4
+ ---
5
+
6
+ 目标:
7
+ - 输出当前仓库 hooks 状态(不修改文件)
8
+
9
+ 执行(在仓库根目录):
10
+ ```bash
11
+ if [[ -x "./node_modules/.bin/aiws" ]]; then
12
+ ./node_modules/.bin/aiws hooks status .
13
+ elif command -v aiws >/dev/null 2>&1; then
14
+ aiws hooks status .
15
+ else
16
+ npx @aipper/aiws hooks status .
17
+ fi
18
+ ```
@@ -0,0 +1,27 @@
1
+ ---
2
+ name: p-aiws-init
3
+ description: 私有:初始化工作区(生成真值文件与门禁)
4
+ ---
5
+
6
+ 目标:
7
+ - 生成/补齐真值文件与门禁文件(以 `AI_PROJECT.md` / `REQUIREMENTS.md` / `AI_WORKSPACE.md` 为准)
8
+ - 写入/更新 `.gitignore` 的 aiws 托管块
9
+ - 生成/更新 `.aiws/manifest.json`(用于漂移检测)
10
+
11
+ 执行(在仓库根目录):
12
+ ```bash
13
+ if [[ -x "./node_modules/.bin/aiws" ]]; then
14
+ ./node_modules/.bin/aiws init .
15
+ ./node_modules/.bin/aiws validate .
16
+ elif command -v aiws >/dev/null 2>&1; then
17
+ aiws init .
18
+ aiws validate .
19
+ else
20
+ npx @aipper/aiws init .
21
+ npx @aipper/aiws validate .
22
+ fi
23
+ ```
24
+
25
+ 约束:
26
+ - 不写入任何 secrets
27
+ - 只允许更新托管块(`AIWS_MANAGED_BEGIN/END`)或 spec 指定的 `replace_file` 文件
@@ -0,0 +1,18 @@
1
+ ---
2
+ name: p-aiws-rollback
3
+ description: 私有:回滚工作区(从备份恢复)
4
+ ---
5
+
6
+ 目标:
7
+ - 从 `.aiws/backups/` 恢复到某次备份快照
8
+
9
+ 执行(在仓库根目录):
10
+ ```bash
11
+ if [[ -x "./node_modules/.bin/aiws" ]]; then
12
+ ./node_modules/.bin/aiws rollback . latest
13
+ elif command -v aiws >/dev/null 2>&1; then
14
+ aiws rollback . latest
15
+ else
16
+ npx @aipper/aiws rollback . latest
17
+ fi
18
+ ```
@@ -0,0 +1,26 @@
1
+ ---
2
+ name: p-aiws-update
3
+ description: 私有:更新工作区(刷新模板与托管块)
4
+ ---
5
+
6
+ 目标:
7
+ - 基于当前 `@aipper/aiws-spec` 刷新模板与 tool-native 文件
8
+ - 更新前备份到 `.aiws/backups/<timestamp>/`
9
+
10
+ 执行(在仓库根目录):
11
+ ```bash
12
+ if [[ -x "./node_modules/.bin/aiws" ]]; then
13
+ ./node_modules/.bin/aiws update .
14
+ ./node_modules/.bin/aiws validate .
15
+ elif command -v aiws >/dev/null 2>&1; then
16
+ aiws update .
17
+ aiws validate .
18
+ else
19
+ npx @aipper/aiws update .
20
+ npx @aipper/aiws validate .
21
+ fi
22
+ ```
23
+
24
+ 约束:
25
+ - 不写入任何 secrets
26
+ - 只更新托管块或 spec 指定的 `replace_file` 文件
@@ -0,0 +1,22 @@
1
+ ---
2
+ name: p-aiws-validate
3
+ description: 私有:校验工作区(漂移检测 + 门禁)
4
+ ---
5
+
6
+ 目标:
7
+ - 作为 CI/本地门禁:校验 required 文件结构、托管块、`.aiws/manifest.json` 漂移
8
+ - 强门禁:缺 `python3`/缺 required 脚本也应失败
9
+
10
+ 执行(在仓库根目录):
11
+ ```bash
12
+ if [[ -x "./node_modules/.bin/aiws" ]]; then
13
+ AIWS_VALIDATE_STAMP=1 ./node_modules/.bin/aiws validate .
14
+ elif command -v aiws >/dev/null 2>&1; then
15
+ AIWS_VALIDATE_STAMP=1 aiws validate .
16
+ else
17
+ AIWS_VALIDATE_STAMP=1 npx @aipper/aiws validate .
18
+ fi
19
+ ```
20
+
21
+ 证据(可选):
22
+ - stamp:`.agentdocs/tmp/aiws-validate/*.json`(由 `.gitignore` 忽略)
@@ -0,0 +1,37 @@
1
+ ---
2
+ name: p-tasks-plan
3
+ description: 原子:tasks 同步(从 changes/<id>/tasks.md 生成 update_plan payload)
4
+ ---
5
+
6
+ 用中文输出(命令/路径/代码标识符保持原样不翻译)。
7
+
8
+ 目标:
9
+ - 用 `changes/<change-id>/tasks.md` 的 checkbox 任务作为“步骤真值”
10
+ - 生成可直接用于 `update_plan` 的 JSON payload(`pending/in_progress/completed`)
11
+ - 输出当前进度摘要(done/total + 当前 in_progress)
12
+
13
+ 约束:
14
+ - 不写入任何 secrets(token、账号、内网端点等不得进入 git)
15
+ - 只读 `changes/<id>/tasks.md`(不自动改写 tasks 文件)
16
+ - 未运行不声称已运行
17
+
18
+ 执行步骤(建议):
19
+ 1) 先运行 `$ws-preflight`。
20
+ 2) 推断 `change-id`:
21
+ - 优先从当前分支名读取:`git rev-parse --abbrev-ref HEAD`(期望形如 `change/<change-id>`)
22
+ - 若无法推断:让用户明确本次要同步的 `<change-id>`
23
+ 3) 检查 tasks 文件存在:`test -f changes/<change-id>/tasks.md`
24
+ 4) 输出进度摘要:
25
+ ```bash
26
+ python3 tools/ws_tasks_plan.py status --file changes/<change-id>/tasks.md
27
+ ```
28
+ 5) 生成 `update_plan` payload(JSON 输出到 stdout):
29
+ ```bash
30
+ python3 tools/ws_tasks_plan.py plan --file changes/<change-id>/tasks.md --explanation "sync tasks.md -> update_plan"
31
+ ```
32
+ 6) 调用 `update_plan`,将上一步 JSON 原样作为入参(确保任意时刻最多 1 条 `in_progress`)。
33
+
34
+ 输出要求:
35
+ - `Change_ID:` <change-id>
36
+ - `Tasks:` `changes/<change-id>/tasks.md`
37
+ - `Next:` 推荐下一步(通常为继续完善 tasks 或进入 `$ws-dev`)
@@ -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,或提出澄清问题>
@@ -0,0 +1,26 @@
1
+ ---
2
+ name: ws-analyze
3
+ description: 分析(定位问题与收集上下文)
4
+ ---
5
+
6
+ 用中文输出(命令/路径/代码标识符保持原样不翻译)。
7
+
8
+ 目标:在开始实现/修复前做一次技术分析,产出可执行的最小行动清单,并把证据落盘到 `.agentdocs/tmp/analyze/`。
9
+
10
+ 输入:
11
+ - 主题/需求:用户在本次消息中提供的主题(若不明确,先问一句“本次分析主题是什么?”)
12
+
13
+ 步骤(建议):
14
+ 1) 先做 preflight:定位项目根目录,读取 `AI_PROJECT.md` / `REQUIREMENTS.md` / `AI_WORKSPACE.md`,输出约束摘要。
15
+ 2) 基于真值文件与当前代码现状,输出:
16
+ - 目标 / 非目标
17
+ - 现状证据(文件路径/接口路径)
18
+ - 推荐方案(1 个)+ 备选(可选)
19
+ - 风险与回滚(3–8 条)
20
+ - 最小验证命令(可复现)
21
+ 3) 将分析落盘到:`.agentdocs/tmp/analyze/codex-analysis.md`(目录不存在则创建)。
22
+ 4) 回复中必须包含:`Evidence:` 证据文件路径。
23
+
24
+ 安全:
25
+ - 不打印 secrets(尤其 `secrets/test-accounts.json`)。
26
+ - 不执行破坏性命令。
@@ -0,0 +1,111 @@
1
+ ---
2
+ name: ws-bugfix
3
+ description: 缺陷修复(通过禅道 MCP 拉取 bug 与附件,下载图片证据,汇总到 issues/fix_bus_issues.csv,并绑定到 changes/<change-id>/)
4
+ ---
5
+
6
+ 用中文输出(命令/路径/代码标识符保持原样不翻译)。
7
+
8
+ 目标:
9
+ - 用禅道 MCP 拉取 bug 详情与附件(尤其图片)
10
+ - 把证据落盘到 `changes/<change-id>/bug/`(避免只停留在对话)
11
+ - 把修复任务汇总/更新到 `issues/fix_bus_issues.csv`
12
+ - 与 `ws-dev` / `aiws change` 流程绑定,确保可追溯、可验证
13
+
14
+ 非目标(强制):
15
+ - 不自动 commit / push
16
+ - 不写入任何 secrets(token、cookie、内网地址)
17
+ - 不在无法复现时直接改代码(先产出阻塞信息)
18
+
19
+ 前置:
20
+ 1) 先运行 `$ws-preflight`。
21
+ 2) 准备 `change-id`(建议:`bug-<bug-id>` 或 `bugfix-<bug-id>-<slug>`)。
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`
28
+ ```bash
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
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`
50
+
51
+ 建议流程(按顺序):
52
+
53
+ ## 1) 通过禅道 MCP 拉取 bug
54
+ - 使用当前会话中已启用的 zentao MCP 工具获取:
55
+ - `bug_id`、标题、优先级/严重级、模块、状态、指派人
56
+ - 重现步骤、期望结果、实际结果
57
+ - 附件列表(含图片 URL/文件名)
58
+ - 若当前环境没有 zentao MCP 工具:立即停止并提示用户先配置,不要猜数据。
59
+
60
+ ## 2) 证据落盘(强制)
61
+ 在当前 active change 上下文的 `changes/<change-id>/bug/` 下落盘:
62
+ - `zentao-bug-<bug-id>.json`:原始字段快照(避免信息丢失)
63
+ - `zentao-bug-<bug-id>.md`:人类可读摘要(复现步骤/期望/实际/风险)
64
+ - `images/<bug-id>/...`:下载的图片附件(保留原扩展名)
65
+
66
+ 建议目录:
67
+ ```text
68
+ changes/<change-id>/bug/
69
+ zentao-bug-<bug-id>.json
70
+ zentao-bug-<bug-id>.md
71
+ images/<bug-id>/
72
+ ```
73
+
74
+ ## 3) 汇总到 issues/fix_bus_issues.csv(upsert)
75
+ - 目标文件:当前 active change 上下文中的 `issues/fix_bus_issues.csv`
76
+ - 若文件不存在,先创建表头:
77
+ ```csv
78
+ Bug_ID,Title,Severity,Module,Status,Assigned_To,Change_ID,Image_Count,Image_Paths,Evidence_Path,Verify_Command,Fix_Status,Updated_At,Notes
79
+ ```
80
+ - 以 `Bug_ID` 为主键 upsert:
81
+ - 已存在:更新状态/证据/图片路径
82
+ - 不存在:新增一行
83
+
84
+ 字段约束:
85
+ - `Change_ID`:必须等于当前 `change-id`
86
+ - `Evidence_Path`:指向 `changes/<change-id>/bug/zentao-bug-<bug-id>.md`
87
+ - `Image_Paths`:多个路径用 `;` 分隔
88
+ - `Fix_Status`:`TODO|DOING|DONE|BLOCKED`
89
+
90
+ ## 4) 修复执行与回填
91
+ - 进入 `$ws-dev` 做最小改动修复;若 `ws-bugfix` 创建了 worktree,则必须在该 worktree 中继续。
92
+ - 完成后回填 `issues/fix_bus_issues.csv`:
93
+ - `Fix_Status`
94
+ - `Verify_Command`
95
+ - `Updated_At`
96
+ - `Notes`(必要时写阻塞原因)
97
+
98
+ ## 5) 验证与交付
99
+ ```bash
100
+ aiws change validate <change-id> --strict
101
+ aiws validate . --stamp
102
+ ```
103
+ - 需要提交时走 `$ws-commit`。
104
+ - 需要收尾合并时走 `$ws-finish`(或在 superproject + submodule 场景走 `$ws-deliver`)。
105
+
106
+ 输出要求:
107
+ - `Change_ID:` `<change-id>`
108
+ - `Change context:` `<当前分支或 worktree 路径>`
109
+ - `CSV:` `issues/fix_bus_issues.csv` 中对应 `Bug_ID` 行的关键字段
110
+ - `Evidence:` `changes/<change-id>/bug/zentao-bug-<bug-id>.md` + 图片目录
111
+ - `Verify:` 实际运行命令与结果(未运行不声称已运行)