@fitlab-ai/agent-infra 0.7.6 → 0.8.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 (173) hide show
  1. package/README.md +2 -0
  2. package/README.zh-CN.md +2 -0
  3. package/bin/cli.ts +53 -18
  4. package/dist/bin/cli.js +56 -19
  5. package/dist/lib/decide.js +110 -0
  6. package/dist/lib/run/host.js +39 -0
  7. package/dist/lib/run/index.js +102 -0
  8. package/dist/lib/run/prompt.js +2 -0
  9. package/dist/lib/run/skills.js +29 -0
  10. package/dist/lib/run/tui.js +35 -0
  11. package/dist/lib/sandbox/capture.js +49 -0
  12. package/dist/lib/sandbox/commands/create.js +55 -6
  13. package/dist/lib/sandbox/commands/ls.js +4 -33
  14. package/dist/lib/sandbox/commands/show.js +67 -0
  15. package/dist/lib/sandbox/index.js +7 -0
  16. package/dist/lib/server/adapters/_contract.js +9 -0
  17. package/dist/lib/server/adapters/feishu/index.js +40 -0
  18. package/dist/lib/server/adapters/feishu/transport.js +95 -0
  19. package/dist/lib/server/auth.js +19 -0
  20. package/dist/lib/server/config.js +183 -0
  21. package/dist/lib/server/daemon.js +96 -0
  22. package/dist/lib/server/index.js +47 -0
  23. package/dist/lib/server/logger.js +34 -0
  24. package/dist/lib/server/plugin-loader.js +73 -0
  25. package/dist/lib/server/process-control.js +200 -0
  26. package/dist/lib/server/protocol.js +69 -0
  27. package/dist/lib/server/redact.js +12 -0
  28. package/dist/lib/server/runner.js +75 -0
  29. package/dist/lib/server/streamer.js +44 -0
  30. package/dist/lib/task/commands/decisions.js +258 -0
  31. package/dist/lib/task/commands/issue-body.js +94 -0
  32. package/dist/lib/task/commands/log.js +67 -9
  33. package/dist/lib/task/index.js +17 -0
  34. package/dist/lib/task/issue-form.js +66 -0
  35. package/dist/lib/task/ledger.js +66 -0
  36. package/dist/lib/task/sections.js +73 -0
  37. package/lib/decide.ts +124 -0
  38. package/lib/run/host.ts +47 -0
  39. package/lib/run/index.ts +124 -0
  40. package/lib/run/prompt.ts +1 -0
  41. package/lib/run/skills.ts +34 -0
  42. package/lib/run/tui.ts +40 -0
  43. package/lib/sandbox/capture.ts +84 -0
  44. package/lib/sandbox/commands/create.ts +61 -9
  45. package/lib/sandbox/commands/ls.ts +4 -36
  46. package/lib/sandbox/commands/show.ts +80 -0
  47. package/lib/sandbox/index.ts +7 -0
  48. package/lib/server/adapters/_contract.ts +42 -0
  49. package/lib/server/adapters/feishu/index.ts +47 -0
  50. package/lib/server/adapters/feishu/transport.ts +128 -0
  51. package/lib/server/auth.ts +28 -0
  52. package/lib/server/config.ts +228 -0
  53. package/lib/server/daemon.ts +110 -0
  54. package/lib/server/index.ts +50 -0
  55. package/lib/server/logger.ts +48 -0
  56. package/lib/server/plugin-loader.ts +84 -0
  57. package/lib/server/process-control.ts +225 -0
  58. package/lib/server/protocol.ts +79 -0
  59. package/lib/server/redact.ts +12 -0
  60. package/lib/server/runner.ts +95 -0
  61. package/lib/server/server.schema.json +127 -0
  62. package/lib/server/streamer.ts +57 -0
  63. package/lib/task/commands/decisions.ts +272 -0
  64. package/lib/task/commands/issue-body.ts +102 -0
  65. package/lib/task/commands/log.ts +73 -9
  66. package/lib/task/index.ts +17 -0
  67. package/lib/task/issue-form.ts +77 -0
  68. package/lib/task/ledger.ts +73 -0
  69. package/lib/task/sections.ts +73 -0
  70. package/package.json +9 -4
  71. package/templates/.agents/QUICKSTART.zh-CN.md +2 -2
  72. package/templates/.agents/README.en.md +3 -1
  73. package/templates/.agents/README.zh-CN.md +3 -1
  74. package/templates/.agents/rules/create-issue.github.en.md +20 -29
  75. package/templates/.agents/rules/create-issue.github.zh-CN.md +20 -29
  76. package/templates/.agents/rules/issue-fields.github.en.md +1 -1
  77. package/templates/.agents/rules/issue-fields.github.zh-CN.md +1 -1
  78. package/templates/.agents/rules/issue-pr-commands.github.en.md +6 -0
  79. package/templates/.agents/rules/issue-pr-commands.github.zh-CN.md +6 -0
  80. package/templates/.agents/rules/next-step-output.en.md +30 -1
  81. package/templates/.agents/rules/next-step-output.zh-CN.md +30 -1
  82. package/templates/.agents/rules/no-mid-flow-questions.en.md +7 -2
  83. package/templates/.agents/rules/no-mid-flow-questions.zh-CN.md +7 -2
  84. package/templates/.agents/rules/review-handshake.en.md +5 -1
  85. package/templates/.agents/rules/review-handshake.zh-CN.md +5 -1
  86. package/templates/.agents/rules/task-management.en.md +3 -1
  87. package/templates/.agents/rules/task-management.zh-CN.md +3 -1
  88. package/templates/.agents/scripts/lib/post-review-commit.js +15 -18
  89. package/templates/.agents/scripts/validate-artifact.js +8 -0
  90. package/templates/.agents/skills/analyze-task/SKILL.en.md +18 -4
  91. package/templates/.agents/skills/analyze-task/SKILL.zh-CN.md +18 -4
  92. package/templates/.agents/skills/analyze-task/config/verify.en.json +2 -1
  93. package/templates/.agents/skills/analyze-task/config/verify.zh-CN.json +2 -1
  94. package/templates/.agents/skills/archive-tasks/SKILL.en.md +3 -1
  95. package/templates/.agents/skills/archive-tasks/SKILL.zh-CN.md +3 -1
  96. package/templates/.agents/skills/block-task/SKILL.en.md +3 -1
  97. package/templates/.agents/skills/block-task/SKILL.zh-CN.md +3 -1
  98. package/templates/.agents/skills/cancel-task/SKILL.en.md +3 -1
  99. package/templates/.agents/skills/cancel-task/SKILL.zh-CN.md +3 -1
  100. package/templates/.agents/skills/check-task/SKILL.en.md +30 -81
  101. package/templates/.agents/skills/check-task/SKILL.zh-CN.md +30 -80
  102. package/templates/.agents/skills/close-codescan/SKILL.en.md +3 -1
  103. package/templates/.agents/skills/close-codescan/SKILL.zh-CN.md +3 -1
  104. package/templates/.agents/skills/close-dependabot/SKILL.en.md +3 -1
  105. package/templates/.agents/skills/close-dependabot/SKILL.zh-CN.md +3 -1
  106. package/templates/.agents/skills/code-task/SKILL.en.md +4 -2
  107. package/templates/.agents/skills/code-task/SKILL.zh-CN.md +4 -2
  108. package/templates/.agents/skills/code-task/reference/dual-mode.en.md +7 -2
  109. package/templates/.agents/skills/code-task/reference/dual-mode.zh-CN.md +7 -2
  110. package/templates/.agents/skills/code-task/scripts/detect-mode.js +6 -14
  111. package/templates/.agents/skills/commit/SKILL.en.md +27 -5
  112. package/templates/.agents/skills/commit/SKILL.zh-CN.md +27 -5
  113. package/templates/.agents/skills/complete-task/SKILL.en.md +4 -1
  114. package/templates/.agents/skills/complete-task/SKILL.zh-CN.md +4 -1
  115. package/templates/.agents/skills/complete-task/config/verify.en.json +2 -1
  116. package/templates/.agents/skills/complete-task/config/verify.zh-CN.json +2 -1
  117. package/templates/.agents/skills/create-pr/SKILL.en.md +3 -1
  118. package/templates/.agents/skills/create-pr/SKILL.zh-CN.md +3 -1
  119. package/templates/.agents/skills/create-release-note/SKILL.en.md +3 -1
  120. package/templates/.agents/skills/create-release-note/SKILL.zh-CN.md +3 -1
  121. package/templates/.agents/skills/create-task/SKILL.en.md +4 -4
  122. package/templates/.agents/skills/create-task/SKILL.zh-CN.md +4 -4
  123. package/templates/.agents/skills/import-codescan/SKILL.en.md +3 -4
  124. package/templates/.agents/skills/import-codescan/SKILL.zh-CN.md +3 -4
  125. package/templates/.agents/skills/import-dependabot/SKILL.en.md +3 -2
  126. package/templates/.agents/skills/import-dependabot/SKILL.zh-CN.md +3 -2
  127. package/templates/.agents/skills/import-issue/SKILL.en.md +20 -4
  128. package/templates/.agents/skills/import-issue/SKILL.zh-CN.md +20 -4
  129. package/templates/.agents/skills/init-labels/SKILL.en.md +3 -1
  130. package/templates/.agents/skills/init-labels/SKILL.zh-CN.md +3 -1
  131. package/templates/.agents/skills/init-milestones/SKILL.en.md +3 -1
  132. package/templates/.agents/skills/init-milestones/SKILL.zh-CN.md +3 -1
  133. package/templates/.agents/skills/plan-task/SKILL.en.md +4 -3
  134. package/templates/.agents/skills/plan-task/SKILL.zh-CN.md +4 -3
  135. package/templates/.agents/skills/post-release/SKILL.en.md +3 -1
  136. package/templates/.agents/skills/post-release/SKILL.zh-CN.md +3 -1
  137. package/templates/.agents/skills/refine-title/SKILL.en.md +3 -1
  138. package/templates/.agents/skills/refine-title/SKILL.zh-CN.md +3 -1
  139. package/templates/.agents/skills/release/SKILL.en.md +3 -1
  140. package/templates/.agents/skills/release/SKILL.zh-CN.md +3 -1
  141. package/templates/.agents/skills/restore-task/SKILL.en.md +3 -1
  142. package/templates/.agents/skills/restore-task/SKILL.zh-CN.md +3 -1
  143. package/templates/.agents/skills/review-analysis/SKILL.en.md +6 -2
  144. package/templates/.agents/skills/review-analysis/SKILL.zh-CN.md +6 -2
  145. package/templates/.agents/skills/review-analysis/reference/output-templates.en.md +1 -1
  146. package/templates/.agents/skills/review-analysis/reference/output-templates.zh-CN.md +1 -1
  147. package/templates/.agents/skills/review-analysis/reference/report-template.en.md +1 -1
  148. package/templates/.agents/skills/review-analysis/reference/report-template.zh-CN.md +1 -2
  149. package/templates/.agents/skills/review-code/SKILL.en.md +5 -2
  150. package/templates/.agents/skills/review-code/SKILL.zh-CN.md +5 -2
  151. package/templates/.agents/skills/review-code/reference/output-templates.en.md +1 -1
  152. package/templates/.agents/skills/review-code/reference/output-templates.zh-CN.md +1 -1
  153. package/templates/.agents/skills/review-code/reference/report-template.en.md +1 -1
  154. package/templates/.agents/skills/review-code/reference/report-template.zh-CN.md +1 -2
  155. package/templates/.agents/skills/review-plan/SKILL.en.md +6 -2
  156. package/templates/.agents/skills/review-plan/SKILL.zh-CN.md +6 -2
  157. package/templates/.agents/skills/review-plan/reference/output-templates.en.md +1 -1
  158. package/templates/.agents/skills/review-plan/reference/output-templates.zh-CN.md +1 -1
  159. package/templates/.agents/skills/review-plan/reference/report-template.en.md +1 -1
  160. package/templates/.agents/skills/review-plan/reference/report-template.zh-CN.md +1 -2
  161. package/templates/.agents/skills/test/SKILL.en.md +3 -1
  162. package/templates/.agents/skills/test/SKILL.zh-CN.md +1 -1
  163. package/templates/.agents/skills/test-integration/SKILL.en.md +3 -1
  164. package/templates/.agents/skills/test-integration/SKILL.zh-CN.md +3 -1
  165. package/templates/.agents/skills/update-agent-infra/SKILL.en.md +3 -1
  166. package/templates/.agents/skills/update-agent-infra/SKILL.zh-CN.md +3 -1
  167. package/templates/.agents/skills/upgrade-dependency/SKILL.en.md +3 -1
  168. package/templates/.agents/skills/upgrade-dependency/SKILL.zh-CN.md +3 -1
  169. package/templates/.agents/skills/watch-pr/SKILL.en.md +3 -1
  170. package/templates/.agents/skills/watch-pr/SKILL.zh-CN.md +3 -1
  171. package/templates/.agents/templates/task.en.md +3 -3
  172. package/templates/.agents/templates/task.zh-CN.md +3 -3
  173. package/templates/.github/workflows/metadata-sync.yml +0 -18
@@ -1,6 +1,8 @@
1
1
  ---
2
2
  name: cancel-task
3
- description: "Cancel an unneeded task and move it"
3
+ description: >
4
+ Cancel an unneeded task and move it.
5
+ Use when a task is no longer needed and should be dropped from active work.
4
6
  ---
5
7
 
6
8
  # Cancel Task
@@ -1,6 +1,8 @@
1
1
  ---
2
2
  name: cancel-task
3
- description: "取消不再需要的任务并转移"
3
+ description: >
4
+ 取消不再需要的任务并转移。
5
+ 当某个任务不再需要、应从 active 工作中撤下时使用。
4
6
  ---
5
7
 
6
8
  # 取消任务
@@ -1,6 +1,8 @@
1
1
  ---
2
2
  name: check-task
3
- description: "Check a task's current status and progress"
3
+ description: >
4
+ Check a task's current status and progress.
5
+ Use when you want a quick view of a task's current status and progress.
4
6
  ---
5
7
 
6
8
  # Check Task Status
@@ -8,7 +10,7 @@ description: "Check a task's current status and progress"
8
10
  ## Boundary / Critical Rules
9
11
 
10
12
  - This skill is **read-only** -- do not modify any files
11
- - Always check the active, blocked, and completed directories
13
+ - Mechanical facts (frontmatter metadata, artifact grouping, git/platform state, and locating the task across the active, blocked, and completed directories) are delegated to the deterministic `ai task status` command. This skill only adds the semantic layer the CLI cannot produce: workflow-stage interpretation, review-verdict parsing, and the next-step recommendation.
12
14
 
13
15
  ## Task id short ref
14
16
 
@@ -16,96 +18,43 @@ description: "Check a task's current status and progress"
16
18
 
17
19
  ## Steps
18
20
 
19
- ### 1. Locate Task
21
+ ### 1. Gather Facts via `ai task status`
20
22
 
21
- Search for the task in this priority order:
22
- 1. `.agents/workspace/active/{task-id}/task.md`
23
- 2. `.agents/workspace/blocked/{task-id}/task.md`
24
- 3. `.agents/workspace/completed/{task-id}/task.md`
23
+ Run the deterministic CLI to collect every mechanical fact, and use its stdout as the factual base of your report:
25
24
 
26
- Note: `{task-id}` format is `TASK-{yyyyMMdd-HHmmss}`, for example `TASK-20260306-143022`
27
-
28
- If the task is not found in any directory, prompt "Task {task-id} not found".
29
-
30
- ### 2. Read Task Metadata
25
+ ```bash
26
+ ai task status {task-id}
27
+ ```
31
28
 
32
- Extract from `task.md`:
33
- - `id`, `title`, `type`, `status`, `workflow`
34
- - `current_step`, `assigned_to`
35
- - `created_at`, `updated_at`
36
- - `issue_number`, `pr_number` (if applicable)
29
+ The command resolves the task across the active, blocked, and completed directories and prints five sections: the task header (`id`, short id, title), `Metadata` (frontmatter fields), `Artifacts` (files grouped by workflow stage), `Git` (branch match, uncommitted count, ahead/behind), and `Platform` (Issue/PR state). Treat that output as authoritative -- do not re-derive any of it by hand.
37
30
 
38
- ### 3. Inspect Context Files
31
+ Fallbacks:
32
+ - If the command is unavailable (e.g. `ai` is not on PATH or `dist/` is not built) or exits non-zero, fall back to a degraded read: show the `task.md` frontmatter and `ls` the task directory, and tell the user the output is degraded (suggest building or installing the CLI, e.g. `ai init`).
33
+ - If the task is not found in any directory, prompt "Task {task-id} not found".
39
34
 
40
- Scan and record the existence, round, and status of these artifact types:
41
- - `analysis.md`, `analysis-r{N}.md` - Requirement analysis
42
- - `plan.md`, `plan-r{N}.md` - Technical plan
43
- - `code.md`, `code-r2.md`, ... - Code reports
44
- - `review-analysis.md`, `review-analysis-r{N}.md` - Requirement analysis review reports
45
- - `review-plan.md`, `review-plan-r{N}.md` - Technical plan review reports
46
- - `review-code.md`, `review-code-r{N}.md` - Code review reports
35
+ ### 2. Interpret Workflow Stage & Review Verdicts
47
36
 
48
- For versioned artifacts (`analysis`, `review-analysis`, `plan`, `review-plan`, `code`, `review-code`):
49
- - Scan all versioned files of the same artifact type in the task directory
50
- - Record the latest round, latest file path, and total number of rounds for each artifact type
51
- - If the latest round is recorded in `task.md` Activity Log, cross-check it against the actual file when possible
37
+ This is the semantic layer the CLI does not produce. Using the `Artifacts` groups from step 1 and the Activity Log in `task.md`:
52
38
 
53
- ### 4. Output Status Report
39
+ - Map each workflow stage to a status indicator plus its latest artifact and round:
40
+ - `[done]` - step completed
41
+ - `[current]` - currently in progress
42
+ - `[pending]` - not started yet
43
+ - `[blocked]` - blocked
44
+ - `[skipped]` - skipped
45
+ - For the latest review artifact of each stage (`review-analysis`, `review-plan`, `review-code`), read the report body and parse its conclusion: the overall verdict (Approved / Changes Requested / Rejected) and the blocker / major / minor counts. The CLI does not parse review bodies, so this reading is required to choose the next action in step 3.
54
46
 
55
- Format the status report with a clear structure and status indicators:
47
+ Present the workflow progress as an overlay on top of the CLI output, marking the latest round and the parsed review verdict, for example:
56
48
 
57
49
  ```
58
- Task status: {task-id} (short id {task-ref})
59
- =======================
60
-
61
- Basic info:
62
- - Title: {title}
63
- - Type: {type}
64
- - Status: {status}
65
- - Workflow: {workflow}
66
- - Assigned to: {assigned_to}
67
- - Created at: {created_at}
68
- - Updated at: {updated_at}
69
-
70
50
  Workflow progress:
71
- [done] Requirement Analysis analysis-r2.md (Round 2, latest)
72
- [done] Analysis Review review-analysis.md (Round 1, latest)
73
- [done] Technical Design plan.md (Round 1)
74
- [done] Plan Review review-plan.md (Round 1, latest)
75
- [current] Code code.md (Round 1)
76
- [pending] Code Review review-code.md (Round 1 will be created next)
77
- [pending] Final Commit
78
-
79
- Context files:
80
- - analysis.md: Exists (Round 1)
81
- - analysis-r2.md: Exists (Round 2, latest)
82
- - review-analysis.md: Exists (Round 1, latest)
83
- - plan.md: Exists (Round 1, latest)
84
- - review-plan.md: Exists (Round 1, latest)
85
- - code.md: Exists (Round 1, latest)
86
- - review-code.md: Not started
87
-
88
- If multiple rounds exist, show all rounds and mark the latest, for example:
89
- - plan.md: Exists (Round 1)
90
- - plan-r2.md: Exists (Round 2, latest)
91
- - review-plan.md: Exists (Round 1)
92
- - code.md: Exists (Round 1)
93
- - code-r2.md: Exists (Round 2, latest)
94
- - review-code.md: Exists (Round 1)
95
- - review-code-r2.md: Exists (Round 2, latest)
96
-
97
- Next step:
98
- Complete implementation, then run code review
51
+ [done] Requirement Analysis analysis.md (Round 1, latest)
52
+ [done] Analysis Review review-analysis.md (Round 1, latest, Approved)
53
+ [current] Technical Design plan.md (Round 1)
54
+ [pending] Plan Review
99
55
  ```
100
56
 
101
- **Status indicators**:
102
- - `[done]` - Step completed
103
- - `[current]` - Currently in progress
104
- - `[pending]` - Not started yet
105
- - `[blocked]` - Blocked
106
- - `[skipped]` - Skipped
107
-
108
- ### 5. Recommend Next Action
57
+ ### 3. Recommend Next Action
109
58
 
110
59
  Recommend the appropriate next skill based on the current workflow state. You must show command formats for all TUI columns in the table below, not just the current AI agent. If `.agents/.airc.json` configures custom TUIs (via `customTUIs`), read each tool's `name` and `invoke`, then add the matching command line in the same format (`${skillName}` becomes the skill name and `${projectName}` becomes the project name).
111
60
 
@@ -144,6 +93,6 @@ Recommend the appropriate next skill based on the current workflow state. You mu
144
93
  ## Notes
145
94
 
146
95
  1. **Read-only**: This skill only reads and reports -- it does not modify files
147
- 2. **Multi-directory search**: Always check active, blocked, and completed
96
+ 2. **CLI delegation**: mechanical facts (metadata, artifact grouping, git/platform state, multi-directory location) come from `ai task status`; this skill adds the semantic interpretation on top
148
97
  3. **Quick reference**: Use this skill any time you need to see where a task is in the workflow
149
- 4. **Versioned artifacts**: `analysis`, `review-analysis`, `plan`, `review-plan`, `code`, and `review-code` must all report the actual round, not only the base filename
98
+ 4. **Versioned artifacts**: `ai task status` groups the actual artifact rounds; the semantic layer must still report the latest review verdict for `review-analysis`, `review-plan`, and `review-code`
@@ -1,6 +1,8 @@
1
1
  ---
2
2
  name: check-task
3
- description: "查看任务的当前状态和进度"
3
+ description: >
4
+ 查看任务的当前状态和进度。
5
+ 当想快速查看某个任务当前状态与进度时使用。
4
6
  ---
5
7
 
6
8
  # 查看任务状态
@@ -8,103 +10,51 @@ description: "查看任务的当前状态和进度"
8
10
  ## 行为边界 / 关键规则
9
11
 
10
12
  - 本技能是**只读**操作 —— 不修改任何文件
11
- - 始终检查 active、blocked completed 目录
13
+ - 机械数据(frontmatter 元数据、产物分组、Git/Platform 状态,以及跨 active、blocked、completed 三目录定位任务)一律委托给确定性的 `ai task status` 命令。本技能只负责 CLI 无法产出的语义层:工作流阶段解读、审查结论解析、下一步建议。
12
14
 
13
15
  ## 任务入参短号别名
14
16
 
15
17
  > 如果 `{task-id}` 入参匹配 `^[#]?[0-9]+$`(裸数字或带 `#` 前缀),先读取 `.agents/rules/task-short-id.md` 的「SKILL 入参解析」段执行解析;后续命令视 `{task-id}` 为解析后的全长 `TASK-YYYYMMDD-HHMMSS` 形式。
16
18
 
17
19
  ## 执行步骤
18
- ### 1. 查找任务
19
20
 
20
- 按以下优先顺序搜索任务:
21
- 1. `.agents/workspace/active/{task-id}/task.md`
22
- 2. `.agents/workspace/blocked/{task-id}/task.md`
23
- 3. `.agents/workspace/completed/{task-id}/task.md`
21
+ ### 1. 通过 `ai task status` 收集事实
24
22
 
25
- 注意:`{task-id}` 格式为 `TASK-{yyyyMMdd-HHmmss}`,例如 `TASK-20260306-143022`
23
+ 运行确定性 CLI 收集全部机械数据,并以其 stdout 作为状态报告的事实基底:
26
24
 
27
- 如果在任何目录中都未找到,提示 "Task {task-id} not found"。
28
-
29
- ### 2. 读取任务元数据
25
+ ```bash
26
+ ai task status {task-id}
27
+ ```
30
28
 
31
- `task.md` 中提取:
32
- - `id`、`title`、`type`、`status`、`workflow`
33
- - `current_step`、`assigned_to`
34
- - `created_at`、`updated_at`
35
- - `issue_number`、`pr_number`(如适用)
29
+ 该命令会跨 active、blocked、completed 三目录解析任务,并输出五段:任务头(`id`、短号、标题)、`Metadata`(frontmatter 字段)、`Artifacts`(按工作流阶段分组的产物)、`Git`(分支匹配、未提交数、ahead/behind)、`Platform`(Issue/PR 状态)。把该输出视为权威事实 —— 不要再手工复述其中任何内容。
36
30
 
37
- ### 3. 检查上下文文件
31
+ 降级处理:
32
+ - 若命令不可用(如 `ai` 不在 PATH 或 `dist/` 未构建)或非零退出,回退到降级读取:展示 `task.md` frontmatter 并 `ls` 任务目录,同时告知用户本次为降级输出(建议先构建或安装 CLI,如 `ai init`)。
33
+ - 若在任何目录都未找到任务,提示 "Task {task-id} not found"。
38
34
 
39
- 按产物类型扫描并记录以下文件的存在、轮次和状态:
40
- - `analysis.md`、`analysis-r{N}.md` - 需求分析
41
- - `plan.md`、`plan-r{N}.md` - 技术方案
42
- - `code.md`、`code-r2.md`、... - 实现报告
43
- - `review-analysis.md`、`review-analysis-r{N}.md` - 需求分析审查报告
44
- - `review-plan.md`、`review-plan-r{N}.md` - 技术方案审查报告
45
- - `review-code.md`、`review-code-r{N}.md` - 代码审查报告
35
+ ### 2. 解读工作流阶段与审查结论
46
36
 
47
- 对于版本化产物(`analysis`、`review-analysis`、`plan`、`review-plan`、`code`、`review-code`):
48
- - 扫描任务目录中的所有同类版本化文件
49
- - 记录每类产物的最新轮次、最新文件路径和总轮次数
50
- - 如果 `task.md` 的 Activity Log 记录了最新轮次,优先核对其与实际文件是否一致
37
+ 这是 CLI 不产出的语义层。基于步骤 1 的 `Artifacts` 分组与 `task.md` 的活动日志:
51
38
 
52
- ### 4. 输出状态报告
39
+ - 把每个工作流阶段映射为状态指示器,并标注其最新产物与轮次:
40
+ - `[done]` - 步骤已完成
41
+ - `[current]` - 当前进行中
42
+ - `[pending]` - 尚未开始
43
+ - `[blocked]` - 被阻塞
44
+ - `[skipped]` - 已跳过
45
+ - 对各阶段最新的审查产物(`review-analysis`、`review-plan`、`review-code`),读取报告正文并解析结论:总体结论(通过 / 需要修改 / 拒绝)与阻塞项 / 主要问题 / 次要问题计数。CLI 不解析审查正文,因此这一步是步骤 3 选择下一步操作的必要输入。
53
46
 
54
- 以清晰的结构和状态指示器格式化输出:
47
+ 把工作流进度作为 CLI 输出之上的叠加层呈现,标注最新轮次与解析出的审查结论,例如:
55
48
 
56
49
  ```
57
- 任务状态:{task-id}(短号 {task-ref})
58
- =======================
59
-
60
- 基本信息:
61
- - 标题:{title}
62
- - 类型:{type}
63
- - 状态:{status}
64
- - 工作流:{workflow}
65
- - 分配给:{assigned_to}
66
- - 创建时间:{created_at}
67
- - 更新时间:{updated_at}
68
-
69
50
  工作流进度:
70
- [已完成] 需求分析 analysis-r2.md (Round 2, latest)
71
- [已完成] 需求分析审查 review-analysis.md (Round 1, latest)
72
- [已完成] 技术设计 plan.md (Round 1)
73
- [已完成] 技术方案审查 review-plan.md (Round 1, latest)
74
- [进行中] 实现 code.md (Round 1)
75
- [待处理] 代码审查 review-code.md (Round 1 will be created next)
76
- [待处理] 最终提交
77
-
78
- 上下文文件:
79
- - analysis.md: 已存在 (Round 1)
80
- - analysis-r2.md: 已存在 (Round 2, latest)
81
- - review-analysis.md: 已存在 (Round 1, latest)
82
- - plan.md: 已存在 (Round 1, latest)
83
- - review-plan.md: 已存在 (Round 1, latest)
84
- - code.md: 已存在 (Round 1, latest)
85
- - review-code.md: 未开始
86
-
87
- 如果存在多轮产物,显示所有轮次,并标记最新版本,例如:
88
- - plan.md: 已存在 (Round 1)
89
- - plan-r2.md: 已存在 (Round 2, latest)
90
- - review-plan.md: 已存在 (Round 1)
91
- - code.md: 已存在 (Round 1)
92
- - code-r2.md: 已存在 (Round 2, latest)
93
- - review-code.md: 已存在 (Round 1)
94
- - review-code-r2.md: 已存在 (Round 2, latest)
95
-
96
- 下一步:
97
- 完成实现,然后执行代码审查
51
+ [done] 需求分析 analysis.md (Round 1, latest)
52
+ [done] 需求分析审查 review-analysis.md (Round 1, latest, 通过)
53
+ [current] 技术设计 plan.md (Round 1)
54
+ [pending] 技术方案审查
98
55
  ```
99
56
 
100
- **状态指示器**:
101
- - `[done]` - 步骤已完成
102
- - `[current]` - 当前进行中
103
- - `[pending]` - 尚未开始
104
- - `[blocked]` - 被阻塞
105
- - `[skipped]` - 已跳过
106
-
107
- ### 5. 建议下一步操作
57
+ ### 3. 建议下一步操作
108
58
 
109
59
  根据当前工作流状态,建议合适的下一个技能。必须展示下表中所有 TUI 列的命令格式,不要只展示当前 AI 代理对应的列。如果 `.agents/.airc.json` 中配置了自定义 TUI(`customTUIs`),读取每个工具的 `name` 和 `invoke`,按同样格式补充对应命令行(`${skillName}` 替换为技能名,`${projectName}` 替换为项目名):
110
60
 
@@ -143,6 +93,6 @@ description: "查看任务的当前状态和进度"
143
93
  ## 注意事项
144
94
 
145
95
  1. **只读**:本技能仅读取和报告 —— 不修改任何文件
146
- 2. **多目录搜索**:始终检查 active、blocked completed 目录
96
+ 2. **CLI 委托**:机械数据(元数据、产物分组、Git/Platform 状态、多目录定位)来自 `ai task status`;本技能在其之上叠加语义解读
147
97
  3. **快速参考**:随时可以使用本技能检查任务在工作流中的位置
148
- 4. **版本化产物**:`analysis`、`review-analysis`、`plan`、`review-plan`、`code`、`review-code` 都需要报告实际轮次,而不是只报告固定文件名
98
+ 4. **版本化产物**:`ai task status` 已按实际轮次分组产物;语义层仍需报告 `review-analysis`、`review-plan`、`review-code` 的最新审查结论
@@ -1,6 +1,8 @@
1
1
  ---
2
2
  name: close-codescan
3
- description: "Close a Code Scanning alert with a documented reason"
3
+ description: >
4
+ Close a Code Scanning alert with a documented reason.
5
+ Use when a Code Scanning alert has been handled or dismissed and needs closing with a reason.
4
6
  ---
5
7
 
6
8
  # Dismiss Code Scanning Alert
@@ -1,6 +1,8 @@
1
1
  ---
2
2
  name: close-codescan
3
- description: "关闭 Code Scanning 告警并记录理由"
3
+ description: >
4
+ 关闭 Code Scanning 告警并记录理由。
5
+ 当某条 Code Scanning 告警已处理或需按理由关闭时使用。
4
6
  ---
5
7
 
6
8
  # 关闭 Code Scanning 告警
@@ -1,6 +1,8 @@
1
1
  ---
2
2
  name: close-dependabot
3
- description: "Close a Dependabot alert with a documented reason"
3
+ description: >
4
+ Close a Dependabot alert with a documented reason.
5
+ Use when a Dependabot alert has been handled or dismissed and needs closing with a reason.
4
6
  ---
5
7
 
6
8
  # Dismiss Dependabot Alert
@@ -1,6 +1,8 @@
1
1
  ---
2
2
  name: close-dependabot
3
- description: "关闭 Dependabot 安全告警并记录理由"
3
+ description: >
4
+ 关闭 Dependabot 安全告警并记录理由。
5
+ 当某条 Dependabot 安全告警已处理或需按理由关闭时使用。
4
6
  ---
5
7
 
6
8
  # 关闭 Dependabot 告警
@@ -1,6 +1,8 @@
1
1
  ---
2
2
  name: code-task
3
- description: "Implement code from the technical plan and output a report"
3
+ description: >
4
+ Implement code from the technical plan and output a report.
5
+ Use when an approved technical plan needs implementing, or code review found issues to fix.
4
6
  ---
5
7
 
6
8
  # Code Task
@@ -11,7 +13,7 @@ Implement the approved plan and produce `code.md` or `code-r{N}.md`. This skill
11
13
 
12
14
  - Follow the latest plan artifact: `plan.md` or `plan-r{N}.md`
13
15
  - Fix mode verifies each finding of the latest `review-code` one by one: fix it if it holds, or rebut it and record it under unresolved if it is unfounded/hallucinated; do not expand to issues the review did not list; env-blocked items are out of scope
14
- - If implementation encounters a key design decision not covered by the plan, record `[needs-human-decision]` / `HD-` rows according to `.agents/rules/no-mid-flow-questions.md` instead of asking mid-flow or expanding scope silently
16
+ - If implementation encounters a key design decision not covered by the plan, per `.agents/rules/no-mid-flow-questions.md` write its detail block into the implementation report's `## 人工裁决待办` (Pending Human Decisions) section as `### HD-N:<title> [needs-human-decision]` (`HD-N` is globally unique, see `.agents/rules/review-handshake.md`) and write the matching `HD-` ledger row, instead of asking mid-flow or expanding scope silently
15
17
  - Never auto-run `git add` or `git commit`
16
18
  - Create a new code artifact for each round and never overwrite an older one
17
19
  - After executing this skill, you **must** immediately update task.md
@@ -1,6 +1,8 @@
1
1
  ---
2
2
  name: code-task
3
- description: "根据技术方案编码任务并输出报告"
3
+ description: >
4
+ 根据技术方案编码任务并输出报告。
5
+ 当技术方案已批准需要落地实现,或代码审查发现问题需要修复时使用。
4
6
  ---
5
7
 
6
8
  # 编码任务
@@ -11,7 +13,7 @@ description: "根据技术方案编码任务并输出报告"
11
13
 
12
14
  - 严格遵循最新方案产物:`plan.md` 或 `plan-r{N}.md`
13
15
  - 修复模式逐条核实最新 `review-code` 的发现:成立则修复,判定为不成立/幻觉则在报告中反驳并记入 unresolved;不擅自扩大到审查未列出的问题;env-blocked 项不在修复范围
14
- - 实现中遇到方案未覆盖的关键设计决策时,按 `.agents/rules/no-mid-flow-questions.md` 判据记录 `[needs-human-decision]` / `HD-` 行,不中途提问或擅自扩范围
16
+ - 实现中遇到方案未覆盖的关键设计决策时,按 `.agents/rules/no-mid-flow-questions.md` 判据,把详情块写入实现报告的 `## 人工裁决待办` 段 `### HD-N:<标题> [needs-human-decision]`(`HD-N` 全局唯一,见 `.agents/rules/review-handshake.md`)并回写 `HD-` 账本行,不中途提问或擅自扩范围
15
17
  - 绝不自动执行 `git add` 或 `git commit`
16
18
  - 每轮实现都创建新的实现产物,不覆盖旧文件
17
19
  - 执行本技能后,你**必须**立即更新 task.md
@@ -10,7 +10,7 @@ node .agents/skills/code-task/scripts/detect-mode.js .agents/workspace/active/{t
10
10
 
11
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
12
 
13
- ## Eight Branches
13
+ ## Seven Branches
14
14
 
15
15
  > Branches are evaluated top-down in this table; the first match returns and skips later rows.
16
16
 
@@ -19,12 +19,17 @@ The script scans `plan.md` / `plan-r{N}.md`, `review-plan.md` / `review-plan-r{N
19
19
  | no code artifact | `init` | 0 | initial implementation, output `code.md` |
20
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
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
22
  | latest review-code is Approved with 0/0/0 | `refused` | 1 | already approved; do not run `code-task` again |
24
23
  | latest review-code is Approved with major/minor findings | `fix` | 0 | optional fix mode |
25
24
  | latest review-code is Changes Requested | `fix` | 0 | required fix mode |
26
25
  | latest review-code is Rejected | `refused` | 1 | re-plan instead of local fixing |
27
26
 
27
+ > The four verdict branches above fire when `rev_max >= code_max`, decided by the latest `review-code-r{rev_max}` verdict:
28
+ > - `rev_max == code_max`: AI fix round (`review-code` reviews the same-numbered code artifact produced by `code-task`).
29
+ > - `rev_max > code_max`: human-supplemented review round — after a PR is opened a maintainer appends a `review-code-r{N}` round against the existing latest code. `fix` mode then uses `next_round = code_max + 1`.
30
+ >
31
+ > If the latest `review-code` verdict cannot be parsed, the script still returns `error` (exit 2) as the retained anomaly guard.
32
+
28
33
  ## Verdict Parsing
29
34
 
30
35
  The script supports zh-CN and English review-code reports:
@@ -10,7 +10,7 @@ node .agents/skills/code-task/scripts/detect-mode.js .agents/workspace/active/{t
10
10
 
11
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
12
 
13
- ## 8 个分支
13
+ ## 7 个分支
14
14
 
15
15
  > 分支按表中自上而下的顺序评估,命中即返回;后续分支不再判定。
16
16
 
@@ -19,12 +19,17 @@ node .agents/skills/code-task/scripts/detect-mode.js .agents/workspace/active/{t
19
19
  | 无 code 产物 | `init` | 0 | 初次实现,产物为 `code.md` |
20
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
21
  | `rev_max < code_max` | `error` | 2 | 最新代码未审查,先运行 `review-code` |
22
- | `rev_max > code_max` | `error` | 2 | 数据状态异常,需要人工检查 |
23
22
  | 最新 review-code 为 Approved 且 0/0/0 | `refused` | 1 | 已通过,无需再次运行 `code-task` |
24
23
  | 最新 review-code 为 Approved 但有 major/minor | `fix` | 0 | 可选修复模式 |
25
24
  | 最新 review-code 为 Changes Requested | `fix` | 0 | 必需修复模式 |
26
25
  | 最新 review-code 为 Rejected | `refused` | 1 | 需要重新设计,不进入局部修复 |
27
26
 
27
+ > 上表 4 个 verdict 分支在 `rev_max >= code_max` 时命中,均以最新 `review-code-r{rev_max}` 的结论决定:
28
+ > - `rev_max == code_max`:AI 修复轮(`code-task` 产出代码后由 `review-code` 审查同号产物)。
29
+ > - `rev_max > code_max`:人工补审轮——PR 创建后维护者追加一轮 `review-code-r{N}` 审查既有最新代码。此时 `fix` 模式的 `next_round = code_max + 1`。
30
+ >
31
+ > 若最新 `review-code` 的 verdict 无法解析,仍返回 `error`(exit 2),作为保留的异常拦截。
32
+
28
33
  ## verdict 解析
29
34
 
30
35
  脚本支持中文和英文 review-code 报告:
@@ -84,20 +84,12 @@ function main() {
84
84
  return;
85
85
  }
86
86
 
87
- if (revMax > codeMax) {
88
- writeResult({
89
- mode: "error",
90
- code_max: codeMax,
91
- rev_max: revMax,
92
- verdict: null,
93
- next_round: null,
94
- next_artifact: null,
95
- review_artifact: artifactName("review-code", revMax),
96
- message: `Inconsistent state: review-code round ${revMax} > code round ${codeMax}. Manual inspection required.`
97
- }, 2);
98
- return;
99
- }
100
-
87
+ // human-supplemented review: after a PR is opened, a maintainer may append a
88
+ // review-code-r{N} round against the existing latest code, so rev_max > code_max.
89
+ // This is NOT corruption — defer to the latest review's verdict instead of erroring.
90
+ // rev_max === code_max (AI fix round) and rev_max > code_max (human review round)
91
+ // both fall through to the verdict dispatch below; fix mode uses next_round = code_max + 1.
92
+ // An unparsable verdict still returns error (exit 2) as the retained anomaly guard.
101
93
  const reviewArtifact = artifactName("review-code", revMax);
102
94
  const verdictResult = parseVerdict(path.join(resolvedTaskDir, reviewArtifact));
103
95
  if (!verdictResult.ok) {
@@ -1,6 +1,8 @@
1
1
  ---
2
2
  name: commit
3
- description: "Commit the current changes to Git"
3
+ description: >
4
+ Commit the current changes to Git.
5
+ Use when finished work needs to be turned into a Git commit.
4
6
  ---
5
7
 
6
8
  # Commit Changes
@@ -64,7 +66,27 @@ If this commit is associated with a task and a `review-code` artifact exists, re
64
66
  - After committing, write `last_reviewed_commit: <new_head>` to task.md frontmatter only when `pre_head == R` and `S == F`; otherwise do not advance that field
65
67
  - Do not scan backward to earlier Approved artifacts; the highest-round `review-code` artifact is the only authoritative source
66
68
 
67
- ## 5. Update Task Status When Applicable
69
+ ## 5. Push to the Existing PR When Applicable
70
+
71
+ After the commit is created, if the current branch already has an open Pull Request, push the new commit so the PR updates automatically. Otherwise keep the current behavior (the first push is still handled by `create-pr`). This is the push wrap-up of a user-initiated `commit`: it adds no extra commit and never pushes when there is no PR; it applies whether or not a task is associated.
72
+
73
+ > Detect whether the current branch has an open PR — and authenticate to the platform — per `.agents/rules/issue-pr-commands.md`; if that rule is unavailable or detection fails, follow the degradation below.
74
+
75
+ a. Detect whether the current branch (head) has an open PR per `.agents/rules/issue-pr-commands.md`.
76
+
77
+ b. On an open PR -> push the current branch:
78
+
79
+ ```bash
80
+ git push
81
+ ```
82
+
83
+ c. Safe degradation (never block an already completed `git commit`; only warn the user):
84
+ - Platform unavailable / unauthenticated / detection failed / no open PR -> do not push; continue.
85
+ - `git push` fails (needs `git pull --rebase`, no upstream, network error) -> keep the local commit and tell the user to push manually.
86
+
87
+ Fold the push outcome (pushed / skipped(no PR) / failed) into the next step's "Update Task Status" Activity Log note or user output.
88
+
89
+ ## 6. Update Task Status When Applicable
68
90
 
69
91
  Get the current time:
70
92
 
@@ -81,7 +103,7 @@ Append the Commit Activity Log entry and choose exactly one next-step case:
81
103
  - more work remains -> update task.md and stop
82
104
  - ready for review -> `review-code {task-id}`
83
105
 
84
- ## 6. Sync Issue Metadata When Applicable
106
+ ## 7. Sync Issue Metadata When Applicable
85
107
 
86
108
  When `{task-id}` exists and task.md contains a valid `issue_number`, sync the linked Issue `in:` labels and requirement checkboxes. Otherwise, skip this step.
87
109
 
@@ -91,7 +113,7 @@ When `{task-id}` exists and task.md contains a valid `issue_number`, sync the li
91
113
 
92
114
  Failure handling matches "Update Task Status When Applicable": warn, but do **not** block an already completed `git commit`.
93
115
 
94
- ## 7. Sync PR Summary When Applicable
116
+ ## 8. Sync PR Summary When Applicable
95
117
 
96
118
  When `{task-id}` exists and task.md contains a valid `pr_number`, refresh the PR summary comment marked with the PR summary marker defined in `.agents/rules/pr-sync.md` on the PR. Otherwise, skip this step.
97
119
 
@@ -101,7 +123,7 @@ When `{task-id}` exists and task.md contains a valid `pr_number`, refresh the PR
101
123
 
102
124
  Failure handling matches "Update Task Status When Applicable": warn, but do **not** block an already completed `git commit`.
103
125
 
104
- ## 8. Verification Gate
126
+ ## 9. Verification Gate
105
127
 
106
128
  If this operation is associated with `{task-id}`, run the verification gate to confirm task metadata and sync state. If there is no task context, skip this step.
107
129
 
@@ -1,6 +1,8 @@
1
1
  ---
2
2
  name: commit
3
- description: "提交当前变更到 Git"
3
+ description: >
4
+ 提交当前变更到 Git。
5
+ 当需要把已完成的工作落为一次 Git 提交时使用。
4
6
  ---
5
7
 
6
8
  # 提交代码
@@ -64,7 +66,27 @@ git diff
64
66
  - 提交后仅当 `pre_head == R` 且 `S == F` 时,在 task.md frontmatter 写入 `last_reviewed_commit: <new_head>`;否则不推进该字段
65
67
  - 不向后扫描更早的 Approved 产物;最高轮 `review-code` 产物是唯一权威来源
66
68
 
67
- ## 5. 按需更新任务状态
69
+ ## 5. 推送到已有 PR(按需)
70
+
71
+ 提交完成后,如果当前分支已存在开放的 Pull Request,则把本次提交推送上去让 PR 自动更新;否则保持现状(首次推送仍由 `create-pr` 负责)。本步骤是用户已发起 `commit` 的推送收尾,不新增自动提交,也不在无 PR 时推送;与是否关联任务无关。
72
+
73
+ > 检测当前分支是否有开放 PR、以及平台认证,统一按 `.agents/rules/issue-pr-commands.md` 执行;该规则不可用或检测失败时,按下方降级处理。
74
+
75
+ a. 按 `.agents/rules/issue-pr-commands.md` 检测当前分支(head)是否存在开放 PR。
76
+
77
+ b. 命中开放 PR -> 推送当前分支:
78
+
79
+ ```bash
80
+ git push
81
+ ```
82
+
83
+ c. 安全降级(不阻塞已完成的 `git commit`,仅提示用户):
84
+ - 平台不可用 / 未认证 / 检测失败 / 未命中开放 PR -> 不推送,继续后续步骤。
85
+ - `git push` 失败(如需 `git pull --rebase`、无 upstream、网络异常)-> 保留本地提交,提示用户手动推送。
86
+
87
+ 把推送结果(pushed / skipped(no PR) / failed)并入下一步「更新任务状态」的 Activity Log 说明或用户输出。
88
+
89
+ ## 6. 按需更新任务状态
68
90
 
69
91
  获取当前时间:
70
92
 
@@ -81,7 +103,7 @@ date "+%Y-%m-%d %H:%M:%S%:z"
81
103
  - 还有后续工作 -> 更新 task.md 后停止
82
104
  - 准备审查 -> `review-code {task-id}`
83
105
 
84
- ## 6. 同步 Issue 元数据(按需)
106
+ ## 7. 同步 Issue 元数据(按需)
85
107
 
86
108
  当 `{task-id}` 存在且 task.md 包含有效 `issue_number` 时,同步 `in:` label 和需求复选框到关联 Issue;否则跳过。
87
109
 
@@ -91,7 +113,7 @@ date "+%Y-%m-%d %H:%M:%S%:z"
91
113
 
92
114
  失败处理与「按需更新任务状态」一致:警告但**不**阻塞已完成的 `git commit`。
93
115
 
94
- ## 7. 同步 PR 摘要(按需)
116
+ ## 8. 同步 PR 摘要(按需)
95
117
 
96
118
  当 `{task-id}` 存在且 task.md 包含有效 `pr_number` 时,刷新 PR 上由 `.agents/rules/pr-sync.md` 中定义的 PR 摘要评论标记对应的摘要评论;否则跳过。
97
119
 
@@ -101,7 +123,7 @@ date "+%Y-%m-%d %H:%M:%S%:z"
101
123
 
102
124
  失败处理与「按需更新任务状态」一致:警告但**不**阻塞已完成的 `git commit`。
103
125
 
104
- ## 8. 完成校验
126
+ ## 9. 完成校验
105
127
 
106
128
  如果本次操作关联了 `{task-id}`,运行完成校验,确认任务元数据和同步状态符合规范;如果没有任务上下文,跳过本步骤。
107
129
 
@@ -1,6 +1,8 @@
1
1
  ---
2
2
  name: complete-task
3
- description: "Mark a task as completed and archive it"
3
+ description: >
4
+ Mark a task as completed and archive it.
5
+ Use when a task's work is done and verified and you want to close and archive it.
4
6
  ---
5
7
 
6
8
  # Complete Task
@@ -128,6 +130,7 @@ Update `.agents/workspace/active/{task-id}/task.md`:
128
130
  - `status`: completed
129
131
  - `current_step`: completed
130
132
  - `completed_at`: {current timestamp}
133
+ - `target_date`: write the date portion (`YYYY-MM-DD`) of `completed_at` only when empty; keep any existing (human-entered) value
131
134
  - `updated_at`: {current timestamp}
132
135
  - `agent_infra_version`: value from `.agents/rules/version-stamp.md`
133
136
  - Add or update the `## State Check` section with the raw Step 0 audit command output, including `$ ` prompt lines, before `## Activity Log`