@fitlab-ai/agent-infra 0.4.0 → 0.4.2

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 (276) hide show
  1. package/README.md +23 -15
  2. package/README.zh-CN.md +23 -15
  3. package/lib/defaults.json +5 -9
  4. package/lib/init.js +1 -6
  5. package/lib/update.js +0 -55
  6. package/package.json +1 -1
  7. package/templates/.agents/QUICKSTART.md +17 -7
  8. package/templates/.agents/QUICKSTART.zh-CN.md +23 -13
  9. package/templates/.agents/README.md +33 -27
  10. package/templates/.agents/README.zh-CN.md +35 -29
  11. package/templates/.agents/skills/analyze-task/SKILL.md +1 -4
  12. package/templates/.agents/skills/analyze-task/SKILL.zh-CN.md +1 -3
  13. package/templates/.agents/skills/block-task/SKILL.md +1 -5
  14. package/templates/.agents/skills/block-task/SKILL.zh-CN.md +1 -4
  15. package/templates/.agents/skills/check-task/SKILL.md +1 -5
  16. package/templates/.agents/skills/check-task/SKILL.zh-CN.md +1 -3
  17. package/templates/.agents/skills/close-codescan/SKILL.md +1 -4
  18. package/templates/.agents/skills/close-codescan/SKILL.zh-CN.md +1 -3
  19. package/templates/.agents/skills/close-dependabot/SKILL.md +1 -4
  20. package/templates/.agents/skills/close-dependabot/SKILL.zh-CN.md +1 -3
  21. package/templates/.agents/skills/commit/SKILL.md +26 -198
  22. package/templates/.agents/skills/commit/SKILL.zh-CN.md +26 -197
  23. package/templates/.agents/skills/commit/reference/commit-message.md +60 -0
  24. package/templates/.agents/skills/commit/reference/commit-message.zh-CN.md +60 -0
  25. package/templates/.agents/skills/commit/reference/copyright-check.md +39 -0
  26. package/templates/.agents/skills/commit/reference/copyright-check.zh-CN.md +39 -0
  27. package/templates/.agents/skills/commit/reference/task-status-update.md +88 -0
  28. package/templates/.agents/skills/commit/reference/task-status-update.zh-CN.md +88 -0
  29. package/templates/.agents/skills/complete-task/SKILL.md +1 -6
  30. package/templates/.agents/skills/complete-task/SKILL.zh-CN.md +1 -4
  31. package/templates/.agents/skills/create-issue/SKILL.md +32 -251
  32. package/templates/.agents/skills/create-issue/SKILL.zh-CN.md +33 -252
  33. package/templates/.agents/skills/create-issue/reference/label-and-type.md +77 -0
  34. package/templates/.agents/skills/create-issue/reference/label-and-type.zh-CN.md +77 -0
  35. package/templates/.agents/skills/create-issue/reference/template-matching.md +45 -0
  36. package/templates/.agents/skills/create-issue/reference/template-matching.zh-CN.md +45 -0
  37. package/templates/.agents/skills/create-pr/SKILL.md +39 -221
  38. package/templates/.agents/skills/create-pr/SKILL.zh-CN.md +39 -220
  39. package/templates/.agents/skills/create-pr/reference/branch-strategy.md +29 -0
  40. package/templates/.agents/skills/create-pr/reference/branch-strategy.zh-CN.md +29 -0
  41. package/templates/.agents/skills/create-pr/reference/pr-body-template.md +86 -0
  42. package/templates/.agents/skills/create-pr/reference/pr-body-template.zh-CN.md +86 -0
  43. package/templates/.agents/skills/create-release-note/SKILL.md +10 -13
  44. package/templates/.agents/skills/create-release-note/SKILL.zh-CN.md +10 -12
  45. package/templates/.agents/skills/create-task/SKILL.md +2 -5
  46. package/templates/.agents/skills/create-task/SKILL.zh-CN.md +2 -4
  47. package/templates/.agents/skills/implement-task/SKILL.md +47 -176
  48. package/templates/.agents/skills/implement-task/SKILL.zh-CN.md +43 -170
  49. package/templates/.agents/skills/implement-task/reference/implementation-rules.md +58 -0
  50. package/templates/.agents/skills/implement-task/reference/implementation-rules.zh-CN.md +58 -0
  51. package/templates/.agents/skills/implement-task/reference/report-template.md +63 -0
  52. package/templates/.agents/skills/implement-task/reference/report-template.zh-CN.md +63 -0
  53. package/templates/.agents/skills/import-codescan/SKILL.md +1 -4
  54. package/templates/.agents/skills/import-codescan/SKILL.zh-CN.md +1 -3
  55. package/templates/.agents/skills/import-dependabot/SKILL.md +1 -4
  56. package/templates/.agents/skills/import-dependabot/SKILL.zh-CN.md +1 -3
  57. package/templates/.agents/skills/import-issue/SKILL.md +2 -3
  58. package/templates/.agents/skills/import-issue/SKILL.zh-CN.md +2 -3
  59. package/templates/.agents/skills/init-labels/SKILL.md +1 -4
  60. package/templates/.agents/skills/init-labels/SKILL.zh-CN.md +1 -4
  61. package/templates/.agents/skills/init-milestones/SKILL.md +1 -3
  62. package/templates/.agents/skills/init-milestones/SKILL.zh-CN.md +1 -3
  63. package/templates/.agents/skills/plan-task/SKILL.md +1 -5
  64. package/templates/.agents/skills/plan-task/SKILL.zh-CN.md +1 -3
  65. package/templates/.agents/skills/refine-task/SKILL.md +40 -162
  66. package/templates/.agents/skills/refine-task/SKILL.zh-CN.md +38 -158
  67. package/templates/.agents/skills/refine-task/reference/fix-workflow.md +76 -0
  68. package/templates/.agents/skills/refine-task/reference/fix-workflow.zh-CN.md +76 -0
  69. package/templates/.agents/skills/refine-task/reference/report-template.md +38 -0
  70. package/templates/.agents/skills/refine-task/reference/report-template.zh-CN.md +38 -0
  71. package/templates/.agents/skills/refine-title/SKILL.md +1 -4
  72. package/templates/.agents/skills/refine-title/SKILL.zh-CN.md +1 -3
  73. package/templates/.agents/skills/release/SKILL.md +10 -12
  74. package/templates/.agents/skills/release/SKILL.zh-CN.md +10 -11
  75. package/templates/.agents/skills/review-task/SKILL.md +37 -239
  76. package/templates/.agents/skills/review-task/SKILL.zh-CN.md +37 -238
  77. package/templates/.agents/skills/review-task/reference/output-templates.md +72 -0
  78. package/templates/.agents/skills/review-task/reference/output-templates.zh-CN.md +72 -0
  79. package/templates/.agents/skills/review-task/reference/report-template.md +63 -0
  80. package/templates/.agents/skills/review-task/reference/report-template.zh-CN.md +63 -0
  81. package/templates/.agents/skills/review-task/reference/review-criteria.md +24 -0
  82. package/templates/.agents/skills/review-task/reference/review-criteria.zh-CN.md +24 -0
  83. package/templates/.agents/skills/sync-issue/SKILL.md +34 -490
  84. package/templates/.agents/skills/sync-issue/SKILL.zh-CN.md +34 -489
  85. package/templates/.agents/skills/sync-issue/reference/comment-publish.md +84 -0
  86. package/templates/.agents/skills/sync-issue/reference/comment-publish.zh-CN.md +84 -0
  87. package/templates/.agents/skills/sync-issue/reference/label-sync.md +62 -0
  88. package/templates/.agents/skills/sync-issue/reference/label-sync.zh-CN.md +62 -0
  89. package/templates/.agents/skills/sync-issue/reference/milestone-sync.md +37 -0
  90. package/templates/.agents/skills/sync-issue/reference/milestone-sync.zh-CN.md +37 -0
  91. package/templates/.agents/skills/sync-pr/SKILL.md +37 -284
  92. package/templates/.agents/skills/sync-pr/SKILL.zh-CN.md +41 -288
  93. package/templates/.agents/skills/sync-pr/reference/comment-publish.md +82 -0
  94. package/templates/.agents/skills/sync-pr/reference/comment-publish.zh-CN.md +82 -0
  95. package/templates/.agents/skills/sync-pr/reference/delivery-detection.md +54 -0
  96. package/templates/.agents/skills/sync-pr/reference/delivery-detection.zh-CN.md +54 -0
  97. package/templates/.agents/skills/test/SKILL.md +1 -3
  98. package/templates/.agents/skills/test/SKILL.zh-CN.md +1 -3
  99. package/templates/.agents/skills/test-integration/SKILL.md +1 -4
  100. package/templates/.agents/skills/test-integration/SKILL.zh-CN.md +1 -3
  101. package/templates/.agents/skills/update-agent-infra/SKILL.md +2 -6
  102. package/templates/.agents/skills/update-agent-infra/SKILL.zh-CN.md +2 -4
  103. package/templates/.agents/skills/update-agent-infra/scripts/sync-templates.js +45 -55
  104. package/templates/.agents/skills/upgrade-dependency/SKILL.md +1 -4
  105. package/templates/.agents/skills/upgrade-dependency/SKILL.zh-CN.md +1 -3
  106. package/templates/.claude/commands/analyze-task.md +1 -1
  107. package/templates/.claude/commands/analyze-task.zh-CN.md +1 -1
  108. package/templates/.claude/commands/block-task.md +2 -1
  109. package/templates/.claude/commands/block-task.zh-CN.md +2 -1
  110. package/templates/.claude/commands/check-task.md +2 -1
  111. package/templates/.claude/commands/check-task.zh-CN.md +2 -1
  112. package/templates/.claude/commands/close-codescan.md +2 -1
  113. package/templates/.claude/commands/close-codescan.zh-CN.md +2 -1
  114. package/templates/.claude/commands/close-dependabot.md +2 -1
  115. package/templates/.claude/commands/close-dependabot.zh-CN.md +2 -1
  116. package/templates/.claude/commands/commit.md +1 -1
  117. package/templates/.claude/commands/commit.zh-CN.md +1 -1
  118. package/templates/.claude/commands/complete-task.md +1 -1
  119. package/templates/.claude/commands/complete-task.zh-CN.md +1 -1
  120. package/templates/.claude/commands/create-issue.md +1 -1
  121. package/templates/.claude/commands/create-issue.zh-CN.md +1 -1
  122. package/templates/.claude/commands/create-pr.md +2 -2
  123. package/templates/.claude/commands/create-pr.zh-CN.md +2 -2
  124. package/templates/.claude/commands/create-release-note.md +2 -1
  125. package/templates/.claude/commands/create-release-note.zh-CN.md +2 -1
  126. package/templates/.claude/commands/create-task.md +1 -1
  127. package/templates/.claude/commands/create-task.zh-CN.md +1 -1
  128. package/templates/.claude/commands/implement-task.md +1 -1
  129. package/templates/.claude/commands/implement-task.zh-CN.md +1 -1
  130. package/templates/.claude/commands/import-codescan.md +1 -0
  131. package/templates/.claude/commands/import-codescan.zh-CN.md +2 -1
  132. package/templates/.claude/commands/import-dependabot.md +1 -0
  133. package/templates/.claude/commands/import-dependabot.zh-CN.md +2 -1
  134. package/templates/.claude/commands/import-issue.md +1 -1
  135. package/templates/.claude/commands/import-issue.zh-CN.md +1 -1
  136. package/templates/.claude/commands/init-labels.md +1 -0
  137. package/templates/.claude/commands/init-labels.zh-CN.md +2 -1
  138. package/templates/.claude/commands/init-milestones.md +2 -1
  139. package/templates/.claude/commands/init-milestones.zh-CN.md +2 -1
  140. package/templates/.claude/commands/plan-task.md +1 -1
  141. package/templates/.claude/commands/plan-task.zh-CN.md +1 -1
  142. package/templates/.claude/commands/refine-task.zh-CN.md +1 -1
  143. package/templates/.claude/commands/refine-title.md +2 -1
  144. package/templates/.claude/commands/refine-title.zh-CN.md +2 -1
  145. package/templates/.claude/commands/release.md +2 -1
  146. package/templates/.claude/commands/release.zh-CN.md +2 -1
  147. package/templates/.claude/commands/review-task.md +1 -1
  148. package/templates/.claude/commands/review-task.zh-CN.md +1 -1
  149. package/templates/.claude/commands/sync-issue.md +1 -1
  150. package/templates/.claude/commands/sync-issue.zh-CN.md +1 -1
  151. package/templates/.claude/commands/sync-pr.md +2 -2
  152. package/templates/.claude/commands/sync-pr.zh-CN.md +2 -2
  153. package/templates/.claude/commands/test-integration.md +2 -1
  154. package/templates/.claude/commands/test-integration.zh-CN.md +2 -1
  155. package/templates/.claude/commands/test.md +1 -1
  156. package/templates/.claude/commands/test.zh-CN.md +1 -1
  157. package/templates/.claude/commands/update-agent-infra.md +2 -1
  158. package/templates/.claude/commands/update-agent-infra.zh-CN.md +2 -1
  159. package/templates/.claude/commands/upgrade-dependency.md +2 -1
  160. package/templates/.claude/commands/upgrade-dependency.zh-CN.md +2 -1
  161. package/templates/.gemini/commands/_project_/analyze-task.toml +1 -1
  162. package/templates/.gemini/commands/_project_/analyze-task.zh-CN.toml +1 -1
  163. package/templates/.gemini/commands/_project_/block-task.toml +1 -1
  164. package/templates/.gemini/commands/_project_/block-task.zh-CN.toml +1 -1
  165. package/templates/.gemini/commands/_project_/check-task.toml +1 -1
  166. package/templates/.gemini/commands/_project_/check-task.zh-CN.toml +1 -1
  167. package/templates/.gemini/commands/_project_/close-codescan.toml +1 -1
  168. package/templates/.gemini/commands/_project_/close-codescan.zh-CN.toml +1 -1
  169. package/templates/.gemini/commands/_project_/close-dependabot.toml +1 -1
  170. package/templates/.gemini/commands/_project_/close-dependabot.zh-CN.toml +1 -1
  171. package/templates/.gemini/commands/_project_/commit.toml +1 -1
  172. package/templates/.gemini/commands/_project_/commit.zh-CN.toml +1 -1
  173. package/templates/.gemini/commands/_project_/complete-task.toml +1 -1
  174. package/templates/.gemini/commands/_project_/complete-task.zh-CN.toml +1 -1
  175. package/templates/.gemini/commands/_project_/create-issue.zh-CN.toml +1 -1
  176. package/templates/.gemini/commands/_project_/create-pr.toml +1 -1
  177. package/templates/.gemini/commands/_project_/create-pr.zh-CN.toml +1 -1
  178. package/templates/.gemini/commands/_project_/create-release-note.toml +1 -1
  179. package/templates/.gemini/commands/_project_/create-release-note.zh-CN.toml +1 -1
  180. package/templates/.gemini/commands/_project_/create-task.toml +1 -1
  181. package/templates/.gemini/commands/_project_/create-task.zh-CN.toml +1 -1
  182. package/templates/.gemini/commands/_project_/implement-task.toml +1 -1
  183. package/templates/.gemini/commands/_project_/implement-task.zh-CN.toml +1 -1
  184. package/templates/.gemini/commands/_project_/import-codescan.zh-CN.toml +1 -1
  185. package/templates/.gemini/commands/_project_/import-dependabot.zh-CN.toml +1 -1
  186. package/templates/.gemini/commands/_project_/import-issue.toml +1 -1
  187. package/templates/.gemini/commands/_project_/import-issue.zh-CN.toml +1 -1
  188. package/templates/.gemini/commands/_project_/init-labels.zh-CN.toml +1 -1
  189. package/templates/.gemini/commands/_project_/init-milestones.toml +1 -1
  190. package/templates/.gemini/commands/_project_/init-milestones.zh-CN.toml +1 -1
  191. package/templates/.gemini/commands/_project_/plan-task.toml +1 -1
  192. package/templates/.gemini/commands/_project_/plan-task.zh-CN.toml +1 -1
  193. package/templates/.gemini/commands/_project_/refine-task.zh-CN.toml +1 -1
  194. package/templates/.gemini/commands/_project_/refine-title.toml +1 -1
  195. package/templates/.gemini/commands/_project_/refine-title.zh-CN.toml +1 -1
  196. package/templates/.gemini/commands/_project_/release.toml +1 -1
  197. package/templates/.gemini/commands/_project_/release.zh-CN.toml +1 -1
  198. package/templates/.gemini/commands/_project_/review-task.toml +1 -1
  199. package/templates/.gemini/commands/_project_/review-task.zh-CN.toml +1 -1
  200. package/templates/.gemini/commands/_project_/sync-issue.toml +1 -1
  201. package/templates/.gemini/commands/_project_/sync-issue.zh-CN.toml +1 -1
  202. package/templates/.gemini/commands/_project_/sync-pr.toml +2 -2
  203. package/templates/.gemini/commands/_project_/sync-pr.zh-CN.toml +2 -2
  204. package/templates/.gemini/commands/_project_/test-integration.toml +1 -1
  205. package/templates/.gemini/commands/_project_/test-integration.zh-CN.toml +1 -1
  206. package/templates/.gemini/commands/_project_/test.toml +1 -1
  207. package/templates/.gemini/commands/_project_/test.zh-CN.toml +1 -1
  208. package/templates/.gemini/commands/_project_/update-agent-infra.toml +1 -1
  209. package/templates/.gemini/commands/_project_/update-agent-infra.zh-CN.toml +1 -1
  210. package/templates/.gemini/commands/_project_/upgrade-dependency.toml +1 -1
  211. package/templates/.gemini/commands/_project_/upgrade-dependency.zh-CN.toml +1 -1
  212. package/templates/.github/hooks/check-version-format.sh +29 -0
  213. package/templates/.github/hooks/pre-commit +8 -0
  214. package/templates/.opencode/commands/analyze-task.md +1 -1
  215. package/templates/.opencode/commands/analyze-task.zh-CN.md +1 -1
  216. package/templates/.opencode/commands/block-task.md +1 -1
  217. package/templates/.opencode/commands/block-task.zh-CN.md +1 -1
  218. package/templates/.opencode/commands/check-task.md +1 -1
  219. package/templates/.opencode/commands/check-task.zh-CN.md +1 -1
  220. package/templates/.opencode/commands/close-codescan.md +1 -1
  221. package/templates/.opencode/commands/close-codescan.zh-CN.md +1 -1
  222. package/templates/.opencode/commands/close-dependabot.md +1 -1
  223. package/templates/.opencode/commands/close-dependabot.zh-CN.md +1 -1
  224. package/templates/.opencode/commands/commit.md +1 -1
  225. package/templates/.opencode/commands/commit.zh-CN.md +1 -1
  226. package/templates/.opencode/commands/complete-task.md +1 -1
  227. package/templates/.opencode/commands/complete-task.zh-CN.md +1 -1
  228. package/templates/.opencode/commands/create-issue.zh-CN.md +1 -1
  229. package/templates/.opencode/commands/create-pr.md +1 -1
  230. package/templates/.opencode/commands/create-pr.zh-CN.md +1 -1
  231. package/templates/.opencode/commands/create-release-note.md +1 -1
  232. package/templates/.opencode/commands/create-release-note.zh-CN.md +1 -1
  233. package/templates/.opencode/commands/create-task.md +1 -1
  234. package/templates/.opencode/commands/create-task.zh-CN.md +1 -1
  235. package/templates/.opencode/commands/implement-task.md +1 -1
  236. package/templates/.opencode/commands/implement-task.zh-CN.md +1 -1
  237. package/templates/.opencode/commands/import-codescan.zh-CN.md +1 -1
  238. package/templates/.opencode/commands/import-dependabot.zh-CN.md +1 -1
  239. package/templates/.opencode/commands/import-issue.md +1 -1
  240. package/templates/.opencode/commands/import-issue.zh-CN.md +1 -1
  241. package/templates/.opencode/commands/init-labels.zh-CN.md +1 -1
  242. package/templates/.opencode/commands/init-milestones.md +1 -1
  243. package/templates/.opencode/commands/init-milestones.zh-CN.md +1 -1
  244. package/templates/.opencode/commands/plan-task.md +1 -1
  245. package/templates/.opencode/commands/plan-task.zh-CN.md +1 -1
  246. package/templates/.opencode/commands/refine-task.zh-CN.md +1 -1
  247. package/templates/.opencode/commands/refine-title.md +1 -1
  248. package/templates/.opencode/commands/refine-title.zh-CN.md +1 -1
  249. package/templates/.opencode/commands/release.md +1 -1
  250. package/templates/.opencode/commands/release.zh-CN.md +1 -1
  251. package/templates/.opencode/commands/review-task.md +1 -1
  252. package/templates/.opencode/commands/review-task.zh-CN.md +1 -1
  253. package/templates/.opencode/commands/sync-issue.md +1 -1
  254. package/templates/.opencode/commands/sync-issue.zh-CN.md +1 -1
  255. package/templates/.opencode/commands/sync-pr.md +2 -2
  256. package/templates/.opencode/commands/sync-pr.zh-CN.md +2 -2
  257. package/templates/.opencode/commands/test-integration.md +1 -1
  258. package/templates/.opencode/commands/test-integration.zh-CN.md +1 -1
  259. package/templates/.opencode/commands/test.md +1 -1
  260. package/templates/.opencode/commands/test.zh-CN.md +1 -1
  261. package/templates/.opencode/commands/update-agent-infra.md +1 -1
  262. package/templates/.opencode/commands/update-agent-infra.zh-CN.md +1 -1
  263. package/templates/.opencode/commands/upgrade-dependency.md +1 -1
  264. package/templates/.opencode/commands/upgrade-dependency.zh-CN.md +1 -1
  265. package/templates/.claude/CLAUDE.md +0 -176
  266. package/templates/.claude/CLAUDE.zh-CN.md +0 -176
  267. package/templates/.claude/project-rules.md +0 -65
  268. package/templates/.claude/project-rules.zh-CN.md +0 -65
  269. package/templates/.codex/README.md +0 -38
  270. package/templates/.codex/README.zh-CN.md +0 -37
  271. package/templates/.opencode/COMMAND_STYLE_GUIDE.md +0 -232
  272. package/templates/.opencode/COMMAND_STYLE_GUIDE.zh-CN.md +0 -232
  273. package/templates/.opencode/README.md +0 -76
  274. package/templates/.opencode/README.zh-CN.md +0 -77
  275. package/templates/AGENTS.md +0 -104
  276. package/templates/AGENTS.zh-CN.md +0 -104
@@ -1,296 +1,63 @@
1
1
  ---
2
2
  name: sync-pr
3
- description: >
4
- 将任务处理进度同步到对应的 Pull Request,包含 PR 元数据同步和单条幂等审查摘要。
5
- 当用户要求同步进度到 PR 时触发。参数:task-id。
3
+ description: "将任务进度同步到 Pull Request"
6
4
  ---
7
5
 
8
6
  # 同步进度到 PR
9
7
 
10
- 将任务处理进度同步到关联的 Pull Request。参数:task-id。
8
+ 同步 PR 元数据,并维护一条面向 reviewer 的摘要评论。
11
9
 
12
10
  ## 执行流程
13
11
 
14
- ### 1. 验证任务存在
12
+ ### 1. 解析参数
15
13
 
16
- 按优先顺序搜索任务:
17
- - `.agents/workspace/active/{task-id}/task.md`
18
- - `.agents/workspace/completed/{task-id}/task.md`
19
- - `.agents/workspace/blocked/{task-id}/task.md`
20
-
21
- 注意:`{task-id}` 格式为 `TASK-{yyyyMMdd-HHmmss}`,例如 `TASK-20260306-143022`
22
-
23
- ### 2. 读取任务信息
24
-
25
- 从 task.md 中提取:
26
- - `pr_number`(必需,如果缺失则提示用户)
27
- - `type`
28
- - `issue_number`(如适用)
29
- - `current_step`
30
- - 任务标题、描述、状态
31
- - `created_at`、`updated_at`、`last_synced_to_pr_at`(如存在)
32
-
33
- ### 3. 读取上下文文件
34
-
35
- 检查并读取(如存在):
36
- - 最高轮次的 `plan.md` / `plan-r{N}.md` - 技术方案
37
- - `implementation.md`、`implementation-r{N}.md` - 实现报告
38
- - `review.md`、`review-r{N}.md` - 审查报告
39
- - `refinement.md`、`refinement-r{N}.md` - 修复报告
40
- - 最高轮次的 `analysis.md` / `analysis-r{N}.md` - 需求分析(仅作为 `in:` label 的回退输入)
41
-
42
- ### 4. 获取仓库坐标并检查 label 体系是否已初始化
43
-
44
- 先获取仓库坐标,供后续 milestone 查询和评论同步复用:
45
-
46
- ```bash
47
- repo="$(gh repo view --json nameWithOwner --jq '.nameWithOwner')"
48
- owner="${repo%%/*}"
49
- ```
50
-
51
- 执行:
52
-
53
- ```bash
54
- gh label list --search "type:" --limit 1 --json name --jq 'length'
55
- ```
56
-
57
- 判断规则:
58
- - 返回 `0` -> 标准 label 体系缺失。先执行 `init-labels` 技能,然后重新执行本步骤
59
- - 返回非 `0` -> 继续后续 PR 元数据同步
60
-
61
- ### 5. 同步 type label
62
-
63
- 根据 task.md 的 `type` 字段按下表映射:
64
-
65
- | task.md type | GitHub label |
66
- |---|---|
67
- | bug、bugfix | `type: bug` |
68
- | feature | `type: feature` |
69
- | enhancement | `type: enhancement` |
70
- | refactor、refactoring | `type: enhancement` |
71
- | documentation | `type: documentation` |
72
- | dependency-upgrade | `type: dependency-upgrade` |
73
- | task | `type: task` |
74
- | 其他 | 跳过 |
75
-
76
- 如果映射到具体 label,执行:
77
-
78
- ```bash
79
- gh pr edit {pr-number} --add-label "{type-label}"
80
- ```
81
-
82
- 未映射到标准 type label 时跳过,不创建新 label。
83
-
84
- ### 6. 同步 in: label
85
-
86
- 从实现报告(优先)或分析报告中提取受影响模块:
87
- - 优先读取 `implementation.md` 与 `implementation-r{N}.md` 中 `## 修改文件` / `## 新建文件` 的文件路径
88
- - 如果实现报告不存在,则回退到分析报告中的受影响文件列表
89
-
90
- 对每个文件路径:
91
- 1. 取第一级目录作为模块名 `{module}`
92
- 2. 去重
93
- 3. 检查仓库中是否存在对应 label:
94
-
95
- ```bash
96
- gh label list --search "in: {module}" --limit 10 --json name --jq '.[].name'
97
- ```
98
-
99
- 4. 只有存在精确匹配的 `in: {module}` label 时才执行:
100
-
101
- ```bash
102
- gh pr edit {pr-number} --add-label "in: {module}"
103
- ```
104
-
105
- 5. 只添加,不移除现有的 `in:` labels
106
-
107
- ### 7. 同步 Milestone
108
-
109
- 根据 PR 当前状态、任务显式配置和分支策略,为 PR 关联线里程碑。
110
-
111
- **a) 检查 PR 是否已有 Milestone**
112
-
113
- 执行:
114
-
115
- ```bash
116
- gh pr view {pr-number} --json milestone --jq '.milestone.title // empty'
117
- ```
118
-
119
- 如果返回非空,保留现有里程碑并记录 `Milestone: {existing} (preserved)`,跳过后续里程碑同步。
120
-
121
- **b) 检查 task.md 是否显式指定 milestone**
122
-
123
- 如果 task.md frontmatter 中存在非空 `milestone` 字段,优先使用该值作为目标里程碑。
124
-
125
- **c) 推断目标线里程碑**
126
-
127
- 当 task.md 未显式指定 `milestone` 时,按以下顺序推断:
128
-
129
- 1. 检测当前分支:
130
-
131
- ```bash
132
- git branch --show-current
133
- ```
134
-
135
- - 如果分支名匹配 `{major}.{minor}.x`,目标里程碑为同名线里程碑 `{major}.{minor}.x`
136
-
137
- 2. 如果当前分支是 `main` 或 `master`,检测现有版本分支:
14
+ 同时接受 `task-id` 和 PR number。对于 PR number,使用下面的命令反查任务:
138
15
 
139
16
  ```bash
140
- git branch -a | grep -oE '[0-9]+\.[0-9]+\.x' | sort -V | tail -1
17
+ grep -rl "^pr_number: {pr-number}$" \
18
+ .agents/workspace/active/ \
19
+ .agents/workspace/blocked/ \
20
+ .agents/workspace/completed/ \
21
+ 2>/dev/null | head -1
141
22
  ```
142
23
 
143
- - 如果存在最高版本分支 `X.Y.x`,则目标里程碑为 `(X+1).0.x`
144
- - 如果不存在版本分支,则读取最新 tag:
24
+ 如果没有匹配任务,输出 `No task found associated with PR #{pr-number}`。
145
25
 
146
- ```bash
147
- git tag --list 'v*' --sort=-v:refname | head -1
148
- ```
149
-
150
- - 当最新 tag 存在且可解析为 `X.Y.Z` 时,目标里程碑为 `X.Y.x`
151
-
152
- 3. 如果以上规则都无法得出结果,回退到 `General Backlog`
153
-
154
- **d) 查找并设置里程碑**
155
-
156
- 执行:
157
-
158
- ```bash
159
- gh api "repos/$repo/milestones" --paginate \
160
- --jq '.[] | select(.title=="{target}") | .title' | head -1
161
- ```
162
-
163
- - 如果目标里程碑不存在,则降级到查找 `General Backlog`
164
- - 如果 `General Backlog` 也不存在,则记录 `Milestone: skipped (not found)` 并跳过关联
165
- - 一旦找到目标标题,执行:
166
-
167
- ```bash
168
- gh pr edit {pr-number} --milestone "{milestone-title}"
169
- ```
170
-
171
- ### 8. 同步 Development 关联
172
-
173
- 如果 task.md 包含 `issue_number`,确保 PR body 关联当前 Issue。
174
-
175
- 1. 读取 PR body:
176
-
177
- ```bash
178
- gh pr view {pr-number} --json body --jq '.body // ""'
179
- ```
180
-
181
- 2. 检查 body 是否已经包含以下任一关键词:
182
- - `Closes #{issue-number}`
183
- - `Fixes #{issue-number}`
184
- - `Resolves #{issue-number}`
185
-
186
- 3. 如果已存在任一关键词,跳过更新
187
- 4. 如果不存在,在 body 末尾追加:
188
-
189
- ```bash
190
- gh pr edit {pr-number} --body "$(cat <<'EOF'
191
- {existing-body}
192
-
193
- Closes #{issue-number}
194
- EOF
195
- )"
196
- ```
197
-
198
- 5. 如果 task.md 不包含 `issue_number`,记录 `Development: N/A`
26
+ ### 2. 验证任务存在
199
27
 
200
- ### 9. 生成或更新单条幂等审查摘要
28
+ active、blocked、completed 的顺序定位匹配任务目录,再继续后续步骤。
201
29
 
202
- 复用步骤 4 已获取的仓库坐标,并拉取 PR 已有评论:
30
+ ### 3. 读取任务信息
203
31
 
204
- ```bash
205
- pr_comments_jsonl="$(mktemp)"
206
-
207
- gh api "repos/$repo/issues/{pr-number}/comments" \
208
- --paginate \
209
- --jq '.[] | {id, body}' > "$pr_comments_jsonl"
210
- ```
211
-
212
- 用隐藏标识定位唯一 summary 评论:
213
-
214
- ```html
215
- <!-- sync-pr:{task-id}:summary -->
216
- ```
217
-
218
- 从评论列表中提取已有 summary comment id:
219
-
220
- ```bash
221
- summary_comment_id="$(
222
- jq -r 'select(.body | contains("<!-- sync-pr:{task-id}:summary -->")) | .id' \
223
- "$pr_comments_jsonl" | head -1
224
- )"
225
- ```
226
-
227
- 摘要内容要求:
228
- - 面向代码审查者,不重复罗列 PR diff 已经展示的文件变更
229
- - 从 `plan.md` 的 `## 决策`、`## 技术方法`、`## 实施步骤` 中提取 2-4 条关键技术决策
230
- - 关键技术决策的描述必须自包含,不要引用内部文档的编号或术语(如 `方案 A/B`);审查者应能独立理解每条决策的含义
231
- - 从 `review.md`、`review-r{N}.md`、`refinement.md`、`refinement-r{N}.md` 构建审查历程表格
232
- - 从 `implementation.md` 或 `refinement.md` 的测试章节提取测试结果
233
-
234
- 审查历程表格建议字段:
235
- - `轮次`
236
- - `结论`
237
- - `问题统计`,例如 `B:1 M:2 m:0`
238
- - `修复状态`
239
-
240
- 如果尚无审查产物,使用一行占位记录,例如 `Round 1 | Pending | N/A | N/A`。
32
+ 从 task.md 提取 `pr_number`、`issue_number`、任务标题、type 和最新时间戳。
241
33
 
242
- 候选评论格式:
34
+ ### 4. 读取上下文文件
243
35
 
244
- ```markdown
245
- <!-- sync-pr:{task-id}:summary -->
246
- ## 审查摘要
36
+ 读取最新的方案、实现、审查和修复产物,用于生成 PR 元数据和 reviewer 摘要。
247
37
 
248
- **任务**:{task-id}
249
- **更新时间**:{当前时间}
38
+ ### 5. 解析仓库坐标并检查 label 就绪状态
250
39
 
251
- ### 关键技术决策
40
+ 先解析 `repo="$(gh repo view --json nameWithOwner --jq '.nameWithOwner')"`,再确认 `type:` labels 是否已经初始化。
252
41
 
253
- - {decision-1}
254
- - {decision-2}
42
+ ### 6. 同步元数据
255
43
 
256
- ### 审查历程
44
+ 把映射后的 type label、相关 `in:` labels 和 milestone 同步到 PR 上。
257
45
 
258
- | 轮次 | 结论 | 问题统计 | 修复状态 |
259
- |------|------|----------|----------|
260
- | Round 1 | Pending | N/A | N/A |
46
+ > PR 状态保护、milestone 推断,以及 PR 已关闭/已合并时的跳过规则见 `reference/delivery-detection.md`。编辑 PR 元数据前先读取 `reference/delivery-detection.md`。
261
47
 
262
- ### 测试结果
48
+ ### 7. 同步 Development 关联
263
49
 
264
- - {test-summary}
50
+ 如果存在 `issue_number`,确保 PR 正文包含 `Closes #{issue-number}` 或等价的关闭关键字。
265
51
 
266
- ---
267
- *由 AI 自动生成 · 内部追踪:{task-id}*
268
- ```
52
+ ### 8. 发布 reviewer 摘要
269
53
 
270
- 幂等规则:
271
- - 如果 `summary_comment_id` 为空 -> 创建新评论
272
- - 如果 `summary_comment_id` 存在且内容发生变化 -> 更新原评论
273
- - 如果 `summary_comment_id` 存在且内容无变化 -> 跳过
54
+ > 隐藏标记、幂等 summary 评论更新、review history 格式,以及评论创建/更新规则见 `reference/comment-publish.md`。发布摘要前先读取 `reference/comment-publish.md`。
274
55
 
275
- 创建新评论时,执行:
56
+ > **Shell 安全规则**(发布评论前必读):
57
+ > 1. `{comment-body}` 必须替换为**实际的内联文本**。先用 Read 工具读取文件,再将全文粘贴到 heredoc body 中。**禁止**在 `<<'EOF'` 内部使用 `$(cat ...)`、`$(< ...)`、`$(...)`、`${...}`。带引号 heredoc 会阻止所有命令替换和变量展开,它们会被当作字面文本输出。
58
+ > 2. 构造含 `<!-- -->` 的字符串时,**禁止使用 `echo`**。bash/zsh 中 `echo` 会将 `!` 转义为 `\!`,导致隐藏标识可见。所有评论内容统一使用 `cat <<'EOF'` heredoc 或 `printf '%s\n'` 构造。
276
59
 
277
- ```bash
278
- gh api "repos/$repo/issues/{pr-number}/comments" -X POST -f body="$(cat <<'EOF'
279
- {comment-body}
280
- EOF
281
- )"
282
- ```
283
-
284
- 更新已有评论时,执行:
285
-
286
- ```bash
287
- gh api "repos/$repo/issues/comments/{comment-id}" -X PATCH -f body="$(cat <<'EOF'
288
- {comment-body}
289
- EOF
290
- )"
291
- ```
292
-
293
- ### 10. 更新任务状态
60
+ ### 9. 更新任务状态
294
61
 
295
62
  获取当前时间:
296
63
 
@@ -298,37 +65,23 @@ EOF
298
65
  date "+%Y-%m-%d %H:%M:%S"
299
66
  ```
300
67
 
301
- task.md 中添加或更新 `last_synced_to_pr_at` 字段为 `{当前时间}`。
302
- - **追加**到 `## Activity Log`(不要覆盖之前的记录):
303
- ```
304
- - {yyyy-MM-dd HH:mm:ss} — **Sync to PR** by {agent} — PR metadata synced, summary {created|updated|skipped} on PR #{pr-number}
305
- ```
306
-
307
- ### 11. 告知用户
68
+ 更新 `last_synced_to_pr_at`,并追加 Sync to PR 的 Activity Log。
308
69
 
309
- ```
310
- 进度已同步到 PR #{pr-number}。
311
-
312
- 已同步内容:
313
- - Labels:{type-label-result}, {in-label-result}
314
- - Milestone:{milestone-result}
315
- - Development:{development-result}
316
- - Summary:{created|updated|skipped}
70
+ ### 10. 告知用户
317
71
 
318
- 查看:https://github.com/{owner}/{repo}/pull/{pr-number}
319
- ```
72
+ 汇总已同步的 labels、milestone、development 状态、summary 结果以及 PR URL。
320
73
 
321
74
  ## 注意事项
322
75
 
323
- 1. `sync-pr` 面向代码审查者,只维护一条 reviewer-facing summary 评论,不逐轮发布完整产物。
324
- 2. PR 元数据同步必须可重复执行;重复执行时仅补齐缺失信息,不制造额外噪音。
325
- 3. 由于 Pull Request 共享 Issue 评论接口,summary 评论应使用 `issues/{pr-number}/comments` API 创建。
326
- 4. 如果 `issue_number` 缺失,Development 应记录为 `N/A`,不要让整个流程失败。
76
+ - 隐藏 summary 标记必须保持 `<!-- sync-pr:{task-id}:summary -->`
77
+ - 面向 reviewer 只保留一条摘要评论
78
+ - 如果 PR 已关闭或已合并,必须报告 `PR #{number} is closed/merged, metadata sync skipped`
79
+ - 发布摘要时遵守步骤 8 的 Shell 安全规则,不要在带引号 heredoc 中依赖命令替换,也不要用 `echo` 构造 HTML 注释标记
327
80
 
328
81
  ## 错误处理
329
82
 
330
- - 任务未找到:提示 `Task {task-id} not found`
331
- - 缺少 PR 编号:提示 `Task has no pr_number field`
332
- - PR 未找到:提示 `PR #{number} not found`
333
- - PR 已关闭/已合并:提示 `PR #{number} is closed/merged, metadata sync skipped`
334
- - gh 认证失败:提示 `Please check GitHub CLI authentication`
83
+ - 未找到关联任务:`No task found associated with PR #{pr-number}`
84
+ - 任务未找到:`Task {task-id} not found`
85
+ - 缺少 PR 编号:`Task has no pr_number field`
86
+ - PR 不存在:`PR #{number} not found`
87
+ - GitHub CLI 认证失败:`Please check GitHub CLI authentication`
@@ -0,0 +1,82 @@
1
+ # PR Summary Comment Publication
2
+
3
+ Read this file before creating or updating the single reviewer-facing PR summary comment.
4
+
5
+ ## Create or Update the Single Idempotent Review Summary
6
+
7
+ Use the hidden marker:
8
+
9
+ ```html
10
+ <!-- sync-pr:{task-id}:summary -->
11
+ ```
12
+
13
+ Fetch existing comments through the Issues comments API, not a separate PR comment API.
14
+
15
+ Recommended summary sections:
16
+ - `## Review Summary`
17
+ - `### Key Technical Decisions`
18
+ - `### Review History`
19
+ - `### Test Results`
20
+
21
+ Summary content rules:
22
+ - write for reviewers, not for end users
23
+ - do not restate the raw file diff
24
+ - extract 2-4 self-contained technical decisions from `plan.md`
25
+ - avoid internal shorthand such as `Plan A/B`; each decision must make sense on its own
26
+ - build a review-history table from `review.md`, `review-r{N}.md`, `refinement.md`, and `refinement-r{N}.md`
27
+ - include test results from `implementation.md` or refinement artifacts
28
+
29
+ Recommended review-history columns:
30
+ - `Round`
31
+ - `Verdict`
32
+ - `Finding Counts`
33
+ - `Fix Status`
34
+
35
+ If a summary comment already exists:
36
+ - update it only when the content changed
37
+ - otherwise skip the write
38
+
39
+ If no summary comment exists:
40
+ - create one with the marker and the current summary body
41
+
42
+ Update an existing comment with:
43
+
44
+ ```bash
45
+ gh api "repos/$repo/issues/comments/{comment-id}" -X PATCH -f body="$(cat <<'EOF'
46
+ {comment-body}
47
+ EOF
48
+ )"
49
+ ```
50
+
51
+ Suggested summary body:
52
+
53
+ ```markdown
54
+ <!-- sync-pr:{task-id}:summary -->
55
+ ## Review Summary
56
+
57
+ **Task**: {task-id}
58
+ **Updated At**: {current-time}
59
+
60
+ ### Key Technical Decisions
61
+
62
+ - {decision-1}
63
+ - {decision-2}
64
+
65
+ ### Review History
66
+
67
+ | Round | Verdict | Finding Counts | Fix Status |
68
+ |-------|---------|----------------|------------|
69
+ | Round 1 | Pending | N/A | N/A |
70
+
71
+ ### Test Results
72
+
73
+ - {test-summary}
74
+
75
+ ---
76
+ *Generated by AI · Internal tracking: {task-id}*
77
+ ```
78
+
79
+ ## Update Task Status
80
+
81
+ Append:
82
+ `- {yyyy-MM-dd HH:mm:ss} — **Sync to PR** by {agent} — PR metadata synced, summary {created|updated|skipped} on PR #{pr-number}`
@@ -0,0 +1,82 @@
1
+ # PR 摘要评论发布
2
+
3
+ 在创建或更新面向 reviewer 的唯一 PR 摘要评论之前先读取本文件。
4
+
5
+ ## 创建或更新唯一且幂等的审查摘要
6
+
7
+ 使用如下隐藏标记:
8
+
9
+ ```html
10
+ <!-- sync-pr:{task-id}:summary -->
11
+ ```
12
+
13
+ 已有评论必须通过 Issues comments API 获取,而不是单独的 PR comments API。
14
+
15
+ 推荐摘要章节:
16
+ - `## 审查摘要`
17
+ - `### 关键技术决策`
18
+ - `### 审查历程`
19
+ - `### 测试结果`
20
+
21
+ 摘要内容规则:
22
+ - 面向 reviewer 编写,而不是面向终端用户
23
+ - 不要简单复述原始文件 diff
24
+ - 从 `plan.md` 中提取 2-4 条自包含的技术决策
25
+ - 避免使用 `方案 A/B` 这类内部简称;每条决策都必须独立可读
26
+ - 用 `review.md`、`review-r{N}.md`、`refinement.md` 和 `refinement-r{N}.md` 构建审查历程表
27
+ - 包含来自 `implementation.md` 或修复产物中的测试结果
28
+
29
+ 推荐审查历程列:
30
+ - `轮次`
31
+ - `结论`
32
+ - `问题统计`
33
+ - `修复状态`
34
+
35
+ 如果摘要评论已经存在:
36
+ - 只有内容发生变化时才更新
37
+ - 否则跳过写入
38
+
39
+ 如果摘要评论不存在:
40
+ - 使用隐藏标记和当前摘要正文创建一条新评论
41
+
42
+ 更新已有评论时,使用:
43
+
44
+ ```bash
45
+ gh api "repos/$repo/issues/comments/{comment-id}" -X PATCH -f body="$(cat <<'EOF'
46
+ {comment-body}
47
+ EOF
48
+ )"
49
+ ```
50
+
51
+ 建议摘要正文:
52
+
53
+ ```markdown
54
+ <!-- sync-pr:{task-id}:summary -->
55
+ ## 审查摘要
56
+
57
+ **任务**:{task-id}
58
+ **更新时间**:{当前时间}
59
+
60
+ ### 关键技术决策
61
+
62
+ - {decision-1}
63
+ - {decision-2}
64
+
65
+ ### 审查历程
66
+
67
+ | 轮次 | 结论 | 问题统计 | 修复状态 |
68
+ |------|------|----------|----------|
69
+ | Round 1 | Pending | N/A | N/A |
70
+
71
+ ### 测试结果
72
+
73
+ - {test-summary}
74
+
75
+ ---
76
+ *由 AI 自动生成 · 内部追踪:{task-id}*
77
+ ```
78
+
79
+ ## 更新任务状态
80
+
81
+ 追加:
82
+ `- {yyyy-MM-dd HH:mm:ss} — **Sync to PR** by {agent} — PR metadata synced, summary {created|updated|skipped} on PR #{pr-number}`
@@ -0,0 +1,54 @@
1
+ # PR Metadata Guards
2
+
3
+ Read this file before inferring milestones or deciding whether metadata sync should be skipped.
4
+
5
+ Initialize label state first:
6
+
7
+ ```bash
8
+ gh label list --search "type:" --limit 1 --json name --jq 'length'
9
+ ```
10
+
11
+ If the result is `0`, run `init-labels` before retrying metadata sync.
12
+
13
+ Type label examples:
14
+ - `bug`, `bugfix` -> `type: bug`
15
+ - `refactor`, `refactoring` -> `type: enhancement`
16
+
17
+ ## Sync the Milestone
18
+
19
+ Milestone priority:
20
+ 1. current PR milestone
21
+ 2. explicit `milestone` in task.md
22
+ 3. milestone inherited from the Issue
23
+ 4. inferred release line
24
+ 5. `General Backlog`
25
+
26
+ Milestone inference algorithm:
27
+ 1. if the current branch matches `{major}.{minor}.x`, use that exact release line
28
+ 2. if the current branch is `main` or `master`, inspect existing `{major}.{minor}.x` branches and target `(X+1).0.x`
29
+ 3. if no release line branch exists, inspect the latest `vX.Y.Z` tag and fall back to `X.Y.x`
30
+ 4. if none of the above resolve, fall back to `General Backlog`
31
+
32
+ Execution order:
33
+ 1. preserve an existing PR milestone when present
34
+ 2. otherwise prefer explicit `milestone` in task.md
35
+ 3. otherwise inherit the Issue milestone if it exists
36
+ 4. otherwise apply the branch/tag inference above
37
+ 5. if the target milestone is unavailable, fall back to `General Backlog`
38
+ 6. if even `General Backlog` is unavailable, record `Milestone: skipped (not found)`
39
+
40
+ Useful commands:
41
+
42
+ ```bash
43
+ gh pr view {pr-number} --json milestone
44
+ gh issue view {issue-number} --json labels,milestone
45
+ git branch --show-current
46
+ git branch -a | grep -oE '[0-9]+\.[0-9]+\.x' | sort -V | tail -1
47
+ git tag --list 'v*' --sort=-v:refname | head -1
48
+ gh pr edit {pr-number} --add-label "{type-label}"
49
+ gh pr edit {pr-number} --add-label "in: {module}"
50
+ gh pr edit {pr-number} --milestone "{milestone-title}"
51
+ ```
52
+
53
+ If the PR is closed or merged, stop metadata sync and report:
54
+ `PR #{number} is closed/merged, metadata sync skipped`
@@ -0,0 +1,54 @@
1
+ # PR 元数据保护规则
2
+
3
+ 在推断 milestone 或决定是否跳过元数据同步之前先读取本文件。
4
+
5
+ 先初始化 label 状态:
6
+
7
+ ```bash
8
+ gh label list --search "type:" --limit 1 --json name --jq 'length'
9
+ ```
10
+
11
+ 如果结果是 `0`,先执行 `init-labels`,再重试元数据同步。
12
+
13
+ Type label 示例:
14
+ - `bug`, `bugfix` -> `type: bug`
15
+ - `refactor`, `refactoring` -> `type: enhancement`
16
+
17
+ ## 同步 Milestone
18
+
19
+ Milestone 优先级:
20
+ 1. PR 当前已有的 milestone
21
+ 2. task.md 中显式设置的 `milestone`
22
+ 3. 从 Issue 继承的 milestone
23
+ 4. 推断得到的 release line
24
+ 5. `General Backlog`
25
+
26
+ Milestone 推断算法:
27
+ 1. 如果当前分支匹配 `{major}.{minor}.x`,直接使用该 release line
28
+ 2. 如果当前分支是 `main` 或 `master`,检查现有的 `{major}.{minor}.x` 分支,并目标设为 `(X+1).0.x`
29
+ 3. 如果不存在 release line 分支,则检查最新的 `vX.Y.Z` tag,并回退到 `X.Y.x`
30
+ 4. 如果以上都无法得出结果,则回退到 `General Backlog`
31
+
32
+ 执行顺序:
33
+ 1. 如果 PR 已经设置 milestone,优先保留
34
+ 2. 否则优先使用 task.md 中显式设置的 `milestone`
35
+ 3. 否则继承已有的 Issue milestone
36
+ 4. 否则应用上面的分支 / tag 推断规则
37
+ 5. 如果目标 milestone 不可用,则回退到 `General Backlog`
38
+ 6. 如果连 `General Backlog` 都不可用,则记录 `Milestone: skipped (not found)`
39
+
40
+ 常用命令:
41
+
42
+ ```bash
43
+ gh pr view {pr-number} --json milestone
44
+ gh issue view {issue-number} --json labels,milestone
45
+ git branch --show-current
46
+ git branch -a | grep -oE '[0-9]+\.[0-9]+\.x' | sort -V | tail -1
47
+ git tag --list 'v*' --sort=-v:refname | head -1
48
+ gh pr edit {pr-number} --add-label "{type-label}"
49
+ gh pr edit {pr-number} --add-label "in: {module}"
50
+ gh pr edit {pr-number} --milestone "{milestone-title}"
51
+ ```
52
+
53
+ 如果 PR 已关闭或已合并,停止元数据同步,并报告:
54
+ `PR #{number} is closed/merged, metadata sync skipped`
@@ -1,8 +1,6 @@
1
1
  ---
2
2
  name: test
3
- description: >
4
- Execute the project's full test workflow (compilation check + unit tests).
5
- Triggered when the user requests running tests or verifying code quality.
3
+ description: "Run the full project test workflow"
6
4
  ---
7
5
 
8
6
  # Run Tests
@@ -1,8 +1,6 @@
1
1
  ---
2
2
  name: test
3
- description: >
4
- 执行项目完整测试流程(编译检查 + 单元测试)。
5
- 当用户要求运行测试或验证代码质量时触发。
3
+ description: "执行项目完整测试流程"
6
4
  ---
7
5
 
8
6
  # 执行测试
@@ -1,9 +1,6 @@
1
1
  ---
2
2
  name: test-integration
3
- description: >
4
- Execute the project's integration test workflow.
5
- Triggered when the user requests running integration tests
6
- or end-to-end verification.
3
+ description: "Run the integration test workflow"
7
4
  ---
8
5
 
9
6
  # Run Integration Tests
@@ -1,8 +1,6 @@
1
1
  ---
2
2
  name: test-integration
3
- description: >
4
- 执行项目集成测试流程。
5
- 当用户要求运行集成测试或端到端验证时触发。
3
+ description: "执行项目集成测试流程"
6
4
  ---
7
5
 
8
6
  # 运行集成测试