@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: complete-task
3
- description: "标记任务完成并归档"
3
+ description: >
4
+ 标记任务完成并归档。
5
+ 当任务工作已完成并验证、需要收尾归档时使用。
4
6
  ---
5
7
 
6
8
  # 完成任务
@@ -127,6 +129,7 @@ date "+%Y-%m-%d %H:%M:%S%:z"
127
129
  - `status`:completed
128
130
  - `current_step`:completed
129
131
  - `completed_at`:{当前时间戳}
132
+ - `target_date`:仅当为空时写入 `completed_at` 的日期部分(`YYYY-MM-DD`);已有值(人工填写)则保留
130
133
  - `updated_at`:{当前时间戳}
131
134
  - `agent_infra_version`:按 `.agents/rules/version-stamp.md` 取值
132
135
  - 新增或更新 `## 状态核对` 段,粘贴第 0 步审计命令原文(含 `$ ` 前缀行),放在 `## 活动日志` 之前
@@ -15,7 +15,8 @@
15
15
  "completed_at"
16
16
  ],
17
17
  "expected_status": "completed",
18
- "require_completed_at": true
18
+ "require_completed_at": true,
19
+ "require_target_date": true
19
20
  },
20
21
  "activity-log": {
21
22
  "expected_action_pattern": "(Complete Task|Completed)",
@@ -15,7 +15,8 @@
15
15
  "completed_at"
16
16
  ],
17
17
  "expected_status": "completed",
18
- "require_completed_at": true
18
+ "require_completed_at": true,
19
+ "require_target_date": true
19
20
  },
20
21
  "activity-log": {
21
22
  "expected_action_pattern": "(Complete Task|Completed)",
@@ -1,6 +1,8 @@
1
1
  ---
2
2
  name: create-pr
3
- description: "Create a Pull Request to a target branch"
3
+ description: >
4
+ Create a Pull Request to a target branch.
5
+ Use when changes are committed and you need to open a Pull Request for review.
4
6
  ---
5
7
 
6
8
  # Create Pull Request
@@ -1,6 +1,8 @@
1
1
  ---
2
2
  name: create-pr
3
- description: "创建 Pull Request 到目标分支"
3
+ description: >
4
+ 创建 Pull Request 到目标分支。
5
+ 当变更已提交、需要发起 Pull Request 评审时使用。
4
6
  ---
5
7
 
6
8
  # 创建 Pull Request
@@ -1,6 +1,8 @@
1
1
  ---
2
2
  name: create-release-note
3
- description: "Generate release notes from PRs and commits"
3
+ description: >
4
+ Generate release notes from PRs and commits.
5
+ Use when preparing a release and you need notes compiled from PRs and commits.
4
6
  ---
5
7
 
6
8
  # Create Release Notes
@@ -1,6 +1,8 @@
1
1
  ---
2
2
  name: create-release-note
3
- description: "从 PR 和 commit 生成版本发布说明"
3
+ description: >
4
+ 从 PR 和 commit 生成版本发布说明。
5
+ 当准备发版、需要从 PR 与 commit 汇总发布说明时使用。
4
6
  ---
5
7
 
6
8
  # 创建发布说明
@@ -1,6 +1,8 @@
1
1
  ---
2
2
  name: create-task
3
- description: "Create a task from a natural-language description"
3
+ description: >
4
+ Create a task from a natural-language description.
5
+ Use when you want to turn a free-form idea or request into a tracked task.
4
6
  ---
5
7
 
6
8
  # Create Task
@@ -92,7 +94,6 @@ status: active
92
94
  created_at: {YYYY-MM-DD HH:mm:ss±HH:MM}
93
95
  updated_at: {YYYY-MM-DD HH:mm:ss±HH:MM}
94
96
  agent_infra_version: {agent_infra_version}
95
- created_by: human
96
97
  priority: # required; inferred by the AI from the title/description; Urgent | High | Medium | Low
97
98
  effort: # required; inferred by the AI from the title/description; High | Medium | Low
98
99
  start_date: # optional; YYYY-MM-DD
@@ -101,8 +102,7 @@ current_step: requirement-analysis
101
102
  assigned_to: {current AI agent}
102
103
  ```
103
104
 
104
- Note: `created_by` is `human` because the task comes from the user's description.
105
- priority / effort are required: the AI infers them from the task title and description (candidates in `.agents/rules/issue-fields.md`; normalize localized input). Leave start_date / target_date empty at creation - analyze-task / plan-task fill them later; do not invent dates.
105
+ priority / effort are required: the AI infers them from the task title and description (candidates in `.agents/rules/issue-fields.md`; normalize localized input). Leave start_date / target_date empty at creation: `start_date` is written by the analyze stage and `target_date` by the complete stage; do not invent dates.
106
106
 
107
107
  ### 3. Update Task Status
108
108
 
@@ -1,6 +1,8 @@
1
1
  ---
2
2
  name: create-task
3
- description: "根据自然语言描述创建任务"
3
+ description: >
4
+ 根据自然语言描述创建任务。
5
+ 当想把一段自然语言的想法或需求落为受跟踪的任务时使用。
4
6
  ---
5
7
 
6
8
  # 创建任务
@@ -91,7 +93,6 @@ status: active
91
93
  created_at: {YYYY-MM-DD HH:mm:ss±HH:MM}
92
94
  updated_at: {YYYY-MM-DD HH:mm:ss±HH:MM}
93
95
  agent_infra_version: {agent_infra_version}
94
- created_by: human
95
96
  priority: # 必填;由 AI 从标题/描述推断;Urgent | High | Medium | Low
96
97
  effort: # 必填;由 AI 从标题/描述推断;High | Medium | Low
97
98
  start_date: # 可选;YYYY-MM-DD
@@ -100,8 +101,7 @@ current_step: requirement-analysis
100
101
  assigned_to: {当前 AI 代理}
101
102
  ```
102
103
 
103
- 注意:`created_by` `human`,因为任务来源于用户的描述。
104
- priority / effort 必填:由 AI 从任务标题与描述推断后填入(候选值见 `.agents/rules/issue-fields.md`;中文输入按本地化映射规范化)。start_date / target_date 创建时保持留空,由 analyze-task / plan-task 阶段填入;不要臆测日期。
104
+ priority / effort 必填:由 AI 从任务标题与描述推断后填入(候选值见 `.agents/rules/issue-fields.md`;中文输入按本地化映射规范化)。start_date / target_date 创建时保持留空:`start_date` analyze 阶段写入、`target_date` 由 complete 阶段写入;不要臆测日期。
105
105
 
106
106
  ### 3. 更新任务状态
107
107
 
@@ -1,6 +1,8 @@
1
1
  ---
2
2
  name: import-codescan
3
- description: "Import a Code Scanning alert and create a remediation task"
3
+ description: >
4
+ Import a Code Scanning alert and create a remediation task.
5
+ Use when a Code Scanning alert needs to become a tracked remediation task.
4
6
  ---
5
7
 
6
8
  # Import Code Scanning Alert
@@ -52,9 +54,6 @@ Task metadata:
52
54
  ```yaml
53
55
  id: TASK-{yyyyMMdd-HHmmss}
54
56
  codescan_alert_number: <alert-number>
55
- severity: <critical/high/medium/low>
56
- rule_id: <rule-id>
57
- tool: <tool-name>
58
57
  ```
59
58
 
60
59
  ### 3. Update Task Status
@@ -1,6 +1,8 @@
1
1
  ---
2
2
  name: import-codescan
3
- description: "导入 Code Scanning 告警并创建修复任务"
3
+ description: >
4
+ 导入 Code Scanning 告警并创建修复任务。
5
+ 当某条 Code Scanning 告警需要转为受跟踪的修复任务时使用。
4
6
  ---
5
7
 
6
8
  # 导入 Code Scanning 告警
@@ -52,9 +54,6 @@ description: "导入 Code Scanning 告警并创建修复任务"
52
54
  ```yaml
53
55
  id: TASK-{yyyyMMdd-HHmmss}
54
56
  codescan_alert_number: <alert-number>
55
- severity: <critical/high/medium/low>
56
- rule_id: <rule-id>
57
- tool: <tool-name>
58
57
  ```
59
58
 
60
59
  ### 3. 更新任务状态
@@ -1,6 +1,8 @@
1
1
  ---
2
2
  name: import-dependabot
3
- description: "Import a Dependabot alert and create a remediation task"
3
+ description: >
4
+ Import a Dependabot alert and create a remediation task.
5
+ Use when a Dependabot alert needs to become a tracked remediation task.
4
6
  ---
5
7
 
6
8
  # Import Dependabot Security Alert
@@ -53,7 +55,6 @@ Task metadata must include:
53
55
  ```yaml
54
56
  id: TASK-{yyyyMMdd-HHmmss}
55
57
  security_alert_number: <alert-number>
56
- severity: <critical/high/medium/low>
57
58
  cve_id: <CVE-ID>
58
59
  ghsa_id: <GHSA-ID>
59
60
  ```
@@ -1,6 +1,8 @@
1
1
  ---
2
2
  name: import-dependabot
3
- description: "导入 Dependabot 安全告警并创建修复任务"
3
+ description: >
4
+ 导入 Dependabot 安全告警并创建修复任务。
5
+ 当某条 Dependabot 安全告警需要转为受跟踪的修复任务时使用。
4
6
  ---
5
7
 
6
8
  # 导入 Dependabot 安全告警
@@ -53,7 +55,6 @@ description: "导入 Dependabot 安全告警并创建修复任务"
53
55
  ```yaml
54
56
  id: TASK-{yyyyMMdd-HHmmss}
55
57
  security_alert_number: <alert-number>
56
- severity: <critical/high/medium/low>
57
58
  cve_id: <CVE-ID>
58
59
  ghsa_id: <GHSA-ID>
59
60
  ```
@@ -1,6 +1,8 @@
1
1
  ---
2
2
  name: import-issue
3
- description: "Import an Issue and create a task"
3
+ description: >
4
+ Import an Issue and create a task.
5
+ Use when you want to start work from an existing Issue and track it locally.
4
6
  ---
5
7
 
6
8
  # Import Issue
@@ -40,7 +42,22 @@ This skill **creates** task.md, so there is no file to write at the start. Captu
40
42
  Read `.agents/rules/issue-pr-commands.md` first, follow its prerequisite steps to complete authentication and code-hosting platform detection, then load the Issue data with its "Read an Issue" command.
41
43
 
42
44
  Extract: issue number, title, description, and labels.
43
- Use the Issue title as-is for the task title (preserve the Issue's original language).
45
+
46
+ Derive the task title from the Issue title by stripping an optional single leading Conventional Commits prefix, following the contract below; preserve the rest of the description verbatim and in its original language. This fenced contract is the authoritative, language-neutral rule — keep it byte-for-byte identical across every `import-issue` variant:
47
+
48
+ ```
49
+ # title-derivation-contract
50
+ strip-prefix: type(scope):
51
+ prefix-types: feat fix docs style refactor perf test build ci chore revert
52
+ single-layer-only: true
53
+ preserve-body-colon: true
54
+ keep-when-no-prefix: true
55
+ example-strip: "feat(meta): create-pr summary" => "create-pr summary"
56
+ example-keep: "修复某问题" => "修复某问题"
57
+ example-single-layer: "feat: add A: B" => "add A: B"
58
+ ```
59
+
60
+ Strip only the first layer, and only when the leading token is a `prefix-types` value optionally followed by `(scope)` and a `!`, then `:` and at least one space; a colon inside the description is never a prefix.
44
61
 
45
62
  ### 2. Check for an Existing Task
46
63
 
@@ -76,7 +93,7 @@ date +%Y%m%d-%H%M%S
76
93
 
77
94
  - Create the directory: `.agents/workspace/active/{task-id}/`
78
95
  - Use the `.agents/templates/task.md` template to create `task.md`
79
- - For Scenario C, prefer `type`, `workflow`, `branch`, `created_by`, and `milestone` from the remote frontmatter; infer missing or damaged fields from Issue labels and current rules
96
+ - For Scenario C, prefer `type`, `workflow`, `branch`, and `milestone` from the remote frontmatter; infer missing or damaged fields from Issue labels and current rules
80
97
  - Always write `current_step` as `requirement-analysis`; do not restore the remote original `current_step`
81
98
 
82
99
  Task metadata:
@@ -90,7 +107,6 @@ status: active
90
107
  created_at: {YYYY-MM-DD HH:mm:ss±HH:MM}
91
108
  updated_at: {YYYY-MM-DD HH:mm:ss±HH:MM}
92
109
  agent_infra_version: {agent_infra_version}
93
- created_by: human
94
110
  priority: # optional; preserve source/frontmatter value when available
95
111
  effort: # optional; preserve source/frontmatter value when available
96
112
  start_date: # optional; preserve explicit YYYY-MM-DD when available
@@ -1,6 +1,8 @@
1
1
  ---
2
2
  name: import-issue
3
- description: "从 Issue 导入并创建任务"
3
+ description: >
4
+ 从 Issue 导入并创建任务。
5
+ 当想从既有 Issue 开工并在本地跟踪时使用。
4
6
  ---
5
7
 
6
8
  # 导入 Issue
@@ -40,7 +42,22 @@ description: "从 Issue 导入并创建任务"
40
42
  执行前先读取 `.agents/rules/issue-pr-commands.md`,并按其中的前置步骤完成认证和代码托管平台检测;随后按其中的 “读取 Issue” 命令获取 Issue 信息。
41
43
 
42
44
  提取:issue 编号、标题、描述、标签。
43
- 任务标题直接使用 Issue 的原始标题(保持 Issue 标题的原始语言)。
45
+
46
+ 从 Issue 标题派生任务标题:按下方契约剥掉可选的单层前导 Conventional Commits 前缀,其余描述原文与原始语言保持不变。下方 fenced 契约是权威的、与语言无关的规则——在所有 `import-issue` 变体中保持逐字节一致:
47
+
48
+ ```
49
+ # title-derivation-contract
50
+ strip-prefix: type(scope):
51
+ prefix-types: feat fix docs style refactor perf test build ci chore revert
52
+ single-layer-only: true
53
+ preserve-body-colon: true
54
+ keep-when-no-prefix: true
55
+ example-strip: "feat(meta): create-pr summary" => "create-pr summary"
56
+ example-keep: "修复某问题" => "修复某问题"
57
+ example-single-layer: "feat: add A: B" => "add A: B"
58
+ ```
59
+
60
+ 只剥第一层前缀,且仅当前导 token 是 `prefix-types` 之一、其后可带 `(scope)` 与 `!`,再接 `:` 和至少一个空格;描述正文中的冒号永远不算前缀。
44
61
 
45
62
  ### 2. 检查已有任务
46
63
 
@@ -76,7 +93,7 @@ date +%Y%m%d-%H%M%S
76
93
 
77
94
  - 创建目录:`.agents/workspace/active/{task-id}/`
78
95
  - 使用 `.agents/templates/task.md` 模板创建 `task.md`
79
- - 场景 C 优先沿用远端 frontmatter 中的 `type`、`workflow`、`branch`、`created_by`、`milestone`;缺失或损坏字段按 Issue 标签和当前规则重新推断
96
+ - 场景 C 优先沿用远端 frontmatter 中的 `type`、`workflow`、`branch`、`milestone`;缺失或损坏字段按 Issue 标签和当前规则重新推断
80
97
  - `current_step` 始终写入 `requirement-analysis`,不要恢复为远端原 `current_step`
81
98
 
82
99
  任务元数据:
@@ -90,7 +107,6 @@ status: active
90
107
  created_at: {YYYY-MM-DD HH:mm:ss±HH:MM}
91
108
  updated_at: {YYYY-MM-DD HH:mm:ss±HH:MM}
92
109
  agent_infra_version: {agent_infra_version}
93
- created_by: human
94
110
  priority: # 可选;有来源/frontmatter 值时保留
95
111
  effort: # 可选;有来源/frontmatter 值时保留
96
112
  start_date: # 可选;有明确 YYYY-MM-DD 时保留
@@ -1,6 +1,8 @@
1
1
  ---
2
2
  name: init-labels
3
- description: "Initialize the repository's standard labels taxonomy"
3
+ description: >
4
+ Initialize the repository's standard labels taxonomy.
5
+ Use when setting up a repository and you need the standard label taxonomy created.
4
6
  ---
5
7
 
6
8
  # Initialize labels
@@ -1,6 +1,8 @@
1
1
  ---
2
2
  name: init-labels
3
- description: "初始化仓库的 labels 体系"
3
+ description: >
4
+ 初始化仓库的 labels 体系。
5
+ 当初始化仓库、需要创建标准 label 体系时使用。
4
6
  ---
5
7
 
6
8
  # 初始化 labels
@@ -1,6 +1,8 @@
1
1
  ---
2
2
  name: init-milestones
3
- description: "Initialize the repository's standard milestones taxonomy"
3
+ description: >
4
+ Initialize the repository's standard milestones taxonomy.
5
+ Use when setting up a repository and you need the standard milestone taxonomy created.
4
6
  ---
5
7
 
6
8
  # Initialize milestones
@@ -1,6 +1,8 @@
1
1
  ---
2
2
  name: init-milestones
3
- description: "初始化仓库的 milestones 体系"
3
+ description: >
4
+ 初始化仓库的 milestones 体系。
5
+ 当初始化仓库、需要创建标准 milestone 体系时使用。
4
6
  ---
5
7
 
6
8
  # 初始化 milestones
@@ -1,6 +1,8 @@
1
1
  ---
2
2
  name: plan-task
3
- description: "Design a technical plan for a task"
3
+ description: >
4
+ Design a technical plan for a task.
5
+ Use when a requirement is understood and you need a technical design before coding.
4
6
  ---
5
7
 
6
8
  # Design Technical Plan
@@ -97,7 +99,7 @@ Follow the `technical-design` step in `.agents/workflows/feature-development.yam
97
99
  - [ ] Define the verification strategy (tests, manual checks)
98
100
  - [ ] Assess impact and risks
99
101
 
100
- When this round introduces a new key design decision, record it under `## Open Questions` according to `.agents/rules/no-mid-flow-questions.md` and write the matching `HD-` ledger row.
102
+ When this round introduces a new key design decision, per `.agents/rules/no-mid-flow-questions.md` write its detail block (background/options/impact/recommendation) into the plan artifact'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 (evidence pointing to `{plan-artifact}#HD-N`); ordinary open questions still go under `## Open Questions`.
101
103
 
102
104
  **Design principles**:
103
105
  1. **Architectural soundness**: choose the structurally correct approach; diff size is not the primary criterion. Do not pile changes onto an unsound structure just to keep the diff small
@@ -123,7 +125,6 @@ Update `.agents/workspace/active/{task-id}/task.md`:
123
125
  - `assigned_to`: {current AI agent}
124
126
  - `updated_at`: {current time}
125
127
  - `agent_infra_version`: value from `.agents/rules/version-stamp.md`
126
- - If `target_date` is empty, write an estimated completion date based on the effort estimate (`YYYY-MM-DD`); leave it empty without blocking when no reasonable estimate exists; keep any existing value
127
128
  - Record the plan artifact for this round: `{plan-artifact}` (Round `{plan-round}`)
128
129
  - If the task template contains a `## Design` section, update it to link to `{plan-artifact}`
129
130
  - Mark technical-design as complete in workflow progress and include the actual round when the task template supports it
@@ -1,6 +1,8 @@
1
1
  ---
2
2
  name: plan-task
3
- description: "为任务设计技术方案和实施计划"
3
+ description: >
4
+ 为任务设计技术方案和实施计划。
5
+ 当需求已明确、需要在编码前形成技术方案时使用。
4
6
  ---
5
7
 
6
8
  # 设计技术方案
@@ -96,7 +98,7 @@ tail .agents/workspace/active/{task-id}/task.md
96
98
  - [ ] 定义验证策略(测试、手动检查)
97
99
  - [ ] 评估方案的影响和风险
98
100
 
99
- 遇到本轮新增的关键设计决策时,按 `.agents/rules/no-mid-flow-questions.md` 判据写入 `## 未决问题`,并回写 `HD-` 账本行。
101
+ 遇到本轮新增的关键设计决策时,按 `.agents/rules/no-mid-flow-questions.md` 判据,把详情块(背景/选项/影响/推荐)写入方案产物的 `## 人工裁决待办` 段 `### HD-N:<标题> [needs-human-decision]`(`HD-N` 全局唯一,规则见 `.agents/rules/review-handshake.md`),并回写 `HD-` 账本行(evidence 指向 `{plan-artifact}#HD-N`);普通未决问题仍写 `## 未决问题`。
100
102
 
101
103
  **设计原则**:
102
104
  1. **架构合理性**:选择结构正确的方案,改动大小不是首要依据。不要为了减少 diff 而在不合理的结构上叠加
@@ -122,7 +124,6 @@ date "+%Y-%m-%d %H:%M:%S%:z"
122
124
  - `assigned_to`:{当前 AI 代理}
123
125
  - `updated_at`:{当前时间}
124
126
  - `agent_infra_version`:按 `.agents/rules/version-stamp.md` 取值
125
- - 若 `target_date` 为空,基于工作量评估写入预估完成日(`YYYY-MM-DD`);无法合理预估时保持留空、不阻塞;已有值则保留
126
127
  - 记录本轮方案产物:`{plan-artifact}`(Round `{plan-round}`)
127
128
  - 如任务模板包含 `## 设计` 段落,更新为指向 `{plan-artifact}` 的链接
128
129
  - 在工作流进度中标记 technical-design 为已完成,并注明实际轮次(如果任务模板支持)
@@ -1,6 +1,8 @@
1
1
  ---
2
2
  name: post-release
3
- description: "Run post-release follow-up tasks"
3
+ description: >
4
+ Run post-release follow-up tasks.
5
+ Use when a release has shipped and follow-up housekeeping is needed.
4
6
  ---
5
7
 
6
8
  # Post-release Tasks
@@ -1,6 +1,8 @@
1
1
  ---
2
2
  name: post-release
3
- description: "执行版本发布后的后处理工作"
3
+ description: >
4
+ 执行版本发布后的后处理工作。
5
+ 当版本已发布、需要执行发版后的收尾工作时使用。
4
6
  ---
5
7
 
6
8
  # 发布后处理
@@ -1,6 +1,8 @@
1
1
  ---
2
2
  name: refine-title
3
- description: "Rewrite an Issue or PR title in Conventional Commits format"
3
+ description: >
4
+ Rewrite an Issue or PR title in Conventional Commits format.
5
+ Use when an Issue or PR title needs rewriting into Conventional Commits format.
4
6
  ---
5
7
 
6
8
  # Refine Title
@@ -1,6 +1,8 @@
1
1
  ---
2
2
  name: refine-title
3
- description: "重构 Issue/PR 标题为 Conventional Commits 格式"
3
+ description: >
4
+ 重构 Issue/PR 标题为 Conventional Commits 格式。
5
+ 当某个 Issue/PR 标题需要改写为 Conventional Commits 格式时使用。
4
6
  ---
5
7
 
6
8
  # 重构标题
@@ -1,6 +1,8 @@
1
1
  ---
2
2
  name: release
3
- description: "Run the version release workflow"
3
+ description: >
4
+ Run the version release workflow.
5
+ Use when you are ready to cut and publish a new version.
4
6
  ---
5
7
 
6
8
  # Version Release
@@ -1,6 +1,8 @@
1
1
  ---
2
2
  name: release
3
- description: "执行版本发布流程"
3
+ description: >
4
+ 执行版本发布流程。
5
+ 当准备切出并发布新版本时使用。
4
6
  ---
5
7
 
6
8
  # 版本发布
@@ -1,6 +1,8 @@
1
1
  ---
2
2
  name: restore-task
3
- description: "Restore local task files from platform Issue comments"
3
+ description: >
4
+ Restore local task files from platform Issue comments.
5
+ Use when local task files are missing and need rebuilding from platform Issue comments.
4
6
  ---
5
7
 
6
8
  # Restore Task
@@ -1,6 +1,8 @@
1
1
  ---
2
2
  name: restore-task
3
- description: "从平台 Issue 评论还原本地任务文件"
3
+ description: >
4
+ 从平台 Issue 评论还原本地任务文件。
5
+ 当本地任务文件缺失、需要从平台 Issue 评论还原时使用。
4
6
  ---
5
7
 
6
8
  # 还原任务
@@ -1,6 +1,8 @@
1
1
  ---
2
2
  name: review-analysis
3
- description: "Review the requirement analysis artifact"
3
+ description: >
4
+ Review the requirement analysis artifact.
5
+ Use when a requirements analysis needs an independent review before planning.
4
6
  ---
5
7
 
6
8
  # Requirement Analysis Review
@@ -52,7 +54,7 @@ Record `{analysis-artifact}`, `{review-round}`, and `{review-artifact}` (`review
52
54
 
53
55
  ### 3. Read Analysis Context
54
56
 
55
- Read `{analysis-artifact}`, `task.md`, and Issue context when available.
57
+ Read `{analysis-artifact}`, `task.md`, and Issue context when available. After reading, record the actually reviewed highest-round analysis artifact by filename in the report's `Review Input` field; leave it blank when it cannot be reliably determined—do not fabricate.
56
58
 
57
59
  ### 4. Perform Review
58
60
 
@@ -77,6 +79,8 @@ date "+%Y-%m-%d %H:%M:%S%:z"
77
79
  Set `current_step` to `requirement-analysis-review`, refresh task metadata, and append:
78
80
  `- {YYYY-MM-DD HH:mm:ss±HH:MM} — **Review Analysis (Round {N})** by {agent} — Verdict: {Approved/Changes Requested/Rejected}, blockers: {n}, major: {n}, minor: {n}[ (+ {n} env-blocked)] → {review-artifact}`
79
81
 
82
+ `env-blocked` is the data source for the `Manual-verify` count folded into review rows in `ai task log`; do not add a parallel manual-verification field.
83
+
80
84
  If task.md has a valid `issue_number`, read `.agents/rules/issue-sync.md`, sync the task comment, and publish the `{review-artifact}` comment.
81
85
 
82
86
  ### 7. Run Completion Gate
@@ -1,6 +1,8 @@
1
1
  ---
2
2
  name: review-analysis
3
- description: "审查需求分析报告"
3
+ description: >
4
+ 审查需求分析报告。
5
+ 当需求分析需要在进入方案前接受独立审查时使用。
4
6
  ---
5
7
 
6
8
  # 需求分析审查
@@ -58,7 +60,7 @@ tail .agents/workspace/active/{task-id}/task.md
58
60
 
59
61
  ### 3. 阅读分析上下文
60
62
 
61
- 读取最新 `{analysis-artifact}`、`task.md` 和关联 Issue 上下文(如有)。
63
+ 读取最新 `{analysis-artifact}`、`task.md` 和关联 Issue 上下文(如有)。读取后,把本轮实际检视的最高轮 analysis artifact 文件名回填到报告 `审查输入` 段;无法可靠取得时留空,不要伪造。
62
64
 
63
65
  ### 4. 执行审查
64
66
 
@@ -88,6 +90,8 @@ date "+%Y-%m-%d %H:%M:%S%:z"
88
90
  - 追加:
89
91
  `- {YYYY-MM-DD HH:mm:ss±HH:MM} — **Review Analysis (Round {N})** by {agent} — Verdict: {Approved/Changes Requested/Rejected}, blockers: {n}, major: {n}, minor: {n}[ (+ {n} env-blocked)] → {review-artifact}`
90
92
 
93
+ `env-blocked` 是 `ai task log` 中 review 行「人工校验点」(EN `Manual-verify`)计数的数据源;不要新增并行人工验证字段。
94
+
91
95
  如果 task.md 中存在有效的 `issue_number`,执行前先读取 `.agents/rules/issue-sync.md`,完成 upstream 仓库检测和权限检测,然后同步 task 评论并发布 `{review-artifact}` 评论。
92
96
 
93
97
  ### 7. 完成校验
@@ -16,7 +16,7 @@ Rules:
16
16
  - If `Blocker > 0`, never use an approved template
17
17
  - Never count env-blocked items as blocker / major / minor or use them to trigger Scenario B/C/D
18
18
  - The selected scenario must include all TUI command formats
19
- - The count line always shows 4 numbers: the first three (Blockers / Major / Minor) must be 0 to proceed; the fourth, `Human-decision` (`{h}`), is the number of rows in task.md `## 审查分歧账本` with `stage=analysis` and `status=needs-human-decision` — a "pending human ruling" item that need not be zero and does not participate in scenario selection
19
+ - The count line always shows 4 numbers: the first three (Blockers / Major / Minor) must be 0 to proceed; the fourth, `Human-decision` (`{h}`), is the number of rows in task.md `## 审查分歧账本` with `stage=analysis` and `status=needs-human-decision` — a "pending human ruling" item that need not be zero and does not participate in scenario selection. When `{h} > 0`, before the selected scenario's "Next steps" commands you must expand each pending ruling per the "Pending human-decision pre-block" in `.agents/rules/next-step-output.md` and prompt to resolve them first
20
20
 
21
21
  ### Scenario A: Approved with no findings
22
22
 
@@ -16,7 +16,7 @@
16
16
  - 只要 `Blocker > 0`,就绝对不能输出通过模板
17
17
  - env-blocked 项绝对不能被计入 blocker / major / minor 计数,也不能用作触发场景 B/C/D 的依据
18
18
  - 所选场景中必须包含所有 TUI 命令格式
19
- - 计数行固定显示 4 个数字:前三项(阻塞 / 主要 / 次要)必须为 0 才进下一步;第四项 `人工裁决`(`{h}`)= task.md `## 审查分歧账本` 中 `stage=analysis` 且 `status=needs-human-decision` 的行数,是「待人裁」项、不要求归零,也不参与场景判断
19
+ - 计数行固定显示 4 个数字:前三项(阻塞 / 主要 / 次要)必须为 0 才进下一步;第四项 `人工裁决`(`{h}`)= task.md `## 审查分歧账本` 中 `stage=analysis` 且 `status=needs-human-decision` 的行数,是「待人裁」项、不要求归零,也不参与场景判断。当 `{h} > 0` 时,必须在选定场景的「下一步」命令之前,按 `.agents/rules/next-step-output.md`「人工裁决待办前置块」逐项展开裁决项并提示先完成裁决
20
20
 
21
21
  ### 场景 A:通过且无问题
22
22
 
@@ -10,7 +10,7 @@ Use this template when writing `review-analysis.md` or `review-analysis-r{N}.md`
10
10
  - **Review Round**: Round {review-round}
11
11
  - **Artifact File**: `{review-artifact}`
12
12
  - **Review Input**:
13
- - `{analysis-artifact}`
13
+ - `{analysis-artifact}` (the highest-round requirement-analysis artifact actually reviewed, e.g. `analysis-r2.md`; leave blank if it cannot be reliably determined)
14
14
 
15
15
  ## State Check
16
16
 
@@ -10,8 +10,7 @@
10
10
  - **审查轮次**:第 {review-round} 轮
11
11
  - **产物文件**:`{review-artifact}`
12
12
  - **审查输入**:
13
- - `{code-artifact}`
14
- - `{code-artifact}`(如存在)
13
+ - `{analysis-artifact}`(本轮实际检视的最高轮需求分析产物,如 `analysis-r2.md`;无法可靠取得则留空)
15
14
 
16
15
  ## 状态核对
17
16
 
@@ -1,6 +1,8 @@
1
1
  ---
2
2
  name: review-code
3
- description: "Review code implementation and output a code review report"
3
+ description: >
4
+ Review code implementation and output a code review report.
5
+ Use when a code implementation needs review before merging.
4
6
  ---
5
7
 
6
8
  # Code Review
@@ -67,7 +69,7 @@ Scan the task directory and record:
67
69
 
68
70
  ### 3. Read Implementation and Refinement Context
69
71
 
70
- Read the highest-round code artifact and, if present, the highest-round fix artifact.
72
+ Read the highest-round code artifact and, if present, the highest-round fix artifact. After reading, record the actually reviewed highest-round code artifact (and the highest-round fix artifact, if present) by filename in the report's `Review Input` field; leave it blank when it cannot be reliably determined—do not fabricate.
71
73
 
72
74
  ### 4. Perform the Review
73
75
 
@@ -97,6 +99,7 @@ Update task.md and append:
97
99
  `- {YYYY-MM-DD HH:mm:ss±HH:MM} — **Review Code (Round {N})** by {agent} — Verdict: {Approved/Changes Requested/Rejected}, blockers: {n}, major: {n}, minor: {n}[ (+ {n} env-blocked)] → {artifact-filename}`
98
100
 
99
101
  Omit the bracketed segment when env-blocked = 0; append ` (+ {n} env-blocked)` when env-blocked > 0.
102
+ `env-blocked` is the data source for the `Manual-verify` count folded into review rows in `ai task log`; do not add a parallel manual-verification field.
100
103
 
101
104
  If task.md contains a valid `issue_number`, perform these sync actions (skip and continue on any failure):
102
105
  - Read `.agents/rules/issue-sync.md` before syncing, and complete upstream repository detection plus permission detection