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
|
@@ -0,0 +1,607 @@
|
|
|
1
|
+
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'
|
|
2
|
+
import { mkdtempSync, writeFileSync, readFileSync, rmSync, existsSync, readdirSync, mkdirSync } from 'node:fs'
|
|
3
|
+
import { tmpdir } from 'node:os'
|
|
4
|
+
import { join, resolve } from 'node:path'
|
|
5
|
+
import { parse as yamlParse } from 'yaml'
|
|
6
|
+
import type { AgentAdapter, ExecuteOptions, Task } from './convoy/spec-types.js'
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* The planner, end to end, against a stub adapter: what it asks, how often, with
|
|
10
|
+
* what authority, and what it does with the answers. No agent CLI is started —
|
|
11
|
+
* the adapter is an object, and the CLI entry's adapter lookup, confirmation
|
|
12
|
+
* prompt and run module are replaced.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
vi.mock('./run.js', () => ({ runSpec: vi.fn(async () => 0), exitWith: vi.fn() }))
|
|
16
|
+
vi.mock('./run/adapters/index.js', () => ({
|
|
17
|
+
resolveAdapter: vi.fn(),
|
|
18
|
+
cleanupAdapters: vi.fn(async () => {}),
|
|
19
|
+
}))
|
|
20
|
+
vi.mock('./prompt.js', async (importOriginal) => ({
|
|
21
|
+
...(await importOriginal<typeof import('./prompt.js')>()),
|
|
22
|
+
confirm: vi.fn(),
|
|
23
|
+
closePrompts: vi.fn(),
|
|
24
|
+
}))
|
|
25
|
+
|
|
26
|
+
const { planConvoy, hashPrd, deriveComplexityPath, planTask, renderPlan, default: pipeline } = await import('./pipeline.js')
|
|
27
|
+
const runModule = await import('./run.js')
|
|
28
|
+
const adapters = await import('./run/adapters/index.js')
|
|
29
|
+
const promptModule = await import('./prompt.js')
|
|
30
|
+
|
|
31
|
+
const pkgRoot = resolve(import.meta.dirname, '..', '..')
|
|
32
|
+
|
|
33
|
+
// ── The stub runtime ────────────────────────────────────────────────────────
|
|
34
|
+
|
|
35
|
+
const PRD = `# Dark Mode — PRD
|
|
36
|
+
|
|
37
|
+
## Overview
|
|
38
|
+
|
|
39
|
+
PRD-MARKER Add a dark mode toggle.
|
|
40
|
+
|
|
41
|
+
## Goals
|
|
42
|
+
|
|
43
|
+
1. A toggle switches the theme.
|
|
44
|
+
|
|
45
|
+
## Task Breakdown
|
|
46
|
+
|
|
47
|
+
Phase 1 — Theme:
|
|
48
|
+
- Tokens: Files: src/theme.ts
|
|
49
|
+
Phase 2 — UI (depends on Phase 1):
|
|
50
|
+
- Toggle: Files: src/toggle.ts
|
|
51
|
+
Phase 3 — Docs:
|
|
52
|
+
- Docs: Files: docs/theme.md
|
|
53
|
+
Phase 4 — Tests (depends on Phase 2):
|
|
54
|
+
- Tests: Files: test/theme.test.ts
|
|
55
|
+
`
|
|
56
|
+
|
|
57
|
+
const fence = (value: unknown): string => '```json\n' + JSON.stringify(value, null, 2) + '\n```'
|
|
58
|
+
|
|
59
|
+
const SINGLE = {
|
|
60
|
+
original_prompt: 'add dark mode',
|
|
61
|
+
total_tasks: 2,
|
|
62
|
+
total_phases: 2,
|
|
63
|
+
domains: ['frontend'],
|
|
64
|
+
complexity: 'medium',
|
|
65
|
+
recommended_strategy: 'single',
|
|
66
|
+
convoy_groups: [{ name: 'all', description: 'All', phases: [1, 2], depends_on: [] }],
|
|
67
|
+
task_complexity: [{ workstream: 'Tokens', phase: 1, complexity: 2, rationale: 'small' }],
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const CHAIN = {
|
|
71
|
+
...SINGLE,
|
|
72
|
+
total_tasks: 12,
|
|
73
|
+
total_phases: 4,
|
|
74
|
+
complexity: 'high',
|
|
75
|
+
recommended_strategy: 'chain',
|
|
76
|
+
convoy_groups: [
|
|
77
|
+
{ name: 'theme', description: 'Theme', phases: [1], depends_on: [] },
|
|
78
|
+
{ name: 'docs', description: 'Docs', phases: [3], depends_on: [] },
|
|
79
|
+
{ name: 'ui', description: 'UI and tests', phases: [2, 4], depends_on: ['theme', 'docs'] },
|
|
80
|
+
],
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
const PLAN = {
|
|
84
|
+
name: 'Dark mode',
|
|
85
|
+
tasks: [
|
|
86
|
+
{ id: 'theme', agent: 'developer', files: ['src/theme.ts'], complexity: 2, prompt: 'Add tokens to src/theme.ts.' },
|
|
87
|
+
{ id: 'toggle', agent: 'ui-ux-expert', files: ['src/toggle.ts'], depends_on: ['theme'], prompt: 'Add the toggle.' },
|
|
88
|
+
],
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
type Answer = string | ((prompt: string, nth: number) => string | Promise<string>)
|
|
92
|
+
|
|
93
|
+
interface Call {
|
|
94
|
+
template: string
|
|
95
|
+
permissionMode?: string
|
|
96
|
+
cwd?: string
|
|
97
|
+
prompt: string
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function stubAdapter(answers: Record<string, Answer> = {}): { adapter: AgentAdapter; calls: Call[] } {
|
|
101
|
+
const calls: Call[] = []
|
|
102
|
+
const seen = new Map<string, number>()
|
|
103
|
+
const defaults: Record<string, Answer> = {
|
|
104
|
+
'generate-prd': PRD,
|
|
105
|
+
'fix-prd': PRD,
|
|
106
|
+
'validate-prd': fence({ valid: true }),
|
|
107
|
+
'assess-complexity': fence(SINGLE),
|
|
108
|
+
'generate-convoy': fence(PLAN),
|
|
109
|
+
'validate-convoy': fence({ valid: true }),
|
|
110
|
+
'fix-convoy': fence([]),
|
|
111
|
+
}
|
|
112
|
+
const adapter: AgentAdapter = {
|
|
113
|
+
name: 'stub',
|
|
114
|
+
isAvailable: async () => true,
|
|
115
|
+
async execute(task: Task, options?: ExecuteOptions) {
|
|
116
|
+
calls.push({ template: task.id, permissionMode: options?.permissionMode, cwd: options?.cwd, prompt: task.prompt })
|
|
117
|
+
const nth = (seen.get(task.id) ?? 0) + 1
|
|
118
|
+
seen.set(task.id, nth)
|
|
119
|
+
const answer = answers[task.id] ?? defaults[task.id]
|
|
120
|
+
const output = typeof answer === 'function' ? await answer(task.prompt, nth) : answer
|
|
121
|
+
return { success: true, output, exitCode: 0 }
|
|
122
|
+
},
|
|
123
|
+
}
|
|
124
|
+
return { adapter, calls }
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
const templates = (calls: Call[]): string[] => calls.map((c) => c.template)
|
|
128
|
+
const count = (calls: Call[], template: string): number => calls.filter((c) => c.template === template).length
|
|
129
|
+
|
|
130
|
+
// ── A scratch project ───────────────────────────────────────────────────────
|
|
131
|
+
|
|
132
|
+
let root: string
|
|
133
|
+
|
|
134
|
+
beforeEach(() => {
|
|
135
|
+
root = mkdtempSync(join(tmpdir(), 'oc-planner-'))
|
|
136
|
+
writeFileSync(
|
|
137
|
+
join(root, 'package.json'),
|
|
138
|
+
JSON.stringify({ packageManager: 'pnpm@9.0.0', scripts: { test: 'vitest run', lint: 'eslint .', typecheck: 'tsc' } }),
|
|
139
|
+
)
|
|
140
|
+
vi.spyOn(console, 'log').mockImplementation(() => {})
|
|
141
|
+
vi.spyOn(console, 'warn').mockImplementation(() => {})
|
|
142
|
+
vi.spyOn(console, 'error').mockImplementation(() => {})
|
|
143
|
+
})
|
|
144
|
+
|
|
145
|
+
afterEach(() => {
|
|
146
|
+
vi.restoreAllMocks()
|
|
147
|
+
vi.mocked(runModule.runSpec).mockClear()
|
|
148
|
+
vi.mocked(runModule.exitWith).mockClear()
|
|
149
|
+
vi.mocked(promptModule.confirm).mockReset()
|
|
150
|
+
rmSync(root, { recursive: true, force: true })
|
|
151
|
+
})
|
|
152
|
+
|
|
153
|
+
function plan(adapter: AgentAdapter, extra: Partial<Parameters<typeof planConvoy>[0]> = {}) {
|
|
154
|
+
return planConvoy({ task: 'add dark mode', adapter, adapterName: 'claude', pkgRoot, projectRoot: root, ...extra })
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
// ── Sessions ────────────────────────────────────────────────────────────────
|
|
158
|
+
|
|
159
|
+
describe('planConvoy: sessions', () => {
|
|
160
|
+
it('needs four sessions when every answer is good, with no semantic review of the plan', async () => {
|
|
161
|
+
const { adapter, calls } = stubAdapter()
|
|
162
|
+
const outcome = await plan(adapter)
|
|
163
|
+
expect([...templates(calls)].sort()).toEqual(['assess-complexity', 'generate-convoy', 'generate-prd', 'validate-prd'])
|
|
164
|
+
expect(outcome.problems).toEqual([])
|
|
165
|
+
})
|
|
166
|
+
|
|
167
|
+
it('runs every planning session read-only, in the project', async () => {
|
|
168
|
+
const { adapter, calls } = stubAdapter({ 'validate-prd': (_p, n) => fence(n === 1 ? { valid: false, issues: ['x'] } : { valid: true }) })
|
|
169
|
+
await plan(adapter, { critic: true })
|
|
170
|
+
expect(calls.length).toBeGreaterThan(4)
|
|
171
|
+
for (const call of calls) {
|
|
172
|
+
expect(call.permissionMode, call.template).toBe('plan')
|
|
173
|
+
expect(call.cwd, call.template).toBe(root)
|
|
174
|
+
}
|
|
175
|
+
})
|
|
176
|
+
|
|
177
|
+
it('sends the PRD to generate-convoy once', async () => {
|
|
178
|
+
const { adapter, calls } = stubAdapter()
|
|
179
|
+
await plan(adapter)
|
|
180
|
+
const prompt = calls.find((c) => c.template === 'generate-convoy')!.prompt
|
|
181
|
+
expect(prompt.match(/PRD-MARKER/g)).toHaveLength(1)
|
|
182
|
+
expect(prompt).not.toMatch(/\{\{(goal|context)\}\}/)
|
|
183
|
+
})
|
|
184
|
+
|
|
185
|
+
it('plans a small change straight from the request, with no PRD', async () => {
|
|
186
|
+
const { adapter, calls } = stubAdapter({ 'assess-complexity': fence({ ...SINGLE, complexity: 'low' }) })
|
|
187
|
+
const outcome = await plan(adapter)
|
|
188
|
+
expect(templates(calls)).toEqual(['assess-complexity', 'generate-convoy'])
|
|
189
|
+
expect(outcome.prdPath).toBeNull()
|
|
190
|
+
expect(existsSync(join(root, '.opencastle', 'prds'))).toBe(false)
|
|
191
|
+
expect(calls[1].prompt).toContain('There is no PRD: this is a small change')
|
|
192
|
+
expect(outcome.problems).toEqual([])
|
|
193
|
+
})
|
|
194
|
+
|
|
195
|
+
it('sizes a larger request once, and does not size its PRD again', async () => {
|
|
196
|
+
const { adapter, calls } = stubAdapter()
|
|
197
|
+
await plan(adapter)
|
|
198
|
+
expect(count(calls, 'assess-complexity')).toBe(1)
|
|
199
|
+
expect(templates(calls)[0]).toBe('assess-complexity')
|
|
200
|
+
})
|
|
201
|
+
|
|
202
|
+
it('fixes an invalid PRD at most twice, then plans from it anyway', async () => {
|
|
203
|
+
const { adapter, calls } = stubAdapter({ 'validate-prd': fence({ valid: false, issues: ['Overview: thin'] }) })
|
|
204
|
+
const outcome = await plan(adapter)
|
|
205
|
+
expect(count(calls, 'fix-prd')).toBe(2)
|
|
206
|
+
expect(count(calls, 'validate-prd')).toBe(3)
|
|
207
|
+
expect(calls).toHaveLength(8)
|
|
208
|
+
expect(outcome.problems).toEqual([])
|
|
209
|
+
})
|
|
210
|
+
|
|
211
|
+
it('stops fixing the PRD as soon as it passes', async () => {
|
|
212
|
+
const { adapter, calls } = stubAdapter({ 'validate-prd': (_p, n) => fence({ valid: n > 1, issues: ['x'] }) })
|
|
213
|
+
await plan(adapter)
|
|
214
|
+
expect(count(calls, 'fix-prd')).toBe(1)
|
|
215
|
+
expect(calls).toHaveLength(6)
|
|
216
|
+
})
|
|
217
|
+
|
|
218
|
+
it('asks fix-convoy only when the checks fail, and never validate-convoy', async () => {
|
|
219
|
+
const bad = { ...PLAN, tasks: [PLAN.tasks[0], { ...PLAN.tasks[1], timeout: 'soon' }] }
|
|
220
|
+
const { adapter, calls } = stubAdapter({
|
|
221
|
+
'generate-convoy': fence(bad),
|
|
222
|
+
'fix-convoy': fence([{ task_id: 'toggle', field: 'timeout', value: '10m' }]),
|
|
223
|
+
})
|
|
224
|
+
const outcome = await plan(adapter)
|
|
225
|
+
expect(count(calls, 'fix-convoy')).toBe(1)
|
|
226
|
+
expect(count(calls, 'validate-convoy')).toBe(0)
|
|
227
|
+
expect(calls).toHaveLength(5)
|
|
228
|
+
expect(outcome.problems).toEqual([])
|
|
229
|
+
})
|
|
230
|
+
|
|
231
|
+
it('retries an unreadable plan once', async () => {
|
|
232
|
+
const { adapter, calls } = stubAdapter({ 'generate-convoy': (_p, n) => (n === 1 ? 'Sorry, here you go: {' : fence(PLAN)) })
|
|
233
|
+
await plan(adapter)
|
|
234
|
+
expect(count(calls, 'generate-convoy')).toBe(2)
|
|
235
|
+
})
|
|
236
|
+
|
|
237
|
+
it('keeps the unreadable answer for inspection when the retry fails too', async () => {
|
|
238
|
+
const { adapter } = stubAdapter({ 'generate-convoy': 'not a plan' })
|
|
239
|
+
await expect(plan(adapter)).rejects.toThrow(/could not be read after a retry/)
|
|
240
|
+
expect(readdirSync(join(root, '.opencastle', 'convoys')).some((f) => f.endsWith('.task-plan.json'))).toBe(true)
|
|
241
|
+
})
|
|
242
|
+
|
|
243
|
+
it('is bounded in the worst case, and reports what is left', async () => {
|
|
244
|
+
const bad = { ...PLAN, tasks: [PLAN.tasks[0], { ...PLAN.tasks[1], timeout: 'soon' }] }
|
|
245
|
+
const { adapter, calls } = stubAdapter({
|
|
246
|
+
'validate-prd': fence({ valid: false, issues: ['x'] }),
|
|
247
|
+
'generate-convoy': (_p, n) => (n === 1 ? '```json\n{ "name": "x", "tasks": [\n```' : fence(bad)),
|
|
248
|
+
'fix-convoy': fence([{ task_id: 'toggle', field: 'timeout', value: 'later' }]),
|
|
249
|
+
})
|
|
250
|
+
const outcome = await plan(adapter, { critic: true })
|
|
251
|
+
// generate-prd, validate-prd ‖ assess, 2 × (fix-prd + validate-prd), 2 × generate-convoy, 2 × fix-convoy.
|
|
252
|
+
expect(calls).toHaveLength(11)
|
|
253
|
+
expect(count(calls, 'validate-convoy')).toBe(0) // no review of a plan that cannot run
|
|
254
|
+
expect(outcome.problems.join('\n')).toContain('timeout')
|
|
255
|
+
})
|
|
256
|
+
|
|
257
|
+
it('sequences a file conflict that survives the fix rounds instead of failing', async () => {
|
|
258
|
+
const clash = {
|
|
259
|
+
name: 'Clash',
|
|
260
|
+
tasks: [
|
|
261
|
+
{ id: 'a', prompt: 'a', files: ['src/components/'] },
|
|
262
|
+
{ id: 'b', prompt: 'b', files: ['src/components/Hero.tsx'] },
|
|
263
|
+
],
|
|
264
|
+
}
|
|
265
|
+
const { adapter, calls } = stubAdapter({ 'generate-convoy': fence(clash) })
|
|
266
|
+
const outcome = await plan(adapter)
|
|
267
|
+
expect(count(calls, 'fix-convoy')).toBe(2)
|
|
268
|
+
expect(outcome.problems).toEqual([])
|
|
269
|
+
expect(outcome.plan.tasks[1].depends_on).toEqual(['a'])
|
|
270
|
+
})
|
|
271
|
+
|
|
272
|
+
it('reviews the plan only for --yes, and keeps a revision only if it still passes', async () => {
|
|
273
|
+
const { adapter, calls } = stubAdapter({
|
|
274
|
+
'validate-convoy': fence({ valid: false, issues: ['toggle: needs the theme docs'] }),
|
|
275
|
+
'fix-convoy': fence([{ task_id: 'toggle', field: 'prompt', value: 'Add the toggle; read docs first.' }]),
|
|
276
|
+
})
|
|
277
|
+
const outcome = await plan(adapter, { critic: true })
|
|
278
|
+
expect(templates(calls).slice(-2)).toEqual(['validate-convoy', 'fix-convoy'])
|
|
279
|
+
expect(calls).toHaveLength(6)
|
|
280
|
+
expect(outcome.plan.tasks[1].prompt).toBe('Add the toggle; read docs first.')
|
|
281
|
+
|
|
282
|
+
const broken = stubAdapter({
|
|
283
|
+
'validate-convoy': fence({ valid: false, issues: ['x'] }),
|
|
284
|
+
'fix-convoy': fence([{ task_id: 'toggle', field: 'depends_on', value: ['ghost'] }]),
|
|
285
|
+
})
|
|
286
|
+
const kept = await plan(broken.adapter, { critic: true })
|
|
287
|
+
expect(kept.plan.tasks[1].depends_on).toEqual(['theme'])
|
|
288
|
+
expect(kept.problems).toEqual([])
|
|
289
|
+
})
|
|
290
|
+
})
|
|
291
|
+
|
|
292
|
+
// ── Chain groups ────────────────────────────────────────────────────────────
|
|
293
|
+
|
|
294
|
+
describe('planConvoy: groups', () => {
|
|
295
|
+
/** generate-convoy for a group waits until every group's session has started. */
|
|
296
|
+
function groupAnswers() {
|
|
297
|
+
let started = 0
|
|
298
|
+
let most = 0
|
|
299
|
+
let release!: () => void
|
|
300
|
+
const allStarted = new Promise<void>((r) => (release = r))
|
|
301
|
+
const answer = async (prompt: string) => {
|
|
302
|
+
const name = /\*\*Group name:\*\*\s*([a-z-]+)/.exec(prompt)![1]
|
|
303
|
+
started++
|
|
304
|
+
most = Math.max(most, started)
|
|
305
|
+
if (started === 3) release()
|
|
306
|
+
// Planned one after another, the first would wait here for the others,
|
|
307
|
+
// which would never start; the timeout keeps that failure from hanging.
|
|
308
|
+
await Promise.race([allStarted, new Promise((r) => setTimeout(r, 1000))])
|
|
309
|
+
return fence({
|
|
310
|
+
name,
|
|
311
|
+
tasks: [
|
|
312
|
+
{ id: 'setup', prompt: `set up ${name}`, files: [`src/${name}/setup.ts`] },
|
|
313
|
+
{ id: `work-${name}`, prompt: `work ${name}`, files: [`src/${name}/work.ts`], depends_on: ['setup'] },
|
|
314
|
+
],
|
|
315
|
+
})
|
|
316
|
+
}
|
|
317
|
+
return { answer, most: () => most }
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
it('sizes the PRD beside its review when the work is planned in groups', async () => {
|
|
321
|
+
let inFlight = 0
|
|
322
|
+
let most = 0
|
|
323
|
+
const slow = (answer: string) => async () => {
|
|
324
|
+
inFlight++
|
|
325
|
+
most = Math.max(most, inFlight)
|
|
326
|
+
await new Promise((r) => setTimeout(r, 20))
|
|
327
|
+
inFlight--
|
|
328
|
+
return answer
|
|
329
|
+
}
|
|
330
|
+
const groups = groupAnswers()
|
|
331
|
+
const { adapter } = stubAdapter({
|
|
332
|
+
'validate-prd': slow(fence({ valid: true })),
|
|
333
|
+
'assess-complexity': slow(fence(CHAIN)),
|
|
334
|
+
'generate-convoy': groups.answer,
|
|
335
|
+
})
|
|
336
|
+
await plan(adapter)
|
|
337
|
+
expect(most).toBe(2)
|
|
338
|
+
})
|
|
339
|
+
|
|
340
|
+
it('plans every group at the same time, from its own part of the PRD', async () => {
|
|
341
|
+
const groups = groupAnswers()
|
|
342
|
+
const { adapter, calls } = stubAdapter({ 'assess-complexity': fence(CHAIN), 'generate-convoy': groups.answer })
|
|
343
|
+
await plan(adapter)
|
|
344
|
+
expect(groups.most()).toBe(3)
|
|
345
|
+
expect(count(calls, 'generate-convoy')).toBe(3)
|
|
346
|
+
// The request is sized, then the PRD again: groups name the PRD's phases.
|
|
347
|
+
expect(calls).toHaveLength(7)
|
|
348
|
+
const docs = calls.find((c) => c.template === 'generate-convoy' && c.prompt.includes('**Group name:** docs'))!
|
|
349
|
+
expect(docs.prompt).not.toContain('Phase 1 — Theme')
|
|
350
|
+
})
|
|
351
|
+
|
|
352
|
+
it('joins the groups into one spec that keeps their dependencies', async () => {
|
|
353
|
+
const groups = groupAnswers()
|
|
354
|
+
const { adapter } = stubAdapter({ 'assess-complexity': fence(CHAIN), 'generate-convoy': groups.answer })
|
|
355
|
+
const outcome = await plan(adapter)
|
|
356
|
+
expect(readdirSync(join(root, '.opencastle', 'convoys')).filter((f) => f.endsWith('.convoy.yml'))).toHaveLength(1)
|
|
357
|
+
const spec = yamlParse(readFileSync(outcome.specPath, 'utf8'))
|
|
358
|
+
expect(spec.name).toBe('Dark Mode')
|
|
359
|
+
expect(spec.depends_on_convoy).toBeUndefined()
|
|
360
|
+
const byId = new Map<string, { depends_on?: string[] }>(spec.tasks.map((t: { id: string }) => [t.id, t]))
|
|
361
|
+
expect(byId.get('ui-setup')!.depends_on).toEqual(['work-theme', 'work-docs'])
|
|
362
|
+
expect(byId.get('setup')!.depends_on).toBeUndefined()
|
|
363
|
+
expect(byId.get('docs-setup')!.depends_on).toBeUndefined()
|
|
364
|
+
})
|
|
365
|
+
})
|
|
366
|
+
|
|
367
|
+
// ── The spec ────────────────────────────────────────────────────────────────
|
|
368
|
+
|
|
369
|
+
describe('planConvoy: the spec', () => {
|
|
370
|
+
it('is safe and fast by default', async () => {
|
|
371
|
+
const { adapter } = stubAdapter()
|
|
372
|
+
const outcome = await plan(adapter)
|
|
373
|
+
expect(outcome.specPath).toBe(join(root, '.opencastle', 'convoys', 'dark-mode.convoy.yml'))
|
|
374
|
+
const spec = yamlParse(readFileSync(outcome.specPath, 'utf8'))
|
|
375
|
+
expect(spec.branch).toBe('convoy/dark-mode')
|
|
376
|
+
expect(spec.on_failure).toBe('continue')
|
|
377
|
+
expect(spec.adapter).toBe('claude')
|
|
378
|
+
expect(spec.concurrency).toBe(1)
|
|
379
|
+
expect(spec.gates).toEqual(['pnpm run typecheck', 'pnpm run lint', 'pnpm run test'])
|
|
380
|
+
expect(spec.defaults.detect_drift).toBeUndefined()
|
|
381
|
+
expect(spec.defaults.built_in_gates).toBeUndefined()
|
|
382
|
+
})
|
|
383
|
+
|
|
384
|
+
it('reduces a glob the planner wrote to a directory', async () => {
|
|
385
|
+
const globbed = { ...PLAN, tasks: [{ ...PLAN.tasks[0], files: ['src/theme/**/*.ts'] }, PLAN.tasks[1]] }
|
|
386
|
+
const { adapter } = stubAdapter({ 'generate-convoy': fence(globbed) })
|
|
387
|
+
const outcome = await plan(adapter)
|
|
388
|
+
expect(outcome.plan.tasks[0].files).toEqual(['src/theme/'])
|
|
389
|
+
})
|
|
390
|
+
|
|
391
|
+
it('does not overwrite an earlier spec or PRD with the same title', async () => {
|
|
392
|
+
const first = await plan(stubAdapter().adapter)
|
|
393
|
+
const second = await plan(stubAdapter().adapter)
|
|
394
|
+
expect(second.specPath).not.toBe(first.specPath)
|
|
395
|
+
expect(second.prdPath).not.toBe(first.prdPath)
|
|
396
|
+
expect(yamlParse(readFileSync(second.specPath, 'utf8')).branch).toBe('convoy/dark-mode-2')
|
|
397
|
+
})
|
|
398
|
+
})
|
|
399
|
+
|
|
400
|
+
// ── The complexity cache ────────────────────────────────────────────────────
|
|
401
|
+
|
|
402
|
+
describe('planConvoy: the complexity cache', () => {
|
|
403
|
+
function writePrd(text: string): string {
|
|
404
|
+
const dir = join(root, '.opencastle', 'prds')
|
|
405
|
+
mkdirSync(dir, { recursive: true })
|
|
406
|
+
const path = join(dir, 'dark-mode.prd.md')
|
|
407
|
+
writeFileSync(path, text)
|
|
408
|
+
return path
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
it('assesses a PRD once, and again when its text changes', async () => {
|
|
412
|
+
const prdPath = writePrd(PRD)
|
|
413
|
+
const first = stubAdapter()
|
|
414
|
+
await plan(first.adapter, { task: undefined, prdPath })
|
|
415
|
+
expect(count(first.calls, 'assess-complexity')).toBe(1)
|
|
416
|
+
expect(count(first.calls, 'generate-prd')).toBe(0)
|
|
417
|
+
|
|
418
|
+
const second = stubAdapter()
|
|
419
|
+
await plan(second.adapter, { task: undefined, prdPath })
|
|
420
|
+
expect(count(second.calls, 'assess-complexity')).toBe(0)
|
|
421
|
+
|
|
422
|
+
writePrd(PRD + '\nOne more line.\n')
|
|
423
|
+
const third = stubAdapter()
|
|
424
|
+
await plan(third.adapter, { task: undefined, prdPath })
|
|
425
|
+
expect(count(third.calls, 'assess-complexity')).toBe(1)
|
|
426
|
+
})
|
|
427
|
+
|
|
428
|
+
it('ignores an assessment of different text at the same path', async () => {
|
|
429
|
+
const prdPath = writePrd(PRD)
|
|
430
|
+
const stale = { prd_sha256: hashPrd('a different request'), ...CHAIN }
|
|
431
|
+
writeFileSync(deriveComplexityPath(prdPath), JSON.stringify(stale))
|
|
432
|
+
const { adapter, calls } = stubAdapter()
|
|
433
|
+
await plan(adapter, { task: undefined, prdPath })
|
|
434
|
+
expect(count(calls, 'assess-complexity')).toBe(1)
|
|
435
|
+
const cached = JSON.parse(readFileSync(deriveComplexityPath(prdPath), 'utf8'))
|
|
436
|
+
expect(cached.prd_sha256).toBe(hashPrd(PRD))
|
|
437
|
+
expect(cached.recommended_strategy).toBe('single')
|
|
438
|
+
})
|
|
439
|
+
})
|
|
440
|
+
|
|
441
|
+
// ── The command ─────────────────────────────────────────────────────────────
|
|
442
|
+
|
|
443
|
+
describe('convoy "<task>": show the plan, ask once', () => {
|
|
444
|
+
let stub: ReturnType<typeof stubAdapter>
|
|
445
|
+
let output: string[]
|
|
446
|
+
|
|
447
|
+
const resolved = (adapter: AgentAdapter) => ({
|
|
448
|
+
name: 'claude',
|
|
449
|
+
adapter,
|
|
450
|
+
source: 'configured' as const,
|
|
451
|
+
detail: 'Claude Code — configured by opencastle init',
|
|
452
|
+
})
|
|
453
|
+
|
|
454
|
+
beforeEach(() => {
|
|
455
|
+
stub = stubAdapter()
|
|
456
|
+
vi.mocked(adapters.resolveAdapter).mockReset().mockResolvedValue(resolved(stub.adapter))
|
|
457
|
+
vi.spyOn(process, 'cwd').mockReturnValue(root)
|
|
458
|
+
output = []
|
|
459
|
+
vi.mocked(console.log).mockImplementation((...args: unknown[]) => void output.push(args.join(' ')))
|
|
460
|
+
vi.mocked(console.error).mockImplementation((...args: unknown[]) => void output.push(args.join(' ')))
|
|
461
|
+
})
|
|
462
|
+
|
|
463
|
+
const text = (): string => output.join('\n')
|
|
464
|
+
const specFile = (): string => join(root, '.opencastle', 'convoys', 'dark-mode.convoy.yml')
|
|
465
|
+
const runArgs = (extra: Record<string, unknown> = {}) => ({
|
|
466
|
+
spec: specFile(), dryRun: false, adapter: null, concurrency: null, verbose: false, help: false, ...extra,
|
|
467
|
+
})
|
|
468
|
+
|
|
469
|
+
it('prints the plan as a table, then the spec, then asks', async () => {
|
|
470
|
+
vi.mocked(promptModule.confirm).mockImplementation(async () => {
|
|
471
|
+
expect(text()).toMatch(/TASK\s+AGENT\s+DEPENDS ON\s+FILES/)
|
|
472
|
+
expect(text()).toMatch(/theme\s+developer\s+–\s+src\/theme\.ts/)
|
|
473
|
+
expect(text()).toMatch(/toggle\s+ui-ux-expert\s+theme\s+src\/toggle\.ts/)
|
|
474
|
+
expect(text()).toContain('.opencastle/convoys/dark-mode.convoy.yml')
|
|
475
|
+
return true
|
|
476
|
+
})
|
|
477
|
+
await planTask({ args: ['--adapter', 'claude'], pkgRoot }, 'add dark mode')
|
|
478
|
+
expect(promptModule.confirm).toHaveBeenCalledWith('Run it?', true, 'refuse')
|
|
479
|
+
// The run gets the spec by its path, on the runtime the planner chose.
|
|
480
|
+
expect(runModule.runSpec).toHaveBeenCalledWith(runArgs({ adapter: 'claude' }), { runtime: resolved(stub.adapter) })
|
|
481
|
+
expect(runModule.exitWith).toHaveBeenCalledWith(0)
|
|
482
|
+
})
|
|
483
|
+
|
|
484
|
+
it('says which runtime it plans on, once, and why', async () => {
|
|
485
|
+
vi.mocked(promptModule.confirm).mockResolvedValue(false)
|
|
486
|
+
await planTask({ args: [], pkgRoot }, 'add dark mode')
|
|
487
|
+
expect(text().match(/Claude Code — configured by opencastle init/g)).toHaveLength(1)
|
|
488
|
+
})
|
|
489
|
+
|
|
490
|
+
it('runs without asking with --yes, after the review', async () => {
|
|
491
|
+
await planTask({ args: ['--yes'], pkgRoot }, 'add dark mode')
|
|
492
|
+
expect(promptModule.confirm).not.toHaveBeenCalled()
|
|
493
|
+
expect(runModule.runSpec).toHaveBeenCalledWith(runArgs(), { runtime: resolved(stub.adapter) })
|
|
494
|
+
expect(count(stub.calls, 'validate-convoy')).toBe(1)
|
|
495
|
+
})
|
|
496
|
+
|
|
497
|
+
it('carries --concurrency through to the run', async () => {
|
|
498
|
+
await planTask({ args: ['-y', '-c', '2'], pkgRoot }, 'add dark mode')
|
|
499
|
+
expect(runModule.runSpec).toHaveBeenCalledWith(runArgs({ concurrency: 2 }), { runtime: resolved(stub.adapter) })
|
|
500
|
+
})
|
|
501
|
+
|
|
502
|
+
it('exits with the code the run ended with', async () => {
|
|
503
|
+
vi.mocked(runModule.runSpec).mockResolvedValueOnce(130)
|
|
504
|
+
await planTask({ args: ['--yes'], pkgRoot }, 'add dark mode')
|
|
505
|
+
expect(runModule.exitWith).toHaveBeenCalledWith(130)
|
|
506
|
+
})
|
|
507
|
+
|
|
508
|
+
it('does not run when nobody answers, and says how to run it later', async () => {
|
|
509
|
+
// What confirm(…, 'refuse') returns on a closed stdin.
|
|
510
|
+
vi.mocked(promptModule.confirm).mockResolvedValue(false)
|
|
511
|
+
await planTask({ args: [], pkgRoot }, 'add dark mode')
|
|
512
|
+
expect(runModule.runSpec).not.toHaveBeenCalled()
|
|
513
|
+
expect(text()).toContain('opencastle convoy run .opencastle/convoys/dark-mode.convoy.yml')
|
|
514
|
+
})
|
|
515
|
+
|
|
516
|
+
it('plans, shows and writes the spec with --dry-run, and does not run or ask', async () => {
|
|
517
|
+
await planTask({ args: ['--dry-run', '--yes'], pkgRoot }, 'add dark mode')
|
|
518
|
+
expect(existsSync(specFile())).toBe(true)
|
|
519
|
+
expect(text()).toMatch(/TASK\s+AGENT/)
|
|
520
|
+
expect(promptModule.confirm).not.toHaveBeenCalled()
|
|
521
|
+
expect(runModule.runSpec).not.toHaveBeenCalled()
|
|
522
|
+
expect(count(stub.calls, 'validate-convoy')).toBe(0)
|
|
523
|
+
expect(text()).toContain('opencastle convoy run .opencastle/convoys/dark-mode.convoy.yml')
|
|
524
|
+
})
|
|
525
|
+
|
|
526
|
+
it('resolves the runtime once for the whole plan', async () => {
|
|
527
|
+
vi.mocked(promptModule.confirm).mockResolvedValue(false)
|
|
528
|
+
await planTask({ args: [], pkgRoot }, 'add dark mode')
|
|
529
|
+
expect(adapters.resolveAdapter).toHaveBeenCalledTimes(1)
|
|
530
|
+
expect(adapters.resolveAdapter).toHaveBeenCalledWith({ projectRoot: root, explicit: null })
|
|
531
|
+
expect(stub.calls.length).toBe(4)
|
|
532
|
+
})
|
|
533
|
+
|
|
534
|
+
it('stops before planning when no runtime can be found', async () => {
|
|
535
|
+
vi.mocked(adapters.resolveAdapter).mockRejectedValue(new Error('No agent CLI found on PATH.'))
|
|
536
|
+
vi.spyOn(process, 'exit').mockImplementation(((code?: number) => {
|
|
537
|
+
throw new Error(`exit ${code}`)
|
|
538
|
+
}) as typeof process.exit)
|
|
539
|
+
await expect(planTask({ args: [], pkgRoot }, 'add dark mode')).rejects.toThrow('exit 1')
|
|
540
|
+
expect(text()).toContain('No agent CLI found on PATH.')
|
|
541
|
+
expect(stub.calls).toHaveLength(0)
|
|
542
|
+
})
|
|
543
|
+
|
|
544
|
+
it('re-plans from a PRD with convoy plan --prd, without writing a new one', async () => {
|
|
545
|
+
const prd = join(root, 'my.prd.md')
|
|
546
|
+
writeFileSync(prd, PRD)
|
|
547
|
+
vi.mocked(promptModule.confirm).mockResolvedValue(false)
|
|
548
|
+
await pipeline({ args: ['--prd', 'my.prd.md'], pkgRoot })
|
|
549
|
+
expect(count(stub.calls, 'generate-prd')).toBe(0)
|
|
550
|
+
expect(existsSync(specFile())).toBe(true)
|
|
551
|
+
})
|
|
552
|
+
|
|
553
|
+
it('does not offer to run a plan that fails its checks', async () => {
|
|
554
|
+
const bad = { ...PLAN, tasks: [PLAN.tasks[0], { ...PLAN.tasks[1], timeout: 'soon' }] }
|
|
555
|
+
stub = stubAdapter({ 'generate-convoy': fence(bad) })
|
|
556
|
+
vi.mocked(adapters.resolveAdapter).mockResolvedValue(resolved(stub.adapter))
|
|
557
|
+
const exit = vi.spyOn(process, 'exit').mockImplementation(((code?: number) => {
|
|
558
|
+
throw new Error(`exit ${code}`)
|
|
559
|
+
}) as typeof process.exit)
|
|
560
|
+
await expect(planTask({ args: ['--yes'], pkgRoot }, 'add dark mode')).rejects.toThrow('exit 1')
|
|
561
|
+
expect(exit).toHaveBeenCalledWith(1)
|
|
562
|
+
expect(runModule.runSpec).not.toHaveBeenCalled()
|
|
563
|
+
})
|
|
564
|
+
|
|
565
|
+
it.each([['--skip-validation'], ['--complexity'], ['--output-prd'], ['--output-spec'], ['--dryRun'], ['-t'], ['--text']])(
|
|
566
|
+
'no longer accepts %s',
|
|
567
|
+
async (flag) => {
|
|
568
|
+
vi.spyOn(process, 'exit').mockImplementation(((code?: number) => {
|
|
569
|
+
throw new Error(`exit ${code}`)
|
|
570
|
+
}) as typeof process.exit)
|
|
571
|
+
await expect(planTask({ args: [flag, 'value'], pkgRoot }, 'x')).rejects.toThrow('exit 1')
|
|
572
|
+
expect(stub.calls).toHaveLength(0)
|
|
573
|
+
},
|
|
574
|
+
)
|
|
575
|
+
|
|
576
|
+
it('keeps --prd for convoy plan, and refuses it beside a task', async () => {
|
|
577
|
+
vi.spyOn(process, 'exit').mockImplementation(((code?: number) => {
|
|
578
|
+
throw new Error(`exit ${code}`)
|
|
579
|
+
}) as typeof process.exit)
|
|
580
|
+
await expect(planTask({ args: ['--prd', 'my.prd.md'], pkgRoot }, 'x')).rejects.toThrow('exit 1')
|
|
581
|
+
expect(stub.calls).toHaveLength(0)
|
|
582
|
+
})
|
|
583
|
+
})
|
|
584
|
+
|
|
585
|
+
describe('the plan says what planning spent', () => {
|
|
586
|
+
const base = {
|
|
587
|
+
plan: { name: 'Tags', tasks: [{ id: 'tags', agent: 'developer', files: ['src/notes.js'], prompt: 'x', depends_on: [] }] },
|
|
588
|
+
settings: { branch: 'convoy/tags', adapter: 'claude', gates: ['npm test'] },
|
|
589
|
+
specPath: join(tmpdir(), 'tags.convoy.yml'),
|
|
590
|
+
} as unknown as Parameters<typeof renderPlan>[0]
|
|
591
|
+
|
|
592
|
+
it('gives time, sessions, tokens and cost as the runtime reported them', () => {
|
|
593
|
+
const rows = renderPlan({ ...base, planning: { sessions: 4, ms: 161_000, tokens: 812_000, costUsd: 0.84, costComplete: true } })
|
|
594
|
+
expect(rows.join('\n')).toContain('in 2m 41s · 4 sessions · 812K tokens · $0.84')
|
|
595
|
+
})
|
|
596
|
+
|
|
597
|
+
it('marks the cost a lower bound when a session reported none', () => {
|
|
598
|
+
const rows = renderPlan({ ...base, planning: { sessions: 2, ms: 9_000, tokens: 1_200, costUsd: 0.1, costComplete: false } })
|
|
599
|
+
expect(rows.join('\n')).toContain('$0.10+ (not every session reported a cost)')
|
|
600
|
+
})
|
|
601
|
+
|
|
602
|
+
it('counts the sessions planConvoy ran', async () => {
|
|
603
|
+
const { adapter } = stubAdapter()
|
|
604
|
+
const outcome = await plan(adapter)
|
|
605
|
+
expect(outcome.planning?.sessions).toBe(4)
|
|
606
|
+
})
|
|
607
|
+
})
|