@aipper/aiws-spec 0.0.24 → 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 (191) 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-commit/SKILL.md +23 -0
  28. package/templates/workspace/.agents/skills/ws-delegate/SKILL.md +75 -0
  29. package/templates/workspace/.agents/skills/ws-deliver/SKILL.md +22 -0
  30. package/templates/workspace/.agents/skills/ws-dev/SKILL.md +35 -6
  31. package/templates/workspace/.agents/skills/ws-finish/SKILL.md +24 -0
  32. package/templates/workspace/.agents/skills/ws-frontend-design/SKILL.md +126 -0
  33. package/templates/workspace/.agents/skills/ws-handoff/SKILL.md +22 -1
  34. package/templates/workspace/.agents/skills/ws-plan/SKILL.md +25 -1
  35. package/templates/workspace/.agents/skills/ws-plan-verify/SKILL.md +20 -0
  36. package/templates/workspace/.agents/skills/ws-preflight/SKILL.md +23 -0
  37. package/templates/workspace/.agents/skills/ws-quality-review/SKILL.md +56 -0
  38. package/templates/workspace/.agents/skills/ws-review/SKILL.md +24 -0
  39. package/templates/workspace/.agents/skills/ws-spec-review/SKILL.md +57 -0
  40. package/templates/workspace/.agents/skills/ws-verify-before-complete/SKILL.md +59 -0
  41. package/templates/workspace/.claude/commands/using-aiws.md +24 -0
  42. package/templates/workspace/.claude/commands/ws-quality-review.md +24 -0
  43. package/templates/workspace/.claude/commands/ws-spec-review.md +24 -0
  44. package/templates/workspace/.claude/commands/ws-verify-before-complete.md +24 -0
  45. package/templates/workspace/.claude/skills/p-aiws-change-archive/SKILL.md +24 -0
  46. package/templates/workspace/.claude/skills/p-aiws-change-finish/SKILL.md +24 -0
  47. package/templates/workspace/.claude/skills/p-aiws-change-list/SKILL.md +18 -0
  48. package/templates/workspace/.claude/skills/p-aiws-change-new/SKILL.md +26 -0
  49. package/templates/workspace/.claude/skills/p-aiws-change-next/SKILL.md +19 -0
  50. package/templates/workspace/.claude/skills/p-aiws-change-start/SKILL.md +33 -0
  51. package/templates/workspace/.claude/skills/p-aiws-change-status/SKILL.md +19 -0
  52. package/templates/workspace/.claude/skills/p-aiws-change-sync/SKILL.md +19 -0
  53. package/templates/workspace/.claude/skills/p-aiws-change-templates-init/SKILL.md +18 -0
  54. package/templates/workspace/.claude/skills/p-aiws-change-templates-which/SKILL.md +18 -0
  55. package/templates/workspace/.claude/skills/p-aiws-change-validate/SKILL.md +23 -0
  56. package/templates/workspace/.claude/skills/p-aiws-hooks-install/SKILL.md +30 -0
  57. package/templates/workspace/.claude/skills/p-aiws-hooks-status/SKILL.md +18 -0
  58. package/templates/workspace/.claude/skills/p-aiws-init/SKILL.md +27 -0
  59. package/templates/workspace/.claude/skills/p-aiws-rollback/SKILL.md +18 -0
  60. package/templates/workspace/.claude/skills/p-aiws-update/SKILL.md +26 -0
  61. package/templates/workspace/.claude/skills/p-aiws-validate/SKILL.md +22 -0
  62. package/templates/workspace/.claude/skills/p-tasks-plan/SKILL.md +37 -0
  63. package/templates/workspace/.claude/skills/using-aiws/SKILL.md +83 -0
  64. package/templates/workspace/.claude/skills/ws-analyze/SKILL.md +26 -0
  65. package/templates/workspace/.claude/skills/ws-bugfix/SKILL.md +111 -0
  66. package/templates/workspace/.claude/skills/ws-commit/SKILL.md +127 -0
  67. package/templates/workspace/.claude/skills/ws-deliver/SKILL.md +231 -0
  68. package/templates/workspace/.claude/skills/ws-dev/SKILL.md +168 -0
  69. package/templates/workspace/.claude/skills/ws-finish/SKILL.md +220 -0
  70. package/templates/workspace/.claude/skills/ws-frontend-design/SKILL.md +126 -0
  71. package/templates/workspace/.claude/skills/ws-handoff/SKILL.md +52 -0
  72. package/templates/workspace/.claude/skills/ws-migrate/SKILL.md +54 -0
  73. package/templates/workspace/.claude/skills/ws-plan/SKILL.md +138 -0
  74. package/templates/workspace/.claude/skills/ws-plan-verify/SKILL.md +61 -0
  75. package/templates/workspace/.claude/skills/ws-preflight/SKILL.md +55 -0
  76. package/templates/workspace/.claude/skills/ws-pull/SKILL.md +119 -0
  77. package/templates/workspace/.claude/skills/ws-push/SKILL.md +110 -0
  78. package/templates/workspace/.claude/skills/ws-quality-review/SKILL.md +56 -0
  79. package/templates/workspace/.claude/skills/ws-req-change/SKILL.md +41 -0
  80. package/templates/workspace/.claude/skills/ws-req-contract-sync/SKILL.md +17 -0
  81. package/templates/workspace/.claude/skills/ws-req-contract-validate/SKILL.md +12 -0
  82. package/templates/workspace/.claude/skills/ws-req-flow-sync/SKILL.md +28 -0
  83. package/templates/workspace/.claude/skills/ws-req-review/SKILL.md +32 -0
  84. package/templates/workspace/.claude/skills/ws-review/SKILL.md +50 -0
  85. package/templates/workspace/.claude/skills/ws-rule/SKILL.md +23 -0
  86. package/templates/workspace/.claude/skills/ws-spec-review/SKILL.md +57 -0
  87. package/templates/workspace/.claude/skills/ws-submodule-setup/SKILL.md +65 -0
  88. package/templates/workspace/.claude/skills/ws-verify-before-complete/SKILL.md +59 -0
  89. package/templates/workspace/.opencode/command/using-aiws.md +29 -0
  90. package/templates/workspace/.opencode/command/ws-delegate.md +33 -0
  91. package/templates/workspace/.opencode/command/ws-plan.md +3 -0
  92. package/templates/workspace/.opencode/command/ws-preflight.md +4 -0
  93. package/templates/workspace/.opencode/command/ws-quality-review.md +30 -0
  94. package/templates/workspace/.opencode/command/ws-review.md +3 -0
  95. package/templates/workspace/.opencode/command/ws-spec-review.md +30 -0
  96. package/templates/workspace/.opencode/command/ws-verify-before-complete.md +27 -0
  97. package/templates/workspace/.opencode/commands/p-aiws-change-archive.md +27 -0
  98. package/templates/workspace/.opencode/commands/p-aiws-change-finish.md +27 -0
  99. package/templates/workspace/.opencode/commands/p-aiws-change-list.md +26 -0
  100. package/templates/workspace/.opencode/commands/p-aiws-change-new.md +27 -0
  101. package/templates/workspace/.opencode/commands/p-aiws-change-next.md +27 -0
  102. package/templates/workspace/.opencode/commands/p-aiws-change-start.md +27 -0
  103. package/templates/workspace/.opencode/commands/p-aiws-change-status.md +27 -0
  104. package/templates/workspace/.opencode/commands/p-aiws-change-sync.md +27 -0
  105. package/templates/workspace/.opencode/commands/p-aiws-change-templates-init.md +26 -0
  106. package/templates/workspace/.opencode/commands/p-aiws-change-templates-which.md +26 -0
  107. package/templates/workspace/.opencode/commands/p-aiws-change-validate.md +27 -0
  108. package/templates/workspace/.opencode/commands/p-aiws-hooks-install.md +26 -0
  109. package/templates/workspace/.opencode/commands/p-aiws-hooks-status.md +26 -0
  110. package/templates/workspace/.opencode/commands/p-aiws-init.md +23 -0
  111. package/templates/workspace/.opencode/commands/p-aiws-rollback.md +16 -0
  112. package/templates/workspace/.opencode/commands/p-aiws-update.md +22 -0
  113. package/templates/workspace/.opencode/commands/p-aiws-validate.md +17 -0
  114. package/templates/workspace/.opencode/commands/using-aiws.md +29 -0
  115. package/templates/workspace/.opencode/commands/ws-analyze.md +30 -0
  116. package/templates/workspace/.opencode/commands/ws-bugfix.md +35 -0
  117. package/templates/workspace/.opencode/commands/ws-commit.md +70 -0
  118. package/templates/workspace/.opencode/commands/ws-delegate.md +33 -0
  119. package/templates/workspace/.opencode/commands/ws-deliver.md +58 -0
  120. package/templates/workspace/.opencode/commands/ws-dev.md +36 -0
  121. package/templates/workspace/.opencode/commands/ws-finish.md +71 -0
  122. package/templates/workspace/.opencode/commands/ws-handoff.md +25 -0
  123. package/templates/workspace/.opencode/commands/ws-migrate.md +25 -0
  124. package/templates/workspace/.opencode/commands/ws-plan-verify.md +28 -0
  125. package/templates/workspace/.opencode/commands/ws-plan.md +27 -0
  126. package/templates/workspace/.opencode/commands/ws-preflight.md +34 -0
  127. package/templates/workspace/.opencode/commands/ws-pull.md +87 -0
  128. package/templates/workspace/.opencode/commands/ws-push.md +93 -0
  129. package/templates/workspace/.opencode/commands/ws-quality-review.md +30 -0
  130. package/templates/workspace/.opencode/commands/ws-req-change.md +45 -0
  131. package/templates/workspace/.opencode/commands/ws-req-contract-sync.md +21 -0
  132. package/templates/workspace/.opencode/commands/ws-req-contract-validate.md +16 -0
  133. package/templates/workspace/.opencode/commands/ws-req-flow-sync.md +23 -0
  134. package/templates/workspace/.opencode/commands/ws-req-review.md +36 -0
  135. package/templates/workspace/.opencode/commands/ws-review.md +33 -0
  136. package/templates/workspace/.opencode/commands/ws-rule.md +27 -0
  137. package/templates/workspace/.opencode/commands/ws-spec-review.md +30 -0
  138. package/templates/workspace/.opencode/commands/ws-submodule-setup.md +57 -0
  139. package/templates/workspace/.opencode/commands/ws-verify-before-complete.md +27 -0
  140. package/templates/workspace/.opencode/oh-my-opencode.json.example +17 -0
  141. package/templates/workspace/.opencode/skills/p-aiws-change-archive/SKILL.md +24 -0
  142. package/templates/workspace/.opencode/skills/p-aiws-change-finish/SKILL.md +24 -0
  143. package/templates/workspace/.opencode/skills/p-aiws-change-list/SKILL.md +18 -0
  144. package/templates/workspace/.opencode/skills/p-aiws-change-new/SKILL.md +26 -0
  145. package/templates/workspace/.opencode/skills/p-aiws-change-next/SKILL.md +19 -0
  146. package/templates/workspace/.opencode/skills/p-aiws-change-start/SKILL.md +33 -0
  147. package/templates/workspace/.opencode/skills/p-aiws-change-status/SKILL.md +19 -0
  148. package/templates/workspace/.opencode/skills/p-aiws-change-sync/SKILL.md +19 -0
  149. package/templates/workspace/.opencode/skills/p-aiws-change-templates-init/SKILL.md +18 -0
  150. package/templates/workspace/.opencode/skills/p-aiws-change-templates-which/SKILL.md +18 -0
  151. package/templates/workspace/.opencode/skills/p-aiws-change-validate/SKILL.md +23 -0
  152. package/templates/workspace/.opencode/skills/p-aiws-hooks-install/SKILL.md +30 -0
  153. package/templates/workspace/.opencode/skills/p-aiws-hooks-status/SKILL.md +18 -0
  154. package/templates/workspace/.opencode/skills/p-aiws-init/SKILL.md +27 -0
  155. package/templates/workspace/.opencode/skills/p-aiws-rollback/SKILL.md +18 -0
  156. package/templates/workspace/.opencode/skills/p-aiws-update/SKILL.md +26 -0
  157. package/templates/workspace/.opencode/skills/p-aiws-validate/SKILL.md +22 -0
  158. package/templates/workspace/.opencode/skills/p-tasks-plan/SKILL.md +37 -0
  159. package/templates/workspace/.opencode/skills/using-aiws/SKILL.md +87 -0
  160. package/templates/workspace/.opencode/skills/ws-analyze/SKILL.md +26 -0
  161. package/templates/workspace/.opencode/skills/ws-bugfix/SKILL.md +111 -0
  162. package/templates/workspace/.opencode/skills/ws-commit/SKILL.md +127 -0
  163. package/templates/workspace/.opencode/skills/ws-delegate/SKILL.md +63 -0
  164. package/templates/workspace/.opencode/skills/ws-deliver/SKILL.md +231 -0
  165. package/templates/workspace/.opencode/skills/ws-dev/SKILL.md +168 -0
  166. package/templates/workspace/.opencode/skills/ws-finish/SKILL.md +220 -0
  167. package/templates/workspace/.opencode/skills/ws-frontend-design/SKILL.md +126 -0
  168. package/templates/workspace/.opencode/skills/ws-handoff/SKILL.md +52 -0
  169. package/templates/workspace/.opencode/skills/ws-migrate/SKILL.md +54 -0
  170. package/templates/workspace/.opencode/skills/ws-plan/SKILL.md +148 -0
  171. package/templates/workspace/.opencode/skills/ws-plan-verify/SKILL.md +61 -0
  172. package/templates/workspace/.opencode/skills/ws-preflight/SKILL.md +60 -0
  173. package/templates/workspace/.opencode/skills/ws-pull/SKILL.md +119 -0
  174. package/templates/workspace/.opencode/skills/ws-push/SKILL.md +110 -0
  175. package/templates/workspace/.opencode/skills/ws-quality-review/SKILL.md +63 -0
  176. package/templates/workspace/.opencode/skills/ws-req-change/SKILL.md +41 -0
  177. package/templates/workspace/.opencode/skills/ws-req-contract-sync/SKILL.md +17 -0
  178. package/templates/workspace/.opencode/skills/ws-req-contract-validate/SKILL.md +12 -0
  179. package/templates/workspace/.opencode/skills/ws-req-flow-sync/SKILL.md +28 -0
  180. package/templates/workspace/.opencode/skills/ws-req-review/SKILL.md +32 -0
  181. package/templates/workspace/.opencode/skills/ws-review/SKILL.md +57 -0
  182. package/templates/workspace/.opencode/skills/ws-rule/SKILL.md +23 -0
  183. package/templates/workspace/.opencode/skills/ws-spec-review/SKILL.md +64 -0
  184. package/templates/workspace/.opencode/skills/ws-submodule-setup/SKILL.md +65 -0
  185. package/templates/workspace/.opencode/skills/ws-verify-before-complete/SKILL.md +59 -0
  186. package/templates/workspace/AGENTS.md +72 -30
  187. package/templates/workspace/changes/README.md +18 -0
  188. package/templates/workspace/changes/templates/proposal.md +15 -0
  189. package/templates/workspace/changes/templates/tasks.md +9 -2
  190. package/templates/workspace/manifest.json +277 -2
  191. package/templates/workspace/tools/ws_change_check.py +26 -4
@@ -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:` 实际运行命令与结果(未运行不声称已运行)
@@ -0,0 +1,127 @@
1
+ ---
2
+ name: ws-commit
3
+ description: 提交(当前分支可直提;submodule 感知;先审计/门禁再 commit)
4
+ ---
5
+
6
+ 用中文输出(命令/路径/代码标识符保持原样不翻译)。
7
+
8
+ 目标:
9
+ - 支持在**当前分支直接提交**(不要求必须先切 `change/<change-id>`)
10
+ - 提交前审计与证据落盘(`$ws-review`)
11
+ - 提交前门禁校验与证据落盘(`aiws validate . --stamp`)
12
+ - 最后执行 `git commit`(commit 前必须让用户确认 message;不使用 `--no-verify` 绕过 hooks)
13
+ - 若仓库含 submodule:提交前识别并提示正确顺序(先 submodule,再 superproject)
14
+ - 若你经常遇到 submodule detached:建议日常拉取使用 `$ws-pull`(尽量把 submodule “挂回分支”且不改变 gitlink commit)
15
+
16
+ 安全约束(强制):
17
+ - 不自动 `git add -A`(避免误提交);只在用户明确指示时才执行 staging 命令
18
+ - 不自动 push
19
+ - 不写入任何 secrets
20
+ - 检测到 submodule 有未提交改动时,不允许直接提交 superproject(先处理 submodule)
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` 绕过门禁。
46
+
47
+ 执行步骤(建议):
48
+ 1) 运行 `$ws-preflight`(确保真值文件就绪)。
49
+ 2) 运行 `$ws-review`(优先生成审计证据:`changes/<change-id>/review/codex-review.md`;无 `change-id` 时回退 `.agentdocs/tmp/review/codex-review.md`)。
50
+ 3) 运行门禁校验并写 stamp:
51
+ ```bash
52
+ if [[ -x "./node_modules/.bin/aiws" ]]; then
53
+ ./node_modules/.bin/aiws validate . --stamp
54
+ elif command -v aiws >/dev/null 2>&1; then
55
+ aiws validate . --stamp
56
+ else
57
+ npx @aipper/aiws validate . --stamp
58
+ fi
59
+ ```
60
+ 4) 输出当前提交上下文(必须输出给用户确认):
61
+ ```bash
62
+ git branch --show-current
63
+ git status --porcelain
64
+ ```
65
+ 5) 检测是否存在 submodule(有则进入 submodule 感知模式):
66
+ ```bash
67
+ if [[ -f .gitmodules ]]; then
68
+ git config --file .gitmodules --get-regexp '^submodule\..*\.path$' || true
69
+ else
70
+ echo "[info] no .gitmodules"
71
+ fi
72
+ ```
73
+ 6) 若存在 submodule,逐个检查子仓库工作区是否干净:
74
+ ```bash
75
+ while read -r _ sub_path; do
76
+ [[ -z "${sub_path:-}" ]] && continue
77
+ echo "== submodule: ${sub_path} =="
78
+ git -C "${sub_path}" rev-parse --abbrev-ref HEAD 2>/dev/null || true
79
+ git -C "${sub_path}" status --porcelain || true
80
+ done < <(git config --file .gitmodules --get-regexp '^submodule\..*\.path$' 2>/dev/null || true)
81
+ ```
82
+ 判定规则(强制):
83
+ - 任一 submodule `git status --porcelain` 非空:停止 superproject commit,先在对应 submodule 完成 commit,再回到 superproject 更新并提交 gitlink。
84
+ - 若该 submodule 当前为 detached HEAD:先按 `.gitmodules` 的目标分支挂到 `aiws/pin/<target_branch>`;不要直接切 `change/<change-id>` / `main` / `master` 来“解 detached”。
85
+ 处理指引(detached submodule):
86
+ ```bash
87
+ cur_branch="$(git branch --show-current)"
88
+ change_id="$(echo "${cur_branch}" | sed -n 's|^change/||p')"
89
+ targets="changes/${change_id}/submodules.targets"
90
+
91
+ source tools/ws_resolve_sub_target.sh
92
+ ws_resolve_sub_target "${sub_path}" "${sub_name}" "${targets}" "${cur_branch}" || exit 2
93
+ target_branch="${_resolved_branch}"
94
+ remote="${_resolved_remote}"
95
+
96
+ git -C "${sub_path}" fetch "${remote}" --prune
97
+ if ! git -C "${sub_path}" show-ref --verify --quiet "refs/remotes/${remote}/${target_branch}"; then
98
+ echo "error: missing ${remote}/${target_branch} for submodule path=${sub_path}"
99
+ exit 2
100
+ fi
101
+ git -C "${sub_path}" checkout -B "aiws/pin/${target_branch}" HEAD
102
+ git -C "${sub_path}" branch --set-upstream-to "${remote}/${target_branch}" "aiws/pin/${target_branch}" >/dev/null 2>&1 || true
103
+ ```
104
+ 7) 检查当前 staging 内容(必须输出给用户确认):
105
+ ```bash
106
+ git status --porcelain
107
+ git diff --staged --submodule=short
108
+ ```
109
+ 8) 若没有 staged changes:停止并提示用户先明确要提交哪些文件(例如 `git add -p` 或 `git add <path>`)。
110
+ 9) 生成中文 commit message 草案(格式:`<类型>: <简述>`),输出给用户确认后再执行。
111
+ - 类型参考:`功能` / `修复` / `重构` / `文档` / `测试` / `构建` / `杂项`
112
+ - 简述用一句话概括本次改动的"为什么"而非"改了什么"
113
+ - 命令/路径/代码标识符保持原样不翻译
114
+ - 若用户给出全英文 message:优先改写成中文;若用户明确要求保留英文,也可以提交(但 strict 模式下会被 hook 拒绝)
115
+ 10) 执行提交(不带 `--no-verify`):
116
+ ```bash
117
+ git commit -m "<message>"
118
+ ```
119
+ 11) 输出提交结果(可选):
120
+ ```bash
121
+ git show --stat --oneline -1
122
+ ```
123
+
124
+ 输出要求:
125
+ - `证据(Evidence):` `changes/<change-id>/review/codex-review.md`(无 `change-id` 时回退 `.agentdocs/tmp/review/codex-review.md`) + `.agentdocs/tmp/aiws-validate/*.json`
126
+ - `上下文(Context):` 当前分支 + 是否检测到 submodule + 若阻断则给出阻断原因
127
+ - `提交信息(Commit):` 最终使用的 commit message(仅当用户确认后)