@fitlab-ai/agent-infra 0.9.0 → 0.9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (327) hide show
  1. package/README.md +22 -5
  2. package/README.zh-CN.md +21 -5
  3. package/bin/cli.ts +12 -0
  4. package/dist/bin/cli.js +14 -0
  5. package/dist/bin/internal-cli.js +20 -0
  6. package/dist/lib/agent-client.js +163 -0
  7. package/dist/lib/agent-clients/adapter.js +294 -0
  8. package/dist/lib/agent-clients/adapters/claude-code.js +62 -0
  9. package/dist/lib/agent-clients/adapters/codex-sandbox.js +210 -0
  10. package/dist/lib/agent-clients/adapters/codex.js +54 -0
  11. package/dist/lib/agent-clients/adapters/gemini-cli.js +64 -0
  12. package/dist/lib/agent-clients/adapters/index.js +20 -0
  13. package/dist/lib/agent-clients/adapters/opencode.js +64 -0
  14. package/dist/lib/agent-clients/config.js +177 -0
  15. package/dist/lib/agent-clients/custom-tuis.js +99 -0
  16. package/dist/lib/agent-clients/invocation.js +9 -0
  17. package/dist/lib/agent-clients/next-steps.js +38 -0
  18. package/dist/lib/agent-clients/project-assets.js +45 -0
  19. package/dist/lib/agent-clients/reconcile.js +235 -0
  20. package/dist/lib/agent-clients/registry.js +72 -0
  21. package/dist/lib/agent-clients/schema.js +57 -0
  22. package/dist/lib/agent-clients/types.js +29 -0
  23. package/dist/lib/builtin-tuis.js +9 -14
  24. package/dist/lib/defaults.json +85 -73
  25. package/dist/lib/git/review-snapshot.js +25 -10
  26. package/dist/lib/git/reviewed-commit-equivalence.js +110 -0
  27. package/dist/lib/init.js +47 -91
  28. package/dist/lib/internal/agent-client.js +117 -0
  29. package/dist/lib/internal/git-workflow.js +1 -1
  30. package/dist/lib/internal/platform-release-notes.js +53 -0
  31. package/dist/lib/internal/release-workflow.js +175 -17
  32. package/dist/lib/internal/task-orchestration.js +151 -0
  33. package/dist/lib/internal/task-review.js +65 -0
  34. package/dist/lib/merge.js +2 -1
  35. package/dist/lib/platform/adapters.js +38 -1
  36. package/dist/lib/platform/change-request-git-evidence.js +113 -0
  37. package/dist/lib/platform/github-release-notes.js +96 -0
  38. package/dist/lib/platform/issues.js +4 -2
  39. package/dist/lib/platform/merged-pr-equivalence.js +84 -0
  40. package/dist/lib/platform/pr-checks.js +43 -15
  41. package/dist/lib/platform/pull-requests.js +113 -7
  42. package/dist/lib/platform/release-notes.js +143 -0
  43. package/dist/lib/platform/releases.js +1 -1
  44. package/dist/lib/platform/verification-required.js +31 -9
  45. package/dist/lib/prompt.js +15 -3
  46. package/dist/lib/release/channels.js +4 -1
  47. package/dist/lib/release/workflow.js +4 -2
  48. package/dist/lib/remove-dir.js +25 -0
  49. package/dist/lib/run/tui.js +8 -2
  50. package/dist/lib/sandbox/agent-client-reconciler.js +234 -0
  51. package/dist/lib/sandbox/build-proxy.js +63 -0
  52. package/dist/lib/sandbox/clipboard/linux.js +2 -1
  53. package/dist/lib/sandbox/commands/create.js +133 -189
  54. package/dist/lib/sandbox/commands/enter.js +17 -1
  55. package/dist/lib/sandbox/commands/prune.js +2 -2
  56. package/dist/lib/sandbox/commands/rebuild.js +24 -7
  57. package/dist/lib/sandbox/commands/rm.js +3 -2
  58. package/dist/lib/sandbox/config.js +21 -4
  59. package/dist/lib/sandbox/constants.js +3 -0
  60. package/dist/lib/sandbox/dockerfile.js +2 -1
  61. package/dist/lib/sandbox/image-build.js +2 -1
  62. package/dist/lib/sandbox/managed-fs.js +10 -5
  63. package/dist/lib/sandbox/recovery.js +52 -36
  64. package/dist/lib/sandbox/runtimes/ai-tools.dockerfile +24 -3
  65. package/dist/lib/sandbox/runtimes/base.dockerfile +8 -1
  66. package/dist/lib/sandbox/runtimes/java17.dockerfile +8 -1
  67. package/dist/lib/sandbox/runtimes/java21.dockerfile +8 -1
  68. package/dist/lib/sandbox/runtimes/node20.dockerfile +8 -1
  69. package/dist/lib/sandbox/runtimes/node22.dockerfile +8 -1
  70. package/dist/lib/sandbox/runtimes/python3.dockerfile +8 -1
  71. package/dist/lib/sandbox/shell.js +3 -2
  72. package/dist/lib/sandbox/tool-types.js +8 -0
  73. package/dist/lib/sandbox/tools.js +2 -126
  74. package/dist/lib/task/artifact-lifecycle.js +1 -49
  75. package/dist/lib/task/commands/decisions.js +50 -20
  76. package/dist/lib/task/commands/issue-body.js +10 -5
  77. package/dist/lib/task/delegation-receipts.js +107 -0
  78. package/dist/lib/task/events.js +101 -2
  79. package/dist/lib/task/issue-form.js +2 -0
  80. package/dist/lib/task/orchestration.js +420 -0
  81. package/dist/lib/task/review-artifacts.js +143 -59
  82. package/dist/lib/task/review-finalization.js +166 -0
  83. package/dist/lib/task/review-fingerprint.js +13 -0
  84. package/dist/lib/task/verification-checks.js +2 -1
  85. package/dist/lib/task/verification-engine.js +168 -23
  86. package/dist/lib/task/verification-review.js +1 -1
  87. package/dist/lib/task/verification.js +4 -2
  88. package/dist/lib/task/workspace-snapshot.js +34 -0
  89. package/dist/lib/update.js +42 -161
  90. package/lib/agent-client.ts +214 -0
  91. package/lib/agent-clients/adapter.ts +461 -0
  92. package/lib/agent-clients/adapters/claude-code.ts +70 -0
  93. package/lib/agent-clients/adapters/codex-sandbox.ts +245 -0
  94. package/lib/agent-clients/adapters/codex.ts +58 -0
  95. package/lib/agent-clients/adapters/gemini-cli.ts +65 -0
  96. package/lib/agent-clients/adapters/index.ts +27 -0
  97. package/lib/agent-clients/adapters/opencode.ts +66 -0
  98. package/lib/agent-clients/config.ts +278 -0
  99. package/lib/agent-clients/custom-tuis.ts +149 -0
  100. package/lib/agent-clients/invocation.ts +19 -0
  101. package/lib/agent-clients/next-steps.ts +72 -0
  102. package/lib/agent-clients/project-assets.ts +96 -0
  103. package/lib/agent-clients/reconcile.ts +324 -0
  104. package/lib/agent-clients/registry.ts +144 -0
  105. package/lib/agent-clients/schema.ts +62 -0
  106. package/lib/agent-clients/types.ts +78 -0
  107. package/lib/benchmark/schemas/v1.0.0/case-manifest.schema.json +120 -0
  108. package/lib/benchmark/schemas/v1.0.0/common.schema.json +109 -0
  109. package/lib/benchmark/schemas/v1.0.0/grader-result.schema.json +160 -0
  110. package/lib/benchmark/schemas/v1.0.0/run-manifest.schema.json +122 -0
  111. package/lib/benchmark/schemas/v1.0.0/subject.schema.json +227 -0
  112. package/lib/builtin-tuis.ts +16 -15
  113. package/lib/defaults.json +24 -12
  114. package/lib/git/review-snapshot.ts +39 -9
  115. package/lib/git/reviewed-commit-equivalence.ts +135 -0
  116. package/lib/init.ts +53 -121
  117. package/lib/internal/agent-client.ts +131 -0
  118. package/lib/internal/git-workflow.ts +1 -1
  119. package/lib/internal/platform-release-notes.ts +55 -0
  120. package/lib/internal/release-workflow.ts +172 -18
  121. package/lib/internal/task-orchestration.ts +132 -0
  122. package/lib/internal/task-review.ts +65 -0
  123. package/lib/merge.ts +2 -1
  124. package/lib/platform/adapters.ts +142 -3
  125. package/lib/platform/change-request-git-evidence.ts +159 -0
  126. package/lib/platform/github-release-notes.ts +132 -0
  127. package/lib/platform/issues.ts +6 -4
  128. package/lib/platform/merged-pr-equivalence.ts +107 -0
  129. package/lib/platform/pr-checks.ts +57 -28
  130. package/lib/platform/pull-requests.ts +140 -25
  131. package/lib/platform/release-notes.ts +167 -0
  132. package/lib/platform/releases.ts +1 -1
  133. package/lib/platform/verification-required.ts +37 -9
  134. package/lib/prompt.ts +16 -3
  135. package/lib/release/channels.ts +4 -1
  136. package/lib/release/workflow.ts +4 -3
  137. package/lib/remove-dir.ts +28 -0
  138. package/lib/run/tui.ts +9 -1
  139. package/lib/sandbox/agent-client-reconciler.ts +378 -0
  140. package/lib/sandbox/build-proxy.ts +94 -0
  141. package/lib/sandbox/clipboard/linux.ts +2 -1
  142. package/lib/sandbox/commands/create.ts +188 -203
  143. package/lib/sandbox/commands/enter.ts +23 -1
  144. package/lib/sandbox/commands/prune.ts +2 -2
  145. package/lib/sandbox/commands/rebuild.ts +29 -7
  146. package/lib/sandbox/commands/rm.ts +3 -2
  147. package/lib/sandbox/config.ts +31 -4
  148. package/lib/sandbox/constants.ts +6 -0
  149. package/lib/sandbox/dockerfile.ts +2 -1
  150. package/lib/sandbox/image-build.ts +4 -1
  151. package/lib/sandbox/managed-fs.ts +18 -5
  152. package/lib/sandbox/recovery.ts +98 -67
  153. package/lib/sandbox/runtimes/ai-tools.dockerfile +24 -3
  154. package/lib/sandbox/runtimes/base.dockerfile +8 -1
  155. package/lib/sandbox/runtimes/java17.dockerfile +8 -1
  156. package/lib/sandbox/runtimes/java21.dockerfile +8 -1
  157. package/lib/sandbox/runtimes/node20.dockerfile +8 -1
  158. package/lib/sandbox/runtimes/node22.dockerfile +8 -1
  159. package/lib/sandbox/runtimes/python3.dockerfile +8 -1
  160. package/lib/sandbox/shell.ts +4 -2
  161. package/lib/sandbox/tool-types.ts +143 -0
  162. package/lib/sandbox/tools.ts +5 -157
  163. package/lib/task/artifact-lifecycle.ts +1 -38
  164. package/lib/task/commands/decisions.ts +53 -20
  165. package/lib/task/commands/issue-body.ts +10 -5
  166. package/lib/task/delegation-receipts.ts +170 -0
  167. package/lib/task/events.ts +111 -3
  168. package/lib/task/issue-form.ts +4 -0
  169. package/lib/task/orchestration.ts +543 -0
  170. package/lib/task/review-artifacts.ts +201 -69
  171. package/lib/task/review-finalization.ts +275 -0
  172. package/lib/task/review-fingerprint.ts +15 -1
  173. package/lib/task/verification-checks.ts +2 -1
  174. package/lib/task/verification-engine.ts +190 -25
  175. package/lib/task/verification-review.ts +2 -0
  176. package/lib/task/verification.ts +6 -3
  177. package/lib/task/workspace-snapshot.ts +36 -0
  178. package/lib/update.ts +48 -184
  179. package/package.json +2 -2
  180. package/templates/.agents/README.en.md +21 -20
  181. package/templates/.agents/README.zh-CN.md +21 -20
  182. package/templates/.agents/hooks/lifecycle-delegation.js +64 -0
  183. package/templates/.agents/rules/README.en.md +2 -0
  184. package/templates/.agents/rules/README.zh-CN.md +2 -0
  185. package/templates/.agents/rules/commit-and-pr.en.md +1 -0
  186. package/templates/.agents/rules/commit-and-pr.zh-CN.md +1 -0
  187. package/templates/.agents/rules/human-decision-context.en.md +14 -12
  188. package/templates/.agents/rules/human-decision-context.zh-CN.md +14 -12
  189. package/templates/.agents/rules/lifecycle-orchestration.en.md +21 -0
  190. package/templates/.agents/rules/lifecycle-orchestration.zh-CN.md +21 -0
  191. package/templates/.agents/rules/next-step-output.en.md +16 -0
  192. package/templates/.agents/rules/next-step-output.zh-CN.md +16 -0
  193. package/templates/.agents/rules/no-mid-flow-questions.en.md +2 -0
  194. package/templates/.agents/rules/no-mid-flow-questions.zh-CN.md +2 -0
  195. package/templates/.agents/rules/release-commands.en.md +2 -2
  196. package/templates/.agents/rules/release-commands.github.en.md +15 -39
  197. package/templates/.agents/rules/release-commands.github.zh-CN.md +14 -38
  198. package/templates/.agents/rules/release-commands.zh-CN.md +2 -2
  199. package/templates/.agents/rules/review-handshake.en.md +4 -3
  200. package/templates/.agents/rules/review-handshake.zh-CN.md +4 -3
  201. package/templates/.agents/rules/review-method.en.md +113 -0
  202. package/templates/.agents/rules/review-method.zh-CN.md +98 -0
  203. package/templates/.agents/rules/testing-discipline.en.md +20 -2
  204. package/templates/.agents/rules/testing-discipline.zh-CN.md +20 -2
  205. package/templates/.agents/skills/analyze-task/SKILL.en.md +9 -6
  206. package/templates/.agents/skills/analyze-task/SKILL.zh-CN.md +9 -6
  207. package/templates/.agents/skills/block-task/SKILL.en.md +4 -4
  208. package/templates/.agents/skills/block-task/SKILL.zh-CN.md +4 -4
  209. package/templates/.agents/skills/cancel-task/SKILL.en.md +4 -4
  210. package/templates/.agents/skills/cancel-task/SKILL.zh-CN.md +5 -5
  211. package/templates/.agents/skills/check-task/SKILL.en.md +16 -16
  212. package/templates/.agents/skills/check-task/SKILL.zh-CN.md +16 -16
  213. package/templates/.agents/skills/close-codescan/SKILL.en.md +4 -4
  214. package/templates/.agents/skills/close-codescan/SKILL.zh-CN.md +4 -4
  215. package/templates/.agents/skills/close-dependabot/SKILL.en.md +4 -4
  216. package/templates/.agents/skills/close-dependabot/SKILL.zh-CN.md +4 -4
  217. package/templates/.agents/skills/code-task/SKILL.en.md +1 -1
  218. package/templates/.agents/skills/code-task/SKILL.zh-CN.md +2 -2
  219. package/templates/.agents/skills/code-task/reference/fix-mode.en.md +14 -16
  220. package/templates/.agents/skills/code-task/reference/fix-mode.zh-CN.md +14 -16
  221. package/templates/.agents/skills/code-task/reference/output-template.en.md +3 -3
  222. package/templates/.agents/skills/code-task/reference/output-template.zh-CN.md +3 -3
  223. package/templates/.agents/skills/commit/SKILL.en.md +11 -1
  224. package/templates/.agents/skills/commit/SKILL.zh-CN.md +11 -1
  225. package/templates/.agents/skills/commit/reference/task-status-update.en.md +24 -28
  226. package/templates/.agents/skills/commit/reference/task-status-update.zh-CN.md +24 -28
  227. package/templates/.agents/skills/complete-task/SKILL.en.md +3 -3
  228. package/templates/.agents/skills/complete-task/SKILL.zh-CN.md +3 -3
  229. package/templates/.agents/skills/complete-task/config/verify.en.json +0 -1
  230. package/templates/.agents/skills/complete-task/config/verify.zh-CN.json +0 -1
  231. package/templates/.agents/skills/create-pr/SKILL.en.md +10 -10
  232. package/templates/.agents/skills/create-pr/SKILL.zh-CN.md +10 -10
  233. package/templates/.agents/skills/create-pr/reference/pr-body-template.en.md +3 -3
  234. package/templates/.agents/skills/create-pr/reference/pr-body-template.zh-CN.md +3 -3
  235. package/templates/.agents/skills/create-release-note/SKILL.en.md +17 -38
  236. package/templates/.agents/skills/create-release-note/SKILL.zh-CN.md +16 -37
  237. package/templates/.agents/skills/create-task/SKILL.en.md +15 -11
  238. package/templates/.agents/skills/create-task/SKILL.zh-CN.md +15 -11
  239. package/templates/.agents/skills/create-task/reference/context-capture.en.md +29 -0
  240. package/templates/.agents/skills/create-task/reference/context-capture.zh-CN.md +29 -0
  241. package/templates/.agents/skills/import-codescan/SKILL.en.md +5 -5
  242. package/templates/.agents/skills/import-codescan/SKILL.zh-CN.md +5 -5
  243. package/templates/.agents/skills/import-dependabot/SKILL.en.md +5 -5
  244. package/templates/.agents/skills/import-dependabot/SKILL.zh-CN.md +5 -5
  245. package/templates/.agents/skills/import-issue/SKILL.en.md +5 -5
  246. package/templates/.agents/skills/import-issue/SKILL.zh-CN.md +5 -5
  247. package/templates/.agents/skills/init-labels/SKILL.en.md +4 -4
  248. package/templates/.agents/skills/init-labels/SKILL.zh-CN.md +4 -4
  249. package/templates/.agents/skills/init-milestones/SKILL.en.md +4 -4
  250. package/templates/.agents/skills/init-milestones/SKILL.zh-CN.md +4 -4
  251. package/templates/.agents/skills/plan-task/SKILL.en.md +5 -5
  252. package/templates/.agents/skills/plan-task/SKILL.zh-CN.md +5 -5
  253. package/templates/.agents/skills/refine-title/SKILL.en.md +1 -1
  254. package/templates/.agents/skills/refine-title/SKILL.zh-CN.md +1 -1
  255. package/templates/.agents/skills/release/SKILL.en.md +1 -1
  256. package/templates/.agents/skills/review-analysis/SKILL.en.md +13 -2
  257. package/templates/.agents/skills/review-analysis/SKILL.zh-CN.md +14 -3
  258. package/templates/.agents/skills/review-analysis/config/verify.en.json +6 -0
  259. package/templates/.agents/skills/review-analysis/config/verify.zh-CN.json +6 -0
  260. package/templates/.agents/skills/review-analysis/reference/output-templates.en.md +13 -15
  261. package/templates/.agents/skills/review-analysis/reference/output-templates.zh-CN.md +13 -15
  262. package/templates/.agents/skills/review-analysis/reference/report-template.en.md +51 -5
  263. package/templates/.agents/skills/review-analysis/reference/report-template.zh-CN.md +52 -6
  264. package/templates/.agents/skills/review-analysis/reference/review-criteria.en.md +25 -22
  265. package/templates/.agents/skills/review-analysis/reference/review-criteria.zh-CN.md +25 -22
  266. package/templates/.agents/skills/review-code/SKILL.en.md +28 -8
  267. package/templates/.agents/skills/review-code/SKILL.zh-CN.md +28 -8
  268. package/templates/.agents/skills/review-code/config/verify.en.json +7 -0
  269. package/templates/.agents/skills/review-code/config/verify.zh-CN.json +7 -0
  270. package/templates/.agents/skills/review-code/reference/concurrency-risks.en.md +25 -0
  271. package/templates/.agents/skills/review-code/reference/concurrency-risks.zh-CN.md +25 -0
  272. package/templates/.agents/skills/review-code/reference/cross-platform-risks.en.md +27 -0
  273. package/templates/.agents/skills/review-code/reference/cross-platform-risks.zh-CN.md +27 -0
  274. package/templates/.agents/skills/review-code/reference/documentation-antipatterns.en.md +13 -0
  275. package/templates/.agents/skills/review-code/reference/documentation-antipatterns.zh-CN.md +13 -0
  276. package/templates/.agents/skills/review-code/reference/migration-risks.en.md +25 -0
  277. package/templates/.agents/skills/review-code/reference/migration-risks.zh-CN.md +25 -0
  278. package/templates/.agents/skills/review-code/reference/output-templates.en.md +22 -24
  279. package/templates/.agents/skills/review-code/reference/output-templates.zh-CN.md +22 -24
  280. package/templates/.agents/skills/review-code/reference/report-template.en.md +54 -7
  281. package/templates/.agents/skills/review-code/reference/report-template.zh-CN.md +54 -7
  282. package/templates/.agents/skills/review-code/reference/review-criteria.en.md +29 -24
  283. package/templates/.agents/skills/review-code/reference/review-criteria.zh-CN.md +29 -24
  284. package/templates/.agents/skills/review-code/reference/security-risks.en.md +25 -0
  285. package/templates/.agents/skills/review-code/reference/security-risks.zh-CN.md +25 -0
  286. package/templates/.agents/skills/review-plan/SKILL.en.md +13 -2
  287. package/templates/.agents/skills/review-plan/SKILL.zh-CN.md +14 -3
  288. package/templates/.agents/skills/review-plan/config/verify.en.json +6 -0
  289. package/templates/.agents/skills/review-plan/config/verify.zh-CN.json +6 -0
  290. package/templates/.agents/skills/review-plan/reference/output-templates.en.md +13 -15
  291. package/templates/.agents/skills/review-plan/reference/output-templates.zh-CN.md +13 -15
  292. package/templates/.agents/skills/review-plan/reference/report-template.en.md +61 -5
  293. package/templates/.agents/skills/review-plan/reference/report-template.zh-CN.md +61 -5
  294. package/templates/.agents/skills/review-plan/reference/review-criteria.en.md +21 -24
  295. package/templates/.agents/skills/review-plan/reference/review-criteria.zh-CN.md +21 -24
  296. package/templates/.agents/skills/run-task/SKILL.en.md +22 -0
  297. package/templates/.agents/skills/run-task/SKILL.zh-CN.md +22 -0
  298. package/templates/.agents/skills/run-task/config/verify.en.json +9 -0
  299. package/templates/.agents/skills/run-task/config/verify.zh-CN.json +9 -0
  300. package/templates/.agents/skills/test/SKILL.en.md +4 -4
  301. package/templates/.agents/skills/test/SKILL.zh-CN.md +4 -4
  302. package/templates/.agents/skills/test-integration/SKILL.en.md +4 -4
  303. package/templates/.agents/skills/test-integration/SKILL.zh-CN.md +4 -4
  304. package/templates/.agents/skills/update-agent-infra/SKILL.en.md +5 -5
  305. package/templates/.agents/skills/update-agent-infra/SKILL.zh-CN.md +5 -5
  306. package/templates/.agents/skills/update-agent-infra/scripts/sync-templates.js +647 -203
  307. package/templates/.agents/skills/upgrade-dependency/SKILL.en.md +4 -4
  308. package/templates/.agents/skills/upgrade-dependency/SKILL.zh-CN.md +4 -4
  309. package/templates/.agents/skills/watch-pr/SKILL.en.md +8 -8
  310. package/templates/.agents/skills/watch-pr/SKILL.zh-CN.md +8 -8
  311. package/templates/.agents/templates/task.en.md +18 -0
  312. package/templates/.agents/templates/task.zh-CN.md +18 -0
  313. package/templates/.claude/agents/agent-infra-lifecycle-executor.en.md +6 -0
  314. package/templates/.claude/agents/agent-infra-lifecycle-executor.zh-CN.md +6 -0
  315. package/templates/.claude/agents/agent-infra-lifecycle-reviewer.en.md +6 -0
  316. package/templates/.claude/agents/agent-infra-lifecycle-reviewer.zh-CN.md +6 -0
  317. package/templates/.claude/commands/run-task.en.md +8 -0
  318. package/templates/.claude/commands/run-task.zh-CN.md +8 -0
  319. package/templates/.claude/settings.json +24 -0
  320. package/templates/.codex/agents/agent-infra-lifecycle-executor.en.toml +3 -0
  321. package/templates/.codex/agents/agent-infra-lifecycle-executor.zh-CN.toml +3 -0
  322. package/templates/.codex/agents/agent-infra-lifecycle-reviewer.en.toml +3 -0
  323. package/templates/.codex/agents/agent-infra-lifecycle-reviewer.zh-CN.toml +3 -0
  324. package/templates/.gemini/commands/_project_/run-task.en.toml +8 -0
  325. package/templates/.gemini/commands/_project_/run-task.zh-CN.toml +8 -0
  326. package/templates/.opencode/commands/run-task.en.md +11 -0
  327. package/templates/.opencode/commands/run-task.zh-CN.md +11 -0
@@ -23,35 +23,38 @@
23
23
  - 对无法确认的信息直接下结论,没有标记假设或开放问题
24
24
  - 凭印象或记忆断言 `file:line`/行为,没有用 rg/nl 复核就下结论
25
25
 
26
- ## 通用审查原则
26
+ ## 需求分析专项覆盖
27
27
 
28
- 1. **严格但公正**:既要指出问题,也要承认做得好的部分
29
- 2. **具体**:引用准确的文件路径和行号
30
- 3. **可执行**:给出明确可落地的修复建议
31
- 4. **按严重程度分类**:明确区分 blocker、major 和 minor
28
+ ### 角色视角
32
29
 
33
- ## 三类审查项决策树
30
+ 每轮必须逐项检视以下最低视角,并在报告中使用稳定的 `perspective_id`:
34
31
 
35
- 1. 若问题揭示当前需求分析缺少需求、约束、风险、影响范围或可验证验收标准,登记为正式 finding,并按影响赋予 blocker / major / minor;severity 只表示影响大小,minor 也必须闭环。
36
- 2. 若没有已知缺陷,但只能依赖真实环境、权限或人工操作完成验证,归为 manual-validation。
37
- 3. 仅当建议属于未来优化且不影响当前分析的完整性、正确性和验收时,归为 advisory。advisory 只写入「非阻塞建议」,不进入账本、问题计数或 verdict。
32
+ - `user`:业务目标、使用结果、非目标和验收
33
+ - `maintainer`:维护边界、依赖、兼容性和长期责任
34
+ - `operations`:部署、运行、可观测性、恢复和支持约束
35
+ - `security`:信任边界、权限、数据和滥用风险
36
+ - `testing`:可观察的输入、动作、结果、边界条件和验证环境
38
37
 
39
- ## 人工校验项分类
38
+ 适用视角记录实际范围、证据和 `covered/gap`;`not-applicable` 必须附可复核依据,否则视为 gap。若任务来源或风险证据出现其他利益相关者,追加稳定 token;不要把可能角色扩张成固定全集。
40
39
 
41
- 某些发现项是 AI agent 在本执行环境**无法闭环**的,例如:
40
+ ### 质量属性
42
41
 
43
- - 缺 Docker / 沙箱而无法跑端到端验证
44
- - 缺特定 OS(macOS-only 行为)
45
- - 缺第三方账号 / OAuth
46
- - 缺特权操作(root、sudo、特殊网络)
42
+ 只记录由来源、约束或角色视角实际触发的质量属性,不使用固定名词全集。每项需有稳定 `quality_id`、来源与利益相关者、优先级或权衡状态、可验证表达及 `covered/gap`。缺少来源的候选项只能作为假设、开放问题或非阻塞建议,不能作为已确认需求。
47
43
 
48
- **分类决策树**:「AI agent 能否在不改环境的前提下独立闭环这一项?」
49
- - 是 -> blocker / major / minor 之一(按风险定档)
50
- - 否 -> **manual-validation**(人工校验元类目,不参与严重程度排序)
44
+ ### 演进场景
51
45
 
52
- manual-validation 项的去向:
53
- - 写入 review 报告独立段落「人工校验项」
54
- - 在 done note 中写入源字段 `Manual-validation: 1`;`ai task log` 归一化展示到 review 行
55
- - **不**进入 code-task 修复循环;维护者在 PR description 中以「待人工验证」清单形式承接
46
+ 合理未来变化需有稳定 `evolution_id`、来源、`confirmed/unconfirmed` 状态、`design-input/assumption/open-question` 分类、边界证据及 `covered/gap`。`unconfirmed` 场景不得升级为当前需求,也不得直接驱动架构或实现选择。
47
+
48
+ ### 验收标准
49
+
50
+ 逐项记录稳定 `acceptance_id`、可观察输入、审查动作、预期结果和 `verifiable/open/gap`。非行为型约束可用可观察验证方式替代行为步骤;无法闭环时必须进入开放问题或 finding。
51
+
52
+ ### 追踪与边界
53
+
54
+ 共享追踪矩阵仍是来源到分析结论的唯一映射。其 `source_id` 应覆盖用户请求、Issue、任务事实/决策和验收标准;专项表通过来源或证据回指这些稳定标识。本阶段只判断分析是否足以进入设计,不选择架构风格、设计模式或实现技术,也不复制共享五遍协议和 finding 证据字段。
55
+
56
+ ## 共享方法与分类边界
57
+
58
+ 先读取 `.agents/rules/review-method.md`,按其五遍协议、风险镜头和 finding 证据契约执行;finding、manual-validation、advisory 与 `needs-human-decision` 的状态语义以 `.agents/rules/review-handshake.md` 为准。本文件只补充需求分析阶段的专项判断。
56
59
 
57
60
  同时检查最新需求分析产物和 `task.md` Activity Log,确保报告反映完整的分析上下文。
@@ -67,13 +67,23 @@ Read the highest-round code artifact and, if present, the highest-round fix arti
67
67
  ### 4. Perform the Review
68
68
 
69
69
  Follow `.agents/workflows/feature-development.yaml` and inspect the full change context:
70
- - Capture `R=$(git rev-parse HEAD)` exactly once; reuse that R for this round's report, fingerprint, and task review fact, and do not re-read HEAD later as a substitute
71
- - `git diff --binary "$R" -- <post-review-globs>` for tracked changes
70
+ - Capture the reviewed commit `R=$(git rev-parse HEAD)` exactly once; reuse R for this round's report, snapshot tree, and task review fact, and do not re-read HEAD later as a substitute
71
+ - Call `agent-infra-internal platform-pr inspect {task-id}`. When a bound PR provides a base SHA, set the diff base to `D=$(git merge-base "$R" "{base-sha}")`. Without a PR, set `D=$R` only when tracked or untracked worktree changes exist. A clean worktree without a bound PR has no reliable complete committed range: stop and require a bound PR instead of reviewing an empty diff
72
+ - `git diff --binary "$D" -- <post-review-globs>` covers committed and uncommitted tracked changes from D to the current worktree
72
73
  - `git ls-files -o --exclude-standard -z -- <post-review-globs>` for untracked new files
73
- - Write `mode=worktree` and baseline `R` to a temporary JSON file, then call `agent-infra-internal git-workflow snapshot --input {file}` to generate the reviewed diff fingerprint `F` and reviewed snapshot tree `T` together; write both into the report
74
+ - Write `mode=worktree`, `baseline=R`, and `diffBase=D` to a temporary JSON file, then call `agent-infra-internal git-workflow snapshot --input {file}` to generate a reviewed diff fingerprint `F` for the complete committed range and a reviewed snapshot tree `T` for the current worktree; write R, D, F, and T into the report
74
75
 
76
+ > After collecting those facts, read `.agents/rules/review-method.md`, use them as readiness evidence, and run Passes 2–5 for traceability, risk lenses, counterevidence, and classification; the report must record all five passes.
75
77
  > Detailed review criteria, severity rules, and reviewer expectations live in `reference/review-criteria.md`. Read `reference/review-criteria.md` before reviewing.
76
- > Test review gate: when `git diff` touches test files, read `.agents/rules/testing-discipline.md` first and check it item by item, especially "do not add negative assertions when a positive assertion already covers the behavior".
78
+
79
+ Apply the shared five-pass protocol to code in this order:
80
+ - Pass 1 reads the complete diff, untracked files, latest code artifact, approved plan/review-plan, task source, and raw test results.
81
+ - Pass 2 maps acceptance/plan → implementation → verification and records changed lines, necessary callers/callees, state/data flow, and uncovered areas per file.
82
+ - Pass 3 reviews overall design before per-file semantics, evaluates every shared registry trigger, and reads every matched reference in full. Test changes load `.agents/rules/testing-discipline.md` through the registry's `testing-discipline` lens; do not maintain a second trigger list.
83
+ - Pass 4 checks guards, call constraints, test coverage, and narrower impact boundaries as counterevidence.
84
+ - Pass 5 reconciles findings, manual-validation, advisories, evidence types, unverified assumptions, ledger state, and verdict.
85
+
86
+ Complete the code implementation coverage in `reference/report-template.md`. Approval is forbidden when a matched reference is missing or unloaded, or when a risk gap remains unclassified.
77
87
 
78
88
  ### 5. Write the Review Report
79
89
 
@@ -85,10 +95,20 @@ Create `.agents/workspace/active/{task-id}/{review-artifact}`.
85
95
 
86
96
  Update task.md:
87
97
  - After the report, submit each new finding with `agent-infra-internal task-ledger {task-id} finding-upsert --stage code --review-artifact {review-artifact} --ordinal {n} --severity {blocker|major|minor} --evidence {review-artifact}#{anchor}`; submit prior-response dispositions with `finding-review --id {ledger-id} --status {confirmed|closed|open|needs-human-decision} --evidence {evidence}`. Do not scan ids or edit ledger rows
88
- - After all ledger writes, call `agent-infra-internal task-ledger {task-id} stage-status --stage code` exactly once. Derive the verdict and next-step branch from `stageStatus.canAdvance`, and blocker/major/minor event counts from `unresolvedFindingCounts`; only `canAdvance=true` permits Approved
98
+ - After all ledger writes, call `agent-infra-internal task-review {task-id} finalize-summary --stage code --artifact {review-artifact}` exactly once
99
+
100
+ Bind and reuse this structured mapping from that one response:
101
+
102
+ ```text
103
+ {unresolved-blockers} = stageStatus.unresolvedFindingCounts.blocker
104
+ {unresolved-major} = stageStatus.unresolvedFindingCounts.major
105
+ {unresolved-minor} = stageStatus.unresolvedFindingCounts.minor
106
+ ```
107
+
108
+ The intent atomically finalizes the report summary and returns the same ledger snapshot. Do not call `stage-status`, replace placeholders manually, or rescan the finding list. If finalization fails or a response field is missing, stop before the completion event. Derive the verdict and next-step branch from the same response's `stageStatus.canAdvance`; only `canAdvance=true` permits Approved
89
109
  - Only when `canAdvance=true`, the verdict is Approved, and `T == R^{tree}`, write `last_reviewed_commit: {R}`. Clear an old value for an Approved snapshot with uncommitted differences; otherwise preserve the existing value and do not advance it
90
110
  - For an Approved exit, collect PR and required-checks facts as defined in `reference/output-templates.md`: route uncommitted/unpushed code to `commit`, no PR to `create-pr` (except no-PR flow), non-terminal checks to `watch-pr`, and route to `complete-task` only when `HEAD == last_reviewed_commit == PR head` with checks `passed|no-required`; never route by review round alone
91
- - After handling `last_reviewed_commit`, run `agent-infra-internal task-event {task-id} review-code.completed --agent {agent} --artifact {review-artifact} --verdict {approved|changes-requested|rejected} --blockers {n} --major {n} --minor {n} --manual-validation {n}`
111
+ - After handling `last_reviewed_commit`, run `agent-infra-internal task-event {task-id} review-code.completed --agent {agent} --artifact {review-artifact} --verdict {approved|changes-requested|rejected} --blockers {unresolved-blockers} --major {unresolved-major} --minor {unresolved-minor} --manual-validation {n}`
92
112
 
93
113
  Always include the `Manual-validation: {n}` field in the done log, including when it is 0.
94
114
  `manual-validation` is the data source for the `Manual-validation` count folded into review rows in `ai task log`; do not add a parallel manual-verification field.
@@ -130,7 +150,7 @@ manual-validation counts do not influence branch selection; they are displayed o
130
150
 
131
151
  > Before rendering the final output, read `.agents/rules/next-step-output.md` and apply both of its rules: (1) render `{task-ref}` in the "Next steps" commands as the current task's short id `NN` (see that file for lookup and fallback), while other `{task-id}` placeholders (report titles, paths) keep the full TASK-id form; (2) append the `Completed at` line as the very last line of the user-facing output (this applies to every user-facing output — success, error, and early-return paths alike, not only the success path).
132
152
 
133
- Include all TUI command formats in the next-step output. If `.agents/.airc.json` configures custom TUIs (via `customTUIs`), read each tool's `name` and `invoke`, then add the matching command line in the same format (`${skillName}` becomes the skill name and `${projectName}` becomes the project name).
153
+ render the selected next-step commands through the shared helper. If `.agents/.airc.json` configures custom TUIs (via `customTUIs`), read each tool's `name` and `invoke`, then add the matching command line in the same format (`${skillName}` becomes the skill name and `${projectName}` becomes the project name).
134
154
 
135
155
  ## Completion Checklist
136
156
 
@@ -138,7 +158,7 @@ Include all TUI command formats in the next-step output. If `.agents/.airc.json`
138
158
  - [ ] Created `{review-artifact}`
139
159
  - [ ] Updated task.md and appended the Activity Log entry
140
160
  - [ ] Chose exactly one verdict branch in the user output
141
- - [ ] Informed the user of the next step (must include all TUI command formats, including any custom TUIs; do not filter)
161
+ - [ ] Rendered the selected next-step commands through the shared helper
142
162
 
143
163
  ## Notes
144
164
 
@@ -66,13 +66,23 @@ agent-infra-internal task-snapshot {task-id} --format text
66
66
  ### 4. 执行审查
67
67
 
68
68
  遵循 `.agents/workflows/feature-development.yaml`,并同时检查完整变更上下文:
69
- - 一次性记录 `R=$(git rev-parse HEAD)`;本轮报告、指纹和任务审查事实都复用该 R,禁止稍后重新读取 HEAD 代替
70
- - `git diff --binary "$R" -- <post-review-globs>` 覆盖已跟踪变更
69
+ - 一次性记录审查提交 `R=$(git rev-parse HEAD)`;本轮报告、快照树和任务审查事实都复用该 R,禁止稍后重新读取 HEAD 代替
70
+ - 调用 `agent-infra-internal platform-pr inspect {task-id}`:已绑定 PR 且返回 base SHA 时,令差异基线 `D=$(git merge-base "$R" "{base-sha}")`;无 PR 时仅在存在已跟踪或未跟踪工作区变化的前提下令 `D=$R`。无 PR 且工作区干净时无法可靠确定完整提交范围,必须停止并要求先绑定 PR,不得用空 diff 继续审查
71
+ - `git diff --binary "$D" -- <post-review-globs>` 覆盖 `D` 到当前工作区的已提交与未提交跟踪变更
71
72
  - `git ls-files -o --exclude-standard -z -- <post-review-globs>` 覆盖未跟踪新文件
72
- - 把 `mode=worktree`、基线 `R` 写入临时 JSON,调用 `agent-infra-internal git-workflow snapshot --input {file}` 一次生成审查差异指纹 `F` 与审查快照树 `T`,并写入报告
73
+ - 把 `mode=worktree`、`baseline=R`、`diffBase=D` 写入临时 JSON,调用 `agent-infra-internal git-workflow snapshot --input {file}` 一次生成覆盖完整提交范围的审查差异指纹 `F` 与当前工作区审查快照树 `T`;把 `R`、`D`、`F`、`T` 全部写入报告
73
74
 
75
+ > 上述事实采集完成后,先读取 `.agents/rules/review-method.md`,以其作为 readiness 证据并按 Pass 2–5 完成追踪、风险镜头、反证和归类;报告必须记录全部五遍覆盖。
74
76
  > 详细审查标准、严重程度划分和 reviewer 关注点见 `reference/review-criteria.md`。执行此步骤前先读取 `reference/review-criteria.md`。
75
- > 测试审查硬门禁:当 `git diff` 触及测试文件时,必须先读取 `.agents/rules/testing-discipline.md` 并逐条核对(尤其"正向已覆盖时不应再加反向断言")。
77
+
78
+ 代码阶段按以下顺序落实共享五遍协议:
79
+ - Pass 1 读取完整 diff、未跟踪文件、最新 code artifact、已批准 plan/review-plan、任务来源和测试原始结果。
80
+ - Pass 2 建立验收/方案—实现—验证映射,并逐文件记录 changed lines、必要调用方/被调用方、状态/数据流和未覆盖区域。
81
+ - Pass 3 先检查整体设计,再检查逐文件语义;逐行判断共享风险镜头注册表,完整读取所有命中 reference。测试变更由注册表中的 `testing-discipline` 镜头加载 `.agents/rules/testing-discipline.md`,不得维护另一份触发清单。
82
+ - Pass 4 检查保护条件、调用约束、测试覆盖和更窄影响范围等反证。
83
+ - Pass 5 核对 finding、manual-validation、advisory、证据类型、未验证假设、账本和 verdict。
84
+
85
+ 报告必须填写 `reference/report-template.md` 中的代码实现专项覆盖;镜头命中但 reference 缺失/未加载,或风险缺口未分类时不得给出通过结论。
76
86
 
77
87
  ### 5. 编写审查报告
78
88
 
@@ -83,10 +93,20 @@ agent-infra-internal task-snapshot {task-id} --format text
83
93
  ### 6. 更新任务状态
84
94
 
85
95
  - 报告完成后,新 finding 逐条调用 `agent-infra-internal task-ledger {task-id} finding-upsert --stage code --review-artifact {review-artifact} --ordinal {n} --severity {blocker|major|minor} --evidence {review-artifact}#{anchor}`;复核上一轮响应时调用 `finding-review --id {ledger-id} --status {confirmed|closed|open|needs-human-decision} --evidence {相称证据}`。不得扫描编号或手写账本行
86
- - 全部账本写入完成后只调用一次 `agent-infra-internal task-ledger {task-id} stage-status --stage code`。以 `stageStatus.canAdvance` 决定 verdict 和下一步,并以 `unresolvedFindingCounts` 填写 blocker/major/minor;仅 `canAdvance=true` 可用 Approved
96
+ - 全部账本写入完成后只调用一次 `agent-infra-internal task-review {task-id} finalize-summary --stage code --artifact {review-artifact}`
97
+
98
+ 从该次返回值绑定并复用以下结构化映射:
99
+
100
+ ```text
101
+ {unresolved-blockers} = stageStatus.unresolvedFindingCounts.blocker
102
+ {unresolved-major} = stageStatus.unresolvedFindingCounts.major
103
+ {unresolved-minor} = stageStatus.unresolvedFindingCounts.minor
104
+ ```
105
+
106
+ 该 intent 原子最终化报告摘要并返回同一次账本快照;不得再调用 `stage-status`、手工替换占位符或扫描问题清单。最终化失败或返回字段缺失时,停止在完成事件之前。以同一次返回的 `stageStatus.canAdvance` 决定 verdict 和下一步;仅 `canAdvance=true` 可用 Approved
87
107
  - 仅当 `canAdvance=true`、本轮结论为 Approved 且 `T == R^{tree}` 时写入 `last_reviewed_commit: {R}`;Approved 快照包含未提交差异时清除旧值。否则保留既有值,不得推进或清空
88
108
  - Approved 出口继续按 `reference/output-templates.md` 采集 PR 与 required-checks 事实:未提交/未推送走 `commit`,无 PR 走 `create-pr`(无 PR 流程除外),checks 未终态走 `watch-pr`,仅 `HEAD == last_reviewed_commit == PR head` 且 checks 为 `passed|no-required` 时走 `complete-task`;不得仅按审查轮次分流
89
- - 完成 `last_reviewed_commit` 处理后执行 `agent-infra-internal task-event {task-id} review-code.completed --agent {agent} --artifact {review-artifact} --verdict {approved|changes-requested|rejected} --blockers {n} --major {n} --minor {n} --manual-validation {n}`
109
+ - 完成 `last_reviewed_commit` 处理后执行 `agent-infra-internal task-event {task-id} review-code.completed --agent {agent} --artifact {review-artifact} --verdict {approved|changes-requested|rejected} --blockers {unresolved-blockers} --major {unresolved-major} --minor {unresolved-minor} --manual-validation {n}`
90
110
 
91
111
  完成日志必须始终写入 `Manual-validation: {n}` 字段,0 也保留。
92
112
  `manual-validation` 是 `ai task log` 中 review 行「人工校验点」(EN `Manual-validation`)计数的数据源;不要新增并行人工验证字段。
@@ -128,7 +148,7 @@ manual-validation 的数量不参与分支选择,只作为人工校验计数
128
148
 
129
149
  > 渲染最终输出前先读取 `.agents/rules/next-step-output.md` 并落实其两类规则:(1) 「下一步」命令的 `{task-ref}` 渲染为当前任务短号 `NN`(取值与回退见该文件),其他 `{task-id}` 占位(报告标题、路径)保持完整 TASK-id 形式;(2) 在面向用户输出的绝对最后一行追加 `Completed at` 收尾行(成功、错误、早退等任何面向用户输出都适用,不限于校验通过的成功态)。
130
150
 
131
- 向用户展示下一步时,必须包含所有 TUI 命令格式。如果 `.agents/.airc.json` 中配置了自定义 TUI(`customTUIs`),读取每个工具的 `name` 和 `invoke`,按同样格式补充对应命令行(`${skillName}` 替换为技能名,`${projectName}` 替换为项目名)。
151
+ 向用户通过统一 helper 渲染已选场景的下一步命令。如果 `.agents/.airc.json` 中配置了自定义 TUI(`customTUIs`),读取每个工具的 `name` 和 `invoke`,按同样格式补充对应命令行(`${skillName}` 替换为技能名,`${projectName}` 替换为项目名)。
132
152
 
133
153
  ## 完成检查清单
134
154
 
@@ -136,7 +156,7 @@ manual-validation 的数量不参与分支选择,只作为人工校验计数
136
156
  - [ ] 已创建 `{review-artifact}`
137
157
  - [ ] 已更新 task.md 并追加 Activity Log
138
158
  - [ ] 用户输出中只选择了一个审查结论分支
139
- - [ ] 告知了用户下一步(必须展示所有 TUI 的命令格式,含自定义 TUI,不要筛选)
159
+ - [ ] 已通过统一 helper 渲染已选场景的下一步命令
140
160
 
141
161
  ## 注意事项
142
162
 
@@ -19,6 +19,9 @@
19
19
  "file_pattern": "review-code.md|review-code-r{N}.md",
20
20
  "required_sections": [
21
21
  "Review Summary",
22
+ "Review Coverage Declaration",
23
+ "Code Implementation Coverage",
24
+ "Traceability Matrix",
22
25
  "Findings",
23
26
  "Non-blocking Advisories",
24
27
  "Manual Validation Items",
@@ -33,10 +36,14 @@
33
36
  "^\\$ ",
34
37
  "^- \\*\\*Overall Verdict\\*\\*[::]\\s*(?:通过|需要修改|拒绝|Approved|Changes Requested|Rejected)\\s*$",
35
38
  "^- \\*\\*Review Baseline Commit\\*\\*[::]\\s*\\S",
39
+ "^- \\*\\*Reviewed Diff Base\\*\\*[::]\\s*[0-9a-f]{40,64}\\s*$",
36
40
  "^- \\*\\*Reviewed Diff Fingerprint\\*\\*[::]\\s*sha256:[0-9a-f]{64}\\s*$",
37
41
  "^- \\*\\*Reviewed Snapshot Tree\\*\\*[::]\\s*[0-9a-f]{40,64}\\s*$"
38
42
  ]
39
43
  },
44
+ "review-summary": {
45
+ "stage": "code"
46
+ },
40
47
  "review-fact": {},
41
48
  "activity-log": {
42
49
  "expected_action_pattern": "(Review Code|Code Review) \\(Round \\d+\\)"
@@ -19,6 +19,9 @@
19
19
  "file_pattern": "review-code.md|review-code-r{N}.md",
20
20
  "required_sections": [
21
21
  "审查摘要",
22
+ "检视覆盖声明",
23
+ "代码实现专项覆盖",
24
+ "追踪矩阵",
22
25
  "问题清单",
23
26
  "非阻塞建议",
24
27
  "人工校验项",
@@ -33,10 +36,14 @@
33
36
  "^\\$ ",
34
37
  "^- \\*\\*总体结论\\*\\*[::]\\s*(?:通过|需要修改|拒绝|Approved|Changes Requested|Rejected)\\s*$",
35
38
  "^- \\*\\*审查基线提交\\*\\*[::]\\s*\\S",
39
+ "^- \\*\\*审查差异基线\\*\\*[::]\\s*[0-9a-f]{40,64}\\s*$",
36
40
  "^- \\*\\*审查差异指纹\\*\\*[::]\\s*sha256:[0-9a-f]{64}\\s*$",
37
41
  "^- \\*\\*审查快照树\\*\\*[::]\\s*[0-9a-f]{40,64}\\s*$"
38
42
  ]
39
43
  },
44
+ "review-summary": {
45
+ "stage": "code"
46
+ },
40
47
  "review-fact": {},
41
48
  "activity-log": {
42
49
  "expected_action_pattern": "(Review Code|Code Review) \\(Round \\d+\\)"
@@ -0,0 +1,25 @@
1
+ # Concurrency Risk Review
2
+
3
+ ## Scope
4
+
5
+ Use when changes touch asynchronous coordination, shared state, locks, retries, idempotency, races, cancellation, or timeouts.
6
+
7
+ ## Review Questions
8
+
9
+ - Are shared-state ownership, atomic boundaries, and visibility explicit?
10
+ - Do retries, timeouts, cancellation, and duplicate delivery remain idempotent and resource-safe?
11
+ - Can competing order or failure interleavings cause lost updates, duplicate side effects, or deadlocks?
12
+
13
+ ## Evidence Requirements
14
+
15
+ Record key state transitions, event order, and synchronization boundaries. Support conclusions with deterministic concurrency tests, call chains, or data flows.
16
+
17
+ ## Common Counterexamples
18
+
19
+ - Inferring concurrency safety from one successful sequential execution.
20
+ - Checking only that a lock exists without its granularity, ordering, and release paths.
21
+ - Replacing explainable evidence with one successful randomized stress run.
22
+
23
+ ## When Closure Is Not Possible
24
+
25
+ Record reproducible races or leaks as findings, checks requiring a real scheduler or load environment as manual-validation, and uncovered interleavings as a gap.
@@ -0,0 +1,25 @@
1
+ # 并发风险检视
2
+
3
+ ## 适用范围
4
+
5
+ 当变更触及异步协调、共享状态、锁、重试、幂等、竞态、取消或超时时使用。
6
+
7
+ ## 检视问题
8
+
9
+ - 共享状态的所有权、原子边界和可见性是否明确。
10
+ - 重试、超时、取消和重复交付是否保持幂等且不会泄漏资源。
11
+ - 竞争顺序和失败交错是否会产生丢失更新、重复副作用或死锁。
12
+
13
+ ## 证据要求
14
+
15
+ 记录关键状态转换、事件顺序和同步边界;使用确定性并发测试、调用链或数据流支撑结论。
16
+
17
+ ## 常见反例
18
+
19
+ - 单次顺序执行通过就推断并发安全。
20
+ - 只检查加锁存在,不检查锁粒度、顺序和释放路径。
21
+ - 用随机压力测试的单次成功替代可解释证据。
22
+
23
+ ## 无法闭环时
24
+
25
+ 可重现的竞态或资源泄漏形成 finding;需要真实调度器或负载环境的检查进入 manual-validation;未覆盖交错记录为 gap。
@@ -0,0 +1,27 @@
1
+ # Cross-platform Risk Review
2
+
3
+ ## Scope
4
+
5
+ Use when changes touch OS branches, path or case behavior, shells and commands, permissions, symlinks, newlines or encodings, signals and processes, or platform fallbacks.
6
+
7
+ When the change also touches test files and must express real platform guards or test execution scope, read `.agents/rules/cross-platform-tests.md` in full. That second-level rule governs test scope only; this file governs implementation semantics. Do not load the second level when tests are unchanged.
8
+
9
+ ## Review Questions
10
+
11
+ - Do paths, shells, permissions, and process behavior use the real semantics of each target platform?
12
+ - Do platform fallbacks preserve consistent outcomes and distinguish unsupported behavior from runtime failure?
13
+ - Do tests execute on genuinely supported platforms instead of simulating coverage with early returns?
14
+
15
+ ## Evidence Requirements
16
+
17
+ Record affected platforms, implementation branches, and fallback paths. When test scope is involved, also record second-level rule readiness and `onPlatforms()` guards.
18
+
19
+ ## Common Counterexamples
20
+
21
+ - Inferring equivalence across platforms from success on the development platform.
22
+ - Simulating path or shell behavior with string concatenation.
23
+ - Loading the test-guard rule unconditionally for formal completeness.
24
+
25
+ ## When Closure Is Not Possible
26
+
27
+ Record reproducible platform defects as findings, checks that only a specific real platform can close as manual-validation, and actual platform risks left uncovered by missing, unloaded, or insufficient rules as a gap. A structural gate cannot replace semantic judgment.
@@ -0,0 +1,27 @@
1
+ # 跨平台风险检视
2
+
3
+ ## 适用范围
4
+
5
+ 当变更触及 OS 分支、路径与大小写、shell/命令、权限、符号链接、换行/编码、信号/进程或平台回退时使用。
6
+
7
+ 若变更同时触及测试文件,且需要表达真实平台守卫或测试运行范围,继续完整读取 `.agents/rules/cross-platform-tests.md`。该二级规则只约束测试运行范围;本文件负责实现层的平台语义。没有测试变更时不加载二级规则。
8
+
9
+ ## 检视问题
10
+
11
+ - 路径、shell、权限和进程行为是否使用目标平台真实语义。
12
+ - 平台回退是否保留一致结果,并区分不支持与运行失败。
13
+ - 测试是否在真实支持平台执行,而非用测试体内早返回伪装覆盖。
14
+
15
+ ## 证据要求
16
+
17
+ 记录受影响平台、实现分支和回退路径;涉及测试范围时同时记录二级规则加载证据和 `onPlatforms()` 守卫。
18
+
19
+ ## 常见反例
20
+
21
+ - 用当前开发平台成功推断所有平台等价。
22
+ - 以字符串拼接模拟路径或 shell 行为。
23
+ - 为形式完整无条件加载测试守卫规则。
24
+
25
+ ## 无法闭环时
26
+
27
+ 可复现的平台缺陷形成 finding;只能在特定真实平台闭环的事项进入 manual-validation;规则缺失、未加载或未覆盖的实际平台风险记录为 gap,不得用结构 gate 替代语义判断。
@@ -0,0 +1,13 @@
1
+ # Documentation Anti-patterns
2
+
3
+ When reviewing new or changed documentation, require it to describe the current behavior after the change instead of using historical differences as a substitute for current facts.
4
+
5
+ ## Backward-looking Descriptions of Removed Functionality
6
+
7
+ When functionality has been removed, current-behavior documentation should not keep saying that the functionality "no longer exists" or "was removed." Such wording keeps a deleted concept in the set of current knowledge that readers must understand.
8
+
9
+ Terms such as `不再`, `no longer`, `已被移除`, `removed`, and `used to` can locate candidate text, but a match is not a finding by itself. Judge the documentation's purpose and change context:
10
+
11
+ - Current reference documentation, rules, and usage instructions should directly describe supported behavior.
12
+ - Migration guides, changelogs, and historical records may preserve necessary before-and-after differences when their historical or migration context is explicit.
13
+ - Record a finding only when backward-looking wording preserves a deleted concept as current knowledge, and cite the exact file and line.
@@ -0,0 +1,13 @@
1
+ # 文档反模式
2
+
3
+ 审查新增或修改的文档时,文档应描述变更后的当前行为,而不是用历史差异替代当前事实。
4
+
5
+ ## 已删除功能的反向描述
6
+
7
+ 当功能已经删除时,面向当前行为的文档不应继续写“该功能不再存在”或“该能力已被移除”。这类反向描述会让已删除概念继续成为读者必须理解的现行知识。
8
+
9
+ `不再`、`no longer`、`已被移除`、`removed` 和 `used to` 等词可用于定位候选文本,但命中本身不是 finding。审查者必须结合文档用途和变更上下文判断:
10
+
11
+ - 当前参考文档、规则和使用说明应直接描述现在支持的行为。
12
+ - 迁移指南、变更日志和历史记录可以保留必要的前后差异,但应明确其历史或迁移语境。
13
+ - 只有当反向措辞把已删除概念保留为现行知识时,才应登记 finding,并引用准确的文件和行号。
@@ -0,0 +1,25 @@
1
+ # Migration and Compatibility Risk Review
2
+
3
+ ## Scope
4
+
5
+ Use when changes touch persistent formats, schemas, configuration/frontmatter, compatibility reads, migrations, or rollback behavior.
6
+
7
+ ## Review Questions
8
+
9
+ - Can old data or configuration be read safely, and is the post-write version boundary explicit?
10
+ - Is migration repeatable, and can execution recover or continue after partial failure?
11
+ - Does the rollback path match the compatibility window between old and new formats?
12
+
13
+ ## Evidence Requirements
14
+
15
+ Record the transition from old input to new state, version decisions, and failure states. Prefer migration tests, fixtures, state transitions, or specification conflicts.
16
+
17
+ ## Common Counterexamples
18
+
19
+ - Testing only fresh installation and ignoring existing state.
20
+ - Assuming migration succeeds once while ignoring retries and partial writes.
21
+ - Replacing data-semantic validation with format-existence checks.
22
+
23
+ ## When Closure Is Not Possible
24
+
25
+ Record reproducible corruption or compatibility failures as findings, checks requiring real historical data as manual-validation, and missing samples or rollback evidence as a gap.
@@ -0,0 +1,25 @@
1
+ # 迁移与兼容风险检视
2
+
3
+ ## 适用范围
4
+
5
+ 当变更触及持久化格式、schema、配置/frontmatter、兼容读取、迁移或回滚行为时使用。
6
+
7
+ ## 检视问题
8
+
9
+ - 旧数据或旧配置能否被安全读取,写入后的版本边界是否明确。
10
+ - 迁移是否可重复执行,部分失败后能否恢复或继续。
11
+ - 回滚路径是否与新旧格式的兼容窗口一致。
12
+
13
+ ## 证据要求
14
+
15
+ 记录旧输入到新状态的转换、版本判定和失败状态;优先使用迁移测试、fixture、状态转换或规范冲突。
16
+
17
+ ## 常见反例
18
+
19
+ - 只验证全新安装,不验证已有状态。
20
+ - 假设迁移一次成功,忽略重试和部分写入。
21
+ - 用格式存在性测试替代数据语义验证。
22
+
23
+ ## 无法闭环时
24
+
25
+ 可复现的数据损坏或兼容失败形成 finding;需要真实历史数据的验证进入 manual-validation;缺少样本或回滚证据时记录 gap。
@@ -17,11 +17,9 @@ Prohibitions:
17
17
  - never mix text from different branches
18
18
  - if `Blocker > 0`, never output an approval template
19
19
  - never count manual-validation findings as blockers / major issues / minor issues, and never use them to trigger Branch B/C/D
20
- - always include every TUI command format in the selected branch
20
+ - generate `{next-step-commands}` for the selected branch through the shared helper
21
21
  - The count line shows 5 numbers. Manual-validation (`{e}`) does not affect selection. `Human-decision` (`{h}`) counts this stage's `needs-human-decision` rows; because those rows are unresolved, `{h} > 0` means `canAdvance=false`. Expand the "Pending human-decision pre-block" from `.agents/rules/next-step-output.md` and show revision and re-review paths only.
22
22
 
23
- For Branches B/C/D, follow the revision commands with re-review commands: `/review-code {task-ref}`, `/{{project}}:review-code {task-ref}`, and `$review-code {task-ref}`.
24
-
25
23
  ### Branch A: Approved with No Findings
26
24
 
27
25
  Do not route by review round. Compare reviewed snapshot tree `T` with the tree of baseline `R`, then read `prFlow` / `pr_number`; when a PR exists, call `agent-infra-internal platform-checks inspect {task-id}`. Select exactly one mutually exclusive exit:
@@ -45,51 +43,51 @@ Reminder: manual-validation findings must be carried in the PR description as a
45
43
 
46
44
  #### Branch A1: Commit or Push
47
45
 
46
+ Populate `{next-step-commands}` for this scenario by running `agent-infra-internal agent-client next-steps --skill commit --task-ref {task-ref}`.
47
+
48
48
  ```text
49
49
  Next step - commit or push the code:
50
- - Claude Code / OpenCode: /commit {task-ref}
51
- - Gemini CLI: /{{project}}:commit {task-ref}
52
- - Codex CLI: $commit {task-ref}
50
+ {next-step-commands}
53
51
  ```
54
52
 
55
53
  #### Branch A2: Create a Pull Request
56
54
 
55
+ Populate `{next-step-commands}` for this scenario by running `agent-infra-internal agent-client next-steps --skill create-pr --task-ref {task-ref}`.
56
+
57
57
  ```text
58
58
  Next step - create a Pull Request:
59
- - Claude Code / OpenCode: /create-pr {task-ref}
60
- - Gemini CLI: /{{project}}:create-pr {task-ref}
61
- - Codex CLI: $create-pr {task-ref}
59
+ {next-step-commands}
62
60
  ```
63
61
 
64
62
  #### Branch A3: Watch Required Checks
65
63
 
64
+ Populate `{next-step-commands}` for this scenario by running `agent-infra-internal agent-client next-steps --skill watch-pr --task-ref {task-ref}`.
65
+
66
66
  ```text
67
67
  Next step - watch PR checks:
68
- - Claude Code / OpenCode: /watch-pr {task-ref}
69
- - Gemini CLI: /{{project}}:watch-pr {task-ref}
70
- - Codex CLI: $watch-pr {task-ref}
68
+ {next-step-commands}
71
69
  ```
72
70
 
73
71
  #### Branch A4: Complete and Archive
74
72
 
73
+ Populate `{next-step-commands}` for this scenario by running `agent-infra-internal agent-client next-steps --skill complete-task --task-ref {task-ref}`.
74
+
75
75
  ```text
76
76
  Next step - complete and archive the task:
77
- - Claude Code / OpenCode: /complete-task {task-ref}
78
- - Gemini CLI: /{{project}}:complete-task {task-ref}
79
- - Codex CLI: $complete-task {task-ref}
77
+ {next-step-commands}
80
78
  ```
81
79
 
82
80
  ### Branch B: Changes Requested (Major / Minor)
83
81
 
82
+ Populate `{next-step-commands}` for this scenario by running `agent-infra-internal agent-client next-steps --skill code-task --task-ref {task-ref}`.
83
+
84
84
  ```text
85
85
  Task {task-id} review completed. Verdict: changes requested.
86
86
  - Blockers: 0 | Major: {n} | Minor: {n} | Manual-validation: {e} | Human-decision: {h}
87
87
  - Review report: .agents/workspace/active/{task-id}/{review-artifact}
88
88
 
89
89
  Next step - fix the findings:
90
- - Claude Code / OpenCode: /code-task {task-ref}
91
- - Gemini CLI: /{{project}}:code-task {task-ref}
92
- - Codex CLI: $code-task {task-ref}
90
+ {next-step-commands}
93
91
 
94
92
  [When manual-validation > 0, append this final line:]
95
93
  Reminder: manual-validation findings must be carried in the PR description as a "manual verification required" checklist and should not trigger /code-task.
@@ -97,15 +95,15 @@ Reminder: manual-validation findings must be carried in the PR description as a
97
95
 
98
96
  ### Branch C: Changes Requested
99
97
 
98
+ Populate `{next-step-commands}` for this scenario by running `agent-infra-internal agent-client next-steps --skill code-task --task-ref {task-ref}`.
99
+
100
100
  ```text
101
101
  Task {task-id} review completed. Verdict: changes requested.
102
102
  - Blockers: {n} | Major: {n} | Minor: {n} | Manual-validation: {e} | Human-decision: {h}
103
103
  - Review report: .agents/workspace/active/{task-id}/{review-artifact}
104
104
 
105
105
  Next step - fix the findings:
106
- - Claude Code / OpenCode: /code-task {task-ref}
107
- - Gemini CLI: /{{project}}:code-task {task-ref}
108
- - Codex CLI: $code-task {task-ref}
106
+ {next-step-commands}
109
107
 
110
108
  [When manual-validation > 0, append this final line:]
111
109
  Reminder: manual-validation findings must be carried in the PR description as a "manual verification required" checklist and should not trigger /code-task.
@@ -113,15 +111,15 @@ Reminder: manual-validation findings must be carried in the PR description as a
113
111
 
114
112
  ### Branch D: Rejected
115
113
 
114
+ Populate `{next-step-commands}` for this scenario by running `agent-infra-internal agent-client next-steps --skill plan-task --task-ref {task-ref}`.
115
+
116
116
  ```text
117
117
  Task {task-id} review completed. Verdict: rejected, re-design the technical plan.
118
118
  - Blockers: {n} | Major: {n} | Minor: {n} | Manual-validation: {e} | Human-decision: {h}
119
119
  - Review report: .agents/workspace/active/{task-id}/{review-artifact}
120
120
 
121
121
  Next step - re-design the technical plan:
122
- - Claude Code / OpenCode: /plan-task {task-ref}
123
- - Gemini CLI: /{{project}}:plan-task {task-ref}
124
- - Codex CLI: $plan-task {task-ref}
122
+ {next-step-commands}
125
123
 
126
124
  > Note: Rejected means the implementation direction needs to be reworked end-to-end, not patched locally. Core artifact lifecycle branch #7 refuses a direct `/code-task` and requires a fresh plan first.
127
125