@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
@@ -0,0 +1,77 @@
1
+ # Labels, Issue Type, and Milestone Rules
2
+
3
+ Read this file before applying labels, Issue Type, milestone, or `in:` labels.
4
+
5
+ ## Default Body Format (Fallback)
6
+
7
+ Recommended fallback:
8
+
9
+ ```markdown
10
+ ## Description
11
+
12
+ {task-description}
13
+
14
+ ## Requirements
15
+
16
+ - [ ] {requirement-1}
17
+ - [ ] {requirement-2}
18
+ ```
19
+
20
+ Map task types to GitHub labels and Issue Types, but keep only labels that actually exist.
21
+
22
+ Fallback label mapping:
23
+
24
+ | task.md type | GitHub label |
25
+ |---|---|
26
+ | `bug`, `bugfix` | `type: bug` |
27
+ | `feature` | `type: feature` |
28
+ | `enhancement` | `type: enhancement` |
29
+ | `docs`, `documentation` | `type: documentation` |
30
+ | `dependency-upgrade` | `type: dependency-upgrade` |
31
+ | `task`, `chore`, `refactor`, `refactoring` | `type: task` |
32
+ | other values | skip |
33
+
34
+ Issue Type fallback mapping:
35
+
36
+ | task.md type | GitHub Issue Type |
37
+ |---|---|
38
+ | `bug`, `bugfix` | `Bug` |
39
+ | `feature`, `enhancement` | `Feature` |
40
+ | `task`, `documentation`, `dependency-upgrade`, `chore`, `docs`, `refactor`, `refactoring`, and all other values | `Task` |
41
+
42
+ ## Create the Issue
43
+
44
+ Use:
45
+
46
+ ```bash
47
+ gh issue create --title "{title}" --body "{body}" --label "{label-1}" --label "{label-2}" --milestone "{milestone}"
48
+ ```
49
+
50
+ If no valid labels remain, omit `--label`. If `milestone` is empty, fall back to `General Backlog`.
51
+
52
+ Issue Type setup:
53
+
54
+ ```bash
55
+ gh api "orgs/$owner/issue-types" --jq '.[].name'
56
+ gh api "repos/$repo/issues/{issue-number}" -X PATCH -f type="{issue-type}" --silent
57
+ ```
58
+
59
+ `in:` labels:
60
+
61
+ ```bash
62
+ gh label list --search "in:" --limit 50 --json name --jq '.[].name'
63
+ gh issue edit {issue-number} --add-label "in: {module}"
64
+ ```
65
+
66
+ Only add relevant `in:` labels. Do not remove existing `in:` labels, and do not fail Issue creation when `in:` labels are unavailable or irrelevant.
67
+
68
+ Skip unavailable labels, Issue Types, or milestones without failing the Issue creation flow.
69
+
70
+ Final user output must include every TUI `sync-issue` command format:
71
+
72
+ ```text
73
+ Next step - sync progress to the Issue:
74
+ - Claude Code / OpenCode: /sync-issue {task-id}
75
+ - Gemini CLI: /agent-infra:sync-issue {task-id}
76
+ - Codex CLI: $sync-issue {task-id}
77
+ ```
@@ -0,0 +1,77 @@
1
+ # Label、Issue Type 和 Milestone 规则
2
+
3
+ 在应用 label、Issue Type、milestone 或 `in:` label 之前先读取本文件。
4
+
5
+ ## 默认正文格式(Fallback)
6
+
7
+ 推荐 fallback:
8
+
9
+ ```markdown
10
+ ## Description
11
+
12
+ {task-description}
13
+
14
+ ## Requirements
15
+
16
+ - [ ] {requirement-1}
17
+ - [ ] {requirement-2}
18
+ ```
19
+
20
+ 将任务类型映射到 GitHub label 和 Issue Type,但只保留仓库里实际存在的 label。
21
+
22
+ Fallback label 映射:
23
+
24
+ | task.md type | GitHub label |
25
+ |---|---|
26
+ | `bug`, `bugfix` | `type: bug` |
27
+ | `feature` | `type: feature` |
28
+ | `enhancement` | `type: enhancement` |
29
+ | `docs`, `documentation` | `type: documentation` |
30
+ | `dependency-upgrade` | `type: dependency-upgrade` |
31
+ | `task`, `chore`, `refactor`, `refactoring` | `type: task` |
32
+ | 其他值 | 跳过 |
33
+
34
+ Issue Type fallback 映射:
35
+
36
+ | task.md type | GitHub Issue Type |
37
+ |---|---|
38
+ | `bug`, `bugfix` | `Bug` |
39
+ | `feature`, `enhancement` | `Feature` |
40
+ | `task`, `documentation`, `dependency-upgrade`, `chore`, `docs`, `refactor`, `refactoring` 以及其他所有值 | `Task` |
41
+
42
+ ## 创建 Issue
43
+
44
+ 使用:
45
+
46
+ ```bash
47
+ gh issue create --title "{title}" --body "{body}" --label "{label-1}" --label "{label-2}" --milestone "{milestone}"
48
+ ```
49
+
50
+ 如果最终没有有效 label,就省略 `--label`。如果 `milestone` 为空,则回退到 `General Backlog`。
51
+
52
+ Issue Type 设置:
53
+
54
+ ```bash
55
+ gh api "orgs/$owner/issue-types" --jq '.[].name'
56
+ gh api "repos/$repo/issues/{issue-number}" -X PATCH -f type="{issue-type}" --silent
57
+ ```
58
+
59
+ `in:` label:
60
+
61
+ ```bash
62
+ gh label list --search "in:" --limit 50 --json name --jq '.[].name'
63
+ gh issue edit {issue-number} --add-label "in: {module}"
64
+ ```
65
+
66
+ 只添加相关的 `in:` label。不要移除已有的 `in:` label,并且当 `in:` label 不可用或不相关时,不要让创建 Issue 流程失败。
67
+
68
+ 当 label、Issue Type 或 milestone 不可用时,应跳过并继续,不要让 Issue 创建失败。
69
+
70
+ 最终给用户的输出必须包含所有 TUI 的 `sync-issue` 命令格式:
71
+
72
+ ```text
73
+ 下一步 - 同步进度到 Issue:
74
+ - Claude Code / OpenCode: /sync-issue {task-id}
75
+ - Gemini CLI: /agent-infra:sync-issue {task-id}
76
+ - Codex CLI: $sync-issue {task-id}
77
+ ```
@@ -0,0 +1,45 @@
1
+ # Issue Template Matching
2
+
3
+ Read this file before deciding how to build the Issue body from `.github/ISSUE_TEMPLATE`.
4
+
5
+ ## Detect Issue Templates
6
+
7
+ Search project templates with:
8
+
9
+ ```bash
10
+ rg --files .github/ISSUE_TEMPLATE -g '*.yml' -g '!config.yml'
11
+ ```
12
+
13
+ If templates exist, inspect their top-level `name:` fields and choose the best match for the task title and description.
14
+
15
+ Typical candidate templates:
16
+ - `bug_report.yml` for bug work
17
+ - `question.yml` for question or investigation work
18
+ - `feature_request.yml` for feature work
19
+ - `documentation.yml` for documentation work
20
+ - `other.yml` as the general fallback
21
+
22
+ If no template matches clearly, choose the nearest candidate. If templates are missing, unreadable, or parsing fails, fall back to the default body path.
23
+
24
+ ## Build the Body from the Matched Template
25
+
26
+ Read the matched template's:
27
+ - `name`
28
+ - `type:`
29
+ - `labels:`
30
+ - `body:`
31
+
32
+ Field handling rules:
33
+ - `textarea` and `input`: use `attributes.label` as the markdown heading and fill values from task.md
34
+ - `markdown`: skip template explanation prose
35
+ - `dropdown` and `checkboxes`: skip
36
+ - when task.md lacks a suitable value, write `N/A`
37
+
38
+ Suggested field mapping:
39
+
40
+ | Template field hint | task.md source |
41
+ |---|---|
42
+ | `summary`, `title` | task title |
43
+ | `description`, `problem`, `what happened`, `issue-description`, `current-content` | task description |
44
+ | `solution`, `requirements`, `steps`, `suggested-content`, `impact`, `context`, `alternatives`, `expected` | requirements list |
45
+ | other `textarea` / `input` fields | task description, otherwise `N/A` |
@@ -0,0 +1,45 @@
1
+ # Issue 模板匹配
2
+
3
+ 在决定如何从 `.github/ISSUE_TEMPLATE` 构建 Issue 正文之前先读取本文件。
4
+
5
+ ## 探测 Issue 模板
6
+
7
+ 用下面的命令搜索项目模板:
8
+
9
+ ```bash
10
+ rg --files .github/ISSUE_TEMPLATE -g '*.yml' -g '!config.yml'
11
+ ```
12
+
13
+ 如果模板存在,检查其顶层 `name:` 字段,并为当前任务标题和描述选择最匹配的模板。
14
+
15
+ 常见候选模板:
16
+ - `bug_report.yml`:用于 bug 类工作
17
+ - `question.yml`:用于问题排查或调研类工作
18
+ - `feature_request.yml`:用于功能类工作
19
+ - `documentation.yml`:用于文档类工作
20
+ - `other.yml`:通用 fallback
21
+
22
+ 如果没有明显匹配的模板,选择最接近的候选项。如果模板缺失、不可读取或解析失败,就回退到默认正文路径。
23
+
24
+ ## 使用匹配到的模板构建正文
25
+
26
+ 读取匹配模板中的:
27
+ - `name`
28
+ - `type:`
29
+ - `labels:`
30
+ - `body:`
31
+
32
+ 字段处理规则:
33
+ - `textarea` 和 `input`:使用 `attributes.label` 作为 Markdown 标题,并从 task.md 填充值
34
+ - `markdown`:跳过模板解释性文字
35
+ - `dropdown` 和 `checkboxes`:跳过
36
+ - 当 task.md 没有合适值时,写入 `N/A`
37
+
38
+ 建议字段映射:
39
+
40
+ | 模板字段提示 | task.md 来源 |
41
+ |---|---|
42
+ | `summary`, `title` | 任务标题 |
43
+ | `description`, `problem`, `what happened`, `issue-description`, `current-content` | 任务描述 |
44
+ | `solution`, `requirements`, `steps`, `suggested-content`, `impact`, `context`, `alternatives`, `expected` | 需求列表 |
45
+ | 其他 `textarea` / `input` 字段 | 优先使用任务描述,否则写 `N/A` |
@@ -1,202 +1,55 @@
1
1
  ---
2
2
  name: create-pr
3
- description: >
4
- Create a Pull Request to the specified or auto-detected target branch.
5
- Triggered when the user requests PR creation.
6
- Optional argument: target branch.
3
+ description: "Create a Pull Request to a target branch"
7
4
  ---
8
5
 
9
6
  # Create Pull Request
10
7
 
11
- Create a Pull Request. Optional argument: target branch.
8
+ Create a Pull Request and, when task-related, sync the essential metadata immediately.
12
9
 
13
10
  ## Execution Flow
14
11
 
15
- ### 1. Determine Target Branch
12
+ ### 1. Parse Command Arguments
16
13
 
17
- - If user provided an argument (e.g. `main`, `develop`, `3.6.x`), use it as target branch
18
- - If no argument, auto-detect:
19
- ```bash
20
- git branch --show-current
21
- git log --oneline --decorate --first-parent -20
22
- ```
23
- **Detection rules**:
24
- - Currently on a main/trunk branch -> target is that branch
25
- - Currently on a feature branch -> find the nearest parent branch from log decorations
26
- - Cannot determine -> ask the user
14
+ Identify arguments from the command input:
15
+ - arguments matching `TASK-{yyyyMMdd-HHmmss}` -> `{task-id}`
16
+ - remaining arguments -> `{target-branch}`
27
17
 
28
- ### 2. Read PR Template
18
+ If `{task-id}` is provided, read `.agents/workspace/active/{task-id}/task.md` to load task metadata such as `issue_number` and `type`.
19
+ If `{task-id}` is omitted, try to resolve it from the current session context; if it still cannot be determined, skip task-association logic in later steps.
29
20
 
30
- Read `.github/PULL_REQUEST_TEMPLATE.md` from the repository.
21
+ ### 2. Determine the Target Branch
31
22
 
32
- If the template doesn't exist, use a standard format.
23
+ Use the explicit argument when provided. Otherwise infer the target branch from Git history and branch topology.
33
24
 
34
- ### 3. Review Recent Merged PRs for Reference
25
+ > Detailed branch detection rules live in `reference/branch-strategy.md`. Read `reference/branch-strategy.md` before auto-detecting the base branch.
35
26
 
36
- ```bash
37
- gh pr list --limit 3 --state merged --json number,title,body
38
- ```
39
-
40
- Use these as style and format reference.
41
-
42
- ### 4. Analyze Current Branch Changes
43
-
44
- ```bash
45
- git status
46
- git log <target-branch>..HEAD --oneline
47
- git diff <target-branch>...HEAD --stat
48
- git diff <target-branch>...HEAD
49
- ```
50
-
51
- Understand all commits and changes that will be in this PR. Look at ALL commits, not just the latest one.
52
-
53
- ### 5. Check Remote Branch Status
54
-
55
- ```bash
56
- git rev-parse --abbrev-ref --symbolic-full-name @{u} 2>/dev/null
57
- ```
58
-
59
- ### 6. Push If Not Yet Pushed
60
-
61
- ```bash
62
- git push -u origin <current-branch>
63
- ```
64
-
65
- ### 7. Create PR
66
-
67
- - If this work is associated with an active task, extract `issue_number` from task.md
68
- - If `issue_number` exists, query Issue information on a best-effort basis and skip on failure:
69
- ```bash
70
- gh issue view {issue-number} --json number,title --jq '.number' 2>/dev/null
71
- ```
72
- - Follow `.github/PULL_REQUEST_TEMPLATE.md` format for all sections
73
- - Reference recent merged PRs for style
74
- - Use HEREDOC format to pass the body
75
- - If `issue_number` exists:
76
- - replace `{$IssueNumber}` in the template with the actual Issue number
77
- - use `Closes #{issue_number}` in the `Related Issue` section
78
- - If `issue_number` does not exist, keep the current behavior
79
- - PR must end with: `Generated with AI assistance`
80
-
81
- ```bash
82
- gh pr create --base <target-branch> --title "<title>" --assignee @me --body "$(cat <<'EOF'
83
- <Complete PR description following template>
84
-
85
- Generated with AI assistance
86
- EOF
87
- )"
88
- ```
89
-
90
- ### 8. Sync PR Metadata (If Task-Related)
91
-
92
- If this work is associated with an active task, sync the following metadata immediately after creating the PR.
93
-
94
- **a) Check whether the label system has been initialized**
95
-
96
- Run:
97
-
98
- ```bash
99
- gh label list --search "type:" --limit 1 --json name --jq 'length'
100
- ```
101
-
102
- - returns `0` -> run the `init-labels` skill first, then retry this step
103
- - returns non-zero -> continue
104
-
105
- **b) Query Issue metadata**
106
-
107
- If task.md contains `issue_number`, query the Issue labels and milestone on a best-effort basis:
108
-
109
- ```bash
110
- gh issue view {issue-number} --json labels,milestone 2>/dev/null
111
- ```
27
+ ### 3. Prepare the PR Body
112
28
 
113
- If the query fails (Issue not found, permission denied, etc.), skip Issue metadata inheritance and continue with only the static mappings from task.md.
29
+ Read `.github/PULL_REQUEST_TEMPLATE.md` when it exists, review recent merged PRs for style, and gather all commits between `<target-branch>` and `HEAD`.
114
30
 
115
- Record the results for later substeps:
116
- - `{issue-labels}`: list of labels currently on the Issue
117
- - `{issue-milestone}`: title of the Issue milestone, if present
31
+ > Template handling, HEREDOC body generation, and `Generated with AI assistance` requirements live in `reference/pr-body-template.md`. Read `reference/pr-body-template.md` before writing the PR body.
118
32
 
119
- **c) Sync the type label**
33
+ ### 4. Check Remote Branch State
120
34
 
121
- Map task.md `type` using this table:
35
+ Confirm whether the current branch already has an upstream. Push with `git push -u origin <current-branch>` when required.
122
36
 
123
- | task.md type | GitHub label |
124
- |---|---|
125
- | bug, bugfix | `type: bug` |
126
- | feature | `type: feature` |
127
- | enhancement | `type: enhancement` |
128
- | refactor, refactoring | `type: enhancement` |
129
- | documentation | `type: documentation` |
130
- | dependency-upgrade | `type: dependency-upgrade` |
131
- | task | `type: task` |
132
- | anything else | skip |
37
+ ### 5. Create the PR
133
38
 
134
- If task.md `type` maps to a standard type label, run:
39
+ Create the PR with `gh pr create --base <target-branch> --title "<title>" --assignee @me --body ...`.
135
40
 
136
- ```bash
137
- gh pr edit {pr-number} --add-label "{type-label}"
138
- ```
139
-
140
- **d) Inherit Issue labels**
141
-
142
- If `{issue-labels}` is not empty, filter labels that do not start with `type:` or `status:` and run the following for each label on a best-effort basis:
143
-
144
- ```bash
145
- gh pr edit {pr-number} --add-label "{label-name}"
146
- ```
147
-
148
- Only add labels; do not remove any existing PR labels.
149
-
150
- **e) Sync `in:` labels**
41
+ If `{task-id}` is available and the related task provides `issue_number`, keep `Closes #{issue-number}` in the PR body.
151
42
 
152
- Extract affected modules from implementation reports or analysis, verify that the label exists, then run:
43
+ ### 6. Sync PR Metadata
153
44
 
154
- ```bash
155
- gh pr edit {pr-number} --add-label "in: {module}"
156
- ```
157
-
158
- Only add labels; do not remove existing `in:` labels.
159
-
160
- **f) Sync the milestone**
161
-
162
- Extend the `sync-pr` milestone inference strategy with Issue milestone priority:
163
- - preserve an existing PR milestone
164
- - otherwise respect explicit `milestone` from task.md
165
- - otherwise use the Issue milestone when available (`{issue-milestone}`)
166
- - otherwise infer from the current branch, release branches, or the latest tag
167
- - finally fall back to `General Backlog`
168
-
169
- Once the target is resolved, run:
170
-
171
- ```bash
172
- gh pr edit {pr-number} --milestone "{milestone-title}"
173
- ```
45
+ For PRs where `{task-id}` is available, sync the core metadata immediately:
46
+ - run `gh label list --search "type:" --limit 1 --json name --jq 'length'`
47
+ - add the mapped type label with `gh pr edit {pr-number} --add-label "{type-label}"`
48
+ - add relevant `in: {module}` labels with `gh pr edit {pr-number} --add-label "in: {module}"`
49
+ - set the milestone with `gh pr edit {pr-number} --milestone "{milestone-title}"`
50
+ - keep Development linking in the PR body with `Closes #{issue-number}` when applicable
174
51
 
175
- **g) Sync development linking**
176
-
177
- If task.md contains `issue_number`, read the PR body:
178
-
179
- ```bash
180
- gh pr view {pr-number} --json body --jq '.body // ""'
181
- ```
182
-
183
- If the body does not contain any of:
184
- - `Closes #{issue-number}`
185
- - `Fixes #{issue-number}`
186
- - `Resolves #{issue-number}`
187
-
188
- append:
189
-
190
- ```bash
191
- gh pr edit {pr-number} --body "$(cat <<'EOF'
192
- {existing-body}
193
-
194
- Closes #{issue-number}
195
- EOF
196
- )"
197
- ```
198
-
199
- ### 9. Update Task Status (If Task-Related)
52
+ ### 7. Update Task Status
200
53
 
201
54
  Get the current time:
202
55
 
@@ -204,58 +57,23 @@ Get the current time:
204
57
  date "+%Y-%m-%d %H:%M:%S"
205
58
  ```
206
59
 
207
- If there is an active task for this work, update `.agents/workspace/active/{task-id}/task.md`:
208
- - `pr_number`: {pr-number}
209
- - `updated_at`: {current time}
210
- - **Append** to `## Activity Log` (do NOT overwrite previous entries):
211
- ```
212
- - {yyyy-MM-dd HH:mm:ss} — **PR Created** by {agent} — PR #{pr-number} created
213
- ```
214
-
215
- ### 10. Output Result
216
-
217
- > **IMPORTANT**: All TUI command formats listed below must be output in full. Do not show only the format for the current AI agent.
60
+ If `{task-id}` is available, update task.md with `pr_number`, `updated_at`, and append the PR Created Activity Log entry.
218
61
 
219
- > **⚠️ Next-Step Check — you must determine the real next action after PR creation before showing the commands below:**
220
- >
221
- > - If `task.md` has a valid `issue_number` and the PR status or review summary should be synced back into task context, prioritize "Publish review summary (optional)"
222
- > - If all workflow steps are complete, or the next action after PR creation is task archival, include "Complete task"
223
- > - If both apply, make the order explicit: **sync PR progress first, then complete the task**
224
- >
225
- > **Do not present "Complete task" as the only next step when PR progress or context still needs to be synced.**
62
+ ### 8. Inform the User
226
63
 
227
- ```
228
- PR created: {pr-url}
229
-
230
- Metadata sync:
231
- - Labels: {type-label-result}, {in-label-result}
232
- - Milestone: {milestone-result}
233
- - Development: {development-result}
234
-
235
- Next steps (if in task workflow):
236
- - Publish review summary (optional; recommended first when task/PR status still needs syncing):
237
- - Claude Code / OpenCode: /sync-pr {task-id}
238
- - Gemini CLI: /{{project}}:sync-pr {task-id}
239
- - Codex CLI: $sync-pr {task-id}
240
- - Complete task (after all workflow steps are complete):
241
- - Claude Code / OpenCode: /complete-task {task-id}
242
- - Gemini CLI: /{{project}}:complete-task {task-id}
243
- - Codex CLI: $complete-task {task-id}
244
- ```
64
+ Explain the created PR URL, summarize metadata sync results, and present both follow-up commands in order:
65
+ - optional `sync-pr {task-id}` to publish reviewer-facing context
66
+ - `complete-task {task-id}` once the workflow is truly done
245
67
 
246
68
  ## Notes
247
69
 
248
- 1. **Follow PR template**: Fill in all required sections from the template
249
- 2. **Reference style**: Match the format and style of recent merged PRs
250
- 3. **Title format**: Follow Conventional Commits or project conventions
251
- 4. **All commits matter**: Analyze ALL commits in the branch, not just the latest
252
- 5. **Sync metadata automatically**: When task-related, create-pr must immediately fill labels, milestone, and development linking after PR creation
70
+ - Review every commit in the branch, not only the latest one
71
+ - `create-pr` must not defer type-label mapping to `sync-pr`; inline the mapping here when `{task-id}` is available
72
+ - When metadata inheritance from the Issue fails, continue with task.md and branch-based fallbacks
253
73
 
254
74
  ## Error Handling
255
75
 
256
- - No commits to push: Prompt "No commits found between {target} and HEAD"
257
- - Push rejected: Suggest `git pull --rebase` first
258
- - PR already exists: Show existing PR URL
259
- - Issue not accessible or missing: Skip Issue metadata inheritance and record "Issue #{number} not accessible, skipping metadata inheritance"
260
- - Issue label unavailable: Skip that label and record "Label '{name}' not found, skipping"
261
- - Issue milestone unavailable: Fall back to branch-based milestone inference
76
+ - No commits found between `{target}` and `HEAD`
77
+ - Push rejected: suggest `git pull --rebase`
78
+ - Existing PR found: show the current PR URL
79
+ - Inaccessible Issue metadata: skip inheritance and continue