@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
@@ -0,0 +1,90 @@
1
+ # Review Report Template
2
+
3
+ Use this template when writing `review-plan.md` or `review-plan-r{N}.md`.
4
+
5
+ ## Output Template
6
+
7
+ ```markdown
8
+ # Technical Plan Review Report
9
+
10
+ - **Review Round**: Round {review-round}
11
+ - **Artifact File**: `{review-artifact}`
12
+ - **Review Input**:
13
+ - `{plan-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 plan 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
+ ```
@@ -1,6 +1,6 @@
1
1
  # 审查报告模板
2
2
 
3
- 编写 `review.md` 或 `review-r{N}.md` 时使用本模板。
3
+ 编写 `review-plan.md` 或 `review-plan-r{N}.md` 时使用本模板。
4
4
 
5
5
  ## 输出模板
6
6
 
@@ -10,8 +10,8 @@
10
10
  - **审查轮次**:第 {review-round} 轮
11
11
  - **产物文件**:`{review-artifact}`
12
12
  - **审查输入**:
13
- - `{implementation-artifact}`
14
- - `{refinement-artifact}`(如存在)
13
+ - `{code-artifact}`
14
+ - `{code-artifact}`(如存在)
15
15
 
16
16
  ## 状态核对
17
17
 
@@ -0,0 +1,47 @@
1
+ # Review Criteria
2
+
3
+ Read this file before reviewing technical plan artifacts or classifying finding severity.
4
+
5
+ ## Technical Plan Review
6
+
7
+ Follow the `design-review` step in `.agents/workflows/feature-development.yaml`.
8
+
9
+ **Required review areas**:
10
+ - [ ] The plan covers the approved requirement analysis
11
+ - [ ] Implementation steps are concrete, ordered, and verifiable
12
+ - [ ] Architecture boundaries, data flow, and interface changes are clear
13
+ - [ ] Test strategy covers critical paths, regression risks, and edge cases
14
+ - [ ] Risks, migration, rollback, or compatibility handling are sufficient
15
+ - [ ] The plan avoids over-design and unrelated scope expansion
16
+
17
+ **Common anti-examples**:
18
+ - Saying "modify related code" without executable steps and verification points
19
+ - Ignoring risks or constraints listed in the analysis
20
+ - Introducing unnecessary abstractions, configuration, or frameworks for a single-use requirement
21
+
22
+ ## Common Review Principles
23
+
24
+ 1. **Strict but fair**: identify issues and acknowledge solid work
25
+ 2. **Specific**: cite exact file paths and line numbers
26
+ 3. **Actionable**: suggest a concrete fix
27
+ 4. **Severity-based**: clearly distinguish blockers, major issues, and minor issues
28
+
29
+ ## Environment-Blocked Classification
30
+
31
+ Some findings cannot be closed by an AI agent in the current execution environment, for example:
32
+
33
+ - Missing Docker / sandbox access for end-to-end validation
34
+ - Missing a specific OS for macOS-only behavior
35
+ - Missing third-party accounts / OAuth
36
+ - Missing privileged operations such as root, sudo, or special network access
37
+
38
+ **Decision tree**: "Can the AI agent close this item independently without changing the environment?"
39
+ - Yes -> blocker / major / minor, based on risk
40
+ - No -> **env-blocked** (a meta-category, not part of severity ordering)
41
+
42
+ Where env-blocked items go:
43
+ - Record them in an independent review report section named "Environment-Blocked Findings"
44
+ - Include them at the end of the numeric summary, for example `(+ 1 env-blocked)`
45
+ - Do **not** include them in the code-task fix loop; maintainers carry them in the PR description under manual verification
46
+
47
+ Also inspect the latest technical plan artifact, latest requirement-analysis review artifact, and `task.md` Activity Log so the report reflects the full design context.
@@ -0,0 +1,47 @@
1
+ # 审查标准
2
+
3
+ 在审查技术方案或划分问题严重程度之前先读取本文件。
4
+
5
+ ## 执行技术方案审查
6
+
7
+ 遵循 `.agents/workflows/feature-development.yaml` 中的 `design-review` 步骤。
8
+
9
+ **必查范围**:
10
+ - [ ] 方案是否覆盖已批准的需求分析
11
+ - [ ] 实现步骤是否具体、顺序合理且可验证
12
+ - [ ] 架构边界、数据流和接口变化是否清晰
13
+ - [ ] 测试策略是否覆盖关键路径、回归风险和边界情况
14
+ - [ ] 风险、迁移、回滚或兼容性处理是否充分
15
+ - [ ] 方案是否避免过度设计和无关扩张
16
+
17
+ **常见反例**:
18
+ - 方案只写“修改相关代码”,没有可执行步骤和验证点
19
+ - 设计没有回应分析中列出的风险或约束
20
+ - 为单次需求引入不必要的新抽象、配置或框架
21
+
22
+ ## 通用审查原则
23
+
24
+ 1. **严格但公正**:既要指出问题,也要承认做得好的部分
25
+ 2. **具体**:引用准确的文件路径和行号
26
+ 3. **可执行**:给出明确可落地的修复建议
27
+ 4. **按严重程度分类**:明确区分 blocker、major 和 minor
28
+
29
+ ## 环境性遗留分类
30
+
31
+ 某些发现项是 AI agent 在本执行环境**无法闭环**的,例如:
32
+
33
+ - 缺 Docker / 沙箱而无法跑端到端验证
34
+ - 缺特定 OS(macOS-only 行为)
35
+ - 缺第三方账号 / OAuth
36
+ - 缺特权操作(root、sudo、特殊网络)
37
+
38
+ **分类决策树**:「AI agent 能否在不改环境的前提下独立闭环这一项?」
39
+ - 是 -> blocker / major / minor 之一(按风险定档)
40
+ - 否 -> **env-blocked**(元类目,不参与严重程度排序)
41
+
42
+ env-blocked 项的去向:
43
+ - 写入 review 报告独立段落「环境性遗留」
44
+ - 在数字摘要末尾附带显示(如 `(+ 1 env-blocked)`)
45
+ - **不**进入 code-task 修复循环;维护者在 PR description 中以「待人工验证」清单形式承接
46
+
47
+ 同时检查最新技术方案产物、最新需求分析审查产物和 `task.md` Activity Log,确保报告反映完整的设计上下文。
@@ -35,7 +35,7 @@ This project uses three test layers as an optional optimization; if the test sui
35
35
  ```
36
36
 
37
37
  Use for:
38
- - implement-task / refine-task inner loops
38
+ - code-task inner loops
39
39
  - save-and-run / frequent feedback
40
40
  - project structure, configuration, and template contract checks
41
41
 
@@ -50,7 +50,7 @@ Use for:
50
50
 
51
51
  Use for:
52
52
  - pre-commit hook (automatic)
53
- - final verification before writing implementation.md / refinement.md
53
+ - final verification before writing code.md / code-r{N}.md
54
54
  - local gate before pushing a PR
55
55
 
56
56
  ### full (complete test suite)
@@ -1,74 +1,56 @@
1
1
  ---
2
2
  name: test
3
- description: "执行项目完整测试流程"
3
+ description: >
4
+ 执行项目完整测试流程(编译检查 + 单元测试)。
5
+ 当用户要求运行测试或验证代码质量时触发。
4
6
  ---
5
7
 
6
8
  # 执行测试
7
9
 
8
10
  执行项目的完整测试流程,包括编译检查和单元测试。
9
11
 
10
- <!-- TODO: 将以下命令替换为你的项目实际命令 -->
11
-
12
12
  ## 1. 编译 / 类型检查
13
13
 
14
- ```bash
15
- # TODO: 替换为你的项目编译命令
16
- # npx tsc --noEmit (TypeScript)
17
- # mvn compile (Maven)
18
- # go build ./... (Go)
19
- # make build (通用)
20
- ```
21
-
22
- 确认无编译错误。
14
+ 本项目由 Node.js CLI 和模板文件组成,无需编译。跳过此步骤。
23
15
 
24
16
  ## 2. 运行单元测试(按层级选择)
25
17
 
26
- 本项目把测试分为三层(可选优化);如果项目测试规模较小,可以全部映射到同一个完整测试命令。
18
+ 本项目把测试分为三层,按场景选择运行命令;新增测试文件默认归入 **full**,确认足够快且足够核心后,再上调到 core 或 smoke。
27
19
 
28
20
  ### smoke(目标 <5s)
29
21
 
30
22
  ```bash
31
- # TODO: 替换为本项目的 smoke 子集命令
32
- # npm run test:smoke (Node.js)
33
- # pytest -m "not slow" (Python)
34
- # go test -short ./... (Go)
23
+ npm run test:smoke
35
24
  ```
36
25
 
37
26
  适用场景:
38
- - implement-task / refine-task 内循环
27
+ - code-task 内循环
39
28
  - 保存即跑 / 频繁反馈
40
29
  - 仅断言项目结构、配置、模板契约
41
30
 
42
31
  ### core(目标 <15s)
43
32
 
44
33
  ```bash
45
- # TODO: 替换为本项目的 core 子集命令
46
- # npm run test:core (Node.js)
47
- # pytest -m "not contract" (Python)
48
- # go test ./... (Go)
34
+ npm run test:core
49
35
  ```
50
36
 
51
37
  适用场景:
52
38
  - pre-commit hook(自动调用)
53
- - 写 implementation.md / refinement.md 报告前的最终验证
39
+ - 写 code.md / code-r{N}.md 报告前的最终验证
54
40
  - 推送 PR 前的本地把关
55
41
 
56
- ### full(完整测试)
42
+ ### full(目标 <60s)
57
43
 
58
44
  ```bash
59
- # TODO: 替换为本项目的完整测试命令
60
- # npm test (Node.js)
61
- # mvn test (Maven)
62
- # pytest (Python)
63
- # go test ./... (Go)
45
+ npm test
64
46
  ```
65
47
 
66
48
  适用场景:
67
49
  - release / tag 前
68
- - CI
50
+ - CI(unit-tests.yml)
69
51
  - main 合并前的最终把关
70
52
 
71
- 如果项目暂不分层,smoke / core / full 可以全部映射到同一个完整测试命令;分层是反馈速度优化项,不是使用协作工作流的前置条件。
53
+ full 层运行全部项目测试。`npm test` 使用通配匹配项目测试文件,**新增的测试文件会自动归入 full**,这是安全网。
72
54
 
73
55
  ## 3. 输出结果
74
56
 
@@ -47,6 +47,7 @@ The script outputs JSON to stdout. Parse and record the report.
47
47
  - `managed.written` / `managed.created`: updated / newly created managed files
48
48
  - `managed.removed`: deleted managed files (including old paths removed during template migrations)
49
49
  - `managed.skippedPlatform`: managed / merged entries skipped because they belong to a different platform
50
+ - `managed.skippedTUI`: managed / merged entries skipped because they are owned by a built-in TUI that is disabled in `tuis` (customTUI command files under the same path prefix are preserved)
50
51
  - `merged.pending`: list of merged files for AI to process
51
52
  - Each item has `target` (project-relative path) and `template` (template-root-relative path)
52
53
  - `registryAdded`: newly added file registry entries
@@ -39,6 +39,7 @@ node .agents/skills/update-agent-infra/scripts/sync-templates.js
39
39
  - `managed.written` / `managed.created`:已更新/新建的 managed 文件
40
40
  - `managed.removed`:被删除的 managed 文件(包括模板迁移时移除的旧路径)
41
41
  - `managed.skippedPlatform`:因归属其他平台而被跳过的 managed / merged 条目
42
+ - `managed.skippedTUI`:因 `tuis` 中未启用对应内建 TUI 而被跳过的 managed / merged 条目(落在同一路径前缀下的 customTUI 命令文件会被保留)
42
43
  - `merged.pending`:需要 AI 处理的 merged 文件列表
43
44
  - 每项包含 `target`(项目中的目标路径)和 `template`(模板根目录下的相对路径)
44
45
  - `registryAdded`:新增的文件注册条目
@@ -23,6 +23,7 @@ const DEFAULTS = {
23
23
  "platform": {
24
24
  "type": "github"
25
25
  },
26
+ "requiresPullRequest": true,
26
27
  "sandbox": {
27
28
  "engine": null,
28
29
  "runtimes": [
@@ -41,6 +42,9 @@ const DEFAULTS = {
41
42
  "disk": null
42
43
  }
43
44
  },
45
+ "task": {
46
+ "shortIdLength": 2
47
+ },
44
48
  "labels": {
45
49
  "in": {}
46
50
  },
@@ -87,6 +91,39 @@ const PACKAGE_NAME = '@fitlab-ai/agent-infra';
87
91
  const KNOWN_PLATFORMS = new Set(['github']);
88
92
  const KNOWN_LANGUAGES = new Set(['en', 'zh-CN']);
89
93
 
94
+ // Single source of truth for built-in TUI ids and owned path prefixes.
95
+ // Keep in sync with lib/builtin-tuis.ts (enforced by tests/unit/scripts/sync-templates-consts.test.ts).
96
+ const BUILTIN_TUI_IDS = ['claude-code', 'codex', 'gemini-cli', 'opencode'];
97
+ const BUILTIN_TUI_OWNED_PATH_PREFIXES = {
98
+ 'claude-code': ['.claude/'],
99
+ 'codex': ['.codex/'],
100
+ 'gemini-cli': ['.gemini/'],
101
+ 'opencode': ['.opencode/']
102
+ };
103
+
104
+ function resolveEnabledTUIs(value) {
105
+ // Missing field / null / non-array → full set (backward compat).
106
+ if (!Array.isArray(value)) return new Set(BUILTIN_TUI_IDS);
107
+ // Empty array is a meaningful user choice: no built-in TUI managed.
108
+ const set = new Set();
109
+ for (const v of value) {
110
+ if (typeof v === 'string' && BUILTIN_TUI_IDS.includes(v)) set.add(v);
111
+ }
112
+ return set;
113
+ }
114
+
115
+ function isPathOwnedByDisabledTUI(rel, enabledSet) {
116
+ const normalized = String(rel || '').replace(/\\/g, '/').replace(/^\.\//, '');
117
+ for (const tui of BUILTIN_TUI_IDS) {
118
+ if (enabledSet.has(tui)) continue;
119
+ for (const prefix of BUILTIN_TUI_OWNED_PATH_PREFIXES[tui]) {
120
+ const trimmed = prefix.replace(/\/$/, '');
121
+ if (normalized === trimmed || normalized.startsWith(prefix)) return true;
122
+ }
123
+ }
124
+ return false;
125
+ }
126
+
90
127
  function norm(p) { return p.replace(/\\/g, '/'); }
91
128
 
92
129
  function normDir(p) {
@@ -653,26 +690,32 @@ function learnAndGenerateCommands(projectRoot, customSkills, tool, templateSkill
653
690
  }
654
691
  }
655
692
 
656
- function generateCustomCommands(projectRoot, customSkills, project, lang, report, customTUIs, templateSkillNames) {
693
+ function generateCustomCommands(projectRoot, customSkills, project, lang, report, customTUIs, templateSkillNames, enabledTUIs) {
657
694
  for (const skill of customSkills) {
658
- writeIfChanged(
659
- projectRoot,
660
- `.claude/commands/${skill.dirName}.md`,
661
- generateClaudeCommand(skill, lang),
662
- report.custom.commands
663
- );
664
- writeIfChanged(
665
- projectRoot,
666
- '.gemini/commands/' + project + '/' + skill.dirName + '.toml',
667
- generateGeminiCommand(skill, lang),
668
- report.custom.commands
669
- );
670
- writeIfChanged(
671
- projectRoot,
672
- `.opencode/commands/${skill.dirName}.md`,
673
- generateOpenCodeCommand(skill, lang),
674
- report.custom.commands
675
- );
695
+ if (enabledTUIs.has('claude-code')) {
696
+ writeIfChanged(
697
+ projectRoot,
698
+ `.claude/commands/${skill.dirName}.md`,
699
+ generateClaudeCommand(skill, lang),
700
+ report.custom.commands
701
+ );
702
+ }
703
+ if (enabledTUIs.has('gemini-cli')) {
704
+ writeIfChanged(
705
+ projectRoot,
706
+ '.gemini/commands/' + project + '/' + skill.dirName + '.toml',
707
+ generateGeminiCommand(skill, lang),
708
+ report.custom.commands
709
+ );
710
+ }
711
+ if (enabledTUIs.has('opencode')) {
712
+ writeIfChanged(
713
+ projectRoot,
714
+ `.opencode/commands/${skill.dirName}.md`,
715
+ generateOpenCodeCommand(skill, lang),
716
+ report.custom.commands
717
+ );
718
+ }
676
719
  }
677
720
 
678
721
  const tools = Array.isArray(customTUIs) ? customTUIs : [];
@@ -968,6 +1011,7 @@ function syncTemplates(projectRoot, templateRootOverride) {
968
1011
 
969
1012
  const { project, org, language: lang = 'en' } = cfg;
970
1013
  const platformType = cfg.platform?.type || DEFAULTS.platform.type;
1014
+ const enabledTUIs = resolveEnabledTUIs(cfg.tuis);
971
1015
  const customTUIsConfig = Array.isArray(cfg.customTUIs) ? cfg.customTUIs : [];
972
1016
  const vars = { project, org };
973
1017
  const templateSkillNames = listTemplateSkillNames(templateRoot);
@@ -988,7 +1032,7 @@ function syncTemplates(projectRoot, templateRootOverride) {
988
1032
  errors: [],
989
1033
  conflicts: []
990
1034
  },
991
- managed: { written: [], created: [], unchanged: [], skippedMerged: [], skippedPlatform: [], removed: [] },
1035
+ managed: { written: [], created: [], unchanged: [], skippedMerged: [], skippedPlatform: [], skippedTUI: [], removed: [] },
992
1036
  custom: {
993
1037
  detected: [],
994
1038
  generated: [],
@@ -1015,10 +1059,12 @@ function syncTemplates(projectRoot, templateRootOverride) {
1015
1059
  const known = new Set([...managed, ...merged, ...ejected]);
1016
1060
  for (const e of (DEFAULTS.files.managed || [])) {
1017
1061
  if (isPathOwnedByOtherPlatform(e, platformType)) continue;
1062
+ if (isPathOwnedByDisabledTUI(e, enabledTUIs)) continue;
1018
1063
  if (!known.has(e)) { managed.push(e); known.add(e); report.registryAdded.push({ entry: e, list: 'managed' }); }
1019
1064
  }
1020
1065
  for (const e of (DEFAULTS.files.merged || [])) {
1021
1066
  if (isPathOwnedByOtherPlatform(e, platformType)) continue;
1067
+ if (isPathOwnedByDisabledTUI(e, enabledTUIs)) continue;
1022
1068
  if (!known.has(e)) { merged.push(e); known.add(e); report.registryAdded.push({ entry: e, list: 'merged' }); }
1023
1069
  }
1024
1070
 
@@ -1049,11 +1095,50 @@ function syncTemplates(projectRoot, templateRootOverride) {
1049
1095
  report.managed.removed.push(norm(path.relative(projectRoot, target)));
1050
1096
  }
1051
1097
 
1098
+ // Cleanup files owned by disabled built-in TUIs. Iterates managed + merged
1099
+ // only (ejected entries are explicitly user-retained, see ejected loop below).
1100
+ //
1101
+ // Protection rule: only skip files registered as customTUI command targets
1102
+ // (e.g. a customTUI configured with dir=.codex/commands/ when codex is
1103
+ // disabled). Built-in TUI custom-skill commands like
1104
+ // .gemini/commands/<project>/<dirName>.toml are intentionally NOT protected
1105
+ // here so that disabling gemini-cli actually frees the gemini directory —
1106
+ // they will be regenerated only for still-enabled TUIs (see
1107
+ // generateCustomCommands).
1108
+ for (const entry of [...managed, ...merged]) {
1109
+ if (!isPathOwnedByDisabledTUI(entry, enabledTUIs)) continue;
1110
+
1111
+ if (entry.endsWith('/')) {
1112
+ const dir = path.join(projectRoot, entry);
1113
+ if (!fs.existsSync(dir)) continue;
1114
+
1115
+ for (const filePath of walkDir(dir)) {
1116
+ const relProj = norm(path.relative(projectRoot, filePath));
1117
+ if (customTUICommandTargets.has(relProj)) continue;
1118
+ fs.unlinkSync(filePath);
1119
+ report.managed.removed.push(relProj);
1120
+ }
1121
+ removeEmptyDirs(dir);
1122
+ continue;
1123
+ }
1124
+
1125
+ const target = path.join(projectRoot, renderPathname(entry, project));
1126
+ if (!fs.existsSync(target)) continue;
1127
+ const relProj = norm(path.relative(projectRoot, target));
1128
+ if (customTUICommandTargets.has(relProj)) continue;
1129
+ fs.unlinkSync(target);
1130
+ report.managed.removed.push(relProj);
1131
+ }
1132
+
1052
1133
  for (const entry of managed) {
1053
1134
  if (isPathOwnedByOtherPlatform(entry, platformType)) {
1054
1135
  report.managed.skippedPlatform.push(entry);
1055
1136
  continue;
1056
1137
  }
1138
+ if (isPathOwnedByDisabledTUI(entry, enabledTUIs)) {
1139
+ report.managed.skippedTUI.push(entry);
1140
+ continue;
1141
+ }
1057
1142
 
1058
1143
  const isDir = entry.endsWith('/');
1059
1144
  let entryRels;
@@ -1139,7 +1224,7 @@ function syncTemplates(projectRoot, templateRootOverride) {
1139
1224
 
1140
1225
  const customSkills = detectCustomSkills(projectRoot, templateSkillNames);
1141
1226
  report.custom.detected = customSkills.map((skill) => skill.dirName);
1142
- generateCustomCommands(projectRoot, customSkills, project, lang, report, customTUIs, templateSkillNames);
1227
+ generateCustomCommands(projectRoot, customSkills, project, lang, report, customTUIs, templateSkillNames, enabledTUIs);
1143
1228
 
1144
1229
  for (const entry of ejected) {
1145
1230
  const dstFull = path.join(projectRoot, entry);
@@ -1147,6 +1232,9 @@ function syncTemplates(projectRoot, templateRootOverride) {
1147
1232
  report.ejected.skipped.push(entry);
1148
1233
  continue;
1149
1234
  }
1235
+ // Do not (re)create ejected files for disabled TUIs. Existing files are
1236
+ // never touched by sync (handled above); this guard only blocks creation.
1237
+ if (isPathOwnedByDisabledTUI(entry, enabledTUIs)) continue;
1150
1238
 
1151
1239
  const selected = platformSelect(langSelect(entryVariantRels(entry, allSet, platformType), lang, allSet, project), platformType, project);
1152
1240
  const target = norm(renderPathname(entry, project));
@@ -1167,6 +1255,10 @@ function syncTemplates(projectRoot, templateRootOverride) {
1167
1255
  report.managed.skippedPlatform.push(entry);
1168
1256
  continue;
1169
1257
  }
1258
+ if (isPathOwnedByDisabledTUI(entry, enabledTUIs)) {
1259
+ report.managed.skippedTUI.push(entry);
1260
+ continue;
1261
+ }
1170
1262
 
1171
1263
  if (entry.includes('*')) {
1172
1264
  const hits = allRels.filter(r => {
@@ -7,11 +7,12 @@ status: open # open | in-progress | review | blocked | complet
7
7
  created_at: YYYY-MM-DDTHH:mm:ss±HH:MM
8
8
  updated_at: YYYY-MM-DDTHH:mm:ss±HH:MM
9
9
  agent_infra_version: v0.0.0 # Current agent-infra version; refreshed by workflow commands
10
+ short_id: # Allocated by create-task / import-* in active window; kept as historical value after archival
10
11
  priority: # Optional Issue field: Urgent | High | Medium | Low
11
12
  effort: # Optional Issue field: High | Medium | Low
12
13
  start_date: # Optional Issue field for Feature: YYYY-MM-DD
13
14
  target_date: # Optional Issue field for Feature: YYYY-MM-DD
14
- current_step: analysis # analysis | design | implementation | review | fix | commit
15
+ current_step: requirement-analysis # requirement-analysis | requirement-analysis-review | technical-design | technical-design-review | code | code-review | completed
15
16
  assigned_to: # claude | codex | gemini | opencode | human
16
17
  ---
17
18
 
@@ -46,11 +47,11 @@ assigned_to: # claude | codex | gemini | opencode | human
46
47
 
47
48
  ## Implementation Notes
48
49
 
49
- [Notes from the implementation phase. Decisions made, trade-offs, deviations from design.]
50
+ [Notes from the code phase. Decisions made, trade-offs, deviations from design.]
50
51
 
51
52
  ## Review Feedback
52
53
 
53
- <!-- Populated by review-task -->
54
+ <!-- Populated by review-* -->
54
55
 
55
56
  ## Activity Log
56
57
 
@@ -7,11 +7,12 @@ status: open # open | in-progress | review | blocked | complet
7
7
  created_at: YYYY-MM-DDTHH:mm:ss±HH:MM
8
8
  updated_at: YYYY-MM-DDTHH:mm:ss±HH:MM
9
9
  agent_infra_version: v0.0.0 # 当前 agent-infra 版本;由工作流命令刷新
10
+ short_id: # 由 create-task / import-* 在 active 期内写入;归档后保留历史值
10
11
  priority: # 可选 Issue 字段:Urgent | High | Medium | Low
11
12
  effort: # 可选 Issue 字段:High | Medium | Low
12
13
  start_date: # Feature 可选 Issue 字段:YYYY-MM-DD
13
14
  target_date: # Feature 可选 Issue 字段:YYYY-MM-DD
14
- current_step: analysis # analysis | design | implementation | review | fix | commit
15
+ current_step: requirement-analysis # requirement-analysis | requirement-analysis-review | technical-design | technical-design-review | code | code-review | completed
15
16
  assigned_to: # claude | codex | gemini | opencode | human
16
17
  ---
17
18
 
@@ -50,7 +51,7 @@ assigned_to: # claude | codex | gemini | opencode | human
50
51
 
51
52
  ## 审查反馈
52
53
 
53
- <!-- 由 review-task 填写 -->
54
+ <!-- 由 review-* 填写 -->
54
55
 
55
56
  ## 活动日志
56
57