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