@fitlab-ai/agent-infra 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (285) hide show
  1. package/License.txt +21 -0
  2. package/README.md +170 -0
  3. package/README.zh-CN.md +170 -0
  4. package/bin/cli.js +65 -0
  5. package/lib/defaults.json +45 -0
  6. package/lib/init.js +203 -0
  7. package/lib/log.js +27 -0
  8. package/lib/paths.js +48 -0
  9. package/lib/prompt.js +70 -0
  10. package/lib/render.js +99 -0
  11. package/lib/update.js +161 -0
  12. package/lib/version.js +7 -0
  13. package/package.json +48 -0
  14. package/templates/.agent-workspace/README.md +26 -0
  15. package/templates/.agent-workspace/README.zh-CN.md +26 -0
  16. package/templates/.agents/QUICKSTART.md +166 -0
  17. package/templates/.agents/QUICKSTART.zh-CN.md +166 -0
  18. package/templates/.agents/README.md +134 -0
  19. package/templates/.agents/README.zh-CN.md +134 -0
  20. package/templates/.agents/skills/analyze-task/SKILL.md +169 -0
  21. package/templates/.agents/skills/analyze-task/SKILL.zh-CN.md +169 -0
  22. package/templates/.agents/skills/block-task/SKILL.md +164 -0
  23. package/templates/.agents/skills/block-task/SKILL.zh-CN.md +163 -0
  24. package/templates/.agents/skills/check-task/SKILL.md +122 -0
  25. package/templates/.agents/skills/check-task/SKILL.zh-CN.md +122 -0
  26. package/templates/.agents/skills/close-codescan/SKILL.md +122 -0
  27. package/templates/.agents/skills/close-codescan/SKILL.zh-CN.md +122 -0
  28. package/templates/.agents/skills/close-dependabot/SKILL.md +130 -0
  29. package/templates/.agents/skills/close-dependabot/SKILL.zh-CN.md +130 -0
  30. package/templates/.agents/skills/commit/SKILL.md +218 -0
  31. package/templates/.agents/skills/commit/SKILL.zh-CN.md +217 -0
  32. package/templates/.agents/skills/complete-task/SKILL.md +139 -0
  33. package/templates/.agents/skills/complete-task/SKILL.zh-CN.md +137 -0
  34. package/templates/.agents/skills/create-pr/SKILL.md +126 -0
  35. package/templates/.agents/skills/create-pr/SKILL.zh-CN.md +125 -0
  36. package/templates/.agents/skills/create-release-note/SKILL.md +167 -0
  37. package/templates/.agents/skills/create-release-note/SKILL.zh-CN.md +166 -0
  38. package/templates/.agents/skills/create-task/SKILL.md +143 -0
  39. package/templates/.agents/skills/create-task/SKILL.zh-CN.md +143 -0
  40. package/templates/.agents/skills/implement-task/SKILL.md +229 -0
  41. package/templates/.agents/skills/implement-task/SKILL.zh-CN.md +227 -0
  42. package/templates/.agents/skills/import-codescan/SKILL.md +103 -0
  43. package/templates/.agents/skills/import-codescan/SKILL.zh-CN.md +103 -0
  44. package/templates/.agents/skills/import-dependabot/SKILL.md +107 -0
  45. package/templates/.agents/skills/import-dependabot/SKILL.zh-CN.md +107 -0
  46. package/templates/.agents/skills/import-issue/SKILL.md +119 -0
  47. package/templates/.agents/skills/import-issue/SKILL.zh-CN.md +119 -0
  48. package/templates/.agents/skills/init-labels/SKILL.md +74 -0
  49. package/templates/.agents/skills/init-labels/SKILL.zh-CN.md +74 -0
  50. package/templates/.agents/skills/init-labels/scripts/init-labels.sh +111 -0
  51. package/templates/.agents/skills/init-milestones/SKILL.md +74 -0
  52. package/templates/.agents/skills/init-milestones/SKILL.zh-CN.md +74 -0
  53. package/templates/.agents/skills/init-milestones/scripts/init-milestones.sh +169 -0
  54. package/templates/.agents/skills/plan-task/SKILL.md +225 -0
  55. package/templates/.agents/skills/plan-task/SKILL.zh-CN.md +225 -0
  56. package/templates/.agents/skills/refine-task/SKILL.md +200 -0
  57. package/templates/.agents/skills/refine-task/SKILL.zh-CN.md +200 -0
  58. package/templates/.agents/skills/refine-title/SKILL.md +84 -0
  59. package/templates/.agents/skills/refine-title/SKILL.zh-CN.md +83 -0
  60. package/templates/.agents/skills/release/SKILL.md +142 -0
  61. package/templates/.agents/skills/release/SKILL.zh-CN.md +141 -0
  62. package/templates/.agents/skills/release/scripts/manage-milestones.sh +80 -0
  63. package/templates/.agents/skills/review-task/SKILL.md +276 -0
  64. package/templates/.agents/skills/review-task/SKILL.zh-CN.md +276 -0
  65. package/templates/.agents/skills/sync-issue/SKILL.md +569 -0
  66. package/templates/.agents/skills/sync-issue/SKILL.zh-CN.md +569 -0
  67. package/templates/.agents/skills/sync-pr/SKILL.md +142 -0
  68. package/templates/.agents/skills/sync-pr/SKILL.zh-CN.md +142 -0
  69. package/templates/.agents/skills/test/SKILL.md +61 -0
  70. package/templates/.agents/skills/test/SKILL.zh-CN.md +61 -0
  71. package/templates/.agents/skills/test-integration/SKILL.md +70 -0
  72. package/templates/.agents/skills/test-integration/SKILL.zh-CN.md +69 -0
  73. package/templates/.agents/skills/update-agent-infra/SKILL.md +136 -0
  74. package/templates/.agents/skills/update-agent-infra/SKILL.zh-CN.md +124 -0
  75. package/templates/.agents/skills/update-agent-infra/scripts/package.json +3 -0
  76. package/templates/.agents/skills/update-agent-infra/scripts/sync-templates.js +469 -0
  77. package/templates/.agents/skills/upgrade-dependency/SKILL.md +88 -0
  78. package/templates/.agents/skills/upgrade-dependency/SKILL.zh-CN.md +87 -0
  79. package/templates/.agents/templates/handoff.md +60 -0
  80. package/templates/.agents/templates/handoff.zh-CN.md +60 -0
  81. package/templates/.agents/templates/review-report.md +67 -0
  82. package/templates/.agents/templates/review-report.zh-CN.md +67 -0
  83. package/templates/.agents/templates/task.md +65 -0
  84. package/templates/.agents/templates/task.zh-CN.md +65 -0
  85. package/templates/.agents/workflows/bug-fix.yaml +149 -0
  86. package/templates/.agents/workflows/bug-fix.zh-CN.yaml +149 -0
  87. package/templates/.agents/workflows/code-review.yaml +60 -0
  88. package/templates/.agents/workflows/code-review.zh-CN.yaml +60 -0
  89. package/templates/.agents/workflows/feature-development.yaml +150 -0
  90. package/templates/.agents/workflows/feature-development.zh-CN.yaml +150 -0
  91. package/templates/.agents/workflows/refactoring.yaml +154 -0
  92. package/templates/.agents/workflows/refactoring.zh-CN.yaml +154 -0
  93. package/templates/.claude/CLAUDE.md +163 -0
  94. package/templates/.claude/CLAUDE.zh-CN.md +163 -0
  95. package/templates/.claude/commands/analyze-task.md +8 -0
  96. package/templates/.claude/commands/analyze-task.zh-CN.md +8 -0
  97. package/templates/.claude/commands/block-task.md +8 -0
  98. package/templates/.claude/commands/block-task.zh-CN.md +8 -0
  99. package/templates/.claude/commands/check-task.md +8 -0
  100. package/templates/.claude/commands/check-task.zh-CN.md +8 -0
  101. package/templates/.claude/commands/close-codescan.md +8 -0
  102. package/templates/.claude/commands/close-codescan.zh-CN.md +8 -0
  103. package/templates/.claude/commands/close-dependabot.md +8 -0
  104. package/templates/.claude/commands/close-dependabot.zh-CN.md +8 -0
  105. package/templates/.claude/commands/commit.md +7 -0
  106. package/templates/.claude/commands/commit.zh-CN.md +7 -0
  107. package/templates/.claude/commands/complete-task.md +8 -0
  108. package/templates/.claude/commands/complete-task.zh-CN.md +8 -0
  109. package/templates/.claude/commands/create-pr.md +8 -0
  110. package/templates/.claude/commands/create-pr.zh-CN.md +8 -0
  111. package/templates/.claude/commands/create-release-note.md +8 -0
  112. package/templates/.claude/commands/create-release-note.zh-CN.md +8 -0
  113. package/templates/.claude/commands/create-task.md +8 -0
  114. package/templates/.claude/commands/create-task.zh-CN.md +8 -0
  115. package/templates/.claude/commands/implement-task.md +8 -0
  116. package/templates/.claude/commands/implement-task.zh-CN.md +8 -0
  117. package/templates/.claude/commands/import-codescan.md +8 -0
  118. package/templates/.claude/commands/import-codescan.zh-CN.md +8 -0
  119. package/templates/.claude/commands/import-dependabot.md +8 -0
  120. package/templates/.claude/commands/import-dependabot.zh-CN.md +8 -0
  121. package/templates/.claude/commands/import-issue.md +8 -0
  122. package/templates/.claude/commands/import-issue.zh-CN.md +8 -0
  123. package/templates/.claude/commands/init-labels.md +7 -0
  124. package/templates/.claude/commands/init-labels.zh-CN.md +7 -0
  125. package/templates/.claude/commands/init-milestones.md +8 -0
  126. package/templates/.claude/commands/init-milestones.zh-CN.md +8 -0
  127. package/templates/.claude/commands/plan-task.md +8 -0
  128. package/templates/.claude/commands/plan-task.zh-CN.md +8 -0
  129. package/templates/.claude/commands/refine-task.md +8 -0
  130. package/templates/.claude/commands/refine-task.zh-CN.md +8 -0
  131. package/templates/.claude/commands/refine-title.md +8 -0
  132. package/templates/.claude/commands/refine-title.zh-CN.md +8 -0
  133. package/templates/.claude/commands/release.md +8 -0
  134. package/templates/.claude/commands/release.zh-CN.md +8 -0
  135. package/templates/.claude/commands/review-task.md +8 -0
  136. package/templates/.claude/commands/review-task.zh-CN.md +8 -0
  137. package/templates/.claude/commands/sync-issue.md +8 -0
  138. package/templates/.claude/commands/sync-issue.zh-CN.md +8 -0
  139. package/templates/.claude/commands/sync-pr.md +8 -0
  140. package/templates/.claude/commands/sync-pr.zh-CN.md +8 -0
  141. package/templates/.claude/commands/test-integration.md +7 -0
  142. package/templates/.claude/commands/test-integration.zh-CN.md +7 -0
  143. package/templates/.claude/commands/test.md +7 -0
  144. package/templates/.claude/commands/test.zh-CN.md +7 -0
  145. package/templates/.claude/commands/update-agent-infra.md +7 -0
  146. package/templates/.claude/commands/update-agent-infra.zh-CN.md +7 -0
  147. package/templates/.claude/commands/upgrade-dependency.md +8 -0
  148. package/templates/.claude/commands/upgrade-dependency.zh-CN.md +8 -0
  149. package/templates/.claude/project-rules.md +65 -0
  150. package/templates/.claude/project-rules.zh-CN.md +65 -0
  151. package/templates/.claude/settings.json +20 -0
  152. package/templates/.codex/README.md +38 -0
  153. package/templates/.codex/README.zh-CN.md +37 -0
  154. package/templates/.editorconfig +15 -0
  155. package/templates/.gemini/commands/_project_/analyze-task.toml +8 -0
  156. package/templates/.gemini/commands/_project_/analyze-task.zh-CN.toml +8 -0
  157. package/templates/.gemini/commands/_project_/block-task.toml +8 -0
  158. package/templates/.gemini/commands/_project_/block-task.zh-CN.toml +8 -0
  159. package/templates/.gemini/commands/_project_/check-task.toml +8 -0
  160. package/templates/.gemini/commands/_project_/check-task.zh-CN.toml +8 -0
  161. package/templates/.gemini/commands/_project_/close-codescan.toml +8 -0
  162. package/templates/.gemini/commands/_project_/close-codescan.zh-CN.toml +8 -0
  163. package/templates/.gemini/commands/_project_/close-dependabot.toml +8 -0
  164. package/templates/.gemini/commands/_project_/close-dependabot.zh-CN.toml +8 -0
  165. package/templates/.gemini/commands/_project_/commit.toml +6 -0
  166. package/templates/.gemini/commands/_project_/commit.zh-CN.toml +6 -0
  167. package/templates/.gemini/commands/_project_/complete-task.toml +8 -0
  168. package/templates/.gemini/commands/_project_/complete-task.zh-CN.toml +8 -0
  169. package/templates/.gemini/commands/_project_/create-pr.toml +8 -0
  170. package/templates/.gemini/commands/_project_/create-pr.zh-CN.toml +8 -0
  171. package/templates/.gemini/commands/_project_/create-release-note.toml +8 -0
  172. package/templates/.gemini/commands/_project_/create-release-note.zh-CN.toml +8 -0
  173. package/templates/.gemini/commands/_project_/create-task.toml +8 -0
  174. package/templates/.gemini/commands/_project_/create-task.zh-CN.toml +8 -0
  175. package/templates/.gemini/commands/_project_/implement-task.toml +8 -0
  176. package/templates/.gemini/commands/_project_/implement-task.zh-CN.toml +8 -0
  177. package/templates/.gemini/commands/_project_/import-codescan.toml +8 -0
  178. package/templates/.gemini/commands/_project_/import-codescan.zh-CN.toml +8 -0
  179. package/templates/.gemini/commands/_project_/import-dependabot.toml +8 -0
  180. package/templates/.gemini/commands/_project_/import-dependabot.zh-CN.toml +8 -0
  181. package/templates/.gemini/commands/_project_/import-issue.toml +8 -0
  182. package/templates/.gemini/commands/_project_/import-issue.zh-CN.toml +8 -0
  183. package/templates/.gemini/commands/_project_/init-labels.toml +8 -0
  184. package/templates/.gemini/commands/_project_/init-labels.zh-CN.toml +8 -0
  185. package/templates/.gemini/commands/_project_/init-milestones.toml +10 -0
  186. package/templates/.gemini/commands/_project_/init-milestones.zh-CN.toml +10 -0
  187. package/templates/.gemini/commands/_project_/plan-task.toml +8 -0
  188. package/templates/.gemini/commands/_project_/plan-task.zh-CN.toml +8 -0
  189. package/templates/.gemini/commands/_project_/refine-task.toml +8 -0
  190. package/templates/.gemini/commands/_project_/refine-task.zh-CN.toml +8 -0
  191. package/templates/.gemini/commands/_project_/refine-title.toml +8 -0
  192. package/templates/.gemini/commands/_project_/refine-title.zh-CN.toml +8 -0
  193. package/templates/.gemini/commands/_project_/release.toml +8 -0
  194. package/templates/.gemini/commands/_project_/release.zh-CN.toml +8 -0
  195. package/templates/.gemini/commands/_project_/review-task.toml +8 -0
  196. package/templates/.gemini/commands/_project_/review-task.zh-CN.toml +8 -0
  197. package/templates/.gemini/commands/_project_/sync-issue.toml +8 -0
  198. package/templates/.gemini/commands/_project_/sync-issue.zh-CN.toml +8 -0
  199. package/templates/.gemini/commands/_project_/sync-pr.toml +8 -0
  200. package/templates/.gemini/commands/_project_/sync-pr.zh-CN.toml +8 -0
  201. package/templates/.gemini/commands/_project_/test-integration.toml +6 -0
  202. package/templates/.gemini/commands/_project_/test-integration.zh-CN.toml +6 -0
  203. package/templates/.gemini/commands/_project_/test.toml +6 -0
  204. package/templates/.gemini/commands/_project_/test.zh-CN.toml +6 -0
  205. package/templates/.gemini/commands/_project_/update-agent-infra.toml +6 -0
  206. package/templates/.gemini/commands/_project_/update-agent-infra.zh-CN.toml +6 -0
  207. package/templates/.gemini/commands/_project_/upgrade-dependency.toml +8 -0
  208. package/templates/.gemini/commands/_project_/upgrade-dependency.zh-CN.toml +8 -0
  209. package/templates/.gemini/settings.json +3 -0
  210. package/templates/.github/ISSUE_TEMPLATE/01_bug_report.yml +149 -0
  211. package/templates/.github/ISSUE_TEMPLATE/02_question.yml +101 -0
  212. package/templates/.github/ISSUE_TEMPLATE/03_feature_request.yml +131 -0
  213. package/templates/.github/ISSUE_TEMPLATE/04_documentation.yml +165 -0
  214. package/templates/.github/ISSUE_TEMPLATE/05_other.yml +147 -0
  215. package/templates/.github/ISSUE_TEMPLATE/config.yml +11 -0
  216. package/templates/.github/PULL_REQUEST_TEMPLATE.md +123 -0
  217. package/templates/.github/dependabot.yml +17 -0
  218. package/templates/.github/hooks/check-utf8-encoding.sh +25 -0
  219. package/templates/.github/release.yml +27 -0
  220. package/templates/.github/workflows/pr-title-check.yml +42 -0
  221. package/templates/.mailmap +4 -0
  222. package/templates/.opencode/COMMAND_STYLE_GUIDE.md +232 -0
  223. package/templates/.opencode/COMMAND_STYLE_GUIDE.zh-CN.md +232 -0
  224. package/templates/.opencode/README.md +76 -0
  225. package/templates/.opencode/README.zh-CN.md +77 -0
  226. package/templates/.opencode/commands/analyze-task.md +11 -0
  227. package/templates/.opencode/commands/analyze-task.zh-CN.md +11 -0
  228. package/templates/.opencode/commands/block-task.md +11 -0
  229. package/templates/.opencode/commands/block-task.zh-CN.md +11 -0
  230. package/templates/.opencode/commands/check-task.md +11 -0
  231. package/templates/.opencode/commands/check-task.zh-CN.md +11 -0
  232. package/templates/.opencode/commands/close-codescan.md +11 -0
  233. package/templates/.opencode/commands/close-codescan.zh-CN.md +11 -0
  234. package/templates/.opencode/commands/close-dependabot.md +11 -0
  235. package/templates/.opencode/commands/close-dependabot.zh-CN.md +11 -0
  236. package/templates/.opencode/commands/commit.md +9 -0
  237. package/templates/.opencode/commands/commit.zh-CN.md +9 -0
  238. package/templates/.opencode/commands/complete-task.md +11 -0
  239. package/templates/.opencode/commands/complete-task.zh-CN.md +11 -0
  240. package/templates/.opencode/commands/create-pr.md +11 -0
  241. package/templates/.opencode/commands/create-pr.zh-CN.md +11 -0
  242. package/templates/.opencode/commands/create-release-note.md +11 -0
  243. package/templates/.opencode/commands/create-release-note.zh-CN.md +11 -0
  244. package/templates/.opencode/commands/create-task.md +11 -0
  245. package/templates/.opencode/commands/create-task.zh-CN.md +11 -0
  246. package/templates/.opencode/commands/implement-task.md +11 -0
  247. package/templates/.opencode/commands/implement-task.zh-CN.md +11 -0
  248. package/templates/.opencode/commands/import-codescan.md +11 -0
  249. package/templates/.opencode/commands/import-codescan.zh-CN.md +11 -0
  250. package/templates/.opencode/commands/import-dependabot.md +11 -0
  251. package/templates/.opencode/commands/import-dependabot.zh-CN.md +11 -0
  252. package/templates/.opencode/commands/import-issue.md +11 -0
  253. package/templates/.opencode/commands/import-issue.zh-CN.md +11 -0
  254. package/templates/.opencode/commands/init-labels.md +9 -0
  255. package/templates/.opencode/commands/init-labels.zh-CN.md +9 -0
  256. package/templates/.opencode/commands/init-milestones.md +11 -0
  257. package/templates/.opencode/commands/init-milestones.zh-CN.md +11 -0
  258. package/templates/.opencode/commands/plan-task.md +11 -0
  259. package/templates/.opencode/commands/plan-task.zh-CN.md +11 -0
  260. package/templates/.opencode/commands/refine-task.md +11 -0
  261. package/templates/.opencode/commands/refine-task.zh-CN.md +11 -0
  262. package/templates/.opencode/commands/refine-title.md +11 -0
  263. package/templates/.opencode/commands/refine-title.zh-CN.md +11 -0
  264. package/templates/.opencode/commands/release.md +11 -0
  265. package/templates/.opencode/commands/release.zh-CN.md +11 -0
  266. package/templates/.opencode/commands/review-task.md +11 -0
  267. package/templates/.opencode/commands/review-task.zh-CN.md +11 -0
  268. package/templates/.opencode/commands/sync-issue.md +11 -0
  269. package/templates/.opencode/commands/sync-issue.zh-CN.md +11 -0
  270. package/templates/.opencode/commands/sync-pr.md +11 -0
  271. package/templates/.opencode/commands/sync-pr.zh-CN.md +11 -0
  272. package/templates/.opencode/commands/test-integration.md +9 -0
  273. package/templates/.opencode/commands/test-integration.zh-CN.md +9 -0
  274. package/templates/.opencode/commands/test.md +9 -0
  275. package/templates/.opencode/commands/test.zh-CN.md +9 -0
  276. package/templates/.opencode/commands/update-agent-infra.md +9 -0
  277. package/templates/.opencode/commands/update-agent-infra.zh-CN.md +9 -0
  278. package/templates/.opencode/commands/upgrade-dependency.md +11 -0
  279. package/templates/.opencode/commands/upgrade-dependency.zh-CN.md +11 -0
  280. package/templates/AGENTS.md +91 -0
  281. package/templates/AGENTS.zh-CN.md +91 -0
  282. package/templates/CONTRIBUTING.md +126 -0
  283. package/templates/CONTRIBUTING.zh-CN.md +124 -0
  284. package/templates/SECURITY.md +131 -0
  285. package/templates/SECURITY.zh-CN.md +131 -0
@@ -0,0 +1,169 @@
1
+ #!/bin/sh
2
+
3
+ set -e
4
+
5
+ arguments=""
6
+ if [ "$#" -gt 0 ]; then
7
+ arguments="$*"
8
+ fi
9
+
10
+ if ! command -v gh >/dev/null 2>&1; then
11
+ echo "GitHub CLI (\`gh\`) is not installed"
12
+ exit 1
13
+ fi
14
+
15
+ if ! gh auth token >/dev/null 2>&1; then
16
+ echo "GitHub CLI is not authenticated"
17
+ exit 1
18
+ fi
19
+
20
+ if ! gh repo view --json nameWithOwner >/dev/null 2>&1; then
21
+ echo "Unable to access the current repository with gh"
22
+ exit 1
23
+ fi
24
+
25
+ tmpdir="$(mktemp -d)"
26
+ trap 'rm -rf "$tmpdir"' EXIT HUP INT TERM
27
+
28
+ history_mode="false"
29
+
30
+ case " $arguments " in
31
+ *" --history "*) history_mode="true" ;;
32
+ esac
33
+
34
+ echo "History mode: $history_mode"
35
+
36
+ current_version=""
37
+ latest_tag="$(git tag --list 'v*' --sort=-v:refname | head -1)"
38
+
39
+ if [ -n "$latest_tag" ]; then
40
+ current_version="${latest_tag#v}"
41
+ elif [ -f package.json ]; then
42
+ current_version="$(node -p "const version = require('./package.json').version || ''; version.replace(/^v/, '').replace(/-.*/, '')")"
43
+ fi
44
+
45
+ if [ -z "$current_version" ]; then
46
+ current_version="0.1.0"
47
+ fi
48
+
49
+ major="${current_version%%.*}"
50
+ rest="${current_version#*.}"
51
+ minor="${rest%%.*}"
52
+ patch="${rest#*.}"
53
+ patch="${patch%%[^0-9]*}"
54
+
55
+ if ! printf '%s %s %s\n' "$major" "$minor" "$patch" | grep -Eq '^[0-9]+ [0-9]+ [0-9]+$'; then
56
+ echo "Unable to determine current version baseline"
57
+ exit 1
58
+ fi
59
+
60
+ line_milestone="$major.$minor.x"
61
+ next_version="$major.$minor.$((patch + 1))"
62
+
63
+ echo "Detected version baseline: $current_version"
64
+ echo "Line milestone: $line_milestone"
65
+ echo "Next version milestone: $next_version"
66
+
67
+ repo="$(gh repo view --json nameWithOwner --jq '.nameWithOwner')"
68
+
69
+ gh api "repos/$repo/milestones?state=all" --paginate \
70
+ --jq '.[] | [.title, .state] | @tsv' > "$tmpdir/existing.tsv"
71
+
72
+ cut -f1 "$tmpdir/existing.tsv" > "$tmpdir/existing-titles.txt"
73
+ echo "Existing milestones:"
74
+ cat "$tmpdir/existing.tsv"
75
+
76
+ cat <<EOF > "$tmpdir/desired.tsv"
77
+ General Backlog All unsorted backlogged tasks may be completed in a future version. open
78
+ $line_milestone Issues that we want to resolve in $major.$minor line. open
79
+ $next_version Issues that we want to release in v$next_version. open
80
+ EOF
81
+
82
+ if [ "$history_mode" = "true" ]; then
83
+ git tag --list 'v*' --sort=v:refname > "$tmpdir/history-tags.txt"
84
+
85
+ if [ ! -s "$tmpdir/history-tags.txt" ]; then
86
+ echo "No history tags found matching v*; only standard milestones will be created."
87
+ else
88
+ while IFS= read -r tag; do
89
+ [ -n "$tag" ] || continue
90
+
91
+ ver="${tag#v}"
92
+ h_major="${ver%%.*}"
93
+ h_rest="${ver#*.}"
94
+ h_minor="${h_rest%%.*}"
95
+ h_patch="${h_rest#*.}"
96
+ h_patch="${h_patch%%[^0-9]*}"
97
+
98
+ if ! printf '%s %s %s\n' "$h_major" "$h_minor" "$h_patch" | grep -Eq '^[0-9]+ [0-9]+ [0-9]+$'; then
99
+ echo "Skip non-semver tag: $tag"
100
+ continue
101
+ fi
102
+
103
+ printf '%s\t%s\t%s\n' \
104
+ "$h_major.$h_minor.x" \
105
+ "Issues that we want to resolve in $h_major.$h_minor line." \
106
+ "open" >> "$tmpdir/desired.tsv"
107
+
108
+ printf '%s\t%s\t%s\n' \
109
+ "$h_major.$h_minor.$h_patch" \
110
+ "Issues that we want to release in v$h_major.$h_minor.$h_patch." \
111
+ "closed" >> "$tmpdir/desired.tsv"
112
+ done < "$tmpdir/history-tags.txt"
113
+ fi
114
+ fi
115
+
116
+ : > "$tmpdir/created.txt"
117
+ : > "$tmpdir/skipped.txt"
118
+
119
+ while IFS="$(printf '\t')" read -r title description state; do
120
+ [ -n "$title" ] || continue
121
+ state="${state:-open}"
122
+
123
+ if grep -Fqx "$title" "$tmpdir/existing-titles.txt"; then
124
+ printf '%s\n' "$title" >> "$tmpdir/skipped.txt"
125
+ echo "Skip existing milestone: $title"
126
+ continue
127
+ fi
128
+
129
+ gh api "repos/$repo/milestones" \
130
+ -f title="$title" \
131
+ -f description="$description" \
132
+ -f state="$state" >/dev/null
133
+
134
+ printf '%s\n' "$title" >> "$tmpdir/created.txt"
135
+ printf '%s\n' "$title" >> "$tmpdir/existing-titles.txt"
136
+ echo "Created milestone: $title ($state)"
137
+ done < "$tmpdir/desired.tsv"
138
+
139
+ created_count="$(wc -l < "$tmpdir/created.txt" | tr -d ' ')"
140
+ skipped_count="$(wc -l < "$tmpdir/skipped.txt" | tr -d ' ')"
141
+
142
+ echo "GitHub Milestones initialized."
143
+ echo
144
+ echo "Summary:"
145
+ echo "- Version baseline: $current_version"
146
+ echo "- History mode: $history_mode"
147
+ echo "- Created milestones: $created_count"
148
+ echo "- Skipped existing milestones: $skipped_count"
149
+
150
+ if [ -s "$tmpdir/created.txt" ]; then
151
+ echo "- Newly created:"
152
+ sed 's/^/ - /' "$tmpdir/created.txt"
153
+ fi
154
+
155
+ if [ -s "$tmpdir/skipped.txt" ]; then
156
+ echo "- Already present:"
157
+ sed 's/^/ - /' "$tmpdir/skipped.txt"
158
+ fi
159
+
160
+ echo
161
+ echo "Notes:"
162
+ echo "- Milestone titles are treated as the idempotency key."
163
+ echo "- General Backlog is the fallback milestone for unsorted work."
164
+ echo "- Without --history, version milestones are created only for the next patch release."
165
+
166
+ if [ "$history_mode" = "true" ]; then
167
+ echo "- Historical X.Y.Z tags create X.Y.x milestones as open and X.Y.Z milestones as closed."
168
+ echo "- Repositories with many tags may hit the GitHub API rate limit."
169
+ fi
@@ -0,0 +1,225 @@
1
+ ---
2
+ name: plan-task
3
+ description: >
4
+ 为任务设计技术方案并输出详细的实施计划。当用户要求为已完成需求分析的任务设计方案或技术计划时触发。
5
+ 这是一个强制性的人工审查检查点。参数:task-id。
6
+ ---
7
+
8
+ # 设计技术方案
9
+
10
+ ## 行为边界 / 关键规则
11
+
12
+ - 本技能仅产出技术方案文档(`plan.md` 或 `plan-r{N}.md`)—— 不修改任何业务代码
13
+ - 这是一个**强制性的人工审查检查点** —— 不要自动进入实现阶段
14
+ - 执行本技能后,你**必须**立即更新 task.md 中的任务状态
15
+
16
+ ## 执行步骤
17
+
18
+ ### 1. 验证前置条件
19
+
20
+ 检查必要文件:
21
+ - `.agent-workspace/active/{task-id}/task.md` - 任务文件
22
+ - 至少一个分析产物:`analysis.md` 或 `analysis-r{N}.md`
23
+
24
+ 注意:`{task-id}` 格式为 `TASK-{yyyyMMdd-HHmmss}`,例如 `TASK-20260306-143022`
25
+
26
+ 如果任一文件缺失,提示用户先完成前置步骤。
27
+
28
+ ### 2. 确定方案轮次
29
+
30
+ 扫描 `.agent-workspace/active/{task-id}/` 目录中的方案产物文件:
31
+ - 如果不存在 `plan.md` 且不存在 `plan-r*.md` → 本轮为第 1 轮,产出 `plan.md`
32
+ - 如果存在 `plan.md` 且不存在 `plan-r*.md` → 本轮为第 2 轮,产出 `plan-r2.md`
33
+ - 如果存在 `plan-r{N}.md` → 本轮为第 N+1 轮,产出 `plan-r{N+1}.md`
34
+
35
+ 记录:
36
+ - `{plan-round}`:本轮方案轮次
37
+ - `{plan-artifact}`:本轮方案产物文件名
38
+
39
+ ### 3. 阅读需求分析
40
+
41
+ 扫描任务目录中的分析产物文件(`analysis.md`、`analysis-r{N}.md`):
42
+ - 如果存在 `analysis-r{N}.md`,读取最高 N 的文件
43
+ - 否则读取 `analysis.md`
44
+ 以理解:
45
+ - 需求及其背景
46
+ - 相关文件和代码结构
47
+ - 影响范围和依赖关系
48
+ - 已识别的技术风险
49
+ - 工作量和复杂度评估
50
+
51
+ ### 4. 理解问题
52
+
53
+ - 阅读分析中识别的相关源码文件
54
+ - 理解当前架构和模式
55
+ - 识别约束条件(向后兼容性、性能等)
56
+ - 考虑边界情况和错误场景
57
+
58
+ ### 5. 设计技术方案
59
+
60
+ 遵循 `.agents/workflows/feature-development.yaml` 中的 `technical-design` 步骤:
61
+
62
+ **必要任务**:
63
+ - [ ] 定义技术方法和理由
64
+ - [ ] 考虑备选方案并说明权衡
65
+ - [ ] 按顺序详细列出实施步骤
66
+ - [ ] 列出所有需要创建/修改的文件
67
+ - [ ] 定义验证策略(测试、手动检查)
68
+ - [ ] 评估方案的影响和风险
69
+
70
+ **设计原则**:
71
+ 1. **简洁性**:优先选择满足需求的最简方案
72
+ 2. **一致性**:遵循现有代码模式和规范
73
+ 3. **可测试性**:设计易于测试的方案
74
+ 4. **可逆性**:优先选择易于回退的变更
75
+
76
+ ### 6. 输出计划文档
77
+
78
+ 创建 `.agent-workspace/active/{task-id}/{plan-artifact}`。
79
+
80
+ ### 7. 更新任务状态
81
+
82
+ 获取当前时间:
83
+
84
+ ```bash
85
+ date "+%Y-%m-%d %H:%M:%S"
86
+ ```
87
+
88
+ 更新 `.agent-workspace/active/{task-id}/task.md`:
89
+ - `current_step`:technical-design
90
+ - `assigned_to`:{当前 AI 代理}
91
+ - `updated_at`:{当前时间}
92
+ - 记录本轮方案产物:`{plan-artifact}`(Round `{plan-round}`)
93
+ - 如任务模板包含 `## 设计` 段落,更新为指向 `{plan-artifact}` 的链接
94
+ - 在工作流进度中标记 technical-design 为已完成,并注明实际轮次(如果任务模板支持)
95
+ - **追加**到 `## Activity Log`(不要覆盖之前的记录):
96
+ ```
97
+ - {yyyy-MM-dd HH:mm:ss} — **Technical Design (Round {N})** by {agent} — Plan completed, awaiting human review → {artifact-filename}
98
+ ```
99
+
100
+ ### 8. 告知用户
101
+
102
+ > **重要**:以下「下一步」中列出的所有 TUI 命令格式必须完整输出,不要只展示当前 AI 代理对应的格式。
103
+
104
+ 输出格式:
105
+ ```
106
+ 任务 {task-id} 技术方案完成。
107
+
108
+ 方案概要:
109
+ - 轮次:Round {plan-round}
110
+ - 方法:{简要描述}
111
+ - 需修改文件:{数量}
112
+ - 需新建文件:{数量}
113
+ - 预估复杂度:{评估}
114
+
115
+ 产出文件:
116
+ - 技术方案:.agent-workspace/active/{task-id}/{plan-artifact}
117
+
118
+ 重要:人工审查检查点。
119
+ 请在继续实现之前审查技术方案。
120
+
121
+ 下一步 - 实施任务:
122
+ - Claude Code / OpenCode:/implement-task {task-id}
123
+ - Gemini CLI:/agent-infra:implement-task {task-id}
124
+ - Codex CLI:$implement-task {task-id}
125
+ ```
126
+
127
+ ## 输出模板
128
+
129
+ ```markdown
130
+ # 技术方案
131
+
132
+ - **方案轮次**:Round {plan-round}
133
+ - **产物文件**:`{plan-artifact}`
134
+
135
+ ## 问题理解
136
+ {总结需要解决的问题和关键约束}
137
+
138
+ ## 约束条件
139
+ - {约束 1}
140
+ - {约束 2}
141
+
142
+ ## 方案对比
143
+
144
+ ### 方案 A:{名称}
145
+ - **方法**:{描述}
146
+ - **优点**:{优势}
147
+ - **缺点**:{劣势}
148
+
149
+ ### 方案 B:{名称}
150
+ - **方法**:{描述}
151
+ - **优点**:{优势}
152
+ - **缺点**:{劣势}
153
+
154
+ ### 决策
155
+ {选择哪个方案以及原因}
156
+
157
+ ## 技术方法
158
+ {所选方案的详细描述}
159
+
160
+ ## 实施步骤
161
+
162
+ ### 步骤 1:{标题}
163
+ - **文件**:`{file-path}`
164
+ - **操作**:{要做什么}
165
+ - **详情**:{具体细节}
166
+
167
+ ### 步骤 2:{标题}
168
+ ...
169
+
170
+ ## 文件清单
171
+
172
+ ### 新建文件
173
+ - `{file-path}` - {用途}
174
+
175
+ ### 修改文件
176
+ - `{file-path}` - {修改内容}
177
+
178
+ ## 验证策略
179
+
180
+ ### 单元测试
181
+ - {测试用例 1}
182
+ - {测试用例 2}
183
+
184
+ ### 手动验证
185
+ - {验证步骤}
186
+
187
+ ## 影响评估
188
+ - 破坏性变更:{是/否 - 详情}
189
+ - 性能影响:{评估}
190
+ - 安全考量:{评估}
191
+
192
+ ## 风险控制
193
+ - {风险 1}:{缓解措施}
194
+ - {风险 2}:{缓解措施}
195
+ ```
196
+
197
+ ## 完成检查清单
198
+
199
+ - [ ] 阅读并理解了需求分析
200
+ - [ ] 考虑了备选方案
201
+ - [ ] 创建了计划文档 `.agent-workspace/active/{task-id}/{plan-artifact}`
202
+ - [ ] 更新了 task.md 中的 `current_step` 为 technical-design
203
+ - [ ] 更新了 task.md 中的 `updated_at` 为当前时间
204
+ - [ ] 在 task.md 中记录了 `{plan-artifact}` 为已完成产物
205
+ - [ ] 在工作流进度中标记了 technical-design 为已完成
206
+ - [ ] 追加了 Activity Log 条目到 task.md
207
+ - [ ] 告知了用户这是人工审查检查点
208
+ - [ ] 告知了用户下一步(必须展示所有 TUI 的命令格式,不要筛选)
209
+
210
+ ## 停止
211
+
212
+ 完成检查清单后,**立即停止**。
213
+ 这是一个**强制性的人工审查检查点** —— 用户必须审查并批准计划后才能继续实现。
214
+
215
+ ## 注意事项
216
+
217
+ 1. **前置条件**:必须已完成至少一轮需求分析(`analysis.md` 或 `analysis-r{N}.md` 存在)
218
+ 2. **人工审查**:这是强制性检查点 —— 不要自动进入实现阶段
219
+ 3. **计划质量**:计划应足够具体,使另一个 AI 代理无需额外上下文即可实现
220
+ 4. **版本化规则**:首轮方案使用 `plan.md`;后续修订使用 `plan-r{N}.md`
221
+
222
+ ## 错误处理
223
+
224
+ - 任务未找到:提示 "Task {task-id} not found, please check the task ID"
225
+ - 缺少分析:提示 "Analysis not found, please run the analyze-task skill first"
@@ -0,0 +1,225 @@
1
+ ---
2
+ name: plan-task
3
+ description: >
4
+ 为任务设计技术方案并输出详细的实施计划。当用户要求为已完成需求分析的任务设计方案或技术计划时触发。
5
+ 这是一个强制性的人工审查检查点。参数:task-id。
6
+ ---
7
+
8
+ # 设计技术方案
9
+
10
+ ## 行为边界 / 关键规则
11
+
12
+ - 本技能仅产出技术方案文档(`plan.md` 或 `plan-r{N}.md`)—— 不修改任何业务代码
13
+ - 这是一个**强制性的人工审查检查点** —— 不要自动进入实现阶段
14
+ - 执行本技能后,你**必须**立即更新 task.md 中的任务状态
15
+
16
+ ## 执行步骤
17
+
18
+ ### 1. 验证前置条件
19
+
20
+ 检查必要文件:
21
+ - `.agent-workspace/active/{task-id}/task.md` - 任务文件
22
+ - 至少一个分析产物:`analysis.md` 或 `analysis-r{N}.md`
23
+
24
+ 注意:`{task-id}` 格式为 `TASK-{yyyyMMdd-HHmmss}`,例如 `TASK-20260306-143022`
25
+
26
+ 如果任一文件缺失,提示用户先完成前置步骤。
27
+
28
+ ### 2. 确定方案轮次
29
+
30
+ 扫描 `.agent-workspace/active/{task-id}/` 目录中的方案产物文件:
31
+ - 如果不存在 `plan.md` 且不存在 `plan-r*.md` → 本轮为第 1 轮,产出 `plan.md`
32
+ - 如果存在 `plan.md` 且不存在 `plan-r*.md` → 本轮为第 2 轮,产出 `plan-r2.md`
33
+ - 如果存在 `plan-r{N}.md` → 本轮为第 N+1 轮,产出 `plan-r{N+1}.md`
34
+
35
+ 记录:
36
+ - `{plan-round}`:本轮方案轮次
37
+ - `{plan-artifact}`:本轮方案产物文件名
38
+
39
+ ### 3. 阅读需求分析
40
+
41
+ 扫描任务目录中的分析产物文件(`analysis.md`、`analysis-r{N}.md`):
42
+ - 如果存在 `analysis-r{N}.md`,读取最高 N 的文件
43
+ - 否则读取 `analysis.md`
44
+ 以理解:
45
+ - 需求及其背景
46
+ - 相关文件和代码结构
47
+ - 影响范围和依赖关系
48
+ - 已识别的技术风险
49
+ - 工作量和复杂度评估
50
+
51
+ ### 4. 理解问题
52
+
53
+ - 阅读分析中识别的相关源码文件
54
+ - 理解当前架构和模式
55
+ - 识别约束条件(向后兼容性、性能等)
56
+ - 考虑边界情况和错误场景
57
+
58
+ ### 5. 设计技术方案
59
+
60
+ 遵循 `.agents/workflows/feature-development.yaml` 中的 `technical-design` 步骤:
61
+
62
+ **必要任务**:
63
+ - [ ] 定义技术方法和理由
64
+ - [ ] 考虑备选方案并说明权衡
65
+ - [ ] 按顺序详细列出实施步骤
66
+ - [ ] 列出所有需要创建/修改的文件
67
+ - [ ] 定义验证策略(测试、手动检查)
68
+ - [ ] 评估方案的影响和风险
69
+
70
+ **设计原则**:
71
+ 1. **简洁性**:优先选择满足需求的最简方案
72
+ 2. **一致性**:遵循现有代码模式和规范
73
+ 3. **可测试性**:设计易于测试的方案
74
+ 4. **可逆性**:优先选择易于回退的变更
75
+
76
+ ### 6. 输出计划文档
77
+
78
+ 创建 `.agent-workspace/active/{task-id}/{plan-artifact}`。
79
+
80
+ ### 7. 更新任务状态
81
+
82
+ 获取当前时间:
83
+
84
+ ```bash
85
+ date "+%Y-%m-%d %H:%M:%S"
86
+ ```
87
+
88
+ 更新 `.agent-workspace/active/{task-id}/task.md`:
89
+ - `current_step`:technical-design
90
+ - `assigned_to`:{当前 AI 代理}
91
+ - `updated_at`:{当前时间}
92
+ - 记录本轮方案产物:`{plan-artifact}`(Round `{plan-round}`)
93
+ - 如任务模板包含 `## 设计` 段落,更新为指向 `{plan-artifact}` 的链接
94
+ - 在工作流进度中标记 technical-design 为已完成,并注明实际轮次(如果任务模板支持)
95
+ - **追加**到 `## Activity Log`(不要覆盖之前的记录):
96
+ ```
97
+ - {yyyy-MM-dd HH:mm:ss} — **Technical Design (Round {N})** by {agent} — Plan completed, awaiting human review → {artifact-filename}
98
+ ```
99
+
100
+ ### 8. 告知用户
101
+
102
+ > **重要**:以下「下一步」中列出的所有 TUI 命令格式必须完整输出,不要只展示当前 AI 代理对应的格式。
103
+
104
+ 输出格式:
105
+ ```
106
+ 任务 {task-id} 技术方案完成。
107
+
108
+ 方案概要:
109
+ - 轮次:Round {plan-round}
110
+ - 方法:{简要描述}
111
+ - 需修改文件:{数量}
112
+ - 需新建文件:{数量}
113
+ - 预估复杂度:{评估}
114
+
115
+ 产出文件:
116
+ - 技术方案:.agent-workspace/active/{task-id}/{plan-artifact}
117
+
118
+ 重要:人工审查检查点。
119
+ 请在继续实现之前审查技术方案。
120
+
121
+ 下一步 - 实施任务:
122
+ - Claude Code / OpenCode:/implement-task {task-id}
123
+ - Gemini CLI:/agent-infra:implement-task {task-id}
124
+ - Codex CLI:$implement-task {task-id}
125
+ ```
126
+
127
+ ## 输出模板
128
+
129
+ ```markdown
130
+ # 技术方案
131
+
132
+ - **方案轮次**:Round {plan-round}
133
+ - **产物文件**:`{plan-artifact}`
134
+
135
+ ## 问题理解
136
+ {总结需要解决的问题和关键约束}
137
+
138
+ ## 约束条件
139
+ - {约束 1}
140
+ - {约束 2}
141
+
142
+ ## 方案对比
143
+
144
+ ### 方案 A:{名称}
145
+ - **方法**:{描述}
146
+ - **优点**:{优势}
147
+ - **缺点**:{劣势}
148
+
149
+ ### 方案 B:{名称}
150
+ - **方法**:{描述}
151
+ - **优点**:{优势}
152
+ - **缺点**:{劣势}
153
+
154
+ ### 决策
155
+ {选择哪个方案以及原因}
156
+
157
+ ## 技术方法
158
+ {所选方案的详细描述}
159
+
160
+ ## 实施步骤
161
+
162
+ ### 步骤 1:{标题}
163
+ - **文件**:`{file-path}`
164
+ - **操作**:{要做什么}
165
+ - **详情**:{具体细节}
166
+
167
+ ### 步骤 2:{标题}
168
+ ...
169
+
170
+ ## 文件清单
171
+
172
+ ### 新建文件
173
+ - `{file-path}` - {用途}
174
+
175
+ ### 修改文件
176
+ - `{file-path}` - {修改内容}
177
+
178
+ ## 验证策略
179
+
180
+ ### 单元测试
181
+ - {测试用例 1}
182
+ - {测试用例 2}
183
+
184
+ ### 手动验证
185
+ - {验证步骤}
186
+
187
+ ## 影响评估
188
+ - 破坏性变更:{是/否 - 详情}
189
+ - 性能影响:{评估}
190
+ - 安全考量:{评估}
191
+
192
+ ## 风险控制
193
+ - {风险 1}:{缓解措施}
194
+ - {风险 2}:{缓解措施}
195
+ ```
196
+
197
+ ## 完成检查清单
198
+
199
+ - [ ] 阅读并理解了需求分析
200
+ - [ ] 考虑了备选方案
201
+ - [ ] 创建了计划文档 `.agent-workspace/active/{task-id}/{plan-artifact}`
202
+ - [ ] 更新了 task.md 中的 `current_step` 为 technical-design
203
+ - [ ] 更新了 task.md 中的 `updated_at` 为当前时间
204
+ - [ ] 在 task.md 中记录了 `{plan-artifact}` 为已完成产物
205
+ - [ ] 在工作流进度中标记了 technical-design 为已完成
206
+ - [ ] 追加了 Activity Log 条目到 task.md
207
+ - [ ] 告知了用户这是人工审查检查点
208
+ - [ ] 告知了用户下一步(必须展示所有 TUI 的命令格式,不要筛选)
209
+
210
+ ## 停止
211
+
212
+ 完成检查清单后,**立即停止**。
213
+ 这是一个**强制性的人工审查检查点** —— 用户必须审查并批准计划后才能继续实现。
214
+
215
+ ## 注意事项
216
+
217
+ 1. **前置条件**:必须已完成至少一轮需求分析(`analysis.md` 或 `analysis-r{N}.md` 存在)
218
+ 2. **人工审查**:这是强制性检查点 —— 不要自动进入实现阶段
219
+ 3. **计划质量**:计划应足够具体,使另一个 AI 代理无需额外上下文即可实现
220
+ 4. **版本化规则**:首轮方案使用 `plan.md`;后续修订使用 `plan-r{N}.md`
221
+
222
+ ## 错误处理
223
+
224
+ - 任务未找到:提示 "Task {task-id} not found, please check the task ID"
225
+ - 缺少分析:提示 "Analysis not found, please run the analyze-task skill first"