@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
@@ -1,154 +1,199 @@
1
- # Refactoring Workflow
1
+ # Refactoring workflow
2
2
  # Use this workflow for code refactoring tasks.
3
+ #
4
+ # Note: a step's `pr_tasks` list is counted toward workflow progress only when
5
+ # `.agents/.airc.json:requiresPullRequest !== false` (see .agents/skills/complete-task/SKILL.md).
3
6
 
4
7
  name: refactoring
5
8
  description: Safe and structured workflow for code refactoring.
6
9
 
7
10
  steps:
8
11
  - name: analysis
9
- description: Analyze the current code and determine the refactoring scope.
12
+ description: Analyze the current code and define the refactoring scope.
10
13
  recommended_agents:
11
14
  - claude
12
15
  - gemini
13
16
  tasks:
14
- - Identify the code to refactor and why it needs refactoring
15
- - Map all dependencies and consumers of the impacted code
17
+ - Identify code to refactor and the reason for refactoring
18
+ - Map dependencies and callers for affected code
16
19
  - Assess refactoring risk and complexity
17
- - Identify existing test coverage for impacted areas
18
- - Record findings in the task file
20
+ - Identify existing test coverage for affected areas
21
+ - Record findings in the task workspace
19
22
  inputs:
20
- - Refactoring request or issue description
23
+ - Refactoring request or Issue description
21
24
  - Project codebase
22
25
  artifact_versioning:
23
26
  outputs:
24
27
  - name: analysis
25
28
  pattern: "analysis.md | analysis-r{N}.md"
26
- rule: "Scan existing analysis artifacts; create analysis.md for the first round, then analysis-r{N}.md for later revisions (N = current highest round + 1)"
29
+ rule: "Scan existing analysis artifacts; create analysis.md for round 1 and analysis-r{N}.md for later revisions (N = current highest round + 1)"
27
30
  outputs:
28
- - Scope analysis with dependency mapping
31
+ - Scope analysis with dependency map
29
32
  - Risk assessment
30
- - Updated task file (analysis section)
33
+ - Updated task analysis notes
34
+
35
+ - name: analysis-review
36
+ description: Review whether the refactoring analysis covers dependencies, risks, and the test baseline.
37
+ recommended_agents:
38
+ - claude
39
+ - gemini
40
+ tasks:
41
+ - Verify the refactoring scope and rationale
42
+ - Check dependency, caller, and risk identification
43
+ - Confirm the existing test baseline is enough for design
44
+ - Create the requirement analysis review report
45
+ inputs:
46
+ - Latest scope analysis
47
+ - Refactoring request or Issue description
48
+ artifact_versioning:
49
+ inputs:
50
+ - name: analysis
51
+ pattern: "analysis.md | analysis-r{N}.md"
52
+ rule: "Read the highest-round analysis artifact as review input"
53
+ outputs:
54
+ - name: review-analysis
55
+ pattern: "review-analysis.md | review-analysis-r{N}.md"
56
+ rule: "Scan existing requirement-analysis review artifacts; create review-analysis.md for round 1 and review-analysis-r{N}.md for later rounds (N = current highest round + 1)"
57
+ outputs:
58
+ - Requirement analysis review report
59
+ - Findings to fix, if any
31
60
 
32
61
  - name: design
33
- description: Plan the refactoring approach to minimize risk.
62
+ description: Plan the refactoring approach while minimizing risk.
34
63
  recommended_agents:
35
64
  - claude
36
65
  tasks:
37
66
  - Define the target architecture or code structure
38
- - Plan incremental refactoring steps to avoid a single large change
67
+ - Plan incremental refactoring steps
39
68
  - Identify intermediate states that must remain functional
40
- - Plan any additional tests needed before refactoring
41
- - Record the refactoring plan in the task file
69
+ - Plan any extra tests needed before refactoring
70
+ - Record the refactoring plan in the task workspace
42
71
  inputs:
43
- - Scope analysis from the previous step
72
+ - Approved scope analysis
44
73
  - Project architecture
45
74
  artifact_versioning:
46
75
  inputs:
47
76
  - name: analysis
48
77
  pattern: "analysis.md | analysis-r{N}.md"
49
78
  rule: "Read the highest-round analysis artifact as design input"
79
+ - name: review-analysis
80
+ pattern: "review-analysis.md | review-analysis-r{N}.md"
81
+ rule: "Read the highest-round analysis review artifact and confirm feedback is approved or handled"
50
82
  outputs:
51
83
  - name: plan
52
84
  pattern: "plan.md | plan-r{N}.md"
53
- rule: "Scan existing plan artifacts; create plan.md for the first round, then plan-r{N}.md for later revisions (N = current highest round + 1)"
85
+ rule: "Scan existing plan artifacts; create plan.md for round 1 and plan-r{N}.md for later revisions (N = current highest round + 1)"
86
+ outputs:
87
+ - Incremental refactoring plan
88
+ - Prerequisite test list
89
+ - Updated task design notes
90
+
91
+ - name: design-review
92
+ description: Review whether the refactoring plan preserves behavior, is verifiable step by step, and controls risk.
93
+ recommended_agents:
94
+ - claude
95
+ - gemini
96
+ tasks:
97
+ - Verify the plan covers the approved scope analysis
98
+ - Check incremental steps, test strategy, and rollback risk
99
+ - Confirm the plan is ready for coding
100
+ - Create the plan review report
101
+ inputs:
102
+ - Latest refactoring plan
103
+ - Latest scope analysis and review report
104
+ artifact_versioning:
105
+ inputs:
106
+ - name: plan
107
+ pattern: "plan.md | plan-r{N}.md"
108
+ rule: "Read the highest-round plan artifact as review input"
109
+ outputs:
110
+ - name: review-plan
111
+ pattern: "review-plan.md | review-plan-r{N}.md"
112
+ rule: "Scan existing plan review artifacts; create review-plan.md for round 1 and review-plan-r{N}.md for later rounds (N = current highest round + 1)"
54
113
  outputs:
55
- - Refactoring plan with incremental steps
56
- - List of prerequisite tests
57
- - Updated task file (design section)
114
+ - Plan review report
115
+ - Findings to fix, if any
58
116
 
59
- - name: implementation
60
- description: Execute the refactoring according to the plan.
117
+ - name: code
118
+ description: Execute the approved refactoring plan; run the same stage again after code review to handle fixes.
61
119
  recommended_agents:
62
120
  - codex
63
121
  - cursor
64
122
  tasks:
65
123
  - Create a refactoring branch
66
- - Add prerequisite tests if they do not already exist
67
- - Execute the refactoring incrementally
68
- - Verify tests pass after each step
69
- - Update impacted documentation or comments
70
- - Ensure the code follows project conventions
124
+ - Add prerequisite tests when not already present
125
+ - Execute refactoring steps incrementally
126
+ - Verify tests after each step
127
+ - Fix findings from the latest code-review artifact when in fix mode
128
+ - Update affected docs or comments
129
+ - Ensure code follows project conventions
71
130
  inputs:
72
- - Refactoring plan from the previous step
131
+ - Approved refactoring plan
73
132
  - Project coding standards
133
+ - Latest code review report when in fix mode
74
134
  artifact_versioning:
135
+ inputs:
136
+ - name: plan
137
+ pattern: "plan.md | plan-r{N}.md"
138
+ rule: "Read the highest-round plan artifact as implementation input"
139
+ - name: review-plan
140
+ pattern: "review-plan.md | review-plan-r{N}.md"
141
+ rule: "Read the highest-round plan review artifact and confirm feedback is approved or handled"
142
+ - name: review-code
143
+ pattern: "review-code.md | review-code-r{N}.md"
144
+ rule: "In fix mode, read the highest-round code review artifact and verify it matches the latest Code Review entry in task.md Activity Log"
75
145
  outputs:
76
- - name: implementation
77
- pattern: "implementation.md | implementation-r{N}.md"
78
- rule: "Scan existing implementation artifacts; create implementation.md for the first round, then implementation-r{N}.md for later re-implementations (N = current highest round + 1)"
146
+ - name: code
147
+ pattern: "code.md | code-r{N}.md"
148
+ rule: "Scan existing code artifacts; create code.md for round 1 and code-r{N}.md for later fixes or reimplementation (N = current highest round + 1)"
79
149
  outputs:
80
- - Refactoring branch with the changes
150
+ - Refactoring branch with implementation or fixes
81
151
  - Updated or new test files
82
- - Updated task file (implementation notes)
152
+ - Updated task notes
83
153
 
84
- - name: review
154
+ - name: code-review
85
155
  description: Verify that the refactoring preserves behavior and improves code quality.
86
156
  recommended_agents:
87
157
  - claude
88
158
  tasks:
89
- - Verify functional equivalence unless behavior changes are intentional
159
+ - Verify functional equivalence unless behavior change is intentional
90
160
  - Check that all tests pass
91
- - Confirm that code quality has improved
92
- - Check for missed dependencies or consumers
161
+ - Verify code quality improvements
162
+ - Check for missing dependencies or callers
93
163
  - Assess performance impact when applicable
94
- - Create a review report
164
+ - Create the code review report
95
165
  inputs:
96
166
  - Refactoring branch
97
167
  - Original code for comparison
98
168
  - Test results
99
169
  artifact_versioning:
100
170
  inputs:
101
- - name: implementation
102
- pattern: "implementation.md | implementation-r{N}.md"
103
- rule: "Read the highest-round implementation artifact as review input"
104
- outputs:
105
- - name: review
106
- pattern: "review.md | review-r{N}.md"
107
- rule: "Scan existing review artifacts; create review.md for the first round, then review-r{N}.md for later rounds (N = current highest round + 1)"
108
- outputs:
109
- - Review report
110
- - List of issues if any
111
-
112
- - name: fix
113
- description: Address issues found during review.
114
- recommended_agents:
115
- - codex
116
- - cursor
117
- tasks:
118
- - Fix issues identified in the review
119
- - Update tests as needed
120
- - Verify that all tests pass
121
- - Ensure there are no regressions
122
- inputs:
123
- - Review report
124
- - Refactoring branch
125
- artifact_versioning:
126
- inputs:
127
- - name: review
128
- pattern: "review.md | review-r{N}.md"
129
- rule: "Read the highest-round review artifact and verify that it matches the latest Code Review entry in the task.md Activity Log"
171
+ - name: code
172
+ pattern: "code.md | code-r{N}.md"
173
+ rule: "Read the highest-round code artifact as review input"
130
174
  outputs:
131
- - name: refinement
132
- pattern: "refinement.md | refinement-r{N}.md"
133
- rule: "Scan existing refinement artifacts; create refinement.md for the first round, then refinement-r{N}.md for later rounds (N = current highest round + 1)"
175
+ - name: review-code
176
+ pattern: "review-code.md | review-code-r{N}.md"
177
+ rule: "Scan existing code review artifacts; create review-code.md for round 1 and review-code-r{N}.md for later rounds (N = current highest round + 1)"
134
178
  outputs:
135
- - Updated branch with fixes
136
- - Updated task file
179
+ - Code review report
180
+ - Findings list, if any
137
181
 
138
182
  - name: commit
139
- description: Finalize the refactoring and create a pull request.
183
+ description: Finalize the refactoring and create a pull request (the PR portion runs only when the project enables the PR flow).
140
184
  recommended_agents:
141
185
  - claude
142
186
  - human
143
187
  tasks:
144
188
  - Ensure all tests pass
145
- - Write a clear commit message that explains the refactoring
146
- - Create a pull request with a detailed change summary
147
- - Link the PR to the relevant issue
189
+ - Write a clear commit message explaining the refactoring
148
190
  - Move the task to completed
191
+ pr_tasks:
192
+ - Create a pull request with detailed changes
193
+ - Link the PR to the related Issue
149
194
  inputs:
150
195
  - Final refactoring branch
151
- - Task file
196
+ - Task workspace
152
197
  outputs:
153
- - Pull request
154
- - Completed task file (stored in .agents/workspace/completed/)
198
+ - Completed task workspace under .agents/workspace/completed/
199
+ - Pull request (only when the project enables the PR flow)
@@ -1,5 +1,8 @@
1
1
  # 重构工作流
2
2
  # 代码重构任务时使用此工作流。
3
+ #
4
+ # 注:步骤中的 `pr_tasks` 列表仅在 `.agents/.airc.json:requiresPullRequest !== false` 时
5
+ # 被计入工作流进度判定(详见 .agents/skills/complete-task/SKILL.md)。
3
6
 
4
7
  name: refactoring
5
8
  description: 安全且结构化的代码重构工作流。
@@ -29,6 +32,32 @@ steps:
29
32
  - 风险评估
30
33
  - 更新后的任务文件(分析部分)
31
34
 
35
+ - name: analysis-review
36
+ description: 审查重构分析是否覆盖依赖、风险和测试基线。
37
+ recommended_agents:
38
+ - claude
39
+ - gemini
40
+ tasks:
41
+ - 验证待重构范围和原因
42
+ - 检查依赖关系、使用者和风险识别
43
+ - 确认现有测试基线足以支撑设计
44
+ - 创建需求分析审查报告
45
+ inputs:
46
+ - 最新范围分析
47
+ - 重构请求或 Issue 描述
48
+ artifact_versioning:
49
+ inputs:
50
+ - name: analysis
51
+ pattern: "analysis.md | analysis-r{N}.md"
52
+ rule: "读取最高轮次的分析产物作为审查输入"
53
+ outputs:
54
+ - name: review-analysis
55
+ pattern: "review-analysis.md | review-analysis-r{N}.md"
56
+ rule: "扫描现有需求分析审查产物;首轮创建 review-analysis.md,后续轮次创建 review-analysis-r{N}.md(N = 当前最高轮次 + 1)"
57
+ outputs:
58
+ - 需求分析审查报告
59
+ - 待修正问题列表(如有)
60
+
32
61
  - name: design
33
62
  description: 规划重构方案以最小化风险。
34
63
  recommended_agents:
@@ -40,13 +69,16 @@ steps:
40
69
  - 规划重构前需要的额外测试
41
70
  - 在任务文件中记录重构计划
42
71
  inputs:
43
- - 上一步的范围分析
72
+ - 已通过审查的范围分析
44
73
  - 项目架构
45
74
  artifact_versioning:
46
75
  inputs:
47
76
  - name: analysis
48
77
  pattern: "analysis.md | analysis-r{N}.md"
49
78
  rule: "读取最高轮次的分析产物作为设计输入"
79
+ - name: review-analysis
80
+ pattern: "review-analysis.md | review-analysis-r{N}.md"
81
+ rule: "读取最高轮次的需求分析审查产物,确认分析已获通过或已处理反馈"
50
82
  outputs:
51
83
  - name: plan
52
84
  pattern: "plan.md | plan-r{N}.md"
@@ -56,8 +88,34 @@ steps:
56
88
  - 前置测试列表
57
89
  - 更新后的任务文件(设计部分)
58
90
 
59
- - name: implementation
60
- description: 按计划执行重构。
91
+ - name: design-review
92
+ description: 审查重构方案是否保持行为稳定、步骤可验证且风险可控。
93
+ recommended_agents:
94
+ - claude
95
+ - gemini
96
+ tasks:
97
+ - 验证方案覆盖已批准的范围分析
98
+ - 检查增量步骤、测试策略和回滚风险
99
+ - 确认方案足以进入编码阶段
100
+ - 创建技术方案审查报告
101
+ inputs:
102
+ - 最新重构计划
103
+ - 最新范围分析和审查报告
104
+ artifact_versioning:
105
+ inputs:
106
+ - name: plan
107
+ pattern: "plan.md | plan-r{N}.md"
108
+ rule: "读取最高轮次的方案产物作为审查输入"
109
+ outputs:
110
+ - name: review-plan
111
+ pattern: "review-plan.md | review-plan-r{N}.md"
112
+ rule: "扫描现有方案审查产物;首轮创建 review-plan.md,后续轮次创建 review-plan-r{N}.md(N = 当前最高轮次 + 1)"
113
+ outputs:
114
+ - 技术方案审查报告
115
+ - 待修正问题列表(如有)
116
+
117
+ - name: code
118
+ description: 按计划执行重构;在审查后再次执行同一阶段处理修复。
61
119
  recommended_agents:
62
120
  - codex
63
121
  - cursor
@@ -66,22 +124,34 @@ steps:
66
124
  - 添加前置测试(如尚未存在)
67
125
  - 增量执行重构步骤
68
126
  - 每步后验证测试通过
127
+ - 修复最新 code-review 产物中要求处理的问题(如处于修复模式)
69
128
  - 更新受影响的文档或注释
70
129
  - 确保代码遵循项目规范
71
130
  inputs:
72
- - 上一步的重构计划
131
+ - 已通过审查的重构计划
73
132
  - 项目编码标准
133
+ - 最新代码审查报告(修复模式适用)
74
134
  artifact_versioning:
135
+ inputs:
136
+ - name: plan
137
+ pattern: "plan.md | plan-r{N}.md"
138
+ rule: "读取最高轮次的方案产物作为实现输入"
139
+ - name: review-plan
140
+ pattern: "review-plan.md | review-plan-r{N}.md"
141
+ rule: "读取最高轮次的方案审查产物,确认方案已获通过或已处理反馈"
142
+ - name: review-code
143
+ pattern: "review-code.md | review-code-r{N}.md"
144
+ rule: "修复模式读取最高轮次的代码审查产物,并校验其与 task.md Activity Log 中最近一条 Code Review 记录一致"
75
145
  outputs:
76
- - name: implementation
77
- pattern: "implementation.md | implementation-r{N}.md"
78
- rule: "扫描现有实现产物;首轮创建 implementation.md,后续重实现创建 implementation-r{N}.md(N = 当前最高轮次 + 1)"
146
+ - name: code
147
+ pattern: "code.md | code-r{N}.md"
148
+ rule: "扫描现有实现产物;首轮创建 code.md,后续修复或重实现创建 code-r{N}.md(N = 当前最高轮次 + 1)"
79
149
  outputs:
80
150
  - 包含变更的重构分支
81
151
  - 更新或新增的测试文件
82
152
  - 更新后的任务文件(实现备注)
83
153
 
84
- - name: review
154
+ - name: code-review
85
155
  description: 验证重构是否保持了行为并提升了代码质量。
86
156
  recommended_agents:
87
157
  - claude
@@ -91,64 +161,39 @@ steps:
91
161
  - 验证代码质量提升
92
162
  - 检查是否有遗漏的依赖项或使用者
93
163
  - 评估性能影响(如适用)
94
- - 创建审查报告
164
+ - 创建代码审查报告
95
165
  inputs:
96
166
  - 重构分支
97
167
  - 原始代码用于对比
98
168
  - 测试结果
99
169
  artifact_versioning:
100
170
  inputs:
101
- - name: implementation
102
- pattern: "implementation.md | implementation-r{N}.md"
171
+ - name: code
172
+ pattern: "code.md | code-r{N}.md"
103
173
  rule: "读取最高轮次的实现产物作为审查输入"
104
174
  outputs:
105
- - name: review
106
- pattern: "review.md | review-r{N}.md"
107
- rule: "扫描现有审查产物;首轮创建 review.md,后续轮次创建 review-r{N}.md(N = 当前最高轮次 + 1)"
175
+ - name: review-code
176
+ pattern: "review-code.md | review-code-r{N}.md"
177
+ rule: "扫描现有代码审查产物;首轮创建 review-code.md,后续轮次创建 review-code-r{N}.md(N = 当前最高轮次 + 1)"
108
178
  outputs:
109
- - 审查报告
179
+ - 代码审查报告
110
180
  - 问题列表(如有)
111
181
 
112
- - name: fix
113
- description: 处理审查中发现的问题。
114
- recommended_agents:
115
- - codex
116
- - cursor
117
- tasks:
118
- - 修复审查中识别的问题
119
- - 根据需要更新测试
120
- - 验证所有测试通过
121
- - 确保无回归问题
122
- inputs:
123
- - 审查报告
124
- - 重构分支
125
- artifact_versioning:
126
- inputs:
127
- - name: review
128
- pattern: "review.md | review-r{N}.md"
129
- rule: "读取最高轮次的审查产物,并校验其与 task.md Activity Log 中最近一条 Code Review 记录一致"
130
- outputs:
131
- - name: refinement
132
- pattern: "refinement.md | refinement-r{N}.md"
133
- rule: "扫描现有修复产物;首轮创建 refinement.md,后续轮次创建 refinement-r{N}.md(N = 当前最高轮次 + 1)"
134
- outputs:
135
- - 包含修复的更新分支
136
- - 更新后的任务文件
137
-
138
182
  - name: commit
139
- description: 最终确认重构并创建拉取请求。
183
+ description: 最终确认重构并创建拉取请求(PR 部分仅在项目启用 PR 流程时执行)。
140
184
  recommended_agents:
141
185
  - claude
142
186
  - human
143
187
  tasks:
144
188
  - 确保所有测试通过
145
189
  - 编写清晰的提交信息说明重构内容
190
+ - 将任务移至已完成
191
+ pr_tasks:
146
192
  - 创建包含详细变更描述的拉取请求
147
193
  - 将 PR 关联到相关 Issue
148
- - 将任务移至已完成
149
194
  inputs:
150
195
  - 最终重构分支
151
196
  - 任务文件
152
197
  outputs:
153
- - 拉取请求
154
198
  - 已完成的任务文件(位于 .agents/workspace/completed/)
199
+ - 拉取请求(仅项目启用 PR 流程时)
@@ -0,0 +1,8 @@
1
+ ---
2
+ description: "Code a task from its technical plan and output a report"
3
+ usage: "/code-task <task-id>"
4
+ ---
5
+
6
+ Read and execute the code-task skill from `.agents/skills/code-task/SKILL.md`.
7
+
8
+ Follow all steps defined in the skill exactly.
@@ -0,0 +1,8 @@
1
+ ---
2
+ description: "根据技术方案编码任务并输出报告"
3
+ usage: "/code-task <task-id>"
4
+ ---
5
+
6
+ 读取并执行 `.agents/skills/code-task/SKILL.md` 中的 code-task 技能。
7
+
8
+ 严格按照技能中定义的所有步骤执行。
@@ -0,0 +1,8 @@
1
+ ---
2
+ description: "Review a requirement analysis report"
3
+ usage: "/review-analysis <task-id>"
4
+ ---
5
+
6
+ Read and execute the review-analysis skill from `.agents/skills/review-analysis/SKILL.md`.
7
+
8
+ Follow all steps defined in the skill exactly.
@@ -0,0 +1,8 @@
1
+ ---
2
+ description: "审查需求分析报告"
3
+ usage: "/review-analysis <task-id>"
4
+ ---
5
+
6
+ 读取并执行 `.agents/skills/review-analysis/SKILL.md` 中的 review-analysis 技能。
7
+
8
+ 严格按照技能中定义的所有步骤执行。
@@ -0,0 +1,8 @@
1
+ ---
2
+ description: "Review code implementation and output a code review report"
3
+ usage: "/review-code <task-id>"
4
+ ---
5
+
6
+ Read and execute the review-code skill from `.agents/skills/review-code/SKILL.md`.
7
+
8
+ Follow all steps defined in the skill exactly.
@@ -0,0 +1,8 @@
1
+ ---
2
+ description: "审查代码实现并输出代码审查报告"
3
+ usage: "/review-code <task-id>"
4
+ ---
5
+
6
+ 读取并执行 `.agents/skills/review-code/SKILL.md` 中的 review-code 技能。
7
+
8
+ 严格按照技能中定义的所有步骤执行。
@@ -0,0 +1,8 @@
1
+ ---
2
+ description: "Review a technical plan"
3
+ usage: "/review-plan <task-id>"
4
+ ---
5
+
6
+ Read and execute the review-plan skill from `.agents/skills/review-plan/SKILL.md`.
7
+
8
+ Follow all steps defined in the skill exactly.
@@ -0,0 +1,8 @@
1
+ ---
2
+ description: "审查技术方案"
3
+ usage: "/review-plan <task-id>"
4
+ ---
5
+
6
+ 读取并执行 `.agents/skills/review-plan/SKILL.md` 中的 review-plan 技能。
7
+
8
+ 严格按照技能中定义的所有步骤执行。
@@ -2,7 +2,7 @@ description = "归档已完成任务到按日期组织的目录"
2
2
  prompt = """
3
3
  归档已完成任务:{{args}}
4
4
 
5
- {{project}} 归档已完成任务。
5
+ agent-infra 归档已完成任务。
6
6
 
7
7
  读取并执行 `.agents/skills/archive-tasks/SKILL.md` 中的 archive-tasks 技能。
8
8
 
@@ -0,0 +1,8 @@
1
+ description = "Code a task from its technical plan and output a report"
2
+ prompt = """
3
+ Code task {{args}}.
4
+
5
+ Read and execute the code-task skill from `.agents/skills/code-task/SKILL.md`.
6
+
7
+ Follow all steps defined in the skill exactly.
8
+ """
@@ -0,0 +1,8 @@
1
+ description = "根据技术方案编码任务并输出报告"
2
+ prompt = """
3
+ 编码任务 {{args}}。
4
+
5
+ 读取并执行 `.agents/skills/code-task/SKILL.md` 中的 code-task 技能。
6
+
7
+ 严格按照技能中定义的所有步骤执行。
8
+ """
@@ -1,6 +1,6 @@
1
1
  description = "初始化仓库的 labels 体系"
2
2
  prompt = """
3
- {{project}} 初始化 labels。
3
+ agent-infra 初始化 labels。
4
4
 
5
5
  读取并执行 `.agents/skills/init-labels/SKILL.md` 中的 init-labels 技能。
6
6
 
@@ -2,7 +2,7 @@ description = "初始化仓库的 milestones 体系"
2
2
  prompt = """
3
3
  初始化里程碑:{{args}}
4
4
 
5
- {{project}} 初始化 milestones。
5
+ agent-infra 初始化 milestones。
6
6
 
7
7
  读取并执行 `.agents/skills/init-milestones/SKILL.md` 中的 init-milestones 技能。
8
8
 
@@ -0,0 +1,8 @@
1
+ description = "Review a requirement analysis report"
2
+ prompt = """
3
+ Review analysis for task {{args}}.
4
+
5
+ Read and execute the review-analysis skill from `.agents/skills/review-analysis/SKILL.md`.
6
+
7
+ Follow all steps defined in the skill exactly.
8
+ """
@@ -0,0 +1,8 @@
1
+ description = "审查需求分析报告"
2
+ prompt = """
3
+ 审查任务 {{args}} 的需求分析。
4
+
5
+ 读取并执行 `.agents/skills/review-analysis/SKILL.md` 中的 review-analysis 技能。
6
+
7
+ 严格按照技能中定义的所有步骤执行。
8
+ """
@@ -0,0 +1,8 @@
1
+ description = "Review code implementation and output a code review report"
2
+ prompt = """
3
+ Review code for task {{args}}.
4
+
5
+ Read and execute the review-code skill from `.agents/skills/review-code/SKILL.md`.
6
+
7
+ Follow all steps defined in the skill exactly.
8
+ """
@@ -0,0 +1,8 @@
1
+ description = "审查代码实现并输出代码审查报告"
2
+ prompt = """
3
+ 审查任务 {{args}} 的代码。
4
+
5
+ 读取并执行 `.agents/skills/review-code/SKILL.md` 中的 review-code 技能。
6
+
7
+ 严格按照技能中定义的所有步骤执行。
8
+ """