opencastle 1.3.1 → 1.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
import { describe, it, expect, vi } from 'vitest';
|
|
1
|
+
import { describe, it, expect, vi, afterEach } from 'vitest';
|
|
2
|
+
import { mkdtempSync, writeFileSync, rmSync } from 'node:fs';
|
|
3
|
+
import { tmpdir } from 'node:os';
|
|
4
|
+
import { join } from 'node:path';
|
|
2
5
|
import { parse as yamlParse } from 'yaml';
|
|
3
6
|
import { parseYaml, validateSpec } from '../run/schema.js';
|
|
4
|
-
import { buildConvoyYaml, applyPatches, parseTaskPlan, parsePatches,
|
|
7
|
+
import { foldTestOnlyTasks, buildConvoyYaml, applyPatches, parseTaskPlan, parseTaskPlanWithReason, parsePatches, detectPackageManager, detectGates, planConcurrency, normalizePlanFiles, checkPlan, sequenceConflicts, mergeGroupPlans, slugify, MAX_PLANNED_CONCURRENCY, } from './spec-builder.js';
|
|
5
8
|
// ── helpers ────────────────────────────────────────────────────────────────────
|
|
9
|
+
const SETTINGS = { adapter: 'claude', branch: 'convoy/my-feature', gates: [] };
|
|
6
10
|
function minimalPlan() {
|
|
7
11
|
return {
|
|
8
12
|
name: 'My Feature',
|
|
@@ -12,88 +16,87 @@ function minimalPlan() {
|
|
|
12
16
|
function fullTask() {
|
|
13
17
|
return {
|
|
14
18
|
id: 'full-task',
|
|
15
|
-
agent: 'ui-expert',
|
|
19
|
+
agent: 'ui-ux-expert',
|
|
16
20
|
description: 'A fully-specified task',
|
|
17
21
|
files: ['src/foo.ts', 'src/bar.ts'],
|
|
18
22
|
depends_on: ['other-task'],
|
|
19
23
|
timeout: '15m',
|
|
20
24
|
max_retries: 3,
|
|
21
25
|
review: 'panel',
|
|
22
|
-
gates: ['custom-gate'],
|
|
23
|
-
built_in_gates: { secret_scan: true },
|
|
24
26
|
prompt: 'Implement the feature\n\nWith multiple paragraphs.',
|
|
25
27
|
};
|
|
26
28
|
}
|
|
29
|
+
function build(plan, settings = SETTINGS) {
|
|
30
|
+
return yamlParse(buildConvoyYaml(plan, settings));
|
|
31
|
+
}
|
|
32
|
+
const tmpDirs = [];
|
|
33
|
+
function project(files) {
|
|
34
|
+
const dir = mkdtempSync(join(tmpdir(), 'oc-spec-builder-'));
|
|
35
|
+
tmpDirs.push(dir);
|
|
36
|
+
for (const [name, text] of Object.entries(files))
|
|
37
|
+
writeFileSync(join(dir, name), text);
|
|
38
|
+
return dir;
|
|
39
|
+
}
|
|
40
|
+
afterEach(() => {
|
|
41
|
+
while (tmpDirs.length)
|
|
42
|
+
rmSync(tmpDirs.pop(), { recursive: true, force: true });
|
|
43
|
+
});
|
|
27
44
|
// ── buildConvoyYaml ────────────────────────────────────────────────────────────
|
|
28
45
|
describe('buildConvoyYaml', () => {
|
|
29
|
-
it('builds
|
|
30
|
-
const yaml = buildConvoyYaml(minimalPlan());
|
|
31
|
-
|
|
32
|
-
expect(
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
it('sets correct defaults when not specified', () => {
|
|
38
|
-
const yaml = buildConvoyYaml(minimalPlan());
|
|
39
|
-
const parsed = yamlParse(yaml);
|
|
40
|
-
expect(parsed.concurrency).toBe(2);
|
|
41
|
-
expect(parsed.on_failure).toBe('stop');
|
|
46
|
+
it('builds a spec the runner accepts from a minimal plan', () => {
|
|
47
|
+
const yaml = buildConvoyYaml(minimalPlan(), SETTINGS);
|
|
48
|
+
const result = validateSpec(parseYaml(yaml));
|
|
49
|
+
expect(result.errors).toEqual([]);
|
|
50
|
+
expect(result.valid).toBe(true);
|
|
51
|
+
});
|
|
52
|
+
it('is safe by default: own branch, continue on failure, the runtime recorded', () => {
|
|
53
|
+
const parsed = build(minimalPlan());
|
|
42
54
|
expect(parsed.version).toBe(1);
|
|
43
|
-
expect(parsed.
|
|
44
|
-
expect(parsed.defaults.max_retries).toBe(1);
|
|
45
|
-
expect(parsed.defaults.review).toBe('fast');
|
|
46
|
-
});
|
|
47
|
-
it('uses plan concurrency and on_failure when provided', () => {
|
|
48
|
-
const plan = { ...minimalPlan(), concurrency: 4, on_failure: 'continue' };
|
|
49
|
-
const parsed = yamlParse(buildConvoyYaml(plan));
|
|
50
|
-
expect(parsed.concurrency).toBe(4);
|
|
55
|
+
expect(parsed.branch).toBe('convoy/my-feature');
|
|
51
56
|
expect(parsed.on_failure).toBe('continue');
|
|
57
|
+
expect(parsed.adapter).toBe('claude');
|
|
52
58
|
});
|
|
53
|
-
it('
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
-
expect(parsed.
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
expect(parsed.branch).toBeUndefined();
|
|
59
|
+
it('switches on nothing that re-runs work per task', () => {
|
|
60
|
+
const parsed = build({ ...minimalPlan(), tasks: [{ id: 't', complexity: 13, prompt: 'Epic' }] });
|
|
61
|
+
expect(parsed.defaults.detect_drift).toBeUndefined();
|
|
62
|
+
expect(parsed.defaults.built_in_gates).toBeUndefined();
|
|
63
|
+
expect(parsed.guard).toBeUndefined();
|
|
64
|
+
expect(parsed.tasks[0].gates).toBeUndefined();
|
|
65
|
+
expect(parsed.tasks[0].built_in_gates).toBeUndefined();
|
|
61
66
|
});
|
|
62
|
-
it('
|
|
63
|
-
const
|
|
64
|
-
|
|
65
|
-
expect(parsed.
|
|
66
|
-
expect(parsed.gate_retries).toBe(2);
|
|
67
|
+
it('runs the project checks once at the end, with one fix attempt', () => {
|
|
68
|
+
const parsed = build(minimalPlan(), { ...SETTINGS, gates: ['pnpm run lint', 'pnpm run test'] });
|
|
69
|
+
expect(parsed.gates).toEqual(['pnpm run lint', 'pnpm run test']);
|
|
70
|
+
expect(parsed.gate_retries).toBe(1);
|
|
67
71
|
});
|
|
68
|
-
it('omits gates and gate_retries when
|
|
69
|
-
const parsed =
|
|
72
|
+
it('omits gates and gate_retries when the project has no checks', () => {
|
|
73
|
+
const parsed = build(minimalPlan());
|
|
70
74
|
expect(parsed.gates).toBeUndefined();
|
|
71
75
|
expect(parsed.gate_retries).toBeUndefined();
|
|
72
76
|
});
|
|
77
|
+
it('sizes concurrency to the plan', () => {
|
|
78
|
+
const wide = { name: 'w', tasks: ['a', 'b', 'c'].map((id) => ({ id, prompt: id })) };
|
|
79
|
+
expect(build(wide).concurrency).toBe(3);
|
|
80
|
+
expect(build(minimalPlan()).concurrency).toBe(1);
|
|
81
|
+
});
|
|
82
|
+
it('keeps the default timeout, retries and review', () => {
|
|
83
|
+
const parsed = build(minimalPlan());
|
|
84
|
+
expect(parsed.defaults).toEqual({ timeout: '30m', max_retries: 1, review: 'fast' });
|
|
85
|
+
});
|
|
73
86
|
it('handles tasks with all optional fields set', () => {
|
|
74
|
-
const plan = {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
{ id: 'other-task', prompt: 'Other task' },
|
|
78
|
-
fullTask(),
|
|
79
|
-
],
|
|
80
|
-
};
|
|
81
|
-
const parsed = yamlParse(buildConvoyYaml(plan));
|
|
82
|
-
const task = parsed.tasks[1];
|
|
83
|
-
expect(task.agent).toBe('ui-expert');
|
|
87
|
+
const plan = { name: 'My Feature', tasks: [{ id: 'other-task', prompt: 'Other task' }, fullTask()] };
|
|
88
|
+
const task = build(plan).tasks[1];
|
|
89
|
+
expect(task.agent).toBe('ui-ux-expert');
|
|
84
90
|
expect(task.description).toBe('A fully-specified task');
|
|
85
91
|
expect(task.files).toEqual(['src/foo.ts', 'src/bar.ts']);
|
|
86
92
|
expect(task.depends_on).toEqual(['other-task']);
|
|
87
93
|
expect(task.timeout).toBe('15m');
|
|
88
94
|
expect(task.max_retries).toBe(3);
|
|
89
95
|
expect(task.review).toBe('panel');
|
|
90
|
-
expect(task.gates).toEqual(['custom-gate']);
|
|
91
|
-
expect(task.built_in_gates).toEqual({ secret_scan: true });
|
|
92
96
|
expect(task.prompt).toBe('Implement the feature\n\nWith multiple paragraphs.');
|
|
93
97
|
});
|
|
94
98
|
it('handles tasks with only required fields (id + prompt)', () => {
|
|
95
|
-
const
|
|
96
|
-
const task = parsed.tasks[0];
|
|
99
|
+
const task = build(minimalPlan()).tasks[0];
|
|
97
100
|
expect(task.id).toBe('task-1');
|
|
98
101
|
expect(task.prompt).toBe('Do something useful');
|
|
99
102
|
expect(task.agent).toBe('developer');
|
|
@@ -103,249 +106,325 @@ describe('buildConvoyYaml', () => {
|
|
|
103
106
|
expect(task.timeout).toBeUndefined();
|
|
104
107
|
expect(task.max_retries).toBeUndefined();
|
|
105
108
|
});
|
|
106
|
-
it('
|
|
107
|
-
const yaml = buildConvoyYaml(minimalPlan());
|
|
108
|
-
expect(yaml.startsWith('#
|
|
109
|
-
|
|
110
|
-
it('comment header converts spaces and special chars to kebab-case', () => {
|
|
111
|
-
const plan = { ...minimalPlan(), name: 'My Big Feature 2' };
|
|
112
|
-
const yaml = buildConvoyYaml(plan);
|
|
113
|
-
expect(yaml.startsWith('# .opencastle/convoys/my-big-feature-2.convoy.yml\n')).toBe(true);
|
|
109
|
+
it('starts with a comment saying how to run it', () => {
|
|
110
|
+
const yaml = buildConvoyYaml(minimalPlan(), SETTINGS);
|
|
111
|
+
expect(yaml.startsWith('# Written by `opencastle convoy`.')).toBe(true);
|
|
112
|
+
expect(yaml).toContain('opencastle convoy run <this file>');
|
|
114
113
|
});
|
|
115
114
|
it('ensures prompt appears last in each task YAML block', () => {
|
|
115
|
+
const plan = { name: 'My Feature', tasks: [{ id: 'other-task', prompt: 'Other task' }, fullTask()] };
|
|
116
|
+
const yaml = buildConvoyYaml(plan, SETTINGS);
|
|
117
|
+
const promptIdx = yaml.lastIndexOf(' prompt:');
|
|
118
|
+
expect(promptIdx).toBeGreaterThan(yaml.lastIndexOf(' agent:'));
|
|
119
|
+
expect(promptIdx).toBeGreaterThan(yaml.lastIndexOf(' files:'));
|
|
120
|
+
expect(promptIdx).toBeGreaterThan(yaml.lastIndexOf(' description:'));
|
|
121
|
+
});
|
|
122
|
+
// ── complexity effort-scaling integration ────────────────────────────────────
|
|
123
|
+
it('auto-populates timeout, max_retries, review from effort table when complexity is set', () => {
|
|
124
|
+
const task = build({ name: 'E', tasks: [{ id: 'task-1', complexity: 3, prompt: 'Do something' }] }).tasks[0];
|
|
125
|
+
expect(task.timeout).toBe('15m');
|
|
126
|
+
expect(task.max_retries).toBe(2);
|
|
127
|
+
expect(task.review).toBe('fast');
|
|
128
|
+
});
|
|
129
|
+
it('does not override explicitly set fields when complexity is also set', () => {
|
|
130
|
+
const tasks = [
|
|
131
|
+
{ id: 't1', complexity: 3, timeout: '1h', prompt: 'x' },
|
|
132
|
+
{ id: 't2', complexity: 5, max_retries: 5, prompt: 'x' },
|
|
133
|
+
{ id: 't3', complexity: 8, review: 'panel', prompt: 'x' },
|
|
134
|
+
];
|
|
135
|
+
const parsed = build({ name: 'E', tasks });
|
|
136
|
+
expect(parsed.tasks[0].timeout).toBe('1h');
|
|
137
|
+
expect(parsed.tasks[1].max_retries).toBe(5);
|
|
138
|
+
expect(parsed.tasks[2].review).toBe('panel');
|
|
139
|
+
});
|
|
140
|
+
it('uses complexity-13 profile for epic tasks', () => {
|
|
141
|
+
const task = build({ name: 'E', tasks: [{ id: 'task-1', complexity: 13, prompt: 'Epic task' }] }).tasks[0];
|
|
142
|
+
expect(task.timeout).toBe('45m');
|
|
143
|
+
expect(task.max_retries).toBe(3);
|
|
144
|
+
expect(task.review).toBe('panel');
|
|
145
|
+
});
|
|
146
|
+
});
|
|
147
|
+
// ── Project checks ─────────────────────────────────────────────────────────────
|
|
148
|
+
describe('detectPackageManager', () => {
|
|
149
|
+
it('reads the packageManager field first', () => {
|
|
150
|
+
const dir = project({ 'package.json': JSON.stringify({ packageManager: 'yarn@4.1.0' }), 'pnpm-lock.yaml': '' });
|
|
151
|
+
expect(detectPackageManager(dir)).toBe('yarn');
|
|
152
|
+
});
|
|
153
|
+
it.each([
|
|
154
|
+
['pnpm-lock.yaml', 'pnpm'],
|
|
155
|
+
['yarn.lock', 'yarn'],
|
|
156
|
+
['bun.lockb', 'bun'],
|
|
157
|
+
['bun.lock', 'bun'],
|
|
158
|
+
['package-lock.json', 'npm'],
|
|
159
|
+
])('falls back to the lockfile: %s → %s', (lockfile, pm) => {
|
|
160
|
+
expect(detectPackageManager(project({ 'package.json': '{}', [lockfile]: '' }))).toBe(pm);
|
|
161
|
+
});
|
|
162
|
+
it('defaults to npm', () => {
|
|
163
|
+
expect(detectPackageManager(project({}))).toBe('npm');
|
|
164
|
+
});
|
|
165
|
+
});
|
|
166
|
+
describe('detectGates', () => {
|
|
167
|
+
it('runs typecheck, lint, test and build with the project package manager, cheapest first', () => {
|
|
168
|
+
const dir = project({
|
|
169
|
+
'package.json': JSON.stringify({
|
|
170
|
+
scripts: { build: 'tsc -b', test: 'vitest run', lint: 'eslint .', typecheck: 'tsc --noEmit', dev: 'vite' },
|
|
171
|
+
}),
|
|
172
|
+
'pnpm-lock.yaml': '',
|
|
173
|
+
});
|
|
174
|
+
expect(detectGates(dir)).toEqual(['pnpm run typecheck', 'pnpm run lint', 'pnpm run test', 'pnpm run build']);
|
|
175
|
+
});
|
|
176
|
+
it('accepts type-check as the typecheck script', () => {
|
|
177
|
+
const dir = project({ 'package.json': JSON.stringify({ scripts: { 'type-check': 'tsc' } }) });
|
|
178
|
+
expect(detectGates(dir)).toEqual(['npm run type-check']);
|
|
179
|
+
});
|
|
180
|
+
it('skips the npm init placeholder and watchers', () => {
|
|
181
|
+
const dir = project({
|
|
182
|
+
'package.json': JSON.stringify({
|
|
183
|
+
scripts: { test: 'echo "Error: no test specified" && exit 1', lint: 'eslint . --watch' },
|
|
184
|
+
}),
|
|
185
|
+
});
|
|
186
|
+
expect(detectGates(dir)).toEqual([]);
|
|
187
|
+
});
|
|
188
|
+
it('returns nothing without a package.json, or with an unreadable one', () => {
|
|
189
|
+
expect(detectGates(project({}))).toEqual([]);
|
|
190
|
+
expect(detectGates(project({ 'package.json': '{ nope' }))).toEqual([]);
|
|
191
|
+
});
|
|
192
|
+
});
|
|
193
|
+
// ── planConcurrency ────────────────────────────────────────────────────────────
|
|
194
|
+
describe('planConcurrency', () => {
|
|
195
|
+
it('is 1 for a straight chain', () => {
|
|
116
196
|
const plan = {
|
|
117
|
-
name: '
|
|
197
|
+
name: 'c',
|
|
118
198
|
tasks: [
|
|
119
|
-
{ id: '
|
|
120
|
-
|
|
199
|
+
{ id: 'a', prompt: 'a' },
|
|
200
|
+
{ id: 'b', prompt: 'b', depends_on: ['a'] },
|
|
201
|
+
{ id: 'c', prompt: 'c', depends_on: ['b'] },
|
|
121
202
|
],
|
|
122
203
|
};
|
|
123
|
-
|
|
124
|
-
// find last occurrence of prompt: which belongs to the full-task
|
|
125
|
-
const agentIdx = yaml.lastIndexOf(' agent:');
|
|
126
|
-
const filesIdx = yaml.lastIndexOf(' files:');
|
|
127
|
-
const descIdx = yaml.lastIndexOf(' description:');
|
|
128
|
-
const promptIdx = yaml.lastIndexOf(' prompt:');
|
|
129
|
-
expect(promptIdx).toBeGreaterThan(agentIdx);
|
|
130
|
-
expect(promptIdx).toBeGreaterThan(filesIdx);
|
|
131
|
-
expect(promptIdx).toBeGreaterThan(descIdx);
|
|
204
|
+
expect(planConcurrency(plan)).toBe(1);
|
|
132
205
|
});
|
|
133
|
-
it('
|
|
206
|
+
it('is the widest level of a diamond', () => {
|
|
134
207
|
const plan = {
|
|
135
|
-
name: '
|
|
136
|
-
concurrency: 3,
|
|
137
|
-
on_failure: 'continue',
|
|
138
|
-
branch: 'feat/round-trip',
|
|
139
|
-
gates: ['custom'],
|
|
140
|
-
gate_retries: 1,
|
|
208
|
+
name: 'd',
|
|
141
209
|
tasks: [
|
|
142
|
-
{ id: '
|
|
143
|
-
{ id: '
|
|
210
|
+
{ id: 'a', prompt: 'a' },
|
|
211
|
+
{ id: 'b', prompt: 'b', depends_on: ['a'] },
|
|
212
|
+
{ id: 'c', prompt: 'c', depends_on: ['a'] },
|
|
213
|
+
{ id: 'd', prompt: 'd', depends_on: ['b', 'c'] },
|
|
144
214
|
],
|
|
145
215
|
};
|
|
146
|
-
|
|
147
|
-
const spec = parseYaml(yaml);
|
|
148
|
-
const result = validateSpec(spec);
|
|
149
|
-
expect(result.valid).toBe(true);
|
|
150
|
-
expect(result.errors).toEqual([]);
|
|
216
|
+
expect(planConcurrency(plan)).toBe(2);
|
|
151
217
|
});
|
|
152
|
-
it('
|
|
153
|
-
const
|
|
154
|
-
|
|
155
|
-
expect(result.valid).toBe(true);
|
|
156
|
-
expect(result.errors).toEqual([]);
|
|
218
|
+
it('is capped', () => {
|
|
219
|
+
const plan = { name: 'w', tasks: Array.from({ length: 9 }, (_, i) => ({ id: `t${i}`, prompt: 'x' })) };
|
|
220
|
+
expect(planConcurrency(plan)).toBe(MAX_PLANNED_CONCURRENCY);
|
|
157
221
|
});
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
222
|
+
});
|
|
223
|
+
// ── Files ──────────────────────────────────────────────────────────────────────
|
|
224
|
+
describe('normalizePlanFiles', () => {
|
|
225
|
+
it('cuts a glob back to the directory before its first wildcard', () => {
|
|
226
|
+
const plan = {
|
|
227
|
+
name: 'g',
|
|
228
|
+
tasks: [{ id: 't', prompt: 'x', files: ['src/**/*.ts', 'components/*.tsx', 'docs/guide?.md'] }],
|
|
165
229
|
};
|
|
166
|
-
const
|
|
167
|
-
|
|
168
|
-
expect(
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
expect(
|
|
173
|
-
expect(
|
|
174
|
-
});
|
|
175
|
-
it('omits enrichment fields when enrichment is not provided', () => {
|
|
176
|
-
const yaml = buildConvoyYaml(minimalPlan());
|
|
177
|
-
const parsed = yamlParse(yaml);
|
|
178
|
-
expect(parsed.guard).toBeUndefined();
|
|
179
|
-
expect(parsed.defaults.circuit_breaker).toBeUndefined();
|
|
180
|
-
expect(parsed.defaults.detect_drift).toBeUndefined();
|
|
181
|
-
expect(parsed.defaults.built_in_gates).toBeUndefined();
|
|
182
|
-
expect(parsed.defaults.max_concurrent_reviews).toBeUndefined();
|
|
230
|
+
const { plan: out, notes } = normalizePlanFiles(plan);
|
|
231
|
+
expect(out.tasks[0].files).toEqual(['src/', 'components/', 'docs/']);
|
|
232
|
+
expect(notes).toHaveLength(3);
|
|
233
|
+
});
|
|
234
|
+
it('drops a pattern at the project root instead of claiming everything', () => {
|
|
235
|
+
const { plan, notes } = normalizePlanFiles({ name: 'g', tasks: [{ id: 't', prompt: 'x', files: ['*.md', 'README.md'] }] });
|
|
236
|
+
expect(plan.tasks[0].files).toEqual(['README.md']);
|
|
237
|
+
expect(notes[0]).toContain('dropped');
|
|
183
238
|
});
|
|
184
|
-
it('
|
|
185
|
-
const
|
|
239
|
+
it('leaves real paths alone, including bracketed route segments, and removes duplicates', () => {
|
|
240
|
+
const files = ['app/[slug]/page.tsx', 'src/a.ts', 'src/a.ts'];
|
|
241
|
+
const { plan, notes } = normalizePlanFiles({ name: 'g', tasks: [{ id: 't', prompt: 'x', files }] });
|
|
242
|
+
expect(plan.tasks[0].files).toEqual(['app/[slug]/page.tsx', 'src/a.ts']);
|
|
243
|
+
expect(notes).toEqual([]);
|
|
244
|
+
});
|
|
245
|
+
});
|
|
246
|
+
// ── checkPlan ──────────────────────────────────────────────────────────────────
|
|
247
|
+
describe('checkPlan', () => {
|
|
248
|
+
it('passes a sound plan', () => {
|
|
186
249
|
const plan = {
|
|
187
|
-
name: '
|
|
188
|
-
branch: 'feat/enriched',
|
|
250
|
+
name: 'ok',
|
|
189
251
|
tasks: [
|
|
190
|
-
{ id: '
|
|
191
|
-
{ id: '
|
|
252
|
+
{ id: 'a', prompt: 'a', files: ['src/a.ts'] },
|
|
253
|
+
{ id: 'b', prompt: 'b', files: ['src/b.ts'] },
|
|
254
|
+
{ id: 'c', prompt: 'c', files: ['src/a.ts'], depends_on: ['a'] },
|
|
192
255
|
],
|
|
193
256
|
};
|
|
194
|
-
|
|
195
|
-
const spec = parseYaml(yaml);
|
|
196
|
-
const result = validateSpec(spec);
|
|
197
|
-
expect(result.valid).toBe(true);
|
|
198
|
-
expect(result.errors).toEqual([]);
|
|
257
|
+
expect(checkPlan(plan, SETTINGS)).toEqual([]);
|
|
199
258
|
});
|
|
200
|
-
|
|
201
|
-
it('auto-populates timeout, max_retries, review from effort table when complexity is set', () => {
|
|
259
|
+
it('reports two tasks that can run together and claim the same file', () => {
|
|
202
260
|
const plan = {
|
|
203
|
-
name: '
|
|
204
|
-
tasks: [
|
|
261
|
+
name: 'x',
|
|
262
|
+
tasks: [
|
|
263
|
+
{ id: 'a', prompt: 'a', files: ['src/components/'] },
|
|
264
|
+
{ id: 'b', prompt: 'b', files: ['src/components/Hero.tsx'] },
|
|
265
|
+
],
|
|
205
266
|
};
|
|
206
|
-
const
|
|
207
|
-
|
|
208
|
-
expect(
|
|
209
|
-
expect(task.max_retries).toBe(2);
|
|
210
|
-
expect(task.review).toBe('fast');
|
|
267
|
+
const problems = checkPlan(plan, SETTINGS);
|
|
268
|
+
expect(problems).toHaveLength(1);
|
|
269
|
+
expect(problems[0]).toContain('"a" and "b"');
|
|
211
270
|
});
|
|
212
|
-
it('
|
|
271
|
+
it('counts a conflict across phases when nothing orders the two tasks', () => {
|
|
272
|
+
// The engine compares phase by phase: b (phase 1) and c (phase 0) passed.
|
|
273
|
+
// A scheduler that starts work as soon as it is ready can run them together.
|
|
213
274
|
const plan = {
|
|
214
|
-
name: '
|
|
215
|
-
tasks: [
|
|
275
|
+
name: 'x',
|
|
276
|
+
tasks: [
|
|
277
|
+
{ id: 'a', prompt: 'a' },
|
|
278
|
+
{ id: 'b', prompt: 'b', depends_on: ['a'], files: ['src/shared.ts'] },
|
|
279
|
+
{ id: 'c', prompt: 'c', files: ['src/shared.ts'] },
|
|
280
|
+
],
|
|
216
281
|
};
|
|
217
|
-
|
|
218
|
-
expect(parsed.tasks[0].timeout).toBe('1h');
|
|
282
|
+
expect(checkPlan(plan, SETTINGS)).toHaveLength(1);
|
|
219
283
|
});
|
|
220
|
-
it('
|
|
284
|
+
it('accepts shared files when one task waits for the other through a third', () => {
|
|
221
285
|
const plan = {
|
|
222
|
-
name: '
|
|
223
|
-
tasks: [
|
|
286
|
+
name: 'x',
|
|
287
|
+
tasks: [
|
|
288
|
+
{ id: 'a', prompt: 'a', files: ['src/shared.ts'] },
|
|
289
|
+
{ id: 'b', prompt: 'b', depends_on: ['a'] },
|
|
290
|
+
{ id: 'c', prompt: 'c', depends_on: ['b'], files: ['src/shared.ts'] },
|
|
291
|
+
],
|
|
224
292
|
};
|
|
225
|
-
|
|
226
|
-
expect(parsed.tasks[0].max_retries).toBe(5);
|
|
293
|
+
expect(checkPlan(plan, SETTINGS)).toEqual([]);
|
|
227
294
|
});
|
|
228
|
-
it('
|
|
295
|
+
it('compares paths without regard to case', () => {
|
|
229
296
|
const plan = {
|
|
230
|
-
name: '
|
|
231
|
-
tasks: [
|
|
297
|
+
name: 'x',
|
|
298
|
+
tasks: [
|
|
299
|
+
{ id: 'a', prompt: 'a', files: ['README.md'] },
|
|
300
|
+
{ id: 'b', prompt: 'b', files: ['readme.md'] },
|
|
301
|
+
],
|
|
232
302
|
};
|
|
233
|
-
|
|
234
|
-
expect(parsed.tasks[0].review).toBe('panel');
|
|
303
|
+
expect(checkPlan(plan, SETTINGS)).toHaveLength(1);
|
|
235
304
|
});
|
|
236
|
-
it('
|
|
237
|
-
const
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
305
|
+
it('reports globs, absolute paths and paths that leave the project', () => {
|
|
306
|
+
const plan = {
|
|
307
|
+
name: 'x',
|
|
308
|
+
tasks: [{ id: 'a', prompt: 'a', files: ['src/*.ts', '/etc/hosts', 'C:\\x', '../outside.ts'] }],
|
|
309
|
+
};
|
|
310
|
+
const problems = checkPlan(plan, SETTINGS).join('\n');
|
|
311
|
+
expect(problems).toContain('"src/*.ts" is a pattern');
|
|
312
|
+
expect(problems).toContain('"/etc/hosts" must be relative');
|
|
313
|
+
expect(problems).toContain('"C:\\x" must be relative');
|
|
314
|
+
expect(problems).toContain('..');
|
|
315
|
+
});
|
|
316
|
+
it('reports what the runner would reject, such as a bad timeout', () => {
|
|
317
|
+
const problems = checkPlan({ name: 'x', tasks: [{ id: 'a', prompt: 'a', timeout: 'soon' }] }, SETTINGS);
|
|
318
|
+
expect(problems.join('\n')).toContain('Schema:');
|
|
319
|
+
});
|
|
320
|
+
it('reports unknown dependencies and cycles', () => {
|
|
321
|
+
expect(checkPlan({ name: 'x', tasks: [{ id: 'a', prompt: 'a', depends_on: ['ghost'] }] }, SETTINGS)[0]).toContain('ghost');
|
|
322
|
+
const cycle = {
|
|
323
|
+
name: 'x',
|
|
324
|
+
tasks: [
|
|
325
|
+
{ id: 'a', prompt: 'a', depends_on: ['b'] },
|
|
326
|
+
{ id: 'b', prompt: 'b', depends_on: ['a'] },
|
|
327
|
+
],
|
|
328
|
+
};
|
|
329
|
+
expect(checkPlan(cycle, SETTINGS)[0]).toContain('cycle');
|
|
242
330
|
});
|
|
243
|
-
|
|
331
|
+
});
|
|
332
|
+
describe('sequenceConflicts', () => {
|
|
333
|
+
it('makes the later task wait for the earlier, leaving a plan that passes', () => {
|
|
244
334
|
const plan = {
|
|
245
|
-
name: '
|
|
246
|
-
tasks: [
|
|
335
|
+
name: 'x',
|
|
336
|
+
tasks: [
|
|
337
|
+
{ id: 'a', prompt: 'a', files: ['src/components/'] },
|
|
338
|
+
{ id: 'b', prompt: 'b', files: ['src/components/Hero.tsx'] },
|
|
339
|
+
{ id: 'c', prompt: 'c', files: ['src/components/Card.tsx'] },
|
|
340
|
+
{ id: 'd', prompt: 'd', files: ['src/other.ts'] },
|
|
341
|
+
],
|
|
247
342
|
};
|
|
248
|
-
const
|
|
249
|
-
|
|
250
|
-
expect(
|
|
251
|
-
expect(
|
|
252
|
-
expect(
|
|
343
|
+
const { plan: out, added } = sequenceConflicts(plan);
|
|
344
|
+
expect(checkPlan(out, SETTINGS)).toEqual([]);
|
|
345
|
+
expect(added.length).toBeGreaterThan(0);
|
|
346
|
+
expect(out.tasks.find((t) => t.id === 'd').depends_on ?? []).toEqual([]);
|
|
347
|
+
expect(parseTaskPlan(JSON.stringify(out))).not.toBeNull(); // still acyclic
|
|
348
|
+
expect(plan.tasks[1].depends_on).toBeUndefined(); // input untouched
|
|
349
|
+
});
|
|
350
|
+
it('changes nothing when there is no conflict', () => {
|
|
351
|
+
expect(sequenceConflicts(minimalPlan()).added).toEqual([]);
|
|
352
|
+
});
|
|
353
|
+
});
|
|
354
|
+
// ── mergeGroupPlans ────────────────────────────────────────────────────────────
|
|
355
|
+
describe('mergeGroupPlans', () => {
|
|
356
|
+
const group = (name, prefix) => ({
|
|
357
|
+
name,
|
|
358
|
+
tasks: [
|
|
359
|
+
{ id: 'setup', prompt: `set up ${name}`, files: [`${prefix}/setup.ts`] },
|
|
360
|
+
{ id: `work-${name}`, prompt: `work ${name}`, files: [`${prefix}/work.ts`], depends_on: ['setup'] },
|
|
361
|
+
],
|
|
362
|
+
});
|
|
363
|
+
const merged = mergeGroupPlans('Feature', [
|
|
364
|
+
{ name: 'theme', depends_on: [], plan: group('theme', 'src/theme') },
|
|
365
|
+
{ name: 'docs', depends_on: [], plan: group('docs', 'docs') },
|
|
366
|
+
{ name: 'ui', depends_on: ['theme', 'docs'], plan: group('ui', 'src/ui') },
|
|
367
|
+
]);
|
|
368
|
+
const byId = new Map(merged.tasks.map((t) => [t.id, t]));
|
|
369
|
+
it('renames a clashing id within its own group', () => {
|
|
370
|
+
expect([...byId.keys()]).toEqual(['setup', 'work-theme', 'docs-setup', 'work-docs', 'ui-setup', 'work-ui']);
|
|
371
|
+
expect(byId.get('work-docs').depends_on).toEqual(['docs-setup']);
|
|
372
|
+
});
|
|
373
|
+
it('makes a group start after the last tasks of the groups it depends on', () => {
|
|
374
|
+
expect(byId.get('ui-setup').depends_on).toEqual(['work-theme', 'work-docs']);
|
|
375
|
+
expect(byId.get('work-ui').depends_on).toEqual(['ui-setup']);
|
|
376
|
+
});
|
|
377
|
+
it('adds nothing between independent groups, so they run side by side', () => {
|
|
378
|
+
expect(byId.get('setup').depends_on).toEqual([]);
|
|
379
|
+
expect(byId.get('docs-setup').depends_on).toEqual([]);
|
|
380
|
+
expect(planConcurrency(merged)).toBe(2);
|
|
381
|
+
});
|
|
382
|
+
it('is one plan that passes the checks and writes plain YAML', () => {
|
|
383
|
+
expect(merged.name).toBe('Feature');
|
|
384
|
+
expect(checkPlan(merged, SETTINGS)).toEqual([]);
|
|
385
|
+
expect(buildConvoyYaml(merged, SETTINGS)).not.toMatch(/[&*]a\d/);
|
|
386
|
+
});
|
|
387
|
+
});
|
|
388
|
+
describe('slugify', () => {
|
|
389
|
+
it('kebab-cases a name', () => {
|
|
390
|
+
expect(slugify('My Big Feature 2!')).toBe('my-big-feature-2');
|
|
253
391
|
});
|
|
254
392
|
});
|
|
255
393
|
// ── applyPatches ──────────────────────────────────────────────────────────────
|
|
256
394
|
describe('applyPatches', () => {
|
|
257
395
|
it('patches a task-level field (prompt)', () => {
|
|
258
|
-
const
|
|
259
|
-
const patched = applyPatches(plan, [
|
|
260
|
-
{ task_id: 'task-1', field: 'prompt', value: 'Updated prompt' },
|
|
261
|
-
]);
|
|
396
|
+
const patched = applyPatches(minimalPlan(), [{ task_id: 'task-1', field: 'prompt', value: 'Updated prompt' }]);
|
|
262
397
|
expect(patched.tasks[0].prompt).toBe('Updated prompt');
|
|
263
398
|
});
|
|
264
399
|
it('patches task depends_on', () => {
|
|
265
|
-
const plan = {
|
|
266
|
-
|
|
267
|
-
tasks: [
|
|
268
|
-
{ id: 'task-1', prompt: 'First' },
|
|
269
|
-
{ id: 'task-2', prompt: 'Second' },
|
|
270
|
-
],
|
|
271
|
-
};
|
|
272
|
-
const patched = applyPatches(plan, [
|
|
273
|
-
{ task_id: 'task-2', field: 'depends_on', value: ['task-1'] },
|
|
274
|
-
]);
|
|
400
|
+
const plan = { name: 'Test', tasks: [{ id: 'task-1', prompt: 'First' }, { id: 'task-2', prompt: 'Second' }] };
|
|
401
|
+
const patched = applyPatches(plan, [{ task_id: 'task-2', field: 'depends_on', value: ['task-1'] }]);
|
|
275
402
|
expect(patched.tasks[1].depends_on).toEqual(['task-1']);
|
|
276
403
|
});
|
|
277
|
-
it('
|
|
278
|
-
const
|
|
279
|
-
|
|
280
|
-
{ task_id: '_plan', field: 'concurrency', value: 5 },
|
|
281
|
-
]);
|
|
282
|
-
expect(patched.concurrency).toBe(5);
|
|
283
|
-
});
|
|
284
|
-
it('patches a top-level string field (_plan)', () => {
|
|
285
|
-
const plan = minimalPlan();
|
|
286
|
-
const patched = applyPatches(plan, [
|
|
287
|
-
{ task_id: '_plan', field: 'branch', value: 'feat/patched-branch' },
|
|
288
|
-
]);
|
|
289
|
-
expect(patched.branch).toBe('feat/patched-branch');
|
|
290
|
-
});
|
|
291
|
-
it('leaves task unchanged when task id does not exist', () => {
|
|
292
|
-
const warnSpy = vi.spyOn(console, 'warn').mockImplementation(() => { });
|
|
293
|
-
const plan = minimalPlan();
|
|
294
|
-
const patched = applyPatches(plan, [
|
|
295
|
-
{ task_id: 'nonexistent', field: 'prompt', value: 'x' },
|
|
296
|
-
]);
|
|
297
|
-
expect(patched.tasks[0].prompt).toBe('Do something useful');
|
|
298
|
-
warnSpy.mockRestore();
|
|
404
|
+
it('renames the plan through _plan', () => {
|
|
405
|
+
const patched = applyPatches(minimalPlan(), [{ task_id: '_plan', field: 'name', value: 'Renamed' }]);
|
|
406
|
+
expect(patched.name).toBe('Renamed');
|
|
299
407
|
});
|
|
300
408
|
it('returns a new object (original plan unchanged)', () => {
|
|
301
409
|
const plan = minimalPlan();
|
|
302
|
-
const patched = applyPatches(plan, [
|
|
303
|
-
{ task_id: 'task-1', field: 'prompt', value: 'New prompt' },
|
|
304
|
-
]);
|
|
410
|
+
const patched = applyPatches(plan, [{ task_id: 'task-1', field: 'prompt', value: 'New prompt' }]);
|
|
305
411
|
expect(patched).not.toBe(plan);
|
|
306
412
|
expect(plan.tasks[0].prompt).toBe('Do something useful');
|
|
307
413
|
});
|
|
308
414
|
it('applies multiple patches in order', () => {
|
|
309
|
-
const plan = {
|
|
310
|
-
name: 'Test',
|
|
311
|
-
tasks: [
|
|
312
|
-
{ id: 'task-1', prompt: 'First' },
|
|
313
|
-
{ id: 'task-2', prompt: 'Second' },
|
|
314
|
-
],
|
|
315
|
-
};
|
|
415
|
+
const plan = { name: 'Test', tasks: [{ id: 'task-1', prompt: 'First' }, { id: 'task-2', prompt: 'Second' }] };
|
|
316
416
|
const patches = [
|
|
317
417
|
{ task_id: 'task-1', field: 'prompt', value: 'Patched first' },
|
|
318
|
-
{ task_id: 'task-2', field: 'agent', value: 'ui-expert' },
|
|
319
|
-
{ task_id: '
|
|
418
|
+
{ task_id: 'task-2', field: 'agent', value: 'ui-ux-expert' },
|
|
419
|
+
{ task_id: 'task-2', field: 'agent', value: 'writer' },
|
|
320
420
|
];
|
|
321
421
|
const patched = applyPatches(plan, patches);
|
|
322
422
|
expect(patched.tasks[0].prompt).toBe('Patched first');
|
|
323
|
-
expect(patched.tasks[1].agent).toBe('
|
|
324
|
-
expect(patched.on_failure).toBe('continue');
|
|
423
|
+
expect(patched.tasks[1].agent).toBe('writer');
|
|
325
424
|
});
|
|
326
|
-
it('warns
|
|
327
|
-
const plan = {
|
|
328
|
-
name: 'test',
|
|
329
|
-
tasks: [{ id: 'task-1', prompt: 'do something' }],
|
|
330
|
-
};
|
|
331
|
-
const warnSpy = vi.spyOn(console, 'warn').mockImplementation(() => { });
|
|
332
|
-
const result = applyPatches(plan, [
|
|
333
|
-
{ task_id: 'nonexistent', field: 'prompt', value: 'new prompt' },
|
|
334
|
-
]);
|
|
335
|
-
expect(warnSpy).toHaveBeenCalledWith(expect.stringContaining('nonexistent'));
|
|
336
|
-
// Original task unchanged
|
|
337
|
-
expect(result.tasks[0].prompt).toBe('do something');
|
|
338
|
-
warnSpy.mockRestore();
|
|
339
|
-
});
|
|
340
|
-
it('applies valid patches and warns for invalid ones', () => {
|
|
341
|
-
const plan = {
|
|
342
|
-
name: 'test',
|
|
343
|
-
tasks: [
|
|
344
|
-
{ id: 'task-1', prompt: 'original' },
|
|
345
|
-
{ id: 'task-2', prompt: 'original2' },
|
|
346
|
-
],
|
|
347
|
-
};
|
|
425
|
+
it('warns about, and skips, a patch for an unknown task', () => {
|
|
348
426
|
const warnSpy = vi.spyOn(console, 'warn').mockImplementation(() => { });
|
|
427
|
+
const plan = { name: 'test', tasks: [{ id: 'task-1', prompt: 'original' }] };
|
|
349
428
|
const result = applyPatches(plan, [
|
|
350
429
|
{ task_id: 'task-1', field: 'prompt', value: 'updated' },
|
|
351
430
|
{ task_id: 'ghost', field: 'prompt', value: 'nope' },
|
|
@@ -355,14 +434,8 @@ describe('applyPatches', () => {
|
|
|
355
434
|
warnSpy.mockRestore();
|
|
356
435
|
});
|
|
357
436
|
it('does not warn when all patches target valid tasks', () => {
|
|
358
|
-
const plan = {
|
|
359
|
-
name: 'test',
|
|
360
|
-
tasks: [{ id: 'task-1', prompt: 'original' }],
|
|
361
|
-
};
|
|
362
437
|
const warnSpy = vi.spyOn(console, 'warn').mockImplementation(() => { });
|
|
363
|
-
applyPatches(
|
|
364
|
-
{ task_id: 'task-1', field: 'prompt', value: 'updated' },
|
|
365
|
-
]);
|
|
438
|
+
applyPatches(minimalPlan(), [{ task_id: 'task-1', field: 'prompt', value: 'updated' }]);
|
|
366
439
|
expect(warnSpy).not.toHaveBeenCalled();
|
|
367
440
|
warnSpy.mockRestore();
|
|
368
441
|
});
|
|
@@ -370,111 +443,44 @@ describe('applyPatches', () => {
|
|
|
370
443
|
// ── parseTaskPlan ──────────────────────────────────────────────────────────────
|
|
371
444
|
describe('parseTaskPlan', () => {
|
|
372
445
|
it('parses a valid plan successfully', () => {
|
|
373
|
-
const
|
|
374
|
-
name: 'My Plan',
|
|
375
|
-
tasks: [{ id: 'task-1', prompt: 'Do the thing' }],
|
|
376
|
-
});
|
|
377
|
-
const result = parseTaskPlan(json);
|
|
378
|
-
expect(result).not.toBeNull();
|
|
446
|
+
const result = parseTaskPlan(JSON.stringify({ name: 'My Plan', tasks: [{ id: 'task-1', prompt: 'Do the thing' }] }));
|
|
379
447
|
expect(result.name).toBe('My Plan');
|
|
380
448
|
expect(result.tasks).toHaveLength(1);
|
|
381
449
|
});
|
|
382
|
-
it('
|
|
383
|
-
const json = JSON.stringify({
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
gates: ['lint'],
|
|
389
|
-
gate_retries: 2,
|
|
390
|
-
tasks: [{ id: 't1', prompt: 'prompt', agent: 'developer', files: ['a.ts'] }],
|
|
391
|
-
});
|
|
392
|
-
const result = parseTaskPlan(json);
|
|
393
|
-
expect(result).not.toBeNull();
|
|
394
|
-
expect(result.branch).toBe('feat/full');
|
|
395
|
-
expect(result.concurrency).toBe(3);
|
|
396
|
-
});
|
|
397
|
-
it('returns null for empty string', () => {
|
|
398
|
-
expect(parseTaskPlan('')).toBeNull();
|
|
399
|
-
});
|
|
400
|
-
it('returns null for invalid JSON', () => {
|
|
401
|
-
expect(parseTaskPlan('{not valid json')).toBeNull();
|
|
402
|
-
});
|
|
403
|
-
it('returns null when name is missing', () => {
|
|
404
|
-
const json = JSON.stringify({ tasks: [{ id: 't1', prompt: 'p' }] });
|
|
405
|
-
expect(parseTaskPlan(json)).toBeNull();
|
|
406
|
-
});
|
|
407
|
-
it('returns null when name is not a string', () => {
|
|
408
|
-
const json = JSON.stringify({ name: 42, tasks: [{ id: 't1', prompt: 'p' }] });
|
|
409
|
-
expect(parseTaskPlan(json)).toBeNull();
|
|
410
|
-
});
|
|
411
|
-
it('returns null for empty tasks array', () => {
|
|
412
|
-
const json = JSON.stringify({ name: 'Test', tasks: [] });
|
|
413
|
-
expect(parseTaskPlan(json)).toBeNull();
|
|
414
|
-
});
|
|
415
|
-
it('returns null when tasks is missing', () => {
|
|
416
|
-
const json = JSON.stringify({ name: 'Test' });
|
|
417
|
-
expect(parseTaskPlan(json)).toBeNull();
|
|
418
|
-
});
|
|
419
|
-
it('returns null for task missing id', () => {
|
|
420
|
-
const json = JSON.stringify({ name: 'Test', tasks: [{ prompt: 'p' }] });
|
|
421
|
-
expect(parseTaskPlan(json)).toBeNull();
|
|
422
|
-
});
|
|
423
|
-
it('returns null for task missing prompt', () => {
|
|
424
|
-
const json = JSON.stringify({ name: 'Test', tasks: [{ id: 't1' }] });
|
|
425
|
-
expect(parseTaskPlan(json)).toBeNull();
|
|
426
|
-
});
|
|
427
|
-
it('returns null for task with non-string id', () => {
|
|
428
|
-
const json = JSON.stringify({ name: 'Test', tasks: [{ id: 1, prompt: 'p' }] });
|
|
429
|
-
expect(parseTaskPlan(json)).toBeNull();
|
|
430
|
-
});
|
|
431
|
-
it('returns null when JSON is surrounded by text', () => {
|
|
432
|
-
const json = JSON.stringify({ name: 'Test', tasks: [{ id: 't1', prompt: 'p' }] });
|
|
433
|
-
const wrapped = `Here is the plan:\n${json}\nHope this helps!`;
|
|
434
|
-
expect(parseTaskPlan(wrapped)).toBeNull();
|
|
435
|
-
});
|
|
436
|
-
it('returns null when trailing garbage present', () => {
|
|
437
|
-
const json = JSON.stringify({ name: 'Test', tasks: [{ id: 't1', prompt: 'p' }] });
|
|
438
|
-
const withTrailing = json + '\n```\nSome extra text';
|
|
439
|
-
expect(parseTaskPlan(withTrailing)).toBeNull();
|
|
450
|
+
it('ignores run settings a planner adds, which the code decides', () => {
|
|
451
|
+
const json = JSON.stringify({ name: 'P', branch: 'main', on_failure: 'stop', tasks: [{ id: 't1', prompt: 'p' }] });
|
|
452
|
+
const plan = parseTaskPlan(json);
|
|
453
|
+
const parsed = build(plan);
|
|
454
|
+
expect(parsed.branch).toBe(SETTINGS.branch);
|
|
455
|
+
expect(parsed.on_failure).toBe('continue');
|
|
440
456
|
});
|
|
441
|
-
it(
|
|
457
|
+
it.each([
|
|
458
|
+
['empty string', ''],
|
|
459
|
+
['invalid JSON', '{not valid json'],
|
|
460
|
+
['missing name', JSON.stringify({ tasks: [{ id: 't1', prompt: 'p' }] })],
|
|
461
|
+
['non-string name', JSON.stringify({ name: 42, tasks: [{ id: 't1', prompt: 'p' }] })],
|
|
462
|
+
['empty tasks', JSON.stringify({ name: 'Test', tasks: [] })],
|
|
463
|
+
['missing tasks', JSON.stringify({ name: 'Test' })],
|
|
464
|
+
['task missing id', JSON.stringify({ name: 'Test', tasks: [{ prompt: 'p' }] })],
|
|
465
|
+
['task missing prompt', JSON.stringify({ name: 'Test', tasks: [{ id: 't1' }] })],
|
|
466
|
+
['non-string id', JSON.stringify({ name: 'Test', tasks: [{ id: 1, prompt: 'p' }] })],
|
|
467
|
+
['surrounding text', `Here is the plan:\n${JSON.stringify({ name: 'T', tasks: [{ id: 't', prompt: 'p' }] })}\nHope this helps!`],
|
|
468
|
+
])('returns null for %s', (_label, text) => {
|
|
442
469
|
const warnSpy = vi.spyOn(console, 'warn').mockImplementation(() => { });
|
|
443
|
-
|
|
444
|
-
name: 'test',
|
|
445
|
-
tasks: [
|
|
446
|
-
{ id: 'setup', prompt: 'Do setup' },
|
|
447
|
-
{ id: 'setup', prompt: 'Do setup again' },
|
|
448
|
-
],
|
|
449
|
-
});
|
|
450
|
-
expect(parseTaskPlan(plan)).toBeNull();
|
|
451
|
-
expect(warnSpy).toHaveBeenCalledWith(expect.stringContaining('setup'));
|
|
470
|
+
expect(parseTaskPlan(text)).toBeNull();
|
|
452
471
|
warnSpy.mockRestore();
|
|
453
472
|
});
|
|
454
|
-
it('
|
|
455
|
-
const
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
],
|
|
462
|
-
});
|
|
463
|
-
expect(parseTaskPlan(plan)).toBeNull();
|
|
464
|
-
expect(warnSpy).toHaveBeenCalledWith(expect.stringContaining('nonexistent'));
|
|
465
|
-
warnSpy.mockRestore();
|
|
473
|
+
it('names duplicate ids, unknown dependencies and cycles in the reason', () => {
|
|
474
|
+
const dup = parseTaskPlanWithReason(JSON.stringify({ name: 't', tasks: [{ id: 'setup', prompt: 'a' }, { id: 'setup', prompt: 'b' }] }));
|
|
475
|
+
expect(dup.reason).toContain('setup');
|
|
476
|
+
const unknown = parseTaskPlanWithReason(JSON.stringify({ name: 't', tasks: [{ id: 'b', prompt: 'b', depends_on: ['nonexistent'] }] }));
|
|
477
|
+
expect(unknown.reason).toContain('nonexistent');
|
|
478
|
+
const cycle = parseTaskPlanWithReason(JSON.stringify({ name: 't', tasks: [{ id: 'a', prompt: 'a', depends_on: ['b'] }, { id: 'b', prompt: 'b', depends_on: ['a'] }] }));
|
|
479
|
+
expect(cycle.reason).toContain('cycle');
|
|
466
480
|
});
|
|
467
|
-
it('
|
|
481
|
+
it('reports a truncated answer as truncated', () => {
|
|
468
482
|
const warnSpy = vi.spyOn(console, 'warn').mockImplementation(() => { });
|
|
469
|
-
|
|
470
|
-
name: 'test',
|
|
471
|
-
tasks: [
|
|
472
|
-
{ id: 'a', prompt: 'Do A', depends_on: ['b'] },
|
|
473
|
-
{ id: 'b', prompt: 'Do B', depends_on: ['a'] },
|
|
474
|
-
],
|
|
475
|
-
});
|
|
476
|
-
expect(parseTaskPlan(plan)).toBeNull();
|
|
477
|
-
expect(warnSpy).toHaveBeenCalledWith(expect.stringContaining('cycle'));
|
|
483
|
+
expect(parseTaskPlanWithReason('{ "name": "x", "tasks": [').reason).toContain('truncated');
|
|
478
484
|
warnSpy.mockRestore();
|
|
479
485
|
});
|
|
480
486
|
it('accepts valid plan with correct dependencies', () => {
|
|
@@ -486,9 +492,7 @@ describe('parseTaskPlan', () => {
|
|
|
486
492
|
{ id: 'c', prompt: 'Do C', depends_on: ['a', 'b'] },
|
|
487
493
|
],
|
|
488
494
|
});
|
|
489
|
-
|
|
490
|
-
expect(result).not.toBeNull();
|
|
491
|
-
expect(result.tasks).toHaveLength(3);
|
|
495
|
+
expect(parseTaskPlan(plan).tasks).toHaveLength(3);
|
|
492
496
|
});
|
|
493
497
|
});
|
|
494
498
|
// ── parsePatches ──────────────────────────────────────────────────────────────
|
|
@@ -496,106 +500,86 @@ describe('parsePatches', () => {
|
|
|
496
500
|
it('parses a valid patches array successfully', () => {
|
|
497
501
|
const json = JSON.stringify([
|
|
498
502
|
{ task_id: 'task-1', field: 'prompt', value: 'New prompt' },
|
|
499
|
-
{ task_id: '_plan', field: '
|
|
503
|
+
{ task_id: '_plan', field: 'name', value: 'Renamed' },
|
|
500
504
|
]);
|
|
501
505
|
const result = parsePatches(json);
|
|
502
|
-
expect(result).not.toBeNull();
|
|
503
506
|
expect(result).toHaveLength(2);
|
|
504
507
|
expect(result[0].task_id).toBe('task-1');
|
|
505
|
-
expect(result[1].value).toBe(
|
|
508
|
+
expect(result[1].value).toBe('Renamed');
|
|
506
509
|
});
|
|
507
510
|
it('parses empty array', () => {
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
511
|
+
expect(parsePatches('[]')).toEqual([]);
|
|
512
|
+
});
|
|
513
|
+
it.each([
|
|
514
|
+
['non-array JSON', JSON.stringify({ task_id: 't1', field: 'f', value: 'v' })],
|
|
515
|
+
['invalid JSON', '{bad'],
|
|
516
|
+
['empty string', ''],
|
|
517
|
+
['missing task_id', JSON.stringify([{ field: 'prompt', value: 'x' }])],
|
|
518
|
+
['missing field', JSON.stringify([{ task_id: 'task-1', value: 'x' }])],
|
|
519
|
+
['missing value', JSON.stringify([{ task_id: 'task-1', field: 'prompt' }])],
|
|
520
|
+
['one bad patch among good', JSON.stringify([{ task_id: 'a', field: 'prompt', value: 'ok' }, { task_id: 'b', field: 'prompt' }])],
|
|
521
|
+
])('returns null for %s', (_label, text) => {
|
|
522
|
+
expect(parsePatches(text)).toBeNull();
|
|
514
523
|
});
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
});
|
|
518
|
-
it('
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
524
|
+
});
|
|
525
|
+
describe('foldTestOnlyTasks', () => {
|
|
526
|
+
const t = (id, files, depends_on = [], agent = 'developer') => ({ id, agent, files, depends_on, prompt: `do ${id}` });
|
|
527
|
+
it('folds a test-only task into the task it tests, as three real plans split them', () => {
|
|
528
|
+
// The plan a real run produced for pagination and DELETE /notes.
|
|
529
|
+
const { plan, folded } = foldTestOnlyTasks({
|
|
530
|
+
name: 'x',
|
|
531
|
+
tasks: [
|
|
532
|
+
t('store', ['src/notes.js']),
|
|
533
|
+
t('routes', ['src/server.js'], ['store']),
|
|
534
|
+
t('unit-tests', ['test/notes.test.js'], ['store'], 'testing-expert'),
|
|
535
|
+
t('http-tests', ['test/server.test.js'], ['routes'], 'testing-expert'),
|
|
536
|
+
],
|
|
537
|
+
});
|
|
538
|
+
expect(folded).toEqual([['unit-tests', 'store'], ['http-tests', 'routes']]);
|
|
539
|
+
expect(plan.tasks.map((x) => x.id)).toEqual(['store', 'routes']);
|
|
540
|
+
expect(plan.tasks[0]).toMatchObject({ files: ['src/notes.js', 'test/notes.test.js'], agent: 'developer' });
|
|
541
|
+
expect(plan.tasks[0].prompt).toContain('do store');
|
|
542
|
+
expect(plan.tasks[0].prompt).toContain('do unit-tests');
|
|
543
|
+
});
|
|
544
|
+
it('points tasks that waited on the tests at the merged task', () => {
|
|
545
|
+
const { plan } = foldTestOnlyTasks({
|
|
546
|
+
name: 'x',
|
|
547
|
+
tasks: [t('api', ['src/api.ts']), t('api-tests', ['src/api.test.ts'], ['api']), t('docs', ['README.md'], ['api-tests'])],
|
|
548
|
+
});
|
|
549
|
+
expect(plan.tasks.find((x) => x.id === 'docs')?.depends_on).toEqual(['api']);
|
|
528
550
|
});
|
|
529
|
-
it('
|
|
530
|
-
|
|
531
|
-
|
|
551
|
+
it('folds tests that list a task and something that task already waits on', () => {
|
|
552
|
+
// The plan a later real run produced: the integration tests named both the
|
|
553
|
+
// store change and the routes built on it, so they test the routes.
|
|
554
|
+
const { plan, folded } = foldTestOnlyTasks({
|
|
555
|
+
name: 'x',
|
|
556
|
+
tasks: [
|
|
557
|
+
t('store', ['src/notes.js']),
|
|
558
|
+
t('routes', ['src/server.js'], ['store']),
|
|
559
|
+
t('http-tests', ['test/server.test.js'], ['store', 'routes'], 'testing-expert'),
|
|
560
|
+
],
|
|
561
|
+
});
|
|
562
|
+
expect(folded).toEqual([['http-tests', 'routes']]);
|
|
563
|
+
expect(plan.tasks.map((x) => x.id)).toEqual(['store', 'routes']);
|
|
532
564
|
});
|
|
533
|
-
it('
|
|
534
|
-
const
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
expect(
|
|
565
|
+
it('leaves alone tests that cover several tasks, or files another task claims', () => {
|
|
566
|
+
const several = foldTestOnlyTasks({
|
|
567
|
+
name: 'x',
|
|
568
|
+
tasks: [t('a', ['src/a.ts']), t('b', ['src/b.ts']), t('e2e', ['tests/e2e.test.ts'], ['a', 'b'])],
|
|
569
|
+
});
|
|
570
|
+
expect(several.folded).toEqual([]);
|
|
571
|
+
const shared = foldTestOnlyTasks({
|
|
572
|
+
name: 'x',
|
|
573
|
+
tasks: [t('a', ['src/a.ts']), t('a-tests', ['test/shared.test.ts'], ['a']), t('b', ['test/shared.test.ts'])],
|
|
574
|
+
});
|
|
575
|
+
expect(shared.folded).toEqual([]);
|
|
539
576
|
});
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
expect(
|
|
546
|
-
});
|
|
547
|
-
it('returns circuit_breaker threshold=3 for medium complexity', () => {
|
|
548
|
-
const result = deriveSpecEnrichment({ complexity: 'medium', total_tasks: 6, domains: ['frontend'] });
|
|
549
|
-
expect(result.circuit_breaker).toEqual({ threshold: 3, cooldown_ms: 300_000 });
|
|
550
|
-
});
|
|
551
|
-
it('returns circuit_breaker threshold=2 for high complexity', () => {
|
|
552
|
-
const result = deriveSpecEnrichment({ complexity: 'high', total_tasks: 12, domains: ['frontend'] });
|
|
553
|
-
expect(result.circuit_breaker).toEqual({ threshold: 2, cooldown_ms: 300_000 });
|
|
554
|
-
});
|
|
555
|
-
it('enables detect_drift for medium/high, not low', () => {
|
|
556
|
-
expect(deriveSpecEnrichment({ complexity: 'low', total_tasks: 3, domains: [] }).detect_drift).toBeUndefined();
|
|
557
|
-
expect(deriveSpecEnrichment({ complexity: 'medium', total_tasks: 6, domains: [] }).detect_drift).toBe(true);
|
|
558
|
-
expect(deriveSpecEnrichment({ complexity: 'high', total_tasks: 12, domains: [] }).detect_drift).toBe(true);
|
|
559
|
-
});
|
|
560
|
-
it('enables guard for medium/high, not low', () => {
|
|
561
|
-
expect(deriveSpecEnrichment({ complexity: 'low', total_tasks: 3, domains: [] }).guard).toBeUndefined();
|
|
562
|
-
expect(deriveSpecEnrichment({ complexity: 'medium', total_tasks: 6, domains: [] }).guard).toEqual({ enabled: true });
|
|
563
|
-
expect(deriveSpecEnrichment({ complexity: 'high', total_tasks: 12, domains: [] }).guard).toEqual({ enabled: true });
|
|
564
|
-
});
|
|
565
|
-
it('always includes secret_scan and blast_radius gates', () => {
|
|
566
|
-
const result = deriveSpecEnrichment({ complexity: 'low', total_tasks: 2, domains: [] });
|
|
567
|
-
expect(result.built_in_gates?.secret_scan).toBe(true);
|
|
568
|
-
expect(result.built_in_gates?.blast_radius).toBe(true);
|
|
569
|
-
});
|
|
570
|
-
it('adds browser_test gate for frontend/ui domains', () => {
|
|
571
|
-
const frontend = deriveSpecEnrichment({ complexity: 'low', total_tasks: 3, domains: ['frontend'] });
|
|
572
|
-
expect(frontend.built_in_gates?.browser_test).toBe('auto');
|
|
573
|
-
const ui = deriveSpecEnrichment({ complexity: 'low', total_tasks: 3, domains: ['UI'] });
|
|
574
|
-
expect(ui.built_in_gates?.browser_test).toBe('auto');
|
|
575
|
-
const backend = deriveSpecEnrichment({ complexity: 'low', total_tasks: 3, domains: ['backend'] });
|
|
576
|
-
expect(backend.built_in_gates?.browser_test).toBeUndefined();
|
|
577
|
-
});
|
|
578
|
-
it('adds regression_test gate for testing domain or >5 tasks', () => {
|
|
579
|
-
const testing = deriveSpecEnrichment({ complexity: 'low', total_tasks: 3, domains: ['testing'] });
|
|
580
|
-
expect(testing.built_in_gates?.regression_test).toBe('auto');
|
|
581
|
-
const manyTasks = deriveSpecEnrichment({ complexity: 'medium', total_tasks: 7, domains: [] });
|
|
582
|
-
expect(manyTasks.built_in_gates?.regression_test).toBe('auto');
|
|
583
|
-
const fewTasks = deriveSpecEnrichment({ complexity: 'low', total_tasks: 4, domains: [] });
|
|
584
|
-
expect(fewTasks.built_in_gates?.regression_test).toBeUndefined();
|
|
585
|
-
});
|
|
586
|
-
it('adds dependency_audit for database/api/backend domains', () => {
|
|
587
|
-
const db = deriveSpecEnrichment({ complexity: 'low', total_tasks: 3, domains: ['database'] });
|
|
588
|
-
expect(db.built_in_gates?.dependency_audit).toBe('auto');
|
|
589
|
-
const api = deriveSpecEnrichment({ complexity: 'low', total_tasks: 3, domains: ['api'] });
|
|
590
|
-
expect(api.built_in_gates?.dependency_audit).toBe('auto');
|
|
591
|
-
const backend = deriveSpecEnrichment({ complexity: 'low', total_tasks: 3, domains: ['Backend'] });
|
|
592
|
-
expect(backend.built_in_gates?.dependency_audit).toBe('auto');
|
|
593
|
-
});
|
|
594
|
-
it('scales max_concurrent_reviews with task count', () => {
|
|
595
|
-
const few = deriveSpecEnrichment({ complexity: 'low', total_tasks: 4, domains: [] });
|
|
596
|
-
expect(few.max_concurrent_reviews).toBe(2);
|
|
597
|
-
const many = deriveSpecEnrichment({ complexity: 'high', total_tasks: 10, domains: [] });
|
|
598
|
-
expect(many.max_concurrent_reviews).toBe(3);
|
|
577
|
+
it('leaves a task with any non-test file alone', () => {
|
|
578
|
+
const { folded } = foldTestOnlyTasks({
|
|
579
|
+
name: 'x',
|
|
580
|
+
tasks: [t('a', ['src/a.ts']), t('fixtures', ['test/a.test.ts', 'src/fixtures.ts'], ['a'])],
|
|
581
|
+
});
|
|
582
|
+
expect(folded).toEqual([]);
|
|
599
583
|
});
|
|
600
584
|
});
|
|
601
585
|
//# sourceMappingURL=spec-builder.test.js.map
|