opencastle 1.3.0 → 1.4.0
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.
- package/README.md +102 -131
- package/bin/cli.mjs +20 -10
- package/dist/cli/adapters/claude-code.d.ts +5 -3
- package/dist/cli/adapters/claude-code.d.ts.map +1 -1
- package/dist/cli/adapters/claude-code.js +7 -3
- package/dist/cli/adapters/claude-code.js.map +1 -1
- package/dist/cli/adapters/single-file-base.d.ts +18 -0
- package/dist/cli/adapters/single-file-base.d.ts.map +1 -1
- package/dist/cli/adapters/single-file-base.js +29 -4
- package/dist/cli/adapters/single-file-base.js.map +1 -1
- package/dist/cli/agent-plugin.test.js +12 -0
- package/dist/cli/agent-plugin.test.js.map +1 -1
- package/dist/cli/agent-roster.test.js +0 -48
- package/dist/cli/agent-roster.test.js.map +1 -1
- package/dist/cli/bootstrap.d.ts.map +1 -1
- package/dist/cli/bootstrap.js +20 -0
- package/dist/cli/bootstrap.js.map +1 -1
- package/dist/cli/boundary.test.js +9 -7
- package/dist/cli/boundary.test.js.map +1 -1
- package/dist/cli/ci.d.ts.map +1 -1
- package/dist/cli/ci.js +6 -4
- package/dist/cli/ci.js.map +1 -1
- package/dist/cli/command-namespace.test.js +33 -0
- package/dist/cli/command-namespace.test.js.map +1 -1
- package/dist/cli/convoy/artifacts.d.ts +9 -2
- package/dist/cli/convoy/artifacts.d.ts.map +1 -1
- package/dist/cli/convoy/artifacts.js +13 -10
- package/dist/cli/convoy/artifacts.js.map +1 -1
- package/dist/cli/convoy/artifacts.test.js +4 -2
- package/dist/cli/convoy/artifacts.test.js.map +1 -1
- package/dist/cli/convoy/engine.d.ts +53 -23
- package/dist/cli/convoy/engine.d.ts.map +1 -1
- package/dist/cli/convoy/engine.git.test.d.ts +2 -0
- package/dist/cli/convoy/engine.git.test.d.ts.map +1 -0
- package/dist/cli/convoy/engine.git.test.js +435 -0
- package/dist/cli/convoy/engine.git.test.js.map +1 -0
- package/dist/cli/convoy/engine.js +1746 -2305
- package/dist/cli/convoy/engine.js.map +1 -1
- package/dist/cli/convoy/engine.test.js +698 -678
- package/dist/cli/convoy/engine.test.js.map +1 -1
- package/dist/cli/convoy/event-schemas.d.ts +2 -0
- package/dist/cli/convoy/event-schemas.d.ts.map +1 -1
- package/dist/cli/convoy/event-schemas.js +59 -57
- package/dist/cli/convoy/event-schemas.js.map +1 -1
- package/dist/cli/convoy/events.d.ts +4 -1
- package/dist/cli/convoy/events.d.ts.map +1 -1
- package/dist/cli/convoy/events.js +69 -84
- package/dist/cli/convoy/events.js.map +1 -1
- package/dist/cli/convoy/events.test.js +50 -9
- package/dist/cli/convoy/events.test.js.map +1 -1
- package/dist/cli/convoy/gates.d.ts +9 -4
- package/dist/cli/convoy/gates.d.ts.map +1 -1
- package/dist/cli/convoy/gates.js +29 -14
- package/dist/cli/convoy/gates.js.map +1 -1
- package/dist/cli/convoy/isolation.d.ts +32 -6
- package/dist/cli/convoy/isolation.d.ts.map +1 -1
- package/dist/cli/convoy/isolation.js +72 -34
- package/dist/cli/convoy/isolation.js.map +1 -1
- package/dist/cli/convoy/isolation.test.js +66 -42
- package/dist/cli/convoy/isolation.test.js.map +1 -1
- package/dist/cli/convoy/lock.d.ts.map +1 -1
- package/dist/cli/convoy/lock.js +25 -10
- package/dist/cli/convoy/lock.js.map +1 -1
- package/dist/cli/convoy/lock.test.js +12 -0
- package/dist/cli/convoy/lock.test.js.map +1 -1
- package/dist/cli/convoy/merge.d.ts +21 -4
- package/dist/cli/convoy/merge.d.ts.map +1 -1
- package/dist/cli/convoy/merge.js +69 -53
- package/dist/cli/convoy/merge.js.map +1 -1
- package/dist/cli/convoy/merge.test.js +23 -1
- package/dist/cli/convoy/merge.test.js.map +1 -1
- package/dist/cli/convoy/progress.d.ts +35 -0
- package/dist/cli/convoy/progress.d.ts.map +1 -0
- package/dist/cli/convoy/progress.js +103 -0
- package/dist/cli/convoy/progress.js.map +1 -0
- package/dist/cli/convoy/progress.test.d.ts +2 -0
- package/dist/cli/convoy/progress.test.d.ts.map +1 -0
- package/dist/cli/convoy/progress.test.js +53 -0
- package/dist/cli/convoy/progress.test.js.map +1 -0
- package/dist/cli/convoy/read-model.d.ts +468 -0
- package/dist/cli/convoy/read-model.d.ts.map +1 -0
- package/dist/cli/convoy/read-model.js +1132 -0
- package/dist/cli/convoy/read-model.js.map +1 -0
- package/dist/cli/convoy/read-model.test.d.ts +2 -0
- package/dist/cli/convoy/read-model.test.d.ts.map +1 -0
- package/dist/cli/convoy/read-model.test.js +609 -0
- package/dist/cli/convoy/read-model.test.js.map +1 -0
- package/dist/cli/convoy/redact.d.ts +34 -0
- package/dist/cli/convoy/redact.d.ts.map +1 -0
- package/dist/cli/convoy/redact.js +66 -0
- package/dist/cli/convoy/redact.js.map +1 -0
- package/dist/cli/convoy/redact.test.d.ts +2 -0
- package/dist/cli/convoy/redact.test.d.ts.map +1 -0
- package/dist/cli/convoy/redact.test.js +43 -0
- package/dist/cli/convoy/redact.test.js.map +1 -0
- package/dist/cli/convoy/reviewer.d.ts +65 -0
- package/dist/cli/convoy/reviewer.d.ts.map +1 -0
- package/dist/cli/convoy/reviewer.js +141 -0
- package/dist/cli/convoy/reviewer.js.map +1 -0
- package/dist/cli/convoy/reviewer.test.d.ts +2 -0
- package/dist/cli/convoy/reviewer.test.d.ts.map +1 -0
- package/dist/cli/convoy/reviewer.test.js +96 -0
- package/dist/cli/convoy/reviewer.test.js.map +1 -0
- package/dist/cli/convoy/schedule.d.ts +30 -0
- package/dist/cli/convoy/schedule.d.ts.map +1 -0
- package/dist/cli/convoy/schedule.js +111 -0
- package/dist/cli/convoy/schedule.js.map +1 -0
- package/dist/cli/convoy/schedule.test.d.ts +2 -0
- package/dist/cli/convoy/schedule.test.d.ts.map +1 -0
- package/dist/cli/convoy/schedule.test.js +45 -0
- package/dist/cli/convoy/schedule.test.js.map +1 -0
- package/dist/cli/convoy/spec-builder.d.ts +120 -30
- package/dist/cli/convoy/spec-builder.d.ts.map +1 -1
- package/dist/cli/convoy/spec-builder.js +438 -114
- package/dist/cli/convoy/spec-builder.js.map +1 -1
- package/dist/cli/convoy/spec-builder.test.js +419 -435
- package/dist/cli/convoy/spec-builder.test.js.map +1 -1
- package/dist/cli/convoy/spec-types.d.ts +46 -92
- package/dist/cli/convoy/spec-types.d.ts.map +1 -1
- package/dist/cli/convoy/store.d.ts +6 -1
- package/dist/cli/convoy/store.d.ts.map +1 -1
- package/dist/cli/convoy/store.js +111 -15
- package/dist/cli/convoy/store.js.map +1 -1
- package/dist/cli/convoy/store.test.js +59 -13
- package/dist/cli/convoy/store.test.js.map +1 -1
- package/dist/cli/convoy/types.d.ts +76 -113
- package/dist/cli/convoy/types.d.ts.map +1 -1
- package/dist/cli/convoy/types.js +6 -13
- package/dist/cli/convoy/types.js.map +1 -1
- package/dist/cli/convoy/worktree.d.ts +88 -3
- package/dist/cli/convoy/worktree.d.ts.map +1 -1
- package/dist/cli/convoy/worktree.js +282 -56
- package/dist/cli/convoy/worktree.js.map +1 -1
- package/dist/cli/convoy/worktree.test.js +132 -1
- package/dist/cli/convoy/worktree.test.js.map +1 -1
- package/dist/cli/convoy-args.test.js +9 -27
- package/dist/cli/convoy-args.test.js.map +1 -1
- package/dist/cli/convoy-cmd.d.ts +31 -6
- package/dist/cli/convoy-cmd.d.ts.map +1 -1
- package/dist/cli/convoy-cmd.js +150 -200
- package/dist/cli/convoy-cmd.js.map +1 -1
- package/dist/cli/convoy-cmd.test.d.ts +2 -0
- package/dist/cli/convoy-cmd.test.d.ts.map +1 -0
- package/dist/cli/convoy-cmd.test.js +144 -0
- package/dist/cli/convoy-cmd.test.js.map +1 -0
- package/dist/cli/dashboard.d.ts +24 -11
- package/dist/cli/dashboard.d.ts.map +1 -1
- package/dist/cli/dashboard.js +241 -303
- package/dist/cli/dashboard.js.map +1 -1
- package/dist/cli/dashboard.test.d.ts +2 -0
- package/dist/cli/dashboard.test.d.ts.map +1 -0
- package/dist/cli/dashboard.test.js +340 -0
- package/dist/cli/dashboard.test.js.map +1 -0
- package/dist/cli/dispatcher.test.js +41 -2
- package/dist/cli/dispatcher.test.js.map +1 -1
- package/dist/cli/docs-accuracy.test.js +36 -11
- package/dist/cli/docs-accuracy.test.js.map +1 -1
- package/dist/cli/doctor.d.ts.map +1 -1
- package/dist/cli/doctor.js +9 -6
- package/dist/cli/doctor.js.map +1 -1
- package/dist/cli/init-own-files.test.d.ts +2 -0
- package/dist/cli/init-own-files.test.d.ts.map +1 -0
- package/dist/cli/init-own-files.test.js +133 -0
- package/dist/cli/init-own-files.test.js.map +1 -0
- package/dist/cli/init.d.ts.map +1 -1
- package/dist/cli/init.js +106 -7
- package/dist/cli/init.js.map +1 -1
- package/dist/cli/init.test.js +5 -4
- package/dist/cli/init.test.js.map +1 -1
- package/dist/cli/layers.d.ts.map +1 -1
- package/dist/cli/layers.js +13 -4
- package/dist/cli/layers.js.map +1 -1
- package/dist/cli/lesson.d.ts.map +1 -1
- package/dist/cli/lesson.js +6 -5
- package/dist/cli/lesson.js.map +1 -1
- package/dist/cli/log.d.ts +39 -0
- package/dist/cli/log.d.ts.map +1 -1
- package/dist/cli/log.js +267 -93
- package/dist/cli/log.js.map +1 -1
- package/dist/cli/log.test.d.ts +2 -0
- package/dist/cli/log.test.d.ts.map +1 -0
- package/dist/cli/log.test.js +208 -0
- package/dist/cli/log.test.js.map +1 -0
- package/dist/cli/nearest.d.ts +18 -0
- package/dist/cli/nearest.d.ts.map +1 -0
- package/dist/cli/nearest.js +38 -0
- package/dist/cli/nearest.js.map +1 -0
- package/dist/cli/nearest.test.d.ts +2 -0
- package/dist/cli/nearest.test.d.ts.map +1 -0
- package/dist/cli/nearest.test.js +24 -0
- package/dist/cli/nearest.test.js.map +1 -0
- package/dist/cli/pipeline.d.ts +61 -0
- package/dist/cli/pipeline.d.ts.map +1 -1
- package/dist/cli/pipeline.flow.test.d.ts +2 -0
- package/dist/cli/pipeline.flow.test.d.ts.map +1 -0
- package/dist/cli/pipeline.flow.test.js +524 -0
- package/dist/cli/pipeline.flow.test.js.map +1 -0
- package/dist/cli/pipeline.js +471 -690
- package/dist/cli/pipeline.js.map +1 -1
- package/dist/cli/plan.d.ts +82 -31
- package/dist/cli/plan.d.ts.map +1 -1
- package/dist/cli/plan.js +167 -507
- package/dist/cli/plan.js.map +1 -1
- package/dist/cli/plan.test.d.ts +2 -0
- package/dist/cli/plan.test.d.ts.map +1 -0
- package/dist/cli/plan.test.js +158 -0
- package/dist/cli/plan.test.js.map +1 -0
- package/dist/cli/prompt.d.ts.map +1 -1
- package/dist/cli/prompt.js +9 -7
- package/dist/cli/prompt.js.map +1 -1
- package/dist/cli/prompt.test.js +20 -2
- package/dist/cli/prompt.test.js.map +1 -1
- package/dist/cli/remove.d.ts.map +1 -1
- package/dist/cli/remove.js +3 -1
- package/dist/cli/remove.js.map +1 -1
- package/dist/cli/review.d.ts.map +1 -1
- package/dist/cli/review.js +7 -1
- package/dist/cli/review.js.map +1 -1
- package/dist/cli/run/adapters/agent-process.d.ts +82 -0
- package/dist/cli/run/adapters/agent-process.d.ts.map +1 -0
- package/dist/cli/run/adapters/agent-process.js +224 -0
- package/dist/cli/run/adapters/agent-process.js.map +1 -0
- package/dist/cli/run/adapters/agent-process.test.d.ts +2 -0
- package/dist/cli/run/adapters/agent-process.test.d.ts.map +1 -0
- package/dist/cli/run/adapters/agent-process.test.js +159 -0
- package/dist/cli/run/adapters/agent-process.test.js.map +1 -0
- package/dist/cli/run/adapters/claude.d.ts +53 -2
- package/dist/cli/run/adapters/claude.d.ts.map +1 -1
- package/dist/cli/run/adapters/claude.js +147 -171
- package/dist/cli/run/adapters/claude.js.map +1 -1
- package/dist/cli/run/adapters/claude.test.js +197 -254
- package/dist/cli/run/adapters/claude.test.js.map +1 -1
- package/dist/cli/run/adapters/codex.d.ts +25 -2
- package/dist/cli/run/adapters/codex.d.ts.map +1 -1
- package/dist/cli/run/adapters/codex.js +113 -81
- package/dist/cli/run/adapters/codex.js.map +1 -1
- package/dist/cli/run/adapters/codex.test.js +116 -95
- package/dist/cli/run/adapters/codex.test.js.map +1 -1
- package/dist/cli/run/adapters/copilot.d.ts +35 -1
- package/dist/cli/run/adapters/copilot.d.ts.map +1 -1
- package/dist/cli/run/adapters/copilot.js +104 -287
- package/dist/cli/run/adapters/copilot.js.map +1 -1
- package/dist/cli/run/adapters/copilot.test.js +122 -282
- package/dist/cli/run/adapters/copilot.test.js.map +1 -1
- package/dist/cli/run/adapters/cursor.d.ts +25 -7
- package/dist/cli/run/adapters/cursor.d.ts.map +1 -1
- package/dist/cli/run/adapters/cursor.js +103 -156
- package/dist/cli/run/adapters/cursor.js.map +1 -1
- package/dist/cli/run/adapters/cursor.test.js +106 -218
- package/dist/cli/run/adapters/cursor.test.js.map +1 -1
- package/dist/cli/run/adapters/index.d.ts +34 -5
- package/dist/cli/run/adapters/index.d.ts.map +1 -1
- package/dist/cli/run/adapters/index.js +147 -21
- package/dist/cli/run/adapters/index.js.map +1 -1
- package/dist/cli/run/adapters/index.test.d.ts +2 -0
- package/dist/cli/run/adapters/index.test.d.ts.map +1 -0
- package/dist/cli/run/adapters/index.test.js +129 -0
- package/dist/cli/run/adapters/index.test.js.map +1 -0
- package/dist/cli/run/adapters/opencode.d.ts +25 -9
- package/dist/cli/run/adapters/opencode.d.ts.map +1 -1
- package/dist/cli/run/adapters/opencode.js +136 -152
- package/dist/cli/run/adapters/opencode.js.map +1 -1
- package/dist/cli/run/adapters/opencode.test.js +99 -218
- package/dist/cli/run/adapters/opencode.test.js.map +1 -1
- package/dist/cli/run/adapters/permission-modes.d.ts +47 -4
- package/dist/cli/run/adapters/permission-modes.d.ts.map +1 -1
- package/dist/cli/run/adapters/permission-modes.js +113 -37
- package/dist/cli/run/adapters/permission-modes.js.map +1 -1
- package/dist/cli/run/adapters/permission-modes.test.js +55 -40
- package/dist/cli/run/adapters/permission-modes.test.js.map +1 -1
- package/dist/cli/run/adapters/stub-cli.test-helper.d.ts +22 -0
- package/dist/cli/run/adapters/stub-cli.test-helper.d.ts.map +1 -0
- package/dist/cli/run/adapters/stub-cli.test-helper.js +73 -0
- package/dist/cli/run/adapters/stub-cli.test-helper.js.map +1 -0
- package/dist/cli/run/platform.d.ts +52 -0
- package/dist/cli/run/platform.d.ts.map +1 -0
- package/dist/cli/run/platform.js +207 -0
- package/dist/cli/run/platform.js.map +1 -0
- package/dist/cli/run/platform.test.d.ts +2 -0
- package/dist/cli/run/platform.test.d.ts.map +1 -0
- package/dist/cli/run/platform.test.js +119 -0
- package/dist/cli/run/platform.test.js.map +1 -0
- package/dist/cli/run/schema.d.ts +6 -8
- package/dist/cli/run/schema.d.ts.map +1 -1
- package/dist/cli/run/schema.js +44 -68
- package/dist/cli/run/schema.js.map +1 -1
- package/dist/cli/run/schema.test.js +59 -279
- package/dist/cli/run/schema.test.js.map +1 -1
- package/dist/cli/run.d.ts +34 -56
- package/dist/cli/run.d.ts.map +1 -1
- package/dist/cli/run.js +379 -1132
- package/dist/cli/run.js.map +1 -1
- package/dist/cli/run.test.d.ts +2 -0
- package/dist/cli/run.test.d.ts.map +1 -0
- package/dist/cli/run.test.js +318 -0
- package/dist/cli/run.test.js.map +1 -0
- package/dist/cli/sync-check.d.ts.map +1 -1
- package/dist/cli/sync-check.js +12 -3
- package/dist/cli/sync-check.js.map +1 -1
- package/dist/cli/sync.d.ts.map +1 -1
- package/dist/cli/sync.js +3 -2
- package/dist/cli/sync.js.map +1 -1
- package/dist/cli/team-config.d.ts.map +1 -1
- package/dist/cli/team-config.js +2 -21
- package/dist/cli/team-config.js.map +1 -1
- package/dist/cli/tiers.test.js +4 -13
- package/dist/cli/tiers.test.js.map +1 -1
- package/dist/cli/update.d.ts.map +1 -1
- package/dist/cli/update.js +4 -3
- package/dist/cli/update.js.map +1 -1
- package/dist/cli/website-plugins.test.js +51 -2
- package/dist/cli/website-plugins.test.js.map +1 -1
- package/dist/orchestrator/plugins/coolify/config.d.ts.map +1 -1
- package/dist/orchestrator/plugins/coolify/config.js +13 -0
- package/dist/orchestrator/plugins/coolify/config.js.map +1 -1
- package/dist/orchestrator/plugins/sentry/config.d.ts.map +1 -1
- package/dist/orchestrator/plugins/sentry/config.js +13 -0
- package/dist/orchestrator/plugins/sentry/config.js.map +1 -1
- package/package.json +3 -10
- package/src/cli/adapters/claude-code.ts +7 -3
- package/src/cli/adapters/single-file-base.ts +47 -4
- package/src/cli/agent-plugin.test.ts +14 -0
- package/src/cli/agent-roster.test.ts +0 -55
- package/src/cli/bootstrap.ts +23 -0
- package/src/cli/boundary.test.ts +9 -7
- package/src/cli/ci.ts +6 -4
- package/src/cli/command-namespace.test.ts +35 -0
- package/src/cli/convoy/TELEMETRY.md +138 -130
- package/src/cli/convoy/artifacts.test.ts +4 -2
- package/src/cli/convoy/artifacts.ts +13 -12
- package/src/cli/convoy/engine.git.test.ts +462 -0
- package/src/cli/convoy/engine.test.ts +817 -850
- package/src/cli/convoy/engine.ts +1864 -2596
- package/src/cli/convoy/event-schemas.ts +63 -59
- package/src/cli/convoy/events.test.ts +58 -9
- package/src/cli/convoy/events.ts +69 -91
- package/src/cli/convoy/gates.ts +31 -12
- package/src/cli/convoy/isolation.test.ts +76 -43
- package/src/cli/convoy/isolation.ts +100 -38
- package/src/cli/convoy/lock.test.ts +16 -0
- package/src/cli/convoy/lock.ts +25 -8
- package/src/cli/convoy/merge.test.ts +25 -1
- package/src/cli/convoy/merge.ts +74 -61
- package/src/cli/convoy/progress.test.ts +59 -0
- package/src/cli/convoy/progress.ts +121 -0
- package/src/cli/convoy/read-model.test.ts +685 -0
- package/src/cli/convoy/read-model.ts +1469 -0
- package/src/cli/convoy/redact.test.ts +49 -0
- package/src/cli/convoy/redact.ts +73 -0
- package/src/cli/convoy/reviewer.test.ts +112 -0
- package/src/cli/convoy/reviewer.ts +196 -0
- package/src/cli/convoy/schedule.test.ts +56 -0
- package/src/cli/convoy/schedule.ts +109 -0
- package/src/cli/convoy/spec-builder.test.ts +460 -464
- package/src/cli/convoy/spec-builder.ts +460 -129
- package/src/cli/convoy/spec-types.ts +46 -108
- package/src/cli/convoy/store.test.ts +64 -13
- package/src/cli/convoy/store.ts +143 -33
- package/src/cli/convoy/types.ts +59 -71
- package/src/cli/convoy/worktree.test.ts +140 -1
- package/src/cli/convoy/worktree.ts +311 -61
- package/src/cli/convoy-args.test.ts +10 -30
- package/src/cli/convoy-cmd.test.ts +163 -0
- package/src/cli/convoy-cmd.ts +173 -215
- package/src/cli/dashboard/dashboard.css +2086 -0
- package/src/cli/dashboard/dashboard.js +1687 -0
- package/src/cli/dashboard/index.html +307 -0
- package/src/cli/dashboard.test.ts +382 -0
- package/src/cli/dashboard.ts +243 -339
- package/src/cli/dispatcher.test.ts +43 -2
- package/src/cli/docs-accuracy.test.ts +37 -10
- package/src/cli/doctor.ts +9 -6
- package/src/cli/init-own-files.test.ts +156 -0
- package/src/cli/init.test.ts +5 -4
- package/src/cli/init.ts +104 -7
- package/src/cli/layers.ts +13 -4
- package/src/cli/lesson.ts +6 -5
- package/src/cli/log.test.ts +228 -0
- package/src/cli/log.ts +302 -83
- package/src/cli/nearest.test.ts +27 -0
- package/src/cli/nearest.ts +38 -0
- package/src/cli/pipeline.flow.test.ts +607 -0
- package/src/cli/pipeline.ts +544 -759
- package/src/cli/plan.test.ts +193 -0
- package/src/cli/plan.ts +209 -545
- package/src/cli/prompt.test.ts +21 -2
- package/src/cli/prompt.ts +11 -7
- package/src/cli/remove.ts +3 -0
- package/src/cli/review.ts +7 -1
- package/src/cli/run/adapters/agent-process.test.ts +175 -0
- package/src/cli/run/adapters/agent-process.ts +252 -0
- package/src/cli/run/adapters/claude.test.ts +205 -260
- package/src/cli/run/adapters/claude.ts +151 -162
- package/src/cli/run/adapters/codex.test.ts +120 -100
- package/src/cli/run/adapters/codex.ts +115 -91
- package/src/cli/run/adapters/copilot.test.ts +135 -306
- package/src/cli/run/adapters/copilot.ts +105 -274
- package/src/cli/run/adapters/cursor.test.ts +111 -220
- package/src/cli/run/adapters/cursor.ts +105 -156
- package/src/cli/run/adapters/index.test.ts +148 -0
- package/src/cli/run/adapters/index.ts +168 -20
- package/src/cli/run/adapters/opencode.test.ts +106 -227
- package/src/cli/run/adapters/opencode.ts +139 -151
- package/src/cli/run/adapters/permission-modes.test.ts +63 -41
- package/src/cli/run/adapters/permission-modes.ts +118 -37
- package/src/cli/run/adapters/stub-cli.test-helper.ts +88 -0
- package/src/cli/run/platform.test.ts +128 -0
- package/src/cli/run/platform.ts +213 -0
- package/src/cli/run/schema.test.ts +62 -344
- package/src/cli/run/schema.ts +48 -78
- package/src/cli/run.test.ts +351 -0
- package/src/cli/run.ts +366 -1151
- package/src/cli/sync-check.ts +12 -3
- package/src/cli/sync.ts +3 -2
- package/src/cli/team-config.ts +2 -21
- package/src/cli/tiers.test.ts +4 -17
- package/src/cli/update.ts +4 -3
- package/src/cli/website-plugins.test.ts +55 -5
- package/src/orchestrator/agents/team-lead.agent.md +2 -2
- package/src/orchestrator/customizations/README.md +58 -13
- package/src/orchestrator/customizations/logs/README.md +23 -18
- package/src/orchestrator/instructions/general.instructions.md +1 -1
- package/src/orchestrator/plugins/coolify/config.ts +13 -0
- package/src/orchestrator/plugins/sentry/config.ts +13 -0
- package/src/orchestrator/prompts/assess-complexity.prompt.md +43 -26
- package/src/orchestrator/prompts/bootstrap-customizations.prompt.md +44 -49
- package/src/orchestrator/prompts/brainstorm.prompt.md +2 -2
- package/src/orchestrator/prompts/bug-fix.prompt.md +5 -4
- package/src/orchestrator/prompts/create-skill.prompt.md +29 -39
- package/src/orchestrator/prompts/fix-convoy.prompt.md +43 -29
- package/src/orchestrator/prompts/fix-prd.prompt.md +26 -22
- package/src/orchestrator/prompts/generate-convoy.prompt.md +139 -147
- package/src/orchestrator/prompts/generate-prd.prompt.md +75 -68
- package/src/orchestrator/prompts/implement-feature.prompt.md +7 -6
- package/src/orchestrator/prompts/validate-convoy.prompt.md +29 -28
- package/src/orchestrator/prompts/validate-prd.prompt.md +28 -21
- package/src/orchestrator/skills/agent-hooks/HOOKS-REFERENCE.md +3 -3
- package/src/orchestrator/skills/agent-hooks/SKILL.md +1 -1
- package/src/orchestrator/skills/fast-review/SKILL.md +3 -1
- package/src/orchestrator/skills/orchestration-protocols/SKILL.md +7 -8
- package/dist/cli/convoy/dag-analysis.d.ts +0 -39
- package/dist/cli/convoy/dag-analysis.d.ts.map +0 -1
- package/dist/cli/convoy/dag-analysis.js +0 -279
- package/dist/cli/convoy/dag-analysis.js.map +0 -1
- package/dist/cli/convoy/dag-analysis.test.d.ts +0 -2
- package/dist/cli/convoy/dag-analysis.test.d.ts.map +0 -1
- package/dist/cli/convoy/dag-analysis.test.js +0 -289
- package/dist/cli/convoy/dag-analysis.test.js.map +0 -1
- package/dist/cli/convoy/formula.d.ts +0 -19
- package/dist/cli/convoy/formula.d.ts.map +0 -1
- package/dist/cli/convoy/formula.js +0 -142
- package/dist/cli/convoy/formula.js.map +0 -1
- package/dist/cli/convoy/formula.test.d.ts +0 -2
- package/dist/cli/convoy/formula.test.d.ts.map +0 -1
- package/dist/cli/convoy/formula.test.js +0 -342
- package/dist/cli/convoy/formula.test.js.map +0 -1
- package/dist/cli/convoy/health.d.ts +0 -34
- package/dist/cli/convoy/health.d.ts.map +0 -1
- package/dist/cli/convoy/health.js +0 -123
- package/dist/cli/convoy/health.js.map +0 -1
- package/dist/cli/convoy/health.test.d.ts +0 -2
- package/dist/cli/convoy/health.test.d.ts.map +0 -1
- package/dist/cli/convoy/health.test.js +0 -448
- package/dist/cli/convoy/health.test.js.map +0 -1
- package/dist/cli/convoy/last-run.d.ts +0 -53
- package/dist/cli/convoy/last-run.d.ts.map +0 -1
- package/dist/cli/convoy/last-run.js +0 -54
- package/dist/cli/convoy/last-run.js.map +0 -1
- package/dist/cli/convoy/last-run.test.d.ts +0 -2
- package/dist/cli/convoy/last-run.test.d.ts.map +0 -1
- package/dist/cli/convoy/last-run.test.js +0 -110
- package/dist/cli/convoy/last-run.test.js.map +0 -1
- package/dist/cli/convoy/pipeline.d.ts +0 -41
- package/dist/cli/convoy/pipeline.d.ts.map +0 -1
- package/dist/cli/convoy/pipeline.js +0 -414
- package/dist/cli/convoy/pipeline.js.map +0 -1
- package/dist/cli/convoy/pipeline.test.d.ts +0 -2
- package/dist/cli/convoy/pipeline.test.d.ts.map +0 -1
- package/dist/cli/convoy/pipeline.test.js +0 -837
- package/dist/cli/convoy/pipeline.test.js.map +0 -1
- package/dist/cli/convoy/review-stages.d.ts +0 -9
- package/dist/cli/convoy/review-stages.d.ts.map +0 -1
- package/dist/cli/convoy/review-stages.js +0 -134
- package/dist/cli/convoy/review-stages.js.map +0 -1
- package/dist/cli/convoy/review-stages.test.d.ts +0 -2
- package/dist/cli/convoy/review-stages.test.d.ts.map +0 -1
- package/dist/cli/convoy/review-stages.test.js +0 -197
- package/dist/cli/convoy/review-stages.test.js.map +0 -1
- package/dist/cli/run/executor.d.ts +0 -15
- package/dist/cli/run/executor.d.ts.map +0 -1
- package/dist/cli/run/executor.js +0 -249
- package/dist/cli/run/executor.js.map +0 -1
- package/dist/cli/run/executor.test.d.ts +0 -2
- package/dist/cli/run/executor.test.d.ts.map +0 -1
- package/dist/cli/run/executor.test.js +0 -297
- package/dist/cli/run/executor.test.js.map +0 -1
- package/dist/cli/run/reporter.d.ts +0 -10
- package/dist/cli/run/reporter.d.ts.map +0 -1
- package/dist/cli/run/reporter.js +0 -142
- package/dist/cli/run/reporter.js.map +0 -1
- package/dist/cli/run-dry-run.test.d.ts +0 -2
- package/dist/cli/run-dry-run.test.d.ts.map +0 -1
- package/dist/cli/run-dry-run.test.js +0 -83
- package/dist/cli/run-dry-run.test.js.map +0 -1
- package/dist/cli/run-executor-flags.test.d.ts +0 -2
- package/dist/cli/run-executor-flags.test.d.ts.map +0 -1
- package/dist/cli/run-executor-flags.test.js +0 -31
- package/dist/cli/run-executor-flags.test.js.map +0 -1
- package/dist/cli/run-finish.test.d.ts +0 -2
- package/dist/cli/run-finish.test.d.ts.map +0 -1
- package/dist/cli/run-finish.test.js +0 -77
- package/dist/cli/run-finish.test.js.map +0 -1
- package/dist/cli/watch.d.ts +0 -15
- package/dist/cli/watch.d.ts.map +0 -1
- package/dist/cli/watch.js +0 -277
- package/dist/cli/watch.js.map +0 -1
- package/dist/dashboard/scripts/etl.d.ts +0 -10
- package/dist/dashboard/scripts/etl.d.ts.map +0 -1
- package/dist/dashboard/scripts/etl.js +0 -141
- package/dist/dashboard/scripts/etl.js.map +0 -1
- package/src/cli/convoy/dag-analysis.test.ts +0 -349
- package/src/cli/convoy/dag-analysis.ts +0 -367
- package/src/cli/convoy/formula.test.ts +0 -404
- package/src/cli/convoy/formula.ts +0 -174
- package/src/cli/convoy/health.test.ts +0 -519
- package/src/cli/convoy/health.ts +0 -189
- package/src/cli/convoy/last-run.test.ts +0 -130
- package/src/cli/convoy/last-run.ts +0 -87
- package/src/cli/convoy/pipeline.test.ts +0 -999
- package/src/cli/convoy/pipeline.ts +0 -492
- package/src/cli/convoy/review-stages.test.ts +0 -235
- package/src/cli/convoy/review-stages.ts +0 -166
- package/src/cli/run/executor.test.ts +0 -338
- package/src/cli/run/executor.ts +0 -292
- package/src/cli/run/reporter.ts +0 -160
- package/src/cli/run-dry-run.test.ts +0 -97
- package/src/cli/run-executor-flags.test.ts +0 -38
- package/src/cli/run-finish.test.ts +0 -91
- package/src/cli/watch.ts +0 -295
- package/src/dashboard/astro.config.mjs +0 -6
- package/src/dashboard/dist/_astro/index.CADNhRPS.css +0 -1
- package/src/dashboard/dist/data/.gitkeep +0 -0
- package/src/dashboard/dist/data/convoy-list.json +0 -1
- package/src/dashboard/dist/data/overall-stats.json +0 -29
- package/src/dashboard/dist/index.html +0 -1963
- package/src/dashboard/node_modules/.vite/deps/_metadata.json +0 -31
- package/src/dashboard/node_modules/.vite/deps/astro___aria-query.js +0 -6776
- package/src/dashboard/node_modules/.vite/deps/astro___aria-query.js.map +0 -7
- package/src/dashboard/node_modules/.vite/deps/astro___axobject-query.js +0 -3754
- package/src/dashboard/node_modules/.vite/deps/astro___axobject-query.js.map +0 -7
- package/src/dashboard/node_modules/.vite/deps/astro___cssesc.js +0 -99
- package/src/dashboard/node_modules/.vite/deps/astro___cssesc.js.map +0 -7
- package/src/dashboard/node_modules/.vite/deps/chunk-BUSYA2B4.js +0 -8
- package/src/dashboard/node_modules/.vite/deps/chunk-BUSYA2B4.js.map +0 -7
- package/src/dashboard/node_modules/.vite/deps/package.json +0 -3
- package/src/dashboard/package-lock.json +0 -6
- package/src/dashboard/public/data/.gitkeep +0 -0
- package/src/dashboard/public/data/convoy-list.json +0 -1
- package/src/dashboard/public/data/overall-stats.json +0 -29
- package/src/dashboard/public/icon-192.png +0 -0
- package/src/dashboard/scripts/etl.test.ts +0 -166
- package/src/dashboard/scripts/etl.ts +0 -170
- package/src/dashboard/scripts/generate-demo-db.test.ts +0 -30
- package/src/dashboard/scripts/generate-demo-db.ts +0 -529
- package/src/dashboard/scripts/integration-test.ts +0 -504
- package/src/dashboard/scripts/verify-demo-data.sh +0 -51
- package/src/dashboard/seed-data/delegations.ndjson +0 -35
- package/src/dashboard/seed-data/events.ndjson +0 -104
- package/src/dashboard/seed-data/panels.ndjson +0 -13
- package/src/dashboard/seed-data/reviews.ndjson +0 -6
- package/src/dashboard/seed-data/sessions.ndjson +0 -50
- package/src/dashboard/src/env.d.ts +0 -1
- package/src/dashboard/src/layouts/Layout.astro +0 -25
- package/src/dashboard/src/pages/index.astro +0 -2313
- package/src/dashboard/src/styles/dashboard.css +0 -2943
- package/src/dashboard/tsconfig.json +0 -6
- /package/src/{dashboard/dist → cli/dashboard}/icon-192.png +0 -0
|
@@ -1,837 +0,0 @@
|
|
|
1
|
-
import { mkdtempSync, rmSync } from 'node:fs';
|
|
2
|
-
import { tmpdir } from 'node:os';
|
|
3
|
-
import { join } from 'node:path';
|
|
4
|
-
import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest';
|
|
5
|
-
import { createPipelineOrchestrator } from './pipeline.js';
|
|
6
|
-
import { createConvoyStore } from './store.js';
|
|
7
|
-
// ── Suppress NDJSON log writes ────────────────────────────────────────────────
|
|
8
|
-
vi.mock('../log.js', () => ({
|
|
9
|
-
appendEvent: vi.fn().mockResolvedValue(undefined),
|
|
10
|
-
}));
|
|
11
|
-
// ── Mock fs/promises readFile ─────────────────────────────────────────────────
|
|
12
|
-
vi.mock('node:fs/promises', () => ({
|
|
13
|
-
readFile: vi.fn(),
|
|
14
|
-
}));
|
|
15
|
-
import { readFile } from 'node:fs/promises';
|
|
16
|
-
// ── Fixture helpers ───────────────────────────────────────────────────────────
|
|
17
|
-
function makeAdapter() {
|
|
18
|
-
return {
|
|
19
|
-
name: 'test-adapter',
|
|
20
|
-
isAvailable: vi.fn().mockResolvedValue(true),
|
|
21
|
-
execute: vi.fn().mockResolvedValue({
|
|
22
|
-
success: true,
|
|
23
|
-
output: 'ok',
|
|
24
|
-
exitCode: 0,
|
|
25
|
-
}),
|
|
26
|
-
kill: vi.fn(),
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
function makeTask(overrides = {}) {
|
|
30
|
-
return {
|
|
31
|
-
id: 'task-1',
|
|
32
|
-
prompt: 'Do something',
|
|
33
|
-
agent: 'developer',
|
|
34
|
-
timeout: '30s',
|
|
35
|
-
depends_on: [],
|
|
36
|
-
files: [],
|
|
37
|
-
description: '',
|
|
38
|
-
max_retries: 0,
|
|
39
|
-
...overrides,
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
function makePipelineSpec(overrides = {}) {
|
|
43
|
-
return {
|
|
44
|
-
name: 'Test Pipeline',
|
|
45
|
-
concurrency: 1,
|
|
46
|
-
on_failure: 'continue',
|
|
47
|
-
adapter: 'test',
|
|
48
|
-
branch: 'main',
|
|
49
|
-
version: 2,
|
|
50
|
-
depends_on_convoy: ['./convoy-a.yaml'],
|
|
51
|
-
...overrides,
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
/** Minimal convoy YAML — content doesn't matter since readFile is mocked. */
|
|
55
|
-
const CONVOY_YAML = 'name: convoy\nconcurrency: 1\non_failure: continue\nadapter: test\nbranch: main\ntasks:\n - id: task-1\n prompt: do thing\n agent: developer\n timeout: 30s\n';
|
|
56
|
-
function makeConvoyResult(overrides = {}, status = 'done') {
|
|
57
|
-
return {
|
|
58
|
-
convoyId: `convoy-${Date.now()}-${Math.random().toString(36).slice(2)}`,
|
|
59
|
-
status,
|
|
60
|
-
summary: { total: 1, done: 1, failed: 0, skipped: 0, timedOut: 0 },
|
|
61
|
-
duration: '100ms',
|
|
62
|
-
...overrides,
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* Create an engine factory where each successive call to engine.run() consumes
|
|
67
|
-
* the next result from `runResults`.
|
|
68
|
-
*/
|
|
69
|
-
function makeEngineFactory(runResults) {
|
|
70
|
-
let idx = 0;
|
|
71
|
-
return vi.fn((_opts) => {
|
|
72
|
-
const result = runResults[idx++] ?? makeConvoyResult();
|
|
73
|
-
return {
|
|
74
|
-
run: vi.fn().mockResolvedValue(result),
|
|
75
|
-
resume: vi.fn().mockResolvedValue(makeConvoyResult()),
|
|
76
|
-
retryFailed: vi.fn(),
|
|
77
|
-
injectTask: vi.fn(),
|
|
78
|
-
};
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
// ── Test lifecycle ────────────────────────────────────────────────────────────
|
|
82
|
-
let tmpDir;
|
|
83
|
-
let dbPath;
|
|
84
|
-
beforeEach(() => {
|
|
85
|
-
vi.mocked(readFile).mockResolvedValue(CONVOY_YAML);
|
|
86
|
-
tmpDir = mkdtempSync(join(tmpdir(), 'pipeline-test-'));
|
|
87
|
-
dbPath = join(tmpDir, 'convoy.db');
|
|
88
|
-
});
|
|
89
|
-
afterEach(() => {
|
|
90
|
-
vi.clearAllMocks();
|
|
91
|
-
rmSync(tmpDir, { recursive: true, force: true });
|
|
92
|
-
});
|
|
93
|
-
// ── 1. Single convoy pipeline ─────────────────────────────────────────────────
|
|
94
|
-
describe('single convoy pipeline', () => {
|
|
95
|
-
it('returns status done when the single convoy succeeds', async () => {
|
|
96
|
-
const factory = makeEngineFactory([makeConvoyResult()]);
|
|
97
|
-
const pipeline = createPipelineOrchestrator({
|
|
98
|
-
spec: makePipelineSpec({ depends_on_convoy: ['./a.yaml'] }),
|
|
99
|
-
specYaml: 'name: pipeline',
|
|
100
|
-
adapter: makeAdapter(),
|
|
101
|
-
dbPath,
|
|
102
|
-
_createConvoyEngine: factory,
|
|
103
|
-
_ensureBranch: async () => { },
|
|
104
|
-
});
|
|
105
|
-
const result = await pipeline.run();
|
|
106
|
-
expect(result.status).toBe('done');
|
|
107
|
-
expect(result.convoyResults).toHaveLength(1);
|
|
108
|
-
expect(result.summary.totalConvoys).toBe(1);
|
|
109
|
-
expect(result.summary.completed).toBe(1);
|
|
110
|
-
expect(result.summary.failed).toBe(0);
|
|
111
|
-
expect(result.summary.skipped).toBe(0);
|
|
112
|
-
expect(typeof result.pipelineId).toBe('string');
|
|
113
|
-
expect(typeof result.duration).toBe('string');
|
|
114
|
-
});
|
|
115
|
-
it('creates a pipeline record in SQLite with correct final state', async () => {
|
|
116
|
-
const factory = makeEngineFactory([makeConvoyResult()]);
|
|
117
|
-
const pipeline = createPipelineOrchestrator({
|
|
118
|
-
spec: makePipelineSpec({ depends_on_convoy: ['./a.yaml'] }),
|
|
119
|
-
specYaml: 'name: pipe',
|
|
120
|
-
adapter: makeAdapter(),
|
|
121
|
-
dbPath,
|
|
122
|
-
_createConvoyEngine: factory,
|
|
123
|
-
_ensureBranch: async () => { },
|
|
124
|
-
});
|
|
125
|
-
const result = await pipeline.run();
|
|
126
|
-
const store = createConvoyStore(dbPath);
|
|
127
|
-
const record = store.getPipeline(result.pipelineId);
|
|
128
|
-
store.close();
|
|
129
|
-
expect(record).toBeDefined();
|
|
130
|
-
expect(record.status).toBe('done');
|
|
131
|
-
expect(record.name).toBe('Test Pipeline');
|
|
132
|
-
expect(record.branch).toBe('main');
|
|
133
|
-
expect(record.finished_at).not.toBeNull();
|
|
134
|
-
});
|
|
135
|
-
});
|
|
136
|
-
// ── 2. Two-convoy pipeline ────────────────────────────────────────────────────
|
|
137
|
-
describe('two-convoy pipeline', () => {
|
|
138
|
-
it('runs both convoys sequentially and returns done', async () => {
|
|
139
|
-
const r1 = makeConvoyResult({ convoyId: 'convoy-1' });
|
|
140
|
-
const r2 = makeConvoyResult({ convoyId: 'convoy-2' });
|
|
141
|
-
const factory = makeEngineFactory([r1, r2]);
|
|
142
|
-
const result = await createPipelineOrchestrator({
|
|
143
|
-
spec: makePipelineSpec({ depends_on_convoy: ['./a.yaml', './b.yaml'] }),
|
|
144
|
-
specYaml: 'name: pipeline',
|
|
145
|
-
adapter: makeAdapter(),
|
|
146
|
-
dbPath,
|
|
147
|
-
_createConvoyEngine: factory,
|
|
148
|
-
_ensureBranch: async () => { },
|
|
149
|
-
}).run();
|
|
150
|
-
expect(result.status).toBe('done');
|
|
151
|
-
expect(result.convoyResults).toHaveLength(2);
|
|
152
|
-
expect(result.summary.completed).toBe(2);
|
|
153
|
-
expect(result.summary.failed).toBe(0);
|
|
154
|
-
expect(factory).toHaveBeenCalledTimes(2);
|
|
155
|
-
});
|
|
156
|
-
it('reads spec files in order', async () => {
|
|
157
|
-
const factory = makeEngineFactory([makeConvoyResult(), makeConvoyResult()]);
|
|
158
|
-
await createPipelineOrchestrator({
|
|
159
|
-
spec: makePipelineSpec({ depends_on_convoy: ['./first.yaml', './second.yaml'] }),
|
|
160
|
-
specYaml: 'name: pipeline',
|
|
161
|
-
adapter: makeAdapter(),
|
|
162
|
-
dbPath,
|
|
163
|
-
_createConvoyEngine: factory,
|
|
164
|
-
_ensureBranch: async () => { },
|
|
165
|
-
}).run();
|
|
166
|
-
expect(vi.mocked(readFile)).toHaveBeenNthCalledWith(1, expect.stringContaining('first.yaml'), 'utf8');
|
|
167
|
-
expect(vi.mocked(readFile)).toHaveBeenNthCalledWith(2, expect.stringContaining('second.yaml'), 'utf8');
|
|
168
|
-
});
|
|
169
|
-
});
|
|
170
|
-
// ── 3. on_failure: 'stop' ─────────────────────────────────────────────────────
|
|
171
|
-
describe('on_failure: stop', () => {
|
|
172
|
-
it('skips remaining convoys when second of three fails', async () => {
|
|
173
|
-
const r1 = makeConvoyResult({ convoyId: 'c1' }, 'done');
|
|
174
|
-
const r2 = makeConvoyResult({ convoyId: 'c2' }, 'failed');
|
|
175
|
-
const factory = makeEngineFactory([r1, r2]);
|
|
176
|
-
const result = await createPipelineOrchestrator({
|
|
177
|
-
spec: makePipelineSpec({
|
|
178
|
-
depends_on_convoy: ['./a.yaml', './b.yaml', './c.yaml'],
|
|
179
|
-
on_failure: 'stop',
|
|
180
|
-
}),
|
|
181
|
-
specYaml: 'name: pipeline',
|
|
182
|
-
adapter: makeAdapter(),
|
|
183
|
-
dbPath,
|
|
184
|
-
_createConvoyEngine: factory,
|
|
185
|
-
_ensureBranch: async () => { },
|
|
186
|
-
}).run();
|
|
187
|
-
expect(result.status).toBe('failed');
|
|
188
|
-
expect(result.summary.totalConvoys).toBe(3);
|
|
189
|
-
expect(result.summary.completed).toBe(1);
|
|
190
|
-
expect(result.summary.failed).toBe(1);
|
|
191
|
-
expect(result.summary.skipped).toBe(1);
|
|
192
|
-
// Engine only called twice (third skipped)
|
|
193
|
-
expect(factory).toHaveBeenCalledTimes(2);
|
|
194
|
-
});
|
|
195
|
-
it('halts immediately on gate-failed convoy', async () => {
|
|
196
|
-
const r1 = makeConvoyResult({ convoyId: 'c1' }, 'gate-failed');
|
|
197
|
-
const factory = makeEngineFactory([r1]);
|
|
198
|
-
const result = await createPipelineOrchestrator({
|
|
199
|
-
spec: makePipelineSpec({
|
|
200
|
-
depends_on_convoy: ['./a.yaml', './b.yaml'],
|
|
201
|
-
on_failure: 'stop',
|
|
202
|
-
}),
|
|
203
|
-
specYaml: 'name: pipeline',
|
|
204
|
-
adapter: makeAdapter(),
|
|
205
|
-
dbPath,
|
|
206
|
-
_createConvoyEngine: factory,
|
|
207
|
-
_ensureBranch: async () => { },
|
|
208
|
-
}).run();
|
|
209
|
-
expect(result.status).toBe('failed');
|
|
210
|
-
expect(result.summary.skipped).toBe(1);
|
|
211
|
-
expect(factory).toHaveBeenCalledTimes(1);
|
|
212
|
-
});
|
|
213
|
-
});
|
|
214
|
-
// ── 4. on_failure: 'continue' ────────────────────────────────────────────────
|
|
215
|
-
describe('on_failure: continue', () => {
|
|
216
|
-
it('runs all three convoys even when second fails', async () => {
|
|
217
|
-
const r1 = makeConvoyResult({ convoyId: 'c1' }, 'done');
|
|
218
|
-
const r2 = makeConvoyResult({ convoyId: 'c2' }, 'failed');
|
|
219
|
-
const r3 = makeConvoyResult({ convoyId: 'c3' }, 'done');
|
|
220
|
-
const factory = makeEngineFactory([r1, r2, r3]);
|
|
221
|
-
const result = await createPipelineOrchestrator({
|
|
222
|
-
spec: makePipelineSpec({
|
|
223
|
-
depends_on_convoy: ['./a.yaml', './b.yaml', './c.yaml'],
|
|
224
|
-
on_failure: 'continue',
|
|
225
|
-
}),
|
|
226
|
-
specYaml: 'name: pipeline',
|
|
227
|
-
adapter: makeAdapter(),
|
|
228
|
-
dbPath,
|
|
229
|
-
_createConvoyEngine: factory,
|
|
230
|
-
_ensureBranch: async () => { },
|
|
231
|
-
}).run();
|
|
232
|
-
expect(result.status).toBe('failed');
|
|
233
|
-
expect(result.summary.totalConvoys).toBe(3);
|
|
234
|
-
expect(result.summary.completed).toBe(2);
|
|
235
|
-
expect(result.summary.failed).toBe(1);
|
|
236
|
-
expect(result.summary.skipped).toBe(0);
|
|
237
|
-
expect(factory).toHaveBeenCalledTimes(3);
|
|
238
|
-
});
|
|
239
|
-
});
|
|
240
|
-
// ── 5. Hybrid pipeline ────────────────────────────────────────────────────────
|
|
241
|
-
describe('hybrid pipeline (chained + own tasks)', () => {
|
|
242
|
-
it('runs chained convoys then own tasks as a final convoy', async () => {
|
|
243
|
-
const r1 = makeConvoyResult({ convoyId: 'chained-1' });
|
|
244
|
-
const rHybrid = makeConvoyResult({ convoyId: 'hybrid-own' });
|
|
245
|
-
const factory = makeEngineFactory([r1, rHybrid]);
|
|
246
|
-
const result = await createPipelineOrchestrator({
|
|
247
|
-
spec: makePipelineSpec({
|
|
248
|
-
depends_on_convoy: ['./a.yaml'],
|
|
249
|
-
tasks: [makeTask()],
|
|
250
|
-
}),
|
|
251
|
-
specYaml: 'name: hybrid',
|
|
252
|
-
adapter: makeAdapter(),
|
|
253
|
-
dbPath,
|
|
254
|
-
_createConvoyEngine: factory,
|
|
255
|
-
_ensureBranch: async () => { },
|
|
256
|
-
}).run();
|
|
257
|
-
expect(result.status).toBe('done');
|
|
258
|
-
expect(result.convoyResults).toHaveLength(2);
|
|
259
|
-
expect(result.summary.totalConvoys).toBe(2);
|
|
260
|
-
expect(factory).toHaveBeenCalledTimes(2);
|
|
261
|
-
});
|
|
262
|
-
it('does NOT run own tasks when pipeline is halted by on_failure: stop', async () => {
|
|
263
|
-
const r1 = makeConvoyResult({ convoyId: 'c1' }, 'failed');
|
|
264
|
-
const factory = makeEngineFactory([r1]);
|
|
265
|
-
const result = await createPipelineOrchestrator({
|
|
266
|
-
spec: makePipelineSpec({
|
|
267
|
-
depends_on_convoy: ['./a.yaml'],
|
|
268
|
-
tasks: [makeTask()],
|
|
269
|
-
on_failure: 'stop',
|
|
270
|
-
}),
|
|
271
|
-
specYaml: 'name: hybrid',
|
|
272
|
-
adapter: makeAdapter(),
|
|
273
|
-
dbPath,
|
|
274
|
-
_createConvoyEngine: factory,
|
|
275
|
-
_ensureBranch: async () => { },
|
|
276
|
-
}).run();
|
|
277
|
-
expect(result.summary.totalConvoys).toBe(1);
|
|
278
|
-
expect(factory).toHaveBeenCalledTimes(1);
|
|
279
|
-
expect(result.status).toBe('failed');
|
|
280
|
-
});
|
|
281
|
-
});
|
|
282
|
-
// ── 6. Token aggregation ──────────────────────────────────────────────────────
|
|
283
|
-
describe('token aggregation', () => {
|
|
284
|
-
it('sums total_tokens across all convoy results', async () => {
|
|
285
|
-
const r1 = makeConvoyResult({ convoyId: 'c1', cost: { total_tokens: 100 } });
|
|
286
|
-
const r2 = makeConvoyResult({ convoyId: 'c2', cost: { total_tokens: 250 } });
|
|
287
|
-
const factory = makeEngineFactory([r1, r2]);
|
|
288
|
-
const result = await createPipelineOrchestrator({
|
|
289
|
-
spec: makePipelineSpec({ depends_on_convoy: ['./a.yaml', './b.yaml'] }),
|
|
290
|
-
specYaml: 'name: pipeline',
|
|
291
|
-
adapter: makeAdapter(),
|
|
292
|
-
dbPath,
|
|
293
|
-
_createConvoyEngine: factory,
|
|
294
|
-
_ensureBranch: async () => { },
|
|
295
|
-
}).run();
|
|
296
|
-
expect(result.cost?.total_tokens).toBe(350);
|
|
297
|
-
});
|
|
298
|
-
it('omits cost when no convoy has token data', async () => {
|
|
299
|
-
const factory = makeEngineFactory([makeConvoyResult()]); // no cost field
|
|
300
|
-
const result = await createPipelineOrchestrator({
|
|
301
|
-
spec: makePipelineSpec({ depends_on_convoy: ['./a.yaml'] }),
|
|
302
|
-
specYaml: 'name: pipeline',
|
|
303
|
-
adapter: makeAdapter(),
|
|
304
|
-
dbPath,
|
|
305
|
-
_createConvoyEngine: factory,
|
|
306
|
-
_ensureBranch: async () => { },
|
|
307
|
-
}).run();
|
|
308
|
-
expect(result.cost).toBeUndefined();
|
|
309
|
-
});
|
|
310
|
-
it('persists total_tokens in the pipeline SQLite record', async () => {
|
|
311
|
-
const factory = makeEngineFactory([
|
|
312
|
-
makeConvoyResult({ cost: { total_tokens: 42 } }),
|
|
313
|
-
]);
|
|
314
|
-
const result = await createPipelineOrchestrator({
|
|
315
|
-
spec: makePipelineSpec({ depends_on_convoy: ['./a.yaml'] }),
|
|
316
|
-
specYaml: 'name: pipeline',
|
|
317
|
-
adapter: makeAdapter(),
|
|
318
|
-
dbPath,
|
|
319
|
-
_createConvoyEngine: factory,
|
|
320
|
-
_ensureBranch: async () => { },
|
|
321
|
-
}).run();
|
|
322
|
-
const store = createConvoyStore(dbPath);
|
|
323
|
-
const record = store.getPipeline(result.pipelineId);
|
|
324
|
-
store.close();
|
|
325
|
-
expect(record.total_tokens).toBe(42);
|
|
326
|
-
});
|
|
327
|
-
});
|
|
328
|
-
// ── 7. Shared branch ──────────────────────────────────────────────────────────
|
|
329
|
-
describe('shared branch', () => {
|
|
330
|
-
it('passes the pipeline branch to all convoy engines', async () => {
|
|
331
|
-
const factory = makeEngineFactory([makeConvoyResult(), makeConvoyResult()]);
|
|
332
|
-
await createPipelineOrchestrator({
|
|
333
|
-
spec: makePipelineSpec({
|
|
334
|
-
branch: 'feature/pipeline-test',
|
|
335
|
-
depends_on_convoy: ['./a.yaml', './b.yaml'],
|
|
336
|
-
}),
|
|
337
|
-
specYaml: 'name: pipeline',
|
|
338
|
-
adapter: makeAdapter(),
|
|
339
|
-
dbPath,
|
|
340
|
-
_createConvoyEngine: factory,
|
|
341
|
-
_ensureBranch: async () => { },
|
|
342
|
-
}).run();
|
|
343
|
-
const calls = factory.mock.calls;
|
|
344
|
-
expect(calls[0][0].spec.branch).toBe('feature/pipeline-test');
|
|
345
|
-
expect(calls[1][0].spec.branch).toBe('feature/pipeline-test');
|
|
346
|
-
});
|
|
347
|
-
});
|
|
348
|
-
// ── 8. Pipeline convoy linking ────────────────────────────────────────────────
|
|
349
|
-
describe('pipeline convoy linking', () => {
|
|
350
|
-
it('passes pipelineId to each convoy engine', async () => {
|
|
351
|
-
const factory = makeEngineFactory([makeConvoyResult(), makeConvoyResult()]);
|
|
352
|
-
const result = await createPipelineOrchestrator({
|
|
353
|
-
spec: makePipelineSpec({ depends_on_convoy: ['./a.yaml', './b.yaml'] }),
|
|
354
|
-
specYaml: 'name: pipeline',
|
|
355
|
-
adapter: makeAdapter(),
|
|
356
|
-
dbPath,
|
|
357
|
-
_createConvoyEngine: factory,
|
|
358
|
-
_ensureBranch: async () => { },
|
|
359
|
-
}).run();
|
|
360
|
-
const calls = factory.mock.calls;
|
|
361
|
-
expect(calls[0][0].pipelineId).toBe(result.pipelineId);
|
|
362
|
-
expect(calls[1][0].pipelineId).toBe(result.pipelineId);
|
|
363
|
-
});
|
|
364
|
-
});
|
|
365
|
-
// ── 9. Pipeline record persistence transitions ────────────────────────────────
|
|
366
|
-
describe('pipeline record persistence', () => {
|
|
367
|
-
it('transitions: pending → running → done', async () => {
|
|
368
|
-
let statusDuringRun;
|
|
369
|
-
const factory = vi.fn((_opts) => ({
|
|
370
|
-
run: vi.fn().mockImplementation(async () => {
|
|
371
|
-
const s = createConvoyStore(dbPath);
|
|
372
|
-
statusDuringRun = s.getPipeline(_opts.pipelineId)?.status;
|
|
373
|
-
s.close();
|
|
374
|
-
return makeConvoyResult();
|
|
375
|
-
}),
|
|
376
|
-
resume: vi.fn(),
|
|
377
|
-
retryFailed: vi.fn(),
|
|
378
|
-
injectTask: vi.fn(),
|
|
379
|
-
}));
|
|
380
|
-
const result = await createPipelineOrchestrator({
|
|
381
|
-
spec: makePipelineSpec({ depends_on_convoy: ['./a.yaml'] }),
|
|
382
|
-
specYaml: 'name: pipeline',
|
|
383
|
-
adapter: makeAdapter(),
|
|
384
|
-
dbPath,
|
|
385
|
-
_createConvoyEngine: factory,
|
|
386
|
-
_ensureBranch: async () => { },
|
|
387
|
-
}).run();
|
|
388
|
-
expect(statusDuringRun).toBe('running');
|
|
389
|
-
const store = createConvoyStore(dbPath);
|
|
390
|
-
const record = store.getPipeline(result.pipelineId);
|
|
391
|
-
store.close();
|
|
392
|
-
expect(record.status).toBe('done');
|
|
393
|
-
expect(record.started_at).not.toBeNull();
|
|
394
|
-
expect(record.finished_at).not.toBeNull();
|
|
395
|
-
});
|
|
396
|
-
it('marks pipeline as failed when a convoy fails', async () => {
|
|
397
|
-
const factory = makeEngineFactory([makeConvoyResult({}, 'failed')]);
|
|
398
|
-
const result = await createPipelineOrchestrator({
|
|
399
|
-
spec: makePipelineSpec({ depends_on_convoy: ['./a.yaml'] }),
|
|
400
|
-
specYaml: 'name: pipeline',
|
|
401
|
-
adapter: makeAdapter(),
|
|
402
|
-
dbPath,
|
|
403
|
-
_createConvoyEngine: factory,
|
|
404
|
-
_ensureBranch: async () => { },
|
|
405
|
-
}).run();
|
|
406
|
-
const store = createConvoyStore(dbPath);
|
|
407
|
-
const record = store.getPipeline(result.pipelineId);
|
|
408
|
-
store.close();
|
|
409
|
-
expect(record.status).toBe('failed');
|
|
410
|
-
});
|
|
411
|
-
});
|
|
412
|
-
// ── 10. Pipeline resume ───────────────────────────────────────────────────────
|
|
413
|
-
describe('pipeline resume', () => {
|
|
414
|
-
it('continues from the first non-completed convoy', async () => {
|
|
415
|
-
const pipelineId = 'pipeline-resume-continue-test';
|
|
416
|
-
const doneConvoyId = 'convoy-1-done';
|
|
417
|
-
// Pre-seed the pipeline and a completed convoy directly in the store
|
|
418
|
-
const store = createConvoyStore(dbPath);
|
|
419
|
-
store.insertPipeline({
|
|
420
|
-
id: pipelineId,
|
|
421
|
-
name: 'Test Pipeline',
|
|
422
|
-
status: 'running',
|
|
423
|
-
branch: 'main',
|
|
424
|
-
spec_yaml: 'name: pipeline',
|
|
425
|
-
convoy_specs: JSON.stringify(['./a.yaml', './b.yaml']),
|
|
426
|
-
created_at: new Date(Date.now() - 5000).toISOString(),
|
|
427
|
-
});
|
|
428
|
-
store.insertConvoy({
|
|
429
|
-
id: doneConvoyId,
|
|
430
|
-
name: 'Convoy A',
|
|
431
|
-
spec_hash: 'abc',
|
|
432
|
-
status: 'done',
|
|
433
|
-
branch: 'main',
|
|
434
|
-
created_at: new Date(Date.now() - 4000).toISOString(),
|
|
435
|
-
spec_yaml: CONVOY_YAML,
|
|
436
|
-
pipeline_id: pipelineId,
|
|
437
|
-
});
|
|
438
|
-
store.close();
|
|
439
|
-
// Resume: second convoy is fresh, factory called once for ./b.yaml
|
|
440
|
-
const secondResult = makeConvoyResult({ convoyId: 'convoy-2-fresh' }, 'done');
|
|
441
|
-
const resumeFactory = makeEngineFactory([secondResult]);
|
|
442
|
-
const pipelineSpec = makePipelineSpec({ depends_on_convoy: ['./a.yaml', './b.yaml'] });
|
|
443
|
-
const resumeResult = await createPipelineOrchestrator({
|
|
444
|
-
spec: pipelineSpec,
|
|
445
|
-
specYaml: 'name: pipeline',
|
|
446
|
-
adapter: makeAdapter(),
|
|
447
|
-
dbPath,
|
|
448
|
-
_createConvoyEngine: resumeFactory,
|
|
449
|
-
_ensureBranch: async () => { },
|
|
450
|
-
}).resume(pipelineId);
|
|
451
|
-
expect(resumeResult.convoyResults).toHaveLength(2);
|
|
452
|
-
expect(resumeResult.convoyResults[0].convoyId).toBe(doneConvoyId);
|
|
453
|
-
expect(resumeResult.convoyResults[1].convoyId).toBe('convoy-2-fresh');
|
|
454
|
-
// Only second convoy ran on resume
|
|
455
|
-
expect(resumeFactory).toHaveBeenCalledTimes(1);
|
|
456
|
-
});
|
|
457
|
-
it('reconstructs token cost from done convoys during resume', async () => {
|
|
458
|
-
const pipelineId = 'pipeline-resume-tokens';
|
|
459
|
-
const doneConvoyId = 'convoy-done-with-tokens';
|
|
460
|
-
const store = createConvoyStore(dbPath);
|
|
461
|
-
store.insertPipeline({
|
|
462
|
-
id: pipelineId,
|
|
463
|
-
name: 'Token Pipeline',
|
|
464
|
-
status: 'running',
|
|
465
|
-
branch: 'main',
|
|
466
|
-
spec_yaml: 'name: pipeline',
|
|
467
|
-
convoy_specs: JSON.stringify(['./a.yaml']),
|
|
468
|
-
created_at: new Date().toISOString(),
|
|
469
|
-
});
|
|
470
|
-
store.insertConvoy({
|
|
471
|
-
id: doneConvoyId,
|
|
472
|
-
name: 'Done Convoy',
|
|
473
|
-
spec_hash: 'abc',
|
|
474
|
-
status: 'done',
|
|
475
|
-
branch: 'main',
|
|
476
|
-
created_at: new Date().toISOString(),
|
|
477
|
-
spec_yaml: CONVOY_YAML,
|
|
478
|
-
pipeline_id: pipelineId,
|
|
479
|
-
});
|
|
480
|
-
store.updateConvoyStatus(doneConvoyId, 'done', { total_tokens: 77 });
|
|
481
|
-
store.close();
|
|
482
|
-
const resumeFactory = makeEngineFactory([]);
|
|
483
|
-
const result = await createPipelineOrchestrator({
|
|
484
|
-
spec: makePipelineSpec({ depends_on_convoy: ['./a.yaml'] }),
|
|
485
|
-
specYaml: 'name: pipeline',
|
|
486
|
-
adapter: makeAdapter(),
|
|
487
|
-
dbPath,
|
|
488
|
-
_createConvoyEngine: resumeFactory,
|
|
489
|
-
_ensureBranch: async () => { },
|
|
490
|
-
}).resume(pipelineId);
|
|
491
|
-
expect(result.cost?.total_tokens).toBe(77);
|
|
492
|
-
expect(result.convoyResults[0].cost).toEqual({ total_tokens: 77 });
|
|
493
|
-
expect(resumeFactory).not.toHaveBeenCalled();
|
|
494
|
-
});
|
|
495
|
-
it('halts remaining convoys during resume when on_failure: stop', async () => {
|
|
496
|
-
const pipelineId = 'pipeline-resume-halt';
|
|
497
|
-
const store = createConvoyStore(dbPath);
|
|
498
|
-
store.insertPipeline({
|
|
499
|
-
id: pipelineId,
|
|
500
|
-
name: 'Halt Pipeline',
|
|
501
|
-
status: 'running',
|
|
502
|
-
branch: 'main',
|
|
503
|
-
spec_yaml: 'name: pipeline',
|
|
504
|
-
convoy_specs: JSON.stringify(['./a.yaml', './b.yaml', './c.yaml']),
|
|
505
|
-
created_at: new Date().toISOString(),
|
|
506
|
-
});
|
|
507
|
-
store.close();
|
|
508
|
-
// First call fails, second should be skipped
|
|
509
|
-
const failResult = makeConvoyResult({ convoyId: 'c1' }, 'failed');
|
|
510
|
-
const resumeFactory = makeEngineFactory([failResult]);
|
|
511
|
-
const result = await createPipelineOrchestrator({
|
|
512
|
-
spec: makePipelineSpec({
|
|
513
|
-
depends_on_convoy: ['./a.yaml', './b.yaml', './c.yaml'],
|
|
514
|
-
on_failure: 'stop',
|
|
515
|
-
}),
|
|
516
|
-
specYaml: 'name: pipeline',
|
|
517
|
-
adapter: makeAdapter(),
|
|
518
|
-
dbPath,
|
|
519
|
-
_createConvoyEngine: resumeFactory,
|
|
520
|
-
_ensureBranch: async () => { },
|
|
521
|
-
}).resume(pipelineId);
|
|
522
|
-
expect(result.status).toBe('failed');
|
|
523
|
-
expect(result.summary.skipped).toBe(2);
|
|
524
|
-
expect(resumeFactory).toHaveBeenCalledTimes(1);
|
|
525
|
-
});
|
|
526
|
-
it('throws when pipelineId does not exist in store', async () => {
|
|
527
|
-
const pipeline = createPipelineOrchestrator({
|
|
528
|
-
spec: makePipelineSpec(),
|
|
529
|
-
specYaml: 'name: pipeline',
|
|
530
|
-
adapter: makeAdapter(),
|
|
531
|
-
dbPath,
|
|
532
|
-
_createConvoyEngine: makeEngineFactory([]),
|
|
533
|
-
_ensureBranch: async () => { },
|
|
534
|
-
});
|
|
535
|
-
await expect(pipeline.resume('nonexistent-id')).rejects.toThrow('Pipeline "nonexistent-id" not found in store');
|
|
536
|
-
});
|
|
537
|
-
it('resumes a running convoy via engine.resume()', async () => {
|
|
538
|
-
const pipelineId = 'pipeline-resume-test';
|
|
539
|
-
const runningConvoyId = 'convoy-running-123';
|
|
540
|
-
const store = createConvoyStore(dbPath);
|
|
541
|
-
store.insertPipeline({
|
|
542
|
-
id: pipelineId,
|
|
543
|
-
name: 'Resume Test',
|
|
544
|
-
status: 'running',
|
|
545
|
-
branch: 'main',
|
|
546
|
-
spec_yaml: 'name: resume',
|
|
547
|
-
convoy_specs: JSON.stringify(['./a.yaml']),
|
|
548
|
-
created_at: new Date(Date.now() - 1000).toISOString(),
|
|
549
|
-
});
|
|
550
|
-
store.insertConvoy({
|
|
551
|
-
id: runningConvoyId,
|
|
552
|
-
name: 'Convoy A',
|
|
553
|
-
spec_hash: 'abc123',
|
|
554
|
-
status: 'running',
|
|
555
|
-
branch: 'main',
|
|
556
|
-
created_at: new Date().toISOString(),
|
|
557
|
-
spec_yaml: CONVOY_YAML,
|
|
558
|
-
pipeline_id: pipelineId,
|
|
559
|
-
});
|
|
560
|
-
store.close();
|
|
561
|
-
const resumedResult = makeConvoyResult({ convoyId: runningConvoyId }, 'done');
|
|
562
|
-
const mockEngine = {
|
|
563
|
-
run: vi.fn().mockResolvedValue(makeConvoyResult()),
|
|
564
|
-
resume: vi.fn().mockResolvedValue(resumedResult),
|
|
565
|
-
retryFailed: vi.fn(),
|
|
566
|
-
injectTask: vi.fn(),
|
|
567
|
-
};
|
|
568
|
-
const factory = vi.fn().mockReturnValue(mockEngine);
|
|
569
|
-
const result = await createPipelineOrchestrator({
|
|
570
|
-
spec: makePipelineSpec({ depends_on_convoy: ['./a.yaml'] }),
|
|
571
|
-
specYaml: 'name: pipeline',
|
|
572
|
-
adapter: makeAdapter(),
|
|
573
|
-
dbPath,
|
|
574
|
-
_createConvoyEngine: factory,
|
|
575
|
-
_ensureBranch: async () => { },
|
|
576
|
-
}).resume(pipelineId);
|
|
577
|
-
expect(mockEngine.resume).toHaveBeenCalledWith(runningConvoyId);
|
|
578
|
-
expect(mockEngine.run).not.toHaveBeenCalled();
|
|
579
|
-
expect(result.convoyResults[0].convoyId).toBe(runningConvoyId);
|
|
580
|
-
});
|
|
581
|
-
it('resumes a failed convoy via retryFailed + resume instead of running fresh', async () => {
|
|
582
|
-
const pipelineId = 'pipeline-resume-failed-convoy';
|
|
583
|
-
const failedConvoyId = 'convoy-failed-456';
|
|
584
|
-
const store = createConvoyStore(dbPath);
|
|
585
|
-
store.insertPipeline({
|
|
586
|
-
id: pipelineId,
|
|
587
|
-
name: 'Failed Resume Test',
|
|
588
|
-
status: 'running',
|
|
589
|
-
branch: 'main',
|
|
590
|
-
spec_yaml: 'name: resume-failed',
|
|
591
|
-
convoy_specs: JSON.stringify(['./a.yaml']),
|
|
592
|
-
created_at: new Date(Date.now() - 1000).toISOString(),
|
|
593
|
-
});
|
|
594
|
-
store.insertConvoy({
|
|
595
|
-
id: failedConvoyId,
|
|
596
|
-
name: 'Convoy A',
|
|
597
|
-
spec_hash: 'abc123',
|
|
598
|
-
status: 'failed',
|
|
599
|
-
branch: 'main',
|
|
600
|
-
created_at: new Date().toISOString(),
|
|
601
|
-
spec_yaml: CONVOY_YAML,
|
|
602
|
-
pipeline_id: pipelineId,
|
|
603
|
-
});
|
|
604
|
-
store.close();
|
|
605
|
-
const resumedResult = makeConvoyResult({ convoyId: failedConvoyId }, 'done');
|
|
606
|
-
const mockEngine = {
|
|
607
|
-
run: vi.fn().mockResolvedValue(makeConvoyResult()),
|
|
608
|
-
resume: vi.fn().mockResolvedValue(resumedResult),
|
|
609
|
-
retryFailed: vi.fn(),
|
|
610
|
-
injectTask: vi.fn(),
|
|
611
|
-
};
|
|
612
|
-
const factory = vi.fn().mockReturnValue(mockEngine);
|
|
613
|
-
const result = await createPipelineOrchestrator({
|
|
614
|
-
spec: makePipelineSpec({ depends_on_convoy: ['./a.yaml'] }),
|
|
615
|
-
specYaml: 'name: pipeline',
|
|
616
|
-
adapter: makeAdapter(),
|
|
617
|
-
dbPath,
|
|
618
|
-
_createConvoyEngine: factory,
|
|
619
|
-
_ensureBranch: async () => { },
|
|
620
|
-
}).resume(pipelineId);
|
|
621
|
-
expect(mockEngine.retryFailed).toHaveBeenCalledWith(failedConvoyId);
|
|
622
|
-
expect(mockEngine.resume).toHaveBeenCalledWith(failedConvoyId);
|
|
623
|
-
expect(mockEngine.run).not.toHaveBeenCalled();
|
|
624
|
-
expect(result.convoyResults[0].convoyId).toBe(failedConvoyId);
|
|
625
|
-
});
|
|
626
|
-
});
|
|
627
|
-
// ── 12. getCurrentBranch fallback ─────────────────────────────────────────────
|
|
628
|
-
describe('getCurrentBranch fallback', () => {
|
|
629
|
-
it('run() uses getCurrentBranch when spec has no branch (falls back to main)', async () => {
|
|
630
|
-
const factory = makeEngineFactory([makeConvoyResult()]);
|
|
631
|
-
// No branch on spec — forces getCurrentBranch call (git fails in tmpDir, returns 'main')
|
|
632
|
-
const specNoBranch = {
|
|
633
|
-
name: 'No Branch Pipeline',
|
|
634
|
-
concurrency: 1,
|
|
635
|
-
on_failure: 'continue',
|
|
636
|
-
adapter: 'test',
|
|
637
|
-
version: 2,
|
|
638
|
-
depends_on_convoy: ['./a.yaml'],
|
|
639
|
-
};
|
|
640
|
-
const result = await createPipelineOrchestrator({
|
|
641
|
-
spec: specNoBranch,
|
|
642
|
-
specYaml: 'name: pipeline',
|
|
643
|
-
adapter: makeAdapter(),
|
|
644
|
-
basePath: tmpDir, // not a git repo → getCurrentBranch returns 'main'
|
|
645
|
-
dbPath,
|
|
646
|
-
_createConvoyEngine: factory,
|
|
647
|
-
_ensureBranch: async () => { },
|
|
648
|
-
}).run();
|
|
649
|
-
expect(result.status).toBe('done');
|
|
650
|
-
// branch should be whatever getCurrentBranch returns (likely 'main' or 'HEAD')
|
|
651
|
-
const store = createConvoyStore(dbPath);
|
|
652
|
-
const record = store.getPipeline(result.pipelineId);
|
|
653
|
-
store.close();
|
|
654
|
-
expect(typeof record.branch).toBe('string');
|
|
655
|
-
});
|
|
656
|
-
it('resume() uses getCurrentBranch when pipeline branch is null and spec has no branch', async () => {
|
|
657
|
-
const pipelineId = 'pipeline-no-branch';
|
|
658
|
-
const store = createConvoyStore(dbPath);
|
|
659
|
-
store.insertPipeline({
|
|
660
|
-
id: pipelineId,
|
|
661
|
-
name: 'No Branch Resume',
|
|
662
|
-
status: 'running',
|
|
663
|
-
branch: null,
|
|
664
|
-
spec_yaml: 'name: pipeline',
|
|
665
|
-
convoy_specs: JSON.stringify(['./a.yaml']),
|
|
666
|
-
created_at: new Date().toISOString(),
|
|
667
|
-
});
|
|
668
|
-
store.close();
|
|
669
|
-
const resumeFactory = makeEngineFactory([makeConvoyResult()]);
|
|
670
|
-
const specNoBranch = {
|
|
671
|
-
name: 'No Branch Pipeline',
|
|
672
|
-
concurrency: 1,
|
|
673
|
-
on_failure: 'continue',
|
|
674
|
-
adapter: 'test',
|
|
675
|
-
version: 2,
|
|
676
|
-
depends_on_convoy: ['./a.yaml'],
|
|
677
|
-
};
|
|
678
|
-
const result = await createPipelineOrchestrator({
|
|
679
|
-
spec: specNoBranch,
|
|
680
|
-
specYaml: 'name: pipeline',
|
|
681
|
-
adapter: makeAdapter(),
|
|
682
|
-
basePath: tmpDir,
|
|
683
|
-
dbPath,
|
|
684
|
-
_createConvoyEngine: resumeFactory,
|
|
685
|
-
_ensureBranch: async () => { },
|
|
686
|
-
}).resume(pipelineId);
|
|
687
|
-
expect(result.status).toBe('done');
|
|
688
|
-
});
|
|
689
|
-
});
|
|
690
|
-
// ── 13. Path traversal protection ────────────────────────────────────────────
|
|
691
|
-
describe('path traversal protection', () => {
|
|
692
|
-
it('rejects absolute path in depends_on_convoy', async () => {
|
|
693
|
-
const factory = makeEngineFactory([]);
|
|
694
|
-
const result = await createPipelineOrchestrator({
|
|
695
|
-
spec: makePipelineSpec({ depends_on_convoy: ['/etc/passwd'] }),
|
|
696
|
-
specYaml: 'name: pipeline',
|
|
697
|
-
adapter: makeAdapter(),
|
|
698
|
-
dbPath,
|
|
699
|
-
_createConvoyEngine: factory,
|
|
700
|
-
_ensureBranch: async () => { },
|
|
701
|
-
}).run();
|
|
702
|
-
expect(result.status).toBe('failed');
|
|
703
|
-
expect(result.summary.failed).toBe(1);
|
|
704
|
-
expect(result.convoyResults[0].status).toBe('failed');
|
|
705
|
-
// Engine should never be called — error happens before spec is loaded
|
|
706
|
-
expect(factory).not.toHaveBeenCalled();
|
|
707
|
-
// Pipeline record must be finalized (not stuck in 'running')
|
|
708
|
-
const store = createConvoyStore(dbPath);
|
|
709
|
-
const record = store.getPipeline(result.pipelineId);
|
|
710
|
-
store.close();
|
|
711
|
-
expect(record.status).toBe('failed');
|
|
712
|
-
expect(record.finished_at).not.toBeNull();
|
|
713
|
-
});
|
|
714
|
-
it('rejects path traversal via .. in depends_on_convoy', async () => {
|
|
715
|
-
const factory = makeEngineFactory([]);
|
|
716
|
-
const result = await createPipelineOrchestrator({
|
|
717
|
-
spec: makePipelineSpec({ depends_on_convoy: ['../../etc/passwd'] }),
|
|
718
|
-
specYaml: 'name: pipeline',
|
|
719
|
-
adapter: makeAdapter(),
|
|
720
|
-
dbPath,
|
|
721
|
-
_createConvoyEngine: factory,
|
|
722
|
-
_ensureBranch: async () => { },
|
|
723
|
-
}).run();
|
|
724
|
-
expect(result.status).toBe('failed');
|
|
725
|
-
expect(result.summary.failed).toBe(1);
|
|
726
|
-
expect(result.convoyResults[0].status).toBe('failed');
|
|
727
|
-
expect(factory).not.toHaveBeenCalled();
|
|
728
|
-
// Pipeline record must be finalized
|
|
729
|
-
const store = createConvoyStore(dbPath);
|
|
730
|
-
const record = store.getPipeline(result.pipelineId);
|
|
731
|
-
store.close();
|
|
732
|
-
expect(record.status).toBe('failed');
|
|
733
|
-
expect(record.finished_at).not.toBeNull();
|
|
734
|
-
});
|
|
735
|
-
it('allows valid relative path like ./sub/convoy.yaml', async () => {
|
|
736
|
-
// readFile default mock returns CONVOY_YAML for any path
|
|
737
|
-
const factory = makeEngineFactory([makeConvoyResult()]);
|
|
738
|
-
const result = await createPipelineOrchestrator({
|
|
739
|
-
spec: makePipelineSpec({ depends_on_convoy: ['./sub/convoy.yaml'] }),
|
|
740
|
-
specYaml: 'name: pipeline',
|
|
741
|
-
adapter: makeAdapter(),
|
|
742
|
-
dbPath,
|
|
743
|
-
_createConvoyEngine: factory,
|
|
744
|
-
_ensureBranch: async () => { },
|
|
745
|
-
}).run();
|
|
746
|
-
expect(result.status).toBe('done');
|
|
747
|
-
expect(factory).toHaveBeenCalledTimes(1);
|
|
748
|
-
});
|
|
749
|
-
});
|
|
750
|
-
// ── 14. Missing convoy spec file ──────────────────────────────────────────────
|
|
751
|
-
describe('missing convoy spec file', () => {
|
|
752
|
-
it('handles readFile ENOENT without crashing pipeline (on_failure: continue)', async () => {
|
|
753
|
-
const enoentError = Object.assign(new Error('ENOENT: no such file or directory'), {
|
|
754
|
-
code: 'ENOENT',
|
|
755
|
-
});
|
|
756
|
-
// First call (./missing.yaml) rejects; second (./exists.yaml) falls back to default CONVOY_YAML
|
|
757
|
-
vi.mocked(readFile).mockRejectedValueOnce(enoentError);
|
|
758
|
-
const factory = makeEngineFactory([makeConvoyResult({ convoyId: 'exists-convoy' })]);
|
|
759
|
-
const result = await createPipelineOrchestrator({
|
|
760
|
-
spec: makePipelineSpec({
|
|
761
|
-
depends_on_convoy: ['./missing.yaml', './exists.yaml'],
|
|
762
|
-
on_failure: 'continue',
|
|
763
|
-
}),
|
|
764
|
-
specYaml: 'name: pipeline',
|
|
765
|
-
adapter: makeAdapter(),
|
|
766
|
-
dbPath,
|
|
767
|
-
_createConvoyEngine: factory,
|
|
768
|
-
_ensureBranch: async () => { },
|
|
769
|
-
}).run();
|
|
770
|
-
expect(result.status).toBe('failed');
|
|
771
|
-
expect(result.summary.failed).toBeGreaterThanOrEqual(1);
|
|
772
|
-
expect(result.summary.completed).toBeGreaterThanOrEqual(1);
|
|
773
|
-
// Engine only called once — for the second spec (first failed before engine)
|
|
774
|
-
expect(factory).toHaveBeenCalledTimes(1);
|
|
775
|
-
// Pipeline record finalized (not stuck in 'running')
|
|
776
|
-
const store = createConvoyStore(dbPath);
|
|
777
|
-
const record = store.getPipeline(result.pipelineId);
|
|
778
|
-
store.close();
|
|
779
|
-
expect(record.status).toBe('failed');
|
|
780
|
-
expect(record.finished_at).not.toBeNull();
|
|
781
|
-
});
|
|
782
|
-
it('stops pipeline on missing file when on_failure: stop', async () => {
|
|
783
|
-
const enoentError = Object.assign(new Error('ENOENT: no such file or directory'), {
|
|
784
|
-
code: 'ENOENT',
|
|
785
|
-
});
|
|
786
|
-
vi.mocked(readFile).mockRejectedValueOnce(enoentError);
|
|
787
|
-
const factory = makeEngineFactory([makeConvoyResult()]);
|
|
788
|
-
const result = await createPipelineOrchestrator({
|
|
789
|
-
spec: makePipelineSpec({
|
|
790
|
-
depends_on_convoy: ['./missing.yaml', './exists.yaml'],
|
|
791
|
-
on_failure: 'stop',
|
|
792
|
-
}),
|
|
793
|
-
specYaml: 'name: pipeline',
|
|
794
|
-
adapter: makeAdapter(),
|
|
795
|
-
dbPath,
|
|
796
|
-
_createConvoyEngine: factory,
|
|
797
|
-
_ensureBranch: async () => { },
|
|
798
|
-
}).run();
|
|
799
|
-
expect(result.status).toBe('failed');
|
|
800
|
-
expect(result.summary.skipped).toBeGreaterThanOrEqual(1);
|
|
801
|
-
// Second spec skipped — factory never called
|
|
802
|
-
expect(factory).not.toHaveBeenCalled();
|
|
803
|
-
// Pipeline record finalized as failed
|
|
804
|
-
const store = createConvoyStore(dbPath);
|
|
805
|
-
const record = store.getPipeline(result.pipelineId);
|
|
806
|
-
store.close();
|
|
807
|
-
expect(record.status).toBe('failed');
|
|
808
|
-
expect(record.finished_at).not.toBeNull();
|
|
809
|
-
});
|
|
810
|
-
});
|
|
811
|
-
// ── 15. Invalid convoy YAML ───────────────────────────────────────────────────
|
|
812
|
-
describe('invalid convoy YAML', () => {
|
|
813
|
-
it('handles parse error without crashing pipeline', async () => {
|
|
814
|
-
// Return syntactically broken YAML (unclosed bracket triggers YAMLException)
|
|
815
|
-
vi.mocked(readFile).mockResolvedValueOnce('name: [unclosed bracket');
|
|
816
|
-
const factory = makeEngineFactory([]);
|
|
817
|
-
const result = await createPipelineOrchestrator({
|
|
818
|
-
spec: makePipelineSpec({ depends_on_convoy: ['./bad.yaml'] }),
|
|
819
|
-
specYaml: 'name: pipeline',
|
|
820
|
-
adapter: makeAdapter(),
|
|
821
|
-
dbPath,
|
|
822
|
-
_createConvoyEngine: factory,
|
|
823
|
-
_ensureBranch: async () => { },
|
|
824
|
-
}).run();
|
|
825
|
-
expect(result.status).toBe('failed');
|
|
826
|
-
expect(result.summary.failed).toBeGreaterThanOrEqual(1);
|
|
827
|
-
// Engine never called — parse error happens before engine creation
|
|
828
|
-
expect(factory).not.toHaveBeenCalled();
|
|
829
|
-
// Pipeline record finalized (not stuck in 'running')
|
|
830
|
-
const store = createConvoyStore(dbPath);
|
|
831
|
-
const record = store.getPipeline(result.pipelineId);
|
|
832
|
-
store.close();
|
|
833
|
-
expect(record.status).toBe('failed');
|
|
834
|
-
expect(record.finished_at).not.toBeNull();
|
|
835
|
-
});
|
|
836
|
-
});
|
|
837
|
-
//# sourceMappingURL=pipeline.test.js.map
|