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,27 +1,197 @@
|
|
|
1
1
|
import { execFile as execFileCb } from 'node:child_process'
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { join, basename, resolve, sep } from 'node:path'
|
|
2
|
+
import { existsSync, mkdirSync, realpathSync } from 'node:fs'
|
|
3
|
+
import { join, basename, dirname, resolve, sep } from 'node:path'
|
|
5
4
|
import { promisify } from 'node:util'
|
|
6
5
|
|
|
7
6
|
const execFile = promisify(execFileCb)
|
|
8
7
|
|
|
8
|
+
/**
|
|
9
|
+
* Git worktrees for a convoy.
|
|
10
|
+
*
|
|
11
|
+
* Every worktree — the convoy's own integration checkout and each task's —
|
|
12
|
+
* lives directly under `<repo>/.opencastle/worktrees/`, created from the main
|
|
13
|
+
* repository with a short name. They used to nest (a task's worktree inside the
|
|
14
|
+
* convoy's, each named with a 13-digit timestamp), which put ~100 characters in
|
|
15
|
+
* front of every path in the repo and broke Windows' 260-character limit.
|
|
16
|
+
* Staying inside the repository keeps npm's walk up to the project's
|
|
17
|
+
* node_modules working for gates run in a worktree.
|
|
18
|
+
*/
|
|
19
|
+
|
|
9
20
|
export interface WorktreeInfo {
|
|
10
21
|
path: string
|
|
11
22
|
branch: string
|
|
12
23
|
head: string
|
|
24
|
+
/** git marks a worktree whose directory has gone as prunable. */
|
|
25
|
+
prunable?: boolean
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** What a task changed since its worktree was created. */
|
|
29
|
+
export interface WorktreeChanges {
|
|
30
|
+
files: string[]
|
|
31
|
+
diff: string
|
|
13
32
|
}
|
|
14
33
|
|
|
15
34
|
export interface WorktreeManager {
|
|
35
|
+
/** Create a worktree on a new branch `convoy-<workerId>` starting at `featureBranch`. */
|
|
16
36
|
create(workerId: string, featureBranch: string): Promise<string>
|
|
17
|
-
|
|
37
|
+
/** Remove a worktree; its branch goes too unless `keepBranch` — kept when its work could not be merged. */
|
|
38
|
+
remove(worktreePath: string, opts?: { keepBranch?: boolean }): Promise<void>
|
|
18
39
|
list(): Promise<WorktreeInfo[]>
|
|
19
|
-
|
|
40
|
+
/** Remove every managed worktree except the paths in `except`. */
|
|
41
|
+
removeAll(opts?: { except?: string[] }): Promise<void>
|
|
42
|
+
/**
|
|
43
|
+
* Commit everything in a worktree. Returns true when a commit was made.
|
|
44
|
+
* Optional so a test double can leave git out entirely.
|
|
45
|
+
*/
|
|
46
|
+
commitAll?(worktreePath: string, message: string): Promise<boolean>
|
|
47
|
+
/** The commit a worktree's HEAD points at. */
|
|
48
|
+
head?(worktreePath: string): Promise<string | null>
|
|
49
|
+
/** Files and diff between `sinceRef` and the worktree's HEAD. */
|
|
50
|
+
changes?(worktreePath: string, sinceRef: string): Promise<WorktreeChanges | null>
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/** The branch name a worker's worktree is created on. */
|
|
54
|
+
export function workerBranchName(workerId: string): string {
|
|
55
|
+
return `convoy-${workerId}`
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/** Absolute path of the directory every managed worktree lives in. */
|
|
59
|
+
export function worktreesDirFor(repoRoot: string): string {
|
|
60
|
+
return join(resolve(repoRoot), '.opencastle', 'worktrees')
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function realOrResolved(p: string): string {
|
|
64
|
+
try {
|
|
65
|
+
return realpathSync(p)
|
|
66
|
+
} catch {
|
|
67
|
+
return resolve(p)
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/** True when `child` is inside `parent`, on either path separator. */
|
|
72
|
+
export function isInside(parent: string, child: string): boolean {
|
|
73
|
+
const p = realOrResolved(parent)
|
|
74
|
+
const c = realOrResolved(child)
|
|
75
|
+
return c.startsWith(p + sep) || c.startsWith(p + '/')
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// ── git, with an identity when the user has none ────────────────────────────
|
|
79
|
+
|
|
80
|
+
let identityKnown: boolean | null = null
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Run git. A commit or merge on a machine with no `user.email` (a CI box, a
|
|
84
|
+
* fresh container) used to fail the task outright; the convoy signs as itself
|
|
85
|
+
* there, and only there.
|
|
86
|
+
*/
|
|
87
|
+
/**
|
|
88
|
+
* git refuses a command, before doing anything, when another git process holds
|
|
89
|
+
* a lock it needs — the index, a ref, packed-refs. Tasks create and remove
|
|
90
|
+
* worktrees and branches in one repository at the same moment, so a refusal is
|
|
91
|
+
* contention, not a fault, and a moment later the command goes through.
|
|
92
|
+
*/
|
|
93
|
+
const LOCK_CONTENTION = /\.lock'?: File exists|Unable to create '[^']*\.lock'|cannot lock ref|could not lock config file|failed to read \S*worktrees\/\S*\/(commondir|gitdir)/i
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* One worktree command at a time per repository.
|
|
97
|
+
*
|
|
98
|
+
* `git worktree add` reads every other worktree's entry under .git/worktrees/,
|
|
99
|
+
* and one being written by a concurrent add is half there: with eight tasks
|
|
100
|
+
* starting together, two failed "Could not create a worktree: fatal: failed to
|
|
101
|
+
* read .git/worktrees/<other>/commondir". Adding, removing and listing
|
|
102
|
+
* worktrees, and deleting branches, now queue per repository. Each takes
|
|
103
|
+
* milliseconds; the agents still run side by side.
|
|
104
|
+
*/
|
|
105
|
+
const repoQueues = new Map<string, Promise<unknown>>()
|
|
106
|
+
|
|
107
|
+
function changesWorktrees(args: string[]): boolean {
|
|
108
|
+
return args[0] === 'worktree' || (args[0] === 'branch' && (args.includes('-D') || args.includes('-d')))
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export async function git(args: string[], cwd: string): Promise<string> {
|
|
112
|
+
if (!changesWorktrees(args)) return runGit(args, cwd)
|
|
113
|
+
const key = realOrResolved(cwd)
|
|
114
|
+
const prev = repoQueues.get(key) ?? Promise.resolve()
|
|
115
|
+
const next = prev.then(() => runGit(args, cwd), () => runGit(args, cwd))
|
|
116
|
+
repoQueues.set(key, next.catch(() => undefined))
|
|
117
|
+
return next
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
async function runGit(args: string[], cwd: string): Promise<string> {
|
|
121
|
+
for (let attempt = 0; ; attempt++) {
|
|
122
|
+
try {
|
|
123
|
+
const { stdout } = await execFile('git', args, { cwd, maxBuffer: 64 * 1024 * 1024 })
|
|
124
|
+
return stdout
|
|
125
|
+
} catch (err) {
|
|
126
|
+
const text = `${(err as { stderr?: string }).stderr ?? ''}\n${(err as Error).message}`
|
|
127
|
+
if (attempt >= 6 || !LOCK_CONTENTION.test(text)) throw err
|
|
128
|
+
await new Promise((r) => setTimeout(r, 40 * 2 ** attempt + Math.random() * 40))
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
async function gitWithIdentity(args: string[], cwd: string): Promise<string> {
|
|
134
|
+
if (identityKnown === null) {
|
|
135
|
+
try {
|
|
136
|
+
await execFile('git', ['var', 'GIT_AUTHOR_IDENT'], { cwd })
|
|
137
|
+
identityKnown = true
|
|
138
|
+
} catch {
|
|
139
|
+
identityKnown = false
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
const prefix = identityKnown ? [] : ['-c', 'user.name=OpenCastle convoy', '-c', 'user.email=convoy@opencastle.invalid']
|
|
143
|
+
return git([...prefix, ...args], cwd)
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Stage and commit everything in `cwd`. Returns true when there was something
|
|
148
|
+
* to commit.
|
|
149
|
+
*
|
|
150
|
+
* `--no-verify`: this is the convoy's bookkeeping commit inside its own
|
|
151
|
+
* worktree, and the checks it cares about run as gates, with their output fed
|
|
152
|
+
* back to the agent. A project's pre-commit hook (lint-staged and the like) is
|
|
153
|
+
* for the commit a person makes when they merge the convoy branch.
|
|
154
|
+
*/
|
|
155
|
+
export async function commitAllIn(cwd: string, message: string): Promise<boolean> {
|
|
156
|
+
await git(['add', '-A'], cwd)
|
|
157
|
+
const staged = await git(['diff', '--cached', '--name-only'], cwd)
|
|
158
|
+
if (!staged.trim()) return false
|
|
159
|
+
await gitWithIdentity(['commit', '-q', '--no-verify', '-m', message], cwd)
|
|
160
|
+
return true
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/** `git merge` with the convoy's fallback identity. */
|
|
164
|
+
export async function mergeIn(cwd: string, args: string[]): Promise<string> {
|
|
165
|
+
return gitWithIdentity(['merge', ...args], cwd)
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
export function parseWorktreeList(output: string): WorktreeInfo[] {
|
|
169
|
+
const results: WorktreeInfo[] = []
|
|
170
|
+
const blocks = output.trim().split(/\n\n+/).filter(Boolean)
|
|
171
|
+
for (const block of blocks) {
|
|
172
|
+
let path = ''
|
|
173
|
+
let head = ''
|
|
174
|
+
let branch = ''
|
|
175
|
+
let prunable = false
|
|
176
|
+
for (const line of block.split('\n')) {
|
|
177
|
+
if (line.startsWith('worktree ')) path = line.slice('worktree '.length)
|
|
178
|
+
else if (line.startsWith('HEAD ')) head = line.slice('HEAD '.length)
|
|
179
|
+
else if (line.startsWith('branch ')) branch = line.slice('branch '.length)
|
|
180
|
+
else if (line.startsWith('prunable')) prunable = true
|
|
181
|
+
}
|
|
182
|
+
if (path) results.push({ path, branch, head, prunable })
|
|
183
|
+
}
|
|
184
|
+
return results
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/** Every worktree of the repository, the main checkout first. */
|
|
188
|
+
export async function listAllWorktrees(repoRoot: string): Promise<WorktreeInfo[]> {
|
|
189
|
+
return parseWorktreeList(await git(['worktree', 'list', '--porcelain'], repoRoot))
|
|
20
190
|
}
|
|
21
191
|
|
|
22
|
-
export function createWorktreeManager(
|
|
23
|
-
const resolvedBase = realpathSync(resolve(
|
|
24
|
-
const worktreesDir =
|
|
192
|
+
export function createWorktreeManager(repoRoot: string): WorktreeManager {
|
|
193
|
+
const resolvedBase = realpathSync(resolve(repoRoot))
|
|
194
|
+
const worktreesDir = worktreesDirFor(resolvedBase)
|
|
25
195
|
|
|
26
196
|
async function create(workerId: string, featureBranch: string): Promise<string> {
|
|
27
197
|
if (!/^[a-zA-Z0-9_-]+$/.test(workerId)) {
|
|
@@ -30,87 +200,167 @@ export function createWorktreeManager(basePath: string): WorktreeManager {
|
|
|
30
200
|
)
|
|
31
201
|
}
|
|
32
202
|
const worktreePath = join(worktreesDir, workerId)
|
|
33
|
-
|
|
34
|
-
await
|
|
35
|
-
'git',
|
|
36
|
-
['worktree', 'add', worktreePath, '-b', `convoy-${workerId}`, featureBranch],
|
|
37
|
-
{ cwd: resolvedBase },
|
|
38
|
-
)
|
|
203
|
+
mkdirSync(worktreesDir, { recursive: true })
|
|
204
|
+
await git(['worktree', 'add', '-q', worktreePath, '-b', workerBranchName(workerId), featureBranch], resolvedBase)
|
|
39
205
|
return worktreePath
|
|
40
206
|
}
|
|
41
207
|
|
|
42
|
-
async function remove(worktreePath: string): Promise<void> {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
resolved = realpathSync(worktreePath)
|
|
46
|
-
} catch {
|
|
47
|
-
resolved = resolve(worktreePath)
|
|
48
|
-
}
|
|
49
|
-
if (!resolved.startsWith(worktreesDir + sep)) {
|
|
208
|
+
async function remove(worktreePath: string, opts: { keepBranch?: boolean } = {}): Promise<void> {
|
|
209
|
+
const resolved = realOrResolved(worktreePath)
|
|
210
|
+
if (!resolved.startsWith(realOrResolved(worktreesDir) + sep)) {
|
|
50
211
|
throw new Error(`Path "${worktreePath}" is outside the managed worktrees directory`)
|
|
51
212
|
}
|
|
52
213
|
const workerId = basename(resolved)
|
|
53
214
|
try {
|
|
54
|
-
await
|
|
55
|
-
cwd: resolvedBase,
|
|
56
|
-
})
|
|
215
|
+
await git(['worktree', 'remove', resolved, '--force'], resolvedBase)
|
|
57
216
|
} catch (err) {
|
|
58
217
|
const stderr = (err as { stderr?: string }).stderr ?? ''
|
|
59
|
-
if (stderr.includes('is not a working tree'))
|
|
60
|
-
return
|
|
61
|
-
}
|
|
62
|
-
throw err
|
|
218
|
+
if (!stderr.includes('is not a working tree')) throw err
|
|
63
219
|
}
|
|
220
|
+
if (opts.keepBranch) return
|
|
64
221
|
try {
|
|
65
|
-
await
|
|
222
|
+
await git(['branch', '-D', workerBranchName(workerId)], resolvedBase)
|
|
66
223
|
} catch {
|
|
67
224
|
// Branch may already be deleted — ignore
|
|
68
225
|
}
|
|
69
226
|
}
|
|
70
227
|
|
|
71
|
-
|
|
72
228
|
async function list(): Promise<WorktreeInfo[]> {
|
|
73
|
-
const
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
return parseWorktreeList(stdout, worktreesDir)
|
|
229
|
+
const all = await listAllWorktrees(resolvedBase)
|
|
230
|
+
const dir = realOrResolved(worktreesDir)
|
|
231
|
+
return all.filter((w) => realOrResolved(w.path).startsWith(dir + sep))
|
|
77
232
|
}
|
|
78
233
|
|
|
79
|
-
async function removeAll(): Promise<void> {
|
|
80
|
-
const
|
|
81
|
-
for (const wt of
|
|
234
|
+
async function removeAll(opts: { except?: string[] } = {}): Promise<void> {
|
|
235
|
+
const keep = new Set((opts.except ?? []).map(realOrResolved))
|
|
236
|
+
for (const wt of await list()) {
|
|
237
|
+
if (keep.has(realOrResolved(wt.path))) continue
|
|
82
238
|
await remove(wt.path)
|
|
83
239
|
}
|
|
240
|
+
// A directory deleted by hand leaves its registration behind, and git then
|
|
241
|
+
// refuses to check its branch out anywhere else.
|
|
242
|
+
try { await git(['worktree', 'prune'], resolvedBase) } catch { /* nothing to prune */ }
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
async function commitAll(worktreePath: string, message: string): Promise<boolean> {
|
|
246
|
+
return commitAllIn(worktreePath, message)
|
|
84
247
|
}
|
|
85
248
|
|
|
86
|
-
|
|
249
|
+
async function head(worktreePath: string): Promise<string | null> {
|
|
250
|
+
try {
|
|
251
|
+
return (await git(['rev-parse', 'HEAD'], worktreePath)).trim() || null
|
|
252
|
+
} catch {
|
|
253
|
+
return null
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
async function changes(worktreePath: string, sinceRef: string): Promise<WorktreeChanges | null> {
|
|
258
|
+
try {
|
|
259
|
+
const files = (await git(['diff', '--name-only', `${sinceRef}..HEAD`], worktreePath))
|
|
260
|
+
.split('\n').map((s) => s.trim()).filter(Boolean)
|
|
261
|
+
const diff = await git(['diff', `${sinceRef}..HEAD`], worktreePath)
|
|
262
|
+
return { files, diff }
|
|
263
|
+
} catch {
|
|
264
|
+
return null
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
return { create, remove, list, removeAll, commitAll, head, changes }
|
|
87
269
|
}
|
|
88
270
|
|
|
89
|
-
|
|
90
|
-
const results: WorktreeInfo[] = []
|
|
91
|
-
const blocks = output.trim().split(/\n\n+/).filter(Boolean)
|
|
271
|
+
// ── The convoy's integration checkout ───────────────────────────────────────
|
|
92
272
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
273
|
+
export class BranchInUseError extends Error {
|
|
274
|
+
constructor(public readonly branch: string, public readonly path: string) {
|
|
275
|
+
super(
|
|
276
|
+
`Branch "${branch}" is checked out at ${path}.\n` +
|
|
277
|
+
` A convoy merges into its branch in a checkout of its own. Switch that ` +
|
|
278
|
+
`checkout to another branch, then run again.`,
|
|
279
|
+
)
|
|
280
|
+
this.name = 'BranchInUseError'
|
|
281
|
+
}
|
|
282
|
+
}
|
|
98
283
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
284
|
+
/**
|
|
285
|
+
* Check `branch` out in the convoy's integration worktree, creating the branch
|
|
286
|
+
* from `base` when it does not exist yet.
|
|
287
|
+
*
|
|
288
|
+
* A worktree left behind by a killed run is reused: its unfinished merge is
|
|
289
|
+
* aborted and it is reset to the branch tip, which holds every merge that
|
|
290
|
+
* completed. One whose directory has gone is pruned first. Either used to make
|
|
291
|
+
* `resume` fail with "'<branch>' is already used by worktree".
|
|
292
|
+
*/
|
|
293
|
+
export async function ensureRootWorktree(opts: {
|
|
294
|
+
repoRoot: string
|
|
295
|
+
branch: string
|
|
296
|
+
base: string
|
|
297
|
+
dirName: string
|
|
298
|
+
}): Promise<string> {
|
|
299
|
+
const repoRoot = realOrResolved(opts.repoRoot)
|
|
300
|
+
const worktreesDir = worktreesDirFor(repoRoot)
|
|
301
|
+
const target = join(worktreesDir, opts.dirName)
|
|
302
|
+
const ref = `refs/heads/${opts.branch}`
|
|
108
303
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
304
|
+
let worktrees = await listAllWorktrees(repoRoot)
|
|
305
|
+
if (worktrees.some((w) => w.branch === ref && (w.prunable || !existsSync(w.path)))) {
|
|
306
|
+
await git(['worktree', 'prune'], repoRoot)
|
|
307
|
+
worktrees = await listAllWorktrees(repoRoot)
|
|
113
308
|
}
|
|
114
309
|
|
|
115
|
-
|
|
310
|
+
const holder = worktrees.find((w) => w.branch === ref)
|
|
311
|
+
if (holder) {
|
|
312
|
+
if (!isInside(worktreesDir, holder.path)) throw new BranchInUseError(opts.branch, holder.path)
|
|
313
|
+
try { await git(['merge', '--abort'], holder.path) } catch { /* no merge in progress */ }
|
|
314
|
+
await git(['reset', '-q', '--hard', 'HEAD'], holder.path)
|
|
315
|
+
await git(['clean', '-q', '-fd'], holder.path)
|
|
316
|
+
return holder.path
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
mkdirSync(dirname(target), { recursive: true })
|
|
320
|
+
let exists = true
|
|
321
|
+
try {
|
|
322
|
+
await git(['rev-parse', '--verify', '--quiet', ref], repoRoot)
|
|
323
|
+
} catch {
|
|
324
|
+
exists = false
|
|
325
|
+
}
|
|
326
|
+
if (exists) {
|
|
327
|
+
await git(['worktree', 'add', '-q', target, opts.branch], repoRoot)
|
|
328
|
+
} else {
|
|
329
|
+
await git(['worktree', 'add', '-q', '-b', opts.branch, target, opts.base], repoRoot)
|
|
330
|
+
}
|
|
331
|
+
return target
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
/** Remove the integration worktree. The branch stays: it is the result. */
|
|
335
|
+
export async function removeRootWorktree(repoRoot: string, path: string): Promise<void> {
|
|
336
|
+
try {
|
|
337
|
+
await git(['worktree', 'remove', '--force', path], realOrResolved(repoRoot))
|
|
338
|
+
} catch {
|
|
339
|
+
try { await git(['worktree', 'prune'], realOrResolved(repoRoot)) } catch { /* ignore */ }
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
/**
|
|
344
|
+
* The repository's main checkout — where `.opencastle/` belongs — even when
|
|
345
|
+
* `cwd` is a worktree. Logs written inside a worktree vanished with it.
|
|
346
|
+
*/
|
|
347
|
+
export async function mainRepoRoot(cwd: string): Promise<string | null> {
|
|
348
|
+
try {
|
|
349
|
+
const top = (await git(['rev-parse', '--show-toplevel'], cwd)).trim()
|
|
350
|
+
const list = await listAllWorktrees(top)
|
|
351
|
+
return list[0]?.path ?? top
|
|
352
|
+
} catch {
|
|
353
|
+
return null
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
/** The branch checked out at `cwd`, or its commit when HEAD is detached. */
|
|
358
|
+
export async function currentRef(cwd: string): Promise<string | null> {
|
|
359
|
+
try {
|
|
360
|
+
const name = (await git(['rev-parse', '--abbrev-ref', 'HEAD'], cwd)).trim()
|
|
361
|
+
if (name && name !== 'HEAD') return name
|
|
362
|
+
return (await git(['rev-parse', 'HEAD'], cwd)).trim() || null
|
|
363
|
+
} catch {
|
|
364
|
+
return null
|
|
365
|
+
}
|
|
116
366
|
}
|
|
@@ -60,12 +60,12 @@ describe('positionalWords', () => {
|
|
|
60
60
|
})
|
|
61
61
|
|
|
62
62
|
it('treats a value that looks like a word as a value, not a task word', () => {
|
|
63
|
-
expect(positionalWords(['--
|
|
63
|
+
expect(positionalWords(['--concurrency', '3', 'do', 'work'])).toEqual(['do', 'work'])
|
|
64
64
|
})
|
|
65
65
|
})
|
|
66
66
|
|
|
67
67
|
describe('the task the planner is given', () => {
|
|
68
|
-
/** What the dispatcher
|
|
68
|
+
/** What the dispatcher hands the planner as the task. */
|
|
69
69
|
const taskText = (args: string[]): string => positionalWords(args).join(' ')
|
|
70
70
|
|
|
71
71
|
it('reassembles an unquoted request in order', () => {
|
|
@@ -86,30 +86,6 @@ describe('the task the planner is given', () => {
|
|
|
86
86
|
})
|
|
87
87
|
})
|
|
88
88
|
|
|
89
|
-
describe('status words stay a status query', () => {
|
|
90
|
-
/** The dispatcher's rule: a status word alone, with no other words after it. */
|
|
91
|
-
const STATUS_WORDS = ['status', 'state', 'info', 'ls', 'list']
|
|
92
|
-
const isStatusQuery = (args: string[]): boolean => {
|
|
93
|
-
const words = positionalWords(args)
|
|
94
|
-
return words.length === 1 && STATUS_WORDS.includes(words[0])
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
it('treats a bare status word as a status query', () => {
|
|
98
|
-
for (const w of STATUS_WORDS) expect(isStatusQuery([w])).toBe(true)
|
|
99
|
-
})
|
|
100
|
-
|
|
101
|
-
it('still does so when flags accompany it', () => {
|
|
102
|
-
expect(isStatusQuery(['status', '--json'])).toBe(true)
|
|
103
|
-
})
|
|
104
|
-
|
|
105
|
-
it('treats a status word that opens a sentence as a task', () => {
|
|
106
|
-
// "status" alone means "where do things stand"; "status page for the admin"
|
|
107
|
-
// is a feature, and planning it must not be hijacked.
|
|
108
|
-
expect(isStatusQuery(['status', 'page', 'for', 'the', 'admin'])).toBe(false)
|
|
109
|
-
expect(isStatusQuery(['list', 'all', 'users', 'in', 'the', 'dashboard'])).toBe(false)
|
|
110
|
-
})
|
|
111
|
-
})
|
|
112
|
-
|
|
113
89
|
describe('splitTaskFlags', () => {
|
|
114
90
|
it('forwards a flag the planner reads, with its value', () => {
|
|
115
91
|
// The defect: --adapter was dropped, and the run used the auto-detected
|
|
@@ -138,15 +114,19 @@ describe('splitTaskFlags', () => {
|
|
|
138
114
|
expect(splitTaskFlags(['add', 'caching', '--adaptr', 'codex']).unknown).toEqual(['--adaptr'])
|
|
139
115
|
})
|
|
140
116
|
|
|
141
|
-
it('
|
|
142
|
-
expect(splitTaskFlags(['x', '--
|
|
117
|
+
it('reports a removed flag rather than forwarding it', () => {
|
|
118
|
+
expect(splitTaskFlags(['x', '--skip-validation']).unknown).toEqual(['--skip-validation'])
|
|
119
|
+
})
|
|
120
|
+
|
|
121
|
+
it('does not mistake a flag value for another unknown flag', () => {
|
|
122
|
+
expect(splitTaskFlags(['x', '--prd', 'out', '--nope']).unknown).toEqual(['--prd', '--nope'])
|
|
143
123
|
})
|
|
144
124
|
|
|
145
125
|
it('forwards several flags at once, keeping order', () => {
|
|
146
126
|
const { forward, unknown } = splitTaskFlags([
|
|
147
|
-
'build', 'it', '--verbose', '--adapter', 'codex', '--
|
|
127
|
+
'build', 'it', '--verbose', '--adapter', 'codex', '--yes', '-c', '2',
|
|
148
128
|
])
|
|
149
|
-
expect(forward).toEqual(['--verbose', '--adapter', 'codex', '--
|
|
129
|
+
expect(forward).toEqual(['--verbose', '--adapter', 'codex', '--yes', '-c', '2'])
|
|
150
130
|
expect(unknown).toEqual([])
|
|
151
131
|
})
|
|
152
132
|
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `opencastle convoy` with no task: where the last run stands, and the one
|
|
3
|
+
* thing to do next — read through the read model, never a store that migrates.
|
|
4
|
+
*/
|
|
5
|
+
import { mkdirSync, mkdtempSync, realpathSync, rmSync, statSync } from 'node:fs'
|
|
6
|
+
import { hostname, tmpdir } from 'node:os'
|
|
7
|
+
import { join } from 'node:path'
|
|
8
|
+
import { DatabaseSync } from 'node:sqlite'
|
|
9
|
+
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
|
|
10
|
+
import convoy, { readLastRun } from './convoy-cmd.js'
|
|
11
|
+
import { createConvoyStore } from './convoy/store.js'
|
|
12
|
+
|
|
13
|
+
let root: string
|
|
14
|
+
let out: string[]
|
|
15
|
+
let savedNoColor: string | undefined
|
|
16
|
+
|
|
17
|
+
beforeEach(() => {
|
|
18
|
+
root = realpathSync(mkdtempSync(join(tmpdir(), 'oc-convoy-')))
|
|
19
|
+
mkdirSync(join(root, '.opencastle'))
|
|
20
|
+
vi.spyOn(process, 'cwd').mockReturnValue(root)
|
|
21
|
+
out = []
|
|
22
|
+
const capture = (...a: unknown[]): void => void out.push(a.join(' '))
|
|
23
|
+
vi.spyOn(console, 'log').mockImplementation(capture)
|
|
24
|
+
vi.spyOn(console, 'error').mockImplementation(capture)
|
|
25
|
+
vi.spyOn(process, 'exit').mockImplementation(((code?: number) => {
|
|
26
|
+
throw new Error(`exit ${code}`)
|
|
27
|
+
}) as typeof process.exit)
|
|
28
|
+
savedNoColor = process.env.NO_COLOR
|
|
29
|
+
process.env.NO_COLOR = '1'
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
afterEach(() => {
|
|
33
|
+
vi.restoreAllMocks()
|
|
34
|
+
if (savedNoColor === undefined) delete process.env.NO_COLOR
|
|
35
|
+
else process.env.NO_COLOR = savedNoColor
|
|
36
|
+
rmSync(root, { recursive: true, force: true })
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
const text = (): string => out.join('\n')
|
|
40
|
+
const dbPath = (): string => join(root, '.opencastle', 'convoy.db')
|
|
41
|
+
|
|
42
|
+
function seed(runs: Array<{ id: string; status: string; tasks: string[]; created: string }>): void {
|
|
43
|
+
const store = createConvoyStore(dbPath())
|
|
44
|
+
for (const run of runs) {
|
|
45
|
+
store.insertConvoy({ id: run.id, name: `Run ${run.id}`, spec_hash: 'h', status: 'pending', branch: `convoy/${run.id}`, created_at: run.created, spec_yaml: 'x' })
|
|
46
|
+
run.tasks.forEach((status, i) => {
|
|
47
|
+
const id = `t${i}`
|
|
48
|
+
store.insertTask({
|
|
49
|
+
id, convoy_id: run.id, phase: 0, prompt: 'p', agent: 'developer', adapter: null, model: null, timeout_ms: 1000,
|
|
50
|
+
status: 'pending', retries: 0, max_retries: 0, files: null, depends_on: null, gates: null,
|
|
51
|
+
})
|
|
52
|
+
if (status !== 'pending') store.updateTaskStatus(id, run.id, status as 'done')
|
|
53
|
+
})
|
|
54
|
+
store.updateConvoyStatus(run.id, run.status as 'done', {})
|
|
55
|
+
}
|
|
56
|
+
store.close()
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function holdLock(): void {
|
|
60
|
+
const db = new DatabaseSync(dbPath())
|
|
61
|
+
db.prepare('INSERT OR REPLACE INTO engine_lock (id, pid, hostname, started_at, last_heartbeat) VALUES (1, ?, ?, ?, ?)')
|
|
62
|
+
.run(process.pid, hostname(), '2026-01-01T00:00:00Z', new Date().toISOString())
|
|
63
|
+
db.close()
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
describe('readLastRun', () => {
|
|
67
|
+
it('is null for a project that has never run a convoy', () => {
|
|
68
|
+
expect(readLastRun(root)).toBeNull()
|
|
69
|
+
})
|
|
70
|
+
|
|
71
|
+
it('counts every failed status as failed', () => {
|
|
72
|
+
seed([{ id: 'a', status: 'failed', created: '2026-10-01T00:00:00Z', tasks: ['done', 'failed', 'gate-failed', 'timed-out', 'review-blocked', 'disputed', 'hook-failed'] }])
|
|
73
|
+
expect(readLastRun(root)).toMatchObject({ total: 7, done: 1, failed: 6, next: 'opencastle convoy resume' })
|
|
74
|
+
})
|
|
75
|
+
|
|
76
|
+
it('does not call a run finished while a task was skipped, even when it says "done"', () => {
|
|
77
|
+
seed([{ id: 'a', status: 'done', created: '2026-10-01T00:00:00Z', tasks: ['done', 'skipped'] }])
|
|
78
|
+
expect(readLastRun(root)).toMatchObject({ done: 1, skipped: 1, failed: 0, next: 'opencastle convoy resume' })
|
|
79
|
+
})
|
|
80
|
+
|
|
81
|
+
it('treats a running task in a dead run as not done', () => {
|
|
82
|
+
seed([{ id: 'a', status: 'running', created: '2026-10-01T00:00:00Z', tasks: ['done', 'running'] }])
|
|
83
|
+
expect(readLastRun(root)).toMatchObject({ running: 1, alive: false, next: 'opencastle convoy resume' })
|
|
84
|
+
})
|
|
85
|
+
|
|
86
|
+
it('points at the live view while a process is working on the run', () => {
|
|
87
|
+
seed([{ id: 'a', status: 'running', created: new Date().toISOString(), tasks: ['running', 'pending'] }])
|
|
88
|
+
holdLock()
|
|
89
|
+
expect(readLastRun(root)).toMatchObject({ alive: true, next: 'opencastle convoy dashboard' })
|
|
90
|
+
})
|
|
91
|
+
|
|
92
|
+
it('offers a new run when every task is done, and names an older run with work left', () => {
|
|
93
|
+
seed([
|
|
94
|
+
{ id: 'old', status: 'interrupted', created: '2026-10-01T00:00:00Z', tasks: ['pending'] },
|
|
95
|
+
{ id: 'new', status: 'done', created: '2026-10-02T00:00:00Z', tasks: ['done', 'done'] },
|
|
96
|
+
])
|
|
97
|
+
expect(readLastRun(root)).toMatchObject({
|
|
98
|
+
id: 'new', done: 2, total: 2, next: 'opencastle convoy "<task>"', older_unfinished: { id: 'old', name: 'Run old' },
|
|
99
|
+
})
|
|
100
|
+
})
|
|
101
|
+
|
|
102
|
+
it('reads without writing to the database', () => {
|
|
103
|
+
seed([{ id: 'a', status: 'failed', created: '2026-10-01T00:00:00Z', tasks: ['failed'] }])
|
|
104
|
+
const before = statSync(dbPath()).mtimeMs
|
|
105
|
+
readLastRun(root)
|
|
106
|
+
expect(statSync(dbPath()).mtimeMs).toBe(before)
|
|
107
|
+
})
|
|
108
|
+
})
|
|
109
|
+
|
|
110
|
+
describe('opencastle convoy (status)', () => {
|
|
111
|
+
it('never reports a run as finished while a task is not done', async () => {
|
|
112
|
+
seed([{ id: 'a', status: 'done', created: '2026-10-01T00:00:00Z', tasks: ['done', 'skipped'] }])
|
|
113
|
+
await convoy({ args: [], pkgRoot: root })
|
|
114
|
+
expect(text()).toMatch(/1\/2 done, 1 skipped/)
|
|
115
|
+
expect(text()).toContain('Next: opencastle convoy resume')
|
|
116
|
+
expect(text()).not.toMatch(/every task is done|Nothing outstanding/)
|
|
117
|
+
})
|
|
118
|
+
|
|
119
|
+
it('prints JSON with --json', async () => {
|
|
120
|
+
seed([{ id: 'a', status: 'done', created: '2026-10-01T00:00:00Z', tasks: ['done'] }])
|
|
121
|
+
await convoy({ args: ['--json'], pkgRoot: root })
|
|
122
|
+
expect(JSON.parse(text())).toMatchObject({ id: 'a', done: 1, total: 1, next: 'opencastle convoy "<task>"' })
|
|
123
|
+
})
|
|
124
|
+
|
|
125
|
+
it('says how to start when there are no runs', async () => {
|
|
126
|
+
await convoy({ args: [], pkgRoot: root })
|
|
127
|
+
expect(text()).toContain('No runs yet.')
|
|
128
|
+
})
|
|
129
|
+
})
|
|
130
|
+
|
|
131
|
+
describe('opencastle convoy (what it refuses before planning anything)', () => {
|
|
132
|
+
const refused = async (args: string[]): Promise<string> => {
|
|
133
|
+
await expect(convoy({ args, pkgRoot: root })).rejects.toThrow('exit 1')
|
|
134
|
+
return text()
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
it('reads a mistyped subcommand as a typo, not a task', async () => {
|
|
138
|
+
expect(await refused(['resum'])).toContain('Did you mean opencastle convoy resume?')
|
|
139
|
+
})
|
|
140
|
+
|
|
141
|
+
it('does not plan a one-word task such as "status"', async () => {
|
|
142
|
+
const said = await refused(['status'])
|
|
143
|
+
expect(said).toContain('"status" is one word')
|
|
144
|
+
expect(said).toContain('For the last run: opencastle convoy')
|
|
145
|
+
})
|
|
146
|
+
|
|
147
|
+
it('names what replaced a removed flag', async () => {
|
|
148
|
+
expect(await refused(['--retry-failed'])).toContain('--retry-failed was removed. Use: opencastle convoy resume')
|
|
149
|
+
expect(await refused(['add', 'rate', 'limiting', '--status'])).toContain('--status was removed')
|
|
150
|
+
})
|
|
151
|
+
|
|
152
|
+
it('suggests the nearest flag a task takes', async () => {
|
|
153
|
+
expect(await refused(['add', 'rate', 'limiting', '--yse'])).toContain('Did you mean --yes?')
|
|
154
|
+
})
|
|
155
|
+
|
|
156
|
+
it('says a task flag needs a task', async () => {
|
|
157
|
+
expect(await refused(['--yes'])).toContain('--yes goes with a task')
|
|
158
|
+
})
|
|
159
|
+
|
|
160
|
+
it('sends a subcommand flag to its subcommand', async () => {
|
|
161
|
+
expect(await refused(['-f', 'spec.yml'])).toContain('-f belongs to `opencastle convoy run`')
|
|
162
|
+
})
|
|
163
|
+
})
|