agentplane 0.3.7 → 0.3.9

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 (619) hide show
  1. package/assets/AGENTS.md +11 -1
  2. package/assets/RUNNER.md +17 -0
  3. package/bin/agentplane.js +16 -7
  4. package/bin/framework-dev-contract.d.ts +6 -0
  5. package/bin/framework-dev-contract.js +13 -0
  6. package/bin/stale-dist-policy.js +6 -1
  7. package/dist/.build-manifest.json +692 -337
  8. package/dist/adapters/task-backend/task-backend-adapter.d.ts +3 -1
  9. package/dist/adapters/task-backend/task-backend-adapter.d.ts.map +1 -1
  10. package/dist/adapters/task-backend/task-backend-adapter.js +13 -0
  11. package/dist/backends/task-backend/local-backend-doc.d.ts +5 -0
  12. package/dist/backends/task-backend/local-backend-doc.d.ts.map +1 -0
  13. package/dist/backends/task-backend/local-backend-doc.js +98 -0
  14. package/dist/backends/task-backend/local-backend-read.d.ts +7 -0
  15. package/dist/backends/task-backend/local-backend-read.d.ts.map +1 -0
  16. package/dist/backends/task-backend/local-backend-read.js +186 -0
  17. package/dist/backends/task-backend/local-backend-state.d.ts +17 -0
  18. package/dist/backends/task-backend/local-backend-state.d.ts.map +1 -0
  19. package/dist/backends/task-backend/local-backend-state.js +50 -0
  20. package/dist/backends/task-backend/local-backend-write.d.ts +15 -0
  21. package/dist/backends/task-backend/local-backend-write.d.ts.map +1 -0
  22. package/dist/backends/task-backend/local-backend-write.js +254 -0
  23. package/dist/backends/task-backend/local-backend.d.ts +4 -2
  24. package/dist/backends/task-backend/local-backend.d.ts.map +1 -1
  25. package/dist/backends/task-backend/local-backend.js +26 -403
  26. package/dist/backends/task-backend/redmine/backend-cache-doc.d.ts +40 -0
  27. package/dist/backends/task-backend/redmine/backend-cache-doc.d.ts.map +1 -0
  28. package/dist/backends/task-backend/redmine/backend-cache-doc.js +178 -0
  29. package/dist/backends/task-backend/redmine/backend-report.d.ts +10 -0
  30. package/dist/backends/task-backend/redmine/backend-report.d.ts.map +1 -0
  31. package/dist/backends/task-backend/redmine/backend-report.js +43 -0
  32. package/dist/backends/task-backend/redmine/backend-sync.d.ts +67 -0
  33. package/dist/backends/task-backend/redmine/backend-sync.d.ts.map +1 -0
  34. package/dist/backends/task-backend/redmine/backend-sync.js +367 -0
  35. package/dist/backends/task-backend/redmine/mapping.d.ts +2 -1
  36. package/dist/backends/task-backend/redmine/mapping.d.ts.map +1 -1
  37. package/dist/backends/task-backend/redmine/mapping.js +12 -2
  38. package/dist/backends/task-backend/redmine/parse.d.ts +2 -1
  39. package/dist/backends/task-backend/redmine/parse.d.ts.map +1 -1
  40. package/dist/backends/task-backend/redmine/parse.js +5 -3
  41. package/dist/backends/task-backend/redmine/state.d.ts +2 -0
  42. package/dist/backends/task-backend/redmine/state.d.ts.map +1 -1
  43. package/dist/backends/task-backend/redmine/state.js +15 -1
  44. package/dist/backends/task-backend/redmine-backend.d.ts +5 -2
  45. package/dist/backends/task-backend/redmine-backend.d.ts.map +1 -1
  46. package/dist/backends/task-backend/redmine-backend.js +88 -536
  47. package/dist/backends/task-backend/shared/constants.d.ts +2 -1
  48. package/dist/backends/task-backend/shared/constants.d.ts.map +1 -1
  49. package/dist/backends/task-backend/shared/doc.d.ts.map +1 -1
  50. package/dist/backends/task-backend/shared/doc.js +25 -39
  51. package/dist/backends/task-backend/shared/export.d.ts +2 -9
  52. package/dist/backends/task-backend/shared/export.d.ts.map +1 -1
  53. package/dist/backends/task-backend/shared/export.js +73 -8
  54. package/dist/backends/task-backend/shared/normalize.d.ts +5 -1
  55. package/dist/backends/task-backend/shared/normalize.d.ts.map +1 -1
  56. package/dist/backends/task-backend/shared/normalize.js +166 -0
  57. package/dist/backends/task-backend/shared/record.d.ts +1 -1
  58. package/dist/backends/task-backend/shared/record.d.ts.map +1 -1
  59. package/dist/backends/task-backend/shared/record.js +7 -2
  60. package/dist/backends/task-backend/shared/types.d.ts +38 -36
  61. package/dist/backends/task-backend/shared/types.d.ts.map +1 -1
  62. package/dist/backends/task-backend/shared.d.ts +2 -2
  63. package/dist/backends/task-backend/shared.d.ts.map +1 -1
  64. package/dist/backends/task-backend/shared.js +1 -1
  65. package/dist/backends/task-backend.d.ts +1 -1
  66. package/dist/backends/task-backend.d.ts.map +1 -1
  67. package/dist/backends/task-backend.js +1 -1
  68. package/dist/backends/task-index.d.ts +2 -2
  69. package/dist/backends/task-index.d.ts.map +1 -1
  70. package/dist/backends/task-index.js +9 -6
  71. package/dist/cli/bootstrap-guide.d.ts +2 -2
  72. package/dist/cli/bootstrap-guide.d.ts.map +1 -1
  73. package/dist/cli/bootstrap-guide.js +10 -10
  74. package/dist/cli/command-guide.d.ts.map +1 -1
  75. package/dist/cli/command-guide.js +11 -9
  76. package/dist/cli/command-invocations.d.ts +4 -0
  77. package/dist/cli/command-invocations.d.ts.map +1 -0
  78. package/dist/cli/command-invocations.js +35 -0
  79. package/dist/cli/command-snippets.d.ts +12 -8
  80. package/dist/cli/command-snippets.d.ts.map +1 -1
  81. package/dist/cli/command-snippets.js +14 -8
  82. package/dist/cli/exit-codes.d.ts.map +1 -1
  83. package/dist/cli/exit-codes.js +1 -0
  84. package/dist/cli/group-command.d.ts +18 -0
  85. package/dist/cli/group-command.d.ts.map +1 -0
  86. package/dist/cli/group-command.js +45 -0
  87. package/dist/cli/output.d.ts +29 -0
  88. package/dist/cli/output.d.ts.map +1 -1
  89. package/dist/cli/output.js +76 -0
  90. package/dist/cli/prompts.d.ts.map +1 -1
  91. package/dist/cli/prompts.js +5 -1
  92. package/dist/cli/run-cli/command-catalog/core.d.ts.map +1 -1
  93. package/dist/cli/run-cli/command-catalog/core.js +38 -29
  94. package/dist/cli/run-cli/command-catalog/lifecycle.d.ts.map +1 -1
  95. package/dist/cli/run-cli/command-catalog/lifecycle.js +9 -6
  96. package/dist/cli/run-cli/command-catalog/project.d.ts +1 -1
  97. package/dist/cli/run-cli/command-catalog/project.d.ts.map +1 -1
  98. package/dist/cli/run-cli/command-catalog/project.js +8 -6
  99. package/dist/cli/run-cli/command-catalog/shared.d.ts +12 -3
  100. package/dist/cli/run-cli/command-catalog/shared.d.ts.map +1 -1
  101. package/dist/cli/run-cli/command-catalog/shared.js +6 -3
  102. package/dist/cli/run-cli/command-catalog/task.d.ts +1 -1
  103. package/dist/cli/run-cli/command-catalog/task.d.ts.map +1 -1
  104. package/dist/cli/run-cli/command-catalog/task.js +46 -11
  105. package/dist/cli/run-cli/command-catalog.d.ts +11 -1
  106. package/dist/cli/run-cli/command-catalog.d.ts.map +1 -1
  107. package/dist/cli/run-cli/command-catalog.js +29 -0
  108. package/dist/cli/run-cli/commands/config.d.ts.map +1 -1
  109. package/dist/cli/run-cli/commands/config.js +52 -6
  110. package/dist/cli/run-cli/commands/core/agent-profiles.d.ts +34 -0
  111. package/dist/cli/run-cli/commands/core/agent-profiles.d.ts.map +1 -0
  112. package/dist/cli/run-cli/commands/core/agent-profiles.js +97 -0
  113. package/dist/cli/run-cli/commands/core/agents.d.ts +7 -0
  114. package/dist/cli/run-cli/commands/core/agents.d.ts.map +1 -0
  115. package/dist/cli/run-cli/commands/core/agents.js +97 -0
  116. package/dist/cli/run-cli/commands/core/preflight.d.ts +10 -0
  117. package/dist/cli/run-cli/commands/core/preflight.d.ts.map +1 -0
  118. package/dist/cli/run-cli/commands/core/preflight.js +286 -0
  119. package/dist/cli/run-cli/commands/core/quickstart.d.ts +8 -0
  120. package/dist/cli/run-cli/commands/core/quickstart.d.ts.map +1 -0
  121. package/dist/cli/run-cli/commands/core/quickstart.js +43 -0
  122. package/dist/cli/run-cli/commands/core/role.d.ts +9 -0
  123. package/dist/cli/run-cli/commands/core/role.d.ts.map +1 -0
  124. package/dist/cli/run-cli/commands/core/role.js +128 -0
  125. package/dist/cli/run-cli/commands/core.d.ts +4 -24
  126. package/dist/cli/run-cli/commands/core.d.ts.map +1 -1
  127. package/dist/cli/run-cli/commands/core.js +4 -630
  128. package/dist/cli/run-cli/error-guidance.js +10 -0
  129. package/dist/cli/run-cli/globals.d.ts +5 -2
  130. package/dist/cli/run-cli/globals.d.ts.map +1 -1
  131. package/dist/cli/run-cli/globals.js +82 -86
  132. package/dist/cli/run-cli.d.ts.map +1 -1
  133. package/dist/cli/run-cli.js +137 -100
  134. package/dist/cli/run-cli.test-helpers.d.ts +21 -0
  135. package/dist/cli/run-cli.test-helpers.d.ts.map +1 -1
  136. package/dist/cli/run-cli.test-helpers.js +122 -12
  137. package/dist/cli/spec/help.d.ts +10 -2
  138. package/dist/cli/spec/help.d.ts.map +1 -1
  139. package/dist/cli/spec/help.js +7 -5
  140. package/dist/cli/spec/registry.d.ts +27 -1
  141. package/dist/cli/spec/registry.d.ts.map +1 -1
  142. package/dist/cli/spec/registry.js +98 -25
  143. package/dist/commands/backend/sync.command.d.ts +3 -5
  144. package/dist/commands/backend/sync.command.d.ts.map +1 -1
  145. package/dist/commands/backend/sync.command.js +9 -12
  146. package/dist/commands/backend.d.ts.map +1 -1
  147. package/dist/commands/backend.js +8 -7
  148. package/dist/commands/branch/base.command.d.ts +2 -3
  149. package/dist/commands/branch/base.command.d.ts.map +1 -1
  150. package/dist/commands/branch/base.command.js +8 -12
  151. package/dist/commands/branch/base.d.ts.map +1 -1
  152. package/dist/commands/branch/base.js +11 -7
  153. package/dist/commands/branch/cleanup-merged.d.ts.map +1 -1
  154. package/dist/commands/branch/cleanup-merged.js +9 -8
  155. package/dist/commands/branch/remove.d.ts.map +1 -1
  156. package/dist/commands/branch/remove.js +4 -3
  157. package/dist/commands/branch/status.d.ts.map +1 -1
  158. package/dist/commands/branch/status.js +4 -3
  159. package/dist/commands/branch/work-start.d.ts.map +1 -1
  160. package/dist/commands/branch/work-start.js +48 -5
  161. package/dist/commands/cleanup/merged.command.d.ts +2 -3
  162. package/dist/commands/cleanup/merged.command.d.ts.map +1 -1
  163. package/dist/commands/cleanup/merged.command.js +8 -12
  164. package/dist/commands/docs/cli.command.js +2 -2
  165. package/dist/commands/doctor/runtime.js +1 -1
  166. package/dist/commands/doctor/workflow.d.ts.map +1 -1
  167. package/dist/commands/doctor/workflow.js +10 -1
  168. package/dist/commands/finish.spec.d.ts.map +1 -1
  169. package/dist/commands/finish.spec.js +7 -0
  170. package/dist/commands/guard/guard.command.d.ts +3 -3
  171. package/dist/commands/guard/guard.command.d.ts.map +1 -1
  172. package/dist/commands/guard/guard.command.js +9 -14
  173. package/dist/commands/guard/impl/commands.d.ts +2 -0
  174. package/dist/commands/guard/impl/commands.d.ts.map +1 -1
  175. package/dist/commands/guard/impl/commands.js +55 -7
  176. package/dist/commands/guard/impl/policy.d.ts +1 -0
  177. package/dist/commands/guard/impl/policy.d.ts.map +1 -1
  178. package/dist/commands/guard/impl/policy.js +9 -6
  179. package/dist/commands/hooks/hooks.command.d.ts +3 -3
  180. package/dist/commands/hooks/hooks.command.d.ts.map +1 -1
  181. package/dist/commands/hooks/hooks.command.js +9 -11
  182. package/dist/commands/hooks/index.d.ts.map +1 -1
  183. package/dist/commands/hooks/index.js +8 -4
  184. package/dist/commands/pr/check.d.ts.map +1 -1
  185. package/dist/commands/pr/check.js +90 -18
  186. package/dist/commands/pr/integrate/cmd.d.ts.map +1 -1
  187. package/dist/commands/pr/integrate/cmd.js +31 -3
  188. package/dist/commands/pr/integrate/internal/cleanup.d.ts +12 -0
  189. package/dist/commands/pr/integrate/internal/cleanup.d.ts.map +1 -0
  190. package/dist/commands/pr/integrate/internal/cleanup.js +46 -0
  191. package/dist/commands/pr/integrate/internal/finalize.d.ts +4 -0
  192. package/dist/commands/pr/integrate/internal/finalize.d.ts.map +1 -1
  193. package/dist/commands/pr/integrate/internal/finalize.js +34 -40
  194. package/dist/commands/pr/integrate/internal/merge.d.ts +6 -0
  195. package/dist/commands/pr/integrate/internal/merge.d.ts.map +1 -1
  196. package/dist/commands/pr/integrate/internal/merge.js +92 -0
  197. package/dist/commands/pr/integrate/internal/prepare.d.ts +1 -0
  198. package/dist/commands/pr/integrate/internal/prepare.d.ts.map +1 -1
  199. package/dist/commands/pr/integrate/internal/prepare.js +1 -0
  200. package/dist/commands/pr/integrate/verify.d.ts.map +1 -1
  201. package/dist/commands/pr/integrate/verify.js +4 -3
  202. package/dist/commands/pr/note.d.ts.map +1 -1
  203. package/dist/commands/pr/note.js +3 -2
  204. package/dist/commands/pr/open.d.ts.map +1 -1
  205. package/dist/commands/pr/open.js +9 -12
  206. package/dist/commands/pr/pr.command.d.ts +3 -4
  207. package/dist/commands/pr/pr.command.d.ts.map +1 -1
  208. package/dist/commands/pr/pr.command.js +6 -11
  209. package/dist/commands/pr/update.d.ts.map +1 -1
  210. package/dist/commands/pr/update.js +5 -10
  211. package/dist/commands/recipes/cache.command.d.ts +3 -4
  212. package/dist/commands/recipes/cache.command.d.ts.map +1 -1
  213. package/dist/commands/recipes/cache.command.js +8 -26
  214. package/dist/commands/recipes/impl/apply.js +1 -1
  215. package/dist/commands/recipes/impl/commands/explain.js +1 -1
  216. package/dist/commands/recipes/impl/installed-recipes.d.ts.map +1 -1
  217. package/dist/commands/recipes/impl/installed-recipes.js +1 -1
  218. package/dist/commands/recipes/impl/manifest.d.ts.map +1 -1
  219. package/dist/commands/recipes/impl/manifest.js +0 -10
  220. package/dist/commands/recipes/impl/project-installed-recipes.d.ts.map +1 -1
  221. package/dist/commands/recipes/impl/project-installed-recipes.js +1 -1
  222. package/dist/commands/recipes/impl/resolver.d.ts +1 -1
  223. package/dist/commands/recipes/impl/resolver.d.ts.map +1 -1
  224. package/dist/commands/recipes/impl/resolver.js +26 -16
  225. package/dist/commands/recipes/impl/scenario.d.ts.map +1 -1
  226. package/dist/commands/recipes/impl/scenario.js +80 -0
  227. package/dist/commands/recipes/impl/types.d.ts +27 -13
  228. package/dist/commands/recipes/impl/types.d.ts.map +1 -1
  229. package/dist/commands/recipes/recipes.command.d.ts +3 -4
  230. package/dist/commands/recipes/recipes.command.d.ts.map +1 -1
  231. package/dist/commands/recipes/recipes.command.js +8 -34
  232. package/dist/commands/recipes.d.ts.map +1 -1
  233. package/dist/commands/recipes.test-helpers.d.ts +17 -0
  234. package/dist/commands/recipes.test-helpers.d.ts.map +1 -1
  235. package/dist/commands/recipes.test-helpers.js +56 -2
  236. package/dist/commands/release/apply.command.d.ts.map +1 -1
  237. package/dist/commands/release/apply.command.js +77 -56
  238. package/dist/commands/release/plan.command.d.ts.map +1 -1
  239. package/dist/commands/release/plan.command.js +7 -3
  240. package/dist/commands/release/release.command.d.ts +3 -3
  241. package/dist/commands/release/release.command.d.ts.map +1 -1
  242. package/dist/commands/release/release.command.js +9 -11
  243. package/dist/commands/release.test-helpers.d.ts +34 -0
  244. package/dist/commands/release.test-helpers.d.ts.map +1 -0
  245. package/dist/commands/release.test-helpers.js +48 -0
  246. package/dist/commands/runtime.command.d.ts +7 -7
  247. package/dist/commands/runtime.command.d.ts.map +1 -1
  248. package/dist/commands/runtime.command.js +29 -33
  249. package/dist/commands/scenario/execute.command.d.ts +8 -0
  250. package/dist/commands/scenario/execute.command.d.ts.map +1 -0
  251. package/dist/commands/scenario/execute.command.js +117 -0
  252. package/dist/commands/scenario/impl/commands.d.ts.map +1 -1
  253. package/dist/commands/scenario/impl/commands.js +45 -32
  254. package/dist/commands/scenario/run.command.js +2 -2
  255. package/dist/commands/scenario/scenario.command.d.ts +3 -4
  256. package/dist/commands/scenario/scenario.command.d.ts.map +1 -1
  257. package/dist/commands/scenario/scenario.command.js +8 -26
  258. package/dist/commands/shared/git-context.d.ts +1 -0
  259. package/dist/commands/shared/git-context.d.ts.map +1 -1
  260. package/dist/commands/shared/git-context.js +4 -2
  261. package/dist/commands/shared/git-ops.d.ts +1 -0
  262. package/dist/commands/shared/git-ops.d.ts.map +1 -1
  263. package/dist/commands/shared/git-ops.js +13 -0
  264. package/dist/commands/shared/operator-pipeline.d.ts +10 -0
  265. package/dist/commands/shared/operator-pipeline.d.ts.map +1 -0
  266. package/dist/commands/shared/operator-pipeline.js +16 -0
  267. package/dist/commands/shared/pr-meta.d.ts +32 -12
  268. package/dist/commands/shared/pr-meta.d.ts.map +1 -1
  269. package/dist/commands/shared/pr-meta.js +49 -14
  270. package/dist/commands/shared/reconcile-check.d.ts.map +1 -1
  271. package/dist/commands/shared/reconcile-check.js +28 -3
  272. package/dist/commands/shared/task-backend.d.ts +10 -6
  273. package/dist/commands/shared/task-backend.d.ts.map +1 -1
  274. package/dist/commands/shared/task-backend.js +99 -25
  275. package/dist/commands/shared/task-handoff.d.ts +64 -0
  276. package/dist/commands/shared/task-handoff.d.ts.map +1 -0
  277. package/dist/commands/shared/task-handoff.js +151 -0
  278. package/dist/commands/shared/task-mutation.d.ts +36 -0
  279. package/dist/commands/shared/task-mutation.d.ts.map +1 -0
  280. package/dist/commands/shared/task-mutation.js +67 -0
  281. package/dist/commands/shared/task-store.d.ts +5 -1
  282. package/dist/commands/shared/task-store.d.ts.map +1 -1
  283. package/dist/commands/shared/task-store.js +72 -92
  284. package/dist/commands/task/add.d.ts.map +1 -1
  285. package/dist/commands/task/add.js +41 -39
  286. package/dist/commands/task/block.d.ts.map +1 -1
  287. package/dist/commands/task/block.js +31 -110
  288. package/dist/commands/task/close-duplicate.d.ts.map +1 -1
  289. package/dist/commands/task/close-duplicate.js +0 -7
  290. package/dist/commands/task/close-noop.d.ts.map +1 -1
  291. package/dist/commands/task/close-noop.js +0 -21
  292. package/dist/commands/task/close-shared.d.ts +0 -2
  293. package/dist/commands/task/close-shared.d.ts.map +1 -1
  294. package/dist/commands/task/close-shared.js +25 -55
  295. package/dist/commands/task/comment.d.ts.map +1 -1
  296. package/dist/commands/task/comment.js +48 -37
  297. package/dist/commands/task/derive.d.ts.map +1 -1
  298. package/dist/commands/task/derive.js +14 -7
  299. package/dist/commands/task/doc.command.d.ts.map +1 -1
  300. package/dist/commands/task/doc.command.js +7 -6
  301. package/dist/commands/task/doc.d.ts.map +1 -1
  302. package/dist/commands/task/doc.js +58 -62
  303. package/dist/commands/task/finish-shared.d.ts +60 -0
  304. package/dist/commands/task/finish-shared.d.ts.map +1 -0
  305. package/dist/commands/task/finish-shared.js +181 -0
  306. package/dist/commands/task/finish.d.ts +1 -0
  307. package/dist/commands/task/finish.d.ts.map +1 -1
  308. package/dist/commands/task/finish.js +79 -210
  309. package/dist/commands/task/handoff-record.command.d.ts +17 -0
  310. package/dist/commands/task/handoff-record.command.d.ts.map +1 -0
  311. package/dist/commands/task/handoff-record.command.js +140 -0
  312. package/dist/commands/task/handoff-show.command.d.ts +8 -0
  313. package/dist/commands/task/handoff-show.command.d.ts.map +1 -0
  314. package/dist/commands/task/handoff-show.command.js +77 -0
  315. package/dist/commands/task/handoff.command.d.ts +7 -0
  316. package/dist/commands/task/handoff.command.d.ts.map +1 -0
  317. package/dist/commands/task/handoff.command.js +21 -0
  318. package/dist/commands/task/handoff.shared.d.ts +39 -0
  319. package/dist/commands/task/handoff.shared.d.ts.map +1 -0
  320. package/dist/commands/task/handoff.shared.js +134 -0
  321. package/dist/commands/task/hosted-close.command.d.ts +9 -0
  322. package/dist/commands/task/hosted-close.command.d.ts.map +1 -0
  323. package/dist/commands/task/hosted-close.command.js +190 -0
  324. package/dist/commands/task/hosted-merge-sync.d.ts +40 -0
  325. package/dist/commands/task/hosted-merge-sync.d.ts.map +1 -0
  326. package/dist/commands/task/hosted-merge-sync.js +277 -0
  327. package/dist/commands/task/list.d.ts.map +1 -1
  328. package/dist/commands/task/list.js +7 -24
  329. package/dist/commands/task/new.d.ts.map +1 -1
  330. package/dist/commands/task/new.js +26 -6
  331. package/dist/commands/task/next.d.ts.map +1 -1
  332. package/dist/commands/task/next.js +10 -28
  333. package/dist/commands/task/normalize.command.d.ts +1 -0
  334. package/dist/commands/task/normalize.command.d.ts.map +1 -1
  335. package/dist/commands/task/normalize.command.js +12 -0
  336. package/dist/commands/task/normalize.d.ts +1 -0
  337. package/dist/commands/task/normalize.d.ts.map +1 -1
  338. package/dist/commands/task/normalize.js +21 -9
  339. package/dist/commands/task/plan.command.d.ts +3 -4
  340. package/dist/commands/task/plan.command.d.ts.map +1 -1
  341. package/dist/commands/task/plan.command.js +6 -12
  342. package/dist/commands/task/plan.d.ts.map +1 -1
  343. package/dist/commands/task/plan.js +96 -103
  344. package/dist/commands/task/reclaim.command.d.ts +11 -0
  345. package/dist/commands/task/reclaim.command.d.ts.map +1 -0
  346. package/dist/commands/task/reclaim.command.js +102 -0
  347. package/dist/commands/task/resume-context.command.d.ts +9 -0
  348. package/dist/commands/task/resume-context.command.d.ts.map +1 -0
  349. package/dist/commands/task/resume-context.command.js +60 -0
  350. package/dist/commands/task/run-cancel.command.d.ts +6 -0
  351. package/dist/commands/task/run-cancel.command.d.ts.map +1 -0
  352. package/dist/commands/task/run-cancel.command.js +45 -0
  353. package/dist/commands/task/run-cancel.spec.d.ts +7 -0
  354. package/dist/commands/task/run-cancel.spec.d.ts.map +1 -0
  355. package/dist/commands/task/run-cancel.spec.js +20 -0
  356. package/dist/commands/task/run-resume.command.d.ts +6 -0
  357. package/dist/commands/task/run-resume.command.d.ts.map +1 -0
  358. package/dist/commands/task/run-resume.command.js +55 -0
  359. package/dist/commands/task/run-resume.spec.d.ts +7 -0
  360. package/dist/commands/task/run-resume.spec.d.ts.map +1 -0
  361. package/dist/commands/task/run-resume.spec.js +20 -0
  362. package/dist/commands/task/run-retry.command.d.ts +6 -0
  363. package/dist/commands/task/run-retry.command.d.ts.map +1 -0
  364. package/dist/commands/task/run-retry.command.js +56 -0
  365. package/dist/commands/task/run-retry.spec.d.ts +7 -0
  366. package/dist/commands/task/run-retry.spec.d.ts.map +1 -0
  367. package/dist/commands/task/run-retry.spec.js +20 -0
  368. package/dist/commands/task/run-show.command.d.ts +6 -0
  369. package/dist/commands/task/run-show.command.d.ts.map +1 -0
  370. package/dist/commands/task/run-show.command.js +133 -0
  371. package/dist/commands/task/run-show.spec.d.ts +8 -0
  372. package/dist/commands/task/run-show.spec.d.ts.map +1 -0
  373. package/dist/commands/task/run-show.spec.js +44 -0
  374. package/dist/commands/task/run-tail.command.d.ts +6 -0
  375. package/dist/commands/task/run-tail.command.d.ts.map +1 -0
  376. package/dist/commands/task/run-tail.command.js +26 -0
  377. package/dist/commands/task/run-tail.spec.d.ts +8 -0
  378. package/dist/commands/task/run-tail.spec.d.ts.map +1 -0
  379. package/dist/commands/task/run-tail.spec.js +51 -0
  380. package/dist/commands/task/run-trace.command.d.ts +6 -0
  381. package/dist/commands/task/run-trace.command.d.ts.map +1 -0
  382. package/dist/commands/task/run-trace.command.js +25 -0
  383. package/dist/commands/task/run-trace.spec.d.ts +7 -0
  384. package/dist/commands/task/run-trace.spec.d.ts.map +1 -0
  385. package/dist/commands/task/run-trace.spec.js +31 -0
  386. package/dist/commands/task/run.command.d.ts +6 -0
  387. package/dist/commands/task/run.command.d.ts.map +1 -0
  388. package/dist/commands/task/run.command.js +74 -0
  389. package/dist/commands/task/run.spec.d.ts +7 -0
  390. package/dist/commands/task/run.spec.d.ts.map +1 -0
  391. package/dist/commands/task/run.spec.js +26 -0
  392. package/dist/commands/task/scaffold.d.ts.map +1 -1
  393. package/dist/commands/task/scaffold.js +4 -2
  394. package/dist/commands/task/scrub.d.ts.map +1 -1
  395. package/dist/commands/task/scrub.js +27 -24
  396. package/dist/commands/task/search.d.ts.map +1 -1
  397. package/dist/commands/task/search.js +21 -31
  398. package/dist/commands/task/set-status.d.ts.map +1 -1
  399. package/dist/commands/task/set-status.js +36 -152
  400. package/dist/commands/task/shared/dependencies.d.ts +4 -4
  401. package/dist/commands/task/shared/dependencies.d.ts.map +1 -1
  402. package/dist/commands/task/shared/dependencies.js +10 -2
  403. package/dist/commands/task/shared/docs.d.ts +6 -1
  404. package/dist/commands/task/shared/docs.d.ts.map +1 -1
  405. package/dist/commands/task/shared/docs.js +13 -0
  406. package/dist/commands/task/shared/listing.d.ts +16 -2
  407. package/dist/commands/task/shared/listing.d.ts.map +1 -1
  408. package/dist/commands/task/shared/listing.js +56 -0
  409. package/dist/commands/task/shared/transition-command.d.ts +15 -0
  410. package/dist/commands/task/shared/transition-command.d.ts.map +1 -0
  411. package/dist/commands/task/shared/transition-command.js +43 -0
  412. package/dist/commands/task/shared/transitions.d.ts +39 -0
  413. package/dist/commands/task/shared/transitions.d.ts.map +1 -1
  414. package/dist/commands/task/shared/transitions.js +62 -1
  415. package/dist/commands/task/shared/workflow-transition-service.d.ts +75 -0
  416. package/dist/commands/task/shared/workflow-transition-service.d.ts.map +1 -0
  417. package/dist/commands/task/shared/workflow-transition-service.js +226 -0
  418. package/dist/commands/task/shared.d.ts +5 -3
  419. package/dist/commands/task/shared.d.ts.map +1 -1
  420. package/dist/commands/task/shared.js +5 -3
  421. package/dist/commands/task/show.d.ts.map +1 -1
  422. package/dist/commands/task/show.js +37 -3
  423. package/dist/commands/task/start.d.ts.map +1 -1
  424. package/dist/commands/task/start.js +33 -119
  425. package/dist/commands/task/task.command.d.ts +3 -4
  426. package/dist/commands/task/task.command.d.ts.map +1 -1
  427. package/dist/commands/task/task.command.js +22 -37
  428. package/dist/commands/task/verify-record.d.ts.map +1 -1
  429. package/dist/commands/task/verify-record.js +16 -141
  430. package/dist/commands/task/verify.command.d.ts.map +1 -1
  431. package/dist/commands/task/verify.command.js +7 -6
  432. package/dist/commands/task.test-helpers.d.ts +13 -0
  433. package/dist/commands/task.test-helpers.d.ts.map +1 -0
  434. package/dist/commands/task.test-helpers.js +65 -0
  435. package/dist/commands/upgrade/materialize.d.ts +28 -0
  436. package/dist/commands/upgrade/materialize.d.ts.map +1 -0
  437. package/dist/commands/upgrade/materialize.js +154 -0
  438. package/dist/commands/upgrade/plan.d.ts +18 -0
  439. package/dist/commands/upgrade/plan.d.ts.map +1 -0
  440. package/dist/commands/upgrade/plan.js +219 -0
  441. package/dist/commands/upgrade/policy.d.ts +24 -0
  442. package/dist/commands/upgrade/policy.d.ts.map +1 -0
  443. package/dist/commands/upgrade/policy.js +182 -0
  444. package/dist/commands/upgrade/report.d.ts.map +1 -1
  445. package/dist/commands/upgrade/report.js +7 -5
  446. package/dist/commands/upgrade.d.ts.map +1 -1
  447. package/dist/commands/upgrade.js +154 -642
  448. package/dist/commands/workflow.command.d.ts +3 -4
  449. package/dist/commands/workflow.command.d.ts.map +1 -1
  450. package/dist/commands/workflow.command.js +8 -25
  451. package/dist/ports/task-backend-port.d.ts +3 -1
  452. package/dist/ports/task-backend-port.d.ts.map +1 -1
  453. package/dist/runner/adapters/codex.d.ts +9 -0
  454. package/dist/runner/adapters/codex.d.ts.map +1 -0
  455. package/dist/runner/adapters/codex.js +414 -0
  456. package/dist/runner/adapters/custom.d.ts +12 -0
  457. package/dist/runner/adapters/custom.d.ts.map +1 -0
  458. package/dist/runner/adapters/custom.js +512 -0
  459. package/dist/runner/adapters/index.d.ts +8 -0
  460. package/dist/runner/adapters/index.d.ts.map +1 -0
  461. package/dist/runner/adapters/index.js +15 -0
  462. package/dist/runner/adapters/recipe-run-profile.d.ts +8 -0
  463. package/dist/runner/adapters/recipe-run-profile.d.ts.map +1 -0
  464. package/dist/runner/adapters/recipe-run-profile.js +53 -0
  465. package/dist/runner/adapters/shared.d.ts +45 -0
  466. package/dist/runner/adapters/shared.d.ts.map +1 -0
  467. package/dist/runner/adapters/shared.js +58 -0
  468. package/dist/runner/artifacts.d.ts +31 -0
  469. package/dist/runner/artifacts.d.ts.map +1 -0
  470. package/dist/runner/artifacts.js +153 -0
  471. package/dist/runner/codex-approval-probe.d.ts +23 -0
  472. package/dist/runner/codex-approval-probe.d.ts.map +1 -0
  473. package/dist/runner/codex-approval-probe.js +55 -0
  474. package/dist/runner/codex-smoke.d.ts +11 -0
  475. package/dist/runner/codex-smoke.d.ts.map +1 -0
  476. package/dist/runner/codex-smoke.js +45 -0
  477. package/dist/runner/config.d.ts +6 -0
  478. package/dist/runner/config.d.ts.map +1 -0
  479. package/dist/runner/config.js +15 -0
  480. package/dist/runner/context/base-prompts.d.ts +10 -0
  481. package/dist/runner/context/base-prompts.d.ts.map +1 -0
  482. package/dist/runner/context/base-prompts.js +255 -0
  483. package/dist/runner/context/recipe-context.d.ts +17 -0
  484. package/dist/runner/context/recipe-context.d.ts.map +1 -0
  485. package/dist/runner/context/recipe-context.js +48 -0
  486. package/dist/runner/context/task-context.d.ts +24 -0
  487. package/dist/runner/context/task-context.d.ts.map +1 -0
  488. package/dist/runner/context/task-context.js +266 -0
  489. package/dist/runner/index.d.ts +12 -0
  490. package/dist/runner/index.d.ts.map +1 -0
  491. package/dist/runner/index.js +11 -0
  492. package/dist/runner/policy-decision.d.ts +12 -0
  493. package/dist/runner/policy-decision.d.ts.map +1 -0
  494. package/dist/runner/policy-decision.js +89 -0
  495. package/dist/runner/policy-display.d.ts +4 -0
  496. package/dist/runner/policy-display.d.ts.map +1 -0
  497. package/dist/runner/policy-display.js +41 -0
  498. package/dist/runner/process-supervision.d.ts +48 -0
  499. package/dist/runner/process-supervision.d.ts.map +1 -0
  500. package/dist/runner/process-supervision.js +490 -0
  501. package/dist/runner/result-manifest-policy.d.ts +9 -0
  502. package/dist/runner/result-manifest-policy.d.ts.map +1 -0
  503. package/dist/runner/result-manifest-policy.js +96 -0
  504. package/dist/runner/result-manifest.d.ts +30 -0
  505. package/dist/runner/result-manifest.d.ts.map +1 -0
  506. package/dist/runner/result-manifest.js +322 -0
  507. package/dist/runner/run-id.d.ts +2 -0
  508. package/dist/runner/run-id.d.ts.map +1 -0
  509. package/dist/runner/run-id.js +3 -0
  510. package/dist/runner/run-repository.d.ts +51 -0
  511. package/dist/runner/run-repository.d.ts.map +1 -0
  512. package/dist/runner/run-repository.js +222 -0
  513. package/dist/runner/task-run-paths.d.ts +19 -0
  514. package/dist/runner/task-run-paths.d.ts.map +1 -0
  515. package/dist/runner/task-run-paths.js +25 -0
  516. package/dist/runner/task-state.d.ts +9 -0
  517. package/dist/runner/task-state.d.ts.map +1 -0
  518. package/dist/runner/task-state.js +354 -0
  519. package/dist/runner/test-helpers.d.ts +30 -0
  520. package/dist/runner/test-helpers.d.ts.map +1 -0
  521. package/dist/runner/test-helpers.js +97 -0
  522. package/dist/runner/trace-artifacts.d.ts +14 -0
  523. package/dist/runner/trace-artifacts.d.ts.map +1 -0
  524. package/dist/runner/trace-artifacts.js +80 -0
  525. package/dist/runner/trace.d.ts +10 -0
  526. package/dist/runner/trace.d.ts.map +1 -0
  527. package/dist/runner/trace.js +37 -0
  528. package/dist/runner/types.d.ts +317 -0
  529. package/dist/runner/types.d.ts.map +1 -0
  530. package/dist/runner/types.js +3 -0
  531. package/dist/runner/usecases/scenario-materialize-task.d.ts +29 -0
  532. package/dist/runner/usecases/scenario-materialize-task.d.ts.map +1 -0
  533. package/dist/runner/usecases/scenario-materialize-task.js +151 -0
  534. package/dist/runner/usecases/task-run-inspect.d.ts +41 -0
  535. package/dist/runner/usecases/task-run-inspect.d.ts.map +1 -0
  536. package/dist/runner/usecases/task-run-inspect.js +74 -0
  537. package/dist/runner/usecases/task-run-lifecycle-cancel.d.ts +10 -0
  538. package/dist/runner/usecases/task-run-lifecycle-cancel.d.ts.map +1 -0
  539. package/dist/runner/usecases/task-run-lifecycle-cancel.js +172 -0
  540. package/dist/runner/usecases/task-run-lifecycle-replay.d.ts +18 -0
  541. package/dist/runner/usecases/task-run-lifecycle-replay.d.ts.map +1 -0
  542. package/dist/runner/usecases/task-run-lifecycle-replay.js +128 -0
  543. package/dist/runner/usecases/task-run-lifecycle-shared.d.ts +45 -0
  544. package/dist/runner/usecases/task-run-lifecycle-shared.d.ts.map +1 -0
  545. package/dist/runner/usecases/task-run-lifecycle-shared.js +172 -0
  546. package/dist/runner/usecases/task-run-lifecycle.d.ts +4 -0
  547. package/dist/runner/usecases/task-run-lifecycle.d.ts.map +1 -0
  548. package/dist/runner/usecases/task-run-lifecycle.js +2 -0
  549. package/dist/runner/usecases/task-run.d.ts +32 -0
  550. package/dist/runner/usecases/task-run.d.ts.map +1 -0
  551. package/dist/runner/usecases/task-run.js +278 -0
  552. package/dist/shared/agent-emoji.d.ts.map +1 -1
  553. package/dist/shared/agent-emoji.js +1 -0
  554. package/dist/shared/errors.d.ts +1 -1
  555. package/dist/shared/errors.d.ts.map +1 -1
  556. package/dist/shared/guards.d.ts.map +1 -1
  557. package/dist/shared/guards.js +1 -0
  558. package/dist/shared/repo-cli-version.d.ts.map +1 -1
  559. package/dist/shared/repo-cli-version.js +7 -5
  560. package/dist/shared/task-doc-conflicts.d.ts +12 -0
  561. package/dist/shared/task-doc-conflicts.d.ts.map +1 -0
  562. package/dist/shared/task-doc-conflicts.js +40 -0
  563. package/dist/shared/task-doc-state.d.ts +10 -0
  564. package/dist/shared/task-doc-state.d.ts.map +1 -0
  565. package/dist/shared/task-doc-state.js +15 -0
  566. package/dist/test-helpers/fs.d.ts +2 -0
  567. package/dist/test-helpers/fs.d.ts.map +1 -0
  568. package/dist/test-helpers/fs.js +9 -0
  569. package/dist/usecases/context/resolve-context.d.ts +2 -0
  570. package/dist/usecases/context/resolve-context.d.ts.map +1 -1
  571. package/dist/usecases/context/resolve-context.js +4 -1
  572. package/dist/usecases/task/task-list-usecase.d.ts.map +1 -1
  573. package/dist/usecases/task/task-list-usecase.js +2 -8
  574. package/dist/workflow-runtime/fix.d.ts +9 -1
  575. package/dist/workflow-runtime/fix.d.ts.map +1 -1
  576. package/dist/workflow-runtime/fix.js +9 -1
  577. package/package.json +2 -2
  578. package/dist/backends/task-backend.test-helpers.d.ts +0 -4
  579. package/dist/backends/task-backend.test-helpers.d.ts.map +0 -1
  580. package/dist/backends/task-backend.test-helpers.js +0 -33
  581. package/dist/cli/run-cli/catalog.d.ts +0 -7
  582. package/dist/cli/run-cli/catalog.d.ts.map +0 -1
  583. package/dist/cli/run-cli/catalog.js +0 -22
  584. package/dist/cli/run-cli.core.pr-flow.test-helpers.d.ts +0 -3
  585. package/dist/cli/run-cli.core.pr-flow.test-helpers.d.ts.map +0 -1
  586. package/dist/cli/run-cli.core.pr-flow.test-helpers.js +0 -41
  587. package/dist/cli/run-cli.core.tasks.test-helpers.d.ts +0 -2
  588. package/dist/cli/run-cli.core.tasks.test-helpers.d.ts.map +0 -1
  589. package/dist/cli/run-cli.core.tasks.test-helpers.js +0 -6
  590. package/dist/commands/block.command.d.ts +0 -4
  591. package/dist/commands/block.command.d.ts.map +0 -1
  592. package/dist/commands/block.command.js +0 -2
  593. package/dist/commands/doctor.command.d.ts +0 -3
  594. package/dist/commands/doctor.command.d.ts.map +0 -1
  595. package/dist/commands/doctor.command.js +0 -2
  596. package/dist/commands/finish.command.d.ts +0 -4
  597. package/dist/commands/finish.command.d.ts.map +0 -1
  598. package/dist/commands/finish.command.js +0 -2
  599. package/dist/commands/recipes/install.command.d.ts +0 -3
  600. package/dist/commands/recipes/install.command.d.ts.map +0 -1
  601. package/dist/commands/recipes/install.command.js +0 -2
  602. package/dist/commands/start.command.d.ts +0 -4
  603. package/dist/commands/start.command.d.ts.map +0 -1
  604. package/dist/commands/start.command.js +0 -2
  605. package/dist/commands/task/list.command.d.ts +0 -4
  606. package/dist/commands/task/list.command.d.ts.map +0 -1
  607. package/dist/commands/task/list.command.js +0 -2
  608. package/dist/commands/task/next.command.d.ts +0 -4
  609. package/dist/commands/task/next.command.d.ts.map +0 -1
  610. package/dist/commands/task/next.command.js +0 -2
  611. package/dist/commands/task/search.command.d.ts +0 -4
  612. package/dist/commands/task/search.command.d.ts.map +0 -1
  613. package/dist/commands/task/search.command.js +0 -2
  614. package/dist/commands/task/show.command.d.ts +0 -4
  615. package/dist/commands/task/show.command.d.ts.map +0 -1
  616. package/dist/commands/task/show.command.js +0 -2
  617. package/dist/commands/verify.command.d.ts +0 -4
  618. package/dist/commands/verify.command.d.ts.map +0 -1
  619. package/dist/commands/verify.command.js +0 -2
@@ -0,0 +1,117 @@
1
+ import { usageError } from "../../cli/spec/errors.js";
2
+ import { exitCodeForError } from "../../cli/exit-codes.js";
3
+ import { mapBackendError } from "../../cli/error-map.js";
4
+ import { createCliEmitter } from "../../cli/output.js";
5
+ import { loadCommandContext } from "../shared/task-backend.js";
6
+ import { executeTaskRunnerExecution } from "../../runner/usecases/task-run.js";
7
+ import { materializeRecipeScenarioTask } from "../../runner/usecases/scenario-materialize-task.js";
8
+ import { cmdTaskPlanApprove } from "../task/plan.js";
9
+ import { cmdTaskStartReady } from "../task/start-ready.js";
10
+ import { CliError } from "../../shared/errors.js";
11
+ const output = createCliEmitter();
12
+ export const scenarioExecuteSpec = {
13
+ id: ["scenario", "execute"],
14
+ group: "Scenario",
15
+ summary: "Materialize a recipe-backed task and execute it through the shared runner flow.",
16
+ description: "Resolves a recipe scenario, materializes a task from its explicit task_template, and executes the shared runner with recipe context bundled alongside the created task.",
17
+ args: [{ name: "id", required: true, valueHint: "<recipe:scenario>" }],
18
+ examples: [
19
+ {
20
+ cmd: "agentplane scenario execute viewer:demo",
21
+ why: "Create a task from the scenario template and execute it through the configured runner.",
22
+ },
23
+ ],
24
+ parse: (raw) => {
25
+ const id = String(raw.args.id ?? "");
26
+ const [recipeId, scenarioId] = id.split(":", 2);
27
+ if (!recipeId || !scenarioId) {
28
+ throw usageError({
29
+ spec: scenarioExecuteSpec,
30
+ command: "scenario execute",
31
+ message: `Invalid scenario id: ${id} (expected: <recipe:scenario>)`,
32
+ });
33
+ }
34
+ return { recipeId, scenarioId };
35
+ },
36
+ };
37
+ function renderScenarioExecuteStartBody(parsed, taskId) {
38
+ return (`Start: execute recipe scenario ${parsed.recipeId}:${parsed.scenarioId} through the shared runner ` +
39
+ `using materialized task ${taskId} and its explicit task_template.`);
40
+ }
41
+ function renderScenarioExecutePlanApprovalNote(parsed) {
42
+ return (`Materialized from recipe scenario ${parsed.recipeId}:${parsed.scenarioId} ` +
43
+ "for immediate shared-runner execution.");
44
+ }
45
+ export const runScenarioExecute = async (ctx, parsed) => {
46
+ try {
47
+ const commandCtx = await loadCommandContext({
48
+ cwd: ctx.cwd,
49
+ rootOverride: ctx.rootOverride ?? null,
50
+ });
51
+ const materialized = await materializeRecipeScenarioTask({
52
+ ctx: commandCtx,
53
+ cwd: ctx.cwd,
54
+ rootOverride: ctx.rootOverride ?? null,
55
+ recipe_id: parsed.recipeId,
56
+ scenario_id: parsed.scenarioId,
57
+ });
58
+ await cmdTaskPlanApprove({
59
+ ctx: commandCtx,
60
+ cwd: ctx.cwd,
61
+ rootOverride: ctx.rootOverride ?? undefined,
62
+ taskId: materialized.task_id,
63
+ by: "ORCHESTRATOR",
64
+ note: renderScenarioExecutePlanApprovalNote(parsed),
65
+ });
66
+ await cmdTaskStartReady({
67
+ ctx: commandCtx,
68
+ cwd: ctx.cwd,
69
+ rootOverride: ctx.rootOverride ?? undefined,
70
+ taskId: materialized.task_id,
71
+ author: materialized.task.owner,
72
+ body: renderScenarioExecuteStartBody(parsed, materialized.task_id),
73
+ force: false,
74
+ yes: false,
75
+ quiet: true,
76
+ });
77
+ const executed = await executeTaskRunnerExecution({
78
+ ctx: commandCtx,
79
+ cwd: ctx.cwd,
80
+ rootOverride: ctx.rootOverride ?? null,
81
+ task_id: materialized.task_id,
82
+ run_id: materialized.run_id,
83
+ recipe: materialized.recipe_context,
84
+ target: {
85
+ kind: "recipe_scenario",
86
+ recipe_id: parsed.recipeId,
87
+ scenario_id: parsed.scenarioId,
88
+ task_id: materialized.task_id,
89
+ },
90
+ });
91
+ output.info(`scenario executed: ${parsed.recipeId}:${parsed.scenarioId}`);
92
+ output.line(`task_id: ${materialized.task_id}`);
93
+ output.line(`run_id: ${executed.invocation.run_id}`);
94
+ output.line(`state: ${executed.bundle.execution.artifact_paths.state_path}`);
95
+ output.line(`events: ${executed.bundle.execution.artifact_paths.events_path}`);
96
+ output.line(`status: ${executed.result.status}`);
97
+ output.line(`runner_exit_code: ${executed.result.exit_code ?? "null"}`);
98
+ if (executed.result.stdout_summary) {
99
+ output.line(`stdout: ${executed.result.stdout_summary}`);
100
+ }
101
+ if (executed.result.stderr_summary) {
102
+ output.line(`stderr: ${executed.result.stderr_summary}`, "stderr");
103
+ }
104
+ return executed.result.status === "success"
105
+ ? 0
106
+ : (executed.result.exit_code ?? exitCodeForError("E_RUNTIME"));
107
+ }
108
+ catch (err) {
109
+ if (err instanceof CliError)
110
+ throw err;
111
+ throw mapBackendError(err, {
112
+ command: scenarioExecuteSpec.id.join(" "),
113
+ recipe_id: parsed.recipeId,
114
+ scenario_id: parsed.scenarioId,
115
+ });
116
+ }
117
+ };
@@ -1 +1 @@
1
- {"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../../../../src/commands/scenario/impl/commands.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAwB,MAAM,qBAAqB,CAAC;AAkB3E,KAAK,iBAAiB,GAAG,MAAM,GAAG,MAAM,CAAC;AAEzC,KAAK,oBAAoB,GAAG;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB,CAAC;AAmKF,wBAAgB,2BAA2B,CACzC,OAAO,EAAE,iBAAiB,EAC1B,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,MAAM,EAAE,GACb,oBAAoB,CAQtB;AAED,wBAAsB,qBAAqB,CAAC,IAAI,EAAE;IAChD,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,GAAG,OAAO,CAAC,MAAM,CAAC,CA8BlB;AAED,wBAAsB,qBAAqB,CAAC,IAAI,EAAE;IAChD,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;CACpB,GAAG,OAAO,CAAC,MAAM,CAAC,CAsClB;AAED,wBAAsB,iBAAiB,CAAC,IAAI,EAAE;IAC5C,OAAO,EAAE,iBAAiB,CAAC;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC7B,GAAG,OAAO,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CA2ChE;AAED,wBAAsB,oBA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,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC7B,GAAG,OAAO,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CA2ChE;AAED,wBAAsB,oBAAoB,CAAC,IAAI,EAAE;IAC/C,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC,CAAC;CACvD,GAAG,OAAO,CAAC,MAAM,CAAC,CAuClB"}
@@ -5,17 +5,11 @@ import { resolveProject } from "@agentplaneorg/core";
5
5
  import { mapCoreError } from "../../../cli/error-map.js";
6
6
  import { exitCodeForError } from "../../../cli/exit-codes.js";
7
7
  import { fileExists } from "../../../cli/fs-utils.js";
8
- import { emptyStateMessage } from "../../../cli/output.js";
8
+ import { createCliEmitter, emptyStateMessage } from "../../../cli/output.js";
9
9
  import { CliError } from "../../../shared/errors.js";
10
- import { formatJsonBlock } from "../../recipes/impl/format.js";
11
10
  import { listResolvedRecipeScenarios, readProjectInstalledRecipes, readScenarioDefinition, resolveRecipeScenarioSelection, } from "../../recipes.js";
12
11
  const execFileAsync = promisify(execFile);
13
- function printJsonSection(label, value) {
14
- const payload = formatJsonBlock(value, " ");
15
- if (!payload)
16
- return;
17
- process.stdout.write(`${label}:\n${payload}\n`);
18
- }
12
+ const output = createCliEmitter();
19
13
  function buildScenarioNotFoundError(recipeId, scenarioId) {
20
14
  return new CliError({
21
15
  exitCode: exitCodeForError("E_IO"),
@@ -49,6 +43,13 @@ async function resolveScenarioForCli(opts) {
49
43
  if (message.startsWith("No recipe scenario matches")) {
50
44
  throw buildScenarioNotFoundError(opts.recipeId, opts.scenarioId);
51
45
  }
46
+ if (message.startsWith("Scenario definition not found")) {
47
+ throw new CliError({
48
+ exitCode: exitCodeForError("E_IO"),
49
+ code: "E_IO",
50
+ message,
51
+ });
52
+ }
52
53
  if (message.startsWith("Scenario selection is ambiguous")) {
53
54
  throw new CliError({
54
55
  exitCode: exitCodeForError("E_VALIDATION"),
@@ -56,6 +57,15 @@ async function resolveScenarioForCli(opts) {
56
57
  message,
57
58
  });
58
59
  }
60
+ if (message.startsWith("Missing required field: scenario.") ||
61
+ message.startsWith("Invalid field scenario.") ||
62
+ message.startsWith("Scenario definition id mismatch:")) {
63
+ throw new CliError({
64
+ exitCode: exitCodeForError("E_VALIDATION"),
65
+ code: "E_VALIDATION",
66
+ message,
67
+ });
68
+ }
59
69
  throw error;
60
70
  }
61
71
  }
@@ -94,9 +104,9 @@ async function validateScenarioRecipeFiles(opts) {
94
104
  const agents = opts.entry.manifest.agents ?? [];
95
105
  const skills = opts.entry.manifest.skills ?? [];
96
106
  const tools = opts.entry.manifest.tools ?? [];
97
- const selectedAgents = agents.filter((agent) => opts.selection.run_profile.agents_involved.includes(agent.id));
98
- const selectedSkills = skills.filter((skill) => opts.selection.run_profile.skills_used.includes(skill.id));
99
- const selectedTools = tools.filter((tool) => opts.selection.run_profile.tools_used.includes(tool.id));
107
+ const selectedAgents = agents.filter((agent) => opts.selection.agents_involved.includes(agent.id));
108
+ const selectedSkills = skills.filter((skill) => opts.selection.skills_used.includes(skill.id));
109
+ const selectedTools = tools.filter((tool) => opts.selection.tools_used.includes(tool.id));
100
110
  for (const agent of selectedAgents) {
101
111
  const agentFile = path.join(opts.selection.recipe_dir, agent.file);
102
112
  if (!(await fileExists(agentFile))) {
@@ -164,13 +174,13 @@ export async function cmdScenarioListParsed(opts) {
164
174
  includeIncompatible: true,
165
175
  });
166
176
  if (entries.length === 0) {
167
- process.stdout.write(`${emptyStateMessage("scenarios", "Install a recipe to add scenarios.")}\n`);
177
+ output.line(emptyStateMessage("scenarios", "Install a recipe to add scenarios."));
168
178
  return 0;
169
179
  }
170
180
  for (const entry of entries) {
171
181
  const compatibilityLabel = entry.compatibility.ok ? "compatible" : "incompatible";
172
- process.stdout.write(`${entry.recipe_id}:${entry.scenario_id} - ${entry.scenario_summary} ` +
173
- `[mode=${entry.run_profile.mode}] [${compatibilityLabel}]\n`);
182
+ output.line(`${entry.recipe_id}:${entry.scenario_id} - ${entry.scenario_summary} ` +
183
+ `[mode=${entry.run_profile.mode}] [${compatibilityLabel}]`);
174
184
  }
175
185
  return 0;
176
186
  }
@@ -191,23 +201,24 @@ export async function cmdScenarioInfoParsed(opts) {
191
201
  recipeId: opts.recipeId,
192
202
  scenarioId: opts.scenarioId,
193
203
  });
194
- process.stdout.write(`Scenario: ${selection.recipe_id}:${selection.scenario_id}\n`);
195
- process.stdout.write(`Recipe: ${selection.recipe_name} (${selection.recipe_id}@${selection.recipe_version})\n`);
196
- process.stdout.write(`Summary: ${selection.scenario_summary}\n`);
204
+ output.line(`Scenario: ${selection.recipe_id}:${selection.scenario_id}`);
205
+ output.line(`Recipe: ${selection.recipe_name} (${selection.recipe_id}@${selection.recipe_version})`);
206
+ output.line(`Summary: ${selection.scenario_summary}`);
197
207
  if (selection.scenario_description) {
198
- process.stdout.write(`Description: ${selection.scenario_description}\n`);
208
+ output.line(`Description: ${selection.scenario_description}`);
199
209
  }
200
- printJsonSection("Use when", selection.use_when);
210
+ output.jsonSection("Use when", selection.use_when);
201
211
  if (selection.avoid_when.length > 0) {
202
- printJsonSection("Avoid when", selection.avoid_when);
212
+ output.jsonSection("Avoid when", selection.avoid_when);
203
213
  }
204
- printJsonSection("Run profile", selection.run_profile);
205
- process.stdout.write(`Scenario file: ${path.relative(project.gitRoot, selection.scenario_file)}\n`);
214
+ output.jsonSection("Run profile", selection.run_profile);
215
+ output.jsonSection("Task template", selection.task_template);
216
+ output.line(`Scenario file: ${path.relative(project.gitRoot, selection.scenario_file)}`);
206
217
  if (selection.compatibility.ok) {
207
- process.stdout.write("Compatibility: satisfied\n");
218
+ output.line("Compatibility: satisfied");
208
219
  }
209
220
  else {
210
- printJsonSection("Compatibility failures", selection.compatibility.failures);
221
+ output.jsonSection("Compatibility failures", selection.compatibility.failures);
211
222
  }
212
223
  return 0;
213
224
  }
@@ -275,17 +286,19 @@ export async function cmdScenarioRunParsed(opts) {
275
286
  assertScenarioCompatibility(selection);
276
287
  const scenarioDefinition = await readValidatedScenarioDefinition({ selection });
277
288
  const validationChecks = await validateScenarioRecipeFiles({ entry, selection });
278
- process.stdout.write(`Prepared run plan: ${selection.recipe_id}:${selection.scenario_id}\n`);
279
- process.stdout.write(`Recipe: ${selection.recipe_name} (${selection.recipe_id}@${selection.recipe_version})\n`);
280
- process.stdout.write(`Goal: ${scenarioDefinition.goal}\n`);
281
- process.stdout.write(`Scenario file: ${path.relative(project.gitRoot, selection.scenario_file)}\n`);
282
- printJsonSection("Run profile", selection.run_profile);
283
- printJsonSection("Selection reasons", selection.selection_reasons);
284
- printJsonSection("Validation", [
289
+ output.line(`Prepared run plan: ${selection.recipe_id}:${selection.scenario_id}`);
290
+ output.line(`Recipe: ${selection.recipe_name} (${selection.recipe_id}@${selection.recipe_version})`);
291
+ output.line(`Goal: ${scenarioDefinition.goal}`);
292
+ output.line(`Scenario file: ${path.relative(project.gitRoot, selection.scenario_file)}`);
293
+ output.jsonSection("Run profile", selection.run_profile);
294
+ output.jsonSection("Selection reasons", selection.selection_reasons);
295
+ output.jsonSection("Validation", [
285
296
  `scenario definition ok: ${path.relative(project.gitRoot, selection.scenario_file)}`,
286
297
  ...validationChecks,
287
298
  ]);
288
- process.stdout.write("Status: scenario orchestration runtime is not implemented yet.\n");
299
+ output.line("Status: preview only; no task created and no runner executed.");
300
+ output.line(`Next: use \`agentplane scenario execute ${selection.recipe_id}:${selection.scenario_id}\` ` +
301
+ "to materialize and run this scenario.");
289
302
  return 0;
290
303
  }
291
304
  catch (err) {
@@ -3,12 +3,12 @@ import { cmdScenarioRunParsed } from "../scenario.js";
3
3
  export const scenarioRunSpec = {
4
4
  id: ["scenario", "run"],
5
5
  group: "Scenario",
6
- summary: "Validate a scenario and print a prepared run plan (no execution).",
6
+ summary: "Preview a validated scenario plan without creating a task or running a runner.",
7
7
  args: [{ name: "id", required: true, valueHint: "<recipe:scenario>" }],
8
8
  examples: [
9
9
  {
10
10
  cmd: "agentplane scenario run viewer:demo",
11
- why: "Validate a scenario and inspect the prepared run plan.",
11
+ why: "Validate a scenario and inspect the preview plan before `scenario execute`.",
12
12
  },
13
13
  ],
14
14
  parse: (raw) => {
@@ -1,6 +1,5 @@
1
1
  import type { CommandHandler, CommandSpec } from "../../cli/spec/spec.js";
2
- type ScenarioParsed = Record<string, never>;
3
- export declare const scenarioSpec: CommandSpec<ScenarioParsed>;
4
- export declare const runScenario: CommandHandler<ScenarioParsed>;
5
- export {};
2
+ import { type GroupCommandParsed } from "../../cli/group-command.js";
3
+ export declare const scenarioSpec: CommandSpec<GroupCommandParsed>;
4
+ export declare const runScenario: CommandHandler<GroupCommandParsed>;
6
5
  //# sourceMappingURL=scenario.command.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"scenario.command.d.ts","sourceRoot":"","sources":["../../../src/commands/scenario/scenario.command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAc,MAAM,wBAAwB,CAAC;AAItF,KAAK,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AAI5C,eAAO,MAAM,YAAY,EAAE,WAAW,CAAC,cAAc,CAyBpD,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,cAAc,CAAC,cAAc,CAOtD,CAAC"}
1
+ {"version":3,"file":"scenario.command.d.ts","sourceRoot":"","sources":["../../../src/commands/scenario/scenario.command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAc,MAAM,wBAAwB,CAAC;AACtF,OAAO,EAIL,KAAK,kBAAkB,EACxB,MAAM,4BAA4B,CAAC;AAEpC,eAAO,MAAM,YAAY,EAAE,WAAW,CAAC,kBAAkB,CAOxD,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,cAAc,CAAC,kBAAkB,CAY1D,CAAC"}
@@ -1,37 +1,19 @@
1
- import { usageError } from "../../cli/spec/errors.js";
2
- import { suggestOne } from "../../cli/spec/suggest.js";
3
- const SCENARIO_SUBCOMMANDS = ["list", "info", "run"];
1
+ import { loadDirectSubcommandNames, parseGroupCommand, throwGroupCommandUsage, } from "../../cli/group-command.js";
4
2
  export const scenarioSpec = {
5
3
  id: ["scenario"],
6
4
  group: "Scenario",
7
5
  summary: "Recipe scenario commands.",
8
6
  synopsis: ["agentplane scenario <subcommand> [options]"],
9
7
  args: [{ name: "subcommand", required: false, variadic: true, valueHint: "<subcommand>" }],
10
- parse: () => ({}),
11
- validateRaw: (raw) => {
12
- const rest = Array.isArray(raw.args.subcommand) ? raw.args.subcommand : [];
13
- const sub = rest[0];
14
- if (!sub) {
15
- throw usageError({
16
- spec: scenarioSpec,
17
- command: "scenario",
18
- message: "Missing scenario subcommand.",
19
- });
20
- }
21
- const suggestion = suggestOne(String(sub), [...SCENARIO_SUBCOMMANDS]);
22
- const suffix = suggestion ? ` Did you mean: ${suggestion}?` : "";
23
- throw usageError({
24
- spec: scenarioSpec,
25
- command: "scenario",
26
- message: `Unknown scenario subcommand: ${String(sub)}.${suffix}`,
27
- });
28
- },
8
+ parse: (raw) => parseGroupCommand(raw, "subcommand"),
29
9
  };
30
- export const runScenario = (_ctx) => {
31
- // Should be unreachable because validateRaw always throws.
32
- throw usageError({
10
+ export const runScenario = async (_ctx, p) => {
11
+ throwGroupCommandUsage({
33
12
  spec: scenarioSpec,
13
+ cmd: p.cmd,
14
+ subcommands: await loadDirectSubcommandNames(["scenario"]),
34
15
  command: "scenario",
35
- message: "Missing scenario subcommand.",
16
+ missingMessage: "Missing scenario subcommand.",
17
+ unknownMessage: (subcommand) => `Unknown scenario subcommand: ${subcommand}.`,
36
18
  });
37
19
  };
@@ -9,6 +9,7 @@ export declare class GitContext {
9
9
  statusStagedPaths(): Promise<string[]>;
10
10
  statusUntrackedPaths(): Promise<string[]>;
11
11
  statusUnstagedTrackedPaths(): Promise<string[]>;
12
+ invalidateStatus(): void;
12
13
  headCommit(): Promise<string>;
13
14
  stage(paths: string[]): Promise<void>;
14
15
  commit(opts: {
@@ -1 +1 @@
1
- {"version":3,"file":"git-context.d.ts","sourceRoot":"","sources":["../../../src/commands/shared/git-context.ts"],"names":[],"mappings":"AAyEA,qBAAa,UAAU;IACrB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAEzB,OAAO,CAAC,IAAI,CAGL;gBAEK,IAAI,EAAE;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE;YAIvB,gBAAgB;IAmBxB,kBAAkB,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IAKvC,iBAAiB,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IAKtC,oBAAoB,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IAKzC,0BAA0B,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IAKrD,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC;IAWvB,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAWrC,MAAM,CAAC,IAAI,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAcxF,iBAAiB,CAAC,IAAI,CAAC,EAAE;QAAE,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAWpE,eAAe,IAAI,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;CAWpE"}
1
+ {"version":3,"file":"git-context.d.ts","sourceRoot":"","sources":["../../../src/commands/shared/git-context.ts"],"names":[],"mappings":"AAyEA,qBAAa,UAAU;IACrB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAEzB,OAAO,CAAC,IAAI,CAGL;gBAEK,IAAI,EAAE;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE;YAIvB,gBAAgB;IAmBxB,kBAAkB,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IAKvC,iBAAiB,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IAKtC,oBAAoB,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IAKzC,0BAA0B,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IAKrD,gBAAgB,IAAI,IAAI;IAIxB,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC;IAWvB,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAUrC,MAAM,CAAC,IAAI,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAcxF,iBAAiB,CAAC,IAAI,CAAC,EAAE;QAAE,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAWpE,eAAe,IAAI,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;CAWpE"}
@@ -95,6 +95,9 @@ export class GitContext {
95
95
  const status = await this.statusPorcelainZ();
96
96
  return status.unstagedTrackedPaths;
97
97
  }
98
+ invalidateStatus() {
99
+ this.memo.status = undefined;
100
+ }
98
101
  headCommit() {
99
102
  this.memo.headCommit ??= (async () => {
100
103
  const { stdout } = await execFileAsync("git", ["rev-parse", "HEAD"], {
@@ -113,8 +116,7 @@ export class GitContext {
113
116
  cwd: this.gitRoot,
114
117
  env: gitEnv(),
115
118
  });
116
- // Invalidate memoized status: staging changes index state.
117
- this.memo.status = undefined;
119
+ this.invalidateStatus();
118
120
  }
119
121
  async commit(opts) {
120
122
  const args = ["commit", "-m", opts.message];
@@ -1,6 +1,7 @@
1
1
  export declare function gitRevParse(cwd: string, args: string[]): Promise<string>;
2
2
  export declare function gitCurrentBranch(cwd: string): Promise<string>;
3
3
  export declare function gitBranchExists(cwd: string, branch: string): Promise<boolean>;
4
+ export declare function gitBranchUpstream(cwd: string, branch: string): Promise<string | null>;
4
5
  export declare function gitListBranches(cwd: string): Promise<string[]>;
5
6
  export declare function gitStagedPaths(cwd: string): Promise<string[]>;
6
7
  export declare function gitAddPaths(cwd: string, paths: string[]): Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"git-ops.d.ts","sourceRoot":"","sources":["../../../src/commands/shared/git-ops.ts"],"names":[],"mappings":"AAMA,wBAAsB,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAK9E;AAED,wBAAsB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAwBnE;AAED,wBAAsB,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAYnF;AAED,wBAAsB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CASpE;AAED,wBAAsB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CASnE;AAED,wBAAsB,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAG7E;AAED,wBAAsB,SAAS,CAC7B,GAAG,EAAE,MAAM,EACX,OAAO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(cwd, branch) {
56
+ try {
57
+ const { stdout } = await execFileAsync("git", ["for-each-ref", "--format=%(upstream:short)", `refs/heads/${branch}`], {
58
+ cwd,
59
+ env: gitEnv(),
60
+ });
61
+ const trimmed = stdout.trim();
62
+ return trimmed.length > 0 ? trimmed : null;
63
+ }
64
+ catch {
65
+ return null;
66
+ }
67
+ }
55
68
  export async function gitListBranches(cwd) {
56
69
  const { stdout } = await execFileAsync("git", ["branch", "--format=%(refname:short)"], {
57
70
  cwd,
@@ -0,0 +1,10 @@
1
+ export type OperatorPipelineSpec<TState, TResult, TOutput = TResult> = {
2
+ init: () => Promise<TState> | TState;
3
+ preflight?: (state: TState) => Promise<void> | void;
4
+ materialize?: (state: TState) => Promise<void> | void;
5
+ execute: (state: TState) => Promise<TResult> | TResult;
6
+ finalize?: (state: TState, result: TResult) => Promise<TOutput> | TOutput;
7
+ cleanup?: (state: TState, result: TResult | null) => Promise<void> | void;
8
+ };
9
+ export declare function runOperatorPipeline<TState, TResult, TOutput = TResult>(spec: OperatorPipelineSpec<TState, TResult, TOutput>): Promise<TOutput>;
10
+ //# sourceMappingURL=operator-pipeline.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operator-pipeline.d.ts","sourceRoot":"","sources":["../../../src/commands/shared/operator-pipeline.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,oBAAoB,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,IAAI;IACrE,IAAI,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC;IACrC,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IACpD,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IACtD,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;IACvD,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,KAAK,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;IAC1E,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,IAAI,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;CAC3E,CAAC;AAEF,wBAAsB,mBAAmB,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,EAC1E,IAAI,EAAE,oBAAoB,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,GACnD,OAAO,CAAC,OAAO,CAAC,CAclB"}
@@ -0,0 +1,16 @@
1
+ export async function runOperatorPipeline(spec) {
2
+ const state = await spec.init();
3
+ let result = null;
4
+ try {
5
+ await spec.preflight?.(state);
6
+ await spec.materialize?.(state);
7
+ result = await spec.execute(state);
8
+ if (spec.finalize) {
9
+ return await spec.finalize(state, result);
10
+ }
11
+ return result;
12
+ }
13
+ finally {
14
+ await spec.cleanup?.(state, result);
15
+ }
16
+ }
@@ -1,16 +1,36 @@
1
- export type PrMeta = {
2
- schema_version: 1;
3
- task_id: string;
4
- branch?: string;
5
- created_at: string;
6
- updated_at: string;
7
- last_verified_sha: string | null;
8
- last_verified_at: string | null;
9
- verify?: {
10
- status?: "pass" | "fail" | "skipped";
11
- command?: string;
12
- };
1
+ import { type TaskPrMeta } from "@agentplaneorg/core";
2
+ export type PrMeta = TaskPrMeta;
3
+ export type PrArtifactTextState = {
4
+ diffstatText: string | null;
5
+ verifyLogText: string | null;
6
+ reviewText: string | null;
13
7
  };
8
+ export type PrArtifactState = PrArtifactTextState & {
9
+ meta: PrMeta;
10
+ };
11
+ export declare function buildOpenedPrMeta(opts: {
12
+ taskId: string;
13
+ branch: string;
14
+ at: string;
15
+ previousMeta: PrMeta | null;
16
+ }): PrMeta;
17
+ export declare function buildUpdatedPrMeta(opts: {
18
+ meta: PrMeta;
19
+ branch: string;
20
+ at: string;
21
+ }): PrMeta;
22
+ export declare function buildIntegratedPrMeta(opts: {
23
+ meta: PrMeta;
24
+ branch: string;
25
+ base: string;
26
+ mergeStrategy: "squash" | "merge" | "rebase";
27
+ mergeHash: string;
28
+ branchHeadSha: string;
29
+ at: string;
30
+ verifyCommands: string[];
31
+ shouldRunVerify: boolean;
32
+ alreadyVerifiedSha: string | null;
33
+ }): PrMeta;
14
34
  export type ShellInvocation = {
15
35
  command: string;
16
36
  args: string[];
@@ -1 +1 @@
1
- {"version":3,"file":"pr-meta.d.ts","sourceRoot":"","sources":["../../../src/commands/shared/pr-meta.ts"],"names":[],"mappings":"AAcA,MAAM,MAAM,MAAM,GAAG;IACnB,cAAc,EAAE,CAAC,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,MAAM,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CACrE,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB,CAAC;AAEF,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,GAAG,eAAe,CAQvE;AAED,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAc/D;AAED,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAQrE;AAED,wBAAsB,eAAe,CACnC,OAAO,E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C;IAC7C,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,eAAe,EAAE,OAAO,CAAC;IACzB,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAC;CACnC,GAAG,MAAM,CAsBT;AAED,MAAM,MAAM,eAAe,GAAG;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB,CAAC;AAEF,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,GAAG,eAAe,CAQvE;AAED,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAW/D;AAED,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAQrE;AAED,wBAAsB,eAAe,CACnC,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,IAAI,CAAC,CAMf;AAED,wBAAsB,eAAe,CACnC,OAAO,EAAE,MAAM,EACf,GAAG,EAAE,MAAM,GACV,OAAO,CAAC;IACT,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC,CAqBD"}
@@ -1,12 +1,54 @@
1
1
  import { mkdir, writeFile } from "node:fs/promises";
2
2
  import os from "node:os";
3
3
  import path from "node:path";
4
+ import { validateTaskPrMeta } from "@agentplaneorg/core";
4
5
  import { execFileAsync } from "./git.js";
5
- function isRecord(value) {
6
- return !!value && typeof value === "object" && !Array.isArray(value);
6
+ function nowOrExisting(value, fallback) {
7
+ const trimmed = value?.trim() ?? "";
8
+ return trimmed || fallback;
7
9
  }
8
- function isIsoDate(value) {
9
- return typeof value === "string" && !Number.isNaN(Date.parse(value));
10
+ export function buildOpenedPrMeta(opts) {
11
+ return {
12
+ schema_version: 1,
13
+ task_id: opts.taskId,
14
+ branch: opts.branch,
15
+ created_at: opts.previousMeta?.created_at ?? opts.at,
16
+ updated_at: opts.at,
17
+ last_verified_sha: opts.previousMeta?.last_verified_sha ?? null,
18
+ last_verified_at: opts.previousMeta?.last_verified_at ?? null,
19
+ verify: opts.previousMeta?.verify ?? { status: "skipped" },
20
+ base: opts.previousMeta?.base,
21
+ };
22
+ }
23
+ export function buildUpdatedPrMeta(opts) {
24
+ return {
25
+ ...opts.meta,
26
+ branch: opts.branch,
27
+ updated_at: opts.at,
28
+ last_verified_sha: opts.meta.last_verified_sha ?? null,
29
+ last_verified_at: opts.meta.last_verified_at ?? null,
30
+ };
31
+ }
32
+ export function buildIntegratedPrMeta(opts) {
33
+ const nextMeta = {
34
+ ...opts.meta,
35
+ branch: opts.branch,
36
+ base: opts.base,
37
+ merge_strategy: opts.mergeStrategy,
38
+ status: "MERGED",
39
+ merged_at: nowOrExisting(opts.meta.merged_at, opts.at),
40
+ merge_commit: opts.mergeHash,
41
+ head_sha: opts.branchHeadSha,
42
+ updated_at: opts.at,
43
+ };
44
+ if (opts.verifyCommands.length > 0 && (opts.shouldRunVerify || opts.alreadyVerifiedSha)) {
45
+ nextMeta.last_verified_sha = opts.branchHeadSha;
46
+ nextMeta.last_verified_at = opts.at;
47
+ nextMeta.verify = opts.meta.verify
48
+ ? { ...opts.meta.verify, status: "pass" }
49
+ : { status: "pass", command: opts.verifyCommands.join(" && ") };
50
+ }
51
+ return nextMeta;
10
52
  }
11
53
  export function resolveShellInvocation(command) {
12
54
  if (os.platform() === "win32") {
@@ -25,17 +67,10 @@ export function parsePrMeta(raw, taskId) {
25
67
  const message = err instanceof Error ? err.message : String(err);
26
68
  throw new Error(`JSON Parse error: ${message}`);
27
69
  }
28
- if (!isRecord(parsed))
29
- throw new Error("pr/meta.json must be an object");
30
- if (parsed.schema_version !== 1)
31
- throw new Error("pr/meta.json schema_version must be 1");
32
- if (parsed.task_id !== taskId)
70
+ const meta = validateTaskPrMeta(parsed);
71
+ if (meta.task_id !== taskId)
33
72
  throw new Error("pr/meta.json task_id mismatch");
34
- if (!isIsoDate(parsed.created_at))
35
- throw new Error("pr/meta.json created_at must be ISO");
36
- if (!isIsoDate(parsed.updated_at))
37
- throw new Error("pr/meta.json updated_at must be ISO");
38
- return parsed;
73
+ return meta;
39
74
  }
40
75
  export function extractLastVerifiedSha(logText) {
41
76
  const regex = /verified_sha=([0-9a-f]{7,40})/gi;
@@ -1 +1 @@
1
- {"version":3,"file":"reconcile-check.d.ts","sourceRoot":"","sources":["../../../src/commands/shared/reconcile-check.ts"],"names":[],"mappings":"AAGA,OAAO,EAAiB,KAAK,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAuGvE,wBAAsB,8BAA8B,CAAC,IAAI,EAAE;IACzD,GAAG,EAAE,cAAc,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B,GAAG,OAAO,CAAC,IAAI,CAAC,CA+ChB"}
1
+ {"version":3,"file":"reconcile-check.d.ts","sourceRoot":"","sources":["../../../src/commands/shared/reconcile-check.ts"],"names":[],"mappings":"AAKA,OAAO,EAGL,KAAK,cAAc,EACpB,MAAM,mBAAmB,CAAC;AAuG3B,wBAAsB,8BAA8B,CAAC,IAAI,EAAE;IACzD,GAAG,EAAE,cAAc,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B,GAAG,OAAO,CAAC,IAAI,CAAC,CAkDhB"}