@fitlab-ai/agent-infra 0.6.4 → 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 (193) hide show
  1. package/README.md +63 -27
  2. package/README.zh-CN.md +61 -25
  3. package/bin/cli.ts +18 -6
  4. package/dist/bin/cli.js +20 -6
  5. package/dist/lib/cp.js +127 -0
  6. package/dist/lib/defaults.json +1 -0
  7. package/dist/lib/init.js +3 -0
  8. package/dist/lib/sandbox/clipboard/bridge.js +23 -4
  9. package/dist/lib/sandbox/clipboard/index.js +12 -3
  10. package/dist/lib/sandbox/commands/create.js +11 -2
  11. package/dist/lib/sandbox/commands/enter.js +29 -6
  12. package/dist/lib/sandbox/commands/list-running.js +108 -0
  13. package/dist/lib/sandbox/commands/ls.js +24 -45
  14. package/dist/lib/sandbox/commands/rebuild.js +15 -7
  15. package/dist/lib/sandbox/config.js +3 -0
  16. package/dist/lib/sandbox/index.js +6 -4
  17. package/dist/lib/sandbox/readme-scaffold.js +148 -0
  18. package/dist/lib/sandbox/runtimes/ai-tools.dockerfile +12 -6
  19. package/dist/lib/sandbox/runtimes/base.dockerfile +3 -3
  20. package/dist/lib/sandbox/tools.js +213 -8
  21. package/dist/lib/update.js +12 -1
  22. package/lib/cp.ts +177 -0
  23. package/lib/defaults.json +1 -0
  24. package/lib/init.ts +10 -0
  25. package/lib/sandbox/clipboard/bridge.ts +23 -4
  26. package/lib/sandbox/clipboard/index.ts +12 -3
  27. package/lib/sandbox/commands/create.ts +18 -2
  28. package/lib/sandbox/commands/enter.ts +48 -6
  29. package/lib/sandbox/commands/list-running.ts +135 -0
  30. package/lib/sandbox/commands/ls.ts +28 -49
  31. package/lib/sandbox/commands/rebuild.ts +24 -7
  32. package/lib/sandbox/config.ts +7 -0
  33. package/lib/sandbox/index.ts +6 -4
  34. package/lib/sandbox/readme-scaffold.ts +177 -0
  35. package/lib/sandbox/runtimes/ai-tools.dockerfile +12 -6
  36. package/lib/sandbox/runtimes/base.dockerfile +3 -3
  37. package/lib/sandbox/tools.ts +248 -9
  38. package/lib/update.ts +15 -1
  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 +79 -2
  43. package/templates/.agents/README.zh-CN.md +79 -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/testing-discipline.en.md +2 -2
  59. package/templates/.agents/rules/testing-discipline.zh-CN.md +2 -2
  60. package/templates/.agents/scripts/validate-artifact.js +1 -1
  61. package/templates/.agents/skills/analyze-task/SKILL.en.md +16 -4
  62. package/templates/.agents/skills/analyze-task/SKILL.zh-CN.md +16 -4
  63. package/templates/.agents/skills/check-task/SKILL.en.md +43 -32
  64. package/templates/.agents/skills/check-task/SKILL.zh-CN.md +42 -31
  65. package/templates/.agents/skills/code-task/SKILL.en.md +117 -0
  66. package/templates/.agents/skills/{implement-task → code-task}/SKILL.zh-CN.md +51 -24
  67. package/templates/.agents/skills/{implement-task → code-task}/config/verify.en.json +4 -4
  68. package/templates/.agents/skills/{implement-task → code-task}/config/verify.zh-CN.json +4 -4
  69. package/templates/.agents/skills/{implement-task → code-task}/reference/branch-management.zh-CN.md +2 -2
  70. package/templates/.agents/skills/{implement-task/reference/implementation-rules.en.md → code-task/reference/code-rules.en.md} +6 -6
  71. package/templates/.agents/skills/{implement-task/reference/implementation-rules.zh-CN.md → code-task/reference/code-rules.zh-CN.md} +3 -3
  72. package/templates/.agents/skills/code-task/reference/dual-mode.en.md +69 -0
  73. package/templates/.agents/skills/code-task/reference/dual-mode.zh-CN.md +69 -0
  74. package/templates/.agents/skills/{refine-task/reference/fix-workflow.en.md → code-task/reference/fix-mode.en.md} +12 -12
  75. package/templates/.agents/skills/{refine-task/reference/fix-workflow.zh-CN.md → code-task/reference/fix-mode.zh-CN.md} +8 -8
  76. package/templates/.agents/skills/code-task/reference/output-template.en.md +20 -0
  77. package/templates/.agents/skills/code-task/reference/output-template.zh-CN.md +20 -0
  78. package/templates/.agents/skills/{implement-task → code-task}/reference/report-template.en.md +4 -4
  79. package/templates/.agents/skills/{implement-task → code-task}/reference/report-template.zh-CN.md +3 -3
  80. package/templates/.agents/skills/code-task/scripts/detect-mode.js +370 -0
  81. package/templates/.agents/skills/commit/SKILL.en.md +2 -2
  82. package/templates/.agents/skills/commit/SKILL.zh-CN.md +2 -2
  83. package/templates/.agents/skills/commit/reference/task-status-update.en.md +10 -6
  84. package/templates/.agents/skills/commit/reference/task-status-update.zh-CN.md +10 -6
  85. package/templates/.agents/skills/complete-task/SKILL.en.md +5 -3
  86. package/templates/.agents/skills/complete-task/SKILL.zh-CN.md +5 -3
  87. package/templates/.agents/skills/create-pr/SKILL.en.md +17 -1
  88. package/templates/.agents/skills/create-pr/SKILL.zh-CN.md +17 -1
  89. package/templates/.agents/skills/import-codescan/SKILL.en.md +1 -1
  90. package/templates/.agents/skills/import-codescan/SKILL.zh-CN.md +1 -1
  91. package/templates/.agents/skills/import-dependabot/SKILL.en.md +2 -2
  92. package/templates/.agents/skills/import-dependabot/SKILL.zh-CN.md +2 -2
  93. package/templates/.agents/skills/import-issue/SKILL.en.md +3 -3
  94. package/templates/.agents/skills/import-issue/SKILL.zh-CN.md +3 -3
  95. package/templates/.agents/skills/plan-task/SKILL.en.md +4 -4
  96. package/templates/.agents/skills/plan-task/SKILL.zh-CN.md +4 -4
  97. package/templates/.agents/skills/restore-task/SKILL.en.md +4 -3
  98. package/templates/.agents/skills/restore-task/SKILL.zh-CN.md +4 -3
  99. package/templates/.agents/skills/review-analysis/SKILL.en.md +76 -0
  100. package/templates/.agents/skills/review-analysis/SKILL.zh-CN.md +102 -0
  101. package/templates/.agents/skills/review-analysis/config/verify.en.json +51 -0
  102. package/templates/.agents/skills/review-analysis/config/verify.zh-CN.json +51 -0
  103. package/templates/.agents/skills/review-analysis/reference/output-templates.en.md +87 -0
  104. package/templates/.agents/skills/review-analysis/reference/output-templates.zh-CN.md +87 -0
  105. package/templates/.agents/skills/review-analysis/reference/report-template.en.md +90 -0
  106. package/templates/.agents/skills/review-analysis/reference/report-template.zh-CN.md +91 -0
  107. package/templates/.agents/skills/review-analysis/reference/review-criteria.en.md +47 -0
  108. package/templates/.agents/skills/review-analysis/reference/review-criteria.zh-CN.md +47 -0
  109. package/templates/.agents/skills/{review-task → review-code}/SKILL.en.md +11 -9
  110. package/templates/.agents/skills/{review-task → review-code}/SKILL.zh-CN.md +15 -9
  111. package/templates/.agents/skills/{review-task → review-code}/config/verify.en.json +7 -5
  112. package/templates/.agents/skills/{review-task → review-code}/config/verify.zh-CN.json +6 -4
  113. package/templates/.agents/skills/{review-task → review-code}/reference/output-templates.en.md +21 -17
  114. package/templates/.agents/skills/{review-task → review-code}/reference/output-templates.zh-CN.md +19 -15
  115. package/templates/.agents/skills/{review-task → review-code}/reference/report-template.en.md +5 -6
  116. package/templates/.agents/skills/review-code/reference/report-template.zh-CN.md +91 -0
  117. package/templates/.agents/skills/review-code/reference/review-criteria.en.md +48 -0
  118. package/templates/.agents/skills/{review-task → review-code}/reference/review-criteria.zh-CN.md +10 -4
  119. package/templates/.agents/skills/review-plan/SKILL.en.md +76 -0
  120. package/templates/.agents/skills/review-plan/SKILL.zh-CN.md +102 -0
  121. package/templates/.agents/skills/{refine-task → review-plan}/config/verify.en.json +14 -10
  122. package/templates/.agents/skills/{refine-task → review-plan}/config/verify.zh-CN.json +14 -10
  123. package/templates/.agents/skills/review-plan/reference/output-templates.en.md +87 -0
  124. package/templates/.agents/skills/review-plan/reference/output-templates.zh-CN.md +87 -0
  125. package/templates/.agents/skills/review-plan/reference/report-template.en.md +90 -0
  126. package/templates/.agents/skills/{review-task → review-plan}/reference/report-template.zh-CN.md +3 -3
  127. package/templates/.agents/skills/review-plan/reference/review-criteria.en.md +47 -0
  128. package/templates/.agents/skills/review-plan/reference/review-criteria.zh-CN.md +47 -0
  129. package/templates/.agents/skills/test/SKILL.en.md +2 -2
  130. package/templates/.agents/skills/test/SKILL.zh-CN.md +13 -31
  131. package/templates/.agents/skills/update-agent-infra/scripts/sync-templates.js +1 -0
  132. package/templates/.agents/templates/task.en.md +3 -3
  133. package/templates/.agents/templates/task.zh-CN.md +2 -2
  134. package/templates/.agents/workflows/bug-fix.en.yaml +126 -80
  135. package/templates/.agents/workflows/bug-fix.zh-CN.yaml +90 -44
  136. package/templates/.agents/workflows/feature-development.en.yaml +115 -70
  137. package/templates/.agents/workflows/feature-development.zh-CN.yaml +92 -47
  138. package/templates/.agents/workflows/refactoring.en.yaml +123 -78
  139. package/templates/.agents/workflows/refactoring.zh-CN.yaml +89 -44
  140. package/templates/.claude/commands/code-task.en.md +8 -0
  141. package/templates/.claude/commands/code-task.zh-CN.md +8 -0
  142. package/templates/.claude/commands/review-analysis.en.md +8 -0
  143. package/templates/.claude/commands/review-analysis.zh-CN.md +8 -0
  144. package/templates/.claude/commands/review-code.en.md +8 -0
  145. package/templates/.claude/commands/review-code.zh-CN.md +8 -0
  146. package/templates/.claude/commands/review-plan.en.md +8 -0
  147. package/templates/.claude/commands/review-plan.zh-CN.md +8 -0
  148. package/templates/.gemini/commands/_project_/archive-tasks.zh-CN.toml +1 -1
  149. package/templates/.gemini/commands/_project_/code-task.en.toml +8 -0
  150. package/templates/.gemini/commands/_project_/code-task.zh-CN.toml +8 -0
  151. package/templates/.gemini/commands/_project_/init-labels.zh-CN.toml +1 -1
  152. package/templates/.gemini/commands/_project_/init-milestones.zh-CN.toml +1 -1
  153. package/templates/.gemini/commands/_project_/review-analysis.en.toml +8 -0
  154. package/templates/.gemini/commands/_project_/review-analysis.zh-CN.toml +8 -0
  155. package/templates/.gemini/commands/_project_/review-code.en.toml +8 -0
  156. package/templates/.gemini/commands/_project_/review-code.zh-CN.toml +8 -0
  157. package/templates/.gemini/commands/_project_/review-plan.en.toml +8 -0
  158. package/templates/.gemini/commands/_project_/review-plan.zh-CN.toml +8 -0
  159. package/templates/.opencode/commands/code-task.en.md +11 -0
  160. package/templates/.opencode/commands/code-task.zh-CN.md +11 -0
  161. package/templates/.opencode/commands/review-analysis.en.md +11 -0
  162. package/templates/.opencode/commands/review-analysis.zh-CN.md +11 -0
  163. package/templates/.opencode/commands/review-code.en.md +11 -0
  164. package/templates/.opencode/commands/review-code.zh-CN.md +11 -0
  165. package/templates/.opencode/commands/review-plan.en.md +11 -0
  166. package/templates/.opencode/commands/review-plan.zh-CN.md +11 -0
  167. package/templates/.agents/skills/implement-task/SKILL.en.md +0 -173
  168. package/templates/.agents/skills/implement-task/reference/output-template.en.md +0 -20
  169. package/templates/.agents/skills/implement-task/reference/output-template.zh-CN.md +0 -20
  170. package/templates/.agents/skills/refine-task/SKILL.en.md +0 -153
  171. package/templates/.agents/skills/refine-task/SKILL.zh-CN.md +0 -153
  172. package/templates/.agents/skills/refine-task/reference/report-template.en.md +0 -64
  173. package/templates/.agents/skills/refine-task/reference/report-template.zh-CN.md +0 -64
  174. package/templates/.agents/skills/review-task/reference/review-criteria.en.md +0 -42
  175. package/templates/.claude/commands/implement-task.en.md +0 -8
  176. package/templates/.claude/commands/implement-task.zh-CN.md +0 -8
  177. package/templates/.claude/commands/refine-task.en.md +0 -8
  178. package/templates/.claude/commands/refine-task.zh-CN.md +0 -8
  179. package/templates/.claude/commands/review-task.en.md +0 -8
  180. package/templates/.claude/commands/review-task.zh-CN.md +0 -8
  181. package/templates/.gemini/commands/_project_/implement-task.en.toml +0 -8
  182. package/templates/.gemini/commands/_project_/implement-task.zh-CN.toml +0 -8
  183. package/templates/.gemini/commands/_project_/refine-task.en.toml +0 -8
  184. package/templates/.gemini/commands/_project_/refine-task.zh-CN.toml +0 -8
  185. package/templates/.gemini/commands/_project_/review-task.en.toml +0 -8
  186. package/templates/.gemini/commands/_project_/review-task.zh-CN.toml +0 -8
  187. package/templates/.opencode/commands/implement-task.en.md +0 -11
  188. package/templates/.opencode/commands/implement-task.zh-CN.md +0 -11
  189. package/templates/.opencode/commands/refine-task.en.md +0 -11
  190. package/templates/.opencode/commands/refine-task.zh-CN.md +0 -11
  191. package/templates/.opencode/commands/review-task.en.md +0 -11
  192. package/templates/.opencode/commands/review-task.zh-CN.md +0 -11
  193. /package/templates/.agents/skills/{implement-task → code-task}/reference/branch-management.en.md +0 -0
@@ -36,11 +36,12 @@ description: "查看任务的当前状态和进度"
36
36
  按产物类型扫描并记录以下文件的存在、轮次和状态:
37
37
  - `analysis.md`、`analysis-r{N}.md` - 需求分析
38
38
  - `plan.md`、`plan-r{N}.md` - 技术方案
39
- - `implementation.md`、`implementation-r2.md`、... - 实现报告
40
- - `refinement.md`、`refinement-r2.md`、... - 修复报告
41
- - `review.md`、`review-r2.md`、... - 审查报告
39
+ - `code.md`、`code-r2.md`、... - 实现报告
40
+ - `review-analysis.md`、`review-analysis-r{N}.md` - 需求分析审查报告
41
+ - `review-plan.md`、`review-plan-r{N}.md` - 技术方案审查报告
42
+ - `review-code.md`、`review-code-r{N}.md` - 代码审查报告
42
43
 
43
- 对于版本化产物(`analysis`、`plan`、`implementation`、`refinement`、`review`):
44
+ 对于版本化产物(`analysis`、`review-analysis`、`plan`、`review-plan`、`code`、`review-code`):
44
45
  - 扫描任务目录中的所有同类版本化文件
45
46
  - 记录每类产物的最新轮次、最新文件路径和总轮次数
46
47
  - 如果 `task.md` 的 Activity Log 记录了最新轮次,优先核对其与实际文件是否一致
@@ -64,28 +65,30 @@ description: "查看任务的当前状态和进度"
64
65
 
65
66
  工作流进度:
66
67
  [已完成] 需求分析 analysis-r2.md (Round 2, latest)
68
+ [已完成] 需求分析审查 review-analysis.md (Round 1, latest)
67
69
  [已完成] 技术设计 plan.md (Round 1)
68
- [进行中] 实现 implementation.md (Round 1)
69
- [待处理] 修复 refinement.md (Round 1 will be created next)
70
- [待处理] 代码审查 review.md (Round 1 will be created next)
70
+ [已完成] 技术方案审查 review-plan.md (Round 1, latest)
71
+ [进行中] 实现 code.md (Round 1)
72
+ [待处理] 代码审查 review-code.md (Round 1 will be created next)
71
73
  [待处理] 最终提交
72
74
 
73
75
  上下文文件:
74
76
  - analysis.md: 已存在 (Round 1)
75
77
  - analysis-r2.md: 已存在 (Round 2, latest)
78
+ - review-analysis.md: 已存在 (Round 1, latest)
76
79
  - plan.md: 已存在 (Round 1, latest)
77
- - implementation.md: 已存在 (Round 1, latest)
78
- - refinement.md: 未开始
79
- - review.md: 未开始
80
+ - review-plan.md: 已存在 (Round 1, latest)
81
+ - code.md: 已存在 (Round 1, latest)
82
+ - review-code.md: 未开始
80
83
 
81
84
  如果存在多轮产物,显示所有轮次,并标记最新版本,例如:
82
- - plan.md:已存在 (Round 1)
83
- - plan-r2.md:已存在 (Round 2, latest)
84
- - implementation.md:已存在 (Round 1)
85
- - implementation-r2.md:已存在 (Round 2, latest)
86
- - refinement.md:已存在 (Round 1)
87
- - review.md:已存在 (Round 1)
88
- - review-r2.md:已存在 (Round 2, latest)
85
+ - plan.md: 已存在 (Round 1)
86
+ - plan-r2.md: 已存在 (Round 2, latest)
87
+ - review-plan.md: 已存在 (Round 1)
88
+ - code.md: 已存在 (Round 1)
89
+ - code-r2.md: 已存在 (Round 2, latest)
90
+ - review-code.md: 已存在 (Round 1)
91
+ - review-code-r2.md: 已存在 (Round 2, latest)
89
92
 
90
93
  下一步:
91
94
  完成实现,然后执行代码审查
@@ -107,26 +110,34 @@ description: "查看任务的当前状态和进度"
107
110
  > - `status = blocked` → 选择「任务被阻塞」
108
111
  > - `status = completed` → 选择「任务已完成」
109
112
  > - `current_step = requirement-analysis` 且最新分析产物已完成 → 选择「分析完成」
113
+ > - `current_step = requirement-analysis-review` 且最新需求分析审查产物通过 → 选择「需求分析审查通过」
114
+ > - `current_step = requirement-analysis-review` 且最新需求分析审查产物存在但未通过或有问题 → 选择「需求分析审查有问题」
110
115
  > - `current_step = technical-design` 且最新计划产物已完成 → 选择「计划完成」
116
+ > - `current_step = technical-design-review` 且最新技术方案审查产物通过 → 选择「技术方案审查通过」
117
+ > - `current_step = technical-design-review` 且最新技术方案审查产物存在但未通过或有问题 → 选择「技术方案审查有问题」
111
118
  > - 最新实现产物已存在,且尚无最新审查产物 → 选择「实现完成」
112
- > - 最新审查产物存在,且结论为 `Approved`,同时 `Blocker = 0`、`Major = 0`、`Minor = 0` → 选择「审查通过」
113
- > - 最新审查产物存在,但仍有任何 `Blocker`、`Major` 或 `Minor` 问题,或结论不是无问题通过 → 选择「审查有问题」
119
+ > - `current_step = code-review` 且最新代码审查产物存在,且结论为 `Approved`,同时 `Blocker = 0`、`Major = 0`、`Minor = 0` → 选择「代码审查通过」
120
+ > - `current_step = code-review` 且最新代码审查产物存在,但仍有任何 `Blocker`、`Major` 或 `Minor` 问题,或结论不是无问题通过 → 选择「代码审查有问题」
114
121
  >
115
- > **特别注意:只要最新审查报告中存在任何问题,就不能使用「审查通过」行。必须改用「审查有问题」行。**
116
-
117
- | 当前状态 | Claude Code / OpenCode | Gemini CLI | Codex CLI |
118
- |---------|----------------------|------------|-----------|
119
- | 分析完成 | `/plan-task {task-id}` | `/agent-infra:plan-task {task-id}` | `$plan-task {task-id}` |
120
- | 计划完成 | `/implement-task {task-id}` | `/agent-infra:implement-task {task-id}` | `$implement-task {task-id}` |
121
- | 实现完成 | `/review-task {task-id}` | `/agent-infra:review-task {task-id}` | `$review-task {task-id}` |
122
- | 审查通过 | `/commit` | `/agent-infra:commit` | `$commit` |
123
- | 审查有问题 | `/refine-task {task-id}` | `/agent-infra:refine-task {task-id}` | `$refine-task {task-id}` |
124
- | 任务被阻塞 | 解除阻塞或提供所需信息 | | 解除阻塞或提供所需信息 |
125
- | 任务已完成 | 无需操作 | | 无需操作 |
122
+ > **特别注意:只要最新审查报告中存在任何问题,就不能使用对应「审查通过」行。必须改用对应「审查有问题」行。**
123
+
124
+ | 当前状态 | Claude Code / OpenCode | Gemini CLI | Codex CLI |
125
+ |--------------------|------------------------------|------------------------------------------|------------------------------|
126
+ | 分析完成 | `/review-analysis {task-id}` | `/agent-infra:review-analysis {task-id}` | `$review-analysis {task-id}` |
127
+ | 需求分析审查通过 | `/plan-task {task-id}` | `/agent-infra:plan-task {task-id}` | `$plan-task {task-id}` |
128
+ | 需求分析审查有问题 | `/analyze-task {task-id}` | `/agent-infra:analyze-task {task-id}` | `$analyze-task {task-id}` |
129
+ | 计划完成 | `/review-plan {task-id}` | `/agent-infra:review-plan {task-id}` | `$review-plan {task-id}` |
130
+ | 技术方案审查通过 | `/code-task {task-id}` | `/agent-infra:code-task {task-id}` | `$code-task {task-id}` |
131
+ | 技术方案审查有问题 | `/plan-task {task-id}` | `/agent-infra:plan-task {task-id}` | `$plan-task {task-id}` |
132
+ | 实现完成 | `/review-code {task-id}` | `/agent-infra:review-code {task-id}` | `$review-code {task-id}` |
133
+ | 代码审查通过 | `/commit` | `/agent-infra:commit` | `$commit` |
134
+ | 代码审查有问题 | `/code-task {task-id}` | `/agent-infra:code-task {task-id}` | `$code-task {task-id}` |
135
+ | 任务被阻塞 | 解除阻塞或提供所需信息 | — | 解除阻塞或提供所需信息 |
136
+ | 任务已完成 | 无需操作 | — | 无需操作 |
126
137
 
127
138
  ## 注意事项
128
139
 
129
140
  1. **只读**:本技能仅读取和报告 —— 不修改任何文件
130
141
  2. **多目录搜索**:始终检查 active、blocked 和 completed 目录
131
142
  3. **快速参考**:随时可以使用本技能检查任务在工作流中的位置
132
- 4. **版本化产物**:`analysis`、`plan`、`implementation`、`refinement`、`review` 都需要报告实际轮次,而不是只报告固定文件名
143
+ 4. **版本化产物**:`analysis`、`review-analysis`、`plan`、`review-plan`、`code`、`review-code` 都需要报告实际轮次,而不是只报告固定文件名
@@ -0,0 +1,117 @@
1
+ ---
2
+ name: code-task
3
+ description: "Implement code from the technical plan and output a report"
4
+ ---
5
+
6
+ # Code Task
7
+
8
+ Implement the approved plan and produce `code.md` or `code-r{N}.md`. This skill supports initial implementation and fix mode based on `review-code` feedback.
9
+
10
+ ## Boundary / Critical Rules
11
+
12
+ - Follow the latest plan artifact: `plan.md` or `plan-r{N}.md`
13
+ - Fix mode only addresses findings from the latest `review-code`; env-blocked items are out of scope
14
+ - Never auto-run `git add` or `git commit`
15
+ - Create a new code artifact for each round and never overwrite an older one
16
+ - After executing this skill, you **must** immediately update task.md
17
+
18
+ Version stamp rule: when creating or updating `task.md` frontmatter, read `.agents/rules/version-stamp.md` first and write or refresh `agent_infra_version`.
19
+
20
+ ## Step 0: State Check (pre-execution hard gate)
21
+
22
+ After loading workflow / skill / rules instructions, and before any task-state judgment or user-visible conclusion, run the state check first.
23
+
24
+ Run these commands and paste the raw output into both the user-facing reply and this round's `## State Check` section:
25
+
26
+ ```bash
27
+ git status -s
28
+ ls -la .agents/workspace/active/{task-id}/
29
+ tail .agents/workspace/active/{task-id}/task.md
30
+ ```
31
+
32
+ ## Steps
33
+
34
+ ### 1. Verify Prerequisites
35
+
36
+ Require `task.md` and at least one plan artifact: `plan.md` or `plan-r{N}.md`.
37
+
38
+ ### 2. Ensure the Task Branch
39
+
40
+ Read `reference/branch-management.md`, ensure the current branch matches the task branch, and write the final branch back to task.md when needed.
41
+
42
+ ### 3. Narrow the Milestone
43
+
44
+ If task.md has a valid `issue_number`, read `.agents/rules/issue-sync.md` and `.agents/rules/milestone-inference.md`; follow Phase 2 for `code-task`.
45
+
46
+ ### 4. Determine Mode and Round
47
+
48
+ Run mode detection and preserve its exit code:
49
+
50
+ ```bash
51
+ result=$(node .agents/skills/code-task/scripts/detect-mode.js .agents/workspace/active/{task-id})
52
+ status=$?
53
+ echo "$result"
54
+ ```
55
+
56
+ Dispatch by `$status` and `result.mode`:
57
+
58
+ - `0` + `"init"`: initial implementation; record `{code-artifact}` and `{code-round}`
59
+ - `0` + `"fix"`: fix mode; record `{code-artifact}`, `{code-round}`, and `{review-artifact}`
60
+ - `1` + `"refused"`: print `result.message`, stop, and do not write an artifact or Activity Log entry
61
+ - `2` + `"error"`: print `result.message`, stop, and do not write an artifact or Activity Log entry
62
+
63
+ > Read `reference/dual-mode.md` before this step.
64
+
65
+ ### 5. Determine the Input Plan
66
+
67
+ Read the highest-round plan artifact and use the `{code-artifact}` selected in step 4. In fix mode, also read `{review-artifact}`.
68
+
69
+ ### 6. Read the Technical Plan
70
+
71
+ Extract implementation steps, files, test strategy, constraints, risks, and approved tradeoffs.
72
+
73
+ ### 7. Implement the Code
74
+
75
+ Follow the plan in order.
76
+
77
+ > Read `reference/code-rules.md` before implementation.
78
+ > In fix mode, read `reference/fix-mode.md` before editing.
79
+ > Read `.agents/rules/testing-discipline.md` before adding or changing tests.
80
+
81
+ ### 8. Run Test Verification
82
+
83
+ Use the project test commands from the `test` skill and iterate until all required tests pass.
84
+
85
+ ### 9. Write the Code Report
86
+
87
+ Create `.agents/workspace/active/{task-id}/{code-artifact}`.
88
+
89
+ > Read `reference/report-template.md` before writing the report.
90
+
91
+ ### 10. Update Task Status
92
+
93
+ Get the current time:
94
+
95
+ ```bash
96
+ date "+%Y-%m-%d %H:%M:%S%:z"
97
+ ```
98
+
99
+ Set `current_step` to `code`, refresh task metadata, and append one Activity Log entry:
100
+
101
+ - initial implementation: `Code (Round {N})`
102
+ - fix mode: `Code (Round {N}, fix for {review-artifact})`
103
+
104
+ If task.md has a valid `issue_number`, read `.agents/rules/issue-sync.md`, then:
105
+ - Set `status: in-progress` according to issue-sync.md
106
+ - Create or update the task comment marker defined in `.agents/rules/issue-sync.md`
107
+ - Publish the `{code-artifact}` comment
108
+
109
+ ### 11. Run Completion Gate
110
+
111
+ ```bash
112
+ node .agents/scripts/validate-artifact.js gate code-task .agents/workspace/active/{task-id} {code-artifact} --format text
113
+ ```
114
+
115
+ ### 12. Tell the User
116
+
117
+ Use `reference/output-template.md` and show all TUI command formats.
@@ -1,15 +1,16 @@
1
1
  ---
2
- name: implement-task
3
- description: "根据技术方案实施任务并输出报告"
2
+ name: code-task
3
+ description: "根据技术方案编码任务并输出报告"
4
4
  ---
5
5
 
6
- # 实施任务
6
+ # 编码任务
7
7
 
8
- 根据已批准的技术方案实施任务,并产出 `implementation.md` 或 `implementation-r{N}.md`。
8
+ 根据已批准的技术方案编码任务,并产出 `code.md` 或 `code-r{N}.md`。本技能支持初次实现和基于 `review-code` 反馈的修复双模式。
9
9
 
10
10
  ## 行为边界 / 关键规则
11
11
 
12
12
  - 严格遵循最新方案产物:`plan.md` 或 `plan-r{N}.md`
13
+ - 修复模式只处理最新 `review-code` 标记的问题;env-blocked 项不在修复范围
13
14
  - 绝不自动执行 `git add` 或 `git commit`
14
15
  - 每轮实现都创建新的实现产物,不覆盖旧文件
15
16
  - 执行本技能后,你**必须**立即更新 task.md
@@ -66,18 +67,40 @@ tail .agents/workspace/active/{task-id}/task.md
66
67
 
67
68
  ### 3. 收窄里程碑
68
69
 
69
- 如果 task.md 中存在有效的 `issue_number`,执行前先读取 `.agents/rules/issue-sync.md`,完成 upstream 仓库检测和权限检测;再读取 `.agents/rules/milestone-inference.md`,按其中的「阶段 2:`implement-task`」收窄 Issue milestone;如果 `has_triage=false`,则保持原 milestone 不变。
70
+ 如果 task.md 中存在有效的 `issue_number`,执行前先读取 `.agents/rules/issue-sync.md`,完成 upstream 仓库检测和权限检测;再读取 `.agents/rules/milestone-inference.md`,按其中的「阶段 2:`code-task`」收窄 Issue milestone;如果 `has_triage=false`,则保持原 milestone 不变。
70
71
 
71
- ### 4. 确定输入方案与实现轮次
72
+ ### 4. 确定模式与轮次
73
+
74
+ 执行 mode detection 脚本,先保存 exit code 再处理输出:
75
+
76
+ ```bash
77
+ result=$(node .agents/skills/code-task/scripts/detect-mode.js .agents/workspace/active/{task-id})
78
+ status=$?
79
+ echo "$result"
80
+ ```
81
+
82
+ 按 `$status` 与 `result.mode` 分流;二者不一致时按 `$status` 为准并报告异常:
83
+
84
+ | `$status` | `result.mode` | 行动 |
85
+ |---|---|---|
86
+ | 0 | `"init"` | 进入初次实现模式。记录 `{code-artifact}` = `result.next_artifact`、`{code-round}` = `result.next_round` |
87
+ | 0 | `"fix"` | 进入修复模式。记录 `{code-artifact}` = `result.next_artifact`、`{code-round}` = `result.next_round`、`{review-artifact}` = `result.review_artifact` |
88
+ | 1 | `"refused"` | 输出 `result.message` 给用户;立即停止;不写 Activity Log、不创建产物 |
89
+ | 2 | `"error"` | 输出 `result.message` 给用户;立即停止;不写 Activity Log、不创建产物 |
90
+ | 其他 | 任意 | 视为脚本异常,输出 `Mode detection failed: status={status}, output={result}` 并停止 |
91
+
92
+ > 双模式判定规则见 `reference/dual-mode.md`。执行此步骤前先读取 `reference/dual-mode.md`。
93
+
94
+ ### 5. 确定输入方案
72
95
 
73
96
  扫描 `.agents/workspace/active/{task-id}/` 并记录:
74
97
  - 最高轮次的方案文件为 `{plan-artifact}`
75
- - 本轮实现产物为 `implementation.md` `implementation-r{N}.md`
76
- - `{implementation-round}` `{implementation-artifact}`
98
+ - 使用步骤 4 记录的 `{code-round}` `{code-artifact}`
99
+ - 若为修复模式,同时记录 `{review-artifact}`
77
100
 
78
101
  如果存在 `plan-r{N}.md`,读取最高轮次的方案文件;否则读取 `plan.md`。
79
102
 
80
- ### 5. 阅读技术方案
103
+ ### 6. 阅读技术方案
81
104
 
82
105
  仔细阅读 `{plan-artifact}`,提取:
83
106
  - 实施步骤
@@ -85,26 +108,29 @@ tail .agents/workspace/active/{task-id}/task.md
85
108
  - 测试策略
86
109
  - 约束、风险与已批准的取舍
87
110
 
88
- ### 6. 执行代码实现
111
+ 修复模式还必须读取 `{review-artifact}`,并只处理其中标记的问题。
112
+
113
+ ### 7. 执行代码实现
89
114
 
90
115
  按照 `.agents/workflows/feature-development.yaml` 和方案顺序实施。
91
116
 
92
- > 详细实现规则、测试执行循环和偏离处理见 `reference/implementation-rules.md`。执行此步骤前,先读取 `reference/implementation-rules.md`。
117
+ > 详细实现规则、测试执行循环和偏离处理见 `reference/code-rules.md`。执行此步骤前,先读取 `reference/code-rules.md`。
118
+ > 修复模式的范围纪律见 `reference/fix-mode.md`。进入修复模式前先读取 `reference/fix-mode.md`。
93
119
  > 测试编写纪律(RED-GREEN-REFACTOR 与反模式)见 `.agents/rules/testing-discipline.md`;新增或调整测试前先读取该文件。
94
120
 
95
- ### 7. 运行测试验证
121
+ ### 8. 运行测试验证
96
122
 
97
123
  使用 `test` 技能中的项目测试命令,直到所有必需测试通过。
98
124
 
99
125
  如果测试失败,先尝试修复并重新运行测试。只有在确认存在外部阻塞、环境缺失或需求不明确且超出任务范围时,才可以停止。
100
126
 
101
- ### 8. 编写实现报告
127
+ ### 9. 编写实现报告
102
128
 
103
- 创建 `.agents/workspace/active/{task-id}/{implementation-artifact}`。
129
+ 创建 `.agents/workspace/active/{task-id}/{code-artifact}`。
104
130
 
105
131
  > 报告结构、必填章节和完整模板见 `reference/report-template.md`。写报告前先读取 `reference/report-template.md`。
106
132
 
107
- ### 9. 更新任务状态
133
+ ### 10. 更新任务状态
108
134
 
109
135
  获取当前时间:
110
136
 
@@ -113,26 +139,27 @@ date "+%Y-%m-%d %H:%M:%S%:z"
113
139
  ```
114
140
 
115
141
  更新 `.agents/workspace/active/{task-id}/task.md`:
116
- - `current_step`:implementation
142
+ - `current_step`:code
117
143
  - `assigned_to`:{当前代理}
118
144
  - `updated_at`:{当前时间}
119
145
  - `agent_infra_version`:按 `.agents/rules/version-stamp.md` 取值
120
146
  - 审查 `## 需求` 段落,仅把本轮已由代码实现且有测试通过支撑的条目从 `- [ ]` 勾为 `- [x]`
121
- - 记录 Round `{implementation-round}` 的 `{implementation-artifact}`
147
+ - 记录 Round `{code-round}` 的 `{code-artifact}`
122
148
  - 追加:
123
- `- {YYYY-MM-DD HH:mm:ss±HH:MM} — **Implementation (Round {N})** by {agent} — Code implemented, {n} files modified, {n} tests passed → {implementation-artifact}`
149
+ - 初次实现:`- {YYYY-MM-DD HH:mm:ss±HH:MM} — **Code (Round {N})** by {agent} — Code implemented, {n} files modified, {n} tests passed → {code-artifact}`
150
+ - 修复模式:`- {YYYY-MM-DD HH:mm:ss±HH:MM} — **Code (Round {N}, fix for {review-artifact})** by {agent} — Fixed {n} blockers, {n} major, {n} minor issues[, skipped {n} env-blocked] → {code-artifact}`
124
151
 
125
152
  如果 task.md 中存在有效的 `issue_number`,执行以下同步操作(任一失败则跳过并继续;执行前先读取 `.agents/rules/issue-sync.md`,完成 upstream 仓库检测和权限检测):
126
153
  - 按 issue-sync.md 设置 `status: in-progress`
127
154
  - 创建或更新 `.agents/rules/issue-sync.md` 中定义的 task 评论标记(按 issue-sync.md 的 task.md 评论同步规则)
128
- - 发布 `{implementation-artifact}` 评论
155
+ - 发布 `{code-artifact}` 评论
129
156
 
130
- ### 10. 完成校验
157
+ ### 11. 完成校验
131
158
 
132
159
  运行完成校验,确认任务产物和同步状态符合规范:
133
160
 
134
161
  ```bash
135
- node .agents/scripts/validate-artifact.js gate implement-task .agents/workspace/active/{task-id} {implementation-artifact} --format text
162
+ node .agents/scripts/validate-artifact.js gate code-task .agents/workspace/active/{task-id} {code-artifact} --format text
136
163
  ```
137
164
 
138
165
  处理结果:
@@ -142,7 +169,7 @@ node .agents/scripts/validate-artifact.js gate implement-task .agents/workspace/
142
169
 
143
170
  将校验输出保留在回复中作为当次验证输出。没有当次校验输出,不得声明完成。
144
171
 
145
- ### 11. 告知用户
172
+ ### 12. 告知用户
146
173
 
147
174
  > 仅在校验通过后执行本步骤。
148
175
 
@@ -151,7 +178,7 @@ node .agents/scripts/validate-artifact.js gate implement-task .agents/workspace/
151
178
  ## 完成检查清单
152
179
 
153
180
  - [ ] 已完成批准范围内的代码实现
154
- - [ ] 已创建 `{implementation-artifact}`
181
+ - [ ] 已创建 `{code-artifact}`
155
182
  - [ ] 所有必需测试通过
156
183
  - [ ] 已更新 task.md 并追加 Activity Log
157
184
  - [ ] 已向用户展示所有 TUI 格式的下一步命令(含自定义 TUI)
@@ -162,7 +189,7 @@ node .agents/scripts/validate-artifact.js gate implement-task .agents/workspace/
162
189
 
163
190
  ## 注意事项
164
191
 
165
- - 首轮实现使用 `implementation.md`,后续轮次使用 `implementation-r{N}.md`
192
+ - 首轮实现使用 `code.md`,后续轮次使用 `code-r{N}.md`
166
193
  - 如偏离 `{plan-artifact}`,必须在报告中记录原因
167
194
  - 新测试必须验证有意义的业务行为,而不是机械透传
168
195
 
@@ -1,5 +1,5 @@
1
1
  {
2
- "skill": "implement-task",
2
+ "skill": "code-task",
3
3
  "checks": {
4
4
  "task-meta": {
5
5
  "required_fields": [
@@ -13,10 +13,10 @@
13
13
  "current_step",
14
14
  "assigned_to"
15
15
  ],
16
- "expected_step": "implementation"
16
+ "expected_step": "code"
17
17
  },
18
18
  "artifact": {
19
- "file_pattern": "implementation.md|implementation-r{N}.md",
19
+ "file_pattern": "code.md|code-r{N}.md",
20
20
  "required_sections": [
21
21
  "Modified Files",
22
22
  "Key Code Explanation",
@@ -32,7 +32,7 @@
32
32
  ]
33
33
  },
34
34
  "activity-log": {
35
- "expected_action_pattern": "Implementation \\(Round \\d+\\)",
35
+ "expected_action_pattern": "Code \\(Round \\d+(?:, fix for review-code(?:-r\\d+)?\\.md)?\\)",
36
36
  "freshness_minutes": 30
37
37
  },
38
38
  "platform-sync": {
@@ -1,5 +1,5 @@
1
1
  {
2
- "skill": "implement-task",
2
+ "skill": "code-task",
3
3
  "checks": {
4
4
  "task-meta": {
5
5
  "required_fields": [
@@ -13,10 +13,10 @@
13
13
  "current_step",
14
14
  "assigned_to"
15
15
  ],
16
- "expected_step": "implementation"
16
+ "expected_step": "code"
17
17
  },
18
18
  "artifact": {
19
- "file_pattern": "implementation.md|implementation-r{N}.md",
19
+ "file_pattern": "code.md|code-r{N}.md",
20
20
  "required_sections": [
21
21
  "变更文件",
22
22
  "关键代码说明",
@@ -32,7 +32,7 @@
32
32
  ]
33
33
  },
34
34
  "activity-log": {
35
- "expected_action_pattern": "Implementation \\(Round \\d+\\)",
35
+ "expected_action_pattern": "Code \\(Round \\d+(?:, fix for review-code(?:-r\\d+)?\\.md)?\\)",
36
36
  "freshness_minutes": 30
37
37
  },
38
38
  "platform-sync": {
@@ -4,7 +4,7 @@
4
4
 
5
5
  ## 分支名规则
6
6
 
7
- - 格式:`{{project}}-{type}-{slug}`
7
+ - 格式:`agent-infra-{type}-{slug}`
8
8
  - 项目前缀:读取 `.agents/.airc.json` 中的 `project`
9
9
  - `{type}`:读取 `task.md` frontmatter 中的 `type`
10
10
  - `{slug}`:根据任务标题提取 3-6 个英文关键词,转为 kebab-case
@@ -23,7 +23,7 @@
23
23
  - 当前分支不一致:按下方”创建与切换命令”章节切换到已记录分支
24
24
 
25
25
  场景 B:`task.md` 未记录任务分支
26
- - 判断当前分支是否符合项目分支命名规范(`{{project}}-{type}-{slug}`)且语义上属于当前任务
26
+ - 判断当前分支是否符合项目分支命名规范(`agent-infra-{type}-{slug}`)且语义上属于当前任务
27
27
  - 符合:将当前分支名回写到 `task.md`,继续
28
28
  - 不符合:生成新的任务分支名,按下方”创建与切换命令”章节创建并切换,回写到 `task.md`
29
29
 
@@ -4,7 +4,7 @@ Read this file before coding or interpreting test failures.
4
4
 
5
5
  ## Execute Code Implementation
6
6
 
7
- Follow the `implementation` step in `.agents/workflows/feature-development.yaml`.
7
+ Follow the `code` step in `.agents/workflows/feature-development.yaml`.
8
8
 
9
9
  **Required tasks**:
10
10
  - [ ] implement the feature code according to the plan
@@ -23,7 +23,7 @@ Follow the `implementation` step in `.agents/workflows/feature-development.yaml`
23
23
 
24
24
  During implementation:
25
25
  - **Inner loop**: after each change, run the project's **smoke subset** (see the `test` skill) for fast feedback
26
- - **Before writing the implementation report**: run the **core subset** as final verification so code entering review has passed the complete core checks
26
+ - **Before writing the code report**: run the **core subset** as final verification so code entering review has passed the complete core checks
27
27
 
28
28
  > Refer to the `test` skill for project-specific commands; downstream projects without layered scripts should fall back to the full project test command.
29
29
 
@@ -39,8 +39,8 @@ Two-way failure handling:
39
39
  - continue until all required tests pass
40
40
  2. external blockers:
41
41
  - confirm the failure comes from missing environment, unrelated upstream breakage, or unclear requirements outside this task
42
- - stop without creating `implementation.md` / `implementation-r{N}.md`
43
- - do not mark implementation complete in `task.md`
42
+ - stop without creating `code.md` / `code-r{N}.md`
43
+ - do not mark code complete in `task.md`
44
44
  - do not output the normal success/next-step template
45
45
 
46
46
  ## Notes
@@ -49,5 +49,5 @@ Two-way failure handling:
49
49
  2. **No auto-commit**: do not run `git commit` or `git add`
50
50
  3. **Test quality**: new tests must validate meaningful business logic
51
51
  4. **Code quality**: follow project coding conventions
52
- 5. **Plan deviation**: record any deviation in the implementation report
53
- 6. **Versioning**: Round 1 uses `implementation.md`; later rounds use `implementation-r{N}.md`
52
+ 5. **Plan deviation**: record any deviation in the code report
53
+ 6. **Versioning**: Round 1 uses `code.md`; later rounds use `code-r{N}.md`
@@ -4,7 +4,7 @@
4
4
 
5
5
  ## 执行代码实现
6
6
 
7
- 遵循 `.agents/workflows/feature-development.yaml` 中的 `implementation` 步骤。
7
+ 遵循 `.agents/workflows/feature-development.yaml` 中的 `code` 步骤。
8
8
 
9
9
  **必做任务**:
10
10
  - [ ] 按计划实现功能代码
@@ -39,7 +39,7 @@
39
39
  - 持续处理直到所有必需测试通过
40
40
  2. 外部阻塞:
41
41
  - 确认失败来自缺失环境、无关的上游损坏,或任务范围外的需求不明确
42
- - 停止,并且不要创建 `implementation.md` / `implementation-r{N}.md`
42
+ - 停止,并且不要创建 `code.md` / `code-r{N}.md`
43
43
  - 不要在 `task.md` 中把实现标记为完成
44
44
  - 不要输出正常的成功/下一步模板
45
45
 
@@ -50,4 +50,4 @@
50
50
  3. **测试质量**:新增测试必须验证有意义的业务逻辑
51
51
  4. **代码质量**:遵循项目编码规范
52
52
  5. **方案偏离**:任何偏离都要记录到实现报告中
53
- 6. **版本命名**:Round 1 使用 `implementation.md`,后续轮次使用 `implementation-r{N}.md`
53
+ 6. **版本命名**:Round 1 使用 `code.md`,后续轮次使用 `code-r{N}.md`
@@ -0,0 +1,69 @@
1
+ # code-task dual mode
2
+
3
+ This file documents `scripts/detect-mode.js`. The script is the source of truth; update this document whenever the script changes.
4
+
5
+ ## Input
6
+
7
+ ```bash
8
+ node .agents/skills/code-task/scripts/detect-mode.js .agents/workspace/active/{task-id}
9
+ ```
10
+
11
+ The script scans `plan.md` / `plan-r{N}.md`, `review-plan.md` / `review-plan-r{N}.md`, `code.md` / `code-r{N}.md`, and `review-code.md` / `review-code-r{N}.md` in the task directory.
12
+
13
+ ## Eight Branches
14
+
15
+ > Branches are evaluated top-down in this table; the first match returns and skips later rows.
16
+
17
+ | Condition | mode | exit | Behavior |
18
+ |---|---|---:|---|
19
+ | no code artifact | `init` | 0 | initial implementation, output `code.md` |
20
+ | latest review-plan is approved (`Approved` or `Approved-with-issues`, i.e. `Overall Verdict: Approved` regardless of findings counts), its "Review Input" / "审查输入" entry names the same plan file as the latest `plan(-r{N})?.md` in the task directory, and its mtime is newer than the latest code artifact | `init` | 0 | plan has been approved after the latest code; enter a new implementation round, `next_round = code_max + 1`, `next_artifact = code-r{next_round}.md`. This branch fires regardless of whether review-code exists or passes. Plan and review-plan rounds are independent counters (e.g. `plan-r5` may be approved by `review-plan-r4`); the link is established via the review-plan's "Review Input" entry, not by matching round numbers. |
21
+ | `rev_max < code_max` | `error` | 2 | latest code round is unreviewed; run `review-code` first |
22
+ | `rev_max > code_max` | `error` | 2 | inconsistent state; manual inspection required |
23
+ | latest review-code is Approved with 0/0/0 | `refused` | 1 | already approved; do not run `code-task` again |
24
+ | latest review-code is Approved with major/minor findings | `fix` | 0 | optional fix mode |
25
+ | latest review-code is Changes Requested | `fix` | 0 | required fix mode |
26
+ | latest review-code is Rejected | `refused` | 1 | re-plan instead of local fixing |
27
+
28
+ ## Verdict Parsing
29
+
30
+ The script supports zh-CN and English review-code reports:
31
+
32
+ | Meaning | zh-CN | English |
33
+ |---|---|---|
34
+ | summary section | `## 审查摘要` | `## Review Summary` |
35
+ | verdict field | `**总体结论**:` | `**Overall Verdict**:` |
36
+ | findings field | `**发现(AI 可处理)**:` | `**Findings (AI-actionable)**:` |
37
+
38
+ Verdict mapping:
39
+
40
+ - `通过` / `Approved` -> `Approved`, then blocker/major/minor counts split it into `Approved` or `Approved-with-issues`
41
+ - `需要修改` / `Changes Requested` -> `Changes Requested`
42
+ - `拒绝` / `Rejected` -> `Rejected`
43
+
44
+ env-blocked counts do not affect mode selection.
45
+
46
+ ## Output Contract
47
+
48
+ The script prints JSON:
49
+
50
+ ```json
51
+ {
52
+ "mode": "init",
53
+ "code_max": 0,
54
+ "rev_max": 0,
55
+ "verdict": null,
56
+ "next_round": 1,
57
+ "next_artifact": "code.md",
58
+ "review_artifact": null,
59
+ "message": "..."
60
+ }
61
+ ```
62
+
63
+ In the replan-driven init branch (row #2), `review_artifact` points to the `review-plan-r{N}.md` that triggered replan rather than a review-code artifact, preserving the attribution chain.
64
+
65
+ exit code:
66
+
67
+ - `0`: continue, `mode` is `init` or `fix`
68
+ - `1`: stop, `mode` is `refused`
69
+ - `2`: inconsistent state, `mode` is `error`