@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
package/README.md CHANGED
@@ -35,9 +35,14 @@ agent-infra standardizes that shared infrastructure. It gives every supported AI
35
35
  ## See it in Action
36
36
 
37
37
  <p align="center">
38
- <img src="./assets/demo-init.gif" alt="CLI install and initialize demo" width="100%" style="max-width: 720px;">
38
+ <img src="./assets/demo-init.gif" alt="CLI install and initialize demo" width="720">
39
39
  </p>
40
40
 
41
+ > The demo is stored with Git LFS. Install Git LFS and run `git lfs install`
42
+ > before cloning, or run `git lfs pull` in an existing checkout. If the image
43
+ > is a small text pointer or is missing, verify `git lfs ls-files`, then retry
44
+ > `git lfs pull`.
45
+
41
46
  Once initialized, open the project in your AI TUI and install the latest skills:
42
47
 
43
48
  ```bash
@@ -51,9 +56,9 @@ Once initialized, open the project in your AI TUI and install the latest skills:
51
56
  ```bash
52
57
  /import-issue 42 # AI reads the issue, creates a task, extracts requirements
53
58
  /analyze-task <task-id> # AI scans the codebase, finds the root cause, writes analysis.md
54
- /review-analysis <task-id> # AI self-reviews: "Approved. 0 blockers — proceed to design."
59
+ /review-analysis <task-id> # An isolated reviewer checks the analysis
55
60
  /plan-task <task-id> # AI proposes a fix plan
56
- /review-plan <task-id> # AI self-reviews the plan: "Approved. Ready for implementation."
61
+ /review-plan <task-id> # A fresh isolated reviewer checks the plan
57
62
  ```
58
63
 
59
64
  > **You review the plan and reply in natural language:**
@@ -67,7 +72,7 @@ Just fix it at the application layer in LoginService.
67
72
 
68
73
  ```bash
69
74
  /code-task <task-id> # AI writes the fix, adds a test for user+tag@example.com — green
70
- /review-code <task-id> # AI reviews its own code: "0 blockers, 1 minor (missing JSDoc)."
75
+ /review-code <task-id> # A fresh isolated reviewer reports one minor finding
71
76
  /code-task <task-id> # AI fixes the minor issue and re-validates
72
77
  /commit
73
78
  /create-pr <task-id> # PR opened, auto-linked to issue #42
@@ -136,7 +141,7 @@ ai init
136
141
  # or: agent-infra init
137
142
  ```
138
143
 
139
- The CLI collects project metadata, installs the `update-agent-infra` seed command for all supported AI TUIs, and generates `.agents/.airc.json`.
144
+ The CLI collects project metadata, lets you select the enabled Agent Clients, installs their `update-agent-infra` seed commands, and generates `.agents/.airc.json`.
140
145
 
141
146
  > `ai` is a shorthand for `agent-infra`. Both commands are equivalent.
142
147
 
@@ -155,11 +160,22 @@ This detects the packaged template version and renders all managed files. The sa
155
160
 
156
161
  ## Core Commands
157
162
 
163
+ Manage the four built-in Agent Clients independently from the project lifecycle:
164
+
165
+ ```bash
166
+ ai agent-client list
167
+ ai agent-client status
168
+ ai agent-client enable codex
169
+ ai agent-client disable gemini-cli
170
+ ai agent-client configure
171
+ ```
172
+
158
173
  The most-used lifecycle commands, in delivery order. The command prefix varies by TUI (`/skill` in Claude Code/OpenCode, `$skill` in Codex, `/{{project}}:skill` in Gemini CLI); the workflow semantics stay the same.
159
174
 
160
175
  | Command | Purpose |
161
176
  |---------|---------|
162
177
  | `create-task` / `import-issue` | Start a task from a description or a GitHub Issue |
178
+ | `run-task` | Resume and orchestrate the lifecycle in Claude Code with fresh isolated executors/reviewers until a safe commit or stable pause; Codex currently fails closed because its multi-agent runtime does not expose the required lifecycle events |
163
179
  | `analyze-task` → `review-analysis` | Capture scope and risks, then review the analysis |
164
180
  | `plan-task` → `review-plan` | Design the approach, then review the plan |
165
181
  | `code-task` → `review-code` | Implement and test, then run a structured code review |
@@ -192,6 +208,7 @@ In-depth guides live under [`docs/en/`](./docs/en/README.md):
192
208
  - [Architecture Overview](./docs/en/architecture.md) — bootstrap CLI, end-to-end flow, layered architecture
193
209
  - [Platform Support](./docs/en/platform-support.md) — macOS, Linux, Windows; sandbox engines and resources
194
210
  - [Sandbox](./docs/en/sandbox.md) — sandbox aliases, host-sandbox file exchange, user-level dotfiles channel
211
+ - [Benchmark Contract and Threat Model](./docs/en/benchmark.md) — versioned benchmark schemas, trust boundaries, and security guarantees
195
212
  - [Feishu Bridge](./docs/en/feishu-bridge.md) — configure the Feishu long-connection adapter, command routing, permissions, and TUI selection
196
213
  - [Built-in AI Skills](./docs/en/skills.md) — the full skill catalog by use case
197
214
  - [Custom Skills](./docs/en/custom-skills.md) — create and sync project-specific skills
package/README.zh-CN.md CHANGED
@@ -35,9 +35,13 @@ agent-infra 的目标就是把这层共享基础设施标准化。它为所有
35
35
  ## 实战演示
36
36
 
37
37
  <p align="center">
38
- <img src="./assets/demo-init.gif" alt="CLI 安装初始化演示" width="100%" style="max-width: 720px;">
38
+ <img src="./assets/demo-init.gif" alt="CLI 安装初始化演示" width="720">
39
39
  </p>
40
40
 
41
+ > 演示动画通过 Git LFS 存储。克隆前请安装 Git LFS 并运行 `git lfs install`;
42
+ > 已有检出可运行 `git lfs pull`。如果图片变成很小的文本指针或缺失,请先用
43
+ > `git lfs ls-files` 核对跟踪状态,再重试 `git lfs pull`。
44
+
41
45
  完成初始化后,在你的 AI TUI 中打开项目并安装最新 skills:
42
46
 
43
47
  ```bash
@@ -51,9 +55,9 @@ agent-infra 的目标就是把这层共享基础设施标准化。它为所有
51
55
  ```bash
52
56
  /import-issue 42 # AI 读取 Issue,创建任务,提取需求
53
57
  /analyze-task <task-id> # AI 扫描代码库,定位根因,输出 analysis.md
54
- /review-analysis <task-id> # AI 自审:“通过。0 阻塞项 —— 可进入方案设计。”
58
+ /review-analysis <task-id> # 隔离 reviewer 审查分析产物
55
59
  /plan-task <task-id> # AI 提出修复方案
56
- /review-plan <task-id> # AI 自审方案:“通过,可进入编码。”
60
+ /review-plan <task-id> # fresh 隔离 reviewer 审查方案
57
61
  ```
58
62
 
59
63
  > **你审查方案后用自然语言回复:**
@@ -67,7 +71,7 @@ agent-infra 的目标就是把这层共享基础设施标准化。它为所有
67
71
 
68
72
  ```bash
69
73
  /code-task <task-id> # AI 编写修复代码,添加 user+tag@example.com 测试 —— 通过
70
- /review-code <task-id> # AI 审查自己的实现:“0 阻塞项,1 次要(缺少 JSDoc)。”
74
+ /review-code <task-id> # fresh 隔离 reviewer 报告一个次要问题
71
75
  /code-task <task-id> # AI 修复次要问题并重新验证
72
76
  /commit
73
77
  /create-pr <task-id> # PR 已创建,自动关联 Issue #42
@@ -136,7 +140,7 @@ ai init
136
140
  # 或:agent-infra init
137
141
  ```
138
142
 
139
- CLI 会收集项目元数据,向所有支持的 AI TUI 安装 `update-agent-infra` 种子命令,并生成 `.agents/.airc.json`。
143
+ CLI 会收集项目元数据,让你选择启用的 Agent Client,为其安装 `update-agent-infra` 种子命令,并生成 `.agents/.airc.json`。
140
144
 
141
145
  > `ai` 是 `agent-infra` 的简写命令,两者等价。
142
146
 
@@ -155,11 +159,22 @@ CLI 会收集项目元数据,向所有支持的 AI TUI 安装 `update-agent-in
155
159
 
156
160
  ## 核心命令
157
161
 
162
+ 以下命令用于独立管理四个内建 Agent Client:
163
+
164
+ ```bash
165
+ ai agent-client list
166
+ ai agent-client status
167
+ ai agent-client enable codex
168
+ ai agent-client disable gemini-cli
169
+ ai agent-client configure
170
+ ```
171
+
158
172
  最常用的生命周期命令,按交付顺序排列。命令前缀因 TUI 而异(Claude Code/OpenCode 用 `/skill`,Codex 用 `$skill`,Gemini CLI 用 `/{{project}}:skill`),工作流语义保持一致。
159
173
 
160
174
  | 命令 | 用途 |
161
175
  |------|------|
162
176
  | `create-task` / `import-issue` | 从描述或 GitHub Issue 创建任务 |
177
+ | `run-task` | 在 Claude Code 中从当前状态续跑生命周期,用 fresh 隔离 executor/reviewer 推进到安全提交或稳定暂停;Codex 当前因多代理运行时未暴露所需生命周期事件而失败关闭 |
163
178
  | `analyze-task` → `review-analysis` | 明确范围与风险,再审查分析 |
164
179
  | `plan-task` → `review-plan` | 设计实现路径,再审查方案 |
165
180
  | `code-task` → `review-code` | 实现并测试,再执行结构化代码审查 |
@@ -192,6 +207,7 @@ my-project/
192
207
  - [架构概览](./docs/zh-CN/architecture.md) — 引导 CLI、端到端流程、分层架构
193
208
  - [平台支持](./docs/zh-CN/platform-support.md) — macOS、Linux、Windows;沙箱引擎与资源配置
194
209
  - [沙箱](./docs/zh-CN/sandbox.md) — 沙箱 aliases、宿主-沙箱文件交换、用户级 dotfiles 通道
210
+ - [Benchmark 契约与威胁模型](./docs/zh-CN/benchmark.md) — 版本化 benchmark schema、信任边界与安全保证
195
211
  - [飞书桥接](./docs/zh-CN/feishu-bridge.md) — 配置飞书长连接 adapter、命令路由、权限和 TUI 选择
196
212
  - [内置 AI Skills](./docs/zh-CN/skills.md) — 按使用场景分组的完整 skill 清单
197
213
  - [自定义 Skills](./docs/zh-CN/custom-skills.md) — 创建并同步项目专属 skill
package/bin/cli.ts CHANGED
@@ -15,6 +15,7 @@ const USAGE = `agent-infra ${VERSION} - bootstrap AI collaboration infrastructur
15
15
  Usage: ai <command> [options]
16
16
 
17
17
  Commands:
18
+ agent-client List, inspect, enable, disable, or configure Agent Clients
18
19
  cp <ssh-alias> Copy local clipboard image to a remote macOS clipboard or Linux sandbox over SSH
19
20
  decide Record a ruling; code-stage decisions require explicit implementation intent
20
21
  help Show this help message
@@ -71,6 +72,17 @@ async function importCommand(importPath: string) {
71
72
  }
72
73
 
73
74
  switch (command) {
75
+ case 'agent-client': {
76
+ const imported = await importCommand('../lib/agent-client.ts');
77
+ if (!imported) break;
78
+ const { cmdAgentClient } = imported;
79
+ const code = await cmdAgentClient(process.argv.slice(3)).catch((e: unknown) => {
80
+ process.stderr.write(`Error: ${errorMessage(e)}\n`);
81
+ return 1;
82
+ });
83
+ if (code) process.exitCode = code;
84
+ break;
85
+ }
74
86
  case 'cp': {
75
87
  const imported = await importCommand('../lib/cp.ts');
76
88
  if (!imported) break;
package/dist/bin/cli.js CHANGED
@@ -19,6 +19,7 @@ const USAGE = `agent-infra ${VERSION} - bootstrap AI collaboration infrastructur
19
19
  Usage: ai <command> [options]
20
20
 
21
21
  Commands:
22
+ agent-client List, inspect, enable, disable, or configure Agent Clients
22
23
  cp <ssh-alias> Copy local clipboard image to a remote macOS clipboard or Linux sandbox over SSH
23
24
  decide Record a ruling; code-stage decisions require explicit implementation intent
24
25
  help Show this help message
@@ -69,6 +70,19 @@ async function importCommand(importPath) {
69
70
  }
70
71
  }
71
72
  switch (command) {
73
+ case 'agent-client': {
74
+ const imported = await importCommand('../lib/agent-client.ts');
75
+ if (!imported)
76
+ break;
77
+ const { cmdAgentClient } = imported;
78
+ const code = await cmdAgentClient(process.argv.slice(3)).catch((e) => {
79
+ process.stderr.write(`Error: ${errorMessage(e)}\n`);
80
+ return 1;
81
+ });
82
+ if (code)
83
+ process.exitCode = code;
84
+ break;
85
+ }
72
86
  case 'cp': {
73
87
  const imported = await importCommand('../lib/cp.ts');
74
88
  if (!imported)
@@ -6,6 +6,11 @@ if (major < 22 || (major === 22 && minor < 9)) {
6
6
  }
7
7
  const command = process.argv[2] || '';
8
8
  switch (command) {
9
+ case 'agent-client': {
10
+ const { agentClient } = await import('../lib/internal/agent-client.js');
11
+ agentClient(process.argv.slice(3));
12
+ break;
13
+ }
9
14
  case 'git-workflow': {
10
15
  const { gitWorkflow } = await import('../lib/internal/git-workflow.js');
11
16
  gitWorkflow(process.argv.slice(3));
@@ -16,6 +21,11 @@ switch (command) {
16
21
  await releaseWorkflow(process.argv.slice(3));
17
22
  break;
18
23
  }
24
+ case 'platform-release-notes': {
25
+ const { platformReleaseNotes } = await import('../lib/internal/platform-release-notes.js');
26
+ platformReleaseNotes(process.argv.slice(3));
27
+ break;
28
+ }
19
29
  case 'platform-context': {
20
30
  const { platformContext } = await import('../lib/internal/platform-context.js');
21
31
  platformContext(process.argv.slice(3));
@@ -61,6 +71,16 @@ switch (command) {
61
71
  taskArtifact(process.argv.slice(3));
62
72
  break;
63
73
  }
74
+ case 'task-orchestration': {
75
+ const { taskOrchestration } = await import('../lib/internal/task-orchestration.js');
76
+ taskOrchestration(process.argv.slice(3));
77
+ break;
78
+ }
79
+ case 'task-review': {
80
+ const { taskReview } = await import('../lib/internal/task-review.js');
81
+ taskReview(process.argv.slice(3));
82
+ break;
83
+ }
64
84
  case 'task-event': {
65
85
  const { taskEvent } = await import('../lib/internal/task-event.js');
66
86
  taskEvent(process.argv.slice(3));
@@ -0,0 +1,163 @@
1
+ import fs from 'node:fs';
2
+ import path from 'node:path';
3
+ import { AgentClientConfigError, normalizeAgentClients } from './agent-clients/config.js';
4
+ import { applyAgentClientReconciliation, planAgentClientReconciliation } from './agent-clients/reconcile.js';
5
+ import { listAgentClientAdapters } from './agent-clients/registry.js';
6
+ import { AGENT_CLIENT_IDS, isAgentClientId } from './agent-clients/types.js';
7
+ import { closePrompt, multiSelect } from './prompt.js';
8
+ import { resolveTemplateDir } from './paths.js';
9
+ const USAGE = `Usage: ai agent-client <operation>
10
+
11
+ Operations:
12
+ list List built-in Agent Clients
13
+ status Show project integration and sandbox state
14
+ enable <client-id> Enable project integration only
15
+ disable <client-id> Disable project integration only
16
+ configure Configure integration and sandbox state interactively
17
+ `;
18
+ class AgentClientCommandError extends Error {
19
+ code;
20
+ constructor(code, message) {
21
+ super(`${code}: ${message}`);
22
+ this.name = 'AgentClientCommandError';
23
+ this.code = code;
24
+ }
25
+ }
26
+ function readConfig(projectRoot) {
27
+ const configPath = path.join(projectRoot, '.agents', '.airc.json');
28
+ if (!fs.existsSync(configPath)) {
29
+ throw new AgentClientCommandError('AGENT_CLIENT_CONFIG_NOT_FOUND', 'No .agents/.airc.json found. Run "ai init" first.');
30
+ }
31
+ let parsed;
32
+ try {
33
+ parsed = JSON.parse(fs.readFileSync(configPath, 'utf8'));
34
+ }
35
+ catch (error) {
36
+ throw new AgentClientCommandError('AGENT_CLIENT_CONFIG_INVALID', error instanceof Error ? error.message : String(error));
37
+ }
38
+ if (typeof parsed !== 'object' || parsed === null || Array.isArray(parsed)) {
39
+ throw new AgentClientCommandError('AGENT_CLIENT_CONFIG_INVALID', 'configuration root must be an object');
40
+ }
41
+ return parsed;
42
+ }
43
+ function choices() {
44
+ return listAgentClientAdapters().map((adapter) => ({
45
+ id: adapter.id,
46
+ label: adapter.displayName
47
+ }));
48
+ }
49
+ function selected(state, field) {
50
+ return AGENT_CLIENT_IDS.filter((id) => state[id][field]);
51
+ }
52
+ function workflowPlan(projectRoot, config, mutation) {
53
+ const templateRoot = resolveTemplateDir();
54
+ if (!templateRoot) {
55
+ throw new AgentClientCommandError('AGENT_CLIENT_TEMPLATE_NOT_FOUND', 'Template directory not found');
56
+ }
57
+ const platform = config.platform;
58
+ const platformType = typeof platform === 'object' && platform !== null && 'type' in platform
59
+ ? String(platform.type ?? 'github')
60
+ : 'github';
61
+ return planAgentClientReconciliation({
62
+ config,
63
+ mutation,
64
+ projectRoot,
65
+ templateRoot,
66
+ platformType,
67
+ language: String(config.language ?? 'en')
68
+ });
69
+ }
70
+ function printState(state) {
71
+ for (const adapter of listAgentClientAdapters()) {
72
+ const value = state[adapter.id];
73
+ process.stdout.write(` ${adapter.id}: enabled=${String(value.enabled)} installInSandbox=${String(value.installInSandbox)}\n`);
74
+ }
75
+ }
76
+ async function cmdAgentClient(args) {
77
+ const operation = args[0];
78
+ if (!operation || operation === '--help' || operation === '-h' || operation === 'help') {
79
+ process.stdout.write(USAGE);
80
+ return 0;
81
+ }
82
+ if (operation === 'list') {
83
+ if (args.length !== 1) {
84
+ throw new AgentClientCommandError('AGENT_CLIENT_ARGUMENT_INVALID', 'list accepts no arguments');
85
+ }
86
+ for (const adapter of listAgentClientAdapters()) {
87
+ process.stdout.write(`${adapter.id}\t${adapter.displayName}\t${adapter.invocation}\tcommands=${adapter.capabilities.commands.level}\tsandbox=${adapter.capabilities.sandbox.level}\n`);
88
+ }
89
+ return 0;
90
+ }
91
+ const projectRoot = process.cwd();
92
+ const config = readConfig(projectRoot);
93
+ try {
94
+ if (operation === 'status') {
95
+ if (args.length !== 1) {
96
+ throw new AgentClientCommandError('AGENT_CLIENT_ARGUMENT_INVALID', 'status accepts no arguments');
97
+ }
98
+ const plan = workflowPlan(projectRoot, config, { type: 'none' });
99
+ process.stdout.write(`source: ${plan.source}\n`);
100
+ printState(plan.desired);
101
+ for (const seed of plan.seedOperations) {
102
+ process.stdout.write(` seed ${seed.target}: ${seed.kind}\n`);
103
+ }
104
+ for (const diagnostic of plan.diagnostics) {
105
+ process.stdout.write(` diagnostic ${diagnostic.code} at ${diagnostic.path}\n`);
106
+ }
107
+ return 0;
108
+ }
109
+ if (operation === 'enable' || operation === 'disable') {
110
+ if (args.length !== 2) {
111
+ throw new AgentClientCommandError('AGENT_CLIENT_ARGUMENT_INVALID', `${operation} requires exactly one client id`);
112
+ }
113
+ const id = args[1];
114
+ if (!isAgentClientId(id)) {
115
+ throw new AgentClientCommandError('UNKNOWN_AGENT_CLIENT', `Unknown Agent Client '${String(id)}'`);
116
+ }
117
+ const plan = workflowPlan(projectRoot, config, {
118
+ type: 'set-enabled',
119
+ id,
120
+ value: operation === 'enable'
121
+ });
122
+ process.stdout.write('Before:\n');
123
+ printState(plan.before);
124
+ const result = applyAgentClientReconciliation(plan);
125
+ process.stdout.write('After:\n');
126
+ printState(plan.desired);
127
+ process.stdout.write(`Result: ${result.status}; applied=${result.applied.length}; protected=${result.protected.length}\n`);
128
+ return 0;
129
+ }
130
+ if (operation === 'configure') {
131
+ if (args.length !== 1) {
132
+ throw new AgentClientCommandError('AGENT_CLIENT_ARGUMENT_INVALID', 'configure accepts no arguments');
133
+ }
134
+ const normalized = normalizeAgentClients(config);
135
+ let enabled;
136
+ let installed;
137
+ try {
138
+ enabled = await multiSelect('Agent Client project integrations', choices(), selected(normalized.state, 'enabled'));
139
+ installed = await multiSelect('Agent Clients installed in sandbox', choices(), selected(normalized.state, 'installInSandbox'));
140
+ }
141
+ finally {
142
+ closePrompt();
143
+ }
144
+ const state = Object.fromEntries(AGENT_CLIENT_IDS.map((id) => [id, {
145
+ enabled: enabled.includes(id),
146
+ installInSandbox: installed.includes(id)
147
+ }]));
148
+ const plan = workflowPlan(projectRoot, config, { type: 'replace-state', state });
149
+ const result = applyAgentClientReconciliation(plan);
150
+ process.stdout.write(`Result: ${result.status}; applied=${result.applied.length}; protected=${result.protected.length}\n`);
151
+ return 0;
152
+ }
153
+ throw new AgentClientCommandError('AGENT_CLIENT_OPERATION_INVALID', `Unknown operation '${operation}'`);
154
+ }
155
+ catch (error) {
156
+ if (error instanceof AgentClientConfigError) {
157
+ throw new AgentClientCommandError(error.code, error.message);
158
+ }
159
+ throw error;
160
+ }
161
+ }
162
+ export { AgentClientCommandError, cmdAgentClient };
163
+ //# sourceMappingURL=agent-client.js.map