@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,218 @@
1
+ ---
2
+ name: commit
3
+ description: >
4
+ Commit current changes to Git, including copyright header year
5
+ check and task status update. Triggered when the user requests
6
+ a code commit or save changes.
7
+ ---
8
+
9
+ # Commit Changes
10
+
11
+ Commit current changes to Git.
12
+
13
+ ## Step 0: Check Local Modifications (CRITICAL)
14
+
15
+ **Mandatory**: Before any edits, you **must** check the user's local modifications to avoid overwriting their work.
16
+
17
+ ```bash
18
+ git status --short
19
+ git diff
20
+ ```
21
+
22
+ **Rules**:
23
+ 1. **Read `git diff` output carefully** - understand what the user has already changed
24
+ 2. **Make incremental edits** on top of user modifications - do not overwrite their implementation
25
+ 3. **If your planned edits conflict** with user modifications, ask the user first:
26
+ ```
27
+ This file has local modifications:
28
+ - Your changes: [describe user's changes]
29
+ - My planned changes: [describe planned changes]
30
+ Please confirm how to proceed.
31
+ ```
32
+ 4. **Do NOT** rewrite code the user has already implemented
33
+ 5. **Do NOT** add "improvements" the user didn't ask for
34
+
35
+ ## Step 1: Update Copyright Header Years (CRITICAL)
36
+
37
+ **Mandatory**: Before committing, check and update copyright headers in all modified files.
38
+
39
+ ### Get Current Year
40
+
41
+ ```bash
42
+ date +%Y
43
+ ```
44
+
45
+ **Never hardcode the year.**
46
+
47
+ ### Check Modified Files
48
+
49
+ ```bash
50
+ git status --short
51
+ ```
52
+
53
+ ### For Each Modified File
54
+
55
+ Check if the file has a copyright header:
56
+ ```bash
57
+ grep "Copyright.*[0-9]\{4\}" <modified_file>
58
+ ```
59
+
60
+ If it has a copyright header and the year is not current, update the year.
61
+
62
+ **Common formats**:
63
+ - `Copyright (C) 2024-2025` -> `Copyright (C) 2024-{CURRENT_YEAR}`
64
+ - `Copyright (C) 2024` -> `Copyright (C) 2024-{CURRENT_YEAR}`
65
+ - `Copyright (C) 2025` -> `Copyright (C) {CURRENT_YEAR}` (if already current)
66
+
67
+ ### Copyright Checklist
68
+
69
+ Before executing `git commit`:
70
+ - [ ] Used `date +%Y` to dynamically get the current year
71
+ - [ ] Checked all files about to be committed
72
+ - [ ] Updated copyright year in all files that have copyright headers
73
+ - [ ] **Never** hardcoded the year
74
+ - [ ] **Only** updated modified files, not the entire project
75
+
76
+ ## Step 2: Analyze Changes and Generate Commit Message
77
+
78
+ ```bash
79
+ git status
80
+ git diff
81
+ git log --oneline -5
82
+ ```
83
+
84
+ Generate commit message in Conventional Commits format:
85
+ - `<type>(<scope>): <subject>` (English imperative mood, max 50 chars)
86
+ - Body: 2-4 bullet points explaining what and why
87
+ - Signature block:
88
+ - `Co-Authored-By: {Your Model Name} <noreply@provider.com>`
89
+ - If task-related, append extra `Co-Authored-By` lines for other contributing agents
90
+
91
+ ### Multi-Agent Co-Authorship (If Task-Related)
92
+
93
+ If the commit belongs to an active task and `.agent-workspace/active/{task-id}/task.md` exists:
94
+
95
+ 1. Read the `## Activity Log` section from `task.md`.
96
+ 2. Extract all unique agent names from entries matching `by {agent}`. A loose pattern such as `by (\S+)` is acceptable.
97
+ 3. Exclude `human` because the Git author is already the human user.
98
+ 4. Map each agent to a `Co-Authored-By` line:
99
+
100
+ | Agent | Signature |
101
+ |-------|-----------|
102
+ | `claude` | `Co-Authored-By: Claude <noreply@anthropic.com>` |
103
+ | `codex` | `Co-Authored-By: Codex <noreply@openai.com>` |
104
+ | `gemini` | `Co-Authored-By: Gemini <noreply@google.com>` |
105
+ | `opencode` | `Co-Authored-By: OpenCode <noreply@opencode.ai>` |
106
+
107
+ 5. Build the signature block with these rules:
108
+ - Keep the current executing agent's signature in its original position.
109
+ - Append other unique participating agents as additional `Co-Authored-By` lines.
110
+ - Do not duplicate the current agent if it already appears in `Activity Log`.
111
+ - For unknown agent names, use `Co-Authored-By: {Agent} <noreply@unknown>`.
112
+
113
+ If the commit is not task-related, keep the existing single-signature behavior.
114
+
115
+ ## Step 3: Create Commit
116
+
117
+ ```bash
118
+ git add <specific-files>
119
+ git commit -m "$(cat <<'EOF'
120
+ <type>(<scope>): <subject>
121
+
122
+ - <bullet point 1>
123
+ - <bullet point 2>
124
+
125
+ Co-Authored-By: {Your Model Name} <noreply@provider.com>
126
+ <additional Co-Authored-By lines for other task participants, if any>
127
+ EOF
128
+ )"
129
+ ```
130
+
131
+ **Important**:
132
+ - Add specific files by name - do NOT use `git add -A` or `git add .`
133
+ - Do NOT commit files that may contain secrets (.env, credentials, keys)
134
+ - For task-related commits, keep the current agent first and append the extra lines generated above
135
+
136
+ ## Step 4: Update Task Status (If Task-Related)
137
+
138
+ Get the current time:
139
+
140
+ ```bash
141
+ date "+%Y-%m-%d %H:%M:%S"
142
+ ```
143
+
144
+ After committing, update task status based on the situation:
145
+
146
+ For all cases below, **append** to `## Activity Log` in task.md (do NOT overwrite previous entries):
147
+ ```
148
+ - {yyyy-MM-dd HH:mm:ss} — **Commit** by {agent} — {commit hash short} {commit subject}
149
+ ```
150
+
151
+ ### Case 1: Final Commit (Task Complete)
152
+
153
+ If this is the last commit and all work is done:
154
+
155
+ Prerequisites:
156
+ - [ ] All code committed
157
+ - [ ] All tests pass
158
+ - [ ] Code review passed
159
+ - [ ] All workflow steps complete
160
+
161
+ Suggest next step:
162
+
163
+ > **IMPORTANT**: All TUI command formats listed below must be output in full. Do not show only the format for the current AI agent.
164
+
165
+ ```
166
+ Next step - complete and archive the task:
167
+ - Claude Code / OpenCode: /complete-task {task-id}
168
+ - Gemini CLI: /{{project}}:complete-task {task-id}
169
+ - Codex CLI: $complete-task {task-id}
170
+ ```
171
+
172
+ ### Case 2: More Work Needed
173
+
174
+ If there's follow-up work (awaiting review, more fixes needed):
175
+ - Update `task.md`: set `updated_at` to current time
176
+ - Record this commit's content and next steps in task.md
177
+
178
+ ### Case 3: Ready for Review
179
+
180
+ If the commit is ready for code review:
181
+ - Update `task.md`: set `current_step` to `code-review`
182
+ - Update `task.md`: set `updated_at` to current time
183
+ - Mark implementation step as complete in workflow progress
184
+
185
+ Suggest next step:
186
+
187
+ > **IMPORTANT**: All TUI command formats listed below must be output in full. Do not show only the format for the current AI agent.
188
+
189
+ ```
190
+ Next step - code review:
191
+ - Claude Code / OpenCode: /review-task {task-id}
192
+ - Gemini CLI: /{{project}}:review-task {task-id}
193
+ - Codex CLI: $review-task {task-id}
194
+ ```
195
+
196
+ ### Case 4: Ready for PR
197
+
198
+ If the commit should become a Pull Request:
199
+ - Update `task.md`: set `updated_at` to current time
200
+ - Record PR plan in task.md
201
+
202
+ Suggest next step:
203
+
204
+ > **IMPORTANT**: All TUI command formats listed below must be output in full. Do not show only the format for the current AI agent.
205
+
206
+ ```
207
+ Next step - create a Pull Request:
208
+ - Claude Code / OpenCode: /create-pr
209
+ - Gemini CLI: /{{project}}:create-pr
210
+ - Codex CLI: $create-pr
211
+ ```
212
+
213
+ ## Notes
214
+
215
+ - Do NOT commit files containing sensitive information (.env, credentials, etc.)
216
+ - Ensure commit messages clearly describe the changes
217
+ - Follow the project's Conventional Commits conventions
218
+ - If task status update fails, warn the user but do not block the commit
@@ -0,0 +1,217 @@
1
+ ---
2
+ name: commit
3
+ description: >
4
+ 提交当前变更到 Git,包含版权头年份检查和任务状态更新。
5
+ 当用户要求提交代码或保存变更时触发。
6
+ ---
7
+
8
+ # 提交代码
9
+
10
+ 提交当前变更到 Git。
11
+
12
+ ## 步骤 0:检查本地修改(关键)
13
+
14
+ **强制步骤**:在任何编辑之前,你**必须**检查用户的本地修改以避免覆盖其工作。
15
+
16
+ ```bash
17
+ git status --short
18
+ git diff
19
+ ```
20
+
21
+ **规则**:
22
+ 1. **仔细阅读 `git diff` 输出** —— 理解用户已经做了哪些修改
23
+ 2. **在用户修改基础上进行增量编辑** —— 不要覆盖其实现
24
+ 3. **如果你计划的编辑与用户修改冲突**,先询问用户:
25
+ ```
26
+ This file has local modifications:
27
+ - Your changes: [描述用户的修改]
28
+ - My planned changes: [描述计划的修改]
29
+ Please confirm how to proceed.
30
+ ```
31
+ 4. **不要**重写用户已实现的代码
32
+ 5. **不要**添加用户没有要求的"改进"
33
+
34
+ ## 步骤 1:更新版权头年份(关键)
35
+
36
+ **强制步骤**:提交之前,检查并更新所有修改文件的版权头。
37
+
38
+ ### 获取当前年份
39
+
40
+ ```bash
41
+ date +%Y
42
+ ```
43
+
44
+ **绝不硬编码年份。**
45
+
46
+ ### 检查修改的文件
47
+
48
+ ```bash
49
+ git status --short
50
+ ```
51
+
52
+ ### 对每个修改的文件
53
+
54
+ 检查文件是否有版权头:
55
+ ```bash
56
+ grep "Copyright.*[0-9]\{4\}" <modified_file>
57
+ ```
58
+
59
+ 如果有版权头且年份不是当前年份,更新年份。
60
+
61
+ **常见格式**:
62
+ - `Copyright (C) 2024-2025` -> `Copyright (C) 2024-{CURRENT_YEAR}`
63
+ - `Copyright (C) 2024` -> `Copyright (C) 2024-{CURRENT_YEAR}`
64
+ - `Copyright (C) 2025` -> `Copyright (C) {CURRENT_YEAR}`(如果已是当前年份)
65
+
66
+ ### 版权检查清单
67
+
68
+ 执行 `git commit` 之前:
69
+ - [ ] 使用 `date +%Y` 动态获取当前年份
70
+ - [ ] 检查了所有即将提交的文件
71
+ - [ ] 更新了所有有版权头的文件的版权年份
72
+ - [ ] **绝不**硬编码年份
73
+ - [ ] **仅**更新修改的文件,而非整个项目
74
+
75
+ ## 步骤 2:分析变更并生成提交信息
76
+
77
+ ```bash
78
+ git status
79
+ git diff
80
+ git log --oneline -5
81
+ ```
82
+
83
+ 生成 Conventional Commits 格式的提交信息:
84
+ - `<type>(<scope>): <subject>`(英文祈使语气,不超过 50 字符)
85
+ - Body:2-4 个要点说明修改了什么以及为什么
86
+ - 署名块:
87
+ - `Co-Authored-By: {你的模型名称} <noreply@provider.com>`
88
+ - 如果与任务相关,追加其他贡献 Agent 的 `Co-Authored-By` 行
89
+
90
+ ### 多 Agent 协作署名(仅任务相关提交)
91
+
92
+ 如果本次提交属于某个活动任务,且存在 `.agent-workspace/active/{task-id}/task.md`:
93
+
94
+ 1. 读取 `task.md` 中的 `## Activity Log` 部分。
95
+ 2. 从符合 `by {agent}` 的条目中提取所有唯一 Agent 名称;可使用较宽松的匹配模式,例如 `by (\S+)`。
96
+ 3. 排除 `human`,因为 Git author 已经是人类用户。
97
+ 4. 将 Agent 名称映射为 `Co-Authored-By` 行:
98
+
99
+ | Agent | 署名 |
100
+ |-------|------|
101
+ | `claude` | `Co-Authored-By: Claude <noreply@anthropic.com>` |
102
+ | `codex` | `Co-Authored-By: Codex <noreply@openai.com>` |
103
+ | `gemini` | `Co-Authored-By: Gemini <noreply@google.com>` |
104
+ | `opencode` | `Co-Authored-By: OpenCode <noreply@opencode.ai>` |
105
+
106
+ 5. 构建署名块时遵循以下规则:
107
+ - 保持当前执行提交的 Agent 署名在原有位置。
108
+ - 将其他唯一参与 Agent 作为额外的 `Co-Authored-By` 行追加。
109
+ - 如果当前 Agent 已在 `Activity Log` 中出现,不要重复追加。
110
+ - 未知 Agent 名称使用兜底格式 `Co-Authored-By: {Agent} <noreply@unknown>`。
111
+
112
+ 如果本次提交与任务无关,保持原有单行署名行为不变。
113
+
114
+ ## 步骤 3:创建提交
115
+
116
+ ```bash
117
+ git add <specific-files>
118
+ git commit -m "$(cat <<'EOF'
119
+ <type>(<scope>): <subject>
120
+
121
+ - <要点 1>
122
+ - <要点 2>
123
+
124
+ Co-Authored-By: {你的模型名称} <noreply@provider.com>
125
+ <其他任务参与者的额外 Co-Authored-By 行(如有)>
126
+ EOF
127
+ )"
128
+ ```
129
+
130
+ **重要**:
131
+ - 按名称添加特定文件 —— 不要使用 `git add -A` 或 `git add .`
132
+ - 不要提交可能包含密钥的文件(.env、凭据、密钥)
133
+ - 对于任务相关提交,保持当前 Agent 署名在前,并在其后追加上面生成的额外署名行
134
+
135
+ ## 步骤 4:更新任务状态(如果与任务相关)
136
+
137
+ 获取当前时间:
138
+
139
+ ```bash
140
+ date "+%Y-%m-%d %H:%M:%S"
141
+ ```
142
+
143
+ 提交后,根据情况更新任务状态:
144
+
145
+ 对于以下所有情况,**追加**到 task.md 的 `## Activity Log`(不要覆盖之前的记录):
146
+ ```
147
+ - {yyyy-MM-dd HH:mm:ss} — **Commit** by {agent} — {commit hash short} {commit subject}
148
+ ```
149
+
150
+ ### 情况 1:最终提交(任务完成)
151
+
152
+ 如果这是最后一次提交且所有工作已完成:
153
+
154
+ 前置条件:
155
+ - [ ] 所有代码已提交
156
+ - [ ] 所有测试通过
157
+ - [ ] 代码审查通过
158
+ - [ ] 所有工作流步骤完成
159
+
160
+ 建议下一步:
161
+
162
+ > **重要**:以下「下一步」中列出的所有 TUI 命令格式必须完整输出,不要只展示当前 AI 代理对应的格式。
163
+
164
+ ```
165
+ 下一步 - 完成并归档任务:
166
+ - Claude Code / OpenCode:/complete-task {task-id}
167
+ - Gemini CLI:/{{project}}:complete-task {task-id}
168
+ - Codex CLI:$complete-task {task-id}
169
+ ```
170
+
171
+ ### 情况 2:还有后续工作
172
+
173
+ 如果有后续工作(等待审查、需要更多修复):
174
+ - 更新 `task.md`:设置 `updated_at` 为当前时间
175
+ - 在 task.md 中记录此次提交的内容和下一步
176
+
177
+ ### 情况 3:准备审查
178
+
179
+ 如果提交已准备好进行代码审查:
180
+ - 更新 `task.md`:设置 `current_step` 为 `code-review`
181
+ - 更新 `task.md`:设置 `updated_at` 为当前时间
182
+ - 在工作流进度中标记 implementation 步骤为已完成
183
+
184
+ 建议下一步:
185
+
186
+ > **重要**:以下「下一步」中列出的所有 TUI 命令格式必须完整输出,不要只展示当前 AI 代理对应的格式。
187
+
188
+ ```
189
+ 下一步 - 代码审查:
190
+ - Claude Code / OpenCode:/review-task {task-id}
191
+ - Gemini CLI:/{{project}}:review-task {task-id}
192
+ - Codex CLI:$review-task {task-id}
193
+ ```
194
+
195
+ ### 情况 4:准备创建 PR
196
+
197
+ 如果提交应该创建 Pull Request:
198
+ - 更新 `task.md`:设置 `updated_at` 为当前时间
199
+ - 在 task.md 中记录 PR 计划
200
+
201
+ 建议下一步:
202
+
203
+ > **重要**:以下「下一步」中列出的所有 TUI 命令格式必须完整输出,不要只展示当前 AI 代理对应的格式。
204
+
205
+ ```
206
+ 下一步 - 创建 Pull Request:
207
+ - Claude Code / OpenCode:/create-pr
208
+ - Gemini CLI:/{{project}}:create-pr
209
+ - Codex CLI:$create-pr
210
+ ```
211
+
212
+ ## 注意事项
213
+
214
+ - 不要提交包含敏感信息的文件(.env、凭据等)
215
+ - 确保提交信息清晰描述变更内容
216
+ - 遵循项目的 Conventional Commits 规范
217
+ - 如果任务状态更新失败,警告用户但不要阻止提交
@@ -0,0 +1,139 @@
1
+ ---
2
+ name: complete-task
3
+ description: >
4
+ Mark a task as completed and archive it by moving the task directory from
5
+ active/ to completed/. Verifies that all workflow steps are done, code is
6
+ reviewed and committed, and tests pass before allowing completion.
7
+ Triggered when the user requests task completion or archiving.
8
+ Argument: task-id.
9
+ ---
10
+
11
+ # Complete Task
12
+
13
+ ## Boundary / Critical Rules
14
+
15
+ - This command updates task metadata AND physically moves the task directory
16
+ - Do not archive a task that has incomplete workflow steps unless forced
17
+
18
+ ## Steps
19
+
20
+ ### 1. Verify Task Exists
21
+
22
+ Check that the task exists in `.agent-workspace/active/{task-id}/`.
23
+
24
+ Note: `{task-id}` format is `TASK-{yyyyMMdd-HHmmss}`, e.g. `TASK-20260306-143022`
25
+
26
+ If not found in `active/`, check `blocked/` and `completed/`:
27
+ - If in `completed/`: Inform user the task is already completed
28
+ - If in `blocked/`: Inform user the task is blocked; suggest unblocking first
29
+
30
+ ### 2. Verify Completion Prerequisites
31
+
32
+ Before marking complete, verify ALL of these:
33
+ - [ ] All workflow steps are complete (check workflow progress in task.md)
34
+ - [ ] Code has been reviewed (`review.md` or `review-r{N}.md` exists, and the latest review verdict is Approved; or review was done externally)
35
+ - [ ] Code has been committed (no uncommitted changes related to this task)
36
+ - [ ] Tests are passing
37
+
38
+ If any prerequisite is not met, warn the user:
39
+ ```
40
+ Cannot complete task {task-id} - prerequisites not met:
41
+ - [ ] {Missing prerequisite}
42
+
43
+ Please complete the missing steps first, or use --force to override.
44
+ ```
45
+
46
+ ### 3. Update Task Metadata
47
+
48
+ Get the current time:
49
+
50
+ ```bash
51
+ date "+%Y-%m-%d %H:%M:%S"
52
+ ```
53
+
54
+ Update `.agent-workspace/active/{task-id}/task.md`:
55
+ - `status`: completed
56
+ - `completed_at`: {current timestamp}
57
+ - `updated_at`: {current timestamp}
58
+ - Mark all workflow steps as complete
59
+ - **Append** to `## Activity Log` (do NOT overwrite previous entries):
60
+ ```
61
+ - {yyyy-MM-dd HH:mm:ss} — **Completed** by {agent} — Task archived to completed/
62
+ ```
63
+
64
+ ### 4. Archive Task
65
+
66
+ Move the task directory from active to completed:
67
+
68
+ ```bash
69
+ mv .agent-workspace/active/{task-id} .agent-workspace/completed/{task-id}
70
+ ```
71
+
72
+ ### 5. Verify Archive
73
+
74
+ ```bash
75
+ ls .agent-workspace/completed/{task-id}/task.md
76
+ ```
77
+
78
+ Confirm the task directory was successfully moved.
79
+
80
+ ### 6. Sync to Issue (Optional)
81
+
82
+ Check whether `task.md` includes an `issue_number` field whose value is neither empty nor `N/A`. If not, **skip this step and output nothing**.
83
+
84
+ If a valid `issue_number` exists, optionally sync the completion status:
85
+
86
+ > **IMPORTANT**: All TUI command formats listed below must be output in full. Do not show only the format for the current AI agent.
87
+
88
+ ```
89
+ (Optional) Sync completion status to the GitHub Issue:
90
+ - Claude Code / OpenCode: /sync-issue {issue_number}
91
+ - Gemini CLI: /{{project}}:sync-issue {issue_number}
92
+ - Codex CLI: $sync-issue {issue_number}
93
+ ```
94
+
95
+ ### 7. Inform User
96
+
97
+ Output format:
98
+ ```
99
+ Task {task-id} completed and archived.
100
+
101
+ Task info:
102
+ - Title: {title}
103
+ - Completed at: {timestamp}
104
+ - Archived to: .agent-workspace/completed/{task-id}/
105
+
106
+ Deliverables:
107
+ - {List of key outputs: files modified, tests added, etc.}
108
+ ```
109
+
110
+ ## Completion Checklist
111
+
112
+ - [ ] Verified all workflow steps are complete
113
+ - [ ] Updated task.md with completed status and timestamp
114
+ - [ ] Moved task directory to `.agent-workspace/completed/`
115
+ - [ ] Verified archive succeeded
116
+ - [ ] Informed user of completion
117
+
118
+ ## Notes
119
+
120
+ 1. **Premature completion**: Do not archive a task that has incomplete steps. Examples of incomplete situations:
121
+ - Code is written but not committed
122
+ - Code is committed but not reviewed
123
+ - Review found blockers that haven't been fixed
124
+ - PR is created but not merged
125
+
126
+ 2. **Rollback**: If a task was archived incorrectly:
127
+ ```bash
128
+ mv .agent-workspace/completed/{task-id} .agent-workspace/active/{task-id}
129
+ ```
130
+ Then update task.md status back to `active`.
131
+
132
+ 3. **Multiple contributors**: If multiple AI agents worked on the task, ensure all contributions are committed before completing.
133
+
134
+ ## Error Handling
135
+
136
+ - Task not found: Prompt "Task {task-id} not found in active directory"
137
+ - Already completed: Prompt "Task {task-id} is already in completed directory"
138
+ - Task is blocked: Prompt "Task {task-id} is blocked. Unblock it first by moving to active/"
139
+ - Move failed: Prompt error and suggest manual move
@@ -0,0 +1,137 @@
1
+ ---
2
+ name: complete-task
3
+ description: >
4
+ 标记任务完成并归档,将任务目录从 active/ 移动到 completed/。在允许完成之前,
5
+ 验证所有工作流步骤已完成、代码已审查并提交、测试已通过。
6
+ 当用户要求完成或归档任务时触发。参数:task-id。
7
+ ---
8
+
9
+ # 完成任务
10
+
11
+ ## 行为边界 / 关键规则
12
+
13
+ - 本命令更新任务元数据并物理移动任务目录
14
+ - 除非强制执行,不要归档有未完成工作流步骤的任务
15
+
16
+ ## 执行步骤
17
+
18
+ ### 1. 验证任务存在
19
+
20
+ 检查任务是否存在于 `.agent-workspace/active/{task-id}/`。
21
+
22
+ 注意:`{task-id}` 格式为 `TASK-{yyyyMMdd-HHmmss}`,例如 `TASK-20260306-143022`
23
+
24
+ 如果在 `active/` 中未找到,检查 `blocked/` 和 `completed/`:
25
+ - 如果在 `completed/`:告知用户任务已完成
26
+ - 如果在 `blocked/`:告知用户任务被阻塞;建议先解除阻塞
27
+
28
+ ### 2. 验证完成前置条件
29
+
30
+ 标记完成之前,验证以下所有条件:
31
+ - [ ] 所有工作流步骤已完成(检查 task.md 中的工作流进度)
32
+ - [ ] 代码已审查(`review.md` 或 `review-r{N}.md` 存在,且最新审查结论为 Approved;或已在外部完成审查)
33
+ - [ ] 代码已提交(没有与此任务相关的未提交变更)
34
+ - [ ] 测试通过
35
+
36
+ 如果任何前置条件未满足,警告用户:
37
+ ```
38
+ Cannot complete task {task-id} - prerequisites not met:
39
+ - [ ] {缺失的前置条件}
40
+
41
+ Please complete the missing steps first, or use --force to override.
42
+ ```
43
+
44
+ ### 3. 更新任务元数据
45
+
46
+ 获取当前时间:
47
+
48
+ ```bash
49
+ date "+%Y-%m-%d %H:%M:%S"
50
+ ```
51
+
52
+ 更新 `.agent-workspace/active/{task-id}/task.md`:
53
+ - `status`:completed
54
+ - `completed_at`:{当前时间戳}
55
+ - `updated_at`:{当前时间戳}
56
+ - 标记所有工作流步骤为已完成
57
+ - **追加**到 `## Activity Log`(不要覆盖之前的记录):
58
+ ```
59
+ - {yyyy-MM-dd HH:mm:ss} — **Completed** by {agent} — Task archived to completed/
60
+ ```
61
+
62
+ ### 4. 归档任务
63
+
64
+ 将任务目录从 active 移动到 completed:
65
+
66
+ ```bash
67
+ mv .agent-workspace/active/{task-id} .agent-workspace/completed/{task-id}
68
+ ```
69
+
70
+ ### 5. 验证归档
71
+
72
+ ```bash
73
+ ls .agent-workspace/completed/{task-id}/task.md
74
+ ```
75
+
76
+ 确认任务目录已成功移动。
77
+
78
+ ### 6. 同步到 Issue(可选)
79
+
80
+ 检查 `task.md` 中是否存在 `issue_number` 字段,且其值不为空也不为 `N/A`。如果没有,**跳过此步骤,不输出任何内容**。
81
+
82
+ 如果存在有效的 `issue_number`,可选择同步完成状态:
83
+
84
+ > **重要**:以下列出的所有 TUI 命令格式必须完整输出,不要只展示当前 AI 代理对应的格式。
85
+
86
+ ```
87
+ (可选)同步完成状态到 GitHub Issue:
88
+ - Claude Code / OpenCode:/sync-issue {issue_number}
89
+ - Gemini CLI:/{{project}}:sync-issue {issue_number}
90
+ - Codex CLI:$sync-issue {issue_number}
91
+ ```
92
+
93
+ ### 7. 告知用户
94
+
95
+ 输出格式:
96
+ ```
97
+ 任务 {task-id} 已完成并归档。
98
+
99
+ 任务信息:
100
+ - 标题:{title}
101
+ - 完成时间:{timestamp}
102
+ - 归档路径:.agent-workspace/completed/{task-id}/
103
+
104
+ 交付物:
105
+ - {关键产出列表:修改的文件、添加的测试等}
106
+ ```
107
+
108
+ ## 完成检查清单
109
+
110
+ - [ ] 验证了所有工作流步骤已完成
111
+ - [ ] 更新了 task.md 的完成状态和时间戳
112
+ - [ ] 将任务目录移动到 `.agent-workspace/completed/`
113
+ - [ ] 验证了归档成功
114
+ - [ ] 告知了用户完成情况
115
+
116
+ ## 注意事项
117
+
118
+ 1. **过早完成**:不要归档有未完成步骤的任务。未完成的情况示例:
119
+ - 代码已编写但未提交
120
+ - 代码已提交但未审查
121
+ - 审查发现阻塞项但未修复
122
+ - PR 已创建但未合并
123
+
124
+ 2. **回滚**:如果任务被错误归档:
125
+ ```bash
126
+ mv .agent-workspace/completed/{task-id} .agent-workspace/active/{task-id}
127
+ ```
128
+ 然后将 task.md 中的状态改回 `active`。
129
+
130
+ 3. **多贡献者**:如果多个 AI 代理参与了任务,确保所有贡献都已提交后再完成。
131
+
132
+ ## 错误处理
133
+
134
+ - 任务未找到:提示 "Task {task-id} not found in active directory"
135
+ - 已完成:提示 "Task {task-id} is already in completed directory"
136
+ - 任务被阻塞:提示 "Task {task-id} is blocked. Unblock it first by moving to active/"
137
+ - 移动失败:提示错误并建议手动移动