opencastle 1.3.1 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -10
- package/bin/cli.mjs +8 -9
- package/dist/cli/agent-roster.test.js +0 -48
- package/dist/cli/agent-roster.test.js.map +1 -1
- package/dist/cli/boundary.test.js +9 -7
- package/dist/cli/boundary.test.js.map +1 -1
- package/dist/cli/convoy/artifacts.d.ts +9 -2
- package/dist/cli/convoy/artifacts.d.ts.map +1 -1
- package/dist/cli/convoy/artifacts.js +13 -10
- package/dist/cli/convoy/artifacts.js.map +1 -1
- package/dist/cli/convoy/artifacts.test.js +4 -2
- package/dist/cli/convoy/artifacts.test.js.map +1 -1
- package/dist/cli/convoy/engine.d.ts +53 -23
- package/dist/cli/convoy/engine.d.ts.map +1 -1
- package/dist/cli/convoy/engine.git.test.d.ts +2 -0
- package/dist/cli/convoy/engine.git.test.d.ts.map +1 -0
- package/dist/cli/convoy/engine.git.test.js +435 -0
- package/dist/cli/convoy/engine.git.test.js.map +1 -0
- package/dist/cli/convoy/engine.js +1746 -2305
- package/dist/cli/convoy/engine.js.map +1 -1
- package/dist/cli/convoy/engine.test.js +698 -678
- package/dist/cli/convoy/engine.test.js.map +1 -1
- package/dist/cli/convoy/event-schemas.d.ts +2 -0
- package/dist/cli/convoy/event-schemas.d.ts.map +1 -1
- package/dist/cli/convoy/event-schemas.js +59 -57
- package/dist/cli/convoy/event-schemas.js.map +1 -1
- package/dist/cli/convoy/events.d.ts +4 -1
- package/dist/cli/convoy/events.d.ts.map +1 -1
- package/dist/cli/convoy/events.js +69 -84
- package/dist/cli/convoy/events.js.map +1 -1
- package/dist/cli/convoy/events.test.js +50 -9
- package/dist/cli/convoy/events.test.js.map +1 -1
- package/dist/cli/convoy/gates.d.ts +9 -4
- package/dist/cli/convoy/gates.d.ts.map +1 -1
- package/dist/cli/convoy/gates.js +29 -14
- package/dist/cli/convoy/gates.js.map +1 -1
- package/dist/cli/convoy/isolation.d.ts +32 -6
- package/dist/cli/convoy/isolation.d.ts.map +1 -1
- package/dist/cli/convoy/isolation.js +72 -34
- package/dist/cli/convoy/isolation.js.map +1 -1
- package/dist/cli/convoy/isolation.test.js +66 -42
- package/dist/cli/convoy/isolation.test.js.map +1 -1
- package/dist/cli/convoy/lock.d.ts.map +1 -1
- package/dist/cli/convoy/lock.js +25 -10
- package/dist/cli/convoy/lock.js.map +1 -1
- package/dist/cli/convoy/lock.test.js +12 -0
- package/dist/cli/convoy/lock.test.js.map +1 -1
- package/dist/cli/convoy/merge.d.ts +21 -4
- package/dist/cli/convoy/merge.d.ts.map +1 -1
- package/dist/cli/convoy/merge.js +69 -53
- package/dist/cli/convoy/merge.js.map +1 -1
- package/dist/cli/convoy/merge.test.js +23 -1
- package/dist/cli/convoy/merge.test.js.map +1 -1
- package/dist/cli/convoy/progress.d.ts +35 -0
- package/dist/cli/convoy/progress.d.ts.map +1 -0
- package/dist/cli/convoy/progress.js +103 -0
- package/dist/cli/convoy/progress.js.map +1 -0
- package/dist/cli/convoy/progress.test.d.ts +2 -0
- package/dist/cli/convoy/progress.test.d.ts.map +1 -0
- package/dist/cli/convoy/progress.test.js +53 -0
- package/dist/cli/convoy/progress.test.js.map +1 -0
- package/dist/cli/convoy/read-model.d.ts +468 -0
- package/dist/cli/convoy/read-model.d.ts.map +1 -0
- package/dist/cli/convoy/read-model.js +1132 -0
- package/dist/cli/convoy/read-model.js.map +1 -0
- package/dist/cli/convoy/read-model.test.d.ts +2 -0
- package/dist/cli/convoy/read-model.test.d.ts.map +1 -0
- package/dist/cli/convoy/read-model.test.js +609 -0
- package/dist/cli/convoy/read-model.test.js.map +1 -0
- package/dist/cli/convoy/redact.d.ts +34 -0
- package/dist/cli/convoy/redact.d.ts.map +1 -0
- package/dist/cli/convoy/redact.js +66 -0
- package/dist/cli/convoy/redact.js.map +1 -0
- package/dist/cli/convoy/redact.test.d.ts +2 -0
- package/dist/cli/convoy/redact.test.d.ts.map +1 -0
- package/dist/cli/convoy/redact.test.js +43 -0
- package/dist/cli/convoy/redact.test.js.map +1 -0
- package/dist/cli/convoy/reviewer.d.ts +65 -0
- package/dist/cli/convoy/reviewer.d.ts.map +1 -0
- package/dist/cli/convoy/reviewer.js +141 -0
- package/dist/cli/convoy/reviewer.js.map +1 -0
- package/dist/cli/convoy/reviewer.test.d.ts +2 -0
- package/dist/cli/convoy/reviewer.test.d.ts.map +1 -0
- package/dist/cli/convoy/reviewer.test.js +96 -0
- package/dist/cli/convoy/reviewer.test.js.map +1 -0
- package/dist/cli/convoy/schedule.d.ts +30 -0
- package/dist/cli/convoy/schedule.d.ts.map +1 -0
- package/dist/cli/convoy/schedule.js +111 -0
- package/dist/cli/convoy/schedule.js.map +1 -0
- package/dist/cli/convoy/schedule.test.d.ts +2 -0
- package/dist/cli/convoy/schedule.test.d.ts.map +1 -0
- package/dist/cli/convoy/schedule.test.js +45 -0
- package/dist/cli/convoy/schedule.test.js.map +1 -0
- package/dist/cli/convoy/spec-builder.d.ts +120 -30
- package/dist/cli/convoy/spec-builder.d.ts.map +1 -1
- package/dist/cli/convoy/spec-builder.js +438 -114
- package/dist/cli/convoy/spec-builder.js.map +1 -1
- package/dist/cli/convoy/spec-builder.test.js +419 -435
- package/dist/cli/convoy/spec-builder.test.js.map +1 -1
- package/dist/cli/convoy/spec-types.d.ts +46 -92
- package/dist/cli/convoy/spec-types.d.ts.map +1 -1
- package/dist/cli/convoy/store.d.ts +6 -1
- package/dist/cli/convoy/store.d.ts.map +1 -1
- package/dist/cli/convoy/store.js +111 -15
- package/dist/cli/convoy/store.js.map +1 -1
- package/dist/cli/convoy/store.test.js +59 -13
- package/dist/cli/convoy/store.test.js.map +1 -1
- package/dist/cli/convoy/types.d.ts +76 -113
- package/dist/cli/convoy/types.d.ts.map +1 -1
- package/dist/cli/convoy/types.js +6 -13
- package/dist/cli/convoy/types.js.map +1 -1
- package/dist/cli/convoy/worktree.d.ts +88 -3
- package/dist/cli/convoy/worktree.d.ts.map +1 -1
- package/dist/cli/convoy/worktree.js +282 -56
- package/dist/cli/convoy/worktree.js.map +1 -1
- package/dist/cli/convoy/worktree.test.js +132 -1
- package/dist/cli/convoy/worktree.test.js.map +1 -1
- package/dist/cli/convoy-args.test.js +9 -27
- package/dist/cli/convoy-args.test.js.map +1 -1
- package/dist/cli/convoy-cmd.d.ts +31 -6
- package/dist/cli/convoy-cmd.d.ts.map +1 -1
- package/dist/cli/convoy-cmd.js +150 -201
- package/dist/cli/convoy-cmd.js.map +1 -1
- package/dist/cli/convoy-cmd.test.d.ts +2 -0
- package/dist/cli/convoy-cmd.test.d.ts.map +1 -0
- package/dist/cli/convoy-cmd.test.js +144 -0
- package/dist/cli/convoy-cmd.test.js.map +1 -0
- package/dist/cli/dashboard.d.ts +24 -11
- package/dist/cli/dashboard.d.ts.map +1 -1
- package/dist/cli/dashboard.js +241 -303
- package/dist/cli/dashboard.js.map +1 -1
- package/dist/cli/dashboard.test.d.ts +2 -0
- package/dist/cli/dashboard.test.d.ts.map +1 -0
- package/dist/cli/dashboard.test.js +340 -0
- package/dist/cli/dashboard.test.js.map +1 -0
- package/dist/cli/dispatcher.test.js +35 -2
- package/dist/cli/dispatcher.test.js.map +1 -1
- package/dist/cli/docs-accuracy.test.js +3 -3
- package/dist/cli/docs-accuracy.test.js.map +1 -1
- package/dist/cli/log.d.ts +39 -0
- package/dist/cli/log.d.ts.map +1 -1
- package/dist/cli/log.js +267 -93
- package/dist/cli/log.js.map +1 -1
- package/dist/cli/log.test.d.ts +2 -0
- package/dist/cli/log.test.d.ts.map +1 -0
- package/dist/cli/log.test.js +208 -0
- package/dist/cli/log.test.js.map +1 -0
- package/dist/cli/nearest.d.ts +18 -0
- package/dist/cli/nearest.d.ts.map +1 -0
- package/dist/cli/nearest.js +38 -0
- package/dist/cli/nearest.js.map +1 -0
- package/dist/cli/nearest.test.d.ts +2 -0
- package/dist/cli/nearest.test.d.ts.map +1 -0
- package/dist/cli/nearest.test.js +24 -0
- package/dist/cli/nearest.test.js.map +1 -0
- package/dist/cli/pipeline.d.ts +61 -0
- package/dist/cli/pipeline.d.ts.map +1 -1
- package/dist/cli/pipeline.flow.test.d.ts +2 -0
- package/dist/cli/pipeline.flow.test.d.ts.map +1 -0
- package/dist/cli/pipeline.flow.test.js +524 -0
- package/dist/cli/pipeline.flow.test.js.map +1 -0
- package/dist/cli/pipeline.js +471 -690
- package/dist/cli/pipeline.js.map +1 -1
- package/dist/cli/plan.d.ts +82 -31
- package/dist/cli/plan.d.ts.map +1 -1
- package/dist/cli/plan.js +167 -507
- package/dist/cli/plan.js.map +1 -1
- package/dist/cli/plan.test.d.ts +2 -0
- package/dist/cli/plan.test.d.ts.map +1 -0
- package/dist/cli/plan.test.js +158 -0
- package/dist/cli/plan.test.js.map +1 -0
- package/dist/cli/run/adapters/agent-process.d.ts +82 -0
- package/dist/cli/run/adapters/agent-process.d.ts.map +1 -0
- package/dist/cli/run/adapters/agent-process.js +224 -0
- package/dist/cli/run/adapters/agent-process.js.map +1 -0
- package/dist/cli/run/adapters/agent-process.test.d.ts +2 -0
- package/dist/cli/run/adapters/agent-process.test.d.ts.map +1 -0
- package/dist/cli/run/adapters/agent-process.test.js +159 -0
- package/dist/cli/run/adapters/agent-process.test.js.map +1 -0
- package/dist/cli/run/adapters/claude.d.ts +53 -2
- package/dist/cli/run/adapters/claude.d.ts.map +1 -1
- package/dist/cli/run/adapters/claude.js +147 -171
- package/dist/cli/run/adapters/claude.js.map +1 -1
- package/dist/cli/run/adapters/claude.test.js +197 -254
- package/dist/cli/run/adapters/claude.test.js.map +1 -1
- package/dist/cli/run/adapters/codex.d.ts +25 -2
- package/dist/cli/run/adapters/codex.d.ts.map +1 -1
- package/dist/cli/run/adapters/codex.js +113 -81
- package/dist/cli/run/adapters/codex.js.map +1 -1
- package/dist/cli/run/adapters/codex.test.js +116 -95
- package/dist/cli/run/adapters/codex.test.js.map +1 -1
- package/dist/cli/run/adapters/copilot.d.ts +35 -1
- package/dist/cli/run/adapters/copilot.d.ts.map +1 -1
- package/dist/cli/run/adapters/copilot.js +104 -287
- package/dist/cli/run/adapters/copilot.js.map +1 -1
- package/dist/cli/run/adapters/copilot.test.js +122 -282
- package/dist/cli/run/adapters/copilot.test.js.map +1 -1
- package/dist/cli/run/adapters/cursor.d.ts +25 -7
- package/dist/cli/run/adapters/cursor.d.ts.map +1 -1
- package/dist/cli/run/adapters/cursor.js +103 -156
- package/dist/cli/run/adapters/cursor.js.map +1 -1
- package/dist/cli/run/adapters/cursor.test.js +106 -218
- package/dist/cli/run/adapters/cursor.test.js.map +1 -1
- package/dist/cli/run/adapters/index.d.ts +34 -5
- package/dist/cli/run/adapters/index.d.ts.map +1 -1
- package/dist/cli/run/adapters/index.js +147 -21
- package/dist/cli/run/adapters/index.js.map +1 -1
- package/dist/cli/run/adapters/index.test.d.ts +2 -0
- package/dist/cli/run/adapters/index.test.d.ts.map +1 -0
- package/dist/cli/run/adapters/index.test.js +129 -0
- package/dist/cli/run/adapters/index.test.js.map +1 -0
- package/dist/cli/run/adapters/opencode.d.ts +25 -9
- package/dist/cli/run/adapters/opencode.d.ts.map +1 -1
- package/dist/cli/run/adapters/opencode.js +136 -152
- package/dist/cli/run/adapters/opencode.js.map +1 -1
- package/dist/cli/run/adapters/opencode.test.js +99 -218
- package/dist/cli/run/adapters/opencode.test.js.map +1 -1
- package/dist/cli/run/adapters/permission-modes.d.ts +47 -4
- package/dist/cli/run/adapters/permission-modes.d.ts.map +1 -1
- package/dist/cli/run/adapters/permission-modes.js +113 -37
- package/dist/cli/run/adapters/permission-modes.js.map +1 -1
- package/dist/cli/run/adapters/permission-modes.test.js +55 -40
- package/dist/cli/run/adapters/permission-modes.test.js.map +1 -1
- package/dist/cli/run/adapters/stub-cli.test-helper.d.ts +22 -0
- package/dist/cli/run/adapters/stub-cli.test-helper.d.ts.map +1 -0
- package/dist/cli/run/adapters/stub-cli.test-helper.js +73 -0
- package/dist/cli/run/adapters/stub-cli.test-helper.js.map +1 -0
- package/dist/cli/run/platform.d.ts +52 -0
- package/dist/cli/run/platform.d.ts.map +1 -0
- package/dist/cli/run/platform.js +207 -0
- package/dist/cli/run/platform.js.map +1 -0
- package/dist/cli/run/platform.test.d.ts +2 -0
- package/dist/cli/run/platform.test.d.ts.map +1 -0
- package/dist/cli/run/platform.test.js +119 -0
- package/dist/cli/run/platform.test.js.map +1 -0
- package/dist/cli/run/schema.d.ts +6 -8
- package/dist/cli/run/schema.d.ts.map +1 -1
- package/dist/cli/run/schema.js +44 -68
- package/dist/cli/run/schema.js.map +1 -1
- package/dist/cli/run/schema.test.js +59 -279
- package/dist/cli/run/schema.test.js.map +1 -1
- package/dist/cli/run.d.ts +34 -56
- package/dist/cli/run.d.ts.map +1 -1
- package/dist/cli/run.js +379 -1132
- package/dist/cli/run.js.map +1 -1
- package/dist/cli/run.test.d.ts +2 -0
- package/dist/cli/run.test.d.ts.map +1 -0
- package/dist/cli/run.test.js +318 -0
- package/dist/cli/run.test.js.map +1 -0
- package/dist/cli/team-config.d.ts.map +1 -1
- package/dist/cli/team-config.js +2 -21
- package/dist/cli/team-config.js.map +1 -1
- package/dist/cli/tiers.test.js +4 -13
- package/dist/cli/tiers.test.js.map +1 -1
- package/package.json +3 -10
- package/src/cli/agent-roster.test.ts +0 -55
- package/src/cli/boundary.test.ts +9 -7
- package/src/cli/convoy/TELEMETRY.md +131 -125
- package/src/cli/convoy/artifacts.test.ts +4 -2
- package/src/cli/convoy/artifacts.ts +13 -12
- package/src/cli/convoy/engine.git.test.ts +462 -0
- package/src/cli/convoy/engine.test.ts +817 -850
- package/src/cli/convoy/engine.ts +1864 -2596
- package/src/cli/convoy/event-schemas.ts +63 -59
- package/src/cli/convoy/events.test.ts +58 -9
- package/src/cli/convoy/events.ts +69 -91
- package/src/cli/convoy/gates.ts +31 -12
- package/src/cli/convoy/isolation.test.ts +76 -43
- package/src/cli/convoy/isolation.ts +100 -38
- package/src/cli/convoy/lock.test.ts +16 -0
- package/src/cli/convoy/lock.ts +25 -8
- package/src/cli/convoy/merge.test.ts +25 -1
- package/src/cli/convoy/merge.ts +74 -61
- package/src/cli/convoy/progress.test.ts +59 -0
- package/src/cli/convoy/progress.ts +121 -0
- package/src/cli/convoy/read-model.test.ts +685 -0
- package/src/cli/convoy/read-model.ts +1469 -0
- package/src/cli/convoy/redact.test.ts +49 -0
- package/src/cli/convoy/redact.ts +73 -0
- package/src/cli/convoy/reviewer.test.ts +112 -0
- package/src/cli/convoy/reviewer.ts +196 -0
- package/src/cli/convoy/schedule.test.ts +56 -0
- package/src/cli/convoy/schedule.ts +109 -0
- package/src/cli/convoy/spec-builder.test.ts +460 -464
- package/src/cli/convoy/spec-builder.ts +460 -129
- package/src/cli/convoy/spec-types.ts +46 -108
- package/src/cli/convoy/store.test.ts +64 -13
- package/src/cli/convoy/store.ts +143 -33
- package/src/cli/convoy/types.ts +59 -71
- package/src/cli/convoy/worktree.test.ts +140 -1
- package/src/cli/convoy/worktree.ts +311 -61
- package/src/cli/convoy-args.test.ts +10 -30
- package/src/cli/convoy-cmd.test.ts +163 -0
- package/src/cli/convoy-cmd.ts +173 -216
- package/src/cli/dashboard/dashboard.css +2086 -0
- package/src/cli/dashboard/dashboard.js +1687 -0
- package/src/cli/dashboard/index.html +307 -0
- package/src/cli/dashboard.test.ts +382 -0
- package/src/cli/dashboard.ts +243 -339
- package/src/cli/dispatcher.test.ts +36 -2
- package/src/cli/docs-accuracy.test.ts +3 -3
- package/src/cli/log.test.ts +228 -0
- package/src/cli/log.ts +302 -83
- package/src/cli/nearest.test.ts +27 -0
- package/src/cli/nearest.ts +38 -0
- package/src/cli/pipeline.flow.test.ts +607 -0
- package/src/cli/pipeline.ts +544 -759
- package/src/cli/plan.test.ts +193 -0
- package/src/cli/plan.ts +209 -545
- package/src/cli/run/adapters/agent-process.test.ts +175 -0
- package/src/cli/run/adapters/agent-process.ts +252 -0
- package/src/cli/run/adapters/claude.test.ts +205 -260
- package/src/cli/run/adapters/claude.ts +151 -162
- package/src/cli/run/adapters/codex.test.ts +120 -100
- package/src/cli/run/adapters/codex.ts +115 -91
- package/src/cli/run/adapters/copilot.test.ts +135 -306
- package/src/cli/run/adapters/copilot.ts +105 -274
- package/src/cli/run/adapters/cursor.test.ts +111 -220
- package/src/cli/run/adapters/cursor.ts +105 -156
- package/src/cli/run/adapters/index.test.ts +148 -0
- package/src/cli/run/adapters/index.ts +168 -20
- package/src/cli/run/adapters/opencode.test.ts +106 -227
- package/src/cli/run/adapters/opencode.ts +139 -151
- package/src/cli/run/adapters/permission-modes.test.ts +63 -41
- package/src/cli/run/adapters/permission-modes.ts +118 -37
- package/src/cli/run/adapters/stub-cli.test-helper.ts +88 -0
- package/src/cli/run/platform.test.ts +128 -0
- package/src/cli/run/platform.ts +213 -0
- package/src/cli/run/schema.test.ts +62 -344
- package/src/cli/run/schema.ts +48 -78
- package/src/cli/run.test.ts +351 -0
- package/src/cli/run.ts +366 -1151
- package/src/cli/team-config.ts +2 -21
- package/src/cli/tiers.test.ts +4 -17
- package/src/orchestrator/agents/team-lead.agent.md +1 -1
- package/src/orchestrator/prompts/assess-complexity.prompt.md +43 -26
- package/src/orchestrator/prompts/brainstorm.prompt.md +1 -1
- package/src/orchestrator/prompts/bug-fix.prompt.md +2 -2
- package/src/orchestrator/prompts/fix-convoy.prompt.md +43 -29
- package/src/orchestrator/prompts/fix-prd.prompt.md +26 -22
- package/src/orchestrator/prompts/generate-convoy.prompt.md +139 -147
- package/src/orchestrator/prompts/generate-prd.prompt.md +75 -68
- package/src/orchestrator/prompts/implement-feature.prompt.md +2 -2
- package/src/orchestrator/prompts/validate-convoy.prompt.md +29 -28
- package/src/orchestrator/prompts/validate-prd.prompt.md +28 -21
- package/src/orchestrator/skills/agent-hooks/HOOKS-REFERENCE.md +3 -3
- package/src/orchestrator/skills/agent-hooks/SKILL.md +1 -1
- package/src/orchestrator/skills/fast-review/SKILL.md +3 -1
- package/src/orchestrator/skills/orchestration-protocols/SKILL.md +7 -8
- package/dist/cli/convoy/dag-analysis.d.ts +0 -39
- package/dist/cli/convoy/dag-analysis.d.ts.map +0 -1
- package/dist/cli/convoy/dag-analysis.js +0 -279
- package/dist/cli/convoy/dag-analysis.js.map +0 -1
- package/dist/cli/convoy/dag-analysis.test.d.ts +0 -2
- package/dist/cli/convoy/dag-analysis.test.d.ts.map +0 -1
- package/dist/cli/convoy/dag-analysis.test.js +0 -289
- package/dist/cli/convoy/dag-analysis.test.js.map +0 -1
- package/dist/cli/convoy/formula.d.ts +0 -19
- package/dist/cli/convoy/formula.d.ts.map +0 -1
- package/dist/cli/convoy/formula.js +0 -142
- package/dist/cli/convoy/formula.js.map +0 -1
- package/dist/cli/convoy/formula.test.d.ts +0 -2
- package/dist/cli/convoy/formula.test.d.ts.map +0 -1
- package/dist/cli/convoy/formula.test.js +0 -342
- package/dist/cli/convoy/formula.test.js.map +0 -1
- package/dist/cli/convoy/health.d.ts +0 -34
- package/dist/cli/convoy/health.d.ts.map +0 -1
- package/dist/cli/convoy/health.js +0 -123
- package/dist/cli/convoy/health.js.map +0 -1
- package/dist/cli/convoy/health.test.d.ts +0 -2
- package/dist/cli/convoy/health.test.d.ts.map +0 -1
- package/dist/cli/convoy/health.test.js +0 -448
- package/dist/cli/convoy/health.test.js.map +0 -1
- package/dist/cli/convoy/last-run.d.ts +0 -53
- package/dist/cli/convoy/last-run.d.ts.map +0 -1
- package/dist/cli/convoy/last-run.js +0 -54
- package/dist/cli/convoy/last-run.js.map +0 -1
- package/dist/cli/convoy/last-run.test.d.ts +0 -2
- package/dist/cli/convoy/last-run.test.d.ts.map +0 -1
- package/dist/cli/convoy/last-run.test.js +0 -110
- package/dist/cli/convoy/last-run.test.js.map +0 -1
- package/dist/cli/convoy/pipeline.d.ts +0 -41
- package/dist/cli/convoy/pipeline.d.ts.map +0 -1
- package/dist/cli/convoy/pipeline.js +0 -414
- package/dist/cli/convoy/pipeline.js.map +0 -1
- package/dist/cli/convoy/pipeline.test.d.ts +0 -2
- package/dist/cli/convoy/pipeline.test.d.ts.map +0 -1
- package/dist/cli/convoy/pipeline.test.js +0 -837
- package/dist/cli/convoy/pipeline.test.js.map +0 -1
- package/dist/cli/convoy/review-stages.d.ts +0 -9
- package/dist/cli/convoy/review-stages.d.ts.map +0 -1
- package/dist/cli/convoy/review-stages.js +0 -134
- package/dist/cli/convoy/review-stages.js.map +0 -1
- package/dist/cli/convoy/review-stages.test.d.ts +0 -2
- package/dist/cli/convoy/review-stages.test.d.ts.map +0 -1
- package/dist/cli/convoy/review-stages.test.js +0 -197
- package/dist/cli/convoy/review-stages.test.js.map +0 -1
- package/dist/cli/run/executor.d.ts +0 -15
- package/dist/cli/run/executor.d.ts.map +0 -1
- package/dist/cli/run/executor.js +0 -249
- package/dist/cli/run/executor.js.map +0 -1
- package/dist/cli/run/executor.test.d.ts +0 -2
- package/dist/cli/run/executor.test.d.ts.map +0 -1
- package/dist/cli/run/executor.test.js +0 -297
- package/dist/cli/run/executor.test.js.map +0 -1
- package/dist/cli/run/reporter.d.ts +0 -10
- package/dist/cli/run/reporter.d.ts.map +0 -1
- package/dist/cli/run/reporter.js +0 -142
- package/dist/cli/run/reporter.js.map +0 -1
- package/dist/cli/run-dry-run.test.d.ts +0 -2
- package/dist/cli/run-dry-run.test.d.ts.map +0 -1
- package/dist/cli/run-dry-run.test.js +0 -83
- package/dist/cli/run-dry-run.test.js.map +0 -1
- package/dist/cli/run-executor-flags.test.d.ts +0 -2
- package/dist/cli/run-executor-flags.test.d.ts.map +0 -1
- package/dist/cli/run-executor-flags.test.js +0 -31
- package/dist/cli/run-executor-flags.test.js.map +0 -1
- package/dist/cli/run-finish.test.d.ts +0 -2
- package/dist/cli/run-finish.test.d.ts.map +0 -1
- package/dist/cli/run-finish.test.js +0 -77
- package/dist/cli/run-finish.test.js.map +0 -1
- package/dist/cli/watch.d.ts +0 -15
- package/dist/cli/watch.d.ts.map +0 -1
- package/dist/cli/watch.js +0 -277
- package/dist/cli/watch.js.map +0 -1
- package/dist/dashboard/scripts/etl.d.ts +0 -10
- package/dist/dashboard/scripts/etl.d.ts.map +0 -1
- package/dist/dashboard/scripts/etl.js +0 -141
- package/dist/dashboard/scripts/etl.js.map +0 -1
- package/src/cli/convoy/dag-analysis.test.ts +0 -349
- package/src/cli/convoy/dag-analysis.ts +0 -367
- package/src/cli/convoy/formula.test.ts +0 -404
- package/src/cli/convoy/formula.ts +0 -174
- package/src/cli/convoy/health.test.ts +0 -519
- package/src/cli/convoy/health.ts +0 -189
- package/src/cli/convoy/last-run.test.ts +0 -130
- package/src/cli/convoy/last-run.ts +0 -87
- package/src/cli/convoy/pipeline.test.ts +0 -999
- package/src/cli/convoy/pipeline.ts +0 -492
- package/src/cli/convoy/review-stages.test.ts +0 -235
- package/src/cli/convoy/review-stages.ts +0 -166
- package/src/cli/run/executor.test.ts +0 -338
- package/src/cli/run/executor.ts +0 -292
- package/src/cli/run/reporter.ts +0 -160
- package/src/cli/run-dry-run.test.ts +0 -97
- package/src/cli/run-executor-flags.test.ts +0 -38
- package/src/cli/run-finish.test.ts +0 -91
- package/src/cli/watch.ts +0 -295
- package/src/dashboard/astro.config.mjs +0 -6
- package/src/dashboard/dist/_astro/index.CADNhRPS.css +0 -1
- package/src/dashboard/dist/data/.gitkeep +0 -0
- package/src/dashboard/dist/data/convoy-list.json +0 -1
- package/src/dashboard/dist/data/overall-stats.json +0 -29
- package/src/dashboard/dist/index.html +0 -1963
- package/src/dashboard/node_modules/.vite/deps/_metadata.json +0 -31
- package/src/dashboard/node_modules/.vite/deps/astro___aria-query.js +0 -6776
- package/src/dashboard/node_modules/.vite/deps/astro___aria-query.js.map +0 -7
- package/src/dashboard/node_modules/.vite/deps/astro___axobject-query.js +0 -3754
- package/src/dashboard/node_modules/.vite/deps/astro___axobject-query.js.map +0 -7
- package/src/dashboard/node_modules/.vite/deps/astro___cssesc.js +0 -99
- package/src/dashboard/node_modules/.vite/deps/astro___cssesc.js.map +0 -7
- package/src/dashboard/node_modules/.vite/deps/chunk-BUSYA2B4.js +0 -8
- package/src/dashboard/node_modules/.vite/deps/chunk-BUSYA2B4.js.map +0 -7
- package/src/dashboard/node_modules/.vite/deps/package.json +0 -3
- package/src/dashboard/package-lock.json +0 -6
- package/src/dashboard/public/data/.gitkeep +0 -0
- package/src/dashboard/public/data/convoy-list.json +0 -1
- package/src/dashboard/public/data/overall-stats.json +0 -29
- package/src/dashboard/public/icon-192.png +0 -0
- package/src/dashboard/scripts/etl.test.ts +0 -166
- package/src/dashboard/scripts/etl.ts +0 -170
- package/src/dashboard/scripts/generate-demo-db.test.ts +0 -30
- package/src/dashboard/scripts/generate-demo-db.ts +0 -529
- package/src/dashboard/scripts/integration-test.ts +0 -504
- package/src/dashboard/scripts/verify-demo-data.sh +0 -51
- package/src/dashboard/seed-data/delegations.ndjson +0 -35
- package/src/dashboard/seed-data/events.ndjson +0 -104
- package/src/dashboard/seed-data/panels.ndjson +0 -13
- package/src/dashboard/seed-data/reviews.ndjson +0 -6
- package/src/dashboard/seed-data/sessions.ndjson +0 -50
- package/src/dashboard/src/env.d.ts +0 -1
- package/src/dashboard/src/layouts/Layout.astro +0 -25
- package/src/dashboard/src/pages/index.astro +0 -2313
- package/src/dashboard/src/styles/dashboard.css +0 -2943
- package/src/dashboard/tsconfig.json +0 -6
- /package/src/{dashboard/dist → cli/dashboard}/icon-192.png +0 -0
package/src/cli/convoy/types.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* `interrupted` is a run stopped by SIGINT or SIGTERM: its running tasks went
|
|
3
|
+
* back to pending, and `convoy resume` carries on from there.
|
|
4
|
+
*/
|
|
5
|
+
export type ConvoyStatus = 'pending' | 'running' | 'done' | 'failed' | 'gate-failed' | 'hook-failed' | 'interrupted'
|
|
2
6
|
|
|
3
7
|
export type ConvoyTaskStatus =
|
|
4
8
|
| 'pending'
|
|
@@ -34,6 +38,12 @@ export interface ConvoyRecord {
|
|
|
34
38
|
circuit_state: string | null
|
|
35
39
|
review_tokens_total: number | null
|
|
36
40
|
review_budget: number | null
|
|
41
|
+
/** What the convoy branch was cut from, so a run can say how to review it. */
|
|
42
|
+
base_ref?: string | null
|
|
43
|
+
/** 1 when any token or cost figure in the totals is an estimate. */
|
|
44
|
+
cost_estimated?: number
|
|
45
|
+
/** The runtime the run used (claude, codex, …). */
|
|
46
|
+
adapter?: string | null
|
|
37
47
|
}
|
|
38
48
|
|
|
39
49
|
export interface TaskRecord {
|
|
@@ -78,6 +88,16 @@ export interface TaskRecord {
|
|
|
78
88
|
outputs?: string | null // JSON array of TaskOutput
|
|
79
89
|
inputs?: string | null // JSON array of TaskInput
|
|
80
90
|
contract_result?: string | null // JSON ContractResult
|
|
91
|
+
/** Input tokens the runtime served from its prompt cache. */
|
|
92
|
+
cache_read_tokens?: number | null
|
|
93
|
+
/** Input tokens the runtime wrote to its prompt cache. */
|
|
94
|
+
cache_write_tokens?: number | null
|
|
95
|
+
/** 1 when the token or cost figures are an estimate, not what the runtime reported. */
|
|
96
|
+
cost_estimated?: number
|
|
97
|
+
/** Why the last attempt failed, told to the next one. Kept apart from `prompt` so retries never stack. */
|
|
98
|
+
retry_note?: string | null
|
|
99
|
+
/** A worker branch kept because its work could not be merged. */
|
|
100
|
+
branch?: string | null
|
|
81
101
|
}
|
|
82
102
|
|
|
83
103
|
export interface WorkerRecord {
|
|
@@ -248,20 +268,6 @@ export interface TaskStepRecord {
|
|
|
248
268
|
finished_at: string | null
|
|
249
269
|
}
|
|
250
270
|
|
|
251
|
-
export interface WatchTrigger {
|
|
252
|
-
type: 'file-change' | 'cron' | 'git-push'
|
|
253
|
-
glob?: string // for file-change: glob pattern to watch
|
|
254
|
-
schedule?: string // for cron: 5-field cron expression
|
|
255
|
-
branch?: string // for git-push: branch name pattern
|
|
256
|
-
debounce_ms?: number // file-change debounce (default: 500ms)
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
export interface WatchConfig {
|
|
260
|
-
triggers: WatchTrigger[]
|
|
261
|
-
clear_scratchpad?: boolean // clear scratchpad on watch start
|
|
262
|
-
scratchpad_retention_days?: number // auto-clear scratchpad entries older than N days
|
|
263
|
-
}
|
|
264
|
-
|
|
265
271
|
export interface ScratchpadRecord {
|
|
266
272
|
key: string
|
|
267
273
|
value: string
|
|
@@ -278,38 +284,33 @@ export interface MCPServerConfig {
|
|
|
278
284
|
config?: Record<string, unknown>
|
|
279
285
|
}
|
|
280
286
|
|
|
281
|
-
// ── Two-stage review ─────────────────────────────────────────────────────────
|
|
282
|
-
|
|
283
|
-
export type ReviewStage = 'spec-compliance' | 'code-quality'
|
|
284
|
-
|
|
285
|
-
export interface StageVerdict {
|
|
286
|
-
stage: ReviewStage
|
|
287
|
-
verdict: 'pass' | 'block'
|
|
288
|
-
issues: string[]
|
|
289
|
-
tokens_used: number
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
export interface TwoStageReviewResult {
|
|
293
|
-
stages: StageVerdict[]
|
|
294
|
-
overall_verdict: 'pass' | 'block'
|
|
295
|
-
total_tokens: number
|
|
296
|
-
}
|
|
297
|
-
|
|
298
287
|
// ---------------------------------------------------------------------------
|
|
299
288
|
// Discriminated union covering every canonical convoy event type.
|
|
300
289
|
// Each variant constrains the `data` shape that callers may pass to emit().
|
|
301
290
|
// ---------------------------------------------------------------------------
|
|
302
291
|
export type ConvoyEventType =
|
|
303
|
-
| { type: 'convoy_started'; data?: { name?: string } }
|
|
292
|
+
| { type: 'convoy_started'; data?: { name?: string; branch?: string; base?: string | null; concurrency?: number } }
|
|
304
293
|
| { type: 'convoy_finished'; data?: { status: string } }
|
|
305
294
|
| { type: 'convoy_failed'; data?: { status: string; reason?: string } }
|
|
306
|
-
| { type: '
|
|
307
|
-
| { type: '
|
|
308
|
-
| { type: '
|
|
309
|
-
| { type: '
|
|
295
|
+
| { type: 'convoy_interrupted'; data?: { signal?: string; requeued?: string[] } }
|
|
296
|
+
| { type: 'convoy_guard'; data?: { passed?: boolean; warnings?: string[] } }
|
|
297
|
+
| { type: 'convoy_resumed'; data?: { original_created_at?: string; reset?: string[] } }
|
|
298
|
+
| { type: 'task_started'; data?: { worker_id?: string; mechanism?: string; adapter?: string; attempt?: number } }
|
|
299
|
+
| {
|
|
300
|
+
type: 'task_done'
|
|
301
|
+
data?: {
|
|
302
|
+
exit_code?: number
|
|
303
|
+
worker_id?: string
|
|
304
|
+
tokens?: number | null
|
|
305
|
+
cost_usd?: number | null
|
|
306
|
+
estimated?: boolean
|
|
307
|
+
model?: string | null
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
| { type: 'task_failed'; data?: { reason: string; message?: string; worker_id?: string; gate?: string; hook?: string; exit_code?: number } }
|
|
310
311
|
| { type: 'task_skipped'; data?: { reason: string } }
|
|
311
|
-
| { type: 'task_retried'; data?: { previous_status: string } }
|
|
312
|
-
| { type: '
|
|
312
|
+
| { type: 'task_retried'; data?: { previous_status: string; reason?: string; attempt?: number } }
|
|
313
|
+
| { type: 'task_merged'; data?: { branch?: string; files?: number } }
|
|
313
314
|
| { type: 'review_started'; data?: { level: string; task_id?: string; model?: string } }
|
|
314
315
|
| {
|
|
315
316
|
type: 'review_verdict'
|
|
@@ -317,99 +318,86 @@ export type ConvoyEventType =
|
|
|
317
318
|
level: string
|
|
318
319
|
verdict: string
|
|
319
320
|
tokens: number
|
|
320
|
-
model?: string
|
|
321
|
+
model?: string | null
|
|
321
322
|
feedback_length?: number
|
|
322
|
-
budget_exceeded?: boolean
|
|
323
|
-
budget_downgrade?: boolean
|
|
324
|
-
budget_skip?: boolean
|
|
325
323
|
passes?: number
|
|
326
324
|
blocks?: number
|
|
327
325
|
}
|
|
328
326
|
}
|
|
327
|
+
| { type: 'review_skipped'; data?: { level: string; reason: string } }
|
|
329
328
|
| { type: 'dispute_opened'; data?: { dispute_id: string; task_id: string; agent?: string; reason?: string } }
|
|
330
329
|
| { type: 'dlq_entry_created'; data?: { dlq_id: string; task_id: string; agent?: string; attempts?: number } }
|
|
331
|
-
| { type: 'drift_check_result'; data?: { score?: number; threshold?: number; passed?: boolean } }
|
|
332
|
-
| { type: 'drift_detected'; data?: { score?: number; files?: string[] } }
|
|
333
330
|
| { type: 'circuit_breaker_tripped'; data?: { agent?: string; failure_count?: number; threshold?: number } }
|
|
334
331
|
| { type: 'circuit_breaker_fallback'; data?: { original_agent?: string; fallback_agent?: string; task_id?: string } }
|
|
335
332
|
| { type: 'circuit_breaker_blocked'; data?: { agent?: string; task_id?: string } }
|
|
336
|
-
| { type: 'merge_conflict_detected'; data?: {
|
|
337
|
-
| { type: '
|
|
338
|
-
| { type: '
|
|
333
|
+
| { type: 'merge_conflict_detected'; data?: { attempt?: number; conflicting_files?: string[] } }
|
|
334
|
+
| { type: 'merge_failed'; data?: { branch: string; error: string; conflicting_files?: string[] } }
|
|
335
|
+
| { type: 'gate_result'; data?: { command: string; passed: boolean; exit_code?: number; scope?: string; output?: string } }
|
|
339
336
|
| { type: 'artifact_limit_reached'; data?: { task_id?: string; limit?: number; current?: number } }
|
|
340
337
|
| { type: 'agent_identity_captured'; data?: { agent?: string; task_id?: string } }
|
|
341
338
|
| { type: 'agent_identity_rejected'; data?: { agent?: string; task_id?: string; reason?: string } }
|
|
342
|
-
| { type: 'swarm_concurrency_update'; data?: { new_concurrency?: number; reason?: string } }
|
|
343
339
|
| { type: 'post_convoy_hook_failed'; data?: { hook?: string; error?: string } }
|
|
344
|
-
| {
|
|
345
|
-
|
|
340
|
+
| {
|
|
341
|
+
type: 'session'
|
|
342
|
+
data?: { agent?: string; model?: string | null; task?: string; outcome?: string; duration_min?: number; [key: string]: unknown }
|
|
343
|
+
}
|
|
344
|
+
| {
|
|
345
|
+
type: 'delegation'
|
|
346
|
+
data?: { agent?: string; model?: string | null; tier?: string; mechanism?: string; outcome?: string; [key: string]: unknown }
|
|
347
|
+
}
|
|
346
348
|
| {
|
|
347
349
|
type: 'secret_leak_prevented'
|
|
348
350
|
data?: { original_type?: string; patterns?: string[]; task_id?: string; findings_count?: number; context?: string }
|
|
349
351
|
}
|
|
350
352
|
| { type: 'ndjson_write_failed'; data?: { original_type?: string } }
|
|
351
353
|
| { type: 'built_in_gate_result'; data?: { gate: string; passed: boolean; output?: string; level?: string } }
|
|
352
|
-
| { type: 'watch_started'; data?: { trigger_type?: string; pid?: number } }
|
|
353
|
-
| { type: 'watch_cycle_start'; data?: { cycle_number?: number; triggered_by?: string } }
|
|
354
|
-
| { type: 'watch_cycle_end'; data?: { cycle_number?: number; status?: string } }
|
|
355
|
-
| { type: 'watch_stopped'; data?: { reason?: string } }
|
|
356
354
|
| { type: 'worker_killed'; data?: { reason?: string; worker_id?: string; task_id?: string } }
|
|
357
355
|
| { type: 'contract_violation'; data?: { task_id?: string; agent?: string; missing?: string[]; warnings?: string[] } }
|
|
358
|
-
| { type: 'review_stage_completed'; data?: { stage: string; verdict: string; tokens: number; task_id?: string; model?: string } }
|
|
359
356
|
| { type: 'partition_violation'; data?: { task_id?: string; allowed?: string[]; actual?: string[]; violations?: string[] } }
|
|
360
357
|
| { type: 'tdd_check_passed'; data?: { task_id?: string; new_source_files?: number; existing_test_files?: number } }
|
|
361
358
|
| { type: 'tdd_check_failed'; data?: { task_id?: string; missing_test_files?: string[]; new_source_files?: number } }
|
|
362
359
|
| { type: 'tdd_check_skipped'; data?: { task_id?: string; reason?: string; agent?: string } }
|
|
363
|
-
| { type: 'convoy_resumed'; data?: { original_created_at?: string } }
|
|
364
360
|
| { type: 'artifacts_extracted'; data?: { task_id?: string; count?: number; artifacts?: Array<{ filename: string; summary?: string }> } }
|
|
365
|
-
| { type: 'file_partition_conflict'; data?: { conflicts?: Array<{ phase: number; taskA: string; taskB: string; overlapping: string[] }> } }
|
|
366
361
|
|
|
367
362
|
/** All canonical convoy event type strings. Used for runtime validation. */
|
|
368
363
|
export const KNOWN_EVENT_TYPES: Set<string> = new Set<ConvoyEventType['type']>([
|
|
369
364
|
'convoy_started',
|
|
370
365
|
'convoy_finished',
|
|
371
366
|
'convoy_failed',
|
|
367
|
+
'convoy_interrupted',
|
|
372
368
|
'convoy_guard',
|
|
369
|
+
'convoy_resumed',
|
|
373
370
|
'task_started',
|
|
374
371
|
'task_done',
|
|
375
372
|
'task_failed',
|
|
376
373
|
'task_skipped',
|
|
377
374
|
'task_retried',
|
|
378
|
-
'
|
|
375
|
+
'task_merged',
|
|
379
376
|
'review_started',
|
|
380
377
|
'review_verdict',
|
|
378
|
+
'review_skipped',
|
|
381
379
|
'dispute_opened',
|
|
382
380
|
'dlq_entry_created',
|
|
383
|
-
'drift_check_result',
|
|
384
|
-
'drift_detected',
|
|
385
381
|
'circuit_breaker_tripped',
|
|
386
382
|
'circuit_breaker_fallback',
|
|
387
383
|
'circuit_breaker_blocked',
|
|
388
384
|
'merge_conflict_detected',
|
|
389
|
-
'
|
|
390
|
-
'
|
|
385
|
+
'merge_failed',
|
|
386
|
+
'gate_result',
|
|
391
387
|
'artifact_limit_reached',
|
|
392
388
|
'agent_identity_captured',
|
|
393
389
|
'agent_identity_rejected',
|
|
394
|
-
'swarm_concurrency_update',
|
|
395
390
|
'post_convoy_hook_failed',
|
|
396
391
|
'session',
|
|
397
392
|
'delegation',
|
|
398
393
|
'secret_leak_prevented',
|
|
399
394
|
'ndjson_write_failed',
|
|
400
395
|
'built_in_gate_result',
|
|
401
|
-
'watch_started',
|
|
402
|
-
'watch_cycle_start',
|
|
403
|
-
'watch_cycle_end',
|
|
404
|
-
'watch_stopped',
|
|
405
396
|
'worker_killed',
|
|
406
397
|
'contract_violation',
|
|
407
|
-
'review_stage_completed',
|
|
408
398
|
'partition_violation',
|
|
409
399
|
'tdd_check_passed',
|
|
410
400
|
'tdd_check_failed',
|
|
411
401
|
'tdd_check_skipped',
|
|
412
|
-
'convoy_resumed',
|
|
413
402
|
'artifacts_extracted',
|
|
414
|
-
'file_partition_conflict',
|
|
415
403
|
])
|
|
@@ -28,7 +28,7 @@ beforeEach(async () => {
|
|
|
28
28
|
})
|
|
29
29
|
|
|
30
30
|
afterEach(() => {
|
|
31
|
-
rmSync(tmpDir, { recursive: true, force: true })
|
|
31
|
+
rmSync(tmpDir, { recursive: true, force: true, maxRetries: 5, retryDelay: 100 })
|
|
32
32
|
})
|
|
33
33
|
|
|
34
34
|
// ── create ────────────────────────────────────────────────────────────────────
|
|
@@ -175,3 +175,142 @@ describe('removeAll', () => {
|
|
|
175
175
|
await expect(manager.removeAll()).resolves.toBeUndefined()
|
|
176
176
|
})
|
|
177
177
|
})
|
|
178
|
+
|
|
179
|
+
// ── keepBranch, commit and changes ─────────────────────────────────────────────
|
|
180
|
+
|
|
181
|
+
describe('remove with keepBranch', () => {
|
|
182
|
+
it('removes the worktree but keeps the branch that holds unmerged work', async () => {
|
|
183
|
+
const path = await manager.create('worker1', 'HEAD')
|
|
184
|
+
await manager.remove(path, { keepBranch: true })
|
|
185
|
+
expect(await manager.list()).toHaveLength(0)
|
|
186
|
+
const { stdout } = await execFile('git', ['branch', '--list', 'convoy-worker1'], { cwd: tmpDir })
|
|
187
|
+
expect(stdout.trim()).toBe('convoy-worker1')
|
|
188
|
+
})
|
|
189
|
+
})
|
|
190
|
+
|
|
191
|
+
describe('removeAll with except', () => {
|
|
192
|
+
it('leaves the listed worktrees alone', async () => {
|
|
193
|
+
const keep = await manager.create('keep', 'HEAD')
|
|
194
|
+
await manager.create('drop', 'HEAD')
|
|
195
|
+
await manager.removeAll({ except: [keep] })
|
|
196
|
+
expect((await manager.list()).map(w => w.path)).toEqual([keep])
|
|
197
|
+
})
|
|
198
|
+
})
|
|
199
|
+
|
|
200
|
+
describe('commitAll and changes', () => {
|
|
201
|
+
it('commits what the agent left uncommitted and reports it against the start commit', async () => {
|
|
202
|
+
const { writeFileSync } = await import('node:fs')
|
|
203
|
+
const path = await manager.create('worker1', 'HEAD')
|
|
204
|
+
const start = await manager.head!(path)
|
|
205
|
+
writeFileSync(join(path, 'new.txt'), 'hello\n')
|
|
206
|
+
expect(await manager.commitAll!(path, 'convoy(t): add new.txt')).toBe(true)
|
|
207
|
+
// Nothing left to commit the second time.
|
|
208
|
+
expect(await manager.commitAll!(path, 'again')).toBe(false)
|
|
209
|
+
const changes = await manager.changes!(path, start!)
|
|
210
|
+
expect(changes!.files).toEqual(['new.txt'])
|
|
211
|
+
expect(changes!.diff).toContain('+hello')
|
|
212
|
+
})
|
|
213
|
+
})
|
|
214
|
+
|
|
215
|
+
describe('ensureRootWorktree', () => {
|
|
216
|
+
it('creates the branch from the base and checks it out in its own worktree', async () => {
|
|
217
|
+
const { ensureRootWorktree } = await import('./worktree.js')
|
|
218
|
+
const path = await ensureRootWorktree({ repoRoot: tmpDir, branch: 'convoy/x-1', base: 'HEAD', dirName: 'abc123' })
|
|
219
|
+
expect(path).toBe(join(tmpDir, '.opencastle', 'worktrees', 'abc123'))
|
|
220
|
+
const { stdout } = await execFile('git', ['rev-parse', '--abbrev-ref', 'HEAD'], { cwd: path })
|
|
221
|
+
expect(stdout.trim()).toBe('convoy/x-1')
|
|
222
|
+
})
|
|
223
|
+
|
|
224
|
+
it('reuses a worktree a killed run left holding the branch, cleaned', async () => {
|
|
225
|
+
const { ensureRootWorktree } = await import('./worktree.js')
|
|
226
|
+
const { writeFileSync, existsSync } = await import('node:fs')
|
|
227
|
+
const first = await ensureRootWorktree({ repoRoot: tmpDir, branch: 'convoy/x-2', base: 'HEAD', dirName: 'old' })
|
|
228
|
+
writeFileSync(join(first, 'half-done.txt'), 'x')
|
|
229
|
+
const again = await ensureRootWorktree({ repoRoot: tmpDir, branch: 'convoy/x-2', base: 'HEAD', dirName: 'new' })
|
|
230
|
+
expect(again).toBe(first)
|
|
231
|
+
expect(existsSync(join(again, 'half-done.txt'))).toBe(false)
|
|
232
|
+
})
|
|
233
|
+
|
|
234
|
+
it('prunes a registration whose directory was deleted, then checks the branch out again', async () => {
|
|
235
|
+
const { ensureRootWorktree } = await import('./worktree.js')
|
|
236
|
+
const first = await ensureRootWorktree({ repoRoot: tmpDir, branch: 'convoy/x-3', base: 'HEAD', dirName: 'gone' })
|
|
237
|
+
rmSync(first, { recursive: true, force: true, maxRetries: 5, retryDelay: 100 })
|
|
238
|
+
const again = await ensureRootWorktree({ repoRoot: tmpDir, branch: 'convoy/x-3', base: 'HEAD', dirName: 'fresh' })
|
|
239
|
+
expect(again).toBe(join(tmpDir, '.opencastle', 'worktrees', 'fresh'))
|
|
240
|
+
})
|
|
241
|
+
|
|
242
|
+
it('refuses a branch the user has checked out elsewhere', async () => {
|
|
243
|
+
const { ensureRootWorktree, BranchInUseError } = await import('./worktree.js')
|
|
244
|
+
const { stdout } = await execFile('git', ['rev-parse', '--abbrev-ref', 'HEAD'], { cwd: tmpDir })
|
|
245
|
+
await expect(ensureRootWorktree({ repoRoot: tmpDir, branch: stdout.trim(), base: 'HEAD', dirName: 'x' }))
|
|
246
|
+
.rejects.toBeInstanceOf(BranchInUseError)
|
|
247
|
+
})
|
|
248
|
+
})
|
|
249
|
+
|
|
250
|
+
describe('git under contention', () => {
|
|
251
|
+
it('waits out a lock another git process holds, instead of failing the task', async () => {
|
|
252
|
+
const { git } = await import('./worktree.js')
|
|
253
|
+
const { writeFileSync, rmSync: rm } = await import('node:fs')
|
|
254
|
+
const dir = mkdtempSync(join(tmpdir(), 'oc-gitlock-'))
|
|
255
|
+
try {
|
|
256
|
+
await git(['init', '-q'], dir)
|
|
257
|
+
writeFileSync(join(dir, 'a.txt'), 'a\n')
|
|
258
|
+
// Another process holds the index for a moment.
|
|
259
|
+
const lock = join(dir, '.git', 'index.lock')
|
|
260
|
+
writeFileSync(lock, '')
|
|
261
|
+
setTimeout(() => rm(lock, { force: true }), 150)
|
|
262
|
+
await git(['add', '-A'], dir)
|
|
263
|
+
expect(await git(['diff', '--cached', '--name-only'], dir)).toContain('a.txt')
|
|
264
|
+
} finally {
|
|
265
|
+
rmSync(dir, { recursive: true, force: true, maxRetries: 5, retryDelay: 100 })
|
|
266
|
+
}
|
|
267
|
+
})
|
|
268
|
+
|
|
269
|
+
it('still fails at once on an error that is not contention', async () => {
|
|
270
|
+
const { git } = await import('./worktree.js')
|
|
271
|
+
const dir = mkdtempSync(join(tmpdir(), 'oc-gitlock-'))
|
|
272
|
+
try {
|
|
273
|
+
await git(['init', '-q'], dir)
|
|
274
|
+
const started = Date.now()
|
|
275
|
+
await expect(git(['checkout', 'no-such-branch'], dir)).rejects.toThrow()
|
|
276
|
+
expect(Date.now() - started).toBeLessThan(1000)
|
|
277
|
+
} finally {
|
|
278
|
+
rmSync(dir, { recursive: true, force: true, maxRetries: 5, retryDelay: 100 })
|
|
279
|
+
}
|
|
280
|
+
})
|
|
281
|
+
})
|
|
282
|
+
|
|
283
|
+
describe('many tasks starting at once', () => {
|
|
284
|
+
it('creates every worktree when twelve are asked for together', async () => {
|
|
285
|
+
// A concurrent `git worktree add` read another's half-written entry and
|
|
286
|
+
// failed the task ("failed to read .git/worktrees/<other>/commondir").
|
|
287
|
+
const dir = realpathSync(mkdtempSync(join(tmpdir(), 'oc-wt-many-')))
|
|
288
|
+
try {
|
|
289
|
+
const { git } = await import('./worktree.js')
|
|
290
|
+
await git(['init', '-q', '-b', 'main'], dir)
|
|
291
|
+
await git(['-c', 'user.name=t', '-c', 'user.email=t@t', 'commit', '-q', '--allow-empty', '-m', 'init'], dir)
|
|
292
|
+
const manager = createWorktreeManager(dir)
|
|
293
|
+
const paths = await Promise.all(Array.from({ length: 12 }, (_, i) => manager.create(`w${i}`, 'main')))
|
|
294
|
+
expect(paths).toHaveLength(12)
|
|
295
|
+
expect((await manager.list()).length).toBeGreaterThanOrEqual(12)
|
|
296
|
+
await Promise.all(paths.map((p) => manager.remove(p)))
|
|
297
|
+
} finally {
|
|
298
|
+
rmSync(dir, { recursive: true, force: true, maxRetries: 5, retryDelay: 100 })
|
|
299
|
+
}
|
|
300
|
+
})
|
|
301
|
+
})
|
|
302
|
+
|
|
303
|
+
describe('the test environment', () => {
|
|
304
|
+
it('runs git without automatic housekeeping, which raced temporary repositories being removed', async () => {
|
|
305
|
+
// vitest.config.ts sets GIT_CONFIG_COUNT/KEY/VALUE for every git a test starts.
|
|
306
|
+
const { git } = await import('./worktree.js')
|
|
307
|
+
const dir = mkdtempSync(join(tmpdir(), 'oc-gitenv-'))
|
|
308
|
+
try {
|
|
309
|
+
await git(['init', '-q'], dir)
|
|
310
|
+
expect((await git(['config', '--get', 'gc.auto'], dir)).trim()).toBe('0')
|
|
311
|
+
expect((await git(['config', '--get', 'maintenance.auto'], dir)).trim()).toBe('false')
|
|
312
|
+
} finally {
|
|
313
|
+
rmSync(dir, { recursive: true, force: true, maxRetries: 5, retryDelay: 100 })
|
|
314
|
+
}
|
|
315
|
+
})
|
|
316
|
+
})
|