opencastle 1.3.1 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -10
- package/bin/cli.mjs +8 -9
- package/dist/cli/agent-roster.test.js +0 -48
- package/dist/cli/agent-roster.test.js.map +1 -1
- package/dist/cli/boundary.test.js +9 -7
- package/dist/cli/boundary.test.js.map +1 -1
- package/dist/cli/convoy/artifacts.d.ts +9 -2
- package/dist/cli/convoy/artifacts.d.ts.map +1 -1
- package/dist/cli/convoy/artifacts.js +13 -10
- package/dist/cli/convoy/artifacts.js.map +1 -1
- package/dist/cli/convoy/artifacts.test.js +4 -2
- package/dist/cli/convoy/artifacts.test.js.map +1 -1
- package/dist/cli/convoy/engine.d.ts +53 -23
- package/dist/cli/convoy/engine.d.ts.map +1 -1
- package/dist/cli/convoy/engine.git.test.d.ts +2 -0
- package/dist/cli/convoy/engine.git.test.d.ts.map +1 -0
- package/dist/cli/convoy/engine.git.test.js +435 -0
- package/dist/cli/convoy/engine.git.test.js.map +1 -0
- package/dist/cli/convoy/engine.js +1746 -2305
- package/dist/cli/convoy/engine.js.map +1 -1
- package/dist/cli/convoy/engine.test.js +698 -678
- package/dist/cli/convoy/engine.test.js.map +1 -1
- package/dist/cli/convoy/event-schemas.d.ts +2 -0
- package/dist/cli/convoy/event-schemas.d.ts.map +1 -1
- package/dist/cli/convoy/event-schemas.js +59 -57
- package/dist/cli/convoy/event-schemas.js.map +1 -1
- package/dist/cli/convoy/events.d.ts +4 -1
- package/dist/cli/convoy/events.d.ts.map +1 -1
- package/dist/cli/convoy/events.js +69 -84
- package/dist/cli/convoy/events.js.map +1 -1
- package/dist/cli/convoy/events.test.js +50 -9
- package/dist/cli/convoy/events.test.js.map +1 -1
- package/dist/cli/convoy/gates.d.ts +9 -4
- package/dist/cli/convoy/gates.d.ts.map +1 -1
- package/dist/cli/convoy/gates.js +29 -14
- package/dist/cli/convoy/gates.js.map +1 -1
- package/dist/cli/convoy/isolation.d.ts +32 -6
- package/dist/cli/convoy/isolation.d.ts.map +1 -1
- package/dist/cli/convoy/isolation.js +72 -34
- package/dist/cli/convoy/isolation.js.map +1 -1
- package/dist/cli/convoy/isolation.test.js +66 -42
- package/dist/cli/convoy/isolation.test.js.map +1 -1
- package/dist/cli/convoy/lock.d.ts.map +1 -1
- package/dist/cli/convoy/lock.js +25 -10
- package/dist/cli/convoy/lock.js.map +1 -1
- package/dist/cli/convoy/lock.test.js +12 -0
- package/dist/cli/convoy/lock.test.js.map +1 -1
- package/dist/cli/convoy/merge.d.ts +21 -4
- package/dist/cli/convoy/merge.d.ts.map +1 -1
- package/dist/cli/convoy/merge.js +69 -53
- package/dist/cli/convoy/merge.js.map +1 -1
- package/dist/cli/convoy/merge.test.js +23 -1
- package/dist/cli/convoy/merge.test.js.map +1 -1
- package/dist/cli/convoy/progress.d.ts +35 -0
- package/dist/cli/convoy/progress.d.ts.map +1 -0
- package/dist/cli/convoy/progress.js +103 -0
- package/dist/cli/convoy/progress.js.map +1 -0
- package/dist/cli/convoy/progress.test.d.ts +2 -0
- package/dist/cli/convoy/progress.test.d.ts.map +1 -0
- package/dist/cli/convoy/progress.test.js +53 -0
- package/dist/cli/convoy/progress.test.js.map +1 -0
- package/dist/cli/convoy/read-model.d.ts +468 -0
- package/dist/cli/convoy/read-model.d.ts.map +1 -0
- package/dist/cli/convoy/read-model.js +1132 -0
- package/dist/cli/convoy/read-model.js.map +1 -0
- package/dist/cli/convoy/read-model.test.d.ts +2 -0
- package/dist/cli/convoy/read-model.test.d.ts.map +1 -0
- package/dist/cli/convoy/read-model.test.js +609 -0
- package/dist/cli/convoy/read-model.test.js.map +1 -0
- package/dist/cli/convoy/redact.d.ts +34 -0
- package/dist/cli/convoy/redact.d.ts.map +1 -0
- package/dist/cli/convoy/redact.js +66 -0
- package/dist/cli/convoy/redact.js.map +1 -0
- package/dist/cli/convoy/redact.test.d.ts +2 -0
- package/dist/cli/convoy/redact.test.d.ts.map +1 -0
- package/dist/cli/convoy/redact.test.js +43 -0
- package/dist/cli/convoy/redact.test.js.map +1 -0
- package/dist/cli/convoy/reviewer.d.ts +65 -0
- package/dist/cli/convoy/reviewer.d.ts.map +1 -0
- package/dist/cli/convoy/reviewer.js +141 -0
- package/dist/cli/convoy/reviewer.js.map +1 -0
- package/dist/cli/convoy/reviewer.test.d.ts +2 -0
- package/dist/cli/convoy/reviewer.test.d.ts.map +1 -0
- package/dist/cli/convoy/reviewer.test.js +96 -0
- package/dist/cli/convoy/reviewer.test.js.map +1 -0
- package/dist/cli/convoy/schedule.d.ts +30 -0
- package/dist/cli/convoy/schedule.d.ts.map +1 -0
- package/dist/cli/convoy/schedule.js +111 -0
- package/dist/cli/convoy/schedule.js.map +1 -0
- package/dist/cli/convoy/schedule.test.d.ts +2 -0
- package/dist/cli/convoy/schedule.test.d.ts.map +1 -0
- package/dist/cli/convoy/schedule.test.js +45 -0
- package/dist/cli/convoy/schedule.test.js.map +1 -0
- package/dist/cli/convoy/spec-builder.d.ts +120 -30
- package/dist/cli/convoy/spec-builder.d.ts.map +1 -1
- package/dist/cli/convoy/spec-builder.js +438 -114
- package/dist/cli/convoy/spec-builder.js.map +1 -1
- package/dist/cli/convoy/spec-builder.test.js +419 -435
- package/dist/cli/convoy/spec-builder.test.js.map +1 -1
- package/dist/cli/convoy/spec-types.d.ts +46 -92
- package/dist/cli/convoy/spec-types.d.ts.map +1 -1
- package/dist/cli/convoy/store.d.ts +6 -1
- package/dist/cli/convoy/store.d.ts.map +1 -1
- package/dist/cli/convoy/store.js +111 -15
- package/dist/cli/convoy/store.js.map +1 -1
- package/dist/cli/convoy/store.test.js +59 -13
- package/dist/cli/convoy/store.test.js.map +1 -1
- package/dist/cli/convoy/types.d.ts +76 -113
- package/dist/cli/convoy/types.d.ts.map +1 -1
- package/dist/cli/convoy/types.js +6 -13
- package/dist/cli/convoy/types.js.map +1 -1
- package/dist/cli/convoy/worktree.d.ts +88 -3
- package/dist/cli/convoy/worktree.d.ts.map +1 -1
- package/dist/cli/convoy/worktree.js +282 -56
- package/dist/cli/convoy/worktree.js.map +1 -1
- package/dist/cli/convoy/worktree.test.js +132 -1
- package/dist/cli/convoy/worktree.test.js.map +1 -1
- package/dist/cli/convoy-args.test.js +9 -27
- package/dist/cli/convoy-args.test.js.map +1 -1
- package/dist/cli/convoy-cmd.d.ts +31 -6
- package/dist/cli/convoy-cmd.d.ts.map +1 -1
- package/dist/cli/convoy-cmd.js +150 -201
- package/dist/cli/convoy-cmd.js.map +1 -1
- package/dist/cli/convoy-cmd.test.d.ts +2 -0
- package/dist/cli/convoy-cmd.test.d.ts.map +1 -0
- package/dist/cli/convoy-cmd.test.js +144 -0
- package/dist/cli/convoy-cmd.test.js.map +1 -0
- package/dist/cli/dashboard.d.ts +24 -11
- package/dist/cli/dashboard.d.ts.map +1 -1
- package/dist/cli/dashboard.js +241 -303
- package/dist/cli/dashboard.js.map +1 -1
- package/dist/cli/dashboard.test.d.ts +2 -0
- package/dist/cli/dashboard.test.d.ts.map +1 -0
- package/dist/cli/dashboard.test.js +340 -0
- package/dist/cli/dashboard.test.js.map +1 -0
- package/dist/cli/dispatcher.test.js +35 -2
- package/dist/cli/dispatcher.test.js.map +1 -1
- package/dist/cli/docs-accuracy.test.js +3 -3
- package/dist/cli/docs-accuracy.test.js.map +1 -1
- package/dist/cli/log.d.ts +39 -0
- package/dist/cli/log.d.ts.map +1 -1
- package/dist/cli/log.js +267 -93
- package/dist/cli/log.js.map +1 -1
- package/dist/cli/log.test.d.ts +2 -0
- package/dist/cli/log.test.d.ts.map +1 -0
- package/dist/cli/log.test.js +208 -0
- package/dist/cli/log.test.js.map +1 -0
- package/dist/cli/nearest.d.ts +18 -0
- package/dist/cli/nearest.d.ts.map +1 -0
- package/dist/cli/nearest.js +38 -0
- package/dist/cli/nearest.js.map +1 -0
- package/dist/cli/nearest.test.d.ts +2 -0
- package/dist/cli/nearest.test.d.ts.map +1 -0
- package/dist/cli/nearest.test.js +24 -0
- package/dist/cli/nearest.test.js.map +1 -0
- package/dist/cli/pipeline.d.ts +61 -0
- package/dist/cli/pipeline.d.ts.map +1 -1
- package/dist/cli/pipeline.flow.test.d.ts +2 -0
- package/dist/cli/pipeline.flow.test.d.ts.map +1 -0
- package/dist/cli/pipeline.flow.test.js +524 -0
- package/dist/cli/pipeline.flow.test.js.map +1 -0
- package/dist/cli/pipeline.js +471 -690
- package/dist/cli/pipeline.js.map +1 -1
- package/dist/cli/plan.d.ts +82 -31
- package/dist/cli/plan.d.ts.map +1 -1
- package/dist/cli/plan.js +167 -507
- package/dist/cli/plan.js.map +1 -1
- package/dist/cli/plan.test.d.ts +2 -0
- package/dist/cli/plan.test.d.ts.map +1 -0
- package/dist/cli/plan.test.js +158 -0
- package/dist/cli/plan.test.js.map +1 -0
- package/dist/cli/run/adapters/agent-process.d.ts +82 -0
- package/dist/cli/run/adapters/agent-process.d.ts.map +1 -0
- package/dist/cli/run/adapters/agent-process.js +224 -0
- package/dist/cli/run/adapters/agent-process.js.map +1 -0
- package/dist/cli/run/adapters/agent-process.test.d.ts +2 -0
- package/dist/cli/run/adapters/agent-process.test.d.ts.map +1 -0
- package/dist/cli/run/adapters/agent-process.test.js +159 -0
- package/dist/cli/run/adapters/agent-process.test.js.map +1 -0
- package/dist/cli/run/adapters/claude.d.ts +53 -2
- package/dist/cli/run/adapters/claude.d.ts.map +1 -1
- package/dist/cli/run/adapters/claude.js +147 -171
- package/dist/cli/run/adapters/claude.js.map +1 -1
- package/dist/cli/run/adapters/claude.test.js +197 -254
- package/dist/cli/run/adapters/claude.test.js.map +1 -1
- package/dist/cli/run/adapters/codex.d.ts +25 -2
- package/dist/cli/run/adapters/codex.d.ts.map +1 -1
- package/dist/cli/run/adapters/codex.js +113 -81
- package/dist/cli/run/adapters/codex.js.map +1 -1
- package/dist/cli/run/adapters/codex.test.js +116 -95
- package/dist/cli/run/adapters/codex.test.js.map +1 -1
- package/dist/cli/run/adapters/copilot.d.ts +35 -1
- package/dist/cli/run/adapters/copilot.d.ts.map +1 -1
- package/dist/cli/run/adapters/copilot.js +104 -287
- package/dist/cli/run/adapters/copilot.js.map +1 -1
- package/dist/cli/run/adapters/copilot.test.js +122 -282
- package/dist/cli/run/adapters/copilot.test.js.map +1 -1
- package/dist/cli/run/adapters/cursor.d.ts +25 -7
- package/dist/cli/run/adapters/cursor.d.ts.map +1 -1
- package/dist/cli/run/adapters/cursor.js +103 -156
- package/dist/cli/run/adapters/cursor.js.map +1 -1
- package/dist/cli/run/adapters/cursor.test.js +106 -218
- package/dist/cli/run/adapters/cursor.test.js.map +1 -1
- package/dist/cli/run/adapters/index.d.ts +34 -5
- package/dist/cli/run/adapters/index.d.ts.map +1 -1
- package/dist/cli/run/adapters/index.js +147 -21
- package/dist/cli/run/adapters/index.js.map +1 -1
- package/dist/cli/run/adapters/index.test.d.ts +2 -0
- package/dist/cli/run/adapters/index.test.d.ts.map +1 -0
- package/dist/cli/run/adapters/index.test.js +129 -0
- package/dist/cli/run/adapters/index.test.js.map +1 -0
- package/dist/cli/run/adapters/opencode.d.ts +25 -9
- package/dist/cli/run/adapters/opencode.d.ts.map +1 -1
- package/dist/cli/run/adapters/opencode.js +136 -152
- package/dist/cli/run/adapters/opencode.js.map +1 -1
- package/dist/cli/run/adapters/opencode.test.js +99 -218
- package/dist/cli/run/adapters/opencode.test.js.map +1 -1
- package/dist/cli/run/adapters/permission-modes.d.ts +47 -4
- package/dist/cli/run/adapters/permission-modes.d.ts.map +1 -1
- package/dist/cli/run/adapters/permission-modes.js +113 -37
- package/dist/cli/run/adapters/permission-modes.js.map +1 -1
- package/dist/cli/run/adapters/permission-modes.test.js +55 -40
- package/dist/cli/run/adapters/permission-modes.test.js.map +1 -1
- package/dist/cli/run/adapters/stub-cli.test-helper.d.ts +22 -0
- package/dist/cli/run/adapters/stub-cli.test-helper.d.ts.map +1 -0
- package/dist/cli/run/adapters/stub-cli.test-helper.js +73 -0
- package/dist/cli/run/adapters/stub-cli.test-helper.js.map +1 -0
- package/dist/cli/run/platform.d.ts +52 -0
- package/dist/cli/run/platform.d.ts.map +1 -0
- package/dist/cli/run/platform.js +207 -0
- package/dist/cli/run/platform.js.map +1 -0
- package/dist/cli/run/platform.test.d.ts +2 -0
- package/dist/cli/run/platform.test.d.ts.map +1 -0
- package/dist/cli/run/platform.test.js +119 -0
- package/dist/cli/run/platform.test.js.map +1 -0
- package/dist/cli/run/schema.d.ts +6 -8
- package/dist/cli/run/schema.d.ts.map +1 -1
- package/dist/cli/run/schema.js +44 -68
- package/dist/cli/run/schema.js.map +1 -1
- package/dist/cli/run/schema.test.js +59 -279
- package/dist/cli/run/schema.test.js.map +1 -1
- package/dist/cli/run.d.ts +34 -56
- package/dist/cli/run.d.ts.map +1 -1
- package/dist/cli/run.js +379 -1132
- package/dist/cli/run.js.map +1 -1
- package/dist/cli/run.test.d.ts +2 -0
- package/dist/cli/run.test.d.ts.map +1 -0
- package/dist/cli/run.test.js +318 -0
- package/dist/cli/run.test.js.map +1 -0
- package/dist/cli/team-config.d.ts.map +1 -1
- package/dist/cli/team-config.js +2 -21
- package/dist/cli/team-config.js.map +1 -1
- package/dist/cli/tiers.test.js +4 -13
- package/dist/cli/tiers.test.js.map +1 -1
- package/package.json +3 -10
- package/src/cli/agent-roster.test.ts +0 -55
- package/src/cli/boundary.test.ts +9 -7
- package/src/cli/convoy/TELEMETRY.md +131 -125
- package/src/cli/convoy/artifacts.test.ts +4 -2
- package/src/cli/convoy/artifacts.ts +13 -12
- package/src/cli/convoy/engine.git.test.ts +462 -0
- package/src/cli/convoy/engine.test.ts +817 -850
- package/src/cli/convoy/engine.ts +1864 -2596
- package/src/cli/convoy/event-schemas.ts +63 -59
- package/src/cli/convoy/events.test.ts +58 -9
- package/src/cli/convoy/events.ts +69 -91
- package/src/cli/convoy/gates.ts +31 -12
- package/src/cli/convoy/isolation.test.ts +76 -43
- package/src/cli/convoy/isolation.ts +100 -38
- package/src/cli/convoy/lock.test.ts +16 -0
- package/src/cli/convoy/lock.ts +25 -8
- package/src/cli/convoy/merge.test.ts +25 -1
- package/src/cli/convoy/merge.ts +74 -61
- package/src/cli/convoy/progress.test.ts +59 -0
- package/src/cli/convoy/progress.ts +121 -0
- package/src/cli/convoy/read-model.test.ts +685 -0
- package/src/cli/convoy/read-model.ts +1469 -0
- package/src/cli/convoy/redact.test.ts +49 -0
- package/src/cli/convoy/redact.ts +73 -0
- package/src/cli/convoy/reviewer.test.ts +112 -0
- package/src/cli/convoy/reviewer.ts +196 -0
- package/src/cli/convoy/schedule.test.ts +56 -0
- package/src/cli/convoy/schedule.ts +109 -0
- package/src/cli/convoy/spec-builder.test.ts +460 -464
- package/src/cli/convoy/spec-builder.ts +460 -129
- package/src/cli/convoy/spec-types.ts +46 -108
- package/src/cli/convoy/store.test.ts +64 -13
- package/src/cli/convoy/store.ts +143 -33
- package/src/cli/convoy/types.ts +59 -71
- package/src/cli/convoy/worktree.test.ts +140 -1
- package/src/cli/convoy/worktree.ts +311 -61
- package/src/cli/convoy-args.test.ts +10 -30
- package/src/cli/convoy-cmd.test.ts +163 -0
- package/src/cli/convoy-cmd.ts +173 -216
- package/src/cli/dashboard/dashboard.css +2086 -0
- package/src/cli/dashboard/dashboard.js +1687 -0
- package/src/cli/dashboard/index.html +307 -0
- package/src/cli/dashboard.test.ts +382 -0
- package/src/cli/dashboard.ts +243 -339
- package/src/cli/dispatcher.test.ts +36 -2
- package/src/cli/docs-accuracy.test.ts +3 -3
- package/src/cli/log.test.ts +228 -0
- package/src/cli/log.ts +302 -83
- package/src/cli/nearest.test.ts +27 -0
- package/src/cli/nearest.ts +38 -0
- package/src/cli/pipeline.flow.test.ts +607 -0
- package/src/cli/pipeline.ts +544 -759
- package/src/cli/plan.test.ts +193 -0
- package/src/cli/plan.ts +209 -545
- package/src/cli/run/adapters/agent-process.test.ts +175 -0
- package/src/cli/run/adapters/agent-process.ts +252 -0
- package/src/cli/run/adapters/claude.test.ts +205 -260
- package/src/cli/run/adapters/claude.ts +151 -162
- package/src/cli/run/adapters/codex.test.ts +120 -100
- package/src/cli/run/adapters/codex.ts +115 -91
- package/src/cli/run/adapters/copilot.test.ts +135 -306
- package/src/cli/run/adapters/copilot.ts +105 -274
- package/src/cli/run/adapters/cursor.test.ts +111 -220
- package/src/cli/run/adapters/cursor.ts +105 -156
- package/src/cli/run/adapters/index.test.ts +148 -0
- package/src/cli/run/adapters/index.ts +168 -20
- package/src/cli/run/adapters/opencode.test.ts +106 -227
- package/src/cli/run/adapters/opencode.ts +139 -151
- package/src/cli/run/adapters/permission-modes.test.ts +63 -41
- package/src/cli/run/adapters/permission-modes.ts +118 -37
- package/src/cli/run/adapters/stub-cli.test-helper.ts +88 -0
- package/src/cli/run/platform.test.ts +128 -0
- package/src/cli/run/platform.ts +213 -0
- package/src/cli/run/schema.test.ts +62 -344
- package/src/cli/run/schema.ts +48 -78
- package/src/cli/run.test.ts +351 -0
- package/src/cli/run.ts +366 -1151
- package/src/cli/team-config.ts +2 -21
- package/src/cli/tiers.test.ts +4 -17
- package/src/orchestrator/agents/team-lead.agent.md +1 -1
- package/src/orchestrator/prompts/assess-complexity.prompt.md +43 -26
- package/src/orchestrator/prompts/brainstorm.prompt.md +1 -1
- package/src/orchestrator/prompts/bug-fix.prompt.md +2 -2
- package/src/orchestrator/prompts/fix-convoy.prompt.md +43 -29
- package/src/orchestrator/prompts/fix-prd.prompt.md +26 -22
- package/src/orchestrator/prompts/generate-convoy.prompt.md +139 -147
- package/src/orchestrator/prompts/generate-prd.prompt.md +75 -68
- package/src/orchestrator/prompts/implement-feature.prompt.md +2 -2
- package/src/orchestrator/prompts/validate-convoy.prompt.md +29 -28
- package/src/orchestrator/prompts/validate-prd.prompt.md +28 -21
- package/src/orchestrator/skills/agent-hooks/HOOKS-REFERENCE.md +3 -3
- package/src/orchestrator/skills/agent-hooks/SKILL.md +1 -1
- package/src/orchestrator/skills/fast-review/SKILL.md +3 -1
- package/src/orchestrator/skills/orchestration-protocols/SKILL.md +7 -8
- package/dist/cli/convoy/dag-analysis.d.ts +0 -39
- package/dist/cli/convoy/dag-analysis.d.ts.map +0 -1
- package/dist/cli/convoy/dag-analysis.js +0 -279
- package/dist/cli/convoy/dag-analysis.js.map +0 -1
- package/dist/cli/convoy/dag-analysis.test.d.ts +0 -2
- package/dist/cli/convoy/dag-analysis.test.d.ts.map +0 -1
- package/dist/cli/convoy/dag-analysis.test.js +0 -289
- package/dist/cli/convoy/dag-analysis.test.js.map +0 -1
- package/dist/cli/convoy/formula.d.ts +0 -19
- package/dist/cli/convoy/formula.d.ts.map +0 -1
- package/dist/cli/convoy/formula.js +0 -142
- package/dist/cli/convoy/formula.js.map +0 -1
- package/dist/cli/convoy/formula.test.d.ts +0 -2
- package/dist/cli/convoy/formula.test.d.ts.map +0 -1
- package/dist/cli/convoy/formula.test.js +0 -342
- package/dist/cli/convoy/formula.test.js.map +0 -1
- package/dist/cli/convoy/health.d.ts +0 -34
- package/dist/cli/convoy/health.d.ts.map +0 -1
- package/dist/cli/convoy/health.js +0 -123
- package/dist/cli/convoy/health.js.map +0 -1
- package/dist/cli/convoy/health.test.d.ts +0 -2
- package/dist/cli/convoy/health.test.d.ts.map +0 -1
- package/dist/cli/convoy/health.test.js +0 -448
- package/dist/cli/convoy/health.test.js.map +0 -1
- package/dist/cli/convoy/last-run.d.ts +0 -53
- package/dist/cli/convoy/last-run.d.ts.map +0 -1
- package/dist/cli/convoy/last-run.js +0 -54
- package/dist/cli/convoy/last-run.js.map +0 -1
- package/dist/cli/convoy/last-run.test.d.ts +0 -2
- package/dist/cli/convoy/last-run.test.d.ts.map +0 -1
- package/dist/cli/convoy/last-run.test.js +0 -110
- package/dist/cli/convoy/last-run.test.js.map +0 -1
- package/dist/cli/convoy/pipeline.d.ts +0 -41
- package/dist/cli/convoy/pipeline.d.ts.map +0 -1
- package/dist/cli/convoy/pipeline.js +0 -414
- package/dist/cli/convoy/pipeline.js.map +0 -1
- package/dist/cli/convoy/pipeline.test.d.ts +0 -2
- package/dist/cli/convoy/pipeline.test.d.ts.map +0 -1
- package/dist/cli/convoy/pipeline.test.js +0 -837
- package/dist/cli/convoy/pipeline.test.js.map +0 -1
- package/dist/cli/convoy/review-stages.d.ts +0 -9
- package/dist/cli/convoy/review-stages.d.ts.map +0 -1
- package/dist/cli/convoy/review-stages.js +0 -134
- package/dist/cli/convoy/review-stages.js.map +0 -1
- package/dist/cli/convoy/review-stages.test.d.ts +0 -2
- package/dist/cli/convoy/review-stages.test.d.ts.map +0 -1
- package/dist/cli/convoy/review-stages.test.js +0 -197
- package/dist/cli/convoy/review-stages.test.js.map +0 -1
- package/dist/cli/run/executor.d.ts +0 -15
- package/dist/cli/run/executor.d.ts.map +0 -1
- package/dist/cli/run/executor.js +0 -249
- package/dist/cli/run/executor.js.map +0 -1
- package/dist/cli/run/executor.test.d.ts +0 -2
- package/dist/cli/run/executor.test.d.ts.map +0 -1
- package/dist/cli/run/executor.test.js +0 -297
- package/dist/cli/run/executor.test.js.map +0 -1
- package/dist/cli/run/reporter.d.ts +0 -10
- package/dist/cli/run/reporter.d.ts.map +0 -1
- package/dist/cli/run/reporter.js +0 -142
- package/dist/cli/run/reporter.js.map +0 -1
- package/dist/cli/run-dry-run.test.d.ts +0 -2
- package/dist/cli/run-dry-run.test.d.ts.map +0 -1
- package/dist/cli/run-dry-run.test.js +0 -83
- package/dist/cli/run-dry-run.test.js.map +0 -1
- package/dist/cli/run-executor-flags.test.d.ts +0 -2
- package/dist/cli/run-executor-flags.test.d.ts.map +0 -1
- package/dist/cli/run-executor-flags.test.js +0 -31
- package/dist/cli/run-executor-flags.test.js.map +0 -1
- package/dist/cli/run-finish.test.d.ts +0 -2
- package/dist/cli/run-finish.test.d.ts.map +0 -1
- package/dist/cli/run-finish.test.js +0 -77
- package/dist/cli/run-finish.test.js.map +0 -1
- package/dist/cli/watch.d.ts +0 -15
- package/dist/cli/watch.d.ts.map +0 -1
- package/dist/cli/watch.js +0 -277
- package/dist/cli/watch.js.map +0 -1
- package/dist/dashboard/scripts/etl.d.ts +0 -10
- package/dist/dashboard/scripts/etl.d.ts.map +0 -1
- package/dist/dashboard/scripts/etl.js +0 -141
- package/dist/dashboard/scripts/etl.js.map +0 -1
- package/src/cli/convoy/dag-analysis.test.ts +0 -349
- package/src/cli/convoy/dag-analysis.ts +0 -367
- package/src/cli/convoy/formula.test.ts +0 -404
- package/src/cli/convoy/formula.ts +0 -174
- package/src/cli/convoy/health.test.ts +0 -519
- package/src/cli/convoy/health.ts +0 -189
- package/src/cli/convoy/last-run.test.ts +0 -130
- package/src/cli/convoy/last-run.ts +0 -87
- package/src/cli/convoy/pipeline.test.ts +0 -999
- package/src/cli/convoy/pipeline.ts +0 -492
- package/src/cli/convoy/review-stages.test.ts +0 -235
- package/src/cli/convoy/review-stages.ts +0 -166
- package/src/cli/run/executor.test.ts +0 -338
- package/src/cli/run/executor.ts +0 -292
- package/src/cli/run/reporter.ts +0 -160
- package/src/cli/run-dry-run.test.ts +0 -97
- package/src/cli/run-executor-flags.test.ts +0 -38
- package/src/cli/run-finish.test.ts +0 -91
- package/src/cli/watch.ts +0 -295
- package/src/dashboard/astro.config.mjs +0 -6
- package/src/dashboard/dist/_astro/index.CADNhRPS.css +0 -1
- package/src/dashboard/dist/data/.gitkeep +0 -0
- package/src/dashboard/dist/data/convoy-list.json +0 -1
- package/src/dashboard/dist/data/overall-stats.json +0 -29
- package/src/dashboard/dist/index.html +0 -1963
- package/src/dashboard/node_modules/.vite/deps/_metadata.json +0 -31
- package/src/dashboard/node_modules/.vite/deps/astro___aria-query.js +0 -6776
- package/src/dashboard/node_modules/.vite/deps/astro___aria-query.js.map +0 -7
- package/src/dashboard/node_modules/.vite/deps/astro___axobject-query.js +0 -3754
- package/src/dashboard/node_modules/.vite/deps/astro___axobject-query.js.map +0 -7
- package/src/dashboard/node_modules/.vite/deps/astro___cssesc.js +0 -99
- package/src/dashboard/node_modules/.vite/deps/astro___cssesc.js.map +0 -7
- package/src/dashboard/node_modules/.vite/deps/chunk-BUSYA2B4.js +0 -8
- package/src/dashboard/node_modules/.vite/deps/chunk-BUSYA2B4.js.map +0 -7
- package/src/dashboard/node_modules/.vite/deps/package.json +0 -3
- package/src/dashboard/package-lock.json +0 -6
- package/src/dashboard/public/data/.gitkeep +0 -0
- package/src/dashboard/public/data/convoy-list.json +0 -1
- package/src/dashboard/public/data/overall-stats.json +0 -29
- package/src/dashboard/public/icon-192.png +0 -0
- package/src/dashboard/scripts/etl.test.ts +0 -166
- package/src/dashboard/scripts/etl.ts +0 -170
- package/src/dashboard/scripts/generate-demo-db.test.ts +0 -30
- package/src/dashboard/scripts/generate-demo-db.ts +0 -529
- package/src/dashboard/scripts/integration-test.ts +0 -504
- package/src/dashboard/scripts/verify-demo-data.sh +0 -51
- package/src/dashboard/seed-data/delegations.ndjson +0 -35
- package/src/dashboard/seed-data/events.ndjson +0 -104
- package/src/dashboard/seed-data/panels.ndjson +0 -13
- package/src/dashboard/seed-data/reviews.ndjson +0 -6
- package/src/dashboard/seed-data/sessions.ndjson +0 -50
- package/src/dashboard/src/env.d.ts +0 -1
- package/src/dashboard/src/layouts/Layout.astro +0 -25
- package/src/dashboard/src/pages/index.astro +0 -2313
- package/src/dashboard/src/styles/dashboard.css +0 -2943
- package/src/dashboard/tsconfig.json +0 -6
- /package/src/{dashboard/dist → cli/dashboard}/icon-192.png +0 -0
|
@@ -0,0 +1,382 @@
|
|
|
1
|
+
import { existsSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, realpathSync, rmSync, writeFileSync } from 'node:fs'
|
|
2
|
+
import { execFileSync } from 'node:child_process'
|
|
3
|
+
import { createServer, request } from 'node:http'
|
|
4
|
+
import type { Server } from 'node:http'
|
|
5
|
+
import type { AddressInfo } from 'node:net'
|
|
6
|
+
import { tmpdir } from 'node:os'
|
|
7
|
+
import { join } from 'node:path'
|
|
8
|
+
import { afterEach, beforeEach, describe, expect, it } from 'vitest'
|
|
9
|
+
import { createConvoyStore } from './convoy/store.js'
|
|
10
|
+
import { PAGE_FILES, pageDir, parseDashboardArgs, startDashboard } from './dashboard.js'
|
|
11
|
+
import type { DashboardHandle } from './dashboard.js'
|
|
12
|
+
|
|
13
|
+
let root: string
|
|
14
|
+
const open: DashboardHandle[] = []
|
|
15
|
+
const blockers: Server[] = []
|
|
16
|
+
|
|
17
|
+
beforeEach(() => {
|
|
18
|
+
root = realpathSync(mkdtempSync(join(tmpdir(), 'dashboard-')))
|
|
19
|
+
mkdirSync(join(root, '.opencastle'), { recursive: true })
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
afterEach(async () => {
|
|
23
|
+
await Promise.all(open.splice(0).map((v) => v.close()))
|
|
24
|
+
await Promise.all(blockers.splice(0).map((s) => new Promise((done) => s.close(done))))
|
|
25
|
+
rmSync(root, { recursive: true, force: true })
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
async function dashboard(port = 0): Promise<DashboardHandle> {
|
|
29
|
+
const v = await startDashboard({ projectRoot: root, port, open: false })
|
|
30
|
+
open.push(v)
|
|
31
|
+
return v
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function portOf(url: string): number {
|
|
35
|
+
return Number(new URL(url).port)
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** A server that is not ours, holding a port and answering with its own name. */
|
|
39
|
+
async function occupy(port = 0): Promise<number> {
|
|
40
|
+
const s = createServer((_, res) => res.end('someone else'))
|
|
41
|
+
blockers.push(s)
|
|
42
|
+
await new Promise<void>((done) => s.listen(port, '127.0.0.1', done))
|
|
43
|
+
return (s.address() as AddressInfo).port
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function seed(): void {
|
|
47
|
+
const store = createConvoyStore(join(root, '.opencastle', 'convoy.db'))
|
|
48
|
+
const at = '2026-10-01T10:00:00.000Z'
|
|
49
|
+
store.insertConvoy({ id: 'convoy-1', name: 'Demo', spec_hash: 'h', status: 'pending', branch: null, created_at: at, spec_yaml: 'x' })
|
|
50
|
+
store.insertTask({
|
|
51
|
+
id: 'a', convoy_id: 'convoy-1', phase: 0, prompt: 'p', agent: 'developer', adapter: null, model: null,
|
|
52
|
+
timeout_ms: 1000, status: 'pending', retries: 0, max_retries: 0, files: null, depends_on: null, gates: null,
|
|
53
|
+
})
|
|
54
|
+
store.updateConvoyStatus('convoy-1', 'done', { started_at: at, finished_at: at })
|
|
55
|
+
for (const type of ['convoy_started', 'task_started', 'task_done', 'convoy_finished']) {
|
|
56
|
+
store.insertEvent({ convoy_id: 'convoy-1', task_id: null, worker_id: null, type, data: null, created_at: at })
|
|
57
|
+
}
|
|
58
|
+
store.close()
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
async function json(url: string): Promise<{ status: number; body: Record<string, unknown> }> {
|
|
62
|
+
const res = await fetch(url)
|
|
63
|
+
return { status: res.status, body: (await res.json()) as Record<string, unknown> }
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
describe('startDashboard', () => {
|
|
67
|
+
it('binds 127.0.0.1 and reports the port the OS gave it', async () => {
|
|
68
|
+
const v = await dashboard(0)
|
|
69
|
+
expect(v.url).toMatch(/^http:\/\/127\.0\.0\.1:\d+$/)
|
|
70
|
+
expect(portOf(v.url)).toBeGreaterThan(0)
|
|
71
|
+
const res = await fetch(v.url)
|
|
72
|
+
expect(res.headers.get('content-type')).toMatch(/text\/html/)
|
|
73
|
+
expect(await res.text()).toContain('name="opencastle-dashboard" content="live"')
|
|
74
|
+
})
|
|
75
|
+
|
|
76
|
+
it('serves the page, its stylesheet, script and icon from the package, and nothing else from disk', async () => {
|
|
77
|
+
const v = await dashboard()
|
|
78
|
+
const page = await fetch(`${v.url}/`)
|
|
79
|
+
expect(page.headers.get('content-security-policy')).toContain("script-src 'self'")
|
|
80
|
+
const html = await page.text()
|
|
81
|
+
for (const file of ['dashboard.css', 'dashboard.js', 'icon-192.png']) {
|
|
82
|
+
expect(html).toContain(file)
|
|
83
|
+
const res = await fetch(`${v.url}/${file}`)
|
|
84
|
+
expect(res.status).toBe(200)
|
|
85
|
+
expect(res.headers.get('content-type')).toBe(PAGE_FILES[file])
|
|
86
|
+
expect(Buffer.from(await res.arrayBuffer()).equals(readFileSync(join(pageDir(), file)))).toBe(true)
|
|
87
|
+
}
|
|
88
|
+
expect((await fetch(`${v.url}/index.html`)).status).toBe(200)
|
|
89
|
+
for (const path of ['/dashboard.ts', '/../package.json', '/%2e%2e/package.json', '/data/runs.json', '/.opencastle/convoy.db']) {
|
|
90
|
+
expect((await fetch(`${v.url}${path}`)).status).toBe(404)
|
|
91
|
+
}
|
|
92
|
+
})
|
|
93
|
+
|
|
94
|
+
it('the page reads only data the API returns', () => {
|
|
95
|
+
// No figure is made up in the browser: no seed data, no per-task token
|
|
96
|
+
// guess, no tier inferred from a model name, no phase labels.
|
|
97
|
+
const script = readFileSync(join(pageDir(), 'dashboard.js'), 'utf8')
|
|
98
|
+
for (const banned of [/\*\s*5000\b/, /estTokens/, /\bderiveTier\b/, /PREMIUM_AGENTS|ECONOMY_AGENTS/, /Foundation|Integration|Validation|QA Gate/, /seed/i, /Math\.random/, /\bphase\b/]) {
|
|
99
|
+
expect(script).not.toMatch(banned)
|
|
100
|
+
}
|
|
101
|
+
})
|
|
102
|
+
|
|
103
|
+
it('moves past a busy port and reports the one it actually bound', async () => {
|
|
104
|
+
const busy = await occupy()
|
|
105
|
+
const v = await dashboard(busy)
|
|
106
|
+
expect(portOf(v.url)).toBe(busy + 1)
|
|
107
|
+
expect(await (await fetch(v.url)).text()).toContain('opencastle-dashboard')
|
|
108
|
+
// The other process keeps its port and its answers.
|
|
109
|
+
expect(await (await fetch(`http://127.0.0.1:${busy}`)).text()).toBe('someone else')
|
|
110
|
+
})
|
|
111
|
+
|
|
112
|
+
it('skips several busy ports in a row', async () => {
|
|
113
|
+
const first = await occupy()
|
|
114
|
+
let second: number
|
|
115
|
+
try {
|
|
116
|
+
second = await occupy(first + 1)
|
|
117
|
+
} catch {
|
|
118
|
+
return // the next port happened to be taken by something else; nothing to assert
|
|
119
|
+
}
|
|
120
|
+
const v = await dashboard(first)
|
|
121
|
+
expect(portOf(v.url)).toBe(second + 1)
|
|
122
|
+
})
|
|
123
|
+
|
|
124
|
+
it('serves runs with the overview, one run with its insights, events after a cursor, and sessions', async () => {
|
|
125
|
+
seed()
|
|
126
|
+
mkdirSync(join(root, '.opencastle', 'logs'), { recursive: true })
|
|
127
|
+
writeFileSync(
|
|
128
|
+
join(root, '.opencastle', 'logs', 'events.ndjson'),
|
|
129
|
+
JSON.stringify({ type: 'session', timestamp: '2026-10-01T10:00:00.000Z', agent: 'Developer', task: 't', outcome: 'success' }) + '\n',
|
|
130
|
+
)
|
|
131
|
+
const v = await dashboard()
|
|
132
|
+
|
|
133
|
+
const runs = await json(`${v.url}/api/runs`)
|
|
134
|
+
expect(runs.status).toBe(200)
|
|
135
|
+
expect(runs.body.project).toBe(root.split(/[\\/]/).pop())
|
|
136
|
+
expect((runs.body.runs as Array<{ id: string }>).map((r) => r.id)).toEqual(['convoy-1'])
|
|
137
|
+
expect((runs.body.categories as Record<string, string[]>).task).toContain('task_failed')
|
|
138
|
+
expect(runs.body.overview).toMatchObject({ runs: { total: 1, by_status: { done: 1 } }, tasks: { total: 1 }, tokens: { total: null } })
|
|
139
|
+
|
|
140
|
+
const run = await json(`${v.url}/api/runs/convoy-1`)
|
|
141
|
+
expect(run.body.run).toMatchObject({ id: 'convoy-1', name: 'Demo', alive: false, tasks_total: 1, display_status: 'done' })
|
|
142
|
+
expect(run.body.insights).toMatchObject({ events_recorded: true, starts: {}, reviews: [], checks: [], dlq: [], artifacts: [] })
|
|
143
|
+
|
|
144
|
+
const all = await json(`${v.url}/api/runs/convoy-1/events?since=0`)
|
|
145
|
+
const events = all.body.events as Array<{ id: number; type: string }>
|
|
146
|
+
expect(events.map((e) => e.type)).toEqual(['convoy_started', 'task_started', 'task_done', 'convoy_finished'])
|
|
147
|
+
expect(all.body.more).toBe(false)
|
|
148
|
+
const newer = await json(`${v.url}/api/runs/convoy-1/events?since=${events[1].id}`)
|
|
149
|
+
expect((newer.body.events as Array<{ type: string }>).map((e) => e.type)).toEqual(['task_done', 'convoy_finished'])
|
|
150
|
+
|
|
151
|
+
const page = await json(`${v.url}/api/runs/convoy-1/events?since=0&limit=3`)
|
|
152
|
+
expect((page.body.events as unknown[]).length).toBe(3)
|
|
153
|
+
expect(page.body.more).toBe(true)
|
|
154
|
+
const rest = await json(`${v.url}/api/runs/convoy-1/events?since=${(page.body.events as Array<{ id: number }>)[2].id}&limit=3`)
|
|
155
|
+
expect((rest.body.events as Array<{ type: string }>).map((e) => e.type)).toEqual(['convoy_finished'])
|
|
156
|
+
expect(rest.body.more).toBe(false)
|
|
157
|
+
|
|
158
|
+
const sessions = await json(`${v.url}/api/sessions`)
|
|
159
|
+
expect(sessions.body.sessions).toMatchObject([{ source: 'log', agent: 'Developer', outcome: 'success' }])
|
|
160
|
+
})
|
|
161
|
+
|
|
162
|
+
it('answers unknown runs and paths with 404, and a bad cursor with 400', async () => {
|
|
163
|
+
seed()
|
|
164
|
+
const v = await dashboard()
|
|
165
|
+
expect((await json(`${v.url}/api/runs/nope`)).status).toBe(404)
|
|
166
|
+
expect((await json(`${v.url}/api/nothing`)).status).toBe(404)
|
|
167
|
+
expect((await json(`${v.url}/api/runs/convoy-1/events?since=-1`)).status).toBe(400)
|
|
168
|
+
expect((await json(`${v.url}/api/runs/convoy-1/events?since=abc`)).status).toBe(400)
|
|
169
|
+
expect((await json(`${v.url}/api/runs/convoy-1/events?limit=0`)).status).toBe(400)
|
|
170
|
+
expect((await json(`${v.url}/api/runs/convoy-1/events?limit=5000`)).status).toBe(400)
|
|
171
|
+
})
|
|
172
|
+
|
|
173
|
+
it('is read-only', async () => {
|
|
174
|
+
const v = await dashboard()
|
|
175
|
+
expect((await fetch(`${v.url}/api/runs`, { method: 'POST' })).status).toBe(405)
|
|
176
|
+
})
|
|
177
|
+
|
|
178
|
+
it('shows an empty project without creating a database', async () => {
|
|
179
|
+
const v = await dashboard()
|
|
180
|
+
expect((await json(`${v.url}/api/runs`)).body.runs).toEqual([])
|
|
181
|
+
expect(readdirSync(join(root, '.opencastle'))).toEqual([])
|
|
182
|
+
})
|
|
183
|
+
|
|
184
|
+
it('refuses requests addressed to another host name (DNS rebinding)', async () => {
|
|
185
|
+
const v = await dashboard()
|
|
186
|
+
const status = await new Promise<number>((done, fail) => {
|
|
187
|
+
const req = request(`${v.url}/api/runs`, { headers: { Host: 'attacker.example' } }, (res) => {
|
|
188
|
+
res.resume()
|
|
189
|
+
done(res.statusCode ?? 0)
|
|
190
|
+
})
|
|
191
|
+
req.on('error', fail)
|
|
192
|
+
req.end()
|
|
193
|
+
})
|
|
194
|
+
expect(status).toBe(403)
|
|
195
|
+
})
|
|
196
|
+
|
|
197
|
+
it('closes promptly with a keep-alive connection open', async () => {
|
|
198
|
+
const v = await startDashboard({ projectRoot: root, port: 0, open: false })
|
|
199
|
+
await fetch(`${v.url}/api/runs`) // leaves a pooled keep-alive socket behind
|
|
200
|
+
const started = Date.now()
|
|
201
|
+
await v.close()
|
|
202
|
+
expect(Date.now() - started).toBeLessThan(2000)
|
|
203
|
+
await expect(fetch(`${v.url}/api/runs`)).rejects.toThrow()
|
|
204
|
+
})
|
|
205
|
+
})
|
|
206
|
+
|
|
207
|
+
const repoRoot = join(import.meta.dirname, '..', '..')
|
|
208
|
+
const exporter = join(repoRoot, 'tools', 'dashboard-demo', 'export.mjs')
|
|
209
|
+
const assembler = join(repoRoot, 'tools', 'dashboard-demo', 'assemble.mjs')
|
|
210
|
+
|
|
211
|
+
/** The static site assemble.mjs builds from a snapshot directory. */
|
|
212
|
+
function assemble(from: string, to: string): void {
|
|
213
|
+
execFileSync(process.execPath, [assembler, from, to], { stdio: 'pipe' })
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/** The site is the page the CLI serves, switched to static mode, beside the data. */
|
|
217
|
+
function expectStaticPage(site: string): void {
|
|
218
|
+
expect(readFileSync(join(site, 'index.html'), 'utf8')).toBe(
|
|
219
|
+
readFileSync(join(pageDir(), 'index.html'), 'utf8').replace('content="live"', 'content="static"'),
|
|
220
|
+
)
|
|
221
|
+
for (const file of ['dashboard.css', 'dashboard.js', 'icon-192.png']) {
|
|
222
|
+
expect(readFileSync(join(site, file)).equals(readFileSync(join(pageDir(), file)))).toBe(true)
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
const snapshot = join(repoRoot, 'tools', 'dashboard-demo', 'snapshot')
|
|
226
|
+
const built = existsSync(join(repoRoot, 'dist', 'cli', 'convoy', 'read-model.js'))
|
|
227
|
+
|
|
228
|
+
/** A second project beside `root`, with one run whose events mention where it lives. */
|
|
229
|
+
function secondProject(extra = ''): string {
|
|
230
|
+
const other = realpathSync(mkdtempSync(join(tmpdir(), 'dashboard-other-')))
|
|
231
|
+
mkdirSync(join(other, '.opencastle'), { recursive: true })
|
|
232
|
+
const store = createConvoyStore(join(other, '.opencastle', 'convoy.db'))
|
|
233
|
+
const at = '2026-10-02T10:00:00.000Z'
|
|
234
|
+
store.insertConvoy({ id: 'convoy-2', name: 'Other', spec_hash: 'h', status: 'pending', branch: null, created_at: at, spec_yaml: 'x' })
|
|
235
|
+
store.updateConvoyStatus('convoy-2', 'running', { started_at: at })
|
|
236
|
+
store.insertEvent({
|
|
237
|
+
convoy_id: 'convoy-2', task_id: null, worker_id: null, type: 'merge_failed',
|
|
238
|
+
data: JSON.stringify({ branch: 'b', error: `cannot lock ${other}/.git/HEAD${extra}` }), created_at: at,
|
|
239
|
+
})
|
|
240
|
+
store.close()
|
|
241
|
+
return other
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
function run(args: string[]): { status: number; stderr: string } {
|
|
245
|
+
try {
|
|
246
|
+
execFileSync(process.execPath, [exporter, ...args], { stdio: 'pipe' })
|
|
247
|
+
return { status: 0, stderr: '' }
|
|
248
|
+
} catch (err) {
|
|
249
|
+
const e = err as { status: number; stderr: Buffer }
|
|
250
|
+
return { status: e.status, stderr: String(e.stderr) }
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
// The exporter reads through the compiled read model, as it does when run by hand.
|
|
255
|
+
describe.skipIf(!built)('the static export', () => {
|
|
256
|
+
it('writes every file the page reads, and only data, combining projects', () => {
|
|
257
|
+
seed()
|
|
258
|
+
const other = secondProject()
|
|
259
|
+
try {
|
|
260
|
+
const out = join(root, 'out')
|
|
261
|
+
expect(run(['--out', out, '--name', 'examples', root, other]).status).toBe(0)
|
|
262
|
+
// No copy of the page: assemble.mjs puts the current one beside the data.
|
|
263
|
+
expect(readdirSync(out)).toEqual(['data'])
|
|
264
|
+
const site = join(root, 'site')
|
|
265
|
+
assemble(out, site)
|
|
266
|
+
expectStaticPage(site)
|
|
267
|
+
const read = (rel: string): Record<string, unknown> => JSON.parse(readFileSync(join(out, 'data', rel), 'utf8'))
|
|
268
|
+
const runs = read('runs.json')
|
|
269
|
+
expect(runs).toMatchObject({ project: 'examples', projects: 2 })
|
|
270
|
+
// A snapshot is never live; the run left "running" reads as interrupted.
|
|
271
|
+
expect(runs.runs).toMatchObject([
|
|
272
|
+
{ id: 'convoy-2', alive: false, status: 'running', display_status: 'interrupted' },
|
|
273
|
+
{ id: 'convoy-1', alive: false, display_status: 'done' },
|
|
274
|
+
])
|
|
275
|
+
expect(runs.overview).toMatchObject({ runs: { total: 2, by_status: { done: 1, interrupted: 1 } } })
|
|
276
|
+
expect(read('runs/convoy-1.json')).toMatchObject({ run: { id: 'convoy-1', tasks: [{ id: 'a' }] }, insights: { events_recorded: true } })
|
|
277
|
+
expect((read('events/convoy-1.json').events as unknown[]).length).toBe(4)
|
|
278
|
+
expect(read('sessions.json').sessions).toEqual([])
|
|
279
|
+
// The project's own path is replaced before anything is written.
|
|
280
|
+
const events = JSON.stringify(read('events/convoy-2.json'))
|
|
281
|
+
expect(events).toContain('cannot lock <project>/.git/HEAD')
|
|
282
|
+
expect(events).not.toContain(other)
|
|
283
|
+
} finally {
|
|
284
|
+
rmSync(other, { recursive: true, force: true })
|
|
285
|
+
}
|
|
286
|
+
})
|
|
287
|
+
|
|
288
|
+
it('refuses to write a snapshot that still holds a local path', () => {
|
|
289
|
+
seed()
|
|
290
|
+
const other = secondProject(' (see /Users/someone/notes.txt)')
|
|
291
|
+
try {
|
|
292
|
+
const out = join(root, 'out')
|
|
293
|
+
const res = run(['--out', out, root, other])
|
|
294
|
+
expect(res.status).toBe(1)
|
|
295
|
+
expect(res.stderr).toMatch(/Refusing to write/)
|
|
296
|
+
expect(existsSync(join(out, 'data'))).toBe(false)
|
|
297
|
+
} finally {
|
|
298
|
+
rmSync(other, { recursive: true, force: true })
|
|
299
|
+
}
|
|
300
|
+
})
|
|
301
|
+
|
|
302
|
+
it('refuses a project with no runs, and a run that two projects both hold', () => {
|
|
303
|
+
const out = join(root, 'out')
|
|
304
|
+
expect(run(['--out', out, root]).stderr).toMatch(/No convoy runs recorded/)
|
|
305
|
+
seed()
|
|
306
|
+
const twin = realpathSync(mkdtempSync(join(tmpdir(), 'dashboard-twin-')))
|
|
307
|
+
try {
|
|
308
|
+
mkdirSync(join(twin, '.opencastle'), { recursive: true })
|
|
309
|
+
execFileSync('cp', [join(root, '.opencastle', 'convoy.db'), join(twin, '.opencastle', 'convoy.db')])
|
|
310
|
+
expect(run(['--out', out, root, twin]).stderr).toMatch(/is in both/)
|
|
311
|
+
} finally {
|
|
312
|
+
rmSync(twin, { recursive: true, force: true })
|
|
313
|
+
}
|
|
314
|
+
})
|
|
315
|
+
})
|
|
316
|
+
|
|
317
|
+
describe('the committed demo snapshot', () => {
|
|
318
|
+
const read = (rel: string): Record<string, unknown> => JSON.parse(readFileSync(join(snapshot, rel), 'utf8'))
|
|
319
|
+
|
|
320
|
+
it('holds data only, and assembles into the page the CLI serves, as the deploy does', () => {
|
|
321
|
+
expect(readdirSync(snapshot)).toEqual(['data'])
|
|
322
|
+
const site = mkdtempSync(join(tmpdir(), 'dashboard-site-'))
|
|
323
|
+
try {
|
|
324
|
+
assemble(snapshot, site)
|
|
325
|
+
expectStaticPage(site)
|
|
326
|
+
expect(existsSync(join(site, 'data', 'runs.json'))).toBe(true)
|
|
327
|
+
} finally {
|
|
328
|
+
rmSync(site, { recursive: true, force: true })
|
|
329
|
+
}
|
|
330
|
+
})
|
|
331
|
+
|
|
332
|
+
it('has a file for every run it lists, and none is live', () => {
|
|
333
|
+
const runs = read('data/runs.json') as { runs: Array<{ id: string; alive: boolean }>; overview: { runs: { total: number } } }
|
|
334
|
+
expect(runs.runs.length).toBeGreaterThan(1)
|
|
335
|
+
expect(runs.overview.runs.total).toBe(runs.runs.length)
|
|
336
|
+
for (const r of runs.runs) {
|
|
337
|
+
expect(r.alive).toBe(false)
|
|
338
|
+
const file = r.id.replace(/[^\w.-]/g, '_')
|
|
339
|
+
const detail = read(`data/runs/${file}.json`) as { run: { tasks: unknown[] }; insights: unknown }
|
|
340
|
+
expect(Array.isArray(detail.run.tasks)).toBe(true)
|
|
341
|
+
expect(detail.insights).toBeTruthy()
|
|
342
|
+
expect(existsSync(join(snapshot, 'data', 'events', `${file}.json`))).toBe(true)
|
|
343
|
+
}
|
|
344
|
+
expect(existsSync(join(snapshot, 'data', 'sessions.json'))).toBe(true)
|
|
345
|
+
})
|
|
346
|
+
|
|
347
|
+
it('holds no local path', () => {
|
|
348
|
+
const walk = (dir: string): string[] => readdirSync(dir, { withFileTypes: true }).flatMap((e) => (e.isDirectory() ? walk(join(dir, e.name)) : [join(dir, e.name)]))
|
|
349
|
+
for (const file of walk(join(snapshot, 'data'))) {
|
|
350
|
+
expect(readFileSync(file, 'utf8'), file).not.toMatch(/\/Users\/|\/home\/|\/private\/(tmp|var)|\/var\/folders|claude-501/)
|
|
351
|
+
}
|
|
352
|
+
})
|
|
353
|
+
})
|
|
354
|
+
|
|
355
|
+
describe('parseDashboardArgs', () => {
|
|
356
|
+
it('defaults to port 4300 and opening a browser', () => {
|
|
357
|
+
expect(parseDashboardArgs([])).toEqual({ port: 4300, open: true, help: false })
|
|
358
|
+
})
|
|
359
|
+
|
|
360
|
+
it('reads --port, including 0, and --no-open', () => {
|
|
361
|
+
expect(parseDashboardArgs(['--port', '0', '--no-open'])).toEqual({ port: 0, open: false, help: false })
|
|
362
|
+
expect(parseDashboardArgs(['--port', '5000'])).toMatchObject({ port: 5000 })
|
|
363
|
+
})
|
|
364
|
+
|
|
365
|
+
it('refuses a missing or invalid port instead of ignoring it', () => {
|
|
366
|
+
expect(parseDashboardArgs(['--port'])).toHaveProperty('error')
|
|
367
|
+
expect(parseDashboardArgs(['--port', '--no-open'])).toHaveProperty('error')
|
|
368
|
+
expect(parseDashboardArgs(['--port', '70000'])).toHaveProperty('error')
|
|
369
|
+
expect(parseDashboardArgs(['--port', 'abc'])).toHaveProperty('error')
|
|
370
|
+
})
|
|
371
|
+
|
|
372
|
+
it('names the nearest flag for a misspelled one', () => {
|
|
373
|
+
expect(parseDashboardArgs(['--prot', '4400'])).toEqual({ error: 'Unknown option --prot. Did you mean --port?' })
|
|
374
|
+
expect((parseDashboardArgs(['--seed']) as { error: string }).error).toMatch(/Unknown option --seed/)
|
|
375
|
+
})
|
|
376
|
+
})
|
|
377
|
+
|
|
378
|
+
describe('a flag nowhere near one the dashboard takes', () => {
|
|
379
|
+
it('lists what it accepts instead of guessing', () => {
|
|
380
|
+
expect(parseDashboardArgs(['--json'])).toEqual({ error: 'Unknown option --json. It accepts --port, --no-open, --help, -h.' })
|
|
381
|
+
})
|
|
382
|
+
})
|