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