@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,42 @@
1
+ name: PR Title Check
2
+
3
+ on:
4
+ pull_request_target:
5
+ types: [opened, edited, synchronize]
6
+
7
+ permissions:
8
+ pull-requests: write
9
+ statuses: write
10
+
11
+ jobs:
12
+ validate:
13
+ runs-on: ubuntu-latest
14
+ steps:
15
+ - uses: amannn/action-semantic-pull-request@v6.1.1
16
+ with:
17
+ # 允许的提交类型
18
+ types: |
19
+ feat
20
+ fix
21
+ docs
22
+ style
23
+ refactor
24
+ perf
25
+ test
26
+ chore
27
+ build
28
+ ci
29
+ revert
30
+
31
+ # 不限制 scope,允许任意模块名
32
+ # requireScope: false - scope 是可选的
33
+
34
+ # 标题描述长度 5-100 字符
35
+ subjectPattern: '^.{5,100}$'
36
+ subjectPatternError: '标题描述长度应在 5-100 字符之间'
37
+
38
+ # 支持 WIP 前缀标记进行中的工作
39
+ wip: true
40
+
41
+ env:
42
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -0,0 +1,4 @@
1
+ Claude <noreply@anthropic.com>
2
+ Codex <noreply@openai.com>
3
+ Gemini <noreply@google.com>
4
+ OpenCode <noreply@opencode.ai>
@@ -0,0 +1,232 @@
1
+ # Command Style Guide
2
+
3
+ This guide defines conventions for writing OpenCode command files in the `.opencode/commands/` directory.
4
+
5
+ ## File Format
6
+
7
+ Every command file uses Markdown with YAML frontmatter:
8
+
9
+ ```markdown
10
+ ---
11
+ description: Brief one-line description
12
+ agent: general
13
+ subtask: false
14
+ ---
15
+
16
+ Command instructions here.
17
+ ```
18
+
19
+ ### Frontmatter Fields
20
+
21
+ | Field | Required | Description |
22
+ |-------|----------|-------------|
23
+ | `description` | Yes | One-line summary (under 80 chars) |
24
+ | `agent` | Yes | Always `general` unless specialized |
25
+ | `subtask` | Yes | `false` for top-level commands |
26
+
27
+ ## Executable Commands vs Code Blocks
28
+
29
+ ### Use `!` prefix for commands that MUST be executed
30
+
31
+ ```markdown
32
+ !date -u +"%Y-%m-%dT%H:%M:%SZ"
33
+ !git status --short
34
+ !gh issue view 123 --json number,title,body
35
+ ```
36
+
37
+ The `!` prefix tells OpenCode to run the command directly. Use this for:
38
+ - Getting dynamic information (timestamps, git status)
39
+ - Performing actions (creating files, calling APIs)
40
+ - Running build/test commands
41
+
42
+ ### Use markdown code blocks for illustrative examples
43
+
44
+ ````markdown
45
+ Example output format:
46
+ ```
47
+ Task ID: TASK-20260101-120000
48
+ Status: active
49
+ ```
50
+ ````
51
+
52
+ Code blocks are NOT executed. Use them for:
53
+ - Showing expected output formats
54
+ - Documenting templates
55
+ - Illustrating patterns the AI should follow
56
+
57
+ ## Parameter Handling
58
+
59
+ ### Positional parameters
60
+
61
+ Reference with `$ARGUMENTS`:
62
+
63
+ ```markdown
64
+ Parse the task ID from `$ARGUMENTS`.
65
+ ```
66
+
67
+ ### Validation
68
+
69
+ Always validate required parameters early:
70
+
71
+ ```markdown
72
+ If `$ARGUMENTS` is empty, respond:
73
+ "Please provide a task ID. Example: /check-task TASK-20260101-120000"
74
+ Then STOP.
75
+ ```
76
+
77
+ ## Timestamp Handling
78
+
79
+ **NEVER** hardcode dates or years.
80
+
81
+ Correct:
82
+ ```markdown
83
+ !date -u +"%Y-%m-%dT%H:%M:%SZ"
84
+ ```
85
+
86
+ Wrong:
87
+ ```markdown
88
+ Set the date to 2026-03-06.
89
+ ```
90
+
91
+ ## GitHub API Paths
92
+
93
+ **ALWAYS** use `{owner}/{repo}` placeholders. Resolve dynamically:
94
+
95
+ ```markdown
96
+ !gh api repos/{owner}/{repo}/dependabot/alerts/$ARGUMENTS
97
+ ```
98
+
99
+ To get owner/repo:
100
+ ```markdown
101
+ !gh repo view --json owner,name -q '.owner.login + "/" + .name'
102
+ ```
103
+
104
+ ## Step Numbering and Readability
105
+
106
+ ### Use numbered steps for sequential operations
107
+
108
+ ```markdown
109
+ ## Steps
110
+
111
+ 1. **Validate input** - Check that the task ID is provided.
112
+
113
+ 2. **Read task file** - Find and read the task.md file.
114
+
115
+ 3. **Update status** - Modify the task metadata.
116
+ ```
117
+
118
+ ### Use bold for step titles
119
+
120
+ Each step should have a clear bold title followed by a description.
121
+
122
+ ### Keep steps atomic
123
+
124
+ Each step should do one thing. If a step is too complex, break it into sub-steps.
125
+
126
+ ## Error Handling Patterns
127
+
128
+ ### Check prerequisites before acting
129
+
130
+ ```markdown
131
+ 1. **Verify task exists**
132
+
133
+ Search for the task file:
134
+ - `.agent-workspace/active/{task-id}/task.md`
135
+ - `.agent-workspace/blocked/{task-id}/task.md`
136
+ - `.agent-workspace/completed/{task-id}/task.md`
137
+
138
+ If not found, respond:
139
+ "Task {task-id} not found. Please check the task ID."
140
+ Then STOP.
141
+ ```
142
+
143
+ ### Report errors clearly
144
+
145
+ ```markdown
146
+ If the command fails, report:
147
+ - What went wrong
148
+ - Possible causes
149
+ - Suggested next steps
150
+
151
+ Do NOT silently continue.
152
+ ```
153
+
154
+ ## Common Patterns
155
+
156
+ ### Task file lookup pattern
157
+
158
+ ```markdown
159
+ Search for the task in this order:
160
+ 1. `.agent-workspace/active/{task-id}/task.md`
161
+ 2. `.agent-workspace/blocked/{task-id}/task.md`
162
+ 3. `.agent-workspace/completed/{task-id}/task.md`
163
+ ```
164
+
165
+ ### Status update pattern
166
+
167
+ ```markdown
168
+ Update `task.md` YAML frontmatter:
169
+ - `current_step`: {step-name}
170
+ - `assigned_to`: opencode
171
+ - `updated_at`: {current timestamp from date command}
172
+ ```
173
+
174
+ ### Next-step suggestion pattern
175
+
176
+ ```markdown
177
+ **Next step:**
178
+ Use `/plan-task {task-id}` to design the technical plan.
179
+ ```
180
+
181
+ ## Anti-Patterns
182
+
183
+ ### DO NOT
184
+
185
+ - Hardcode dates, years, or timestamps
186
+ - Hardcode repository owner/name in API paths
187
+ - Skip parameter validation
188
+ - Auto-commit without user confirmation
189
+ - Use tool-specific syntax (e.g., Claude's Read/Edit/Write tool names)
190
+ - Reference tech-stack-specific commands without TODO markers
191
+ - Include emoji in command files (keep them professional)
192
+ - Write overly long steps -- break them up
193
+
194
+ ### DO
195
+
196
+ - Use `!` for all executable commands
197
+ - Validate parameters before proceeding
198
+ - Provide clear error messages
199
+ - Include "STOP" after error conditions
200
+ - Keep commands concise and scannable
201
+ - Use placeholders for project-specific values
202
+ - Add TODO markers for tech-stack-specific sections
203
+
204
+ ## Tech-Stack Agnostic Commands
205
+
206
+ For commands that depend on the project's tech stack (build tools, test runners, package managers), use TODO markers:
207
+
208
+ ```markdown
209
+ 3. **Run tests**
210
+
211
+ <!-- TODO: Replace with your project's test command -->
212
+ !npm test
213
+ ```
214
+
215
+ This tells users they need to customize the command for their project.
216
+
217
+ ## Command Review Checklist
218
+
219
+ Before submitting a new command, verify:
220
+
221
+ - [ ] Frontmatter has `description`, `agent`, and `subtask`
222
+ - [ ] All executable commands use `!` prefix
223
+ - [ ] All illustrative examples use code blocks (no `!`)
224
+ - [ ] Parameters are validated with clear error messages
225
+ - [ ] Timestamps are generated dynamically
226
+ - [ ] GitHub API paths use `{owner}/{repo}` placeholders
227
+ - [ ] Steps are numbered and have bold titles
228
+ - [ ] Error cases are handled with "STOP" directives
229
+ - [ ] No hardcoded dates, repo names, or tool-specific references
230
+ - [ ] Tech-stack-specific sections have TODO markers
231
+ - [ ] Both EN and ZH-CN versions are created
232
+ - [ ] Command is concise -- no unnecessary prose
@@ -0,0 +1,232 @@
1
+ # 命令编写风格指南
2
+
3
+ 本指南定义了 `.opencode/commands/` 目录中 OpenCode 命令文件的编写规范。
4
+
5
+ ## 文件格式
6
+
7
+ 每个命令文件使用带 YAML 前置元数据的 Markdown 格式:
8
+
9
+ ```markdown
10
+ ---
11
+ description: 简要描述
12
+ agent: general
13
+ subtask: false
14
+ ---
15
+
16
+ 命令指令内容。
17
+ ```
18
+
19
+ ### 前置元数据字段
20
+
21
+ | 字段 | 必需 | 说明 |
22
+ |------|------|------|
23
+ | `description` | 是 | 一行摘要(80 字符以内) |
24
+ | `agent` | 是 | 除非有专门代理,否则为 `general` |
25
+ | `subtask` | 是 | 顶层命令为 `false` |
26
+
27
+ ## 可执行命令 vs 代码块
28
+
29
+ ### 使用 `!` 前缀标记必须执行的命令
30
+
31
+ ```markdown
32
+ !date -u +"%Y-%m-%dT%H:%M:%SZ"
33
+ !git status --short
34
+ !gh issue view 123 --json number,title,body
35
+ ```
36
+
37
+ `!` 前缀告诉 OpenCode 直接运行该命令。适用于:
38
+ - 获取动态信息(时间戳、git 状态)
39
+ - 执行操作(创建文件、调用 API)
40
+ - 运行构建/测试命令
41
+
42
+ ### 使用 markdown 代码块展示说明性示例
43
+
44
+ ````markdown
45
+ 预期输出格式:
46
+ ```
47
+ Task ID: TASK-20260101-120000
48
+ Status: active
49
+ ```
50
+ ````
51
+
52
+ 代码块不会被执行。适用于:
53
+ - 展示预期输出格式
54
+ - 记录模板
55
+ - 说明 AI 应遵循的模式
56
+
57
+ ## 参数处理
58
+
59
+ ### 位置参数
60
+
61
+ 通过 `$ARGUMENTS` 引用:
62
+
63
+ ```markdown
64
+ 从 `$ARGUMENTS` 中解析任务 ID。
65
+ ```
66
+
67
+ ### 验证
68
+
69
+ 始终在早期验证必需参数:
70
+
71
+ ```markdown
72
+ 如果 `$ARGUMENTS` 为空,回复:
73
+ "请提供任务 ID。示例:/check-task TASK-20260101-120000"
74
+ 然后 STOP。
75
+ ```
76
+
77
+ ## 时间戳处理
78
+
79
+ **绝对不要**硬编码日期或年份。
80
+
81
+ 正确做法:
82
+ ```markdown
83
+ !date -u +"%Y-%m-%dT%H:%M:%SZ"
84
+ ```
85
+
86
+ 错误做法:
87
+ ```markdown
88
+ 将日期设为 2026-03-06。
89
+ ```
90
+
91
+ ## GitHub API 路径
92
+
93
+ **始终**使用 `{owner}/{repo}` 占位符。动态解析:
94
+
95
+ ```markdown
96
+ !gh api repos/{owner}/{repo}/dependabot/alerts/$ARGUMENTS
97
+ ```
98
+
99
+ 获取 owner/repo:
100
+ ```markdown
101
+ !gh repo view --json owner,name -q '.owner.login + "/" + .name'
102
+ ```
103
+
104
+ ## 步骤编号和可读性
105
+
106
+ ### 使用编号标记顺序操作
107
+
108
+ ```markdown
109
+ ## 步骤
110
+
111
+ 1. **验证输入** - 检查是否提供了任务 ID。
112
+
113
+ 2. **读取任务文件** - 查找并读取 task.md 文件。
114
+
115
+ 3. **更新状态** - 修改任务元数据。
116
+ ```
117
+
118
+ ### 使用粗体标记步骤标题
119
+
120
+ 每个步骤应有清晰的粗体标题,后跟描述。
121
+
122
+ ### 保持步骤原子化
123
+
124
+ 每个步骤只做一件事。如果步骤太复杂,拆分为子步骤。
125
+
126
+ ## 错误处理模式
127
+
128
+ ### 在操作前检查前置条件
129
+
130
+ ```markdown
131
+ 1. **验证任务存在**
132
+
133
+ 按以下顺序搜索任务文件:
134
+ - `.agent-workspace/active/{task-id}/task.md`
135
+ - `.agent-workspace/blocked/{task-id}/task.md`
136
+ - `.agent-workspace/completed/{task-id}/task.md`
137
+
138
+ 如果未找到,回复:
139
+ "任务 {task-id} 不存在,请检查任务 ID。"
140
+ 然后 STOP。
141
+ ```
142
+
143
+ ### 清晰地报告错误
144
+
145
+ ```markdown
146
+ 如果命令失败,报告:
147
+ - 出了什么问题
148
+ - 可能的原因
149
+ - 建议的后续步骤
150
+
151
+ 不要静默继续。
152
+ ```
153
+
154
+ ## 常见模式
155
+
156
+ ### 任务文件查找模式
157
+
158
+ ```markdown
159
+ 按以下顺序搜索任务:
160
+ 1. `.agent-workspace/active/{task-id}/task.md`
161
+ 2. `.agent-workspace/blocked/{task-id}/task.md`
162
+ 3. `.agent-workspace/completed/{task-id}/task.md`
163
+ ```
164
+
165
+ ### 状态更新模式
166
+
167
+ ```markdown
168
+ 更新 `task.md` YAML 前置元数据:
169
+ - `current_step`: {步骤名}
170
+ - `assigned_to`: opencode
171
+ - `updated_at`: {通过 date 命令获取的当前时间戳}
172
+ ```
173
+
174
+ ### 下一步建议模式
175
+
176
+ ```markdown
177
+ **下一步:**
178
+ 使用 `/plan-task {task-id}` 设计技术方案。
179
+ ```
180
+
181
+ ## 反模式
182
+
183
+ ### 不要
184
+
185
+ - 硬编码日期、年份或时间戳
186
+ - 在 API 路径中硬编码仓库 owner/name
187
+ - 跳过参数验证
188
+ - 未经用户确认就自动提交
189
+ - 使用特定工具语法(如 Claude 的 Read/Edit/Write 工具名)
190
+ - 引用特定技术栈的命令但不加 TODO 标记
191
+ - 在命令文件中使用 emoji(保持专业)
192
+ - 写过长的步骤——应该拆分
193
+
194
+ ### 要
195
+
196
+ - 对所有可执行命令使用 `!` 前缀
197
+ - 在继续之前验证参数
198
+ - 提供清晰的错误消息
199
+ - 在错误条件后包含 "STOP"
200
+ - 保持命令简洁且易于浏览
201
+ - 对项目特定的值使用占位符
202
+ - 对技术栈特定的部分添加 TODO 标记
203
+
204
+ ## 技术栈无关的命令
205
+
206
+ 对于依赖项目技术栈的命令(构建工具、测试运行器、包管理器),使用 TODO 标记:
207
+
208
+ ```markdown
209
+ 3. **运行测试**
210
+
211
+ <!-- TODO: Replace with your project's test command -->
212
+ !npm test
213
+ ```
214
+
215
+ 这告诉用户需要根据自己的项目定制该命令。
216
+
217
+ ## 命令审查清单
218
+
219
+ 提交新命令前,请验证:
220
+
221
+ - [ ] 前置元数据包含 `description`、`agent` 和 `subtask`
222
+ - [ ] 所有可执行命令使用 `!` 前缀
223
+ - [ ] 所有说明性示例使用代码块(无 `!`)
224
+ - [ ] 参数已验证,有清晰的错误消息
225
+ - [ ] 时间戳动态生成
226
+ - [ ] GitHub API 路径使用 `{owner}/{repo}` 占位符
227
+ - [ ] 步骤已编号且有粗体标题
228
+ - [ ] 错误情况使用 "STOP" 指令处理
229
+ - [ ] 无硬编码的日期、仓库名或工具特定引用
230
+ - [ ] 技术栈特定的部分有 TODO 标记
231
+ - [ ] 已创建英文和中文两个版本
232
+ - [ ] 命令简洁——无多余的描述
@@ -0,0 +1,76 @@
1
+ # OpenCode Commands
2
+
3
+ This directory contains command files for [OpenCode](https://opencode.ai), an AI-powered coding assistant.
4
+
5
+ ## Structure
6
+
7
+ ```
8
+ .opencode/
9
+ README.md # This file
10
+ COMMAND_STYLE_GUIDE.md # Guide for writing commands
11
+ commands/
12
+ {command}.md # English command files
13
+ {command}.zh-CN.md # Chinese command files
14
+ ```
15
+
16
+ ## Command Format
17
+
18
+ Each command file uses Markdown with YAML frontmatter:
19
+
20
+ ```markdown
21
+ ---
22
+ description: Brief description of what the command does
23
+ agent: general
24
+ subtask: false
25
+ ---
26
+
27
+ Step-by-step instructions for the AI agent.
28
+ Use `!` prefix for shell commands that should be executed directly.
29
+ Use markdown code blocks for illustrative examples that should NOT be auto-executed.
30
+ ```
31
+
32
+ ## Available Commands
33
+
34
+ ### Project Setup
35
+ - `update-agent-infra` - Update project configuration
36
+
37
+ ### Development
38
+ - `commit` - Commit current changes to Git
39
+ - `test` - Run unit tests (TODO: tech-stack specific)
40
+ - `test-integration` - Run integration tests (TODO: tech-stack specific)
41
+
42
+ ### Task Management
43
+ - `create-task` - Create a task from natural language description
44
+ - `import-issue` - Import a GitHub Issue as a task
45
+ - `analyze-task` - Analyze task requirements
46
+ - `plan-task` - Design a technical plan for a task
47
+ - `implement-task` - Implement a task based on the plan
48
+ - `review-task` - Review task implementation
49
+ - `refine-task` - Address review feedback
50
+ - `complete-task` - Mark task as completed and archive
51
+ - `check-task` - Check task status
52
+ - `block-task` - Mark task as blocked
53
+
54
+ ### Pull Requests and Sync
55
+ - `create-pr` - Create a Pull Request
56
+ - `sync-pr` - Sync task progress to PR comments
57
+ - `sync-issue` - Sync task progress to Issue comments
58
+
59
+ ### Security
60
+ - `import-dependabot` - Import Dependabot alerts
61
+ - `close-dependabot` - Close Dependabot alerts
62
+ - `import-codescan` - Import Code Scanning alerts
63
+ - `close-codescan` - Close Code Scanning alerts
64
+
65
+ ### Release and Maintenance
66
+ - `release` - Create a release (TODO: tech-stack specific)
67
+ - `create-release-note` - Generate release notes
68
+ - `refine-title` - Refine Issue/PR titles
69
+ - `upgrade-dependency` - Upgrade a dependency (TODO: tech-stack specific)
70
+
71
+ ## Conventions
72
+
73
+ - Commands are **tool-agnostic** and **tech-stack agnostic**
74
+ - Commands with `TODO` markers require project-specific customization
75
+ - All timestamps are generated dynamically (never hardcoded)
76
+ - GitHub API paths use `{owner}/{repo}` placeholders
@@ -0,0 +1,77 @@
1
+ # OpenCode 命令
2
+
3
+ 本目录包含 [OpenCode](https://opencode.ai) AI 编码助手的命令文件。
4
+
5
+ ## 目录结构
6
+
7
+ ```
8
+ .opencode/
9
+ README.md # 英文说明
10
+ README.zh-CN.md # 本文件
11
+ COMMAND_STYLE_GUIDE.md # 命令编写指南
12
+ commands/
13
+ {command}.md # 英文命令文件
14
+ {command}.zh-CN.md # 中文命令文件
15
+ ```
16
+
17
+ ## 命令格式
18
+
19
+ 每个命令文件使用带 YAML 前置元数据的 Markdown 格式:
20
+
21
+ ```markdown
22
+ ---
23
+ description: 命令功能的简要描述
24
+ agent: general
25
+ subtask: false
26
+ ---
27
+
28
+ AI 代理的分步指令。
29
+ 使用 `!` 前缀标记需要直接执行的 shell 命令。
30
+ 使用 markdown 代码块展示不需要自动执行的示例。
31
+ ```
32
+
33
+ ## 可用命令
34
+
35
+ ### 项目设置
36
+ - `update-agent-infra` - 更新项目配置
37
+
38
+ ### 开发
39
+ - `commit` - 提交当前变更到 Git
40
+ - `test` - 运行单元测试(TODO: 需适配技术栈)
41
+ - `test-integration` - 运行集成测试(TODO: 需适配技术栈)
42
+
43
+ ### 任务管理
44
+ - `create-task` - 从自然语言描述创建任务
45
+ - `import-issue` - 导入 GitHub Issue 为任务
46
+ - `analyze-task` - 分析任务需求
47
+ - `plan-task` - 为任务设计技术方案
48
+ - `implement-task` - 根据方案实施任务
49
+ - `review-task` - 审查任务实现
50
+ - `refine-task` - 处理审查反馈
51
+ - `complete-task` - 标记任务完成并归档
52
+ - `check-task` - 查看任务状态
53
+ - `block-task` - 标记任务为阻塞
54
+
55
+ ### PR 和同步
56
+ - `create-pr` - 创建 Pull Request
57
+ - `sync-pr` - 同步任务进度到 PR 评论
58
+ - `sync-issue` - 同步任务进度到 Issue 评论
59
+
60
+ ### 安全
61
+ - `import-dependabot` - 导入 Dependabot 告警
62
+ - `close-dependabot` - 关闭 Dependabot 告警
63
+ - `import-codescan` - 导入 Code Scanning 告警
64
+ - `close-codescan` - 关闭 Code Scanning 告警
65
+
66
+ ### 发布和维护
67
+ - `release` - 创建发布版本(TODO: 需适配技术栈)
68
+ - `create-release-note` - 生成发布说明
69
+ - `refine-title` - 优化 Issue/PR 标题
70
+ - `upgrade-dependency` - 升级依赖(TODO: 需适配技术栈)
71
+
72
+ ## 约定
73
+
74
+ - 命令是**工具无关**和**技术栈无关**的
75
+ - 带 `TODO` 标记的命令需要根据项目具体技术栈进行定制
76
+ - 所有时间戳动态生成(禁止硬编码)
77
+ - GitHub API 路径使用 `{owner}/{repo}` 占位符
@@ -0,0 +1,11 @@
1
+ ---
2
+ description: "Analyze an existing task and output a requirement analysis document"
3
+ agent: general
4
+ subtask: false
5
+ ---
6
+
7
+ Analyze task $1.
8
+
9
+ Read and execute the analyze-task skill from `.agents/skills/analyze-task/SKILL.md`.
10
+
11
+ Follow all steps defined in the skill exactly.
@@ -0,0 +1,11 @@
1
+ ---
2
+ description: "分析已有任务并输出需求分析文档,支持多轮分析产物。 当用户要求分析某个任务时触发。参数:task-id。"
3
+ agent: general
4
+ subtask: false
5
+ ---
6
+
7
+ 分析任务 $1。
8
+
9
+ 读取并执行 `.agents/skills/analyze-task/SKILL.md` 中的 analyze-task 技能。
10
+
11
+ 严格按照技能中定义的所有步骤执行。
@@ -0,0 +1,11 @@
1
+ ---
2
+ description: "Mark task as blocked and record blocking reason"
3
+ agent: general
4
+ subtask: false
5
+ ---
6
+
7
+ Block task: $ARGUMENTS
8
+
9
+ Read and execute the block-task skill from `.agents/skills/block-task/SKILL.md`.
10
+
11
+ Follow all steps defined in the skill exactly.
@@ -0,0 +1,11 @@
1
+ ---
2
+ description: "标记任务为阻塞状态并记录阻塞原因,将其从 active 目录移动到 blocked 目录。 当任务因技术问题、需求不清晰、缺少资源或待定决策而无法继续时使用。 参数:task-id,可选的阻塞原因。"
3
+ agent: general
4
+ subtask: false
5
+ ---
6
+
7
+ 阻塞任务:$ARGUMENTS
8
+
9
+ 读取并执行 `.agents/skills/block-task/SKILL.md` 中的 block-task 技能。
10
+
11
+ 严格按照技能中定义的所有步骤执行。