opencastle 1.3.1 → 1.4.1

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 (486) hide show
  1. package/README.md +16 -10
  2. package/bin/cli.mjs +8 -9
  3. package/dist/cli/agent-roster.test.js +0 -48
  4. package/dist/cli/agent-roster.test.js.map +1 -1
  5. package/dist/cli/boundary.test.js +9 -7
  6. package/dist/cli/boundary.test.js.map +1 -1
  7. package/dist/cli/convoy/artifacts.d.ts +9 -2
  8. package/dist/cli/convoy/artifacts.d.ts.map +1 -1
  9. package/dist/cli/convoy/artifacts.js +13 -10
  10. package/dist/cli/convoy/artifacts.js.map +1 -1
  11. package/dist/cli/convoy/artifacts.test.js +4 -2
  12. package/dist/cli/convoy/artifacts.test.js.map +1 -1
  13. package/dist/cli/convoy/engine.d.ts +53 -23
  14. package/dist/cli/convoy/engine.d.ts.map +1 -1
  15. package/dist/cli/convoy/engine.git.test.d.ts +2 -0
  16. package/dist/cli/convoy/engine.git.test.d.ts.map +1 -0
  17. package/dist/cli/convoy/engine.git.test.js +435 -0
  18. package/dist/cli/convoy/engine.git.test.js.map +1 -0
  19. package/dist/cli/convoy/engine.js +1746 -2305
  20. package/dist/cli/convoy/engine.js.map +1 -1
  21. package/dist/cli/convoy/engine.test.js +698 -678
  22. package/dist/cli/convoy/engine.test.js.map +1 -1
  23. package/dist/cli/convoy/event-schemas.d.ts +2 -0
  24. package/dist/cli/convoy/event-schemas.d.ts.map +1 -1
  25. package/dist/cli/convoy/event-schemas.js +59 -57
  26. package/dist/cli/convoy/event-schemas.js.map +1 -1
  27. package/dist/cli/convoy/events.d.ts +4 -1
  28. package/dist/cli/convoy/events.d.ts.map +1 -1
  29. package/dist/cli/convoy/events.js +69 -84
  30. package/dist/cli/convoy/events.js.map +1 -1
  31. package/dist/cli/convoy/events.test.js +50 -9
  32. package/dist/cli/convoy/events.test.js.map +1 -1
  33. package/dist/cli/convoy/gates.d.ts +9 -4
  34. package/dist/cli/convoy/gates.d.ts.map +1 -1
  35. package/dist/cli/convoy/gates.js +29 -14
  36. package/dist/cli/convoy/gates.js.map +1 -1
  37. package/dist/cli/convoy/isolation.d.ts +32 -6
  38. package/dist/cli/convoy/isolation.d.ts.map +1 -1
  39. package/dist/cli/convoy/isolation.js +72 -34
  40. package/dist/cli/convoy/isolation.js.map +1 -1
  41. package/dist/cli/convoy/isolation.test.js +66 -42
  42. package/dist/cli/convoy/isolation.test.js.map +1 -1
  43. package/dist/cli/convoy/lock.d.ts.map +1 -1
  44. package/dist/cli/convoy/lock.js +25 -10
  45. package/dist/cli/convoy/lock.js.map +1 -1
  46. package/dist/cli/convoy/lock.test.js +12 -0
  47. package/dist/cli/convoy/lock.test.js.map +1 -1
  48. package/dist/cli/convoy/merge.d.ts +21 -4
  49. package/dist/cli/convoy/merge.d.ts.map +1 -1
  50. package/dist/cli/convoy/merge.js +69 -53
  51. package/dist/cli/convoy/merge.js.map +1 -1
  52. package/dist/cli/convoy/merge.test.js +23 -1
  53. package/dist/cli/convoy/merge.test.js.map +1 -1
  54. package/dist/cli/convoy/progress.d.ts +35 -0
  55. package/dist/cli/convoy/progress.d.ts.map +1 -0
  56. package/dist/cli/convoy/progress.js +103 -0
  57. package/dist/cli/convoy/progress.js.map +1 -0
  58. package/dist/cli/convoy/progress.test.d.ts +2 -0
  59. package/dist/cli/convoy/progress.test.d.ts.map +1 -0
  60. package/dist/cli/convoy/progress.test.js +53 -0
  61. package/dist/cli/convoy/progress.test.js.map +1 -0
  62. package/dist/cli/convoy/read-model.d.ts +468 -0
  63. package/dist/cli/convoy/read-model.d.ts.map +1 -0
  64. package/dist/cli/convoy/read-model.js +1132 -0
  65. package/dist/cli/convoy/read-model.js.map +1 -0
  66. package/dist/cli/convoy/read-model.test.d.ts +2 -0
  67. package/dist/cli/convoy/read-model.test.d.ts.map +1 -0
  68. package/dist/cli/convoy/read-model.test.js +609 -0
  69. package/dist/cli/convoy/read-model.test.js.map +1 -0
  70. package/dist/cli/convoy/redact.d.ts +34 -0
  71. package/dist/cli/convoy/redact.d.ts.map +1 -0
  72. package/dist/cli/convoy/redact.js +66 -0
  73. package/dist/cli/convoy/redact.js.map +1 -0
  74. package/dist/cli/convoy/redact.test.d.ts +2 -0
  75. package/dist/cli/convoy/redact.test.d.ts.map +1 -0
  76. package/dist/cli/convoy/redact.test.js +43 -0
  77. package/dist/cli/convoy/redact.test.js.map +1 -0
  78. package/dist/cli/convoy/reviewer.d.ts +65 -0
  79. package/dist/cli/convoy/reviewer.d.ts.map +1 -0
  80. package/dist/cli/convoy/reviewer.js +141 -0
  81. package/dist/cli/convoy/reviewer.js.map +1 -0
  82. package/dist/cli/convoy/reviewer.test.d.ts +2 -0
  83. package/dist/cli/convoy/reviewer.test.d.ts.map +1 -0
  84. package/dist/cli/convoy/reviewer.test.js +96 -0
  85. package/dist/cli/convoy/reviewer.test.js.map +1 -0
  86. package/dist/cli/convoy/schedule.d.ts +30 -0
  87. package/dist/cli/convoy/schedule.d.ts.map +1 -0
  88. package/dist/cli/convoy/schedule.js +111 -0
  89. package/dist/cli/convoy/schedule.js.map +1 -0
  90. package/dist/cli/convoy/schedule.test.d.ts +2 -0
  91. package/dist/cli/convoy/schedule.test.d.ts.map +1 -0
  92. package/dist/cli/convoy/schedule.test.js +45 -0
  93. package/dist/cli/convoy/schedule.test.js.map +1 -0
  94. package/dist/cli/convoy/spec-builder.d.ts +120 -30
  95. package/dist/cli/convoy/spec-builder.d.ts.map +1 -1
  96. package/dist/cli/convoy/spec-builder.js +438 -114
  97. package/dist/cli/convoy/spec-builder.js.map +1 -1
  98. package/dist/cli/convoy/spec-builder.test.js +419 -435
  99. package/dist/cli/convoy/spec-builder.test.js.map +1 -1
  100. package/dist/cli/convoy/spec-types.d.ts +46 -92
  101. package/dist/cli/convoy/spec-types.d.ts.map +1 -1
  102. package/dist/cli/convoy/store.d.ts +6 -1
  103. package/dist/cli/convoy/store.d.ts.map +1 -1
  104. package/dist/cli/convoy/store.js +111 -15
  105. package/dist/cli/convoy/store.js.map +1 -1
  106. package/dist/cli/convoy/store.test.js +59 -13
  107. package/dist/cli/convoy/store.test.js.map +1 -1
  108. package/dist/cli/convoy/types.d.ts +76 -113
  109. package/dist/cli/convoy/types.d.ts.map +1 -1
  110. package/dist/cli/convoy/types.js +6 -13
  111. package/dist/cli/convoy/types.js.map +1 -1
  112. package/dist/cli/convoy/worktree.d.ts +88 -3
  113. package/dist/cli/convoy/worktree.d.ts.map +1 -1
  114. package/dist/cli/convoy/worktree.js +282 -56
  115. package/dist/cli/convoy/worktree.js.map +1 -1
  116. package/dist/cli/convoy/worktree.test.js +132 -1
  117. package/dist/cli/convoy/worktree.test.js.map +1 -1
  118. package/dist/cli/convoy-args.test.js +9 -27
  119. package/dist/cli/convoy-args.test.js.map +1 -1
  120. package/dist/cli/convoy-cmd.d.ts +31 -6
  121. package/dist/cli/convoy-cmd.d.ts.map +1 -1
  122. package/dist/cli/convoy-cmd.js +150 -201
  123. package/dist/cli/convoy-cmd.js.map +1 -1
  124. package/dist/cli/convoy-cmd.test.d.ts +2 -0
  125. package/dist/cli/convoy-cmd.test.d.ts.map +1 -0
  126. package/dist/cli/convoy-cmd.test.js +144 -0
  127. package/dist/cli/convoy-cmd.test.js.map +1 -0
  128. package/dist/cli/dashboard.d.ts +24 -11
  129. package/dist/cli/dashboard.d.ts.map +1 -1
  130. package/dist/cli/dashboard.js +241 -303
  131. package/dist/cli/dashboard.js.map +1 -1
  132. package/dist/cli/dashboard.test.d.ts +2 -0
  133. package/dist/cli/dashboard.test.d.ts.map +1 -0
  134. package/dist/cli/dashboard.test.js +340 -0
  135. package/dist/cli/dashboard.test.js.map +1 -0
  136. package/dist/cli/dispatcher.test.js +35 -2
  137. package/dist/cli/dispatcher.test.js.map +1 -1
  138. package/dist/cli/docs-accuracy.test.js +3 -3
  139. package/dist/cli/docs-accuracy.test.js.map +1 -1
  140. package/dist/cli/log.d.ts +39 -0
  141. package/dist/cli/log.d.ts.map +1 -1
  142. package/dist/cli/log.js +267 -93
  143. package/dist/cli/log.js.map +1 -1
  144. package/dist/cli/log.test.d.ts +2 -0
  145. package/dist/cli/log.test.d.ts.map +1 -0
  146. package/dist/cli/log.test.js +208 -0
  147. package/dist/cli/log.test.js.map +1 -0
  148. package/dist/cli/nearest.d.ts +18 -0
  149. package/dist/cli/nearest.d.ts.map +1 -0
  150. package/dist/cli/nearest.js +38 -0
  151. package/dist/cli/nearest.js.map +1 -0
  152. package/dist/cli/nearest.test.d.ts +2 -0
  153. package/dist/cli/nearest.test.d.ts.map +1 -0
  154. package/dist/cli/nearest.test.js +24 -0
  155. package/dist/cli/nearest.test.js.map +1 -0
  156. package/dist/cli/pipeline.d.ts +61 -0
  157. package/dist/cli/pipeline.d.ts.map +1 -1
  158. package/dist/cli/pipeline.flow.test.d.ts +2 -0
  159. package/dist/cli/pipeline.flow.test.d.ts.map +1 -0
  160. package/dist/cli/pipeline.flow.test.js +524 -0
  161. package/dist/cli/pipeline.flow.test.js.map +1 -0
  162. package/dist/cli/pipeline.js +471 -690
  163. package/dist/cli/pipeline.js.map +1 -1
  164. package/dist/cli/plan.d.ts +82 -31
  165. package/dist/cli/plan.d.ts.map +1 -1
  166. package/dist/cli/plan.js +167 -507
  167. package/dist/cli/plan.js.map +1 -1
  168. package/dist/cli/plan.test.d.ts +2 -0
  169. package/dist/cli/plan.test.d.ts.map +1 -0
  170. package/dist/cli/plan.test.js +158 -0
  171. package/dist/cli/plan.test.js.map +1 -0
  172. package/dist/cli/run/adapters/agent-process.d.ts +82 -0
  173. package/dist/cli/run/adapters/agent-process.d.ts.map +1 -0
  174. package/dist/cli/run/adapters/agent-process.js +224 -0
  175. package/dist/cli/run/adapters/agent-process.js.map +1 -0
  176. package/dist/cli/run/adapters/agent-process.test.d.ts +2 -0
  177. package/dist/cli/run/adapters/agent-process.test.d.ts.map +1 -0
  178. package/dist/cli/run/adapters/agent-process.test.js +159 -0
  179. package/dist/cli/run/adapters/agent-process.test.js.map +1 -0
  180. package/dist/cli/run/adapters/claude.d.ts +53 -2
  181. package/dist/cli/run/adapters/claude.d.ts.map +1 -1
  182. package/dist/cli/run/adapters/claude.js +147 -171
  183. package/dist/cli/run/adapters/claude.js.map +1 -1
  184. package/dist/cli/run/adapters/claude.test.js +197 -254
  185. package/dist/cli/run/adapters/claude.test.js.map +1 -1
  186. package/dist/cli/run/adapters/codex.d.ts +25 -2
  187. package/dist/cli/run/adapters/codex.d.ts.map +1 -1
  188. package/dist/cli/run/adapters/codex.js +113 -81
  189. package/dist/cli/run/adapters/codex.js.map +1 -1
  190. package/dist/cli/run/adapters/codex.test.js +116 -95
  191. package/dist/cli/run/adapters/codex.test.js.map +1 -1
  192. package/dist/cli/run/adapters/copilot.d.ts +35 -1
  193. package/dist/cli/run/adapters/copilot.d.ts.map +1 -1
  194. package/dist/cli/run/adapters/copilot.js +104 -287
  195. package/dist/cli/run/adapters/copilot.js.map +1 -1
  196. package/dist/cli/run/adapters/copilot.test.js +122 -282
  197. package/dist/cli/run/adapters/copilot.test.js.map +1 -1
  198. package/dist/cli/run/adapters/cursor.d.ts +25 -7
  199. package/dist/cli/run/adapters/cursor.d.ts.map +1 -1
  200. package/dist/cli/run/adapters/cursor.js +103 -156
  201. package/dist/cli/run/adapters/cursor.js.map +1 -1
  202. package/dist/cli/run/adapters/cursor.test.js +106 -218
  203. package/dist/cli/run/adapters/cursor.test.js.map +1 -1
  204. package/dist/cli/run/adapters/index.d.ts +34 -5
  205. package/dist/cli/run/adapters/index.d.ts.map +1 -1
  206. package/dist/cli/run/adapters/index.js +147 -21
  207. package/dist/cli/run/adapters/index.js.map +1 -1
  208. package/dist/cli/run/adapters/index.test.d.ts +2 -0
  209. package/dist/cli/run/adapters/index.test.d.ts.map +1 -0
  210. package/dist/cli/run/adapters/index.test.js +129 -0
  211. package/dist/cli/run/adapters/index.test.js.map +1 -0
  212. package/dist/cli/run/adapters/opencode.d.ts +25 -9
  213. package/dist/cli/run/adapters/opencode.d.ts.map +1 -1
  214. package/dist/cli/run/adapters/opencode.js +136 -152
  215. package/dist/cli/run/adapters/opencode.js.map +1 -1
  216. package/dist/cli/run/adapters/opencode.test.js +99 -218
  217. package/dist/cli/run/adapters/opencode.test.js.map +1 -1
  218. package/dist/cli/run/adapters/permission-modes.d.ts +47 -4
  219. package/dist/cli/run/adapters/permission-modes.d.ts.map +1 -1
  220. package/dist/cli/run/adapters/permission-modes.js +113 -37
  221. package/dist/cli/run/adapters/permission-modes.js.map +1 -1
  222. package/dist/cli/run/adapters/permission-modes.test.js +55 -40
  223. package/dist/cli/run/adapters/permission-modes.test.js.map +1 -1
  224. package/dist/cli/run/adapters/stub-cli.test-helper.d.ts +22 -0
  225. package/dist/cli/run/adapters/stub-cli.test-helper.d.ts.map +1 -0
  226. package/dist/cli/run/adapters/stub-cli.test-helper.js +73 -0
  227. package/dist/cli/run/adapters/stub-cli.test-helper.js.map +1 -0
  228. package/dist/cli/run/platform.d.ts +52 -0
  229. package/dist/cli/run/platform.d.ts.map +1 -0
  230. package/dist/cli/run/platform.js +207 -0
  231. package/dist/cli/run/platform.js.map +1 -0
  232. package/dist/cli/run/platform.test.d.ts +2 -0
  233. package/dist/cli/run/platform.test.d.ts.map +1 -0
  234. package/dist/cli/run/platform.test.js +119 -0
  235. package/dist/cli/run/platform.test.js.map +1 -0
  236. package/dist/cli/run/schema.d.ts +6 -8
  237. package/dist/cli/run/schema.d.ts.map +1 -1
  238. package/dist/cli/run/schema.js +44 -68
  239. package/dist/cli/run/schema.js.map +1 -1
  240. package/dist/cli/run/schema.test.js +59 -279
  241. package/dist/cli/run/schema.test.js.map +1 -1
  242. package/dist/cli/run.d.ts +34 -56
  243. package/dist/cli/run.d.ts.map +1 -1
  244. package/dist/cli/run.js +379 -1132
  245. package/dist/cli/run.js.map +1 -1
  246. package/dist/cli/run.test.d.ts +2 -0
  247. package/dist/cli/run.test.d.ts.map +1 -0
  248. package/dist/cli/run.test.js +318 -0
  249. package/dist/cli/run.test.js.map +1 -0
  250. package/dist/cli/team-config.d.ts.map +1 -1
  251. package/dist/cli/team-config.js +2 -21
  252. package/dist/cli/team-config.js.map +1 -1
  253. package/dist/cli/tiers.test.js +4 -13
  254. package/dist/cli/tiers.test.js.map +1 -1
  255. package/package.json +3 -10
  256. package/src/cli/agent-roster.test.ts +0 -55
  257. package/src/cli/boundary.test.ts +9 -7
  258. package/src/cli/convoy/TELEMETRY.md +131 -125
  259. package/src/cli/convoy/artifacts.test.ts +4 -2
  260. package/src/cli/convoy/artifacts.ts +13 -12
  261. package/src/cli/convoy/engine.git.test.ts +462 -0
  262. package/src/cli/convoy/engine.test.ts +817 -850
  263. package/src/cli/convoy/engine.ts +1864 -2596
  264. package/src/cli/convoy/event-schemas.ts +63 -59
  265. package/src/cli/convoy/events.test.ts +58 -9
  266. package/src/cli/convoy/events.ts +69 -91
  267. package/src/cli/convoy/gates.ts +31 -12
  268. package/src/cli/convoy/isolation.test.ts +76 -43
  269. package/src/cli/convoy/isolation.ts +100 -38
  270. package/src/cli/convoy/lock.test.ts +16 -0
  271. package/src/cli/convoy/lock.ts +25 -8
  272. package/src/cli/convoy/merge.test.ts +25 -1
  273. package/src/cli/convoy/merge.ts +74 -61
  274. package/src/cli/convoy/progress.test.ts +59 -0
  275. package/src/cli/convoy/progress.ts +121 -0
  276. package/src/cli/convoy/read-model.test.ts +685 -0
  277. package/src/cli/convoy/read-model.ts +1469 -0
  278. package/src/cli/convoy/redact.test.ts +49 -0
  279. package/src/cli/convoy/redact.ts +73 -0
  280. package/src/cli/convoy/reviewer.test.ts +112 -0
  281. package/src/cli/convoy/reviewer.ts +196 -0
  282. package/src/cli/convoy/schedule.test.ts +56 -0
  283. package/src/cli/convoy/schedule.ts +109 -0
  284. package/src/cli/convoy/spec-builder.test.ts +460 -464
  285. package/src/cli/convoy/spec-builder.ts +460 -129
  286. package/src/cli/convoy/spec-types.ts +46 -108
  287. package/src/cli/convoy/store.test.ts +64 -13
  288. package/src/cli/convoy/store.ts +143 -33
  289. package/src/cli/convoy/types.ts +59 -71
  290. package/src/cli/convoy/worktree.test.ts +140 -1
  291. package/src/cli/convoy/worktree.ts +311 -61
  292. package/src/cli/convoy-args.test.ts +10 -30
  293. package/src/cli/convoy-cmd.test.ts +163 -0
  294. package/src/cli/convoy-cmd.ts +173 -216
  295. package/src/cli/dashboard/dashboard.css +2086 -0
  296. package/src/cli/dashboard/dashboard.js +1687 -0
  297. package/src/cli/dashboard/index.html +307 -0
  298. package/src/cli/dashboard.test.ts +382 -0
  299. package/src/cli/dashboard.ts +243 -339
  300. package/src/cli/dispatcher.test.ts +36 -2
  301. package/src/cli/docs-accuracy.test.ts +3 -3
  302. package/src/cli/log.test.ts +228 -0
  303. package/src/cli/log.ts +302 -83
  304. package/src/cli/nearest.test.ts +27 -0
  305. package/src/cli/nearest.ts +38 -0
  306. package/src/cli/pipeline.flow.test.ts +607 -0
  307. package/src/cli/pipeline.ts +544 -759
  308. package/src/cli/plan.test.ts +193 -0
  309. package/src/cli/plan.ts +209 -545
  310. package/src/cli/run/adapters/agent-process.test.ts +175 -0
  311. package/src/cli/run/adapters/agent-process.ts +252 -0
  312. package/src/cli/run/adapters/claude.test.ts +205 -260
  313. package/src/cli/run/adapters/claude.ts +151 -162
  314. package/src/cli/run/adapters/codex.test.ts +120 -100
  315. package/src/cli/run/adapters/codex.ts +115 -91
  316. package/src/cli/run/adapters/copilot.test.ts +135 -306
  317. package/src/cli/run/adapters/copilot.ts +105 -274
  318. package/src/cli/run/adapters/cursor.test.ts +111 -220
  319. package/src/cli/run/adapters/cursor.ts +105 -156
  320. package/src/cli/run/adapters/index.test.ts +148 -0
  321. package/src/cli/run/adapters/index.ts +168 -20
  322. package/src/cli/run/adapters/opencode.test.ts +106 -227
  323. package/src/cli/run/adapters/opencode.ts +139 -151
  324. package/src/cli/run/adapters/permission-modes.test.ts +63 -41
  325. package/src/cli/run/adapters/permission-modes.ts +118 -37
  326. package/src/cli/run/adapters/stub-cli.test-helper.ts +88 -0
  327. package/src/cli/run/platform.test.ts +128 -0
  328. package/src/cli/run/platform.ts +213 -0
  329. package/src/cli/run/schema.test.ts +62 -344
  330. package/src/cli/run/schema.ts +48 -78
  331. package/src/cli/run.test.ts +351 -0
  332. package/src/cli/run.ts +366 -1151
  333. package/src/cli/team-config.ts +2 -21
  334. package/src/cli/tiers.test.ts +4 -17
  335. package/src/orchestrator/agents/team-lead.agent.md +1 -1
  336. package/src/orchestrator/prompts/assess-complexity.prompt.md +43 -26
  337. package/src/orchestrator/prompts/brainstorm.prompt.md +1 -1
  338. package/src/orchestrator/prompts/bug-fix.prompt.md +2 -2
  339. package/src/orchestrator/prompts/fix-convoy.prompt.md +43 -29
  340. package/src/orchestrator/prompts/fix-prd.prompt.md +26 -22
  341. package/src/orchestrator/prompts/generate-convoy.prompt.md +139 -147
  342. package/src/orchestrator/prompts/generate-prd.prompt.md +75 -68
  343. package/src/orchestrator/prompts/implement-feature.prompt.md +2 -2
  344. package/src/orchestrator/prompts/validate-convoy.prompt.md +29 -28
  345. package/src/orchestrator/prompts/validate-prd.prompt.md +28 -21
  346. package/src/orchestrator/skills/agent-hooks/HOOKS-REFERENCE.md +3 -3
  347. package/src/orchestrator/skills/agent-hooks/SKILL.md +1 -1
  348. package/src/orchestrator/skills/fast-review/SKILL.md +3 -1
  349. package/src/orchestrator/skills/orchestration-protocols/SKILL.md +7 -8
  350. package/dist/cli/convoy/dag-analysis.d.ts +0 -39
  351. package/dist/cli/convoy/dag-analysis.d.ts.map +0 -1
  352. package/dist/cli/convoy/dag-analysis.js +0 -279
  353. package/dist/cli/convoy/dag-analysis.js.map +0 -1
  354. package/dist/cli/convoy/dag-analysis.test.d.ts +0 -2
  355. package/dist/cli/convoy/dag-analysis.test.d.ts.map +0 -1
  356. package/dist/cli/convoy/dag-analysis.test.js +0 -289
  357. package/dist/cli/convoy/dag-analysis.test.js.map +0 -1
  358. package/dist/cli/convoy/formula.d.ts +0 -19
  359. package/dist/cli/convoy/formula.d.ts.map +0 -1
  360. package/dist/cli/convoy/formula.js +0 -142
  361. package/dist/cli/convoy/formula.js.map +0 -1
  362. package/dist/cli/convoy/formula.test.d.ts +0 -2
  363. package/dist/cli/convoy/formula.test.d.ts.map +0 -1
  364. package/dist/cli/convoy/formula.test.js +0 -342
  365. package/dist/cli/convoy/formula.test.js.map +0 -1
  366. package/dist/cli/convoy/health.d.ts +0 -34
  367. package/dist/cli/convoy/health.d.ts.map +0 -1
  368. package/dist/cli/convoy/health.js +0 -123
  369. package/dist/cli/convoy/health.js.map +0 -1
  370. package/dist/cli/convoy/health.test.d.ts +0 -2
  371. package/dist/cli/convoy/health.test.d.ts.map +0 -1
  372. package/dist/cli/convoy/health.test.js +0 -448
  373. package/dist/cli/convoy/health.test.js.map +0 -1
  374. package/dist/cli/convoy/last-run.d.ts +0 -53
  375. package/dist/cli/convoy/last-run.d.ts.map +0 -1
  376. package/dist/cli/convoy/last-run.js +0 -54
  377. package/dist/cli/convoy/last-run.js.map +0 -1
  378. package/dist/cli/convoy/last-run.test.d.ts +0 -2
  379. package/dist/cli/convoy/last-run.test.d.ts.map +0 -1
  380. package/dist/cli/convoy/last-run.test.js +0 -110
  381. package/dist/cli/convoy/last-run.test.js.map +0 -1
  382. package/dist/cli/convoy/pipeline.d.ts +0 -41
  383. package/dist/cli/convoy/pipeline.d.ts.map +0 -1
  384. package/dist/cli/convoy/pipeline.js +0 -414
  385. package/dist/cli/convoy/pipeline.js.map +0 -1
  386. package/dist/cli/convoy/pipeline.test.d.ts +0 -2
  387. package/dist/cli/convoy/pipeline.test.d.ts.map +0 -1
  388. package/dist/cli/convoy/pipeline.test.js +0 -837
  389. package/dist/cli/convoy/pipeline.test.js.map +0 -1
  390. package/dist/cli/convoy/review-stages.d.ts +0 -9
  391. package/dist/cli/convoy/review-stages.d.ts.map +0 -1
  392. package/dist/cli/convoy/review-stages.js +0 -134
  393. package/dist/cli/convoy/review-stages.js.map +0 -1
  394. package/dist/cli/convoy/review-stages.test.d.ts +0 -2
  395. package/dist/cli/convoy/review-stages.test.d.ts.map +0 -1
  396. package/dist/cli/convoy/review-stages.test.js +0 -197
  397. package/dist/cli/convoy/review-stages.test.js.map +0 -1
  398. package/dist/cli/run/executor.d.ts +0 -15
  399. package/dist/cli/run/executor.d.ts.map +0 -1
  400. package/dist/cli/run/executor.js +0 -249
  401. package/dist/cli/run/executor.js.map +0 -1
  402. package/dist/cli/run/executor.test.d.ts +0 -2
  403. package/dist/cli/run/executor.test.d.ts.map +0 -1
  404. package/dist/cli/run/executor.test.js +0 -297
  405. package/dist/cli/run/executor.test.js.map +0 -1
  406. package/dist/cli/run/reporter.d.ts +0 -10
  407. package/dist/cli/run/reporter.d.ts.map +0 -1
  408. package/dist/cli/run/reporter.js +0 -142
  409. package/dist/cli/run/reporter.js.map +0 -1
  410. package/dist/cli/run-dry-run.test.d.ts +0 -2
  411. package/dist/cli/run-dry-run.test.d.ts.map +0 -1
  412. package/dist/cli/run-dry-run.test.js +0 -83
  413. package/dist/cli/run-dry-run.test.js.map +0 -1
  414. package/dist/cli/run-executor-flags.test.d.ts +0 -2
  415. package/dist/cli/run-executor-flags.test.d.ts.map +0 -1
  416. package/dist/cli/run-executor-flags.test.js +0 -31
  417. package/dist/cli/run-executor-flags.test.js.map +0 -1
  418. package/dist/cli/run-finish.test.d.ts +0 -2
  419. package/dist/cli/run-finish.test.d.ts.map +0 -1
  420. package/dist/cli/run-finish.test.js +0 -77
  421. package/dist/cli/run-finish.test.js.map +0 -1
  422. package/dist/cli/watch.d.ts +0 -15
  423. package/dist/cli/watch.d.ts.map +0 -1
  424. package/dist/cli/watch.js +0 -277
  425. package/dist/cli/watch.js.map +0 -1
  426. package/dist/dashboard/scripts/etl.d.ts +0 -10
  427. package/dist/dashboard/scripts/etl.d.ts.map +0 -1
  428. package/dist/dashboard/scripts/etl.js +0 -141
  429. package/dist/dashboard/scripts/etl.js.map +0 -1
  430. package/src/cli/convoy/dag-analysis.test.ts +0 -349
  431. package/src/cli/convoy/dag-analysis.ts +0 -367
  432. package/src/cli/convoy/formula.test.ts +0 -404
  433. package/src/cli/convoy/formula.ts +0 -174
  434. package/src/cli/convoy/health.test.ts +0 -519
  435. package/src/cli/convoy/health.ts +0 -189
  436. package/src/cli/convoy/last-run.test.ts +0 -130
  437. package/src/cli/convoy/last-run.ts +0 -87
  438. package/src/cli/convoy/pipeline.test.ts +0 -999
  439. package/src/cli/convoy/pipeline.ts +0 -492
  440. package/src/cli/convoy/review-stages.test.ts +0 -235
  441. package/src/cli/convoy/review-stages.ts +0 -166
  442. package/src/cli/run/executor.test.ts +0 -338
  443. package/src/cli/run/executor.ts +0 -292
  444. package/src/cli/run/reporter.ts +0 -160
  445. package/src/cli/run-dry-run.test.ts +0 -97
  446. package/src/cli/run-executor-flags.test.ts +0 -38
  447. package/src/cli/run-finish.test.ts +0 -91
  448. package/src/cli/watch.ts +0 -295
  449. package/src/dashboard/astro.config.mjs +0 -6
  450. package/src/dashboard/dist/_astro/index.CADNhRPS.css +0 -1
  451. package/src/dashboard/dist/data/.gitkeep +0 -0
  452. package/src/dashboard/dist/data/convoy-list.json +0 -1
  453. package/src/dashboard/dist/data/overall-stats.json +0 -29
  454. package/src/dashboard/dist/index.html +0 -1963
  455. package/src/dashboard/node_modules/.vite/deps/_metadata.json +0 -31
  456. package/src/dashboard/node_modules/.vite/deps/astro___aria-query.js +0 -6776
  457. package/src/dashboard/node_modules/.vite/deps/astro___aria-query.js.map +0 -7
  458. package/src/dashboard/node_modules/.vite/deps/astro___axobject-query.js +0 -3754
  459. package/src/dashboard/node_modules/.vite/deps/astro___axobject-query.js.map +0 -7
  460. package/src/dashboard/node_modules/.vite/deps/astro___cssesc.js +0 -99
  461. package/src/dashboard/node_modules/.vite/deps/astro___cssesc.js.map +0 -7
  462. package/src/dashboard/node_modules/.vite/deps/chunk-BUSYA2B4.js +0 -8
  463. package/src/dashboard/node_modules/.vite/deps/chunk-BUSYA2B4.js.map +0 -7
  464. package/src/dashboard/node_modules/.vite/deps/package.json +0 -3
  465. package/src/dashboard/package-lock.json +0 -6
  466. package/src/dashboard/public/data/.gitkeep +0 -0
  467. package/src/dashboard/public/data/convoy-list.json +0 -1
  468. package/src/dashboard/public/data/overall-stats.json +0 -29
  469. package/src/dashboard/public/icon-192.png +0 -0
  470. package/src/dashboard/scripts/etl.test.ts +0 -166
  471. package/src/dashboard/scripts/etl.ts +0 -170
  472. package/src/dashboard/scripts/generate-demo-db.test.ts +0 -30
  473. package/src/dashboard/scripts/generate-demo-db.ts +0 -529
  474. package/src/dashboard/scripts/integration-test.ts +0 -504
  475. package/src/dashboard/scripts/verify-demo-data.sh +0 -51
  476. package/src/dashboard/seed-data/delegations.ndjson +0 -35
  477. package/src/dashboard/seed-data/events.ndjson +0 -104
  478. package/src/dashboard/seed-data/panels.ndjson +0 -13
  479. package/src/dashboard/seed-data/reviews.ndjson +0 -6
  480. package/src/dashboard/seed-data/sessions.ndjson +0 -50
  481. package/src/dashboard/src/env.d.ts +0 -1
  482. package/src/dashboard/src/layouts/Layout.astro +0 -25
  483. package/src/dashboard/src/pages/index.astro +0 -2313
  484. package/src/dashboard/src/styles/dashboard.css +0 -2943
  485. package/src/dashboard/tsconfig.json +0 -6
  486. /package/src/{dashboard/dist → cli/dashboard}/icon-192.png +0 -0
package/src/cli/plan.ts CHANGED
@@ -1,136 +1,63 @@
1
- import { readFile } from 'node:fs/promises'
1
+ import { readFile, mkdir, writeFile } from 'node:fs/promises'
2
2
  import { existsSync } from 'node:fs'
3
- import { resolve, join, basename } from 'node:path'
4
- import { mkdir, writeFile } from 'node:fs/promises'
5
- import { getAdapter, detectAdapter, cleanupAdapters } from './run/adapters/index.js'
6
- import { parseTaskSpecText } from './run/schema.js'
3
+ import { resolve, join } from 'node:path'
7
4
  import { c } from './prompt.js'
8
- import type { CliContext } from './types.js'
9
- import type { Task } from './convoy/spec-types.js'
10
- import type { MCPServerConfig } from './convoy/types.js'
11
-
12
- const HELP = `
13
- opencastle convoy plan [options]
14
-
15
- Generate a convoy spec (or other AI output) from a task description by running
16
- it through a prompt template via an AI adapter.
17
-
18
- Options:
19
- --file, -f <path> Path to a text file (fills {{goal}} in the template)
20
- --text, -t <text> Inline text to use as {{goal}} (alternative to --file)
21
- --template <name> Prompt template name (default: generate-convoy)
22
- Built-in templates:
23
- generate-prd — Write a PRD from a feature prompt
24
- validate-prd — Check a PRD for completeness
25
- fix-prd — Fix validation errors in a PRD
26
- assess-complexity — Assess PRD complexity (returns JSON)
27
- generate-convoy — Generate a convoy spec from a PRD (default)
28
- validate-convoy — Check a convoy spec for correctness
29
- fix-convoy — Fix validation errors in a convoy spec
30
- --context <path> Optional path to an additional context file (fills {{context}})
31
- --context-text <text> Inline text to fill {{context}} (alternative to --context)
32
- --output, -o <path> Output path override (skipped for validation output)
33
- --adapter, -a <name> Override agent runtime adapter
34
- --verbose Show full agent output
35
- --dry-run Print the assembled prompt without executing
36
- --help, -h Show this help
37
- `
38
-
39
- interface PlanOptions {
40
- file: string | null
41
- text: string | null
42
- template: string
43
- context: string | null
44
- contextText: string | null
45
- output: string | null
46
- adapter: string | null
47
- verbose: boolean
48
- dryRun: boolean
49
- help: boolean
50
- }
5
+ import type { AgentAdapter, Task } from './convoy/spec-types.js'
6
+
7
+ /**
8
+ * One planning step: fill a prompt template, run it through the adapter the
9
+ * caller resolved, and read the answer the way the template's `output:`
10
+ * frontmatter says.
11
+ *
12
+ * This file used to be a command of its own (`--template`, `--context`, …). No
13
+ * route reached it once `convoy plan` went to the pipeline, so only the step
14
+ * runner is left.
15
+ */
51
16
 
52
- // ── Exported types ──────────────────────────────────────────────────────────
17
+ export type PromptOutput = 'prd' | 'validation' | 'json'
53
18
 
54
19
  export interface PromptStepOptions {
55
- /** Template name without extension. Default: 'generate-convoy' */
56
- template?: string
57
- /** Absolute file path whose content fills {{goal}} */
58
- filePath?: string
59
- /** Inline text that fills {{goal}} — alternative to filePath */
20
+ /** Template name, without `.prompt.md`. */
21
+ template: string
22
+ /** Fills the template's `{{goal}}` line. */
60
23
  goalText?: string
61
- /** File path whose content fills {{context}} */
62
- contextPath?: string
63
- /** Inline text that fills {{context}} — alternative to contextPath */
24
+ /** Fills the template's `{{context}}` line. */
64
25
  contextText?: string
65
- /** Explicit output path override */
26
+ /** Where a PRD answer is written. Defaults to a new file in `.opencastle/prds/`. */
66
27
  outputPath?: string
67
- /** Adapter name override */
68
- adapterName?: string
69
- verbose?: boolean
70
- dryRun?: boolean
71
- /** Absolute path to the opencastle package root (for locating prompt templates) */
28
+ /**
29
+ * The runtime, resolved once by the caller. Each step used to detect it
30
+ * afresh, so one plan could in principle be written by two different CLIs.
31
+ */
32
+ adapter: AgentAdapter
33
+ /** Where opencastle is installed; the templates live under it. */
72
34
  pkgRoot: string
73
- /** MCP servers to make available to the AI adapter during execution. */
74
- mcpServers?: MCPServerConfig[]
35
+ /** The project the planner reads. Defaults to the current directory. */
36
+ cwd?: string
37
+ verbose?: boolean
38
+ /** How long one session may run before it is stopped. Defaults to 10 minutes. */
39
+ timeoutMs?: number
75
40
  }
76
41
 
77
42
  export interface PromptStepResult {
78
- /** Absolute path the output was written to. null for validation output or dry-run */
43
+ /** Where a PRD was written; null for the other outputs. */
79
44
  outputPath: string | null
80
- /** Raw text returned by the AI adapter (or assembled prompt on dry-run) */
45
+ /** The answer: for `json`, the JSON text alone when it came fenced. */
81
46
  rawOutput: string
82
- /** How the output was interpreted */
83
- outputType: 'convoy-spec' | 'prd' | 'validation' | 'json'
84
- /** Set when outputType === 'validation' */
47
+ outputType: PromptOutput
48
+ /** Set for `validation`. */
85
49
  isValid?: boolean
86
- /** Set when outputType === 'validation' and isValid === false */
50
+ /** Set for `validation` when the verdict is invalid. */
87
51
  errors?: string
52
+ /** What the session spent, as the runtime reported it. */
53
+ tokens?: number
54
+ /** Undefined when the runtime reports no cost. */
55
+ costUsd?: number
88
56
  }
89
57
 
90
- // ── Private helpers ─────────────────────────────────────────────────────────
91
-
92
- function printAdapterError(detectionFailed: boolean, adapterName: string): void {
93
- if (detectionFailed) {
94
- console.error(
95
- ` ✗ No agent CLI found on your PATH.\n` +
96
- ` Install one of the following adapters:\n` +
97
- ` • copilot — https://docs.github.com/en/copilot/how-tos/set-up/install-copilot-cli\n` +
98
- ` • claude — npm install -g @anthropic-ai/claude-code\n` +
99
- ` • cursor — https://cursor.com (Cursor > Install CLI)\n` +
100
- ` • opencode — https://opencode.ai\n` +
101
- ` • codex — npm install -g @openai/codex\n` +
102
- `\n` +
103
- ` Or specify an adapter explicitly: opencastle convoy plan --adapter <name>`
104
- )
105
- } else {
106
- const hints: Record<string, string> = {
107
- claude:
108
- ' Install: npm install -g @anthropic-ai/claude-code\n' +
109
- ' Docs: https://docs.anthropic.com/en/docs/claude-code',
110
- copilot:
111
- ' Requires the Copilot CLI installed and authenticated:\n' +
112
- ' https://docs.github.com/en/copilot/how-tos/set-up/install-copilot-cli\n' +
113
- ' Docs: https://docs.github.com/en/copilot',
114
- cursor:
115
- ' The Cursor agent CLI ships with the Cursor editor.\n' +
116
- ' Install Cursor from https://cursor.com and ensure the\n' +
117
- ' "agent" command is on your PATH (Cursor > Install CLI).',
118
- opencode:
119
- ' Install OpenCode from https://opencode.ai\n' +
120
- ' Ensure the "opencode" command is on your PATH.',
121
- codex:
122
- ' Install: npm install -g @openai/codex\n' +
123
- ' Docs: https://developers.openai.com/codex',
124
- }
125
- const cliName = adapterName === 'cursor' ? 'agent' : adapterName
126
- const hint = hints[adapterName] ?? ''
127
- console.error(
128
- ` ✗ Adapter "${adapterName}" is not available.\n` +
129
- ` Make sure the "${cliName}" CLI is installed and on your PATH.\n` +
130
- hint
131
- )
132
- }
133
- }
58
+ const DEFAULT_STEP_TIMEOUT_MS = 10 * 60_000
59
+
60
+ // ── Templates ───────────────────────────────────────────────────────────────
134
61
 
135
62
  /** Strip YAML frontmatter (everything between first and second --- delimiters). */
136
63
  function stripFrontmatter(text: string): string {
@@ -142,7 +69,7 @@ function stripFrontmatter(text: string): string {
142
69
  }
143
70
 
144
71
  /** Extract key: value pairs from YAML frontmatter (top-level scalar values only). */
145
- function parseFrontmatter(text: string): Record<string, string> {
72
+ export function parseFrontmatter(text: string): Record<string, string> {
146
73
  const result: Record<string, string> = {}
147
74
  const lines = text.split('\n')
148
75
  if (lines[0]?.trim() !== '---') return result
@@ -155,102 +82,94 @@ function parseFrontmatter(text: string): Record<string, string> {
155
82
  return result
156
83
  }
157
84
 
158
- /** Extract YAML content from a fenced ```yaml ... ``` block. */
159
- function extractYamlBlock(text: string): string | null {
160
- // 1. Prefer explicit yaml/yml fence — greedy to skip backticks inside content
161
- const yamlFence = text.match(/```ya?ml\s*\n([\s\S]*)```/)
162
- if (yamlFence) return yamlFence[1].trim()
163
-
164
- // 2. Fallback: any code fence whose content looks like a convoy spec
165
- // Must contain at least `name:` AND `tasks:` to avoid false positives
166
- const genericFences = [...text.matchAll(/```\s*\n([\s\S]*?)```/g)]
167
- for (const m of genericFences) {
168
- const content = m[1].trim()
169
- if (/^name:/m.test(content) && /^tasks:/m.test(content)) return content
170
- }
171
-
172
- return null
85
+ export function templatePath(pkgRoot: string, name: string): string {
86
+ return join(pkgRoot, 'src', 'orchestrator', 'prompts', `${name}.prompt.md`)
173
87
  }
174
88
 
175
89
  /**
176
- * Derive a .convoy.yml filename from YAML content.
177
- * Checks for a first-line comment, then falls back to the `name:` field.
90
+ * Put the inputs into a template.
91
+ *
92
+ * A placeholder is filled only where it stands on a line of its own. The
93
+ * instructions in generate-convoy mentioned `{{goal}}` and `{{context}}` in
94
+ * passing, and a global replace pasted the whole PRD into those sentences as
95
+ * well, so every plan carried its PRD twice.
96
+ *
97
+ * One pass with a function replacement: the text put in is never scanned again
98
+ * (a PRD that mentions `{{context}}` stays as written), and `$&` or `$'` in it
99
+ * are not read as replacement patterns.
178
100
  */
179
- function deriveOutputFilename(yaml: string): string {
180
- const firstLine = yaml.split('\n')[0] ?? ''
181
- const commentMatch = firstLine.match(/^#\s*(.+\.convoy\.ya?ml)\s*$/)
182
- if (commentMatch) return basename(commentMatch[1])
183
- const nameMatch = yaml.match(/^name:\s*['"]?([^'"\n]+)['"]?\s*$/m)
184
- if (nameMatch) {
185
- const kebab = nameMatch[1].trim().toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-|-$/g, '')
186
- if (kebab) return `${kebab}.convoy.yml`
187
- }
188
- return 'convoy-plan.convoy.yml'
101
+ export function fillTemplate(body: string, goal: string, context: string): string {
102
+ return body.replace(/^[ \t]*\{\{(goal|context)\}\}[ \t]*$/gm, (_line, key: string) =>
103
+ (key === 'goal' ? goal : context).trim(),
104
+ )
189
105
  }
190
106
 
191
- /**
192
- * Derive a .prd.md filename from PRD Markdown content.
193
- * Looks for a # Heading to extract a kebab-case name.
194
- */
195
- function derivePrdFilename(content: string): string {
196
- const headingMatch = content.match(/^#\s+(.+?)(?:\s*[-—–]+\s*PRD)?\s*$/m)
197
- if (headingMatch) {
198
- const kebab = headingMatch[1]
199
- .trim()
200
- .toLowerCase()
201
- .replace(/[^a-z0-9]+/g, '-')
202
- .replace(/^-|-$/g, '')
203
- if (kebab) return `${kebab}.prd.md`
204
- }
205
- return `prd-${Date.now()}.prd.md`
107
+ /** `'Team Lead (OpenCastle)'` → `team-lead`, the agent slug the adapter introduces. */
108
+ function agentSlug(label: string | undefined): string {
109
+ return (label ?? 'team-lead')
110
+ .replace(/\(.*?\)/g, '')
111
+ .trim()
112
+ .toLowerCase()
113
+ .replace(/\s+/g, '-')
206
114
  }
207
115
 
116
+ // ── Answers ─────────────────────────────────────────────────────────────────
117
+
208
118
  /**
209
119
  * Extract Markdown body from AI output.
210
120
  * Strips wrapping ```markdown / ```md fences if present.
211
121
  * If a heading is present but prefixed with preamble, trims to the first heading.
212
122
  */
213
123
  function extractMarkdownBody(output: string): string {
214
- // Strip explicit markdown fence
215
124
  const mdFenceMatch = output.match(/^```(?:markdown|md)\s*\n([\s\S]*?)```\s*$/m)
216
125
  if (mdFenceMatch) return mdFenceMatch[1].trim()
217
126
 
218
127
  const lines = output.trim().split('\n')
219
- // Strip plain ``` wrapping (first and last line are fences)
220
128
  if (lines[0]?.startsWith('```') && lines[lines.length - 1]?.trim() === '```') {
221
129
  return lines.slice(1, -1).join('\n').trim()
222
130
  }
223
131
 
224
- // If there's preamble before the first heading, strip it
225
132
  const headingIdx = lines.findIndex((l) => /^#{1,3}\s/.test(l))
226
133
  if (headingIdx > 0) return lines.slice(headingIdx).join('\n').trim()
227
134
 
228
135
  return output.trim()
229
136
  }
230
137
 
138
+ /**
139
+ * The JSON in an answer: the last ```json fence if there is one, else the whole
140
+ * answer. A missing fence used to abort the plan outright, before the one
141
+ * retry generate-convoy is allowed; now the parser downstream sees the text and
142
+ * reports why it is not a plan.
143
+ */
144
+ export function extractJson(output: string): string {
145
+ // Greedy, so a prompt inside the plan that shows a fenced example does not
146
+ // cut the block short.
147
+ const fenced = output.match(/```json\s*\n([\s\S]*)```/)
148
+ return (fenced ? fenced[1] : output).trim()
149
+ }
150
+
231
151
  /**
232
152
  * Parse a validation AI response for VALID / INVALID verdict.
233
153
  * Prefers structured JSON output; falls back to VALID/INVALID keyword matching.
234
154
  */
235
- function parseValidationResult(output: string): { isValid: boolean; errors: string } {
155
+ export function parseValidationResult(output: string): { isValid: boolean; errors: string } {
236
156
  const trimmed = output.trim()
237
157
 
238
- // Try structured JSON first (preferred format)
239
158
  const jsonFenceMatch = trimmed.match(/```json\s*\n([\s\S]*?)```/)
240
- if (jsonFenceMatch) {
159
+ const candidate = jsonFenceMatch ? jsonFenceMatch[1].trim() : trimmed.startsWith('{') ? trimmed : null
160
+ if (candidate) {
241
161
  try {
242
- const parsed = JSON.parse(jsonFenceMatch[1].trim()) as { valid?: boolean; issues?: string[] }
162
+ const parsed = JSON.parse(candidate) as { valid?: boolean; issues?: string[] }
243
163
  if (typeof parsed.valid === 'boolean') {
244
164
  if (parsed.valid) return { isValid: true, errors: '' }
245
165
  const errors = Array.isArray(parsed.issues) ? parsed.issues.join('\n') : ''
246
166
  return { isValid: false, errors }
247
167
  }
248
168
  } catch {
249
- // JSON parse failed — fall through to regex fallback
169
+ // Not JSON after all — fall through to the keyword check.
250
170
  }
251
171
  }
252
172
 
253
- // Fallback: regex-based parsing for backward compatibility
254
173
  const hasInvalid = /\bINVALID\b/.test(trimmed)
255
174
  const hasValid = /\bVALID\b/.test(trimmed)
256
175
  if (hasValid && !hasInvalid) return { isValid: true, errors: '' }
@@ -258,437 +177,182 @@ function parseValidationResult(output: string): { isValid: boolean; errors: stri
258
177
  return { isValid: false, errors: errorsMatch ? errorsMatch[1].trim() : trimmed }
259
178
  }
260
179
 
180
+ /**
181
+ * A path in `dir` that nothing is using yet: `<stem><suffix>`, then
182
+ * `<stem>-2<suffix>` and so on.
183
+ *
184
+ * PRDs and specs were named after their title and overwritten. Two requests
185
+ * that happened to share a title replaced each other's files, hand edits
186
+ * included, and the complexity cache that sat next to the PRD answered for the
187
+ * wrong one.
188
+ */
189
+ export function freePath(dir: string, stem: string, suffix: string): string {
190
+ let candidate = join(dir, `${stem}${suffix}`)
191
+ for (let n = 2; existsSync(candidate); n++) candidate = join(dir, `${stem}-${n}${suffix}`)
192
+ return candidate
193
+ }
194
+
195
+ function prdStem(content: string): string {
196
+ const heading = content.match(/^#\s+(.+?)(?:\s*[-—–]+\s*PRD)?\s*$/m)
197
+ const kebab = heading?.[1]
198
+ .trim()
199
+ .toLowerCase()
200
+ .replace(/[^a-z0-9]+/g, '-')
201
+ .replace(/^-|-$/g, '')
202
+ return kebab || `prd-${Date.now()}`
203
+ }
204
+
205
+ // ── Progress ────────────────────────────────────────────────────────────────
206
+
261
207
  const SPINNER_FRAMES = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏']
262
208
 
263
209
  const TEMPLATE_MESSAGES: Record<string, string> = {
264
- 'generate-prd': 'Generating PRD…',
265
- 'generate-convoy': 'Generating convoy spec…',
266
- 'validate-prd': 'Validating PRD…',
267
- 'validate-convoy': 'Validating convoy spec…',
268
- 'fix-prd': 'Fixing PRD…',
269
- 'fix-convoy': 'Fixing convoy spec…',
210
+ 'generate-prd': 'Writing the PRD',
211
+ 'validate-prd': 'Checking the PRD',
212
+ 'fix-prd': 'Fixing the PRD',
213
+ 'assess-complexity': 'Sizing the work',
214
+ 'generate-convoy': 'Breaking it into tasks',
215
+ 'validate-convoy': 'Reviewing the plan',
216
+ 'fix-convoy': 'Fixing the plan',
270
217
  }
271
218
 
272
- /** Show an in-place spinner with elapsed time during a long-running adapter call. Returns a stop function. */
219
+ /**
220
+ * One spinner line for however many steps are running.
221
+ *
222
+ * Steps run side by side now (validation beside sizing, one task plan per
223
+ * group), and a spinner each meant several timers overwriting the same line.
224
+ * Off a terminal there is no line to redraw, and the frames only cluttered a
225
+ * log, so nothing is drawn there.
226
+ */
227
+ const running = new Map<number, string>()
228
+ let nextId = 0
229
+ let ticker: ReturnType<typeof setInterval> | null = null
230
+ let startedAt = 0
231
+
273
232
  function startProgress(templateName: string): () => void {
274
- const message = TEMPLATE_MESSAGES[templateName] ?? `Running ${templateName}…`
275
- const startTime = Date.now()
276
- let frame = 0
277
- const interval = setInterval(() => {
278
- const elapsed = Math.floor((Date.now() - startTime) / 1000)
279
- const spinner = SPINNER_FRAMES[frame % SPINNER_FRAMES.length]!
280
- process.stdout.write(c.dim(`\r ${spinner} ${message} (${elapsed}s)`))
281
- frame++
282
- }, 250)
233
+ if (!process.stdout.isTTY) return () => {}
234
+ const id = nextId++
235
+ running.set(id, TEMPLATE_MESSAGES[templateName] ?? templateName)
236
+ if (!ticker) {
237
+ startedAt = Date.now()
238
+ let frame = 0
239
+ ticker = setInterval(() => {
240
+ const labels = [...new Set(running.values())]
241
+ const elapsed = Math.floor((Date.now() - startedAt) / 1000)
242
+ const spinner = SPINNER_FRAMES[frame++ % SPINNER_FRAMES.length]
243
+ const line = ` ${spinner} ${labels.join(' · ')}… (${elapsed}s)`
244
+ process.stdout.write('\r' + c.dim(line.slice(0, (process.stdout.columns ?? 80) - 1)) + '\x1b[K')
245
+ }, 250)
246
+ }
283
247
  return () => {
284
- clearInterval(interval)
285
- process.stdout.write('\r' + ' '.repeat(60) + '\r')
248
+ running.delete(id)
249
+ if (running.size === 0 && ticker) {
250
+ clearInterval(ticker)
251
+ ticker = null
252
+ process.stdout.write('\r\x1b[K')
253
+ }
286
254
  }
287
255
  }
288
256
 
289
- // ── Exported programmatic API ───────────────────────────────────────────────
257
+ // ── The step ────────────────────────────────────────────────────────────────
290
258
 
291
259
  /**
292
- * Execute a single prompt template step via an AI adapter.
293
- * Used by the start command to chain steps programmatically.
260
+ * Writing the PRD and the plan is the work the rest depends on, so it gets the
261
+ * standard tier; checking and sizing them is a short read, so it gets economy.
262
+ */
263
+ function modelFor(adapter: AgentAdapter, template: string): string | undefined {
264
+ const tier = /^(validate-|assess-)/.test(template) ? 'economy' : 'standard'
265
+ return adapter.tierModels?.[tier]
266
+ }
267
+
268
+ /**
269
+ * Run one planning template through the caller's adapter.
270
+ *
271
+ * Planning sessions run with `permissionMode: 'plan'`: they read the repository
272
+ * to ground the plan in real paths, and they cannot change it. They used to get
273
+ * the workers' `acceptEdits`, so a planner could edit the project it was only
274
+ * meant to describe.
294
275
  */
295
276
  export async function runPromptStep(opts: PromptStepOptions): Promise<PromptStepResult> {
296
- const templateName = opts.template ?? 'generate-convoy'
297
-
298
- const templatePath = join(
299
- opts.pkgRoot,
300
- 'src',
301
- 'orchestrator',
302
- 'prompts',
303
- `${templateName}.prompt.md`
304
- )
305
- if (!existsSync(templatePath)) {
306
- throw new Error(`Prompt template not found: ${templatePath}`)
307
- }
277
+ const path = templatePath(opts.pkgRoot, opts.template)
278
+ if (!existsSync(path)) throw new Error(`Prompt template not found: ${path}`)
308
279
 
309
- const rawTemplate = await readFile(templatePath, 'utf8')
280
+ const rawTemplate = await readFile(path, 'utf8')
310
281
  const frontmatter = parseFrontmatter(rawTemplate)
311
- const outputType = (frontmatter['output'] ?? 'convoy-spec') as 'convoy-spec' | 'prd' | 'validation' | 'json'
312
- const template = stripFrontmatter(rawTemplate)
313
-
314
- let goalContent = opts.goalText ?? ''
315
- if (!goalContent && opts.filePath) {
316
- if (!existsSync(opts.filePath)) throw new Error(`File not found: ${opts.filePath}`)
317
- goalContent = await readFile(opts.filePath, 'utf8')
318
- }
319
-
320
- let contextContent = opts.contextText ?? ''
321
- if (!contextContent && opts.contextPath) {
322
- if (!existsSync(opts.contextPath)) throw new Error(`Context file not found: ${opts.contextPath}`)
323
- contextContent = await readFile(opts.contextPath, 'utf8')
324
- }
325
-
326
- const assembledPrompt = template
327
- .replace(/\{\{goal\}\}/g, goalContent.trim())
328
- .replace(/\{\{context\}\}/g, contextContent.trim())
282
+ const outputType = (frontmatter['output'] ?? 'json') as PromptOutput
283
+ const prompt = fillTemplate(stripFrontmatter(rawTemplate), opts.goalText ?? '', opts.contextText ?? '')
329
284
 
330
- if (opts.dryRun) {
331
- console.log(c.bold(c.cyan(` [${templateName}] Assembled prompt (dry-run):\n`)))
332
- console.log(assembledPrompt)
333
- return { outputPath: null, rawOutput: assembledPrompt, outputType }
334
- }
335
-
336
- let adapterName = opts.adapterName ?? ''
337
- if (!adapterName) {
338
- const detected = await detectAdapter()
339
- if (!detected) {
340
- printAdapterError(true, '')
341
- throw new Error('No adapter available')
342
- }
343
- adapterName = detected
344
- }
345
-
346
- let adapter
347
- try {
348
- adapter = await getAdapter(adapterName)
349
- } catch {
350
- printAdapterError(false, adapterName)
351
- throw new Error(`Adapter "${adapterName}" failed to load`)
352
- }
353
-
354
- if (!(await adapter.isAvailable())) {
355
- printAdapterError(false, adapterName)
356
- throw new Error(`Adapter "${adapterName}" is not available`)
357
- }
358
-
359
- const agentField = (frontmatter['agent'] ?? 'team-lead').toLowerCase().replace(/\s+/g, '-')
360
285
  const task: Task = {
361
- id: templateName,
362
- prompt: assembledPrompt,
363
- agent: agentField,
286
+ id: opts.template,
287
+ prompt,
288
+ agent: agentSlug(frontmatter['agent']),
364
289
  timeout: '10m',
365
290
  depends_on: [],
366
291
  files: [],
367
- description: frontmatter['description'] ?? templateName,
292
+ description: frontmatter['description'] ?? opts.template,
368
293
  max_retries: 1,
369
294
  }
370
295
 
371
296
  if (opts.verbose) {
372
- console.log(c.dim(` Adapter: ${adapterName} | Template: ${templateName} | Agent: ${agentField}`))
297
+ console.log(c.dim(` ${opts.template} · ${opts.adapter.name} · read-only · ${prompt.length} chars`))
373
298
  }
374
299
 
375
- const stop = opts.verbose ? null : startProgress(templateName)
300
+ const timeoutMs = opts.timeoutMs ?? DEFAULT_STEP_TIMEOUT_MS
301
+ const stop = opts.verbose ? null : startProgress(opts.template)
302
+ let timer: ReturnType<typeof setTimeout> | undefined
376
303
  let execResult
377
304
  try {
378
- execResult = await adapter.execute(task, {
379
- verbose: opts.verbose ?? false,
380
- ...(opts.mcpServers?.length ? { mcpServers: opts.mcpServers } : {}),
381
- })
305
+ execResult = await Promise.race([
306
+ opts.adapter.execute(task, {
307
+ verbose: opts.verbose ?? false,
308
+ cwd: opts.cwd ?? process.cwd(),
309
+ permissionMode: 'plan',
310
+ ...(modelFor(opts.adapter, opts.template) ? { model: modelFor(opts.adapter, opts.template) } : {}),
311
+ }),
312
+ new Promise<never>((_, reject) => {
313
+ timer = setTimeout(() => {
314
+ // A hung session would otherwise hold the whole plan open forever.
315
+ opts.adapter.kill?.(task)
316
+ reject(new Error(`${opts.template} ran longer than ${Math.round(timeoutMs / 60_000)}m and was stopped`))
317
+ }, timeoutMs)
318
+ }),
319
+ ])
382
320
  } finally {
321
+ if (timer) clearTimeout(timer)
383
322
  stop?.()
384
323
  }
385
324
 
386
325
  if (!execResult.success) {
387
326
  throw new Error(
388
- `Adapter "${adapterName}" returned failure (exit code ${execResult.exitCode}) for template "${templateName}".\n` +
389
- `Output (${execResult.output.length} chars):\n${execResult.output.slice(0, 2000)}`
327
+ `${opts.adapter.name} failed on ${opts.template} (exit code ${execResult.exitCode}).\n` +
328
+ execResult.output.slice(0, 2000),
390
329
  )
391
330
  }
392
331
 
393
332
  const rawOutput = execResult.output
394
-
395
- if (opts.verbose) {
396
- console.log(c.dim(` Output: ${rawOutput.length} chars | Exit code: ${execResult.exitCode}`))
333
+ const usage = execResult.usage
334
+ const spent: Pick<PromptStepResult, 'tokens' | 'costUsd'> = {
335
+ tokens: usage?.total_tokens ?? ((usage?.prompt_tokens ?? 0) + (usage?.completion_tokens ?? 0)),
336
+ ...(execResult.costUsd !== undefined ? { costUsd: execResult.costUsd } : {}),
397
337
  }
398
338
 
399
339
  if (outputType === 'validation') {
400
340
  const { isValid, errors } = parseValidationResult(rawOutput)
401
- return { outputPath: null, rawOutput, outputType, isValid, errors }
402
- }
403
-
404
- if (outputType === 'json') {
405
- // Extract JSON from a ```json fenced block — fail fast if missing
406
- // Use greedy match (.*) to capture up to the LAST closing fence,
407
- // since task prompts may contain triple backticks in code examples
408
- const jsonFenceMatch = rawOutput.match(/```json\s*\n([\s\S]*)```/)
409
- if (!jsonFenceMatch) {
410
- throw new Error(
411
- `Expected a fenced \`\`\`json block in the AI response but found none.\n\n` +
412
- `Adapter: ${adapterName} | Output length: ${rawOutput.length} chars\n\n` +
413
- `Raw output:\n${rawOutput}\n\n` +
414
- `Tip: re-run with --verbose to see the full adapter output.`
415
- )
416
- }
417
- const jsonContent = jsonFenceMatch[1].trim()
418
-
419
- const outputPath = opts.outputPath ?? null
420
- if (outputPath) {
421
- await mkdir(resolve(outputPath, '..'), { recursive: true })
422
- await writeFile(outputPath, jsonContent + '\n', 'utf8')
423
- }
424
- return { outputPath, rawOutput: jsonContent, outputType }
341
+ return { outputPath: null, rawOutput, outputType, isValid, errors, ...spent }
425
342
  }
426
343
 
427
344
  if (outputType === 'prd') {
428
345
  const content = extractMarkdownBody(rawOutput)
429
346
  let outputPath = opts.outputPath ?? null
430
347
  if (!outputPath) {
431
- const prdDir = resolve(process.cwd(), '.opencastle', 'prds')
348
+ const prdDir = resolve(opts.cwd ?? process.cwd(), '.opencastle', 'prds')
432
349
  await mkdir(prdDir, { recursive: true })
433
- outputPath = join(prdDir, derivePrdFilename(content))
350
+ outputPath = freePath(prdDir, prdStem(content), '.prd.md')
434
351
  }
435
352
  await mkdir(resolve(outputPath, '..'), { recursive: true })
436
353
  await writeFile(outputPath, content + '\n', 'utf8')
437
- return { outputPath, rawOutput, outputType }
438
- }
439
-
440
- // convoy-spec (default)
441
- const yamlContent = extractYamlBlock(rawOutput)
442
- if (!yamlContent) {
443
- const preview = rawOutput.slice(0, 10_000)
444
- throw new Error(
445
- `No YAML code block found in the agent response.\n\nRaw output (truncated):\n${preview}`
446
- )
447
- }
448
-
449
- let schemaValid = true
450
- try {
451
- parseTaskSpecText(yamlContent)
452
- } catch (err) {
453
- schemaValid = false
454
- const msg = err instanceof Error ? err.message : String(err)
455
- console.warn(c.yellow(` ⚠ YAML validation warning: ${msg}`))
456
- console.warn(c.dim(` The file will still be written — you may need to edit it before running.\n`))
457
- }
458
-
459
- let outputPath = opts.outputPath ?? null
460
- if (!outputPath) {
461
- const convoyDir = resolve(process.cwd(), '.opencastle', 'convoys')
462
- await mkdir(convoyDir, { recursive: true })
463
- outputPath = join(convoyDir, deriveOutputFilename(yamlContent))
464
- }
465
- await mkdir(resolve(outputPath, '..'), { recursive: true })
466
- await writeFile(outputPath, yamlContent + '\n', 'utf8')
467
-
468
- return { outputPath, rawOutput, outputType, isValid: schemaValid }
469
- }
470
-
471
- /**
472
- * Read MCP server configurations from the project's MCP config file.
473
- * Checks in priority order: .vscode/mcp.json, .cursor/mcp.json, .claude/mcp.json, mcp.json
474
- */
475
- export async function readProjectMcpServers(projectRoot: string): Promise<MCPServerConfig[]> {
476
- const candidates = [
477
- join(projectRoot, '.vscode', 'mcp.json'),
478
- join(projectRoot, '.cursor', 'mcp.json'),
479
- join(projectRoot, '.claude', 'mcp.json'),
480
- join(projectRoot, 'mcp.json'),
481
- ]
482
-
483
- for (const filePath of candidates) {
484
- if (!existsSync(filePath)) continue
485
- try {
486
- const raw = await readFile(filePath, 'utf8')
487
- const parsed = JSON.parse(raw) as Record<string, unknown>
488
-
489
- // VS Code format: { servers: { name: { type, command, args } } }
490
- // Cursor/Claude format: { mcpServers: { name: { command, args } } }
491
- const serversMap =
492
- (parsed['servers'] as Record<string, unknown> | undefined) ??
493
- (parsed['mcpServers'] as Record<string, unknown> | undefined)
494
-
495
- if (!serversMap || typeof serversMap !== 'object') continue
496
-
497
- return Object.entries(serversMap).map(([name, cfg]) => {
498
- const c = cfg as Record<string, unknown>
499
- const server: MCPServerConfig = { name, type: (c['type'] as string) ?? 'stdio' }
500
- if (typeof c['command'] === 'string') server.command = c['command']
501
- if (Array.isArray(c['args'])) server.args = c['args'] as string[]
502
- if (typeof c['url'] === 'string') server.url = c['url']
503
- return server
504
- })
505
- } catch {
506
- return []
507
- }
508
- }
509
-
510
- return []
511
- }
512
-
513
- // ── CLI argument parsing ────────────────────────────────────────────────────
514
-
515
- function parseArgs(args: string[]): PlanOptions {
516
- const opts: PlanOptions = {
517
- file: null,
518
- text: null,
519
- template: 'generate-convoy',
520
- context: null,
521
- contextText: null,
522
- output: null,
523
- adapter: null,
524
- verbose: false,
525
- dryRun: false,
526
- help: false,
527
- }
528
-
529
- for (let i = 0; i < args.length; i++) {
530
- const arg = args[i]
531
- switch (arg) {
532
- case '--help':
533
- case '-h':
534
- opts.help = true
535
- break
536
- case '--file':
537
- case '-f':
538
- if (i + 1 >= args.length) { console.error(' ✗ --file requires a path'); process.exit(1) }
539
- opts.file = args[++i]
540
- if (!opts.file.trim()) { console.error(' ✗ --file cannot be empty'); process.exit(1) }
541
- break
542
- case '--text':
543
- case '-t':
544
- if (i + 1 >= args.length) { console.error(' ✗ --text requires a value'); process.exit(1) }
545
- opts.text = args[++i]
546
- if (!opts.text.trim()) { console.error(' ✗ --text cannot be empty'); process.exit(1) }
547
- break
548
- case '--template':
549
- if (i + 1 >= args.length) { console.error(' ✗ --template requires a name'); process.exit(1) }
550
- opts.template = args[++i]
551
- if (!opts.template.trim()) { console.error(' ✗ --template cannot be empty'); process.exit(1) }
552
- break
553
- case '--context':
554
- if (i + 1 >= args.length) { console.error(' ✗ --context requires a path'); process.exit(1) }
555
- opts.context = args[++i]
556
- if (!opts.context.trim()) { console.error(' ✗ --context cannot be empty'); process.exit(1) }
557
- break
558
- case '--context-text':
559
- if (i + 1 >= args.length) { console.error(' ✗ --context-text requires a value'); process.exit(1) }
560
- opts.contextText = args[++i]
561
- if (!opts.contextText.trim()) { console.error(' ✗ --context-text cannot be empty'); process.exit(1) }
562
- break
563
- case '--output':
564
- case '-o':
565
- if (i + 1 >= args.length) { console.error(' ✗ --output requires a path'); process.exit(1) }
566
- opts.output = args[++i]
567
- if (!opts.output.trim()) { console.error(' ✗ --output cannot be empty'); process.exit(1) }
568
- break
569
- case '--adapter':
570
- case '-a':
571
- if (i + 1 >= args.length) { console.error(' ✗ --adapter requires a name'); process.exit(1) }
572
- opts.adapter = args[++i]
573
- if (!opts.adapter.trim()) { console.error(' ✗ --adapter cannot be empty'); process.exit(1) }
574
- break
575
- case '--verbose':
576
- opts.verbose = true
577
- break
578
- case '--dry-run':
579
- case '--dryRun':
580
- opts.dryRun = true
581
- break
582
- default:
583
- console.error(` ✗ Unknown option: ${arg}. Run with --help to see available options.`)
584
- console.log(HELP)
585
- process.exit(1)
586
- }
587
- }
588
-
589
- return opts
590
- }
591
-
592
- // ── CLI entrypoint ──────────────────────────────────────────────────────────
593
-
594
- export default async function plan({ args, pkgRoot }: CliContext): Promise<void> {
595
- const opts = parseArgs(args)
596
-
597
- if (opts.help) {
598
- console.log(HELP)
599
- return
600
- }
601
-
602
- if (!opts.file && !opts.text) {
603
- console.error(` ✗ Either --file or --text is required.`)
604
- console.log(HELP)
605
- process.exit(1)
606
- }
607
-
608
- if (opts.file && opts.text) {
609
- console.error(` ✗ --file and --text are mutually exclusive.`)
610
- process.exit(1)
611
- }
612
-
613
- const filePath = opts.file ? resolve(process.cwd(), opts.file) : undefined
614
-
615
- if (filePath && !existsSync(filePath)) {
616
- console.error(` ✗ File not found: ${opts.file}`)
617
- process.exit(1)
618
- }
619
-
620
- const outputPath = opts.output ? resolve(process.cwd(), opts.output) : undefined
621
- const source = opts.file
622
- ? opts.file
623
- : `"${(opts.text ?? '').slice(0, 60)}${(opts.text ?? '').length > 60 ? '…' : ''}"`
624
-
625
- console.log(c.dim(` Template: ${opts.template}`))
626
- console.log(c.dim(` Input: ${source}\n`))
627
-
628
- let result: PromptStepResult
629
- try {
630
- result = await runPromptStep({
631
- template: opts.template,
632
- filePath,
633
- goalText: opts.text ?? undefined,
634
- contextPath: opts.context ?? undefined,
635
- contextText: opts.contextText ?? undefined,
636
- outputPath,
637
- adapterName: opts.adapter ?? undefined,
638
- verbose: opts.verbose,
639
- dryRun: opts.dryRun,
640
- pkgRoot,
641
- })
642
- } catch (err) {
643
- console.error(` ✗ ${err instanceof Error ? err.message : String(err)}`)
644
- process.exit(1)
645
- }
646
-
647
- if (opts.dryRun) return
648
-
649
- switch (result.outputType) {
650
- case 'validation': {
651
- if (result.isValid) {
652
- console.log(c.green(` ✓ VALID`))
653
- } else {
654
- console.log(c.red(` ✗ INVALID\n`))
655
- console.log(result.errors ?? result.rawOutput)
656
- process.exit(1)
657
- }
658
- break
659
- }
660
- case 'prd': {
661
- const relPath = result.outputPath!.startsWith(process.cwd())
662
- ? result.outputPath!.slice(process.cwd().length + 1)
663
- : result.outputPath!
664
- console.log(c.green(` ✓ PRD written to ${relPath}`))
665
- console.log(`\n ${c.dim('Next step:')} opencastle convoy plan --prd ${relPath}`)
666
- break
667
- }
668
- case 'json': {
669
- if (result.outputPath) {
670
- const relP = result.outputPath.startsWith(process.cwd())
671
- ? result.outputPath.slice(process.cwd().length + 1)
672
- : result.outputPath
673
- console.log(c.green(` ✓ JSON written to ${relP}`))
674
- }
675
- console.log(result.rawOutput)
676
- break
677
- }
678
- default: {
679
- const relPath = result.outputPath!.startsWith(process.cwd())
680
- ? result.outputPath!.slice(process.cwd().length + 1)
681
- : result.outputPath!
682
- console.log(c.green(` ✓ Convoy spec written to ${relPath}`))
683
- if (result.isValid === false) {
684
- console.log(c.yellow(` (contains validation warnings — review before running)`))
685
- }
686
- console.log(`
687
- ${c.dim('Preview:')} npx opencastle convoy run -f ${relPath} --dry-run
688
- ${c.dim('Execute:')} npx opencastle convoy run -f ${relPath}
689
- `)
690
- }
354
+ return { outputPath, rawOutput, outputType, ...spent }
691
355
  }
692
356
 
693
- await cleanupAdapters()
357
+ return { outputPath: null, rawOutput: extractJson(rawOutput), outputType: 'json', ...spent }
694
358
  }