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
@@ -62,8 +62,9 @@ interface RawSpec {
62
62
  gates?: string[]
63
63
  gate_retries?: number
64
64
  branch?: string
65
- depends_on_convoy?: string[]
65
+ depends_on_convoy?: unknown
66
66
  guard?: unknown
67
+ watch?: unknown
67
68
  }
68
69
 
69
70
  interface RawTask {
@@ -80,6 +81,7 @@ interface RawTask {
80
81
  built_in_gates?: unknown
81
82
  browser_test?: unknown
82
83
  review?: string
84
+ detect_drift?: unknown
83
85
  }
84
86
 
85
87
  /**
@@ -119,21 +121,35 @@ function validateBrowserTestConfig(value: unknown, prefix: string, errors: strin
119
121
  }
120
122
  }
121
123
 
122
- /**
123
- * Validate a parsed spec object.
124
- */
125
124
  /**
126
125
  * Keys an earlier build honoured and this one does not.
127
126
  *
128
127
  * Silently accepting them is worse than rejecting them: the spec looks valid, the
129
128
  * run proceeds, and the behaviour the author asked for never happens. Rejecting
130
- * them outright would break specs that are otherwise fine, so they warn.
129
+ * them outright would break specs that are otherwise fine, so they warn, and the
130
+ * warning names the key and says why it does nothing.
131
131
  */
132
132
  const RETIRED_DEFAULTS: Record<string, string> = {
133
133
  compaction: 'context compaction was removed; the adapter manages its own context',
134
134
  inject_lessons: 'lessons are read from .opencastle/LESSONS-LEARNED.md by the agent itself',
135
135
  snippets: 'snippets were folded into skills',
136
+ detect_drift: 'drift detection was removed; reviews and gates check the work instead',
137
+ review_stages: 'the two-stage review was removed; `review` picks one fast review or a panel',
138
+ mcp_approve_all: 'agents use the MCP servers and approvals in the project\'s own config, which `opencastle sync` writes',
139
+ }
140
+
141
+ /** Top-level and per-task keys retired the same way. */
142
+ const RETIRED_SPEC_KEYS: Record<string, string> = {
143
+ watch: 'watch mode was removed; run the spec again, or `opencastle convoy resume` to continue one',
136
144
  }
145
+ const RETIRED_TASK_KEYS: Record<string, string> = {
146
+ detect_drift: 'drift detection was removed; reviews and gates check the work instead',
147
+ }
148
+
149
+ /** What a version 2 (chained) spec is told to do instead. */
150
+ const CHAIN_REPLACEMENT =
151
+ 'put every task in one version 1 spec and let `depends_on` order them — tasks that do not ' +
152
+ 'depend on each other run in parallel. `opencastle convoy "<task>"` plans large work that way.'
137
153
 
138
154
  /**
139
155
  * Every key under `defaults` that something reads.
@@ -153,11 +169,9 @@ const KNOWN_DEFAULTS = new Set([
153
169
  'browser_test',
154
170
  'built_in_gates',
155
171
  'circuit_breaker',
156
- 'detect_drift',
157
172
  'max_concurrent_reviews',
158
173
  'max_retries',
159
174
  'max_swarm_concurrency',
160
- 'mcp_approve_all',
161
175
  'mcp_server_approval_timeout',
162
176
  'mcp_servers',
163
177
  'model',
@@ -167,7 +181,6 @@ const KNOWN_DEFAULTS = new Set([
167
181
  'review',
168
182
  'review_budget',
169
183
  'review_heuristics',
170
- 'review_stages',
171
184
  'reviewer_model',
172
185
  'timeout',
173
186
  ...Object.keys(RETIRED_DEFAULTS),
@@ -192,6 +205,7 @@ const KNOWN_BUILT_IN_GATES = new Set([
192
205
  'gate_timeout',
193
206
  ])
194
207
 
208
+ /** Validate a parsed spec object. */
195
209
  export function validateSpec(spec: unknown): ValidationResult {
196
210
  const errors: string[] = []
197
211
  const warnings: string[] = []
@@ -233,21 +247,19 @@ export function validateSpec(spec: unknown): ValidationResult {
233
247
  errors.push('`adapter` must be a string')
234
248
  }
235
249
 
236
- // version
237
- if (s.version !== undefined) {
238
- if (typeof s.version !== 'number' || !Number.isInteger(s.version) || (s.version !== 1 && s.version !== 2)) {
239
- errors.push('`version` must be 1 or 2')
240
- }
250
+ // version. A spec without one is a convoy spec, version 1: there is one
251
+ // executor now. Version 2 chained whole specs one after another; the planner
252
+ // writes one spec in which independent work runs side by side instead.
253
+ if (s.version === 2 || s.depends_on_convoy !== undefined) {
254
+ errors.push(`A chain of convoy specs (\`version: 2\` with \`depends_on_convoy\`) is no longer supported: ${CHAIN_REPLACEMENT}`)
255
+ // The rest of a chain spec is a list of other specs, so nothing below applies.
256
+ return { valid: false, errors, warnings }
257
+ } else if (s.version !== undefined && s.version !== 1) {
258
+ errors.push('`version` must be 1, or left out')
241
259
  }
242
260
 
243
- // depends_on_convoy
244
- if (s.depends_on_convoy !== undefined) {
245
- if (
246
- !Array.isArray(s.depends_on_convoy) ||
247
- !(s.depends_on_convoy as unknown[]).every((c) => typeof c === 'string')
248
- ) {
249
- errors.push('`depends_on_convoy` must be an array of strings')
250
- }
261
+ for (const [key, why] of Object.entries(RETIRED_SPEC_KEYS)) {
262
+ if ((s as Record<string, unknown>)[key] !== undefined) warnings.push(`\`${key}\` is ignored — ${why}`)
251
263
  }
252
264
 
253
265
  // defaults
@@ -327,11 +339,6 @@ export function validateSpec(spec: unknown): ValidationResult {
327
339
  }
328
340
  }
329
341
 
330
- // mcp_approve_all validation
331
- if (d.mcp_approve_all !== undefined && typeof d.mcp_approve_all !== 'boolean') {
332
- errors.push('`defaults.mcp_approve_all` must be a boolean')
333
- }
334
-
335
342
  // mcp_server_approval_timeout validation
336
343
  if (d.mcp_server_approval_timeout !== undefined) {
337
344
  const t = Number(d.mcp_server_approval_timeout)
@@ -385,11 +392,6 @@ export function validateSpec(spec: unknown): ValidationResult {
385
392
  validateBrowserTestConfig(d.browser_test, 'defaults.browser_test', errors)
386
393
  }
387
394
 
388
- // review_stages validation (Phase 40 — two-stage review toggle)
389
- if (d.review_stages !== undefined && typeof d.review_stages !== 'boolean') {
390
- errors.push('`defaults.review_stages` must be a boolean')
391
- }
392
-
393
395
  // review validation
394
396
  const VALID_REVIEW = ['auto', 'fast', 'panel', 'none']
395
397
  if (d.review !== undefined && !VALID_REVIEW.includes(d.review as string)) {
@@ -526,28 +528,11 @@ export function validateSpec(spec: unknown): ValidationResult {
526
528
  }
527
529
  }
528
530
 
529
- // Tasks: required unless this is a version:2 pipeline spec with depends_on_convoy
530
- const isPipeline =
531
- s.version === 2 &&
532
- Array.isArray(s.depends_on_convoy) &&
533
- (s.depends_on_convoy as unknown[]).length > 0
534
-
535
- if (!isPipeline) {
536
- if (!s.tasks || !Array.isArray(s.tasks) || s.tasks.length === 0) {
537
- errors.push('`tasks` is required and must be a non-empty array')
538
- return { valid: false, errors, warnings }
539
- }
540
- } else if (s.tasks !== undefined && (!Array.isArray(s.tasks) || s.tasks.length === 0)) {
541
- // Pipeline spec may omit tasks entirely, but if present they must be non-empty
542
- errors.push('`tasks`, when provided, must be a non-empty array')
531
+ if (!s.tasks || !Array.isArray(s.tasks) || s.tasks.length === 0) {
532
+ errors.push('`tasks` is required and must be a non-empty array')
543
533
  return { valid: false, errors, warnings }
544
534
  }
545
535
 
546
- // Skip per-task validation when pipeline spec has no tasks
547
- if (isPipeline && !s.tasks) {
548
- return { valid: errors.length === 0, errors, warnings }
549
- }
550
-
551
536
  const taskIds = new Set<string>()
552
537
  const tasks = s.tasks as RawTask[]
553
538
 
@@ -560,6 +545,10 @@ export function validateSpec(spec: unknown): ValidationResult {
560
545
  continue
561
546
  }
562
547
 
548
+ for (const [key, why] of Object.entries(RETIRED_TASK_KEYS)) {
549
+ if ((task as Record<string, unknown>)[key] !== undefined) warnings.push(`\`${prefix}.${key}\` is ignored — ${why}`)
550
+ }
551
+
563
552
  // id
564
553
  if (!task.id || typeof task.id !== 'string') {
565
554
  errors.push(`${prefix}: \`id\` is required and must be a string`)
@@ -713,20 +702,23 @@ function detectCycles(tasks: Array<{ id: string; depends_on?: string[] }>): stri
713
702
 
714
703
  /**
715
704
  * Apply default values to a parsed spec.
705
+ *
706
+ * Every spec is a convoy spec, version 1, whether or not it says so; a spec
707
+ * without `version` used to go to a second, older executor that ignored
708
+ * `defaults` altogether. Concurrency left out is `auto`, which lets the engine
709
+ * pick (`defaults.max_swarm_concurrency`, else 4) rather than one at a time.
716
710
  */
717
711
  export function applyDefaults(spec: Record<string, unknown>): TaskSpec {
718
712
  const s = spec as Record<string, unknown>
719
- s.concurrency = s.concurrency === 'auto' ? 'auto' : (s.concurrency !== undefined ? Number(s.concurrency) : 1)
713
+ s.version = 1
714
+ s.concurrency = s.concurrency === 'auto' || s.concurrency === undefined ? 'auto' : Number(s.concurrency)
720
715
  s.on_failure = (s.on_failure as string) || 'continue'
721
- // Leave adapter empty so run.ts can auto-detect the best available CLI
716
+ // Empty means "not chosen": the caller resolves the runtime with resolveAdapter.
722
717
  s.adapter = (s.adapter as string) || ''
723
718
  s.gate_retries = s.gate_retries !== undefined ? Number(s.gate_retries) : 0
724
719
 
725
720
  const tasks = (s.tasks as Array<Record<string, unknown>> | undefined) ?? []
726
- const d =
727
- s.version === 1 && s.defaults
728
- ? (s.defaults as Record<string, unknown>)
729
- : {}
721
+ const d = s.defaults && typeof s.defaults === 'object' ? (s.defaults as Record<string, unknown>) : {}
730
722
  for (const task of tasks) {
731
723
  task.agent =
732
724
  (task.agent as string) || (d.agent as string | undefined) || 'developer'
@@ -759,28 +751,6 @@ export function applyDefaults(spec: Record<string, unknown>): TaskSpec {
759
751
  return s as unknown as TaskSpec
760
752
  }
761
753
 
762
- /**
763
- * Returns true if the spec uses the Convoy Engine enhanced format (version: 1 or 2).
764
- */
765
- export function isConvoySpec(spec: unknown): boolean {
766
- if (!spec || typeof spec !== 'object') return false
767
- const v = (spec as Record<string, unknown>).version
768
- return v === 1 || v === 2
769
- }
770
-
771
- /**
772
- * Returns true if the spec is a pipeline spec (version: 2 + non-empty depends_on_convoy).
773
- */
774
- export function isPipelineSpec(spec: unknown): boolean {
775
- if (!spec || typeof spec !== 'object') return false
776
- const s = spec as Record<string, unknown>
777
- return (
778
- s.version === 2 &&
779
- Array.isArray(s.depends_on_convoy) &&
780
- (s.depends_on_convoy as unknown[]).length > 0
781
- )
782
- }
783
-
784
754
  /**
785
755
  * Parse, validate, and return a typed task spec from a YAML string.
786
756
  * @throws If the text is empty, cannot be parsed, or spec is invalid
@@ -0,0 +1,351 @@
1
+ /**
2
+ * `convoy run <spec>` and `convoy resume`, from the command line inwards.
3
+ *
4
+ * The engine has its own tests; these check what this file adds: how the
5
+ * arguments are read, that a dry run starts and records nothing, that resume
6
+ * picks the run it says it picks, and that a real run against a stub `claude`
7
+ * returns its exit code and leaves nothing behind to keep the process alive.
8
+ */
9
+ import { execFileSync } from 'node:child_process'
10
+ import { chmodSync, existsSync, mkdirSync, mkdtempSync, realpathSync, rmSync, statSync, writeFileSync } from 'node:fs'
11
+ import { hostname, tmpdir } from 'node:os'
12
+ import { delimiter, join } from 'node:path'
13
+ import { DatabaseSync } from 'node:sqlite'
14
+ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
15
+ import { parseRunArgs, resumeLast, runSpec, type RunArgs } from './run.js'
16
+ import { createConvoyStore } from './convoy/store.js'
17
+ import { readRun } from './convoy/read-model.js'
18
+ import { _resetAllowlistCache, _setAllowlistConfigPath } from './convoy/gates.js'
19
+
20
+ const args = (over: Partial<RunArgs> = {}): RunArgs => ({
21
+ spec: null, dryRun: false, adapter: null, concurrency: null, verbose: false, help: false, ...over,
22
+ })
23
+
24
+ describe('parseRunArgs', () => {
25
+ it('takes the spec as a positional argument', () => {
26
+ expect(parseRunArgs(['my.convoy.yml', '--dry-run'], 'run')).toEqual(args({ spec: 'my.convoy.yml', dryRun: true }))
27
+ })
28
+
29
+ it('still reads -f and --file, which every older spec header names', () => {
30
+ expect(parseRunArgs(['-f', 'a.yml'], 'run')).toMatchObject({ spec: 'a.yml' })
31
+ expect(parseRunArgs(['--file', 'a.yml'], 'run')).toMatchObject({ spec: 'a.yml' })
32
+ })
33
+
34
+ it('refuses two specs', () => {
35
+ expect(parseRunArgs(['a.yml', 'b.yml'], 'run')).toEqual({ error: 'Two specs given: a.yml and b.yml. Run one at a time.' })
36
+ expect(parseRunArgs(['a.yml', '-f', 'b.yml'], 'run')).toHaveProperty('error')
37
+ })
38
+
39
+ it('reads the common flags', () => {
40
+ expect(parseRunArgs(['s.yml', '-a', 'codex', '-c', '3', '--verbose'], 'run')).toEqual(
41
+ args({ spec: 's.yml', adapter: 'codex', concurrency: 3, verbose: true }),
42
+ )
43
+ })
44
+
45
+ it('refuses a concurrency that is not a whole number from 1 to 50', () => {
46
+ for (const bad of ['0', '51', '2.5', 'many']) {
47
+ expect(parseRunArgs(['s.yml', '-c', bad], 'run'), bad).toHaveProperty('error')
48
+ }
49
+ expect(parseRunArgs(['s.yml', '--concurrency'], 'run')).toEqual({ error: '--concurrency needs a value' })
50
+ })
51
+
52
+ it('names the nearest flag for a misspelled one', () => {
53
+ expect(parseRunArgs(['s.yml', '--dryRun'], 'run')).toEqual({ error: 'Unknown option --dryRun. Did you mean --dry-run?' })
54
+ expect(parseRunArgs(['s.yml', '--verbos'], 'run')).toEqual({ error: 'Unknown option --verbos. Did you mean --verbose?' })
55
+ })
56
+
57
+ it('lists what it accepts when nothing is close', () => {
58
+ expect((parseRunArgs(['s.yml', '--json'], 'run') as { error: string }).error).toMatch(/It accepts --dry-run, --adapter/)
59
+ })
60
+
61
+ it('says what replaced a removed flag', () => {
62
+ const removed: Array<[string, RegExp]> = [
63
+ ['--resume', /opencastle convoy resume/],
64
+ ['--retry-failed', /opencastle convoy resume/],
65
+ ['--status', /opencastle convoy —/],
66
+ ['--dlq-list', /opencastle convoy resume/],
67
+ ['--formula', /Formulas are gone/],
68
+ ['--watch', /Watch mode is gone/],
69
+ ['--report-dir', /convoy\.db/],
70
+ ['--permission-mode', /defaults\.permission_mode/],
71
+ ]
72
+ for (const [flag, why] of removed) {
73
+ const parsed = parseRunArgs(['s.yml', flag], 'run') as { error: string }
74
+ expect(parsed.error, flag).toMatch(new RegExp(`^${flag} was removed\\.`))
75
+ expect(parsed.error, flag).toMatch(why)
76
+ }
77
+ })
78
+
79
+ it('gives resume no spec, and says so for a stray word', () => {
80
+ expect(parseRunArgs(['--dry-run'], 'resume')).toEqual(args({ dryRun: true }))
81
+ expect((parseRunArgs(['task-1'], 'resume') as { error: string }).error).toMatch(/takes no name/)
82
+ expect(parseRunArgs(['-f', 'a.yml'], 'resume')).toEqual({ error: '-f belongs to opencastle convoy run' })
83
+ })
84
+ })
85
+
86
+ // ── Against a project on disk ─────────────────────────────────────────────────
87
+
88
+ /**
89
+ * A stand-in for Claude Code. It prints the `--output-format json` result
90
+ * shape, writes the files a prompt asks for with `WRITE <path> <text>` lines,
91
+ * sleeps on `SLEEP <seconds>`, fails while the file named by `FAILIF <path>`
92
+ * exists, and passes any review it is asked for.
93
+ */
94
+ const STUB_CLAUDE = `#!/bin/sh
95
+ input=$(cat)
96
+ case "$input" in
97
+ *"You are a code reviewer"*)
98
+ printf '%s' '{"type":"result","subtype":"success","is_error":false,"result":"Fine. <!-- REVIEW_VERDICT { \\"verdict\\": \\"pass\\", \\"issues\\": [] } -->","total_cost_usd":0.001,"usage":{"input_tokens":50,"output_tokens":5}}'
99
+ exit 0 ;;
100
+ esac
101
+ failif=$(printf '%s\\n' "$input" | sed -n 's/^ *FAILIF //p' | head -n 1)
102
+ if [ -n "$failif" ] && [ -e "$failif" ]; then
103
+ printf '%s' '{"type":"result","subtype":"error_during_execution","is_error":true,"errors":["stub failure"],"total_cost_usd":0.002}'
104
+ exit 1
105
+ fi
106
+ printf '%s\\n' "$input" | while read -r verb path rest; do
107
+ case "$verb" in
108
+ WRITE) mkdir -p "$(dirname "$path")"; printf '%s\\n' "$rest" > "$path" ;;
109
+ SLEEP) sleep "$path" ;;
110
+ esac
111
+ done
112
+ printf '%s' '{"type":"result","subtype":"success","is_error":false,"result":"Done.","total_cost_usd":0.01,"usage":{"input_tokens":100,"output_tokens":20},"modelUsage":{"claude-stub":{"inputTokens":100,"outputTokens":20,"costUSD":0.01}}}'
113
+ `
114
+
115
+ let root: string
116
+ let saved: { PATH?: string; HOME?: string; NO_COLOR?: string }
117
+ let out: string[]
118
+
119
+ function git(...a: string[]): string {
120
+ return execFileSync('git', a, { cwd: root, encoding: 'utf8' }).trim()
121
+ }
122
+
123
+ beforeEach(() => {
124
+ root = realpathSync(mkdtempSync(join(tmpdir(), 'oc-run-')))
125
+ const bin = join(root, '.bin')
126
+ mkdirSync(bin)
127
+ writeFileSync(join(bin, 'claude'), STUB_CLAUDE)
128
+ chmodSync(join(bin, 'claude'), 0o755)
129
+ // Only the stub is reachable: a real agent CLI on this machine never is.
130
+ saved = { PATH: process.env.PATH, HOME: process.env.HOME, NO_COLOR: process.env.NO_COLOR }
131
+ process.env.PATH = [bin, '/usr/bin', '/bin'].join(delimiter)
132
+ process.env.HOME = root
133
+ process.env.NO_COLOR = '1'
134
+ vi.spyOn(process, 'cwd').mockReturnValue(root)
135
+ out = []
136
+ const capture = (...a: unknown[]): void => void out.push(a.join(' '))
137
+ vi.spyOn(console, 'log').mockImplementation(capture)
138
+ vi.spyOn(console, 'error').mockImplementation(capture)
139
+ vi.spyOn(console, 'warn').mockImplementation(capture)
140
+ vi.spyOn(process.stdout, 'write').mockImplementation(((chunk: string) => (out.push(String(chunk)), true)) as typeof process.stdout.write)
141
+ _setAllowlistConfigPath('/nonexistent/secret-scan-config.yml')
142
+ _resetAllowlistCache()
143
+ })
144
+
145
+ afterEach(() => {
146
+ vi.restoreAllMocks()
147
+ for (const [k, v] of Object.entries(saved)) {
148
+ if (v === undefined) delete process.env[k]
149
+ else process.env[k] = v
150
+ }
151
+ rmSync(root, { recursive: true, force: true, maxRetries: 5, retryDelay: 100 })
152
+ })
153
+
154
+ const text = (): string => out.join('\n')
155
+
156
+ function writeSpec(name: string, body: string): string {
157
+ writeFileSync(join(root, name), body)
158
+ return name
159
+ }
160
+
161
+ const TWO_TASKS = `name: Two files
162
+ tasks:
163
+ - id: one
164
+ files: [one.txt]
165
+ prompt: |
166
+ WRITE one.txt first
167
+ - id: two
168
+ depends_on: [one]
169
+ files: [two.txt]
170
+ prompt: |
171
+ WRITE two.txt second
172
+ `
173
+
174
+ describe('convoy run --dry-run', () => {
175
+ it('shows the plan and the runtime, and records nothing', async () => {
176
+ const spec = writeSpec('s.yml', TWO_TASKS)
177
+ expect(await runSpec(args({ spec, dryRun: true }))).toBe(0)
178
+ expect(text()).toMatch(/Convoy: Two files — 2 tasks, up to 4 at once/)
179
+ expect(text()).toMatch(/two\s+developer\s+one\s+two\.txt/)
180
+ expect(text()).toContain('Claude Code — found on PATH')
181
+ expect(text()).toContain('nothing started, nothing recorded')
182
+ expect(existsSync(join(root, '.opencastle'))).toBe(false)
183
+ })
184
+
185
+ it('refuses what a run would refuse: two tasks that could run together on one file', async () => {
186
+ const spec = writeSpec('s.yml', `name: Clash
187
+ tasks:
188
+ - id: a
189
+ files: [same.txt]
190
+ prompt: x
191
+ - id: b
192
+ files: [same.txt]
193
+ prompt: y
194
+ `)
195
+ expect(await runSpec(args({ spec, dryRun: true }))).toBe(1)
196
+ expect(text()).toMatch(/File partition conflicts/)
197
+ expect(existsSync(join(root, '.opencastle'))).toBe(false)
198
+ })
199
+
200
+ it('still shows the plan when no runtime is installed, then says why it would not run', async () => {
201
+ process.env.PATH = ['/usr/bin', '/bin'].join(delimiter)
202
+ const spec = writeSpec('s.yml', TWO_TASKS)
203
+ expect(await runSpec(args({ spec, dryRun: true }))).toBe(1)
204
+ expect(text()).toMatch(/Convoy: Two files/)
205
+ expect(text()).toMatch(/No agent CLI found on PATH/)
206
+ })
207
+ })
208
+
209
+ describe('convoy run', () => {
210
+ it('names a missing spec, and a chained one, without starting anything', async () => {
211
+ expect(await runSpec(args({ spec: 'nope.yml' }))).toBe(1)
212
+ expect(text()).toContain('Spec not found: nope.yml')
213
+ const chain = writeSpec('chain.yml', 'name: c\nversion: 2\ndepends_on_convoy: [a.yml]\n')
214
+ expect(await runSpec(args({ spec: chain }))).toBe(1)
215
+ expect(text()).toMatch(/no longer supported/)
216
+ expect(await runSpec(args())).toBe(1)
217
+ expect(text()).toContain('Name the spec to run')
218
+ })
219
+
220
+ it('runs to the end on a stub runtime, lands the work on a branch, and lets go', async () => {
221
+ git('init', '-q', '-b', 'main')
222
+ git('config', 'user.email', 't@t')
223
+ git('config', 'user.name', 't')
224
+ writeFileSync(join(root, '.gitignore'), '.opencastle/\n.bin/\n')
225
+ git('add', '-A')
226
+ git('commit', '-qm', 'init')
227
+ const spec = writeSpec('s.yml', TWO_TASKS)
228
+ const listeners = process.listenerCount('SIGINT')
229
+
230
+ expect(await runSpec(args({ spec }))).toBe(0)
231
+
232
+ // The engine's summary, once.
233
+ expect(text().match(/Convoy done/g)).toHaveLength(1)
234
+ const branch = git('branch', '--list', 'convoy/*').replace('*', '').trim()
235
+ expect(branch).toMatch(/^convoy\/two-files-/)
236
+ expect(git('show', `${branch}:one.txt`)).toBe('first')
237
+ expect(git('show', `${branch}:two.txt`)).toBe('second')
238
+ // The user's checkout is untouched.
239
+ expect(git('rev-parse', '--abbrev-ref', 'HEAD')).toBe('main')
240
+ expect(existsSync(join(root, 'one.txt'))).toBe(false)
241
+ // Nothing left listening for Ctrl+C once the run is over.
242
+ expect(process.listenerCount('SIGINT')).toBe(listeners)
243
+ }, 60_000)
244
+ })
245
+
246
+ // ── convoy resume ─────────────────────────────────────────────────────────────
247
+
248
+ describe('convoy run, then resume after a failure', () => {
249
+ it('re-runs the failed task and the one it skipped, on the same branch, and ends done', async () => {
250
+ git('init', '-q', '-b', 'main')
251
+ git('config', 'user.email', 't@t')
252
+ git('config', 'user.name', 't')
253
+ writeFileSync(join(root, '.gitignore'), '.opencastle/\n.bin/\nbroken\n')
254
+ git('add', '-A')
255
+ git('commit', '-qm', 'init')
256
+ const flag = join(root, 'broken')
257
+ writeFileSync(flag, '')
258
+ const spec = writeSpec('s.yml', `name: Fails once
259
+ tasks:
260
+ - id: one
261
+ files: [one.txt]
262
+ max_retries: 0
263
+ prompt: |
264
+ FAILIF ${flag}
265
+ WRITE one.txt first
266
+ - id: two
267
+ depends_on: [one]
268
+ files: [two.txt]
269
+ prompt: |
270
+ WRITE two.txt second
271
+ `)
272
+ expect(await runSpec(args({ spec }))).toBe(1)
273
+ expect(text()).toMatch(/Resume with: opencastle convoy resume/)
274
+
275
+ rmSync(flag)
276
+ out.length = 0
277
+ expect(await resumeLast(args())).toBe(0)
278
+ expect(text()).toContain('Resuming Fails once')
279
+ expect(text()).toMatch(/Convoy done/)
280
+ const branches = git('branch', '--list', 'convoy/*').split('\n').map((b) => b.replace('*', '').trim()).filter(Boolean)
281
+ expect(branches).toHaveLength(1)
282
+ expect(git('show', `${branches[0]}:one.txt`)).toBe('first')
283
+ expect(git('show', `${branches[0]}:two.txt`)).toBe('second')
284
+ }, 60_000)
285
+ })
286
+
287
+ function seedRuns(runs: Array<{ id: string; status: string; tasks: Array<[string, string]>; created: string }>): void {
288
+ mkdirSync(join(root, '.opencastle'), { recursive: true })
289
+ const store = createConvoyStore(join(root, '.opencastle', 'convoy.db'))
290
+ for (const run of runs) {
291
+ store.insertConvoy({ id: run.id, name: `Run ${run.id}`, spec_hash: 'h', status: 'pending', branch: null, created_at: run.created, spec_yaml: TWO_TASKS })
292
+ for (const [id, status] of run.tasks) {
293
+ store.insertTask({
294
+ id, convoy_id: run.id, phase: 0, prompt: 'p', agent: 'developer', adapter: null, model: null, timeout_ms: 1000,
295
+ status: 'pending', retries: 0, max_retries: 0, files: null, depends_on: null, gates: null,
296
+ })
297
+ if (status !== 'pending') store.updateTaskStatus(id, run.id, status as 'done')
298
+ }
299
+ store.updateConvoyStatus(run.id, run.status as 'done', {})
300
+ }
301
+ store.close()
302
+ }
303
+
304
+ describe('convoy resume', () => {
305
+ it('says there is nothing to resume when there are no runs', async () => {
306
+ expect(await resumeLast(args())).toBe(1)
307
+ expect(text()).toContain('No convoy runs in this project yet')
308
+ })
309
+
310
+ it('says so and exits 0 when every run is done', async () => {
311
+ seedRuns([{ id: 'a', status: 'done', tasks: [['one', 'done']], created: '2026-10-01T00:00:00Z' }])
312
+ expect(await resumeLast(args())).toBe(0)
313
+ expect(text()).toMatch(/Nothing to resume: the last run, Run a, finished/)
314
+ })
315
+
316
+ it('previews the newest run that is not done, listing what would run, and writes nothing', async () => {
317
+ seedRuns([
318
+ { id: 'old', status: 'failed', tasks: [['one', 'done'], ['two', 'failed'], ['three', 'skipped']], created: '2026-10-01T00:00:00Z' },
319
+ { id: 'new', status: 'done', tasks: [['one', 'done']], created: '2026-10-02T00:00:00Z' },
320
+ ])
321
+ const db = join(root, '.opencastle', 'convoy.db')
322
+ const before = statSync(db).mtimeMs
323
+ expect(await resumeLast(args({ dryRun: true }))).toBe(0)
324
+ expect(text()).toContain('Resuming Run old')
325
+ expect(text()).toContain('The newest run, Run new, finished')
326
+ expect(text()).toMatch(/Would run 2 of 3 task\(s\)/)
327
+ expect(text()).toMatch(/two — developer \[failed\]/)
328
+ expect(text()).toMatch(/three — developer \[skipped\]/)
329
+ expect(text()).not.toMatch(/one — developer/)
330
+ // Nothing was reset: the preview only read.
331
+ expect(statSync(db).mtimeMs).toBe(before)
332
+ expect(readRun(root, 'old')!.tasks.map((t) => t.status)).toEqual(['done', 'failed', 'skipped'])
333
+ })
334
+
335
+ it('counts a run "done" with a task skipped as not done', async () => {
336
+ seedRuns([{ id: 'a', status: 'done', tasks: [['one', 'done'], ['two', 'skipped']], created: '2026-10-01T00:00:00Z' }])
337
+ expect(await resumeLast(args({ dryRun: true }))).toBe(0)
338
+ expect(text()).toMatch(/Would run 1 of 2/)
339
+ })
340
+
341
+ it('refuses a run another process is still working on', async () => {
342
+ seedRuns([{ id: 'live', status: 'running', tasks: [['one', 'running']], created: new Date().toISOString() }])
343
+ const db = new DatabaseSync(join(root, '.opencastle', 'convoy.db'))
344
+ db.exec('CREATE TABLE IF NOT EXISTS engine_lock (id INTEGER PRIMARY KEY, pid INTEGER, hostname TEXT, started_at TEXT, last_heartbeat TEXT)')
345
+ db.prepare('INSERT OR REPLACE INTO engine_lock VALUES (1, ?, ?, ?, ?)').run(process.pid, hostname(), '2026-01-01T00:00:00Z', new Date().toISOString())
346
+ db.close()
347
+ expect(await resumeLast(args())).toBe(1)
348
+ expect(text()).toMatch(/is still running in another process/)
349
+ expect(text()).toContain('opencastle convoy dashboard')
350
+ })
351
+ })