@fitlab-ai/agent-infra 0.5.7 → 0.5.9

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 (132) hide show
  1. package/README.md +44 -4
  2. package/README.zh-CN.md +44 -4
  3. package/lib/defaults.json +4 -2
  4. package/lib/init.js +18 -1
  5. package/lib/sandbox/commands/vm.js +7 -1
  6. package/lib/sandbox/constants.js +3 -0
  7. package/lib/sandbox/engine.js +57 -3
  8. package/lib/sandbox/runtimes/base.dockerfile +9 -2
  9. package/lib/sandbox/shell.js +36 -2
  10. package/lib/update.js +14 -3
  11. package/package.json +6 -4
  12. package/templates/.agents/QUICKSTART.en.md +2 -2
  13. package/templates/.agents/QUICKSTART.zh-CN.md +2 -2
  14. package/templates/.agents/README.en.md +1 -1
  15. package/templates/.agents/README.zh-CN.md +1 -1
  16. package/templates/.agents/rules/create-issue.en.md +5 -0
  17. package/templates/.agents/rules/create-issue.github.en.md +178 -0
  18. package/templates/.agents/rules/create-issue.github.zh-CN.md +178 -0
  19. package/templates/.agents/rules/create-issue.zh-CN.md +5 -0
  20. package/templates/.agents/rules/issue-pr-commands.github.en.md +60 -0
  21. package/templates/.agents/rules/issue-pr-commands.github.zh-CN.md +60 -0
  22. package/templates/.agents/rules/issue-sync.en.md +14 -0
  23. package/templates/.agents/rules/issue-sync.github.en.md +15 -1
  24. package/templates/.agents/rules/issue-sync.github.zh-CN.md +15 -1
  25. package/templates/.agents/rules/issue-sync.zh-CN.md +14 -0
  26. package/templates/.agents/rules/label-milestone-setup.github.en.md +10 -0
  27. package/templates/.agents/rules/label-milestone-setup.github.zh-CN.md +10 -0
  28. package/templates/.agents/rules/milestone-inference.github.en.md +2 -2
  29. package/templates/.agents/rules/milestone-inference.github.zh-CN.md +2 -2
  30. package/templates/.agents/rules/release-commands.github.en.md +16 -0
  31. package/templates/.agents/rules/release-commands.github.zh-CN.md +16 -0
  32. package/templates/.agents/scripts/platform-adapters/find-existing-task.github.js +272 -0
  33. package/templates/.agents/scripts/platform-adapters/find-existing-task.js +5 -0
  34. package/templates/.agents/scripts/platform-adapters/platform-sync.github.js +134 -9
  35. package/templates/.agents/scripts/platform-adapters/platform-sync.js +7 -0
  36. package/templates/.agents/skills/analyze-task/SKILL.en.md +3 -3
  37. package/templates/.agents/skills/analyze-task/SKILL.zh-CN.md +3 -3
  38. package/templates/.agents/skills/analyze-task/config/verify.json +3 -1
  39. package/templates/.agents/skills/block-task/config/verify.json +2 -1
  40. package/templates/.agents/skills/cancel-task/SKILL.en.md +2 -2
  41. package/templates/.agents/skills/cancel-task/SKILL.zh-CN.md +2 -2
  42. package/templates/.agents/skills/cancel-task/config/verify.json +2 -1
  43. package/templates/.agents/skills/close-codescan/SKILL.en.md +2 -2
  44. package/templates/.agents/skills/close-codescan/SKILL.zh-CN.md +2 -2
  45. package/templates/.agents/skills/commit/SKILL.en.md +1 -1
  46. package/templates/.agents/skills/commit/SKILL.zh-CN.md +1 -1
  47. package/templates/.agents/skills/commit/config/verify.json +2 -1
  48. package/templates/.agents/skills/complete-task/SKILL.en.md +1 -1
  49. package/templates/.agents/skills/complete-task/SKILL.zh-CN.md +1 -1
  50. package/templates/.agents/skills/complete-task/config/verify.json +2 -1
  51. package/templates/.agents/skills/create-pr/SKILL.en.md +2 -2
  52. package/templates/.agents/skills/create-pr/SKILL.zh-CN.md +2 -2
  53. package/templates/.agents/skills/create-pr/config/verify.json +2 -1
  54. package/templates/.agents/skills/create-pr/reference/pr-body-template.en.md +7 -17
  55. package/templates/.agents/skills/create-pr/reference/pr-body-template.zh-CN.md +27 -37
  56. package/templates/.agents/skills/create-release-note/SKILL.en.md +9 -9
  57. package/templates/.agents/skills/create-release-note/SKILL.zh-CN.md +9 -9
  58. package/templates/.agents/skills/create-task/SKILL.en.md +70 -12
  59. package/templates/.agents/skills/create-task/SKILL.zh-CN.md +71 -13
  60. package/templates/.agents/skills/create-task/config/verify.json +6 -1
  61. package/templates/.agents/skills/implement-task/SKILL.en.md +1 -1
  62. package/templates/.agents/skills/implement-task/SKILL.zh-CN.md +1 -1
  63. package/templates/.agents/skills/implement-task/config/verify.json +3 -1
  64. package/templates/.agents/skills/implement-task/reference/implementation-rules.en.md +7 -12
  65. package/templates/.agents/skills/implement-task/reference/implementation-rules.zh-CN.md +7 -12
  66. package/templates/.agents/skills/import-codescan/SKILL.en.md +1 -1
  67. package/templates/.agents/skills/import-codescan/SKILL.zh-CN.md +1 -1
  68. package/templates/.agents/skills/import-issue/SKILL.en.md +40 -10
  69. package/templates/.agents/skills/import-issue/SKILL.zh-CN.md +40 -10
  70. package/templates/.agents/skills/init-labels/SKILL.en.md +9 -9
  71. package/templates/.agents/skills/init-labels/SKILL.zh-CN.md +9 -9
  72. package/templates/.agents/skills/init-milestones/SKILL.en.md +7 -7
  73. package/templates/.agents/skills/init-milestones/SKILL.zh-CN.md +7 -7
  74. package/templates/.agents/skills/plan-task/SKILL.en.md +1 -1
  75. package/templates/.agents/skills/plan-task/SKILL.zh-CN.md +1 -1
  76. package/templates/.agents/skills/plan-task/config/verify.json +3 -1
  77. package/templates/.agents/skills/refine-task/SKILL.en.md +1 -1
  78. package/templates/.agents/skills/refine-task/SKILL.zh-CN.md +1 -1
  79. package/templates/.agents/skills/refine-task/config/verify.json +3 -1
  80. package/templates/.agents/skills/refine-task/reference/fix-workflow.en.md +2 -2
  81. package/templates/.agents/skills/refine-task/reference/fix-workflow.zh-CN.md +2 -2
  82. package/templates/.agents/skills/restore-task/SKILL.en.md +13 -64
  83. package/templates/.agents/skills/restore-task/SKILL.zh-CN.md +13 -64
  84. package/templates/.agents/skills/review-task/SKILL.en.md +1 -1
  85. package/templates/.agents/skills/review-task/SKILL.zh-CN.md +1 -1
  86. package/templates/.agents/skills/review-task/config/verify.json +3 -1
  87. package/templates/.agents/skills/test/SKILL.en.md +45 -6
  88. package/templates/.agents/skills/test/SKILL.zh-CN.md +45 -6
  89. package/templates/.agents/skills/update-agent-infra/SKILL.en.md +2 -0
  90. package/templates/.agents/skills/update-agent-infra/SKILL.zh-CN.md +2 -0
  91. package/templates/.agents/skills/update-agent-infra/scripts/sync-templates.js +56 -5
  92. package/templates/.claude/commands/import-issue.en.md +1 -1
  93. package/templates/.claude/commands/import-issue.zh-CN.md +1 -1
  94. package/templates/.claude/commands/init-labels.en.md +1 -1
  95. package/templates/.claude/commands/init-labels.zh-CN.md +1 -1
  96. package/templates/.claude/commands/init-milestones.en.md +1 -1
  97. package/templates/.claude/commands/init-milestones.zh-CN.md +1 -1
  98. package/templates/.claude/commands/restore-task.en.md +1 -1
  99. package/templates/.claude/commands/restore-task.zh-CN.md +1 -1
  100. package/templates/.claude/hooks/check-version-format.sh +1 -1
  101. package/templates/.gemini/commands/_project_/import-issue.en.toml +1 -1
  102. package/templates/.gemini/commands/_project_/import-issue.zh-CN.toml +1 -1
  103. package/templates/.gemini/commands/_project_/init-labels.en.toml +2 -2
  104. package/templates/.gemini/commands/_project_/init-labels.zh-CN.toml +2 -2
  105. package/templates/.gemini/commands/_project_/init-milestones.en.toml +2 -2
  106. package/templates/.gemini/commands/_project_/init-milestones.zh-CN.toml +2 -2
  107. package/templates/.gemini/commands/_project_/restore-task.en.toml +1 -1
  108. package/templates/.gemini/commands/_project_/restore-task.zh-CN.toml +1 -1
  109. package/templates/{.github/hooks → .git-hooks}/check-version-format.sh +2 -2
  110. package/templates/.github/workflows/pr-label.yml +1 -1
  111. package/templates/.opencode/commands/import-issue.en.md +1 -1
  112. package/templates/.opencode/commands/import-issue.zh-CN.md +1 -1
  113. package/templates/.opencode/commands/init-labels.en.md +1 -1
  114. package/templates/.opencode/commands/init-labels.zh-CN.md +1 -1
  115. package/templates/.opencode/commands/init-milestones.en.md +1 -1
  116. package/templates/.opencode/commands/init-milestones.zh-CN.md +1 -1
  117. package/templates/.opencode/commands/restore-task.en.md +1 -1
  118. package/templates/.opencode/commands/restore-task.zh-CN.md +1 -1
  119. package/templates/.agents/skills/create-issue/SKILL.en.md +0 -118
  120. package/templates/.agents/skills/create-issue/SKILL.zh-CN.md +0 -118
  121. package/templates/.agents/skills/create-issue/config/verify.json +0 -29
  122. package/templates/.agents/skills/create-issue/reference/label-and-type.en.md +0 -71
  123. package/templates/.agents/skills/create-issue/reference/label-and-type.zh-CN.md +0 -71
  124. package/templates/.agents/skills/create-issue/reference/template-matching.en.md +0 -45
  125. package/templates/.agents/skills/create-issue/reference/template-matching.zh-CN.md +0 -45
  126. package/templates/.claude/commands/create-issue.en.md +0 -8
  127. package/templates/.claude/commands/create-issue.zh-CN.md +0 -8
  128. package/templates/.gemini/commands/_project_/create-issue.en.toml +0 -8
  129. package/templates/.gemini/commands/_project_/create-issue.zh-CN.toml +0 -8
  130. package/templates/.opencode/commands/create-issue.en.md +0 -11
  131. package/templates/.opencode/commands/create-issue.zh-CN.md +0 -11
  132. /package/templates/{.github/hooks → .git-hooks}/pre-commit +0 -0
@@ -7,13 +7,14 @@ description: "根据自然语言描述创建任务"
7
7
 
8
8
  ## 行为边界 / 关键规则
9
9
 
10
- **本技能的唯一产出是 `task.md`。**
10
+ **本技能的核心产出是 `task.md`。**
11
11
 
12
12
  - 不要编写、修改或创建任何业务代码或配置文件
13
13
  - 不要执行需求分析;分析由 `analyze-task` 独立完成
14
14
  - 不要直接实现所描述的功能
15
15
  - 不要跳过工作流直接进入计划/实现阶段
16
- - 仅执行:解析描述 -> 创建任务文件 -> 更新任务状态 -> 告知用户下一步
16
+ - 仅执行:解析描述 -> 创建任务文件 -> 更新任务状态 -> 按 `.agents/rules/create-issue.md` 级联尝试创建 Issue -> 告知用户下一步
17
+ - Issue 创建由 `.agents/rules/create-issue.md` 规则决定;自定义或空平台(未提供平台变体规则文件)时,规则会自然降级为 no-op
17
18
 
18
19
  用户的描述是一个**待办事项**,而不是**立即执行的指令**。
19
20
 
@@ -98,7 +99,21 @@ date "+%Y-%m-%d %H:%M:%S%:z"
98
99
  - {YYYY-MM-DD HH:mm:ss±HH:MM} — **Task Created** by {agent} — Task created from description
99
100
  ```
100
101
 
101
- ### 4. 完成校验
102
+ ### 4. 按 `.agents/rules/create-issue.md` 级联创建 Issue
103
+
104
+ 在 task.md 落盘并记录 `Task Created` 后,先读取 `.agents/rules/create-issue.md` 并按其中描述的步骤执行 Issue 创建。
105
+
106
+ 规则文件由当前配置的代码平台决定其内容:
107
+ - 支持 Issue 创建的平台:包含完整的认证检测、模板检测、label/Issue Type/milestone 推断、Issue 创建调用、`task.md` 回写流程
108
+ - 自定义或空平台(未提供平台变体规则文件):内容为 no-op 说明,本步骤直接跳过
109
+
110
+ 处理结果:
111
+ - 规则成功创建 Issue:`issue_number` 已按规则回写到 task.md;继续读取 `.agents/rules/issue-sync.md`,完成 upstream 仓库检测和权限检测,然后同步 task 评论并按规则设置 `status: waiting-for-triage`
112
+ - 规则失败(认证 / 网络 / 模板解析等):不回滚 task.md;获取当前时间,追加 `Issue Creation Skipped` Activity Log,说明错误原因
113
+ - 规则为 no-op(自定义或空平台):不创建评论,不阻塞后续工作流,不写 Activity Log
114
+ - task.md 已存在 `issue_number`:规则中的前置检查会跳过;`create-task` 直接进入步骤 5
115
+
116
+ ### 5. 完成校验
102
117
 
103
118
  运行完成校验,确认任务产物和同步状态符合规范:
104
119
 
@@ -113,13 +128,33 @@ node .agents/scripts/validate-artifact.js gate create-task .agents/workspace/act
113
128
 
114
129
  将校验输出保留在回复中作为当次验证输出。没有当次校验输出,不得声明完成。
115
130
 
116
- ### 5. 告知用户
131
+ ### 6. 告知用户
117
132
 
118
133
  > 仅在校验通过后执行本步骤。
119
134
 
120
135
  > **重要**:以下「下一步」中列出的所有 TUI 命令格式必须完整输出,不要只展示当前 AI 代理对应的格式。如果 `.agents/.airc.json` 中配置了自定义 TUI(`customTUIs`),读取每个工具的 `name` 和 `invoke`,按同样格式补充对应命令行(`${skillName}` 替换为技能名,`${projectName}` 替换为项目名)。
121
136
 
122
- 输出格式:
137
+ 场景 A:已创建 Issue 时输出:
138
+ ```
139
+ 任务已创建,并已级联创建 Issue。
140
+
141
+ 任务信息:
142
+ - 任务 ID:{task-id}
143
+ - 标题:{title}
144
+ - 类型:{type}
145
+ - 工作流:{workflow}
146
+ - Issue:#{issue_number} {issue_url}
147
+
148
+ 产出文件:
149
+ - 任务文件:.agents/workspace/active/{task-id}/task.md
150
+
151
+ 下一步 - 执行需求分析:
152
+ - Claude Code / OpenCode:/analyze-task {task-id}
153
+ - Gemini CLI:/{{project}}:analyze-task {task-id}
154
+ - Codex CLI:$analyze-task {task-id}
155
+ ```
156
+
157
+ 场景 B:未创建 Issue 时输出:
123
158
  ```
124
159
  任务已创建。
125
160
 
@@ -134,13 +169,34 @@ node .agents/scripts/validate-artifact.js gate create-task .agents/workspace/act
134
169
 
135
170
  下一步 - 执行需求分析:
136
171
  - Claude Code / OpenCode:/analyze-task {task-id}
137
- - Gemini CLI:/agent-infra:analyze-task {task-id}
172
+ - Gemini CLI:/{{project}}:analyze-task {task-id}
173
+ - Codex CLI:$analyze-task {task-id}
174
+ ```
175
+
176
+ 场景 C:Issue 创建失败时输出:
177
+ ```
178
+ 任务已创建,但 Issue 级联创建失败。
179
+
180
+ 任务信息:
181
+ - 任务 ID:{task-id}
182
+ - 标题:{title}
183
+ - 类型:{type}
184
+ - 工作流:{workflow}
185
+
186
+ Issue 创建失败:
187
+ - 错误码:{error_code}
188
+ - 原因:{error_message}
189
+ - 本地 task.md 已保留,未回滚
190
+
191
+ 产出文件:
192
+ - 任务文件:.agents/workspace/active/{task-id}/task.md
193
+
194
+ 下一步 - 执行需求分析:
195
+ - Claude Code / OpenCode:/analyze-task {task-id}
196
+ - Gemini CLI:/{{project}}:analyze-task {task-id}
138
197
  - Codex CLI:$analyze-task {task-id}
139
198
 
140
- 或先创建 GitHub Issue
141
- - Claude Code / OpenCode:/create-issue {task-id}
142
- - Gemini CLI:/agent-infra:create-issue {task-id}
143
- - Codex CLI:$create-issue {task-id}
199
+ 后续如需平台同步:修复认证/网络/模板问题后,可按 `.agents/rules/create-issue.md` 对当前任务手动执行一次 Issue 创建;或手动创建/查找 Issue,并把 `issue_number` 写入 task.md,后续技能会接管级联同步。
144
200
  ```
145
201
 
146
202
  ## 完成检查清单
@@ -150,8 +206,9 @@ node .agents/scripts/validate-artifact.js gate create-task .agents/workspace/act
150
206
  - [ ] 更新了 task.md 中的 `updated_at` 为当前时间
151
207
  - [ ] 更新了 task.md 中的 `assigned_to`
152
208
  - [ ] 追加了 Activity Log 条目到 task.md
209
+ - [ ] 已按 `.agents/rules/create-issue.md` 尝试级联创建 Issue;失败时保留 task.md 并记录原因
153
210
  - [ ] 告知了用户下一步(必须展示所有 TUI 的命令格式,含自定义 TUI,不要筛选)
154
- - [ ] **没有修改任何业务代码或配置文件**(仅 task.md)
211
+ - [ ] **没有修改任何业务代码或配置文件**
155
212
 
156
213
  ## 停止
157
214
 
@@ -161,8 +218,9 @@ node .agents/scripts/validate-artifact.js gate create-task .agents/workspace/act
161
218
  ## 注意事项
162
219
 
163
220
  1. **清晰度**:如果用户描述模糊或缺少关键信息,先要求澄清
164
- 2. **与 import-issue 的区别**:`import-issue` 从 GitHub Issue 导入任务;`create-task` 从自由描述创建
165
- 3. **工作流顺序**:创建任务后,通常先执行 `analyze-task` 再进入 `plan-task`;如需先建立 GitHub 跟踪,也可先执行 `create-issue`
221
+ 2. **与 import-issue 的区别**:`import-issue` 从 Issue 导入任务;`create-task` 从自由描述创建
222
+ 3. **工作流顺序**:创建任务后,通常先执行 `analyze-task` 再进入 `plan-task`
223
+ 4. **Issue 级联失败**:如果规则执行失败,task.md 仍保留;需要后续平台同步时,可手动写入 `issue_number` 后继续执行工作流
166
224
 
167
225
  ## 错误处理
168
226
 
@@ -20,6 +20,11 @@
20
20
  "expected_action_pattern": "Task Created",
21
21
  "freshness_minutes": 30
22
22
  },
23
- "platform-sync": null
23
+ "platform-sync": {
24
+ "when": "issue_number_exists",
25
+ "issue_must_exist": true,
26
+ "verify_task_comment_content": true,
27
+ "expected_status_label_key": "waitingForTriage"
28
+ }
24
29
  }
25
30
  }
@@ -95,7 +95,7 @@ Update `.agents/workspace/active/{task-id}/task.md`:
95
95
 
96
96
  If task.md contains a valid `issue_number`, perform these sync actions (skip and continue on any failure; read `.agents/rules/issue-sync.md` first and complete upstream repository detection plus permission detection):
97
97
  - Set `status: in-progress` by following issue-sync.md
98
- - Create or update the `<!-- sync-issue:{task-id}:task -->` comment (follow the task.md comment sync rule in issue-sync.md)
98
+ - Create or update the task comment marker defined in `.agents/rules/issue-sync.md` (follow the task.md comment sync rule in issue-sync.md)
99
99
  - Publish the `{implementation-artifact}` comment
100
100
 
101
101
  ### 10. Verification Gate
@@ -95,7 +95,7 @@ date "+%Y-%m-%d %H:%M:%S%:z"
95
95
 
96
96
  如果 task.md 中存在有效的 `issue_number`,执行以下同步操作(任一失败则跳过并继续;执行前先读取 `.agents/rules/issue-sync.md`,完成 upstream 仓库检测和权限检测):
97
97
  - 按 issue-sync.md 设置 `status: in-progress`
98
- - 创建或更新 `<!-- sync-issue:{task-id}:task -->` 评论(按 issue-sync.md 的 task.md 评论同步规则)
98
+ - 创建或更新 `.agents/rules/issue-sync.md` 中定义的 task 评论标记(按 issue-sync.md 的 task.md 评论同步规则)
99
99
  - 发布 `{implementation-artifact}` 评论
100
100
 
101
101
  ### 10. 完成校验
@@ -36,7 +36,9 @@
36
36
  "verify_comment_content": true,
37
37
  "verify_task_comment_content": true,
38
38
  "verify_issue_type": true,
39
- "verify_milestone": true
39
+ "verify_milestone": true,
40
+ "expected_status_label_key": "inProgress",
41
+ "expected_comment_marker_key": "artifact"
40
42
  }
41
43
  }
42
44
  }
@@ -16,31 +16,26 @@ Follow the `implementation` step in `.agents/workflows/feature-development.yaml`
16
16
  **Implementation principles**:
17
17
  1. **Follow the plan strictly**: do not deviate from the technical plan
18
18
  2. **Work step by step**: execute the planned sequence
19
- 3. **Keep testing continuously**: re-run tests as work progresses
19
+ 3. **Keep testing continuously**: run the **smoke subset** continuously as work progresses (see the `test` skill)
20
20
  4. **Keep it simple**: do not add unplanned features
21
21
 
22
22
  ## Run Test Verification
23
23
 
24
- Run the project test command. Refer to the `test` skill for project-specific commands.
24
+ During implementation:
25
+ - **Inner loop**: after each change, run the project's **smoke subset** (see the `test` skill) for fast feedback
26
+ - **Before writing the implementation report**: run the **core subset** as final verification so code entering review has passed the complete core checks
25
27
 
26
- ```bash
27
- # See .agents/skills/test/SKILL.md for the project's test command
28
- # Common patterns:
29
- # npm test (Node.js)
30
- # mvn test (Maven)
31
- # pytest (Python)
32
- # go test ./... (Go)
33
- ```
28
+ > Refer to the `test` skill for project-specific commands; downstream projects without layered scripts should fall back to the full project test command.
34
29
 
35
30
  If tests fail:
36
31
  - analyze the failure first and prioritize fixing issues introduced by this implementation
37
- - re-run tests after each fix until they pass, or confirm that the problem is an external blocker
32
+ - after each fix, re-run at least the smoke subset, then upgrade to core for the next full-pass verification
38
33
  - only stop without producing the implementation artifact when the failure is caused by an external blocker, missing environment, or unclear requirement that cannot be resolved inside the task
39
34
 
40
35
  Two-way failure handling:
41
36
  1. implementation-caused failures:
42
37
  - fix the code, tests, docs, or fixtures introduced by this implementation
43
- - re-run the test command after each fix
38
+ - re-run tests after each fix (smoke for the immediate fix verification, core for the round-level verification)
44
39
  - continue until all required tests pass
45
40
  2. external blockers:
46
41
  - confirm the failure comes from missing environment, unrelated upstream breakage, or unclear requirements outside this task
@@ -16,31 +16,26 @@
16
16
  **实现原则**:
17
17
  1. **严格遵循方案**:不要偏离技术方案
18
18
  2. **按步骤推进**:按计划顺序执行
19
- 3. **持续测试**:实现过程中持续重新运行测试
19
+ 3. **持续测试**:实现过程中持续运行 **smoke 子集**(参见 `test` skill)
20
20
  4. **保持简单**:不要加入未计划的功能
21
21
 
22
22
  ## 运行测试验证
23
23
 
24
- 运行项目测试命令。项目特定命令请参考 `test` skill。
24
+ 实现过程中:
25
+ - **内循环**:每次修改后运行项目测试的 **smoke 子集**(参见 `test` skill),快速反馈
26
+ - **写实现报告前**:运行 **core 子集**做最终验证,确保进入审查的代码已通过完整的核心测试
25
27
 
26
- ```bash
27
- # 参考 .agents/skills/test/SKILL.md 中的项目测试命令
28
- # 常见模式:
29
- # npm test (Node.js)
30
- # mvn test (Maven)
31
- # pytest (Python)
32
- # go test ./... (Go)
33
- ```
28
+ > 项目特定命令请参考 `test` skill;不存在分层 script 的下游项目回退到完整项目测试命令。
34
29
 
35
30
  如果测试失败:
36
31
  - 先分析失败原因,并优先修复由本次实现引入的问题
37
- - 每次修复后重新运行测试,直到通过,或者确认问题属于外部阻塞
32
+ - 每次修复后重新运行至少 smoke 子集,进入下一轮再升级到 core
38
33
  - 只有当失败由外部阻塞、环境缺失或当前任务内无法澄清的需求问题导致时,才允许在不生成实现产物的情况下停止
39
34
 
40
35
  双分支失败处理:
41
36
  1. 本次实现引入的失败:
42
37
  - 修复由本次实现引入的代码、测试、文档或 fixture 问题
43
- - 每次修复后重新运行测试命令
38
+ - 每次修复后重新运行测试(smoke 用于本次修复验证,core 用于本轮整体验证)
44
39
  - 持续处理直到所有必需测试通过
45
40
  2. 外部阻塞:
46
41
  - 确认失败来自缺失环境、无关的上游损坏,或任务范围外的需求不明确
@@ -25,7 +25,7 @@ Extract key information:
25
25
  - `rule`: rule information (`id`, `severity`, `description`, `security_severity_level`)
26
26
  - `tool`: scanning tool information (`name`, `version`)
27
27
  - `most_recent_instance`: location (`path`, `start_line`, `end_line`) and message
28
- - `html_url`: GitHub alert link
28
+ - `html_url`: alert link in the platform
29
29
 
30
30
  ### 2. Create the Task Directory and File
31
31
 
@@ -25,7 +25,7 @@ description: "导入 Code Scanning 告警并创建修复任务"
25
25
  - `rule`:规则信息(id、severity、description、security_severity_level)
26
26
  - `tool`:扫描工具信息(name、version)
27
27
  - `most_recent_instance`:位置(path、start_line、end_line)、消息
28
- - `html_url`:GitHub 告警链接
28
+ - `html_url`:平台告警链接
29
29
 
30
30
  ### 2. 创建任务目录和文件
31
31
 
@@ -1,11 +1,11 @@
1
1
  ---
2
2
  name: import-issue
3
- description: "Import a GitHub Issue and create a task"
3
+ description: "Import an Issue and create a task"
4
4
  ---
5
5
 
6
6
  # Import Issue
7
7
 
8
- Import the specified GitHub Issue and create a task. Argument: issue number.
8
+ Import the specified Issue and create a task. Argument: issue number.
9
9
 
10
10
  ## Boundary / Critical Rules
11
11
 
@@ -24,22 +24,46 @@ Use the Issue title as-is for the task title (preserve the Issue's original lang
24
24
 
25
25
  ### 2. Check for an Existing Task
26
26
 
27
- Search `.agents/workspace/active/` for an existing task linked to this Issue.
27
+ 2.1 Search `.agents/workspace/active/` for an existing task linked to this Issue.
28
28
  - If found, ask the user whether to re-import or continue with the existing task
29
- - If not found, create a new task
29
+ - If not found, continue to 2.2
30
+
31
+ 2.2 Scan Issue comments for sync markers and look for a recoverable historical task ID:
32
+
33
+ If `$upstream_repo` was not set in step 1, omit `--repo`; the script will infer it using the issue-sync.md detection rule.
34
+
35
+ ```bash
36
+ node .agents/scripts/platform-adapters/find-existing-task.js --issue <issue-number> --repo "$upstream_repo" --format json
37
+ ```
38
+
39
+ - Script outputs `found=false`: create a new task through the normal import flow
40
+ - Script outputs `found=true`: reuse `task_id`
41
+ - Script exits 2: treat it as network, authentication, or platform API degradation; show the failure reason from script stderr to the user, then continue with the new-task import flow without blocking
30
42
 
31
43
  ### 3. Create the Task Directory and File
32
44
 
45
+ 3.1 Decide the task ID and `created_at`.
46
+
47
+ | Scenario | Trigger | task ID source | created_at source | User confirmation |
48
+ |---|---|---|---|---|
49
+ | Scenario A | 2.1 finds a local task | Reuse local ID | Preserve local value | Must ask whether to re-import or continue using the existing task |
50
+ | Scenario B | 2.1 no match + 2.2 no candidate | Create with `date +%Y%m%d-%H%M%S` | Current time | Not required |
51
+ | Scenario C | 2.1 no match + 2.2 any candidate | Automatically reuse the earliest candidate ID | Prefer remote frontmatter `created_at`; use current time if missing | Inform only |
52
+
33
53
  ```bash
34
54
  date +%Y%m%d-%H%M%S
35
55
  ```
36
56
 
37
- - Create the directory: `.agents/workspace/active/TASK-{yyyyMMdd-HHmmss}/`
57
+ 3.2 Write the task directory and `task.md`.
58
+
59
+ - Create the directory: `.agents/workspace/active/{task-id}/`
38
60
  - Use the `.agents/templates/task.md` template to create `task.md`
61
+ - 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
62
+ - Always write `current_step` as `requirement-analysis`; do not restore the remote original `current_step`
39
63
 
40
64
  Task metadata:
41
65
  ```yaml
42
- id: TASK-{yyyyMMdd-HHmmss}
66
+ id: {task-id}
43
67
  issue_number: <issue-number>
44
68
  type: feature|bugfix|refactor|docs|chore
45
69
  branch: <project>-<type>-<slug>
@@ -52,6 +76,11 @@ current_step: requirement-analysis
52
76
  assigned_to: {current AI agent}
53
77
  ```
54
78
 
79
+ 3.3 Append Activity Log entries.
80
+
81
+ - Scenario B: append `Import Issue`
82
+ - Scenario C: append `Import Issue (Recovered)` and include the recovered task ID, any recoverable original `current_step`, original `assigned_to`, and that `current_step` was reset to `requirement-analysis`; if some frontmatter fields are missing or damaged, mention the fallback in the same entry
83
+
55
84
  ### 4. Update Task Status
56
85
 
57
86
  Get the current time:
@@ -69,6 +98,7 @@ Update `.agents/workspace/active/{task-id}/task.md`:
69
98
  ```
70
99
  - {YYYY-MM-DD HH:mm:ss±HH:MM} — **Import Issue** by {agent} — Issue #{number} imported
71
100
  ```
101
+ If step 3.3 already appended recovery Activity Log entries, do not append a duplicate equivalent entry.
72
102
 
73
103
  ### 5. Assign the Issue Assignee
74
104
 
@@ -78,8 +108,8 @@ If task.md contains a valid `issue_number`, use the Issue update command from `.
78
108
 
79
109
  If task.md contains a valid `issue_number`, perform these sync actions (skip and continue on any failure):
80
110
  - Read `.agents/rules/issue-sync.md` before syncing, and complete upstream repository detection plus permission detection
81
- - Check the Issue's current milestone; if it is unset, read `.agents/rules/milestone-inference.md` and infer plus set the milestone using "Stage 1: `create-issue`". If `has_triage=false` or the inference is uncertain, skip and continue
82
- - Create or update the `<!-- sync-issue:{task-id}:task -->` comment (follow the task.md comment sync rule in issue-sync.md)
111
+ - Check the Issue's current milestone; if it is unset, read `.agents/rules/milestone-inference.md` and infer plus set the milestone using "Phase 1: `create-task` (when the platform rule creates an Issue)". If `has_triage=false` or the inference is uncertain, skip and continue
112
+ - After every scenario, task comment sync is mandatory: create or update the task comment marker defined in `.agents/rules/issue-sync.md` so the remote `:task` comment exists and matches the local `task.md` content (follow the task.md comment sync rule in issue-sync.md)
83
113
 
84
114
  ### 7. Verification Gate
85
115
 
@@ -126,7 +156,7 @@ Next step - run requirements analysis:
126
156
  - [ ] Updated `current_step` to requirement-analysis
127
157
  - [ ] Updated `updated_at` to the current time
128
158
  - [ ] Appended an Activity Log entry to task.md
129
- - [ ] Synced the task comment to the Issue
159
+ - [ ] Synced the task comment to the Issue, with remote content matching local task.md
130
160
  - [ ] Informed the user of the next step (must include all TUI command formats, including any custom TUIs; do not filter)
131
161
  - [ ] **Did not modify any business code**
132
162
 
@@ -143,5 +173,5 @@ After completing the checklist, **stop immediately**. Do not continue to later s
143
173
  ## Error Handling
144
174
 
145
175
  - Issue not found: output "Issue #{number} not found, please check the issue number"
146
- - Network error: output "Cannot connect to GitHub, please check network"
176
+ - Network error: output "Cannot connect to the platform, please check network"
147
177
  - Permission error: output "No access to this repository"
@@ -1,11 +1,11 @@
1
1
  ---
2
2
  name: import-issue
3
- description: "从 GitHub Issue 导入并创建任务"
3
+ description: "从 Issue 导入并创建任务"
4
4
  ---
5
5
 
6
6
  # 导入 Issue
7
7
 
8
- 导入指定的 GitHub Issue 并创建任务。参数:issue 编号。
8
+ 导入指定的 Issue 并创建任务。参数:issue 编号。
9
9
 
10
10
  ## 行为边界 / 关键规则
11
11
 
@@ -24,22 +24,46 @@ description: "从 GitHub Issue 导入并创建任务"
24
24
 
25
25
  ### 2. 检查已有任务
26
26
 
27
- 搜索 `.agents/workspace/active/` 中是否已有链接到此 Issue 的任务。
27
+ 2.1 搜索 `.agents/workspace/active/` 中是否已有链接到此 Issue 的任务。
28
28
  - 如果找到,询问用户是重新导入还是继续使用现有任务
29
- - 如果未找到,创建新任务
29
+ - 如果未找到,继续执行 2.2
30
+
31
+ 2.2 扫描 Issue 评论中的同步标记,查找可恢复的历史任务 ID:
32
+
33
+ 如未在步骤 1 中已设置 `$upstream_repo`,可省略 `--repo`,脚本会自动按 issue-sync.md 的检测规则推断。
34
+
35
+ ```bash
36
+ node .agents/scripts/platform-adapters/find-existing-task.js --issue <issue-number> --repo "$upstream_repo" --format json
37
+ ```
38
+
39
+ - 脚本输出 `found=false`:按新 Issue 导入流程创建新任务
40
+ - 脚本输出 `found=true`:复用 `task_id`
41
+ - 脚本退出码 2:视为网络、认证或 platform API 降级,向用户展示脚本 stderr 中的失败原因后,按新 Issue 导入流程继续,不阻塞导入
30
42
 
31
43
  ### 3. 创建任务目录和文件
32
44
 
45
+ 3.1 决定 task ID 和 `created_at`。
46
+
47
+ | 场景 | 触发条件 | task ID 来源 | created_at 来源 | 用户确认 |
48
+ |---|---|---|---|---|
49
+ | 场景 A | 2.1 命中本地任务 | 复用本地 ID | 本地保留 | 必须询问"重新导入还是继续使用现有任务" |
50
+ | 场景 B | 2.1 无命中 + 2.2 无候选 | `date +%Y%m%d-%H%M%S` 新建 | 当前时间 | 不需要 |
51
+ | 场景 C | 2.1 无命中 + 2.2 有候选 | 自动复用最早候选 ID | 优先用远端 frontmatter 的 `created_at`,缺失时用当前时间 | 告知即可 |
52
+
33
53
  ```bash
34
54
  date +%Y%m%d-%H%M%S
35
55
  ```
36
56
 
37
- - 创建目录:`.agents/workspace/active/TASK-{yyyyMMdd-HHmmss}/`
57
+ 3.2 写入任务目录和 `task.md`。
58
+
59
+ - 创建目录:`.agents/workspace/active/{task-id}/`
38
60
  - 使用 `.agents/templates/task.md` 模板创建 `task.md`
61
+ - 场景 C 优先沿用远端 frontmatter 中的 `type`、`workflow`、`branch`、`created_by`、`milestone`;缺失或损坏字段按 Issue 标签和当前规则重新推断
62
+ - `current_step` 始终写入 `requirement-analysis`,不要恢复为远端原 `current_step`
39
63
 
40
64
  任务元数据:
41
65
  ```yaml
42
- id: TASK-{yyyyMMdd-HHmmss}
66
+ id: {task-id}
43
67
  issue_number: <issue-number>
44
68
  type: feature|bugfix|refactor|docs|chore
45
69
  branch: <project>-<type>-<slug>
@@ -52,6 +76,11 @@ current_step: requirement-analysis
52
76
  assigned_to: {当前 AI 代理}
53
77
  ```
54
78
 
79
+ 3.3 追加 Activity Log。
80
+
81
+ - 场景 B:追加 `Import Issue`
82
+ - 场景 C:追加 `Import Issue (Recovered)`,注明恢复的 task ID、可恢复的原 `current_step`、原 `assigned_to`,并说明 `current_step` 已重置为 `requirement-analysis`;如果部分 frontmatter 字段缺失或损坏,在同一条记录中注明 fallback
83
+
55
84
  ### 4. 更新任务状态
56
85
 
57
86
  获取当前时间:
@@ -69,6 +98,7 @@ date "+%Y-%m-%d %H:%M:%S%:z"
69
98
  ```
70
99
  - {YYYY-MM-DD HH:mm:ss±HH:MM} — **Import Issue** by {agent} — Issue #{number} imported
71
100
  ```
101
+ 如果步骤 3.3 已经按恢复场景追加了 Activity Log,不要重复追加同义记录。
72
102
 
73
103
  ### 5. 分配 Issue Assignee
74
104
 
@@ -78,8 +108,8 @@ date "+%Y-%m-%d %H:%M:%S%:z"
78
108
 
79
109
  如果 task.md 中存在有效的 `issue_number`,执行以下同步操作(任一失败则跳过并继续):
80
110
  - 执行前先读取 `.agents/rules/issue-sync.md`,完成 upstream 仓库检测和权限检测
81
- - 检查 Issue 当前 milestone;如果未设置,先读取 `.agents/rules/milestone-inference.md`,按其中的「阶段 1:`create-issue`」规则推断并设置 milestone;如果 `has_triage=false` 或推断不确定,跳过并继续
82
- - 创建或更新 `<!-- sync-issue:{task-id}:task -->` 评论(按 issue-sync.md 的 task.md 评论同步规则)
111
+ - 检查 Issue 当前 milestone;如果未设置,先读取 `.agents/rules/milestone-inference.md`,按其中的「阶段 1:`create-task`(平台规则创建 Issue 时)」规则推断并设置 milestone;如果 `has_triage=false` 或推断不确定,跳过并继续
112
+ - 所有场景结束后,必须执行一次 task 留言同步,创建或更新 `.agents/rules/issue-sync.md` 中定义的 task 评论标记,确保远端 `:task` 评论存在且内容与本地 `task.md` 一致(按 issue-sync.md 的 task.md 评论同步规则)
83
113
 
84
114
  ### 7. 完成校验
85
115
 
@@ -126,7 +156,7 @@ Issue #{number} 已导入。
126
156
  - [ ] 更新了 `current_step` 为 requirement-analysis
127
157
  - [ ] 更新了 `updated_at` 为当前时间
128
158
  - [ ] 追加了 Activity Log 条目到 task.md
129
- - [ ] 同步了 task 评论到 Issue
159
+ - [ ] 同步了 task 评论到 Issue,且远端内容与本地 task.md 一致
130
160
  - [ ] 告知了用户下一步(必须展示所有 TUI 的命令格式,含自定义 TUI,不要筛选)
131
161
  - [ ] **没有修改任何业务代码**
132
162
 
@@ -143,5 +173,5 @@ Issue #{number} 已导入。
143
173
  ## 错误处理
144
174
 
145
175
  - Issue 未找到:提示 "Issue #{number} not found, please check the issue number"
146
- - 网络错误:提示 "Cannot connect to GitHub, please check network"
176
+ - 网络错误:提示 "Cannot connect to the platform, please check network"
147
177
  - 权限错误:提示 "No access to this repository"
@@ -1,11 +1,11 @@
1
1
  ---
2
2
  name: init-labels
3
- description: "Initialize the repository's standard GitHub Labels taxonomy"
3
+ description: "Initialize the repository's standard labels taxonomy"
4
4
  ---
5
5
 
6
- # Initialize GitHub Labels
6
+ # Initialize labels
7
7
 
8
- Initialize the repository's standard GitHub Labels taxonomy.
8
+ Initialize the repository's standard labels taxonomy.
9
9
 
10
10
  ## Execution Flow
11
11
 
@@ -36,14 +36,14 @@ The script and `.agents/rules/label-milestone-setup.md` are responsible for:
36
36
  The script manages these common label families:
37
37
  - `type:` labels such as `type: bug`, `type: enhancement`, `type: feature`, `type: documentation`, `type: dependency-upgrade`, and `type: task`
38
38
  - `status:` labels such as `status: waiting-for-triage`, `status: in-progress`, and `status: waiting-for-internal-feedback`
39
- - GitHub-default-name labels intentionally overwritten in place: `good first issue` and `help wanted`
39
+ - platform-default-name labels intentionally overwritten in place: `good first issue` and `help wanted`
40
40
  - Additional shared labels such as `dependencies`
41
41
 
42
42
  #### Scope
43
43
 
44
44
  | Label prefix | Issue | PR | Notes |
45
45
  |---|---|---|---|
46
- | `type:` | — | Yes | Issues use the native GitHub Type field; PRs need `type:` labels to drive changelog grouping |
46
+ | `type:` | — | Yes | Issues use the native platform Type field; PRs need `type:` labels to drive changelog grouping |
47
47
  | `status:` | Yes | — | PRs already have their own state flow (Open/Draft/Merged/Closed); Issues use `status:` labels for project tracking |
48
48
  | `in:` | Yes | Yes | Both Issues and PRs need module-based filtering |
49
49
 
@@ -98,8 +98,8 @@ Next step - initialize milestones (optional):
98
98
 
99
99
  ## Error Handling
100
100
 
101
- - `gh` not found: prompt "GitHub CLI (`gh`) is not installed"
102
- - Authentication failed: prompt "GitHub CLI is not authenticated"
103
- - Repository access failed: prompt "Unable to access the current repository with gh"
101
+ - platform CLI not found: prompt "the platform CLI is not installed"
102
+ - Authentication failed: prompt "the platform CLI is not authenticated"
103
+ - Repository access failed: prompt "Unable to access the current repository with the platform CLI"
104
104
  - Permission error: prompt "No permission to manage labels in this repository"
105
- - API rate limit: prompt "GitHub API rate limit reached, please retry later"
105
+ - API rate limit: prompt "platform API rate limit reached, please retry later"
@@ -1,11 +1,11 @@
1
1
  ---
2
2
  name: init-labels
3
- description: "初始化仓库的 GitHub Labels 体系"
3
+ description: "初始化仓库的 labels 体系"
4
4
  ---
5
5
 
6
- # 初始化 GitHub Labels
6
+ # 初始化 labels
7
7
 
8
- 一次性初始化仓库的标准 GitHub Labels 体系。
8
+ 一次性初始化仓库的标准 labels 体系。
9
9
 
10
10
  ## 执行流程
11
11
 
@@ -36,14 +36,14 @@ bash .agents/skills/init-labels/scripts/init-labels.sh
36
36
  脚本管理以下通用 label 族:
37
37
  - `type:` labels,例如 `type: bug`、`type: enhancement`、`type: feature`、`type: documentation`、`type: dependency-upgrade`、`type: task`
38
38
  - `status:` labels,例如 `status: waiting-for-triage`、`status: in-progress`、`status: waiting-for-internal-feedback`
39
- - 明确覆盖的 GitHub 默认同名 labels:`good first issue` 和 `help wanted`
39
+ - 明确覆盖的 平台默认同名 labels:`good first issue` 和 `help wanted`
40
40
  - 额外通用 labels,例如 `dependencies`
41
41
 
42
42
  #### 适用范围
43
43
 
44
44
  | Label 前缀 | Issue | PR | 说明 |
45
45
  |---|---|---|---|
46
- | `type:` | — | Yes | Issue 使用 GitHub 原生 Type 字段;PR 无原生类型字段,需 `type:` label 驱动 changelog |
46
+ | `type:` | — | Yes | Issue 使用 平台原生 Type 字段;PR 无原生类型字段,需 `type:` label 驱动 changelog |
47
47
  | `status:` | Yes | — | PR 有自身状态流转(Open/Draft/Merged/Closed);Issue 使用 `status:` label 标记项目管理状态 |
48
48
  | `in:` | Yes | Yes | Issue 和 PR 均需按模块筛选 |
49
49
 
@@ -98,8 +98,8 @@ bash .agents/skills/init-labels/scripts/init-labels.sh
98
98
 
99
99
  ## 错误处理
100
100
 
101
- - 未找到 `gh`:提示 "GitHub CLI (`gh`) is not installed"
102
- - 认证失败:提示 "GitHub CLI is not authenticated"
103
- - 仓库访问失败:提示 "Unable to access the current repository with gh"
101
+ - 未找到平台 CLI:提示 "the platform CLI is not installed"
102
+ - 认证失败:提示 "the platform CLI is not authenticated"
103
+ - 仓库访问失败:提示 "Unable to access the current repository with the platform CLI"
104
104
  - 权限不足:提示 "No permission to manage labels in this repository"
105
- - API 限流:提示 "GitHub API rate limit reached, please retry later"
105
+ - API 限流:提示 "platform API rate limit reached, please retry later"
@@ -1,11 +1,11 @@
1
1
  ---
2
2
  name: init-milestones
3
- description: "Initialize the repository's standard GitHub Milestones taxonomy"
3
+ description: "Initialize the repository's standard milestones taxonomy"
4
4
  ---
5
5
 
6
- # Initialize GitHub Milestones
6
+ # Initialize milestones
7
7
 
8
- Initialize the repository's standard GitHub Milestones taxonomy.
8
+ Initialize the repository's standard milestones taxonomy.
9
9
 
10
10
  ## Execution Flow
11
11
 
@@ -75,10 +75,10 @@ Next step - initialize labels (optional):
75
75
 
76
76
  ## Error Handling
77
77
 
78
- - `gh` not found: prompt "GitHub CLI (`gh`) is not installed"
79
- - Authentication failed: prompt "GitHub CLI is not authenticated"
80
- - Repository access failed: prompt "Unable to access the current repository with gh"
78
+ - platform CLI not found: prompt "the platform CLI is not installed"
79
+ - Authentication failed: prompt "the platform CLI is not authenticated"
80
+ - Repository access failed: prompt "Unable to access the current repository with the platform CLI"
81
81
  - Version detection failed: prompt "Unable to determine current version baseline"
82
82
  - No `v*` tags found in `--history` mode: prompt "No history tags found matching v*; only standard milestones will be created"
83
83
  - Permission error: prompt "No permission to manage milestones in this repository"
84
- - API rate limit: prompt "GitHub API rate limit reached, please retry later"
84
+ - API rate limit: prompt "platform API rate limit reached, please retry later"