@fitlab-ai/agent-infra 0.6.5 → 0.7.1

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 (208) hide show
  1. package/README.md +51 -25
  2. package/README.zh-CN.md +49 -23
  3. package/bin/cli.ts +1 -1
  4. package/dist/bin/cli.js +1 -1
  5. package/dist/lib/builtin-tuis.js +45 -0
  6. package/dist/lib/defaults.json +4 -0
  7. package/dist/lib/init.js +65 -23
  8. package/dist/lib/prompt.js +49 -1
  9. package/dist/lib/sandbox/commands/create.js +4 -2
  10. package/dist/lib/sandbox/commands/enter.js +15 -4
  11. package/dist/lib/sandbox/commands/list-running.js +153 -0
  12. package/dist/lib/sandbox/commands/ls.js +24 -45
  13. package/dist/lib/sandbox/commands/rebuild.js +7 -13
  14. package/dist/lib/sandbox/commands/rm.js +2 -0
  15. package/dist/lib/sandbox/config.js +3 -0
  16. package/dist/lib/sandbox/image-prune.js +18 -0
  17. package/dist/lib/sandbox/index.js +2 -1
  18. package/dist/lib/sandbox/runtimes/ai-tools.dockerfile +10 -6
  19. package/dist/lib/sandbox/task-resolver.js +18 -0
  20. package/dist/lib/sandbox/tools.js +213 -8
  21. package/dist/lib/update.js +70 -18
  22. package/lib/builtin-tuis.ts +55 -0
  23. package/lib/defaults.json +4 -0
  24. package/lib/init.ts +97 -35
  25. package/lib/prompt.ts +54 -1
  26. package/lib/sandbox/commands/create.ts +10 -2
  27. package/lib/sandbox/commands/enter.ts +14 -4
  28. package/lib/sandbox/commands/list-running.ts +188 -0
  29. package/lib/sandbox/commands/ls.ts +28 -49
  30. package/lib/sandbox/commands/rebuild.ts +12 -14
  31. package/lib/sandbox/commands/rm.ts +3 -0
  32. package/lib/sandbox/config.ts +7 -0
  33. package/lib/sandbox/image-prune.ts +23 -0
  34. package/lib/sandbox/index.ts +2 -1
  35. package/lib/sandbox/runtimes/ai-tools.dockerfile +10 -6
  36. package/lib/sandbox/task-resolver.ts +23 -1
  37. package/lib/sandbox/tools.ts +248 -9
  38. package/lib/update.ts +85 -30
  39. package/package.json +1 -1
  40. package/templates/.agents/QUICKSTART.en.md +1 -1
  41. package/templates/.agents/QUICKSTART.zh-CN.md +1 -1
  42. package/templates/.agents/README.en.md +111 -2
  43. package/templates/.agents/README.zh-CN.md +111 -2
  44. package/templates/.agents/rules/create-issue.en.md +1 -1
  45. package/templates/.agents/rules/create-issue.github.en.md +1 -1
  46. package/templates/.agents/rules/create-issue.github.zh-CN.md +1 -1
  47. package/templates/.agents/rules/create-issue.zh-CN.md +1 -1
  48. package/templates/.agents/rules/issue-sync.github.en.md +6 -5
  49. package/templates/.agents/rules/issue-sync.github.zh-CN.md +6 -5
  50. package/templates/.agents/rules/milestone-inference.github.en.md +2 -2
  51. package/templates/.agents/rules/milestone-inference.github.zh-CN.md +2 -2
  52. package/templates/.agents/rules/no-mid-flow-questions.en.md +57 -0
  53. package/templates/.agents/rules/no-mid-flow-questions.zh-CN.md +57 -0
  54. package/templates/.agents/rules/pr-sync.github.en.md +4 -5
  55. package/templates/.agents/rules/pr-sync.github.zh-CN.md +4 -5
  56. package/templates/.agents/rules/task-management.en.md +9 -6
  57. package/templates/.agents/rules/task-management.zh-CN.md +9 -6
  58. package/templates/.agents/rules/task-short-id.en.md +141 -0
  59. package/templates/.agents/rules/task-short-id.zh-CN.md +124 -0
  60. package/templates/.agents/rules/testing-discipline.en.md +2 -2
  61. package/templates/.agents/rules/testing-discipline.zh-CN.md +2 -2
  62. package/templates/.agents/scripts/task-short-id.js +713 -0
  63. package/templates/.agents/scripts/validate-artifact.js +1 -1
  64. package/templates/.agents/skills/analyze-task/SKILL.en.md +20 -4
  65. package/templates/.agents/skills/analyze-task/SKILL.zh-CN.md +20 -5
  66. package/templates/.agents/skills/block-task/SKILL.en.md +12 -0
  67. package/templates/.agents/skills/block-task/SKILL.zh-CN.md +12 -1
  68. package/templates/.agents/skills/cancel-task/SKILL.en.md +12 -0
  69. package/templates/.agents/skills/cancel-task/SKILL.zh-CN.md +12 -1
  70. package/templates/.agents/skills/check-task/SKILL.en.md +47 -32
  71. package/templates/.agents/skills/check-task/SKILL.zh-CN.md +46 -32
  72. package/templates/.agents/skills/close-codescan/SKILL.en.md +11 -0
  73. package/templates/.agents/skills/close-codescan/SKILL.zh-CN.md +11 -0
  74. package/templates/.agents/skills/close-dependabot/SKILL.en.md +11 -0
  75. package/templates/.agents/skills/close-dependabot/SKILL.zh-CN.md +11 -0
  76. package/templates/.agents/skills/code-task/SKILL.en.md +121 -0
  77. package/templates/.agents/skills/{implement-task → code-task}/SKILL.zh-CN.md +55 -25
  78. package/templates/.agents/skills/{implement-task → code-task}/config/verify.en.json +4 -4
  79. package/templates/.agents/skills/{implement-task → code-task}/config/verify.zh-CN.json +4 -4
  80. package/templates/.agents/skills/{implement-task → code-task}/reference/branch-management.zh-CN.md +2 -2
  81. package/templates/.agents/skills/{implement-task/reference/implementation-rules.en.md → code-task/reference/code-rules.en.md} +6 -6
  82. package/templates/.agents/skills/{implement-task/reference/implementation-rules.zh-CN.md → code-task/reference/code-rules.zh-CN.md} +3 -3
  83. package/templates/.agents/skills/code-task/reference/dual-mode.en.md +69 -0
  84. package/templates/.agents/skills/code-task/reference/dual-mode.zh-CN.md +69 -0
  85. package/templates/.agents/skills/{refine-task/reference/fix-workflow.en.md → code-task/reference/fix-mode.en.md} +12 -12
  86. package/templates/.agents/skills/{refine-task/reference/fix-workflow.zh-CN.md → code-task/reference/fix-mode.zh-CN.md} +8 -8
  87. package/templates/.agents/skills/code-task/reference/output-template.en.md +20 -0
  88. package/templates/.agents/skills/code-task/reference/output-template.zh-CN.md +20 -0
  89. package/templates/.agents/skills/{implement-task → code-task}/reference/report-template.en.md +4 -4
  90. package/templates/.agents/skills/{implement-task → code-task}/reference/report-template.zh-CN.md +3 -3
  91. package/templates/.agents/skills/code-task/scripts/detect-mode.js +370 -0
  92. package/templates/.agents/skills/commit/SKILL.en.md +6 -2
  93. package/templates/.agents/skills/commit/SKILL.zh-CN.md +6 -2
  94. package/templates/.agents/skills/commit/reference/task-status-update.en.md +10 -6
  95. package/templates/.agents/skills/commit/reference/task-status-update.zh-CN.md +10 -6
  96. package/templates/.agents/skills/complete-task/SKILL.en.md +17 -3
  97. package/templates/.agents/skills/complete-task/SKILL.zh-CN.md +17 -4
  98. package/templates/.agents/skills/create-pr/SKILL.en.md +21 -1
  99. package/templates/.agents/skills/create-pr/SKILL.zh-CN.md +21 -1
  100. package/templates/.agents/skills/create-task/SKILL.en.md +14 -0
  101. package/templates/.agents/skills/create-task/SKILL.zh-CN.md +14 -1
  102. package/templates/.agents/skills/import-codescan/SKILL.en.md +15 -1
  103. package/templates/.agents/skills/import-codescan/SKILL.zh-CN.md +15 -1
  104. package/templates/.agents/skills/import-dependabot/SKILL.en.md +16 -2
  105. package/templates/.agents/skills/import-dependabot/SKILL.zh-CN.md +16 -2
  106. package/templates/.agents/skills/import-issue/SKILL.en.md +17 -3
  107. package/templates/.agents/skills/import-issue/SKILL.zh-CN.md +17 -3
  108. package/templates/.agents/skills/plan-task/SKILL.en.md +8 -4
  109. package/templates/.agents/skills/plan-task/SKILL.zh-CN.md +8 -5
  110. package/templates/.agents/skills/restore-task/SKILL.en.md +16 -3
  111. package/templates/.agents/skills/restore-task/SKILL.zh-CN.md +16 -4
  112. package/templates/.agents/skills/review-analysis/SKILL.en.md +80 -0
  113. package/templates/.agents/skills/review-analysis/SKILL.zh-CN.md +105 -0
  114. package/templates/.agents/skills/review-analysis/config/verify.en.json +51 -0
  115. package/templates/.agents/skills/review-analysis/config/verify.zh-CN.json +51 -0
  116. package/templates/.agents/skills/review-analysis/reference/output-templates.en.md +87 -0
  117. package/templates/.agents/skills/review-analysis/reference/output-templates.zh-CN.md +87 -0
  118. package/templates/.agents/skills/review-analysis/reference/report-template.en.md +90 -0
  119. package/templates/.agents/skills/review-analysis/reference/report-template.zh-CN.md +91 -0
  120. package/templates/.agents/skills/review-analysis/reference/review-criteria.en.md +47 -0
  121. package/templates/.agents/skills/review-analysis/reference/review-criteria.zh-CN.md +47 -0
  122. package/templates/.agents/skills/{review-task → review-code}/SKILL.en.md +15 -9
  123. package/templates/.agents/skills/{review-task → review-code}/SKILL.zh-CN.md +19 -10
  124. package/templates/.agents/skills/{review-task → review-code}/config/verify.en.json +7 -5
  125. package/templates/.agents/skills/{review-task → review-code}/config/verify.zh-CN.json +6 -4
  126. package/templates/.agents/skills/{review-task → review-code}/reference/output-templates.en.md +21 -17
  127. package/templates/.agents/skills/{review-task → review-code}/reference/output-templates.zh-CN.md +19 -15
  128. package/templates/.agents/skills/{review-task → review-code}/reference/report-template.en.md +5 -6
  129. package/templates/.agents/skills/review-code/reference/report-template.zh-CN.md +91 -0
  130. package/templates/.agents/skills/review-code/reference/review-criteria.en.md +48 -0
  131. package/templates/.agents/skills/{review-task → review-code}/reference/review-criteria.zh-CN.md +10 -4
  132. package/templates/.agents/skills/review-plan/SKILL.en.md +80 -0
  133. package/templates/.agents/skills/review-plan/SKILL.zh-CN.md +105 -0
  134. package/templates/.agents/skills/{refine-task → review-plan}/config/verify.en.json +14 -10
  135. package/templates/.agents/skills/{refine-task → review-plan}/config/verify.zh-CN.json +14 -10
  136. package/templates/.agents/skills/review-plan/reference/output-templates.en.md +87 -0
  137. package/templates/.agents/skills/review-plan/reference/output-templates.zh-CN.md +87 -0
  138. package/templates/.agents/skills/review-plan/reference/report-template.en.md +90 -0
  139. package/templates/.agents/skills/{review-task → review-plan}/reference/report-template.zh-CN.md +3 -3
  140. package/templates/.agents/skills/review-plan/reference/review-criteria.en.md +47 -0
  141. package/templates/.agents/skills/review-plan/reference/review-criteria.zh-CN.md +47 -0
  142. package/templates/.agents/skills/test/SKILL.en.md +2 -2
  143. package/templates/.agents/skills/test/SKILL.zh-CN.md +13 -31
  144. package/templates/.agents/skills/update-agent-infra/SKILL.en.md +1 -0
  145. package/templates/.agents/skills/update-agent-infra/SKILL.zh-CN.md +1 -0
  146. package/templates/.agents/skills/update-agent-infra/scripts/sync-templates.js +113 -21
  147. package/templates/.agents/templates/task.en.md +4 -3
  148. package/templates/.agents/templates/task.zh-CN.md +3 -2
  149. package/templates/.agents/workflows/bug-fix.en.yaml +126 -80
  150. package/templates/.agents/workflows/bug-fix.zh-CN.yaml +90 -44
  151. package/templates/.agents/workflows/feature-development.en.yaml +115 -70
  152. package/templates/.agents/workflows/feature-development.zh-CN.yaml +92 -47
  153. package/templates/.agents/workflows/refactoring.en.yaml +123 -78
  154. package/templates/.agents/workflows/refactoring.zh-CN.yaml +89 -44
  155. package/templates/.claude/commands/code-task.en.md +8 -0
  156. package/templates/.claude/commands/code-task.zh-CN.md +8 -0
  157. package/templates/.claude/commands/review-analysis.en.md +8 -0
  158. package/templates/.claude/commands/review-analysis.zh-CN.md +8 -0
  159. package/templates/.claude/commands/review-code.en.md +8 -0
  160. package/templates/.claude/commands/review-code.zh-CN.md +8 -0
  161. package/templates/.claude/commands/review-plan.en.md +8 -0
  162. package/templates/.claude/commands/review-plan.zh-CN.md +8 -0
  163. package/templates/.gemini/commands/_project_/archive-tasks.zh-CN.toml +1 -1
  164. package/templates/.gemini/commands/_project_/code-task.en.toml +8 -0
  165. package/templates/.gemini/commands/_project_/code-task.zh-CN.toml +8 -0
  166. package/templates/.gemini/commands/_project_/init-labels.zh-CN.toml +1 -1
  167. package/templates/.gemini/commands/_project_/init-milestones.zh-CN.toml +1 -1
  168. package/templates/.gemini/commands/_project_/review-analysis.en.toml +8 -0
  169. package/templates/.gemini/commands/_project_/review-analysis.zh-CN.toml +8 -0
  170. package/templates/.gemini/commands/_project_/review-code.en.toml +8 -0
  171. package/templates/.gemini/commands/_project_/review-code.zh-CN.toml +8 -0
  172. package/templates/.gemini/commands/_project_/review-plan.en.toml +8 -0
  173. package/templates/.gemini/commands/_project_/review-plan.zh-CN.toml +8 -0
  174. package/templates/.opencode/commands/code-task.en.md +11 -0
  175. package/templates/.opencode/commands/code-task.zh-CN.md +11 -0
  176. package/templates/.opencode/commands/review-analysis.en.md +11 -0
  177. package/templates/.opencode/commands/review-analysis.zh-CN.md +11 -0
  178. package/templates/.opencode/commands/review-code.en.md +11 -0
  179. package/templates/.opencode/commands/review-code.zh-CN.md +11 -0
  180. package/templates/.opencode/commands/review-plan.en.md +11 -0
  181. package/templates/.opencode/commands/review-plan.zh-CN.md +11 -0
  182. package/templates/.agents/skills/implement-task/SKILL.en.md +0 -173
  183. package/templates/.agents/skills/implement-task/reference/output-template.en.md +0 -20
  184. package/templates/.agents/skills/implement-task/reference/output-template.zh-CN.md +0 -20
  185. package/templates/.agents/skills/refine-task/SKILL.en.md +0 -153
  186. package/templates/.agents/skills/refine-task/SKILL.zh-CN.md +0 -153
  187. package/templates/.agents/skills/refine-task/reference/report-template.en.md +0 -64
  188. package/templates/.agents/skills/refine-task/reference/report-template.zh-CN.md +0 -64
  189. package/templates/.agents/skills/review-task/reference/review-criteria.en.md +0 -42
  190. package/templates/.claude/commands/implement-task.en.md +0 -8
  191. package/templates/.claude/commands/implement-task.zh-CN.md +0 -8
  192. package/templates/.claude/commands/refine-task.en.md +0 -8
  193. package/templates/.claude/commands/refine-task.zh-CN.md +0 -8
  194. package/templates/.claude/commands/review-task.en.md +0 -8
  195. package/templates/.claude/commands/review-task.zh-CN.md +0 -8
  196. package/templates/.gemini/commands/_project_/implement-task.en.toml +0 -8
  197. package/templates/.gemini/commands/_project_/implement-task.zh-CN.toml +0 -8
  198. package/templates/.gemini/commands/_project_/refine-task.en.toml +0 -8
  199. package/templates/.gemini/commands/_project_/refine-task.zh-CN.toml +0 -8
  200. package/templates/.gemini/commands/_project_/review-task.en.toml +0 -8
  201. package/templates/.gemini/commands/_project_/review-task.zh-CN.toml +0 -8
  202. package/templates/.opencode/commands/implement-task.en.md +0 -11
  203. package/templates/.opencode/commands/implement-task.zh-CN.md +0 -11
  204. package/templates/.opencode/commands/refine-task.en.md +0 -11
  205. package/templates/.opencode/commands/refine-task.zh-CN.md +0 -11
  206. package/templates/.opencode/commands/review-task.en.md +0 -11
  207. package/templates/.opencode/commands/review-task.zh-CN.md +0 -11
  208. /package/templates/.agents/skills/{implement-task → code-task}/reference/branch-management.en.md +0 -0
@@ -16,6 +16,10 @@ Restore local task workspace files from platform Issue comments that contain syn
16
16
 
17
17
  Version stamp rule: when creating or updating `task.md` frontmatter, read `.agents/rules/version-stamp.md` first and write or refresh `agent_infra_version`.
18
18
 
19
+ ## Task id short ref
20
+
21
+ > If `{task-id}` begins with `#`, follow the "SKILL parameter resolver" section of `.agents/rules/task-short-id.md`; treat `{task-id}` as the resolved full `TASK-YYYYMMDD-HHMMSS` form for every downstream command.
22
+
19
23
  ## Steps
20
24
 
21
25
  ### 1. Verify Input and Environment
@@ -43,10 +47,11 @@ Rules:
43
47
  - map `{file-stem}` back to filenames:
44
48
  - `task` -> `task.md`
45
49
  - `analysis` / `analysis-r{N}` -> matching `.md`
50
+ - `review-analysis` / `review-analysis-r{N}` -> matching `.md`
46
51
  - `plan` / `plan-r{N}` -> matching `.md`
47
- - `implementation` / `implementation-r{N}` -> matching `.md`
48
- - `review` / `review-r{N}` -> matching `.md`
49
- - `refinement` / `refinement-r{N}` -> matching `.md`
52
+ - `review-plan` / `review-plan-r{N}` -> matching `.md`
53
+ - `code` / `code-r{N}` -> matching `.md`
54
+ - `review-code` / `review-code-r{N}` -> matching `.md`
50
55
 
51
56
  ### 4. Process Chunks and Check the Local Directory
52
57
 
@@ -89,10 +94,18 @@ Update the restored `task.md`:
89
94
 
90
95
  Append an Activity Log entry indicating the task was restored from the platform Issue.
91
96
 
97
+ **Re-allocate short id** (the task directory is back under `active/`; alloc a new `#N`, which may differ from the pre-archival value):
98
+
99
+ ```bash
100
+ node .agents/scripts/task-short-id.js alloc "$task_id"
101
+ ```
102
+
92
103
  ### 7. Inform User
93
104
 
94
105
  Report the restored task id, restored file count, and the active task directory.
95
106
 
107
+
108
+
96
109
  ## Completion Checklist
97
110
 
98
111
  - [ ] Fetched Issue comments from the platform
@@ -16,8 +16,11 @@ description: "从平台 Issue 评论还原本地任务文件"
16
16
 
17
17
  版本戳规则:创建或更新 `task.md` frontmatter 时,先读取 `.agents/rules/version-stamp.md`,并写入或刷新 `agent_infra_version`。
18
18
 
19
- ## 执行步骤
19
+ ## 任务入参短号别名
20
+
21
+ > 如果 `{task-id}` 入参以 `#` 开头,先读取 `.agents/rules/task-short-id.md` 的「SKILL 入参解析」段执行解析;后续命令视 `{task-id}` 为解析后的全长 `TASK-YYYYMMDD-HHMMSS` 形式。
20
22
 
23
+ ## 执行步骤
21
24
  ### 1. 验证输入与环境
22
25
 
23
26
  检查:
@@ -43,10 +46,11 @@ description: "从平台 Issue 评论还原本地任务文件"
43
46
  - 将 `{file-stem}` 映射回文件名:
44
47
  - `task` -> `task.md`
45
48
  - `analysis` / `analysis-r{N}` -> 对应 `.md`
49
+ - `review-analysis` / `review-analysis-r{N}` -> 对应 `.md`
46
50
  - `plan` / `plan-r{N}` -> 对应 `.md`
47
- - `implementation` / `implementation-r{N}` -> 对应 `.md`
48
- - `review` / `review-r{N}` -> 对应 `.md`
49
- - `refinement` / `refinement-r{N}` -> 对应 `.md`
51
+ - `review-plan` / `review-plan-r{N}` -> 对应 `.md`
52
+ - `code` / `code-r{N}` -> 对应 `.md`
53
+ - `review-code` / `review-code-r{N}` -> 对应 `.md`
50
54
 
51
55
  ### 4. 处理分片并检查本地目录
52
56
 
@@ -89,10 +93,18 @@ date "+%Y-%m-%d %H:%M:%S%:z"
89
93
 
90
94
  追加 Activity Log,说明任务已从平台 Issue 还原。
91
95
 
96
+ **重新分配短号**(已把任务目录写回 `active/`,需要在锁内重新 alloc;新短号可能与归档前不同):
97
+
98
+ ```bash
99
+ node .agents/scripts/task-short-id.js alloc "$task_id"
100
+ ```
101
+
92
102
  ### 7. 告知用户
93
103
 
94
104
  报告已恢复的 task id、恢复文件数量和 active task 目录。
95
105
 
106
+
107
+
96
108
  ## 完成检查清单
97
109
 
98
110
  - [ ] 已从平台获取 Issue 评论
@@ -0,0 +1,80 @@
1
+ ---
2
+ name: review-analysis
3
+ description: "Review the requirement analysis artifact"
4
+ ---
5
+
6
+ # Requirement Analysis Review
7
+
8
+ Review the latest analysis artifact and produce `review-analysis.md` or `review-analysis-r{N}.md`.
9
+
10
+ ## Boundary / Critical Rules
11
+
12
+ - This skill only reviews analysis artifacts and writes a report; it does not modify product code.
13
+ - After executing this skill, you **must** immediately update task.md.
14
+
15
+ Version stamp rule: when creating or updating `task.md` frontmatter, read `.agents/rules/version-stamp.md` first and write or refresh `agent_infra_version`.
16
+
17
+ ## Step 0: State Check (pre-execution hard gate)
18
+
19
+ After loading workflow / skill / rules instructions, and before any task-state judgment or user-visible conclusion, run the state check first.
20
+
21
+ Run these commands and paste the raw output into both the user-facing reply and this round's `## State Check` section:
22
+
23
+ ```bash
24
+ git status -s
25
+ ls -la .agents/workspace/active/{task-id}/
26
+ tail .agents/workspace/active/{task-id}/task.md
27
+ ```
28
+
29
+ ## Task id short ref
30
+
31
+ > If `{task-id}` begins with `#`, follow the "SKILL parameter resolver" section of `.agents/rules/task-short-id.md`; treat `{task-id}` as the resolved full `TASK-YYYYMMDD-HHMMSS` form for every downstream command.
32
+
33
+ ## Steps
34
+
35
+ ### 1. Verify Prerequisites
36
+
37
+ Require `task.md` and at least one analysis artifact: `analysis.md` or `analysis-r{N}.md`.
38
+
39
+ ### 2. Determine Review Round
40
+
41
+ Record `{analysis-artifact}`, `{review-round}`, and `{review-artifact}` (`review-analysis.md` or `review-analysis-r{N}.md`).
42
+
43
+ ### 3. Read Analysis Context
44
+
45
+ Read `{analysis-artifact}`, `task.md`, and Issue context when available.
46
+
47
+ ### 4. Perform Review
48
+
49
+ Check requirement completeness, risks, affected scope, open questions, and effort estimates.
50
+
51
+ > Read `reference/review-criteria.md` before this step.
52
+
53
+ ### 5. Write Review Report
54
+
55
+ Create `.agents/workspace/active/{task-id}/{review-artifact}`.
56
+
57
+ > Read `reference/report-template.md` before writing the report.
58
+
59
+ ### 6. Update Task Status
60
+
61
+ Get the current time:
62
+
63
+ ```bash
64
+ date "+%Y-%m-%d %H:%M:%S%:z"
65
+ ```
66
+
67
+ Set `current_step` to `requirement-analysis-review`, refresh task metadata, and append:
68
+ `- {YYYY-MM-DD HH:mm:ss±HH:MM} — **Analysis Review (Round {N})** by {agent} — Verdict: {Approved/Changes Requested/Rejected}, blockers: {n}, major: {n}, minor: {n}[ (+ {n} env-blocked)] → {review-artifact}`
69
+
70
+ If task.md has a valid `issue_number`, read `.agents/rules/issue-sync.md`, sync the task comment, and publish the `{review-artifact}` comment.
71
+
72
+ ### 7. Run Completion Gate
73
+
74
+ ```bash
75
+ node .agents/scripts/validate-artifact.js gate review-analysis .agents/workspace/active/{task-id} {review-artifact} --format text
76
+ ```
77
+
78
+ ### 8. Tell the User
79
+
80
+ Use the conclusion branch in `reference/output-templates.md` and show all TUI command formats.
@@ -0,0 +1,105 @@
1
+ ---
2
+ name: review-analysis
3
+ description: "审查需求分析报告"
4
+ ---
5
+
6
+ # 需求分析审查
7
+
8
+ 审查最新需求分析产物,并产出 `review-analysis.md` 或 `review-analysis-r{N}.md`。
9
+
10
+ ## 行为边界 / 关键规则
11
+
12
+ - 本技能只审查分析产物并写报告,不修改业务代码
13
+ - 执行本技能后,你**必须**立即更新 task.md
14
+
15
+ 版本戳规则:创建或更新 `task.md` frontmatter 时,先读取 `.agents/rules/version-stamp.md`,并写入或刷新 `agent_infra_version`。
16
+
17
+ ## 第 0 步:状态核对(执行前硬约束)
18
+
19
+ 在加载 workflow / skill / rules 指令之后、做任何任务状态判断或用户可见结论之前,必须先执行状态核对。指令类文件读取不算对外动作或结论。
20
+
21
+ 运行以下命令,并把原文粘贴到回复正文和本轮产物的 `## 状态核对` 段:
22
+
23
+ ```bash
24
+ git status -s
25
+ ls -la .agents/workspace/active/{task-id}/
26
+ tail .agents/workspace/active/{task-id}/task.md
27
+ ```
28
+
29
+ 状态核对完成前,禁止任何关于外部状态的断言。
30
+
31
+ ## 任务入参短号别名
32
+
33
+ > 如果 `{task-id}` 入参以 `#` 开头,先读取 `.agents/rules/task-short-id.md` 的「SKILL 入参解析」段执行解析;后续命令视 `{task-id}` 为解析后的全长 `TASK-YYYYMMDD-HHMMSS` 形式。
34
+
35
+ ## 执行步骤
36
+ ### 1. 验证前置条件
37
+
38
+ 要求存在:
39
+ - `.agents/workspace/active/{task-id}/task.md`
40
+ - 至少一个分析产物:`analysis.md` 或 `analysis-r{N}.md`
41
+
42
+ ### 2. 确定审查轮次
43
+
44
+ 扫描任务目录并记录:
45
+ - `{analysis-artifact}`:最高轮次的分析产物
46
+ - `{review-round}`
47
+ - `{review-artifact}`:`review-analysis.md` 或 `review-analysis-r{N}.md`
48
+
49
+ ### 3. 阅读分析上下文
50
+
51
+ 读取最新 `{analysis-artifact}`、`task.md` 和关联 Issue 上下文(如有)。
52
+
53
+ ### 4. 执行审查
54
+
55
+ 重点检查需求完整性、风险识别、影响范围、开放问题和工作量评估。
56
+
57
+ > 详细审查标准见 `reference/review-criteria.md`。执行此步骤前先读取 `reference/review-criteria.md`。
58
+
59
+ ### 5. 编写审查报告
60
+
61
+ 创建 `.agents/workspace/active/{task-id}/{review-artifact}`。
62
+
63
+ > 报告格式见 `reference/report-template.md`。写报告前先读取 `reference/report-template.md`。
64
+
65
+ ### 6. 更新任务状态
66
+
67
+ 获取当前时间:
68
+
69
+ ```bash
70
+ date "+%Y-%m-%d %H:%M:%S%:z"
71
+ ```
72
+
73
+ 更新 task.md:
74
+ - `current_step`:requirement-analysis-review
75
+ - `assigned_to`:{当前代理}
76
+ - `updated_at`:{当前时间}
77
+ - `agent_infra_version`:按 `.agents/rules/version-stamp.md` 取值
78
+ - 追加:
79
+ `- {YYYY-MM-DD HH:mm:ss±HH:MM} — **Analysis Review (Round {N})** by {agent} — Verdict: {Approved/Changes Requested/Rejected}, blockers: {n}, major: {n}, minor: {n}[ (+ {n} env-blocked)] → {review-artifact}`
80
+
81
+ 如果 task.md 中存在有效的 `issue_number`,执行前先读取 `.agents/rules/issue-sync.md`,完成 upstream 仓库检测和权限检测,然后同步 task 评论并发布 `{review-artifact}` 评论。
82
+
83
+ ### 7. 完成校验
84
+
85
+ ```bash
86
+ node .agents/scripts/validate-artifact.js gate review-analysis .agents/workspace/active/{task-id} {review-artifact} --format text
87
+ ```
88
+
89
+ 校验通过后继续告知用户;校验失败则修复报告或 task 状态后重跑。
90
+
91
+ ### 8. 告知用户
92
+
93
+ 按 `reference/output-templates.md` 的结论分支输出,并展示所有 TUI 的下一步命令。
94
+
95
+ ## 完成检查清单
96
+
97
+ - [ ] 已审查最新分析上下文
98
+ - [ ] 已创建 `{review-artifact}`
99
+ - [ ] 已更新 task.md 并追加 Activity Log
100
+ - [ ] 已展示所有 TUI 的下一步命令
101
+
102
+ ## 注意事项
103
+
104
+ - 首轮审查使用 `review-analysis.md`,后续轮次使用 `review-analysis-r{N}.md`
105
+ - 所有问题都要引用具体文件路径和行号;分析产物问题可引用 `{analysis-artifact}` 的行号
@@ -0,0 +1,51 @@
1
+ {
2
+ "skill": "review-analysis",
3
+ "checks": {
4
+ "task-meta": {
5
+ "required_fields": [
6
+ "id",
7
+ "type",
8
+ "workflow",
9
+ "status",
10
+ "created_at",
11
+ "updated_at",
12
+ "agent_infra_version",
13
+ "current_step",
14
+ "assigned_to"
15
+ ],
16
+ "expected_step": "requirement-analysis-review"
17
+ },
18
+ "artifact": {
19
+ "file_pattern": "review-analysis.md|review-analysis-r{N}.md",
20
+ "required_sections": [
21
+ "Review Summary",
22
+ "Findings",
23
+ "Environment-Blocked Findings",
24
+ "Conclusion and Recommendations",
25
+ "State Check",
26
+ "Evidence"
27
+ ],
28
+ "required_patterns": [
29
+ "^### Approval Decision$",
30
+ "^\\$ "
31
+ ],
32
+ "freshness_minutes": 30
33
+ },
34
+ "activity-log": {
35
+ "expected_action_pattern": "Analysis Review \\(Round \\d+\\)",
36
+ "freshness_minutes": 30
37
+ },
38
+ "platform-sync": {
39
+ "when": "issue_number_exists",
40
+ "expected_status_label": "status: pending-design-work",
41
+ "expected_comment_marker": "<!-- sync-issue:{task-id}:{artifact-stem} -->",
42
+ "verify_comment_content": true,
43
+ "verify_task_comment_content": true,
44
+ "verify_issue_type": true,
45
+ "verify_issue_fields": false,
46
+ "verify_milestone": true,
47
+ "expected_status_label_key": "pendingDesignWork",
48
+ "expected_comment_marker_key": "artifact"
49
+ }
50
+ }
51
+ }
@@ -0,0 +1,51 @@
1
+ {
2
+ "skill": "review-analysis",
3
+ "checks": {
4
+ "task-meta": {
5
+ "required_fields": [
6
+ "id",
7
+ "type",
8
+ "workflow",
9
+ "status",
10
+ "created_at",
11
+ "updated_at",
12
+ "agent_infra_version",
13
+ "current_step",
14
+ "assigned_to"
15
+ ],
16
+ "expected_step": "requirement-analysis-review"
17
+ },
18
+ "artifact": {
19
+ "file_pattern": "review-analysis.md|review-analysis-r{N}.md",
20
+ "required_sections": [
21
+ "审查摘要",
22
+ "问题清单",
23
+ "环境性遗留",
24
+ "结论与建议",
25
+ "状态核对",
26
+ "证据原文"
27
+ ],
28
+ "required_patterns": [
29
+ "^### 审查决定$",
30
+ "^\\$ "
31
+ ],
32
+ "freshness_minutes": 30
33
+ },
34
+ "activity-log": {
35
+ "expected_action_pattern": "Analysis Review \\(Round \\d+\\)",
36
+ "freshness_minutes": 30
37
+ },
38
+ "platform-sync": {
39
+ "when": "issue_number_exists",
40
+ "expected_status_label": "status: pending-design-work",
41
+ "expected_comment_marker": "<!-- sync-issue:{task-id}:{artifact-stem} -->",
42
+ "verify_comment_content": true,
43
+ "verify_task_comment_content": true,
44
+ "verify_issue_type": true,
45
+ "verify_issue_fields": false,
46
+ "verify_milestone": true,
47
+ "expected_status_label_key": "pendingDesignWork",
48
+ "expected_comment_marker_key": "artifact"
49
+ }
50
+ }
51
+ }
@@ -0,0 +1,87 @@
1
+ # Review Output Templates
2
+
3
+ Read this file before presenting the final review result to the user.
4
+
5
+ ## Select exactly one output scenario
6
+
7
+ Evaluate in this order (**env-blocked count does not participate in selection**):
8
+ 1. If `Blocker = 0`, `Major = 0`, and `Minor = 0`, use Scenario A, regardless of env-blocked count
9
+ 2. If `Blocker = 0` and (`Major > 0` or `Minor > 0`), use Scenario B
10
+ 3. If `Blocker > 0` and the issues can be handled by one focused revision, use Scenario C
11
+ 4. If the requirement analysis needs broad rewriting or fresh clarification, use Scenario D
12
+
13
+ Rules:
14
+ - Do not skip scenario selection
15
+ - Do not mix text from multiple scenarios
16
+ - If `Blocker > 0`, never use an approved template
17
+ - Never count env-blocked items as blocker / major / minor or use them to trigger Scenario B/C/D
18
+ - The selected scenario must include all TUI command formats
19
+
20
+ ### Scenario A: Approved with no findings
21
+
22
+ ```text
23
+ Task {task-id} requirement analysis review completed. Verdict: approved.
24
+ - Blockers: 0 | Major issues: 0 | Minor issues: 0[ | Environment-blocked: {n} (outside AI fix scope)]
25
+ [- Review report: .agents/workspace/active/{task-id}/{review-artifact}]
26
+
27
+ Next step - write the technical plan:
28
+ - Claude Code / OpenCode: /plan-task {task-id}
29
+ - Gemini CLI: /agent-infra:plan-task {task-id}
30
+ - Codex CLI: $plan-task {task-id}
31
+
32
+ [When env-blocked > 0, append:]
33
+ Reminder: env-blocked items belong in the PR description manual verification checklist and should not trigger /analyze-task.
34
+ ```
35
+
36
+ ### Scenario B: Approved with findings
37
+
38
+ ```text
39
+ Task {task-id} requirement analysis review completed. Verdict: approved.
40
+ - Blockers: 0 | Major issues: {n} | Minor issues: {n}[ | Environment-blocked: {n} (outside AI fix scope)]
41
+ - Review report: .agents/workspace/active/{task-id}/{review-artifact}
42
+
43
+ Next step - revise analysis before continuing (recommended):
44
+ - Claude Code / OpenCode: /analyze-task {task-id}
45
+ - Gemini CLI: /agent-infra:analyze-task {task-id}
46
+ - Codex CLI: $analyze-task {task-id}
47
+
48
+ Or proceed directly to planning:
49
+ - Claude Code / OpenCode: /plan-task {task-id}
50
+ - Gemini CLI: /agent-infra:plan-task {task-id}
51
+ - Codex CLI: $plan-task {task-id}
52
+
53
+ [When env-blocked > 0, append:]
54
+ Reminder: env-blocked items belong in the PR description manual verification checklist and should not trigger /analyze-task.
55
+ ```
56
+
57
+ ### Scenario C: Changes requested
58
+
59
+ ```text
60
+ Task {task-id} requirement analysis review completed. Verdict: changes requested.
61
+ - Blockers: {n} | Major issues: {n} | Minor issues: {n}[ | Environment-blocked: {n} (outside AI fix scope)]
62
+ - Review report: .agents/workspace/active/{task-id}/{review-artifact}
63
+
64
+ Next step - revise requirement analysis:
65
+ - Claude Code / OpenCode: /analyze-task {task-id}
66
+ - Gemini CLI: /agent-infra:analyze-task {task-id}
67
+ - Codex CLI: $analyze-task {task-id}
68
+
69
+ [When env-blocked > 0, append:]
70
+ Reminder: env-blocked items belong in the PR description manual verification checklist and should not trigger /analyze-task.
71
+ ```
72
+
73
+ ### Scenario D: Rejected
74
+
75
+ ```text
76
+ Task {task-id} requirement analysis review completed. Verdict: rejected, fresh analysis or requirement clarification required.
77
+ - Blockers: {n} | Major issues: {n} | Minor issues: {n}[ | Environment-blocked: {n} (outside AI fix scope)]
78
+ - Review report: .agents/workspace/active/{task-id}/{review-artifact}
79
+
80
+ Next step - re-analyze:
81
+ - Claude Code / OpenCode: /analyze-task {task-id}
82
+ - Gemini CLI: /agent-infra:analyze-task {task-id}
83
+ - Codex CLI: $analyze-task {task-id}
84
+
85
+ [When env-blocked > 0, append:]
86
+ Reminder: env-blocked items belong in the PR description manual verification checklist and should not trigger /analyze-task.
87
+ ```
@@ -0,0 +1,87 @@
1
+ # 审查输出模板
2
+
3
+ 在向用户汇报最终审查结论之前先读取本文件。
4
+
5
+ ## 选择唯一输出场景
6
+
7
+ 按以下顺序判断(**注意:env-blocked 数量不参与判断**):
8
+ 1. 如果 `Blocker = 0` 且 `Major = 0` 且 `Minor = 0`,使用场景 A(不管 env-blocked 是否 > 0)
9
+ 2. 如果 `Blocker = 0` 且(`Major > 0` 或 `Minor > 0`),使用场景 B
10
+ 3. 如果 `Blocker > 0`,且问题可以通过一次聚焦修复解决,使用场景 C
11
+ 4. 如果需求分析需要大范围重写或重新澄清,使用场景 D
12
+
13
+ 禁止规则:
14
+ - 不要跳过场景判断步骤
15
+ - 不要混用不同场景的文案
16
+ - 只要 `Blocker > 0`,就绝对不能输出通过模板
17
+ - env-blocked 项绝对不能被计入 blocker / major / minor 计数,也不能用作触发场景 B/C/D 的依据
18
+ - 所选场景中必须包含所有 TUI 命令格式
19
+
20
+ ### 场景 A:通过且无问题
21
+
22
+ ```text
23
+ 任务 {task-id} 需求分析审查完成。结论:通过。
24
+ - 阻塞项:0 | 主要问题:0 | 次要问题:0[ | 环境性遗留:{n}(不在 AI 修复范围)]
25
+ [- 审查报告:.agents/workspace/active/{task-id}/{review-artifact}]
26
+
27
+ 下一步 - 编写技术方案:
28
+ - Claude Code / OpenCode:/plan-task {task-id}
29
+ - Gemini CLI:/agent-infra:plan-task {task-id}
30
+ - Codex CLI:$plan-task {task-id}
31
+
32
+ [当 env-blocked > 0 时,在最后附加一行:]
33
+ 提醒:env-blocked 项需在 PR description 的「待人工验证」清单中承接,不应触发 /analyze-task。
34
+ ```
35
+
36
+ ### 场景 B:通过但有问题
37
+
38
+ ```text
39
+ 任务 {task-id} 需求分析审查完成。结论:通过。
40
+ - 阻塞项:0 | 主要问题:{n} | 次要问题:{n}[ | 环境性遗留:{n}(不在 AI 修复范围)]
41
+ - 审查报告:.agents/workspace/active/{task-id}/{review-artifact}
42
+
43
+ 下一步 - 修订分析后继续(推荐):
44
+ - Claude Code / OpenCode:/analyze-task {task-id}
45
+ - Gemini CLI:/agent-infra:analyze-task {task-id}
46
+ - Codex CLI:$analyze-task {task-id}
47
+
48
+ 或直接进入方案设计:
49
+ - Claude Code / OpenCode:/plan-task {task-id}
50
+ - Gemini CLI:/agent-infra:plan-task {task-id}
51
+ - Codex CLI:$plan-task {task-id}
52
+
53
+ [当 env-blocked > 0 时,在最后附加一行:]
54
+ 提醒:env-blocked 项需在 PR description 的「待人工验证」清单中承接,不应触发 /analyze-task。
55
+ ```
56
+
57
+ ### 场景 C:需要修改
58
+
59
+ ```text
60
+ 任务 {task-id} 需求分析审查完成。结论:需要修改。
61
+ - 阻塞项:{n} | 主要问题:{n} | 次要问题:{n}[ | 环境性遗留:{n}(不在 AI 修复范围)]
62
+ - 审查报告:.agents/workspace/active/{task-id}/{review-artifact}
63
+
64
+ 下一步 - 修订需求分析:
65
+ - Claude Code / OpenCode:/analyze-task {task-id}
66
+ - Gemini CLI:/agent-infra:analyze-task {task-id}
67
+ - Codex CLI:$analyze-task {task-id}
68
+
69
+ [当 env-blocked > 0 时,在最后附加一行:]
70
+ 提醒:env-blocked 项需在 PR description 的「待人工验证」清单中承接,不应触发 /analyze-task。
71
+ ```
72
+
73
+ ### 场景 D:拒绝
74
+
75
+ ```text
76
+ 任务 {task-id} 需求分析审查完成。结论:拒绝,需要重新分析或补充需求澄清。
77
+ - 阻塞项:{n} | 主要问题:{n} | 次要问题:{n}[ | 环境性遗留:{n}(不在 AI 修复范围)]
78
+ - 审查报告:.agents/workspace/active/{task-id}/{review-artifact}
79
+
80
+ 下一步 - 重新分析:
81
+ - Claude Code / OpenCode:/analyze-task {task-id}
82
+ - Gemini CLI:/agent-infra:analyze-task {task-id}
83
+ - Codex CLI:$analyze-task {task-id}
84
+
85
+ [当 env-blocked > 0 时,在最后附加一行:]
86
+ 提醒:env-blocked 项需在 PR description 的「待人工验证」清单中承接,不应触发 /analyze-task。
87
+ ```
@@ -0,0 +1,90 @@
1
+ # Review Report Template
2
+
3
+ Use this template when writing `review-analysis.md` or `review-analysis-r{N}.md`.
4
+
5
+ ## Output Template
6
+
7
+ ```markdown
8
+ # Requirement Analysis Review Report
9
+
10
+ - **Review Round**: Round {review-round}
11
+ - **Artifact File**: `{review-artifact}`
12
+ - **Review Input**:
13
+ - `{analysis-artifact}`
14
+
15
+ ## State Check
16
+
17
+ > Paste the raw state-check command output; each command starts with `$ `.
18
+
19
+ ## Review Summary
20
+
21
+ - **Reviewer**: {reviewer-name}
22
+ - **Review Time**: {timestamp}
23
+ - **Scope**: {file-count and major modules}
24
+ - **Overall Verdict**: {Approved / Changes Requested / Rejected}
25
+ - **Findings (AI-actionable)**: 0 blockers, 0 majors, 0 minors / **env-blocked**: 0
26
+
27
+ ## Findings
28
+
29
+ ### Blockers (must fix)
30
+
31
+ #### 1. {Issue title}
32
+ **File**: `{file-path}:{line-number}`
33
+ **Description**: {details}
34
+ **Suggested Fix**: {fix suggestion}
35
+
36
+ ### Major Issues (should fix)
37
+
38
+ #### 1. {Issue title}
39
+ **File**: `{file-path}:{line-number}`
40
+ **Description**: {details}
41
+ **Suggested Fix**: {fix suggestion}
42
+
43
+ ### Minor Issues (optional improvements)
44
+
45
+ #### 1. {Improvement point}
46
+ **File**: `{file-path}:{line-number}`
47
+ **Suggestion**: {improvement suggestion}
48
+
49
+ ## Environment-Blocked Findings
50
+
51
+ > Items the AI agent cannot close in the current execution environment; they do not participate in the next analysis round. Maintainers carry them in the PR description as a "manual verification required" checklist.
52
+
53
+ #### 1. {environment-blocked finding title}
54
+ **File**: `{file-path}:{line-number}` (if applicable)
55
+ **Description**: {details}
56
+ **Required Environment**: {e.g. Docker sandbox / macOS host / privileged root / third-party account}
57
+ **Manual Verification Steps**: {steps for the human verifier}
58
+
59
+ > If this round has no env-blocked findings, keep the section heading and write "None".
60
+
61
+
62
+ ## Evidence
63
+
64
+ > Pair each "I verified X" claim with the corresponding raw tool output; the gate only checks that this section exists and at least one `$ ` line is present.
65
+
66
+ - Claim: {verified claim}
67
+ ```text
68
+ $ {command}
69
+ {raw output}
70
+ ```
71
+
72
+ ## Highlights
73
+
74
+ - {what went well}
75
+
76
+ ## Alignment with Plan
77
+
78
+ - [ ] Implementation matches the technical plan
79
+ - [ ] No unintended scope expansion
80
+
81
+ ## Conclusion and Recommendation
82
+
83
+ ### Approval Decision
84
+ - [ ] Approved
85
+ - [ ] Changes Requested
86
+ - [ ] Rejected
87
+
88
+ ### Next Steps
89
+ {recommended next step}
90
+ ```