@fitlab-ai/agent-infra 0.6.5 → 0.7.0

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 (181) hide show
  1. package/README.md +51 -25
  2. package/README.zh-CN.md +49 -23
  3. package/dist/lib/defaults.json +1 -0
  4. package/dist/lib/init.js +3 -0
  5. package/dist/lib/sandbox/commands/create.js +4 -2
  6. package/dist/lib/sandbox/commands/enter.js +15 -4
  7. package/dist/lib/sandbox/commands/list-running.js +108 -0
  8. package/dist/lib/sandbox/commands/ls.js +24 -45
  9. package/dist/lib/sandbox/commands/rebuild.js +4 -2
  10. package/dist/lib/sandbox/config.js +3 -0
  11. package/dist/lib/sandbox/index.js +2 -1
  12. package/dist/lib/sandbox/runtimes/ai-tools.dockerfile +10 -6
  13. package/dist/lib/sandbox/tools.js +213 -8
  14. package/dist/lib/update.js +12 -1
  15. package/lib/defaults.json +1 -0
  16. package/lib/init.ts +10 -0
  17. package/lib/sandbox/commands/create.ts +10 -2
  18. package/lib/sandbox/commands/enter.ts +14 -4
  19. package/lib/sandbox/commands/list-running.ts +135 -0
  20. package/lib/sandbox/commands/ls.ts +28 -49
  21. package/lib/sandbox/commands/rebuild.ts +9 -2
  22. package/lib/sandbox/config.ts +7 -0
  23. package/lib/sandbox/index.ts +2 -1
  24. package/lib/sandbox/runtimes/ai-tools.dockerfile +10 -6
  25. package/lib/sandbox/tools.ts +248 -9
  26. package/lib/update.ts +15 -1
  27. package/package.json +1 -1
  28. package/templates/.agents/QUICKSTART.en.md +1 -1
  29. package/templates/.agents/QUICKSTART.zh-CN.md +1 -1
  30. package/templates/.agents/README.en.md +79 -2
  31. package/templates/.agents/README.zh-CN.md +79 -2
  32. package/templates/.agents/rules/create-issue.en.md +1 -1
  33. package/templates/.agents/rules/create-issue.github.en.md +1 -1
  34. package/templates/.agents/rules/create-issue.github.zh-CN.md +1 -1
  35. package/templates/.agents/rules/create-issue.zh-CN.md +1 -1
  36. package/templates/.agents/rules/issue-sync.github.en.md +6 -5
  37. package/templates/.agents/rules/issue-sync.github.zh-CN.md +6 -5
  38. package/templates/.agents/rules/milestone-inference.github.en.md +2 -2
  39. package/templates/.agents/rules/milestone-inference.github.zh-CN.md +2 -2
  40. package/templates/.agents/rules/no-mid-flow-questions.en.md +57 -0
  41. package/templates/.agents/rules/no-mid-flow-questions.zh-CN.md +57 -0
  42. package/templates/.agents/rules/pr-sync.github.en.md +4 -5
  43. package/templates/.agents/rules/pr-sync.github.zh-CN.md +4 -5
  44. package/templates/.agents/rules/task-management.en.md +9 -6
  45. package/templates/.agents/rules/task-management.zh-CN.md +9 -6
  46. package/templates/.agents/rules/testing-discipline.en.md +2 -2
  47. package/templates/.agents/rules/testing-discipline.zh-CN.md +2 -2
  48. package/templates/.agents/scripts/validate-artifact.js +1 -1
  49. package/templates/.agents/skills/analyze-task/SKILL.en.md +16 -4
  50. package/templates/.agents/skills/analyze-task/SKILL.zh-CN.md +16 -4
  51. package/templates/.agents/skills/check-task/SKILL.en.md +43 -32
  52. package/templates/.agents/skills/check-task/SKILL.zh-CN.md +42 -31
  53. package/templates/.agents/skills/code-task/SKILL.en.md +117 -0
  54. package/templates/.agents/skills/{implement-task → code-task}/SKILL.zh-CN.md +51 -24
  55. package/templates/.agents/skills/{implement-task → code-task}/config/verify.en.json +4 -4
  56. package/templates/.agents/skills/{implement-task → code-task}/config/verify.zh-CN.json +4 -4
  57. package/templates/.agents/skills/{implement-task → code-task}/reference/branch-management.zh-CN.md +2 -2
  58. package/templates/.agents/skills/{implement-task/reference/implementation-rules.en.md → code-task/reference/code-rules.en.md} +6 -6
  59. package/templates/.agents/skills/{implement-task/reference/implementation-rules.zh-CN.md → code-task/reference/code-rules.zh-CN.md} +3 -3
  60. package/templates/.agents/skills/code-task/reference/dual-mode.en.md +69 -0
  61. package/templates/.agents/skills/code-task/reference/dual-mode.zh-CN.md +69 -0
  62. package/templates/.agents/skills/{refine-task/reference/fix-workflow.en.md → code-task/reference/fix-mode.en.md} +12 -12
  63. package/templates/.agents/skills/{refine-task/reference/fix-workflow.zh-CN.md → code-task/reference/fix-mode.zh-CN.md} +8 -8
  64. package/templates/.agents/skills/code-task/reference/output-template.en.md +20 -0
  65. package/templates/.agents/skills/code-task/reference/output-template.zh-CN.md +20 -0
  66. package/templates/.agents/skills/{implement-task → code-task}/reference/report-template.en.md +4 -4
  67. package/templates/.agents/skills/{implement-task → code-task}/reference/report-template.zh-CN.md +3 -3
  68. package/templates/.agents/skills/code-task/scripts/detect-mode.js +370 -0
  69. package/templates/.agents/skills/commit/SKILL.en.md +2 -2
  70. package/templates/.agents/skills/commit/SKILL.zh-CN.md +2 -2
  71. package/templates/.agents/skills/commit/reference/task-status-update.en.md +10 -6
  72. package/templates/.agents/skills/commit/reference/task-status-update.zh-CN.md +10 -6
  73. package/templates/.agents/skills/complete-task/SKILL.en.md +5 -3
  74. package/templates/.agents/skills/complete-task/SKILL.zh-CN.md +5 -3
  75. package/templates/.agents/skills/create-pr/SKILL.en.md +17 -1
  76. package/templates/.agents/skills/create-pr/SKILL.zh-CN.md +17 -1
  77. package/templates/.agents/skills/import-codescan/SKILL.en.md +1 -1
  78. package/templates/.agents/skills/import-codescan/SKILL.zh-CN.md +1 -1
  79. package/templates/.agents/skills/import-dependabot/SKILL.en.md +2 -2
  80. package/templates/.agents/skills/import-dependabot/SKILL.zh-CN.md +2 -2
  81. package/templates/.agents/skills/import-issue/SKILL.en.md +3 -3
  82. package/templates/.agents/skills/import-issue/SKILL.zh-CN.md +3 -3
  83. package/templates/.agents/skills/plan-task/SKILL.en.md +4 -4
  84. package/templates/.agents/skills/plan-task/SKILL.zh-CN.md +4 -4
  85. package/templates/.agents/skills/restore-task/SKILL.en.md +4 -3
  86. package/templates/.agents/skills/restore-task/SKILL.zh-CN.md +4 -3
  87. package/templates/.agents/skills/review-analysis/SKILL.en.md +76 -0
  88. package/templates/.agents/skills/review-analysis/SKILL.zh-CN.md +102 -0
  89. package/templates/.agents/skills/review-analysis/config/verify.en.json +51 -0
  90. package/templates/.agents/skills/review-analysis/config/verify.zh-CN.json +51 -0
  91. package/templates/.agents/skills/review-analysis/reference/output-templates.en.md +87 -0
  92. package/templates/.agents/skills/review-analysis/reference/output-templates.zh-CN.md +87 -0
  93. package/templates/.agents/skills/review-analysis/reference/report-template.en.md +90 -0
  94. package/templates/.agents/skills/review-analysis/reference/report-template.zh-CN.md +91 -0
  95. package/templates/.agents/skills/review-analysis/reference/review-criteria.en.md +47 -0
  96. package/templates/.agents/skills/review-analysis/reference/review-criteria.zh-CN.md +47 -0
  97. package/templates/.agents/skills/{review-task → review-code}/SKILL.en.md +11 -9
  98. package/templates/.agents/skills/{review-task → review-code}/SKILL.zh-CN.md +15 -9
  99. package/templates/.agents/skills/{review-task → review-code}/config/verify.en.json +7 -5
  100. package/templates/.agents/skills/{review-task → review-code}/config/verify.zh-CN.json +6 -4
  101. package/templates/.agents/skills/{review-task → review-code}/reference/output-templates.en.md +21 -17
  102. package/templates/.agents/skills/{review-task → review-code}/reference/output-templates.zh-CN.md +19 -15
  103. package/templates/.agents/skills/{review-task → review-code}/reference/report-template.en.md +5 -6
  104. package/templates/.agents/skills/review-code/reference/report-template.zh-CN.md +91 -0
  105. package/templates/.agents/skills/review-code/reference/review-criteria.en.md +48 -0
  106. package/templates/.agents/skills/{review-task → review-code}/reference/review-criteria.zh-CN.md +10 -4
  107. package/templates/.agents/skills/review-plan/SKILL.en.md +76 -0
  108. package/templates/.agents/skills/review-plan/SKILL.zh-CN.md +102 -0
  109. package/templates/.agents/skills/{refine-task → review-plan}/config/verify.en.json +14 -10
  110. package/templates/.agents/skills/{refine-task → review-plan}/config/verify.zh-CN.json +14 -10
  111. package/templates/.agents/skills/review-plan/reference/output-templates.en.md +87 -0
  112. package/templates/.agents/skills/review-plan/reference/output-templates.zh-CN.md +87 -0
  113. package/templates/.agents/skills/review-plan/reference/report-template.en.md +90 -0
  114. package/templates/.agents/skills/{review-task → review-plan}/reference/report-template.zh-CN.md +3 -3
  115. package/templates/.agents/skills/review-plan/reference/review-criteria.en.md +47 -0
  116. package/templates/.agents/skills/review-plan/reference/review-criteria.zh-CN.md +47 -0
  117. package/templates/.agents/skills/test/SKILL.en.md +2 -2
  118. package/templates/.agents/skills/test/SKILL.zh-CN.md +13 -31
  119. package/templates/.agents/skills/update-agent-infra/scripts/sync-templates.js +1 -0
  120. package/templates/.agents/templates/task.en.md +3 -3
  121. package/templates/.agents/templates/task.zh-CN.md +2 -2
  122. package/templates/.agents/workflows/bug-fix.en.yaml +126 -80
  123. package/templates/.agents/workflows/bug-fix.zh-CN.yaml +90 -44
  124. package/templates/.agents/workflows/feature-development.en.yaml +115 -70
  125. package/templates/.agents/workflows/feature-development.zh-CN.yaml +92 -47
  126. package/templates/.agents/workflows/refactoring.en.yaml +123 -78
  127. package/templates/.agents/workflows/refactoring.zh-CN.yaml +89 -44
  128. package/templates/.claude/commands/code-task.en.md +8 -0
  129. package/templates/.claude/commands/code-task.zh-CN.md +8 -0
  130. package/templates/.claude/commands/review-analysis.en.md +8 -0
  131. package/templates/.claude/commands/review-analysis.zh-CN.md +8 -0
  132. package/templates/.claude/commands/review-code.en.md +8 -0
  133. package/templates/.claude/commands/review-code.zh-CN.md +8 -0
  134. package/templates/.claude/commands/review-plan.en.md +8 -0
  135. package/templates/.claude/commands/review-plan.zh-CN.md +8 -0
  136. package/templates/.gemini/commands/_project_/archive-tasks.zh-CN.toml +1 -1
  137. package/templates/.gemini/commands/_project_/code-task.en.toml +8 -0
  138. package/templates/.gemini/commands/_project_/code-task.zh-CN.toml +8 -0
  139. package/templates/.gemini/commands/_project_/init-labels.zh-CN.toml +1 -1
  140. package/templates/.gemini/commands/_project_/init-milestones.zh-CN.toml +1 -1
  141. package/templates/.gemini/commands/_project_/review-analysis.en.toml +8 -0
  142. package/templates/.gemini/commands/_project_/review-analysis.zh-CN.toml +8 -0
  143. package/templates/.gemini/commands/_project_/review-code.en.toml +8 -0
  144. package/templates/.gemini/commands/_project_/review-code.zh-CN.toml +8 -0
  145. package/templates/.gemini/commands/_project_/review-plan.en.toml +8 -0
  146. package/templates/.gemini/commands/_project_/review-plan.zh-CN.toml +8 -0
  147. package/templates/.opencode/commands/code-task.en.md +11 -0
  148. package/templates/.opencode/commands/code-task.zh-CN.md +11 -0
  149. package/templates/.opencode/commands/review-analysis.en.md +11 -0
  150. package/templates/.opencode/commands/review-analysis.zh-CN.md +11 -0
  151. package/templates/.opencode/commands/review-code.en.md +11 -0
  152. package/templates/.opencode/commands/review-code.zh-CN.md +11 -0
  153. package/templates/.opencode/commands/review-plan.en.md +11 -0
  154. package/templates/.opencode/commands/review-plan.zh-CN.md +11 -0
  155. package/templates/.agents/skills/implement-task/SKILL.en.md +0 -173
  156. package/templates/.agents/skills/implement-task/reference/output-template.en.md +0 -20
  157. package/templates/.agents/skills/implement-task/reference/output-template.zh-CN.md +0 -20
  158. package/templates/.agents/skills/refine-task/SKILL.en.md +0 -153
  159. package/templates/.agents/skills/refine-task/SKILL.zh-CN.md +0 -153
  160. package/templates/.agents/skills/refine-task/reference/report-template.en.md +0 -64
  161. package/templates/.agents/skills/refine-task/reference/report-template.zh-CN.md +0 -64
  162. package/templates/.agents/skills/review-task/reference/review-criteria.en.md +0 -42
  163. package/templates/.claude/commands/implement-task.en.md +0 -8
  164. package/templates/.claude/commands/implement-task.zh-CN.md +0 -8
  165. package/templates/.claude/commands/refine-task.en.md +0 -8
  166. package/templates/.claude/commands/refine-task.zh-CN.md +0 -8
  167. package/templates/.claude/commands/review-task.en.md +0 -8
  168. package/templates/.claude/commands/review-task.zh-CN.md +0 -8
  169. package/templates/.gemini/commands/_project_/implement-task.en.toml +0 -8
  170. package/templates/.gemini/commands/_project_/implement-task.zh-CN.toml +0 -8
  171. package/templates/.gemini/commands/_project_/refine-task.en.toml +0 -8
  172. package/templates/.gemini/commands/_project_/refine-task.zh-CN.toml +0 -8
  173. package/templates/.gemini/commands/_project_/review-task.en.toml +0 -8
  174. package/templates/.gemini/commands/_project_/review-task.zh-CN.toml +0 -8
  175. package/templates/.opencode/commands/implement-task.en.md +0 -11
  176. package/templates/.opencode/commands/implement-task.zh-CN.md +0 -11
  177. package/templates/.opencode/commands/refine-task.en.md +0 -11
  178. package/templates/.opencode/commands/refine-task.zh-CN.md +0 -11
  179. package/templates/.opencode/commands/review-task.en.md +0 -11
  180. package/templates/.opencode/commands/review-task.zh-CN.md +0 -11
  181. /package/templates/.agents/skills/{implement-task → code-task}/reference/branch-management.en.md +0 -0
@@ -25,7 +25,7 @@ Use the Issue title as-is for the task title (preserve the Issue's original lang
25
25
  ### 2. Check for an Existing Task
26
26
 
27
27
  2.1 Search `.agents/workspace/active/` for an existing task linked to this Issue.
28
- - If found, ask the user whether to re-import or continue with the existing task
28
+ - If found, **reuse the existing task by default** (Scenario A); do not ask the user. State clearly in the final notice: "Reused existing task `{task-id}`; not re-imported." If the user wants to re-import, they must first archive or delete the existing task and run this skill again
29
29
  - If not found, continue to 2.2
30
30
 
31
31
  2.2 Use the "historical task comment scan" command in `.agents/rules/issue-pr-commands.md` to scan Issue comments for sync markers and look for a recoverable historical task ID.
@@ -44,7 +44,7 @@ Exit code handling for the whole pipeline:
44
44
 
45
45
  | Scenario | Trigger | task ID source | created_at source | User confirmation |
46
46
  |---|---|---|---|---|
47
- | Scenario A | 2.1 finds a local task | Reuse local ID | Preserve local value | Must ask whether to re-import or continue using the existing task |
47
+ | Scenario A | 2.1 finds a local task | Reuse local ID | Preserve local value | Reuse by default; do not ask; inform the user reuse happened |
48
48
  | Scenario B | 2.1 no match + 2.2 no candidate | Create with `date +%Y%m%d-%H%M%S` | Current time | Not required |
49
49
  | Scenario C | 2.1 no match + 2.2 any candidate | Automatically reuse the earliest candidate ID | Prefer remote frontmatter `created_at`; use current time if missing | Inform only |
50
50
 
@@ -175,7 +175,7 @@ Version stamp rule: when creating or updating `task.md` frontmatter, read `.agen
175
175
  ## Notes
176
176
 
177
177
  1. **Issue validation**: verify that the Issue exists before continuing
178
- 2. **Duplicate task**: if this Issue already has a linked task, ask the user before creating a new one
178
+ 2. **Duplicate task**: if this Issue already has a linked task, **reuse it by default** instead of creating a new one (do not ask the user)
179
179
  3. **Next step**: after import, run `analyze-task` before `plan-task`
180
180
 
181
181
  ## Error Handling
@@ -25,7 +25,7 @@ description: "从 Issue 导入并创建任务"
25
25
  ### 2. 检查已有任务
26
26
 
27
27
  2.1 搜索 `.agents/workspace/active/` 中是否已有链接到此 Issue 的任务。
28
- - 如果找到,询问用户是重新导入还是继续使用现有任务
28
+ - 如果找到,**默认复用现有任务**(场景 A),不询问用户;在最终告知中明确「已复用现有任务 `{task-id}`,未重新导入」。若用户希望重新导入,需要先手动归档/删除已有任务再次执行本技能
29
29
  - 如果未找到,继续执行 2.2
30
30
 
31
31
  2.2 按 `.agents/rules/issue-pr-commands.md` 的“历史任务评论扫描”命令扫描 Issue 评论中的同步标记,查找可恢复的历史任务 ID。
@@ -44,7 +44,7 @@ description: "从 Issue 导入并创建任务"
44
44
 
45
45
  | 场景 | 触发条件 | task ID 来源 | created_at 来源 | 用户确认 |
46
46
  |---|---|---|---|---|
47
- | 场景 A | 2.1 命中本地任务 | 复用本地 ID | 本地保留 | 必须询问"重新导入还是继续使用现有任务" |
47
+ | 场景 A | 2.1 命中本地任务 | 复用本地 ID | 本地保留 | 默认复用,不询问;告知用户已复用 |
48
48
  | 场景 B | 2.1 无命中 + 2.2 无候选 | `date +%Y%m%d-%H%M%S` 新建 | 当前时间 | 不需要 |
49
49
  | 场景 C | 2.1 无命中 + 2.2 有候选 | 自动复用最早候选 ID | 优先用远端 frontmatter 的 `created_at`,缺失时用当前时间 | 告知即可 |
50
50
 
@@ -175,7 +175,7 @@ Issue #{number} 已导入。
175
175
  ## 注意事项
176
176
 
177
177
  1. **Issue 验证**:在继续之前检查 Issue 是否存在
178
- 2. **重复任务**:如果此 Issue 已有关联任务,在创建新任务前询问用户
178
+ 2. **重复任务**:如果此 Issue 已有关联任务,**默认复用**而非创建新任务(不询问用户)
179
179
  3. **下一步**:导入完成后,先执行 `analyze-task`,再进入 `plan-task`
180
180
 
181
181
  ## 错误处理
@@ -167,10 +167,10 @@ Output file:
167
167
  Important: human review checkpoint.
168
168
  Please review the technical plan before continuing to implementation.
169
169
 
170
- Next step - implement the task:
171
- - Claude Code / OpenCode: /implement-task {task-id}
172
- - Gemini CLI: /{{project}}:implement-task {task-id}
173
- - Codex CLI: $implement-task {task-id}
170
+ Next step - review the technical plan:
171
+ - Claude Code / OpenCode: /review-plan {task-id}
172
+ - Gemini CLI: /{{project}}:review-plan {task-id}
173
+ - Codex CLI: $review-plan {task-id}
174
174
  ```
175
175
 
176
176
  ## Completion Checklist
@@ -167,10 +167,10 @@ node .agents/scripts/validate-artifact.js gate plan-task .agents/workspace/activ
167
167
  重要:人工审查检查点。
168
168
  请在继续实现之前审查技术方案。
169
169
 
170
- 下一步 - 实施任务:
171
- - Claude Code / OpenCode:/implement-task {task-id}
172
- - Gemini CLI:/agent-infra:implement-task {task-id}
173
- - Codex CLI:$implement-task {task-id}
170
+ 下一步 - 审查技术方案:
171
+ - Claude Code / OpenCode:/review-plan {task-id}
172
+ - Gemini CLI:/{{project}}:review-plan {task-id}
173
+ - Codex CLI:$review-plan {task-id}
174
174
  ```
175
175
 
176
176
  ## 完成检查清单
@@ -43,10 +43,11 @@ Rules:
43
43
  - map `{file-stem}` back to filenames:
44
44
  - `task` -> `task.md`
45
45
  - `analysis` / `analysis-r{N}` -> matching `.md`
46
+ - `review-analysis` / `review-analysis-r{N}` -> matching `.md`
46
47
  - `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`
48
+ - `review-plan` / `review-plan-r{N}` -> matching `.md`
49
+ - `code` / `code-r{N}` -> matching `.md`
50
+ - `review-code` / `review-code-r{N}` -> matching `.md`
50
51
 
51
52
  ### 4. Process Chunks and Check the Local Directory
52
53
 
@@ -43,10 +43,11 @@ description: "从平台 Issue 评论还原本地任务文件"
43
43
  - 将 `{file-stem}` 映射回文件名:
44
44
  - `task` -> `task.md`
45
45
  - `analysis` / `analysis-r{N}` -> 对应 `.md`
46
+ - `review-analysis` / `review-analysis-r{N}` -> 对应 `.md`
46
47
  - `plan` / `plan-r{N}` -> 对应 `.md`
47
- - `implementation` / `implementation-r{N}` -> 对应 `.md`
48
- - `review` / `review-r{N}` -> 对应 `.md`
49
- - `refinement` / `refinement-r{N}` -> 对应 `.md`
48
+ - `review-plan` / `review-plan-r{N}` -> 对应 `.md`
49
+ - `code` / `code-r{N}` -> 对应 `.md`
50
+ - `review-code` / `review-code-r{N}` -> 对应 `.md`
50
51
 
51
52
  ### 4. 处理分片并检查本地目录
52
53
 
@@ -0,0 +1,76 @@
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
+ ## Steps
30
+
31
+ ### 1. Verify Prerequisites
32
+
33
+ Require `task.md` and at least one analysis artifact: `analysis.md` or `analysis-r{N}.md`.
34
+
35
+ ### 2. Determine Review Round
36
+
37
+ Record `{analysis-artifact}`, `{review-round}`, and `{review-artifact}` (`review-analysis.md` or `review-analysis-r{N}.md`).
38
+
39
+ ### 3. Read Analysis Context
40
+
41
+ Read `{analysis-artifact}`, `task.md`, and Issue context when available.
42
+
43
+ ### 4. Perform Review
44
+
45
+ Check requirement completeness, risks, affected scope, open questions, and effort estimates.
46
+
47
+ > Read `reference/review-criteria.md` before this step.
48
+
49
+ ### 5. Write Review Report
50
+
51
+ Create `.agents/workspace/active/{task-id}/{review-artifact}`.
52
+
53
+ > Read `reference/report-template.md` before writing the report.
54
+
55
+ ### 6. Update Task Status
56
+
57
+ Get the current time:
58
+
59
+ ```bash
60
+ date "+%Y-%m-%d %H:%M:%S%:z"
61
+ ```
62
+
63
+ Set `current_step` to `requirement-analysis-review`, refresh task metadata, and append:
64
+ `- {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}`
65
+
66
+ If task.md has a valid `issue_number`, read `.agents/rules/issue-sync.md`, sync the task comment, and publish the `{review-artifact}` comment.
67
+
68
+ ### 7. Run Completion Gate
69
+
70
+ ```bash
71
+ node .agents/scripts/validate-artifact.js gate review-analysis .agents/workspace/active/{task-id} {review-artifact} --format text
72
+ ```
73
+
74
+ ### 8. Tell the User
75
+
76
+ Use the conclusion branch in `reference/output-templates.md` and show all TUI command formats.
@@ -0,0 +1,102 @@
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
+ ### 1. 验证前置条件
34
+
35
+ 要求存在:
36
+ - `.agents/workspace/active/{task-id}/task.md`
37
+ - 至少一个分析产物:`analysis.md` 或 `analysis-r{N}.md`
38
+
39
+ ### 2. 确定审查轮次
40
+
41
+ 扫描任务目录并记录:
42
+ - `{analysis-artifact}`:最高轮次的分析产物
43
+ - `{review-round}`
44
+ - `{review-artifact}`:`review-analysis.md` 或 `review-analysis-r{N}.md`
45
+
46
+ ### 3. 阅读分析上下文
47
+
48
+ 读取最新 `{analysis-artifact}`、`task.md` 和关联 Issue 上下文(如有)。
49
+
50
+ ### 4. 执行审查
51
+
52
+ 重点检查需求完整性、风险识别、影响范围、开放问题和工作量评估。
53
+
54
+ > 详细审查标准见 `reference/review-criteria.md`。执行此步骤前先读取 `reference/review-criteria.md`。
55
+
56
+ ### 5. 编写审查报告
57
+
58
+ 创建 `.agents/workspace/active/{task-id}/{review-artifact}`。
59
+
60
+ > 报告格式见 `reference/report-template.md`。写报告前先读取 `reference/report-template.md`。
61
+
62
+ ### 6. 更新任务状态
63
+
64
+ 获取当前时间:
65
+
66
+ ```bash
67
+ date "+%Y-%m-%d %H:%M:%S%:z"
68
+ ```
69
+
70
+ 更新 task.md:
71
+ - `current_step`:requirement-analysis-review
72
+ - `assigned_to`:{当前代理}
73
+ - `updated_at`:{当前时间}
74
+ - `agent_infra_version`:按 `.agents/rules/version-stamp.md` 取值
75
+ - 追加:
76
+ `- {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}`
77
+
78
+ 如果 task.md 中存在有效的 `issue_number`,执行前先读取 `.agents/rules/issue-sync.md`,完成 upstream 仓库检测和权限检测,然后同步 task 评论并发布 `{review-artifact}` 评论。
79
+
80
+ ### 7. 完成校验
81
+
82
+ ```bash
83
+ node .agents/scripts/validate-artifact.js gate review-analysis .agents/workspace/active/{task-id} {review-artifact} --format text
84
+ ```
85
+
86
+ 校验通过后继续告知用户;校验失败则修复报告或 task 状态后重跑。
87
+
88
+ ### 8. 告知用户
89
+
90
+ 按 `reference/output-templates.md` 的结论分支输出,并展示所有 TUI 的下一步命令。
91
+
92
+ ## 完成检查清单
93
+
94
+ - [ ] 已审查最新分析上下文
95
+ - [ ] 已创建 `{review-artifact}`
96
+ - [ ] 已更新 task.md 并追加 Activity Log
97
+ - [ ] 已展示所有 TUI 的下一步命令
98
+
99
+ ## 注意事项
100
+
101
+ - 首轮审查使用 `review-analysis.md`,后续轮次使用 `review-analysis-r{N}.md`
102
+ - 所有问题都要引用具体文件路径和行号;分析产物问题可引用 `{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
+ ```