@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.
- package/README.md +51 -25
- package/README.zh-CN.md +49 -23
- package/bin/cli.ts +1 -1
- package/dist/bin/cli.js +1 -1
- package/dist/lib/builtin-tuis.js +45 -0
- package/dist/lib/defaults.json +4 -0
- package/dist/lib/init.js +65 -23
- package/dist/lib/prompt.js +49 -1
- package/dist/lib/sandbox/commands/create.js +4 -2
- package/dist/lib/sandbox/commands/enter.js +15 -4
- package/dist/lib/sandbox/commands/list-running.js +153 -0
- package/dist/lib/sandbox/commands/ls.js +24 -45
- package/dist/lib/sandbox/commands/rebuild.js +7 -13
- package/dist/lib/sandbox/commands/rm.js +2 -0
- package/dist/lib/sandbox/config.js +3 -0
- package/dist/lib/sandbox/image-prune.js +18 -0
- package/dist/lib/sandbox/index.js +2 -1
- package/dist/lib/sandbox/runtimes/ai-tools.dockerfile +10 -6
- package/dist/lib/sandbox/task-resolver.js +18 -0
- package/dist/lib/sandbox/tools.js +213 -8
- package/dist/lib/update.js +70 -18
- package/lib/builtin-tuis.ts +55 -0
- package/lib/defaults.json +4 -0
- package/lib/init.ts +97 -35
- package/lib/prompt.ts +54 -1
- package/lib/sandbox/commands/create.ts +10 -2
- package/lib/sandbox/commands/enter.ts +14 -4
- package/lib/sandbox/commands/list-running.ts +188 -0
- package/lib/sandbox/commands/ls.ts +28 -49
- package/lib/sandbox/commands/rebuild.ts +12 -14
- package/lib/sandbox/commands/rm.ts +3 -0
- package/lib/sandbox/config.ts +7 -0
- package/lib/sandbox/image-prune.ts +23 -0
- package/lib/sandbox/index.ts +2 -1
- package/lib/sandbox/runtimes/ai-tools.dockerfile +10 -6
- package/lib/sandbox/task-resolver.ts +23 -1
- package/lib/sandbox/tools.ts +248 -9
- package/lib/update.ts +85 -30
- package/package.json +1 -1
- package/templates/.agents/QUICKSTART.en.md +1 -1
- package/templates/.agents/QUICKSTART.zh-CN.md +1 -1
- package/templates/.agents/README.en.md +111 -2
- package/templates/.agents/README.zh-CN.md +111 -2
- package/templates/.agents/rules/create-issue.en.md +1 -1
- package/templates/.agents/rules/create-issue.github.en.md +1 -1
- package/templates/.agents/rules/create-issue.github.zh-CN.md +1 -1
- package/templates/.agents/rules/create-issue.zh-CN.md +1 -1
- package/templates/.agents/rules/issue-sync.github.en.md +6 -5
- package/templates/.agents/rules/issue-sync.github.zh-CN.md +6 -5
- package/templates/.agents/rules/milestone-inference.github.en.md +2 -2
- package/templates/.agents/rules/milestone-inference.github.zh-CN.md +2 -2
- package/templates/.agents/rules/no-mid-flow-questions.en.md +57 -0
- package/templates/.agents/rules/no-mid-flow-questions.zh-CN.md +57 -0
- package/templates/.agents/rules/pr-sync.github.en.md +4 -5
- package/templates/.agents/rules/pr-sync.github.zh-CN.md +4 -5
- package/templates/.agents/rules/task-management.en.md +9 -6
- package/templates/.agents/rules/task-management.zh-CN.md +9 -6
- package/templates/.agents/rules/task-short-id.en.md +141 -0
- package/templates/.agents/rules/task-short-id.zh-CN.md +124 -0
- package/templates/.agents/rules/testing-discipline.en.md +2 -2
- package/templates/.agents/rules/testing-discipline.zh-CN.md +2 -2
- package/templates/.agents/scripts/task-short-id.js +713 -0
- package/templates/.agents/scripts/validate-artifact.js +1 -1
- package/templates/.agents/skills/analyze-task/SKILL.en.md +20 -4
- package/templates/.agents/skills/analyze-task/SKILL.zh-CN.md +20 -5
- package/templates/.agents/skills/block-task/SKILL.en.md +12 -0
- package/templates/.agents/skills/block-task/SKILL.zh-CN.md +12 -1
- package/templates/.agents/skills/cancel-task/SKILL.en.md +12 -0
- package/templates/.agents/skills/cancel-task/SKILL.zh-CN.md +12 -1
- package/templates/.agents/skills/check-task/SKILL.en.md +47 -32
- package/templates/.agents/skills/check-task/SKILL.zh-CN.md +46 -32
- package/templates/.agents/skills/close-codescan/SKILL.en.md +11 -0
- package/templates/.agents/skills/close-codescan/SKILL.zh-CN.md +11 -0
- package/templates/.agents/skills/close-dependabot/SKILL.en.md +11 -0
- package/templates/.agents/skills/close-dependabot/SKILL.zh-CN.md +11 -0
- package/templates/.agents/skills/code-task/SKILL.en.md +121 -0
- package/templates/.agents/skills/{implement-task → code-task}/SKILL.zh-CN.md +55 -25
- package/templates/.agents/skills/{implement-task → code-task}/config/verify.en.json +4 -4
- package/templates/.agents/skills/{implement-task → code-task}/config/verify.zh-CN.json +4 -4
- package/templates/.agents/skills/{implement-task → code-task}/reference/branch-management.zh-CN.md +2 -2
- package/templates/.agents/skills/{implement-task/reference/implementation-rules.en.md → code-task/reference/code-rules.en.md} +6 -6
- package/templates/.agents/skills/{implement-task/reference/implementation-rules.zh-CN.md → code-task/reference/code-rules.zh-CN.md} +3 -3
- package/templates/.agents/skills/code-task/reference/dual-mode.en.md +69 -0
- package/templates/.agents/skills/code-task/reference/dual-mode.zh-CN.md +69 -0
- package/templates/.agents/skills/{refine-task/reference/fix-workflow.en.md → code-task/reference/fix-mode.en.md} +12 -12
- package/templates/.agents/skills/{refine-task/reference/fix-workflow.zh-CN.md → code-task/reference/fix-mode.zh-CN.md} +8 -8
- package/templates/.agents/skills/code-task/reference/output-template.en.md +20 -0
- package/templates/.agents/skills/code-task/reference/output-template.zh-CN.md +20 -0
- package/templates/.agents/skills/{implement-task → code-task}/reference/report-template.en.md +4 -4
- package/templates/.agents/skills/{implement-task → code-task}/reference/report-template.zh-CN.md +3 -3
- package/templates/.agents/skills/code-task/scripts/detect-mode.js +370 -0
- package/templates/.agents/skills/commit/SKILL.en.md +6 -2
- package/templates/.agents/skills/commit/SKILL.zh-CN.md +6 -2
- package/templates/.agents/skills/commit/reference/task-status-update.en.md +10 -6
- package/templates/.agents/skills/commit/reference/task-status-update.zh-CN.md +10 -6
- package/templates/.agents/skills/complete-task/SKILL.en.md +17 -3
- package/templates/.agents/skills/complete-task/SKILL.zh-CN.md +17 -4
- package/templates/.agents/skills/create-pr/SKILL.en.md +21 -1
- package/templates/.agents/skills/create-pr/SKILL.zh-CN.md +21 -1
- package/templates/.agents/skills/create-task/SKILL.en.md +14 -0
- package/templates/.agents/skills/create-task/SKILL.zh-CN.md +14 -1
- package/templates/.agents/skills/import-codescan/SKILL.en.md +15 -1
- package/templates/.agents/skills/import-codescan/SKILL.zh-CN.md +15 -1
- package/templates/.agents/skills/import-dependabot/SKILL.en.md +16 -2
- package/templates/.agents/skills/import-dependabot/SKILL.zh-CN.md +16 -2
- package/templates/.agents/skills/import-issue/SKILL.en.md +17 -3
- package/templates/.agents/skills/import-issue/SKILL.zh-CN.md +17 -3
- package/templates/.agents/skills/plan-task/SKILL.en.md +8 -4
- package/templates/.agents/skills/plan-task/SKILL.zh-CN.md +8 -5
- package/templates/.agents/skills/restore-task/SKILL.en.md +16 -3
- package/templates/.agents/skills/restore-task/SKILL.zh-CN.md +16 -4
- package/templates/.agents/skills/review-analysis/SKILL.en.md +80 -0
- package/templates/.agents/skills/review-analysis/SKILL.zh-CN.md +105 -0
- package/templates/.agents/skills/review-analysis/config/verify.en.json +51 -0
- package/templates/.agents/skills/review-analysis/config/verify.zh-CN.json +51 -0
- package/templates/.agents/skills/review-analysis/reference/output-templates.en.md +87 -0
- package/templates/.agents/skills/review-analysis/reference/output-templates.zh-CN.md +87 -0
- package/templates/.agents/skills/review-analysis/reference/report-template.en.md +90 -0
- package/templates/.agents/skills/review-analysis/reference/report-template.zh-CN.md +91 -0
- package/templates/.agents/skills/review-analysis/reference/review-criteria.en.md +47 -0
- package/templates/.agents/skills/review-analysis/reference/review-criteria.zh-CN.md +47 -0
- package/templates/.agents/skills/{review-task → review-code}/SKILL.en.md +15 -9
- package/templates/.agents/skills/{review-task → review-code}/SKILL.zh-CN.md +19 -10
- package/templates/.agents/skills/{review-task → review-code}/config/verify.en.json +7 -5
- package/templates/.agents/skills/{review-task → review-code}/config/verify.zh-CN.json +6 -4
- package/templates/.agents/skills/{review-task → review-code}/reference/output-templates.en.md +21 -17
- package/templates/.agents/skills/{review-task → review-code}/reference/output-templates.zh-CN.md +19 -15
- package/templates/.agents/skills/{review-task → review-code}/reference/report-template.en.md +5 -6
- package/templates/.agents/skills/review-code/reference/report-template.zh-CN.md +91 -0
- package/templates/.agents/skills/review-code/reference/review-criteria.en.md +48 -0
- package/templates/.agents/skills/{review-task → review-code}/reference/review-criteria.zh-CN.md +10 -4
- package/templates/.agents/skills/review-plan/SKILL.en.md +80 -0
- package/templates/.agents/skills/review-plan/SKILL.zh-CN.md +105 -0
- package/templates/.agents/skills/{refine-task → review-plan}/config/verify.en.json +14 -10
- package/templates/.agents/skills/{refine-task → review-plan}/config/verify.zh-CN.json +14 -10
- package/templates/.agents/skills/review-plan/reference/output-templates.en.md +87 -0
- package/templates/.agents/skills/review-plan/reference/output-templates.zh-CN.md +87 -0
- package/templates/.agents/skills/review-plan/reference/report-template.en.md +90 -0
- package/templates/.agents/skills/{review-task → review-plan}/reference/report-template.zh-CN.md +3 -3
- package/templates/.agents/skills/review-plan/reference/review-criteria.en.md +47 -0
- package/templates/.agents/skills/review-plan/reference/review-criteria.zh-CN.md +47 -0
- package/templates/.agents/skills/test/SKILL.en.md +2 -2
- package/templates/.agents/skills/test/SKILL.zh-CN.md +13 -31
- package/templates/.agents/skills/update-agent-infra/SKILL.en.md +1 -0
- package/templates/.agents/skills/update-agent-infra/SKILL.zh-CN.md +1 -0
- package/templates/.agents/skills/update-agent-infra/scripts/sync-templates.js +113 -21
- package/templates/.agents/templates/task.en.md +4 -3
- package/templates/.agents/templates/task.zh-CN.md +3 -2
- package/templates/.agents/workflows/bug-fix.en.yaml +126 -80
- package/templates/.agents/workflows/bug-fix.zh-CN.yaml +90 -44
- package/templates/.agents/workflows/feature-development.en.yaml +115 -70
- package/templates/.agents/workflows/feature-development.zh-CN.yaml +92 -47
- package/templates/.agents/workflows/refactoring.en.yaml +123 -78
- package/templates/.agents/workflows/refactoring.zh-CN.yaml +89 -44
- package/templates/.claude/commands/code-task.en.md +8 -0
- package/templates/.claude/commands/code-task.zh-CN.md +8 -0
- package/templates/.claude/commands/review-analysis.en.md +8 -0
- package/templates/.claude/commands/review-analysis.zh-CN.md +8 -0
- package/templates/.claude/commands/review-code.en.md +8 -0
- package/templates/.claude/commands/review-code.zh-CN.md +8 -0
- package/templates/.claude/commands/review-plan.en.md +8 -0
- package/templates/.claude/commands/review-plan.zh-CN.md +8 -0
- package/templates/.gemini/commands/_project_/archive-tasks.zh-CN.toml +1 -1
- package/templates/.gemini/commands/_project_/code-task.en.toml +8 -0
- package/templates/.gemini/commands/_project_/code-task.zh-CN.toml +8 -0
- package/templates/.gemini/commands/_project_/init-labels.zh-CN.toml +1 -1
- package/templates/.gemini/commands/_project_/init-milestones.zh-CN.toml +1 -1
- package/templates/.gemini/commands/_project_/review-analysis.en.toml +8 -0
- package/templates/.gemini/commands/_project_/review-analysis.zh-CN.toml +8 -0
- package/templates/.gemini/commands/_project_/review-code.en.toml +8 -0
- package/templates/.gemini/commands/_project_/review-code.zh-CN.toml +8 -0
- package/templates/.gemini/commands/_project_/review-plan.en.toml +8 -0
- package/templates/.gemini/commands/_project_/review-plan.zh-CN.toml +8 -0
- package/templates/.opencode/commands/code-task.en.md +11 -0
- package/templates/.opencode/commands/code-task.zh-CN.md +11 -0
- package/templates/.opencode/commands/review-analysis.en.md +11 -0
- package/templates/.opencode/commands/review-analysis.zh-CN.md +11 -0
- package/templates/.opencode/commands/review-code.en.md +11 -0
- package/templates/.opencode/commands/review-code.zh-CN.md +11 -0
- package/templates/.opencode/commands/review-plan.en.md +11 -0
- package/templates/.opencode/commands/review-plan.zh-CN.md +11 -0
- package/templates/.agents/skills/implement-task/SKILL.en.md +0 -173
- package/templates/.agents/skills/implement-task/reference/output-template.en.md +0 -20
- package/templates/.agents/skills/implement-task/reference/output-template.zh-CN.md +0 -20
- package/templates/.agents/skills/refine-task/SKILL.en.md +0 -153
- package/templates/.agents/skills/refine-task/SKILL.zh-CN.md +0 -153
- package/templates/.agents/skills/refine-task/reference/report-template.en.md +0 -64
- package/templates/.agents/skills/refine-task/reference/report-template.zh-CN.md +0 -64
- package/templates/.agents/skills/review-task/reference/review-criteria.en.md +0 -42
- package/templates/.claude/commands/implement-task.en.md +0 -8
- package/templates/.claude/commands/implement-task.zh-CN.md +0 -8
- package/templates/.claude/commands/refine-task.en.md +0 -8
- package/templates/.claude/commands/refine-task.zh-CN.md +0 -8
- package/templates/.claude/commands/review-task.en.md +0 -8
- package/templates/.claude/commands/review-task.zh-CN.md +0 -8
- package/templates/.gemini/commands/_project_/implement-task.en.toml +0 -8
- package/templates/.gemini/commands/_project_/implement-task.zh-CN.toml +0 -8
- package/templates/.gemini/commands/_project_/refine-task.en.toml +0 -8
- package/templates/.gemini/commands/_project_/refine-task.zh-CN.toml +0 -8
- package/templates/.gemini/commands/_project_/review-task.en.toml +0 -8
- package/templates/.gemini/commands/_project_/review-task.zh-CN.toml +0 -8
- package/templates/.opencode/commands/implement-task.en.md +0 -11
- package/templates/.opencode/commands/implement-task.zh-CN.md +0 -11
- package/templates/.opencode/commands/refine-task.en.md +0 -11
- package/templates/.opencode/commands/refine-task.zh-CN.md +0 -11
- package/templates/.opencode/commands/review-task.en.md +0 -11
- package/templates/.opencode/commands/review-task.zh-CN.md +0 -11
- /package/templates/.agents/skills/{implement-task → code-task}/reference/branch-management.en.md +0 -0
|
@@ -0,0 +1,121 @@
|
|
|
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
|
+
## Task id short ref
|
|
33
|
+
|
|
34
|
+
> If `{task-id}` begins with `#`, follow the "SKILL parameter resolver" section of `.agents/rules/task-short-id.md`; treat `{task-id}` as the resolved full `TASK-YYYYMMDD-HHMMSS` form for every downstream command.
|
|
35
|
+
|
|
36
|
+
## Steps
|
|
37
|
+
|
|
38
|
+
### 1. Verify Prerequisites
|
|
39
|
+
|
|
40
|
+
Require `task.md` and at least one plan artifact: `plan.md` or `plan-r{N}.md`.
|
|
41
|
+
|
|
42
|
+
### 2. Ensure the Task Branch
|
|
43
|
+
|
|
44
|
+
Read `reference/branch-management.md`, ensure the current branch matches the task branch, and write the final branch back to task.md when needed.
|
|
45
|
+
|
|
46
|
+
### 3. Narrow the Milestone
|
|
47
|
+
|
|
48
|
+
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`.
|
|
49
|
+
|
|
50
|
+
### 4. Determine Mode and Round
|
|
51
|
+
|
|
52
|
+
Run mode detection and preserve its exit code:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
result=$(node .agents/skills/code-task/scripts/detect-mode.js .agents/workspace/active/{task-id})
|
|
56
|
+
status=$?
|
|
57
|
+
echo "$result"
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Dispatch by `$status` and `result.mode`:
|
|
61
|
+
|
|
62
|
+
- `0` + `"init"`: initial implementation; record `{code-artifact}` and `{code-round}`
|
|
63
|
+
- `0` + `"fix"`: fix mode; record `{code-artifact}`, `{code-round}`, and `{review-artifact}`
|
|
64
|
+
- `1` + `"refused"`: print `result.message`, stop, and do not write an artifact or Activity Log entry
|
|
65
|
+
- `2` + `"error"`: print `result.message`, stop, and do not write an artifact or Activity Log entry
|
|
66
|
+
|
|
67
|
+
> Read `reference/dual-mode.md` before this step.
|
|
68
|
+
|
|
69
|
+
### 5. Determine the Input Plan
|
|
70
|
+
|
|
71
|
+
Read the highest-round plan artifact and use the `{code-artifact}` selected in step 4. In fix mode, also read `{review-artifact}`.
|
|
72
|
+
|
|
73
|
+
### 6. Read the Technical Plan
|
|
74
|
+
|
|
75
|
+
Extract implementation steps, files, test strategy, constraints, risks, and approved tradeoffs.
|
|
76
|
+
|
|
77
|
+
### 7. Implement the Code
|
|
78
|
+
|
|
79
|
+
Follow the plan in order.
|
|
80
|
+
|
|
81
|
+
> Read `reference/code-rules.md` before implementation.
|
|
82
|
+
> In fix mode, read `reference/fix-mode.md` before editing.
|
|
83
|
+
> Read `.agents/rules/testing-discipline.md` before adding or changing tests.
|
|
84
|
+
|
|
85
|
+
### 8. Run Test Verification
|
|
86
|
+
|
|
87
|
+
Use the project test commands from the `test` skill and iterate until all required tests pass.
|
|
88
|
+
|
|
89
|
+
### 9. Write the Code Report
|
|
90
|
+
|
|
91
|
+
Create `.agents/workspace/active/{task-id}/{code-artifact}`.
|
|
92
|
+
|
|
93
|
+
> Read `reference/report-template.md` before writing the report.
|
|
94
|
+
|
|
95
|
+
### 10. Update Task Status
|
|
96
|
+
|
|
97
|
+
Get the current time:
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
date "+%Y-%m-%d %H:%M:%S%:z"
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Set `current_step` to `code`, refresh task metadata, and append one Activity Log entry:
|
|
104
|
+
|
|
105
|
+
- initial implementation: `Code (Round {N})`
|
|
106
|
+
- fix mode: `Code (Round {N}, fix for {review-artifact})`
|
|
107
|
+
|
|
108
|
+
If task.md has a valid `issue_number`, read `.agents/rules/issue-sync.md`, then:
|
|
109
|
+
- Set `status: in-progress` according to issue-sync.md
|
|
110
|
+
- Create or update the task comment marker defined in `.agents/rules/issue-sync.md`
|
|
111
|
+
- Publish the `{code-artifact}` comment
|
|
112
|
+
|
|
113
|
+
### 11. Run Completion Gate
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
node .agents/scripts/validate-artifact.js gate code-task .agents/workspace/active/{task-id} {code-artifact} --format text
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### 12. Tell the User
|
|
120
|
+
|
|
121
|
+
Use `reference/output-template.md` and show all TUI command formats.
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
---
|
|
2
|
-
name:
|
|
3
|
-
description: "
|
|
2
|
+
name: code-task
|
|
3
|
+
description: "根据技术方案编码任务并输出报告"
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
#
|
|
6
|
+
# 编码任务
|
|
7
7
|
|
|
8
|
-
|
|
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
|
|
@@ -41,8 +42,11 @@ tail .agents/workspace/active/{task-id}/task.md
|
|
|
41
42
|
|
|
42
43
|
状态核对完成前,禁止任何关于外部状态的断言(例如“代码没变”“测试已通过”“没有其他引用”),包括思考阶段。本门禁只提供结构下限;逐条证据配对和真实性仍需按报告模板与审查要求核对。
|
|
43
44
|
|
|
44
|
-
##
|
|
45
|
+
## 任务入参短号别名
|
|
46
|
+
|
|
47
|
+
> 如果 `{task-id}` 入参以 `#` 开头,先读取 `.agents/rules/task-short-id.md` 的「SKILL 入参解析」段执行解析;后续命令视 `{task-id}` 为解析后的全长 `TASK-YYYYMMDD-HHMMSS` 形式。
|
|
45
48
|
|
|
49
|
+
## 执行步骤
|
|
46
50
|
### 1. 验证前置条件
|
|
47
51
|
|
|
48
52
|
先检查:
|
|
@@ -66,18 +70,40 @@ tail .agents/workspace/active/{task-id}/task.md
|
|
|
66
70
|
|
|
67
71
|
### 3. 收窄里程碑
|
|
68
72
|
|
|
69
|
-
如果 task.md 中存在有效的 `issue_number`,执行前先读取 `.agents/rules/issue-sync.md`,完成 upstream 仓库检测和权限检测;再读取 `.agents/rules/milestone-inference.md`,按其中的「阶段 2:`
|
|
73
|
+
如果 task.md 中存在有效的 `issue_number`,执行前先读取 `.agents/rules/issue-sync.md`,完成 upstream 仓库检测和权限检测;再读取 `.agents/rules/milestone-inference.md`,按其中的「阶段 2:`code-task`」收窄 Issue milestone;如果 `has_triage=false`,则保持原 milestone 不变。
|
|
74
|
+
|
|
75
|
+
### 4. 确定模式与轮次
|
|
76
|
+
|
|
77
|
+
执行 mode detection 脚本,先保存 exit code 再处理输出:
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
result=$(node .agents/skills/code-task/scripts/detect-mode.js .agents/workspace/active/{task-id})
|
|
81
|
+
status=$?
|
|
82
|
+
echo "$result"
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
按 `$status` 与 `result.mode` 分流;二者不一致时按 `$status` 为准并报告异常:
|
|
70
86
|
|
|
71
|
-
|
|
87
|
+
| `$status` | `result.mode` | 行动 |
|
|
88
|
+
|---|---|---|
|
|
89
|
+
| 0 | `"init"` | 进入初次实现模式。记录 `{code-artifact}` = `result.next_artifact`、`{code-round}` = `result.next_round` |
|
|
90
|
+
| 0 | `"fix"` | 进入修复模式。记录 `{code-artifact}` = `result.next_artifact`、`{code-round}` = `result.next_round`、`{review-artifact}` = `result.review_artifact` |
|
|
91
|
+
| 1 | `"refused"` | 输出 `result.message` 给用户;立即停止;不写 Activity Log、不创建产物 |
|
|
92
|
+
| 2 | `"error"` | 输出 `result.message` 给用户;立即停止;不写 Activity Log、不创建产物 |
|
|
93
|
+
| 其他 | 任意 | 视为脚本异常,输出 `Mode detection failed: status={status}, output={result}` 并停止 |
|
|
94
|
+
|
|
95
|
+
> 双模式判定规则见 `reference/dual-mode.md`。执行此步骤前先读取 `reference/dual-mode.md`。
|
|
96
|
+
|
|
97
|
+
### 5. 确定输入方案
|
|
72
98
|
|
|
73
99
|
扫描 `.agents/workspace/active/{task-id}/` 并记录:
|
|
74
100
|
- 最高轮次的方案文件为 `{plan-artifact}`
|
|
75
|
-
-
|
|
76
|
-
-
|
|
101
|
+
- 使用步骤 4 记录的 `{code-round}` 与 `{code-artifact}`
|
|
102
|
+
- 若为修复模式,同时记录 `{review-artifact}`
|
|
77
103
|
|
|
78
104
|
如果存在 `plan-r{N}.md`,读取最高轮次的方案文件;否则读取 `plan.md`。
|
|
79
105
|
|
|
80
|
-
###
|
|
106
|
+
### 6. 阅读技术方案
|
|
81
107
|
|
|
82
108
|
仔细阅读 `{plan-artifact}`,提取:
|
|
83
109
|
- 实施步骤
|
|
@@ -85,26 +111,29 @@ tail .agents/workspace/active/{task-id}/task.md
|
|
|
85
111
|
- 测试策略
|
|
86
112
|
- 约束、风险与已批准的取舍
|
|
87
113
|
|
|
88
|
-
|
|
114
|
+
修复模式还必须读取 `{review-artifact}`,并只处理其中标记的问题。
|
|
115
|
+
|
|
116
|
+
### 7. 执行代码实现
|
|
89
117
|
|
|
90
118
|
按照 `.agents/workflows/feature-development.yaml` 和方案顺序实施。
|
|
91
119
|
|
|
92
|
-
> 详细实现规则、测试执行循环和偏离处理见 `reference/
|
|
120
|
+
> 详细实现规则、测试执行循环和偏离处理见 `reference/code-rules.md`。执行此步骤前,先读取 `reference/code-rules.md`。
|
|
121
|
+
> 修复模式的范围纪律见 `reference/fix-mode.md`。进入修复模式前先读取 `reference/fix-mode.md`。
|
|
93
122
|
> 测试编写纪律(RED-GREEN-REFACTOR 与反模式)见 `.agents/rules/testing-discipline.md`;新增或调整测试前先读取该文件。
|
|
94
123
|
|
|
95
|
-
###
|
|
124
|
+
### 8. 运行测试验证
|
|
96
125
|
|
|
97
126
|
使用 `test` 技能中的项目测试命令,直到所有必需测试通过。
|
|
98
127
|
|
|
99
128
|
如果测试失败,先尝试修复并重新运行测试。只有在确认存在外部阻塞、环境缺失或需求不明确且超出任务范围时,才可以停止。
|
|
100
129
|
|
|
101
|
-
###
|
|
130
|
+
### 9. 编写实现报告
|
|
102
131
|
|
|
103
|
-
创建 `.agents/workspace/active/{task-id}/{
|
|
132
|
+
创建 `.agents/workspace/active/{task-id}/{code-artifact}`。
|
|
104
133
|
|
|
105
134
|
> 报告结构、必填章节和完整模板见 `reference/report-template.md`。写报告前先读取 `reference/report-template.md`。
|
|
106
135
|
|
|
107
|
-
###
|
|
136
|
+
### 10. 更新任务状态
|
|
108
137
|
|
|
109
138
|
获取当前时间:
|
|
110
139
|
|
|
@@ -113,26 +142,27 @@ date "+%Y-%m-%d %H:%M:%S%:z"
|
|
|
113
142
|
```
|
|
114
143
|
|
|
115
144
|
更新 `.agents/workspace/active/{task-id}/task.md`:
|
|
116
|
-
- `current_step`:
|
|
145
|
+
- `current_step`:code
|
|
117
146
|
- `assigned_to`:{当前代理}
|
|
118
147
|
- `updated_at`:{当前时间}
|
|
119
148
|
- `agent_infra_version`:按 `.agents/rules/version-stamp.md` 取值
|
|
120
149
|
- 审查 `## 需求` 段落,仅把本轮已由代码实现且有测试通过支撑的条目从 `- [ ]` 勾为 `- [x]`
|
|
121
|
-
- 记录 Round `{
|
|
150
|
+
- 记录 Round `{code-round}` 的 `{code-artifact}`
|
|
122
151
|
- 追加:
|
|
123
|
-
|
|
152
|
+
- 初次实现:`- {YYYY-MM-DD HH:mm:ss±HH:MM} — **Code (Round {N})** by {agent} — Code implemented, {n} files modified, {n} tests passed → {code-artifact}`
|
|
153
|
+
- 修复模式:`- {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
154
|
|
|
125
155
|
如果 task.md 中存在有效的 `issue_number`,执行以下同步操作(任一失败则跳过并继续;执行前先读取 `.agents/rules/issue-sync.md`,完成 upstream 仓库检测和权限检测):
|
|
126
156
|
- 按 issue-sync.md 设置 `status: in-progress`
|
|
127
157
|
- 创建或更新 `.agents/rules/issue-sync.md` 中定义的 task 评论标记(按 issue-sync.md 的 task.md 评论同步规则)
|
|
128
|
-
- 发布 `{
|
|
158
|
+
- 发布 `{code-artifact}` 评论
|
|
129
159
|
|
|
130
|
-
###
|
|
160
|
+
### 11. 完成校验
|
|
131
161
|
|
|
132
162
|
运行完成校验,确认任务产物和同步状态符合规范:
|
|
133
163
|
|
|
134
164
|
```bash
|
|
135
|
-
node .agents/scripts/validate-artifact.js gate
|
|
165
|
+
node .agents/scripts/validate-artifact.js gate code-task .agents/workspace/active/{task-id} {code-artifact} --format text
|
|
136
166
|
```
|
|
137
167
|
|
|
138
168
|
处理结果:
|
|
@@ -142,7 +172,7 @@ node .agents/scripts/validate-artifact.js gate implement-task .agents/workspace/
|
|
|
142
172
|
|
|
143
173
|
将校验输出保留在回复中作为当次验证输出。没有当次校验输出,不得声明完成。
|
|
144
174
|
|
|
145
|
-
###
|
|
175
|
+
### 12. 告知用户
|
|
146
176
|
|
|
147
177
|
> 仅在校验通过后执行本步骤。
|
|
148
178
|
|
|
@@ -151,7 +181,7 @@ node .agents/scripts/validate-artifact.js gate implement-task .agents/workspace/
|
|
|
151
181
|
## 完成检查清单
|
|
152
182
|
|
|
153
183
|
- [ ] 已完成批准范围内的代码实现
|
|
154
|
-
- [ ] 已创建 `{
|
|
184
|
+
- [ ] 已创建 `{code-artifact}`
|
|
155
185
|
- [ ] 所有必需测试通过
|
|
156
186
|
- [ ] 已更新 task.md 并追加 Activity Log
|
|
157
187
|
- [ ] 已向用户展示所有 TUI 格式的下一步命令(含自定义 TUI)
|
|
@@ -162,7 +192,7 @@ node .agents/scripts/validate-artifact.js gate implement-task .agents/workspace/
|
|
|
162
192
|
|
|
163
193
|
## 注意事项
|
|
164
194
|
|
|
165
|
-
- 首轮实现使用 `
|
|
195
|
+
- 首轮实现使用 `code.md`,后续轮次使用 `code-r{N}.md`
|
|
166
196
|
- 如偏离 `{plan-artifact}`,必须在报告中记录原因
|
|
167
197
|
- 新测试必须验证有意义的业务行为,而不是机械透传
|
|
168
198
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"skill": "
|
|
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": "
|
|
16
|
+
"expected_step": "code"
|
|
17
17
|
},
|
|
18
18
|
"artifact": {
|
|
19
|
-
"file_pattern": "
|
|
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": "
|
|
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": "
|
|
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": "
|
|
16
|
+
"expected_step": "code"
|
|
17
17
|
},
|
|
18
18
|
"artifact": {
|
|
19
|
-
"file_pattern": "
|
|
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": "
|
|
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": {
|
package/templates/.agents/skills/{implement-task → code-task}/reference/branch-management.zh-CN.md
RENAMED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
## 分支名规则
|
|
6
6
|
|
|
7
|
-
- 格式:`
|
|
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
|
-
- 判断当前分支是否符合项目分支命名规范(`
|
|
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 `
|
|
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
|
|
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 `
|
|
43
|
-
- do not mark
|
|
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
|
|
53
|
-
6. **Versioning**: Round 1 uses `
|
|
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` 中的 `
|
|
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
|
-
- 停止,并且不要创建 `
|
|
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 使用 `
|
|
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`
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# code-task 双模式判定
|
|
2
|
+
|
|
3
|
+
本文件说明 `scripts/detect-mode.js` 的行为。脚本是单点真相;修改脚本时必须同步更新本文档。
|
|
4
|
+
|
|
5
|
+
## 输入
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
node .agents/skills/code-task/scripts/detect-mode.js .agents/workspace/active/{task-id}
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
脚本扫描任务目录中的 `plan.md` / `plan-r{N}.md`、`review-plan.md` / `review-plan-r{N}.md`、`code.md` / `code-r{N}.md` 和 `review-code.md` / `review-code-r{N}.md`。
|
|
12
|
+
|
|
13
|
+
## 8 个分支
|
|
14
|
+
|
|
15
|
+
> 分支按表中自上而下的顺序评估,命中即返回;后续分支不再判定。
|
|
16
|
+
|
|
17
|
+
| 条件 | mode | exit | 行为 |
|
|
18
|
+
|---|---|---:|---|
|
|
19
|
+
| 无 code 产物 | `init` | 0 | 初次实现,产物为 `code.md` |
|
|
20
|
+
| 最新 review-plan 已批准(`通过` 或 `通过 + major/minor 建议`,即 `Approved` 或 `Approved-with-issues`),且其「审查输入」/「Review Input」字段引用的 plan 文件 == 任务目录中最新的 `plan(-r{N})?.md`,且最新 review-plan 的 mtime > 最新 code 的 mtime | `init` | 0 | plan 已在 code 之后被批准;进入新一轮实现,`next_round = code_max + 1`、`next_artifact = code-r{next_round}.md`。**不论 review-code 是否已审**,本分支均先命中。plan 与 review-plan 的轮次独立递增(如 `plan-r5` 可被 `review-plan-r4` 批准),通过 review-plan 的「审查输入」字段建立批准关系,不要求同号 |
|
|
21
|
+
| `rev_max < code_max` | `error` | 2 | 最新代码未审查,先运行 `review-code` |
|
|
22
|
+
| `rev_max > code_max` | `error` | 2 | 数据状态异常,需要人工检查 |
|
|
23
|
+
| 最新 review-code 为 Approved 且 0/0/0 | `refused` | 1 | 已通过,无需再次运行 `code-task` |
|
|
24
|
+
| 最新 review-code 为 Approved 但有 major/minor | `fix` | 0 | 可选修复模式 |
|
|
25
|
+
| 最新 review-code 为 Changes Requested | `fix` | 0 | 必需修复模式 |
|
|
26
|
+
| 最新 review-code 为 Rejected | `refused` | 1 | 需要重新设计,不进入局部修复 |
|
|
27
|
+
|
|
28
|
+
## verdict 解析
|
|
29
|
+
|
|
30
|
+
脚本支持中文和英文 review-code 报告:
|
|
31
|
+
|
|
32
|
+
| 语义 | 中文 | 英文 |
|
|
33
|
+
|---|---|---|
|
|
34
|
+
| 摘要段落 | `## 审查摘要` | `## Review Summary` |
|
|
35
|
+
| 总体结论字段 | `**总体结论**:` | `**Overall Verdict**:` |
|
|
36
|
+
| 发现统计字段 | `**发现(AI 可处理)**:` | `**Findings (AI-actionable)**:` |
|
|
37
|
+
|
|
38
|
+
结论映射:
|
|
39
|
+
|
|
40
|
+
- `通过` / `Approved` -> `Approved`,再按 blocker/major/minor 计数拆成 `Approved` 或 `Approved-with-issues`
|
|
41
|
+
- `需要修改` / `Changes Requested` -> `Changes Requested`
|
|
42
|
+
- `拒绝` / `Rejected` -> `Rejected`
|
|
43
|
+
|
|
44
|
+
env-blocked 计数不参与 mode 判定。
|
|
45
|
+
|
|
46
|
+
## 输出契约
|
|
47
|
+
|
|
48
|
+
脚本输出 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
|
+
`review_artifact` 字段在第 2 分支(replan-driven init)下指向触发的 `review-plan-r{N}.md` 而非 review-code 产物,用于追溯触发原因。
|
|
64
|
+
|
|
65
|
+
exit code:
|
|
66
|
+
|
|
67
|
+
- `0`:可继续,`mode` 为 `init` 或 `fix`
|
|
68
|
+
- `1`:拒绝继续,`mode` 为 `refused`
|
|
69
|
+
- `2`:状态异常,`mode` 为 `error`
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Fix Workflow
|
|
2
2
|
|
|
3
|
-
Read this file before changing code during
|
|
3
|
+
Read this file before changing code during fix mode.
|
|
4
4
|
|
|
5
5
|
## Plan the Fixes
|
|
6
6
|
|
|
@@ -24,7 +24,7 @@ Detailed priority rules:
|
|
|
24
24
|
|
|
25
25
|
env-blocked findings are outside the repair scope. Handling rules:
|
|
26
26
|
- do not write code changes for these findings
|
|
27
|
-
- list them unchanged in the
|
|
27
|
+
- list them unchanged in the code report's "Environment-Blocked Handling" section and mark them "outside AI repair scope"
|
|
28
28
|
- do not repeat them under unresolved issues, to avoid visually double-counting them
|
|
29
29
|
- their destination is the PR description, where maintainers carry them as a "manual verification required" checklist
|
|
30
30
|
|
|
@@ -38,7 +38,7 @@ For each fix:
|
|
|
38
38
|
|
|
39
39
|
## Run Test Verification
|
|
40
40
|
|
|
41
|
-
Before writing the
|
|
41
|
+
Before writing the code report, run the project's **core subset** as final verification and confirm that all required tests still pass. If the project does not have layered scripts, fall back to the full project test command.
|
|
42
42
|
|
|
43
43
|
## Choose the Next-Step Branch
|
|
44
44
|
|
|
@@ -53,22 +53,22 @@ Prohibition:
|
|
|
53
53
|
Required output template:
|
|
54
54
|
|
|
55
55
|
```text
|
|
56
|
-
Task {task-id}
|
|
56
|
+
Task {task-id} fix completed.
|
|
57
57
|
|
|
58
|
-
|
|
58
|
+
Fix status:
|
|
59
59
|
- Blockers fixed: {fixed-blockers}/{total-blockers}
|
|
60
60
|
- Major issues fixed: {fixed-majors}/{total-majors}
|
|
61
61
|
- Minor issues fixed: {fixed-minors}/{total-minors}
|
|
62
62
|
- [If env-blocked > 0] env-blocked skipped: {count}
|
|
63
63
|
- All tests passing: {yes/no}
|
|
64
64
|
- Review input: {review-artifact}
|
|
65
|
-
-
|
|
65
|
+
- Code artifact: {code-artifact}
|
|
66
66
|
|
|
67
67
|
Next step - re-review or commit:
|
|
68
68
|
- Re-review (always recommended):
|
|
69
|
-
- Claude Code / OpenCode: /review-
|
|
70
|
-
- Gemini CLI: /agent-infra:review-
|
|
71
|
-
- Codex CLI: $review-
|
|
69
|
+
- Claude Code / OpenCode: /review-code {task-id}
|
|
70
|
+
- Gemini CLI: /agent-infra:review-code {task-id}
|
|
71
|
+
- Codex CLI: $review-code {task-id}
|
|
72
72
|
- Commit directly (optional; only when all issues are resolved and changes are low risk):
|
|
73
73
|
- Claude Code / OpenCode: /commit
|
|
74
74
|
- Gemini CLI: /agent-infra:commit
|
|
@@ -77,9 +77,9 @@ Next step - re-review or commit:
|
|
|
77
77
|
|
|
78
78
|
## Notes
|
|
79
79
|
|
|
80
|
-
1. **Prerequisite**: a review artifact must exist (`review.md` or `review-r{N}.md`)
|
|
80
|
+
1. **Prerequisite**: a code review artifact must exist (`review-code.md` or `review-code-r{N}.md`)
|
|
81
81
|
2. **No auto-commit**: do not run `git commit`
|
|
82
82
|
3. **Scope discipline**: only fix reviewed issues
|
|
83
83
|
4. **Disagreement handling**: record any disagreement in the report
|
|
84
|
-
5. **Re-review**: always recommend `review-
|
|
85
|
-
6. **Consistency**: the latest review artifact, Activity Log entry, and
|
|
84
|
+
5. **Re-review**: always recommend `review-code` as the default next step after fix mode
|
|
85
|
+
6. **Consistency**: the latest review artifact, Activity Log entry, and code report must reference the same round
|