@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,24 +1,17 @@
1
1
  ---
2
2
  name: sync-issue
3
- description: >
4
- Sync task progress to comments on the related GitHub Issue.
5
- Triggered when the user asks to sync progress to an Issue.
6
- Argument: task-id or issue-number.
3
+ description: "Sync task progress to a GitHub Issue"
7
4
  ---
8
5
 
9
6
  # Sync Progress to Issue
10
7
 
11
- Sync task progress to the related GitHub Issue. Argument: task-id or issue-number.
8
+ Sync the task state, summary comment, and published artifacts to the related GitHub Issue.
12
9
 
13
10
  ## Execution Flow
14
11
 
15
12
  ### 1. Parse the Argument
16
13
 
17
- Identify the argument provided by the user:
18
- - plain number (`123`) or `#` + number (`#123`) -> treat as an issue number
19
- - Starts with `TASK-` -> treat as a task-id (current format)
20
-
21
- If the argument is an issue number, use Bash to search for the related task (note: `.agents/workspace` is a hidden directory, so Grep/Glob tools may skip it; you must use Bash):
14
+ Accept either `task-id` or issue number input. For issue-number input, resolve the task with:
22
15
 
23
16
  ```bash
24
17
  grep -rl "^issue_number: {issue-number}$" \
@@ -28,479 +21,51 @@ grep -rl "^issue_number: {issue-number}$" \
28
21
  2>/dev/null | head -1
29
22
  ```
30
23
 
31
- - If a file path is returned (for example `.agents/workspace/completed/TASK-xxx/task.md`), extract `{task-id}` and the task directory from the path, then continue to Step 2
32
- - If nothing is returned, output `No task found associated with Issue #{issue-number}`
33
-
34
- If the argument is a task-id, continue with the normal Step 2 flow.
24
+ If no task matches, output `No task found associated with Issue #{issue-number}`.
35
25
 
36
26
  ### 2. Verify the Task Exists
37
27
 
38
- For a `task-id`, search for the task in this order:
39
- - `.agents/workspace/active/{task-id}/task.md`
40
- - `.agents/workspace/blocked/{task-id}/task.md`
41
- - `.agents/workspace/completed/{task-id}/task.md`
42
-
43
- Note: `{task-id}` format is `TASK-{yyyyMMdd-HHmmss}`, for example `TASK-20260306-143022`
44
-
45
- If Step 1 already found a matching task through the issue number, use that task directory directly for the remaining steps without scanning again.
28
+ Search active, blocked, and completed task directories and lock onto the matching task folder before continuing.
46
29
 
47
30
  ### 3. Read Task Information
48
31
 
49
- Extract from task.md:
50
- - `issue_number` (required; if missing, prompt the user)
51
- - `type`
52
- - task title, description, and status
53
- - `current_step`, `created_at`, `updated_at`, and `last_synced_at` (if present)
32
+ Extract `issue_number`, `type`, task title, status, `current_step`, and timestamp fields from task.md.
54
33
 
55
34
  ### 4. Read Context Files
56
35
 
57
- Check and read these files if they exist:
58
- - highest-round `analysis.md` / `analysis-r{N}.md` - requirements analysis
59
- - highest-round `plan.md` / `plan-r{N}.md` - technical plan
60
- - `implementation.md`, `implementation-r*.md` - implementation reports
61
- - `refinement.md`, `refinement-r*.md` - refinement reports
62
- - `review.md`, `review-r*.md` - review reports
63
-
64
- ### 5. Detect Delivery Status
65
-
66
- Run the following checks in order. If any step fails, fall back to "Mode C: In development". Do not invent anything you cannot verify.
67
-
68
- Before starting detection, first resolve repository coordinates and the absolute URL prefix:
69
-
70
- ```bash
71
- repo="$(gh repo view --json nameWithOwner --jq '.nameWithOwner')"
72
- owner="${repo%%/*}"
73
- repo_url="https://github.com/$repo"
74
- ```
75
-
76
- **a) Extract the commit hash**
77
-
78
- Match the last `**Commit** by` record in `## Activity Log` in task.md. The Activity Log format is:
79
-
80
- ```text
81
- **Commit** by {agent} — {hash} {subject}
82
- ```
83
-
84
- Extract the first word as the commit hash. If none is found, mark it as "no commit".
85
-
86
- **b) Detect whether the commit is on a protected branch**
87
-
88
- If a commit hash exists, run:
89
-
90
- ```bash
91
- git branch -a --contains {commit-hash} 2>/dev/null
92
- ```
93
-
94
- Decision rules:
95
- - output contains `main` or `master` -> merged into the main branch; record the branch name
96
- - output matches a `{major}.{minor}.x` branch name -> merged into a release branch; record the branch name
97
- - neither matches -> not merged into a protected branch
98
-
99
- **c) Detect the linked PR**
100
-
101
- Check the `pr_number` field in task.md. If it exists, run:
102
-
103
- ```bash
104
- gh pr view {pr-number} --json state,mergedAt
105
- ```
106
-
107
- Use the result to determine whether the PR is `OPEN`, `MERGED`, or another state.
108
-
109
- **d) Determine the delivery mode**
110
-
111
- Choose the summary mode with this priority:
112
-
113
- | Condition | Mode |
114
- |---|---|
115
- | commit is already on a protected branch | Mode A: Completed |
116
- | PR exists and its state is `OPEN` or `MERGED` | Mode B: PR stage |
117
- | anything else | Mode C: In development |
118
-
119
- The priority must be `Mode A > Mode B > Mode C`. Even if a PR exists, treat it as "Completed" when the commit is already on a protected branch.
120
-
121
- All later commit and PR links must use absolute URLs:
122
- - `https://github.com/{owner}/{repo}/commit/{commit-hash}`
123
- - `https://github.com/{owner}/{repo}/pull/{pr-number}`
124
-
125
- Do not use relative paths such as `../../commit/...` or `../../pull/...`.
126
-
127
- ### 6. Sync Labels and Issue Type
128
-
129
- Sync Issue labels based on the detection result from Step 5.
130
-
131
- **a) Check whether the label system has been initialized**
132
-
133
- Run:
134
-
135
- ```bash
136
- gh label list --search "type:" --limit 1 --json name --jq 'length'
137
- ```
138
-
139
- Decision rules:
140
- - returns `0` -> the standard label system is missing; run the `init-labels` skill first (idempotent), then retry this step
141
- - returns non-zero -> continue with label sync
142
-
143
- **b) Sync the `status:` label**
144
-
145
- First read existing `status:` labels on the Issue:
146
-
147
- ```bash
148
- gh issue view {issue-number} --json labels --jq '.labels[].name | select(startswith("status:"))'
149
- ```
150
-
151
- Remove each existing `status:` label:
36
+ Read the highest-round `analysis.md` / `analysis-r{N}.md`, `plan.md` / `plan-r{N}.md`, and the current implementation, refinement, and review artifacts that still exist.
152
37
 
153
- ```bash
154
- gh issue edit {issue-number} --remove-label "{status-label}"
155
- ```
156
-
157
- Then decide whether to add a new `status:` label using this priority:
158
-
159
- | Condition | Action |
160
- |---|---|
161
- | task is under the `blocked/` directory | add `status: blocked` |
162
- | Mode A: Completed | do not add a new status label |
163
- | Mode B: PR is MERGED | do not add a new status label |
164
- | Mode B: PR is OPEN | add `status: in-progress` |
165
- | Mode C + `current_step` ∈ {`requirement-analysis`, `technical-design`} | add `status: pending-design-work` |
166
- | Mode C + `current_step` ∈ {`implementation`, `code-review`, `refinement`} | add `status: in-progress` |
167
-
168
- If a new label needs to be added, run:
169
-
170
- ```bash
171
- gh issue edit {issue-number} --add-label "{status-label}"
172
- ```
173
-
174
- **c) Sync the `in:` label**
175
-
176
- Extract affected file paths from implementation reports first, or from `analysis.md` as a fallback:
177
- - prefer file paths listed under `## Modified Files`, especially `### New Files` / `### Modified Files`, in `implementation.md` and `implementation-r{N}.md`
178
- - if no implementation report exists, fall back to the affected file list in the analysis report
179
-
180
- For each file path:
181
- 1. take the first-level directory as the module name
182
- 2. deduplicate
183
- 3. check whether the corresponding label exists in the repository:
184
-
185
- ```bash
186
- gh label list --search "in: {module}" --limit 10 --json name --jq '.[].name'
187
- ```
188
-
189
- 4. only when the exact `in: {module}` label exists, run:
190
-
191
- ```bash
192
- gh issue edit {issue-number} --add-label "in: {module}"
193
- ```
38
+ ### 5. Sync Labels and Issue Type
194
39
 
195
- 5. **Only add; do not remove** existing `in:` labels
40
+ > Label initialization, `status:` replacement rules, `in:` label discovery, and the `issue-types` mapping logic live in `reference/label-sync.md`. Read `reference/label-sync.md` before editing Issue metadata.
196
41
 
197
- **d) Sync the Issue Type field**
198
-
199
- Map the `type` field in task.md to the native GitHub Issue Type:
200
-
201
- | task.md type | GitHub Issue Type |
202
- |---|---|
203
- | `bug`, `bugfix` | `Bug` |
204
- | `feature`, `enhancement` | `Feature` |
205
- | `task`, `documentation`, `dependency-upgrade`, `chore`, `docs`, `refactor`, `refactoring`, and any other value | `Task` |
206
-
207
- First query the Issue Types available in the organization:
208
-
209
- ```bash
210
- gh api "orgs/$owner/issue-types" --jq '.[].name'
211
- ```
42
+ ### 6. Sync Development Linking
212
43
 
213
- Then execute this only when the target type exists:
214
-
215
- ```bash
216
- gh api "repos/$repo/issues/{issue-number}" -X PATCH -f type="{name}"
217
- ```
218
-
219
- Fault-tolerance requirements:
220
- - If the API returns `404`, the repo owner is not an organization, or Issue Types are not enabled for the repo, record `Issue Type: skipped (not enabled)` and continue; do not fail the whole sync
221
- - If the target type does not exist, record `Issue Type: skipped (type not available)`
222
- - Do not try to create new Issue Types; only use names that already exist in the organization
223
-
224
- ### 7. Sync Development
225
-
226
- If task.md contains `pr_number`, ensure the PR body links the current Issue.
227
-
228
- 1. Read the PR body:
229
-
230
- ```bash
231
- gh pr view {pr-number} --json body --jq '.body // ""'
232
- ```
233
-
234
- 2. Check whether the body already contains any of:
44
+ If `pr_number` exists, make sure the PR body contains one of:
235
45
  - `Closes #{issue-number}`
236
46
  - `Fixes #{issue-number}`
237
47
  - `Resolves #{issue-number}`
238
48
 
239
- 3. If any keyword already exists, skip the update
240
- 4. Otherwise append this to the end of the body:
49
+ ### 7. Sync the Milestone
241
50
 
242
- ```bash
243
- gh pr edit {pr-number} --body "$(cat <<'EOF'
244
- {existing-body}
51
+ > Milestone inheritance, line-branch inference, and `General Backlog` fallback rules live in `reference/milestone-sync.md`. Read `reference/milestone-sync.md` before editing the Issue milestone.
245
52
 
246
- Closes #{issue-number}
247
- EOF
248
- )"
249
- ```
250
-
251
- 5. If task.md does not contain `pr_number`, record `Development: N/A`
252
-
253
- ### 8. Sync the Milestone
53
+ ### 8. Sync Requirement Checkboxes
254
54
 
255
- Assign a line milestone to the Issue based on the current Issue state, explicit task configuration, and branch strategy.
55
+ Extract checked `- [x]` items from the `## Requirements` section of task.md; if none exist, skip this step.
56
+ Read the current Issue body with `gh issue view {issue-number} --json body --jq '.body'`.
57
+ Match by checkbox text and replace only `- [ ] {text}` with `- [x] {text}` in the Issue body; keep existing `- [x]` items, unmatched items, and non-requirement checkboxes unchanged.
58
+ Only when the body actually changes, update the full body with `gh api` PATCH and build the request payload with `cat <<'EOF'` heredoc.
256
59
 
257
- **a) Check whether the Issue already has a milestone**
60
+ ### 9. Publish Context Artifacts
258
61
 
259
- Run:
260
-
261
- ```bash
262
- gh issue view {issue-number} --json milestone --jq '.milestone.title // empty'
263
- ```
62
+ > Existing-comment discovery, hidden markers, the artifact timeline, and summary comment ordering live in `reference/comment-publish.md`. Read `reference/comment-publish.md` before publishing Issue comments.
264
63
 
265
- If the result is non-empty, preserve the existing milestone and record `Milestone: {existing} (preserved)`, then skip the remaining milestone-sync steps.
64
+ > **Shell Safety Rules** (read before publishing comments):
65
+ > 1. `{comment-body}` must be replaced with **actual inline text**. Read the file with the Read tool first, then paste the full content into the heredoc body. **Do NOT** use `$(cat ...)`, `$(< ...)`, `$(...)`, or `${...}` inside `<<'EOF'`. Quoted heredocs suppress all command substitution and variable expansion, so those expressions will be output as literal text.
66
+ > 2. When constructing strings that contain `<!-- -->`, **do NOT use `echo`**. In bash/zsh, `echo` escapes `!` as `\!`, which makes hidden markers visible. Build all comment content and the Step 8 Issue body update with `cat <<'EOF'` heredocs or `printf '%s\n'`.
266
67
 
267
- **b) Check whether task.md explicitly sets `milestone`**
268
-
269
- If the frontmatter in task.md contains a non-empty `milestone` field, use it as the target milestone.
270
- This field should contain a line milestone title or `General Backlog`; do not automatically set a specific version milestone here.
271
-
272
- **c) Infer the target line milestone**
273
-
274
- When task.md does not explicitly set `milestone`, infer it in this order:
275
-
276
- 1. Detect the current branch:
277
-
278
- ```bash
279
- git branch --show-current
280
- ```
281
-
282
- - If the branch name matches `{major}.{minor}.x`, the target milestone is the same line milestone `{major}.{minor}.x`
283
-
284
- 2. If the current branch is `main` or `master`, detect existing release branches:
285
-
286
- ```bash
287
- git branch -a | grep -oE '[0-9]+\.[0-9]+\.x' | sort -V | tail -1
288
- ```
289
-
290
- - If the highest release branch is `X.Y.x`, the target milestone is `(X+1).0.x`
291
- - If no release branch exists, read the latest tag:
292
-
293
- ```bash
294
- git tag --list 'v*' --sort=-v:refname | head -1
295
- ```
296
-
297
- - When the latest tag exists and can be parsed as `X.Y.Z`, the target milestone is `X.Y.x`
298
-
299
- 3. If none of the above yields a result, fall back to `General Backlog`
300
-
301
- **d) Find the target milestone number**
302
-
303
- Run:
304
-
305
- ```bash
306
- gh api "repos/$repo/milestones" --paginate \
307
- --jq '.[] | select(.title=="{target}") | .number'
308
- ```
309
-
310
- - If the target milestone does not exist, fall back to `General Backlog`
311
- - If `General Backlog` also does not exist, record `Milestone: skipped (not found)` and skip assignment
312
-
313
- **e) Assign the Issue to the milestone**
314
-
315
- Once a target milestone number is found, run:
316
-
317
- ```bash
318
- gh api "repos/$repo/issues/{issue-number}" -X PATCH -F milestone={milestone-number}
319
- ```
320
-
321
- Record:
322
- - `Milestone: {target} (assigned)` or
323
- - `Milestone: General Backlog (fallback)`
324
-
325
- ### 9. Fetch Existing Comments and Build the Published Artifact Set
326
-
327
- Fetch all Issue comments in one pass, then build the set of published artifact stems from hidden markers and construct the local timeline of artifacts to publish.
328
-
329
- First fetch comments (preserving comment id and body):
330
-
331
- ```bash
332
- comments_jsonl="$(mktemp)"
333
-
334
- gh api "repos/$repo/issues/{issue-number}/comments" \
335
- --paginate \
336
- --jq '.[] | {id, body}' > "$comments_jsonl"
337
- ```
338
-
339
- Extract all Activity Log records in `task.md` that end with `→ {filename}`.
340
-
341
- Parsing rules:
342
- - Use the regex `/→\s+(\S+\.md)\s*$/` to extract filenames
343
- - remove the `.md` suffix to get `{file-stem}`
344
- - build the artifact timeline in Activity Log order
345
- - append `summary` as a fixed final artifact at the end of the timeline
346
- - `summary` is always last
347
-
348
- Only include files that still exist in the task directory in the publish set. Skip missing files without error.
349
-
350
- The first line of every sync comment must include a hidden marker:
351
-
352
- ```html
353
- <!-- sync-issue:{task-id}:{file-stem} -->
354
- ```
355
-
356
- Where `{file-stem}` is the filename without the `.md` suffix, for example `analysis`, `plan`, `implementation`, `implementation-r2`, or `review-r3`. `summary` still uses the literal `summary`.
357
-
358
- Timeline example:
359
- `analysis → plan → implementation → review → refinement → analysis-r2 → plan-r2 → implementation-r2 → review-r2 → summary`
360
-
361
- For each `{file-stem}`, determine whether it has already been published with a local check:
362
-
363
- ```bash
364
- grep -qF "<!-- sync-issue:{task-id}:{file-stem} -->" "$comments_jsonl"
365
- ```
366
-
367
- - match found: this artifact has already been published and should be skipped by default
368
- - no match: this artifact has not been published yet and can create a new comment
369
-
370
- For the `summary` artifact, also extract the comment id for later updates:
371
-
372
- ```bash
373
- summary_comment_id="$(
374
- jq -r 'select(.body | contains("<!-- sync-issue:{task-id}:summary -->")) | .id' \
375
- "$comments_jsonl" | head -1
376
- )"
377
- ```
378
-
379
- Before finishing Step 9, precompute `has_unpublished_artifacts` from the published/unpublished results above: whether any non-`summary` artifact remains unpublished. Keep this value fixed during Step 10. It is only used to decide whether `summary` should be updated in place or deleted and rebuilt at the end.
380
-
381
- Idempotency requirements:
382
- - On the first run, publish comments only for artifacts that currently exist
383
- - On the second run, skip already published files and only publish new artifacts (for example `implementation-r2`, `review-r2`)
384
- - If all artifact file comments have already been published and the `summary` content has not changed, publish no new comments
385
- - If `summary` is already published but the delivery state has changed: delete the old `summary` and recreate it at the end when new artifacts are published this run; otherwise update the existing comment in place when no new artifacts are published
386
-
387
- ### 10. Publish Context Files One by One in Timeline Order
388
-
389
- Process the sorted artifact list from Step 9 one item at a time. Do not fall back to a fixed 5-step order, and do not merge multiple rounds of the same artifact type into a single comment.
390
-
391
- **a) Prepare comment content for each artifact**
392
-
393
- - `analysis`: publish the full text of `analysis.md`
394
- - `plan`: publish the full text of `plan.md`
395
- - `analysis-r{N}`, `plan-r{N}`: publish one comment per file, using the artifact's original content as the comment body
396
- - `implementation`, `implementation-r{N}`: publish one comment per file, using the corresponding implementation report as-is
397
- - `refinement`, `refinement-r{N}`: publish one comment per file, using the corresponding refinement report as-is
398
- - `review`, `review-r{N}`: publish one comment per file, using the corresponding review report as-is
399
- - `summary`: generate a concise delivery summary that includes only the current delivery state and absolute GitHub links
400
-
401
- All artifacts except `summary` must publish the original content directly. Do not compress them into another summary.
402
-
403
- Use the same format for every comment:
404
-
405
- ```markdown
406
- <!-- sync-issue:{task-id}:{file-stem} -->
407
- ## {artifact title}
408
-
409
- {original content or summary content}
410
-
411
- ---
412
- *Generated by AI · Internal tracking: {task-id}*
413
- ```
414
-
415
- Recommended title mapping:
416
- - `analysis` -> `Requirements Analysis`
417
- - `analysis-r2` -> `Requirements Analysis (Round 2)`
418
- - `analysis-r{N}` -> `Requirements Analysis (Round {N})`
419
- - `plan` -> `Technical Plan`
420
- - `plan-r2` -> `Technical Plan (Round 2)`
421
- - `plan-r{N}` -> `Technical Plan (Round {N})`
422
- - `implementation` -> `Implementation Report (Round 1)`
423
- - `implementation-r2` -> `Implementation Report (Round 2)`
424
- - `implementation-r{N}` -> `Implementation Report (Round {N})`
425
- - `refinement` -> `Refinement Report (Round 1)`
426
- - `refinement-r2` -> `Refinement Report (Round 2)`
427
- - `refinement-r{N}` -> `Refinement Report (Round {N})`
428
- - `review` -> `Review Report (Round 1)`
429
- - `review-r2` -> `Review Report (Round 2)`
430
- - `review-r{N}` -> `Review Report (Round {N})`
431
- - `summary` -> `Delivery Summary`
432
-
433
- Recommended `summary` comment format:
434
-
435
- ```markdown
436
- <!-- sync-issue:{task-id}:summary -->
437
- ## Delivery Summary
438
-
439
- **Updated at**: {current time}
440
- **Status**: {formatted status description}
441
-
442
- | Type | Content |
443
- |---|---|
444
- | Branch | `{branch or N/A}` |
445
- | Commit | [`{commit-short}`](https://github.com/{owner}/{repo}/commit/{commit-hash}) or `N/A` |
446
-
447
- ---
448
- *Generated by AI · Internal tracking: {task-id}*
449
- ```
450
-
451
- Formatted status description rules:
452
- - Mode A: `✅ Completed`
453
- - Mode B: `PR stage`
454
- - Mode C: `In development, current step is {current_step}`
455
-
456
- **b) Skip already-published or missing artifacts**
457
-
458
- - For `analysis.md`, `plan.md`, `implementation*.md`, and `review*.md`: skip directly if the corresponding file does not exist, without error
459
- - For any artifact: skip by default if its marker already exists
460
- - For `summary`: regenerate candidate content even if its marker already exists, so you can compare whether an update is needed
461
-
462
- **c) Publish a new comment**
463
-
464
- When an artifact has not been published yet, run:
465
-
466
- ```bash
467
- gh issue comment {issue-number} --body "$(cat <<'EOF'
468
- {comment-body}
469
- EOF
470
- )"
471
- ```
472
-
473
- **d) Publish or rebuild the `summary` comment**
474
-
475
- `summary` must always remain the last comment. Choose the handling strategy with these rules:
476
-
477
- - `summary` does not exist: publish a new `summary` comment using Step 10c
478
- - `summary` exists and `has_unpublished_artifacts=true`: delete the old `summary` comment first, then publish a new `summary` comment using Step 10c
479
- - `summary` exists, `has_unpublished_artifacts=false`, and the newly generated content differs from the existing one: update the existing comment in place
480
- - `summary` exists, `has_unpublished_artifacts=false`, and the content is the same: do nothing
481
-
482
- To delete the old `summary` comment, run:
483
-
484
- ```bash
485
- gh api "repos/$repo/issues/comments/{summary_comment_id}" -X DELETE
486
- ```
487
-
488
- To update an existing `summary` comment in place, run:
489
-
490
- ```bash
491
- gh api "repos/$repo/issues/comments/{summary_comment_id}" -X PATCH -f body="$(cat <<'EOF'
492
- {comment-body}
493
- EOF
494
- )"
495
- ```
496
-
497
- **e) No-op scenario**
498
-
499
- If all artifacts are already synced and `summary` does not need an update:
500
- - publish no new comments
501
- - explicitly tell the user at the end: `All artifacts are already synced, no new content`
502
-
503
- ### 11. Update Task Status
68
+ ### 10. Update Task Status
504
69
 
505
70
  Get the current time:
506
71
 
@@ -508,42 +73,21 @@ Get the current time:
508
73
  date "+%Y-%m-%d %H:%M:%S"
509
74
  ```
510
75
 
511
- Add or update the `last_synced_at` field in task.md with `{current time}`.
512
- - **Append** to `## Activity Log` (do NOT overwrite previous entries):
513
- ```
514
- - {yyyy-MM-dd HH:mm:ss} — **Sync to Issue** by {agent} — Progress synced to Issue #{issue-number}
515
- ```
76
+ Update `last_synced_at` in task.md and append the Sync to Issue Activity Log entry.
516
77
 
517
- ### 12. Inform User
78
+ ### 11. Inform User
518
79
 
519
- ```
520
- Progress synced to Issue #{issue-number}.
521
-
522
- Sync result:
523
- - New comments published: {count}
524
- - Comments updated: {count}
525
- - Steps skipped: {step list or `none`}
526
- - Current status: {status}
527
- - Labels: status={status-label or cleared}, in:={added count}
528
- - Issue Type: {Bug / Feature / Task / skipped}
529
- - Milestone: {preserved / assigned / fallback / skipped}
530
- - Development: {Closes link appended / link already existed / no PR, skipped}
531
-
532
- View: https://github.com/{owner}/{repo}/issues/{issue-number}
533
-
534
- If no comments were published or updated in this run, clearly state: all steps are already synced, no new content.
535
- ```
80
+ Summarize synced labels, milestone, development linkage, published comments, and include the Issue URL.
536
81
 
537
82
  ## Notes
538
83
 
539
- 1. **Requires an issue number**: task.md must contain `issue_number`. If missing, prompt the user.
540
- 2. **Audience**: `sync-issue` is for stakeholders, while `sync-pr` is for code reviewers. They have different focus areas.
541
- 3. **When to sync**: sync after major stages (analysis, design, implementation, review) or when blocked.
542
- 4. **Avoid noise**: do not sync too frequently. Although this skill uses hidden markers for idempotency, avoid meaningless repeated syncs.
84
+ - The hidden comment marker format must stay `<!-- sync-issue:{task-id}:{file-stem} -->`
85
+ - Build the artifact timeline from Activity Log order, not a fixed `analysis -> plan -> implementation -> review -> summary` sequence
86
+ - Follow the Step 9 shell safety rules when publishing comments or updating the Issue body: do not rely on command substitution inside quoted heredocs, and do not use `echo` for HTML comment markers
543
87
 
544
88
  ## Error Handling
545
89
 
546
- - Task not found: output "Task {task-id} not found"
547
- - Missing issue number: output "Task has no issue_number field"
548
- - Issue not found: output "Issue #{number} not found"
549
- - `gh` authentication failed: output "Please check GitHub CLI authentication"
90
+ - Task not found: `Task {task-id} not found`
91
+ - Missing `issue_number`: `Task has no issue_number field`
92
+ - GitHub CLI auth failed: `Please check GitHub CLI authentication`
93
+ - Issue not found: `Issue #{number} not found`