@cnc-tools/storm 0.0.0 → 0.6.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/bin/node-version.js +24 -0
- package/bin/storm.js +16 -0
- package/dist/application.d.ts +13 -0
- package/dist/application.js +23 -0
- package/dist/bin/storm.d.ts +1 -0
- package/dist/bin/storm.js +45 -0
- package/dist/build-info.js +3 -0
- package/dist/closed-terminal.d.ts +7 -0
- package/dist/closed-terminal.js +18 -0
- package/dist/combine-errors.d.ts +11 -0
- package/dist/combine-errors.js +19 -0
- package/dist/commands/dashboard.d.ts +11 -0
- package/dist/commands/dashboard.js +18 -0
- package/dist/commands/exec/cleanup.d.ts +135 -0
- package/dist/commands/exec/cleanup.js +171 -0
- package/dist/commands/exec/command.d.ts +272 -0
- package/dist/commands/exec/command.js +23 -0
- package/dist/commands/exec/job-summary.d.ts +10 -0
- package/dist/commands/exec/job-summary.js +34 -0
- package/dist/commands/exec/live-view.d.ts +22 -0
- package/dist/commands/exec/live-view.js +395 -0
- package/dist/commands/exec/metadata.d.ts +66 -0
- package/dist/commands/exec/metadata.js +55 -0
- package/dist/commands/exec/mint-failed.d.ts +11 -0
- package/dist/commands/exec/mint-failed.js +33 -0
- package/dist/commands/exec/outcomes.d.ts +614 -0
- package/dist/commands/exec/outcomes.js +338 -0
- package/dist/commands/exec/progress.d.ts +44 -0
- package/dist/commands/exec/progress.js +277 -0
- package/dist/commands/exec/redaction.d.ts +15 -0
- package/dist/commands/exec/redaction.js +40 -0
- package/dist/commands/exec/run-collector.d.ts +30 -0
- package/dist/commands/exec/run-collector.js +73 -0
- package/dist/commands/exec/run-command.d.ts +221 -0
- package/dist/commands/exec/run-command.js +663 -0
- package/dist/commands/exec/run-metadata.d.ts +56 -0
- package/dist/commands/exec/run-metadata.js +58 -0
- package/dist/commands/exec/run-record.d.ts +170 -0
- package/dist/commands/exec/run-record.js +104 -0
- package/dist/commands/exec/tests-summary.d.ts +34 -0
- package/dist/commands/exec/tests-summary.js +141 -0
- package/dist/commands/exec/testserver-flags.d.ts +48 -0
- package/dist/commands/exec/testserver-flags.js +80 -0
- package/dist/commands/exec/text.d.ts +22 -0
- package/dist/commands/exec/text.js +74 -0
- package/dist/commands/exec/view.d.ts +35 -0
- package/dist/commands/exec/view.js +163 -0
- package/dist/commands/exec/waterfall.d.ts +25 -0
- package/dist/commands/exec/waterfall.js +108 -0
- package/dist/commands/exec/worker-chart.d.ts +79 -0
- package/dist/commands/exec/worker-chart.js +313 -0
- package/dist/commands/runs/facts.d.ts +150 -0
- package/dist/commands/runs/facts.js +292 -0
- package/dist/commands/runs/list/command.d.ts +86 -0
- package/dist/commands/runs/list/command.js +36 -0
- package/dist/commands/runs/list/metadata.d.ts +22 -0
- package/dist/commands/runs/list/metadata.js +19 -0
- package/dist/commands/runs/list/outcomes.d.ts +74 -0
- package/dist/commands/runs/list/outcomes.js +89 -0
- package/dist/commands/runs/logs/command.d.ts +72 -0
- package/dist/commands/runs/logs/command.js +51 -0
- package/dist/commands/runs/logs/metadata.d.ts +22 -0
- package/dist/commands/runs/logs/metadata.js +22 -0
- package/dist/commands/runs/logs/outcomes.d.ts +55 -0
- package/dist/commands/runs/logs/outcomes.js +80 -0
- package/dist/commands/runs/metadata.d.ts +3 -0
- package/dist/commands/runs/metadata.js +3 -0
- package/dist/commands/runs/past-run.d.ts +72 -0
- package/dist/commands/runs/past-run.js +99 -0
- package/dist/commands/runs/show/command.d.ts +176 -0
- package/dist/commands/runs/show/command.js +76 -0
- package/dist/commands/runs/show/metadata.d.ts +25 -0
- package/dist/commands/runs/show/metadata.js +22 -0
- package/dist/commands/runs/show/outcomes.d.ts +164 -0
- package/dist/commands/runs/show/outcomes.js +320 -0
- package/dist/commands/vitest/command.d.ts +299 -0
- package/dist/commands/vitest/command.js +138 -0
- package/dist/commands/vitest/metadata.d.ts +66 -0
- package/dist/commands/vitest/metadata.js +35 -0
- package/dist/commands/vitest/outcomes.d.ts +273 -0
- package/dist/commands/vitest/outcomes.js +77 -0
- package/dist/config/by-name.d.ts +24 -0
- package/dist/config/by-name.js +26 -0
- package/dist/config/errors.d.ts +58 -0
- package/dist/config/errors.js +101 -0
- package/dist/config/gateways.d.ts +32 -0
- package/dist/config/gateways.js +1 -0
- package/dist/config/index.d.ts +10 -0
- package/dist/config/index.js +13 -0
- package/dist/config/live/config-gateway.d.ts +6 -0
- package/dist/config/live/config-gateway.js +71 -0
- package/dist/config/load.d.ts +54 -0
- package/dist/config/load.js +175 -0
- package/dist/config/resolve.d.ts +49 -0
- package/dist/config/resolve.js +94 -0
- package/dist/config/resource-config.d.ts +132 -0
- package/dist/config/resource-config.js +19 -0
- package/dist/config/schema.d.ts +64 -0
- package/dist/config/schema.js +57 -0
- package/dist/config/set.d.ts +27 -0
- package/dist/config/set.js +71 -0
- package/dist/config/settings-file.d.ts +41 -0
- package/dist/config/settings-file.js +72 -0
- package/dist/config-file/define.d.ts +39 -0
- package/dist/config-file/define.js +9 -0
- package/dist/config-file/toolchain.d.ts +9 -0
- package/dist/config-file/toolchain.js +41 -0
- package/dist/context.d.ts +89 -0
- package/dist/context.js +45 -0
- package/dist/core/command-provider.d.ts +126 -0
- package/dist/core/command-provider.js +13 -0
- package/dist/core/command-slots.d.ts +67 -0
- package/dist/core/command-slots.js +136 -0
- package/dist/core/events.d.ts +128 -0
- package/dist/core/events.js +15 -0
- package/dist/core/gateways.d.ts +249 -0
- package/dist/core/gateways.js +1 -0
- package/dist/core/index.d.ts +20 -0
- package/dist/core/index.js +18 -0
- package/dist/core/keyed.d.ts +12 -0
- package/dist/core/keyed.js +24 -0
- package/dist/core/lane.d.ts +46 -0
- package/dist/core/lane.js +5 -0
- package/dist/core/limit.d.ts +9 -0
- package/dist/core/limit.js +29 -0
- package/dist/core/live/command-gateway.d.ts +11 -0
- package/dist/core/live/command-gateway.js +83 -0
- package/dist/core/live/job-summary-gateway.d.ts +5 -0
- package/dist/core/live/job-summary-gateway.js +20 -0
- package/dist/core/live/progress-terminal.d.ts +20 -0
- package/dist/core/live/progress-terminal.js +173 -0
- package/dist/core/live/run-directory-gateway.d.ts +24 -0
- package/dist/core/live/run-directory-gateway.js +437 -0
- package/dist/core/mint.d.ts +10 -0
- package/dist/core/mint.js +14 -0
- package/dist/core/payload.d.ts +26 -0
- package/dist/core/payload.js +33 -0
- package/dist/core/presentation.d.ts +87 -0
- package/dist/core/presentation.js +5 -0
- package/dist/core/presentations.d.ts +56 -0
- package/dist/core/presentations.js +66 -0
- package/dist/core/provider.d.ts +69 -0
- package/dist/core/provider.js +5 -0
- package/dist/core/resource.d.ts +262 -0
- package/dist/core/resource.js +6 -0
- package/dist/core/resources.d.ts +131 -0
- package/dist/core/resources.js +254 -0
- package/dist/core/run-directory.d.ts +69 -0
- package/dist/core/run-directory.js +94 -0
- package/dist/core/run-state.d.ts +152 -0
- package/dist/core/run-state.js +313 -0
- package/dist/core/run.d.ts +187 -0
- package/dist/core/run.js +321 -0
- package/dist/core/state-directory.d.ts +19 -0
- package/dist/core/state-directory.js +29 -0
- package/dist/core/timeline.d.ts +63 -0
- package/dist/core/timeline.js +97 -0
- package/dist/core/timing.d.ts +22 -0
- package/dist/core/timing.js +26 -0
- package/dist/credential/credential.d.ts +46 -0
- package/dist/credential/credential.js +80 -0
- package/dist/credential/diagnosis.d.ts +18 -0
- package/dist/credential/diagnosis.js +99 -0
- package/dist/credential/gateways.d.ts +109 -0
- package/dist/credential/gateways.js +1 -0
- package/dist/credential/index.d.ts +7 -0
- package/dist/credential/index.js +7 -0
- package/dist/credential/live/github-actions-token-gateway.d.ts +15 -0
- package/dist/credential/live/github-actions-token-gateway.js +43 -0
- package/dist/credential/live/github-actions-token-response.d.ts +19 -0
- package/dist/credential/live/github-actions-token-response.js +49 -0
- package/dist/credential/live/vercel-cli-gateway.d.ts +9 -0
- package/dist/credential/live/vercel-cli-gateway.js +64 -0
- package/dist/credential/live/vercel-output.d.ts +60 -0
- package/dist/credential/live/vercel-output.js +122 -0
- package/dist/credential/live/vercel-process.d.ts +14 -0
- package/dist/credential/live/vercel-process.js +3 -0
- package/dist/credential/settle.d.ts +31 -0
- package/dist/credential/settle.js +49 -0
- package/dist/credential/source.d.ts +110 -0
- package/dist/credential/source.js +114 -0
- package/dist/help-logo.d.ts +11 -0
- package/dist/help-logo.js +56 -0
- package/dist/presentation.d.ts +26 -0
- package/dist/presentation.js +21 -0
- package/dist/resources/github/cleanup.d.ts +23 -0
- package/dist/resources/github/cleanup.js +39 -0
- package/dist/resources/github/command.d.ts +74 -0
- package/dist/resources/github/command.js +117 -0
- package/dist/resources/github/config.d.ts +16 -0
- package/dist/resources/github/config.js +37 -0
- package/dist/resources/github/events.d.ts +26 -0
- package/dist/resources/github/events.js +2 -0
- package/dist/resources/github/fixture-repo.d.ts +69 -0
- package/dist/resources/github/fixture-repo.js +60 -0
- package/dist/resources/github/gateways.d.ts +62 -0
- package/dist/resources/github/gateways.js +1 -0
- package/dist/resources/github/index.d.ts +12 -0
- package/dist/resources/github/index.js +15 -0
- package/dist/resources/github/live/fixture-repo-gateway.d.ts +12 -0
- package/dist/resources/github/live/fixture-repo-gateway.js +92 -0
- package/dist/resources/github/live/gateways.d.ts +6 -0
- package/dist/resources/github/live/gateways.js +13 -0
- package/dist/resources/github/presentation.d.ts +13 -0
- package/dist/resources/github/presentation.js +43 -0
- package/dist/resources/github/provider.d.ts +66 -0
- package/dist/resources/github/provider.js +58 -0
- package/dist/resources/github/resource-provider.d.ts +6 -0
- package/dist/resources/github/resource-provider.js +20 -0
- package/dist/resources/github/resource.d.ts +33 -0
- package/dist/resources/github/resource.js +12 -0
- package/dist/resources/testserver/cleanup.d.ts +14 -0
- package/dist/resources/testserver/cleanup.js +22 -0
- package/dist/resources/testserver/command.d.ts +322 -0
- package/dist/resources/testserver/command.js +245 -0
- package/dist/resources/testserver/commands/app.d.ts +18 -0
- package/dist/resources/testserver/commands/app.js +3 -0
- package/dist/resources/testserver/commands/create/command.d.ts +136 -0
- package/dist/resources/testserver/commands/create/command.js +158 -0
- package/dist/resources/testserver/commands/create/metadata.d.ts +31 -0
- package/dist/resources/testserver/commands/create/metadata.js +45 -0
- package/dist/resources/testserver/commands/create/outcomes.d.ts +111 -0
- package/dist/resources/testserver/commands/create/outcomes.js +172 -0
- package/dist/resources/testserver/commands/list/command.d.ts +60 -0
- package/dist/resources/testserver/commands/list/command.js +56 -0
- package/dist/resources/testserver/commands/list/metadata.d.ts +9 -0
- package/dist/resources/testserver/commands/list/metadata.js +9 -0
- package/dist/resources/testserver/commands/list/outcomes.d.ts +54 -0
- package/dist/resources/testserver/commands/list/outcomes.js +152 -0
- package/dist/resources/testserver/config.d.ts +18 -0
- package/dist/resources/testserver/config.js +78 -0
- package/dist/resources/testserver/credential-facts.d.ts +80 -0
- package/dist/resources/testserver/credential-facts.js +83 -0
- package/dist/resources/testserver/events.d.ts +59 -0
- package/dist/resources/testserver/events.js +4 -0
- package/dist/resources/testserver/index.d.ts +16 -0
- package/dist/resources/testserver/index.js +24 -0
- package/dist/resources/testserver/lane.d.ts +28 -0
- package/dist/resources/testserver/lane.js +139 -0
- package/dist/resources/testserver/live/gateways.d.ts +6 -0
- package/dist/resources/testserver/live/gateways.js +26 -0
- package/dist/resources/testserver/options.d.ts +5 -0
- package/dist/resources/testserver/options.js +5 -0
- package/dist/resources/testserver/pool/channels.d.ts +80 -0
- package/dist/resources/testserver/pool/channels.js +48 -0
- package/dist/resources/testserver/pool/create.d.ts +48 -0
- package/dist/resources/testserver/pool/create.js +45 -0
- package/dist/resources/testserver/pool/directory.d.ts +4 -0
- package/dist/resources/testserver/pool/directory.js +5 -0
- package/dist/resources/testserver/pool/gateways.d.ts +190 -0
- package/dist/resources/testserver/pool/gateways.js +1 -0
- package/dist/resources/testserver/pool/host.d.ts +8 -0
- package/dist/resources/testserver/pool/host.js +21 -0
- package/dist/resources/testserver/pool/index.d.ts +9 -0
- package/dist/resources/testserver/pool/index.js +10 -0
- package/dist/resources/testserver/pool/inspect.d.ts +53 -0
- package/dist/resources/testserver/pool/inspect.js +45 -0
- package/dist/resources/testserver/pool/lease.d.ts +84 -0
- package/dist/resources/testserver/pool/lease.js +125 -0
- package/dist/resources/testserver/pool/live/pool-records.d.ts +17 -0
- package/dist/resources/testserver/pool/live/pool-records.js +70 -0
- package/dist/resources/testserver/pool/live/pool-store-gateway.d.ts +12 -0
- package/dist/resources/testserver/pool/live/pool-store-gateway.js +435 -0
- package/dist/resources/testserver/pool/staleness.d.ts +16 -0
- package/dist/resources/testserver/pool/staleness.js +27 -0
- package/dist/resources/testserver/presentation.d.ts +9 -0
- package/dist/resources/testserver/presentation.js +217 -0
- package/dist/resources/testserver/provider.d.ts +177 -0
- package/dist/resources/testserver/provider.js +254 -0
- package/dist/resources/testserver/ran.d.ts +87 -0
- package/dist/resources/testserver/ran.js +140 -0
- package/dist/resources/testserver/resource-provider.d.ts +12 -0
- package/dist/resources/testserver/resource-provider.js +38 -0
- package/dist/resources/testserver/resource.d.ts +32 -0
- package/dist/resources/testserver/resource.js +10 -0
- package/dist/resources/testserver/run-sandbox.d.ts +13 -0
- package/dist/resources/testserver/run-sandbox.js +6 -0
- package/dist/resources/testserver/sandbox/channels.d.ts +12 -0
- package/dist/resources/testserver/sandbox/channels.js +21 -0
- package/dist/resources/testserver/sandbox/create-failure.d.ts +35 -0
- package/dist/resources/testserver/sandbox/create-failure.js +65 -0
- package/dist/resources/testserver/sandbox/create.d.ts +29 -0
- package/dist/resources/testserver/sandbox/create.js +37 -0
- package/dist/resources/testserver/sandbox/gateways.d.ts +150 -0
- package/dist/resources/testserver/sandbox/gateways.js +1 -0
- package/dist/resources/testserver/sandbox/index.d.ts +6 -0
- package/dist/resources/testserver/sandbox/index.js +7 -0
- package/dist/resources/testserver/sandbox/live/builds-response.d.ts +9 -0
- package/dist/resources/testserver/sandbox/live/builds-response.js +27 -0
- package/dist/resources/testserver/sandbox/live/control-plane-gateway.d.ts +17 -0
- package/dist/resources/testserver/sandbox/live/control-plane-gateway.js +133 -0
- package/dist/resources/testserver/sandbox/live/create-response.d.ts +35 -0
- package/dist/resources/testserver/sandbox/live/create-response.js +78 -0
- package/dist/resources/testserver/sandbox/live/fetch-failure.d.ts +24 -0
- package/dist/resources/testserver/sandbox/live/fetch-failure.js +45 -0
- package/dist/resources/testserver/sandbox/live/health-check-gateway.d.ts +11 -0
- package/dist/resources/testserver/sandbox/live/health-check-gateway.js +36 -0
- package/dist/resources/testserver/sandbox/live/sse.d.ts +12 -0
- package/dist/resources/testserver/sandbox/live/sse.js +32 -0
- package/dist/resources.d.ts +455 -0
- package/dist/resources.js +88 -0
- package/dist/runner/base.d.ts +40 -0
- package/dist/runner/base.js +52 -0
- package/dist/runner/context.d.ts +13 -0
- package/dist/runner/context.js +9 -0
- package/dist/runner/events.d.ts +179 -0
- package/dist/runner/events.js +16 -0
- package/dist/runner/gateways.d.ts +351 -0
- package/dist/runner/gateways.js +3 -0
- package/dist/runner/index.d.ts +19 -0
- package/dist/runner/index.js +18 -0
- package/dist/runner/live/checkout-gateway.d.ts +3 -0
- package/dist/runner/live/checkout-gateway.js +206 -0
- package/dist/runner/live/git-output.d.ts +14 -0
- package/dist/runner/live/git-output.js +32 -0
- package/dist/runner/live/sandbox-errors.d.ts +7 -0
- package/dist/runner/live/sandbox-errors.js +21 -0
- package/dist/runner/live/sandbox-gateway.d.ts +7 -0
- package/dist/runner/live/sandbox-gateway.js +427 -0
- package/dist/runner/live/snapshot-cache-gateway.d.ts +12 -0
- package/dist/runner/live/snapshot-cache-gateway.js +104 -0
- package/dist/runner/live/snapshot-records.d.ts +11 -0
- package/dist/runner/live/snapshot-records.js +57 -0
- package/dist/runner/live/terminal.d.ts +16 -0
- package/dist/runner/live/terminal.js +37 -0
- package/dist/runner/live/user.d.ts +2 -0
- package/dist/runner/live/user.js +11 -0
- package/dist/runner/output.d.ts +23 -0
- package/dist/runner/output.js +58 -0
- package/dist/runner/prepare.d.ts +67 -0
- package/dist/runner/prepare.js +59 -0
- package/dist/runner/ready.d.ts +68 -0
- package/dist/runner/ready.js +159 -0
- package/dist/runner/recipe.d.ts +126 -0
- package/dist/runner/recipe.js +302 -0
- package/dist/runner/remote-command.d.ts +77 -0
- package/dist/runner/remote-command.js +127 -0
- package/dist/runner/scope.d.ts +58 -0
- package/dist/runner/scope.js +117 -0
- package/dist/runner/snapshot-build.d.ts +33 -0
- package/dist/runner/snapshot-build.js +112 -0
- package/dist/runner/snapshot-cache.d.ts +84 -0
- package/dist/runner/snapshot-cache.js +126 -0
- package/dist/runner/snapshot-key.d.ts +52 -0
- package/dist/runner/snapshot-key.js +91 -0
- package/dist/runner/steps.d.ts +41 -0
- package/dist/runner/steps.js +49 -0
- package/dist/sdk/container/api-request.d.ts +32 -0
- package/dist/sdk/container/api-request.js +46 -0
- package/dist/sdk/container/container.d.ts +144 -0
- package/dist/sdk/container/container.js +346 -0
- package/dist/sdk/container/feature-flags.d.ts +37 -0
- package/dist/sdk/container/feature-flags.js +118 -0
- package/dist/sdk/container/gateways.d.ts +108 -0
- package/dist/sdk/container/gateways.js +1 -0
- package/dist/sdk/container/index.d.ts +5 -0
- package/dist/sdk/container/index.js +5 -0
- package/dist/sdk/container/live/container-gateway.d.ts +17 -0
- package/dist/sdk/container/live/container-gateway.js +114 -0
- package/dist/sdk/factories/build.d.ts +66 -0
- package/dist/sdk/factories/build.js +98 -0
- package/dist/sdk/factories/definition.d.ts +28 -0
- package/dist/sdk/factories/definition.js +16 -0
- package/dist/sdk/factories/definitions.d.ts +166 -0
- package/dist/sdk/factories/definitions.js +235 -0
- package/dist/sdk/factories/gateways.d.ts +25 -0
- package/dist/sdk/factories/gateways.js +1 -0
- package/dist/sdk/factories/index.d.ts +5 -0
- package/dist/sdk/factories/index.js +5 -0
- package/dist/sdk/factories/live/factory-gateway.d.ts +10 -0
- package/dist/sdk/factories/live/factory-gateway.js +29 -0
- package/dist/sdk/index.d.ts +7 -0
- package/dist/sdk/index.js +15 -0
- package/dist/sdk/payload/index.d.ts +2 -0
- package/dist/sdk/payload/index.js +4 -0
- package/dist/sdk/payload/payload.d.ts +47 -0
- package/dist/sdk/payload/payload.js +74 -0
- package/dist/sdk/payload/test-events.d.ts +102 -0
- package/dist/sdk/payload/test-events.js +59 -0
- package/dist/sdk/proxy/exchange.d.ts +58 -0
- package/dist/sdk/proxy/exchange.js +173 -0
- package/dist/sdk/proxy/faulted-exchange.d.ts +10 -0
- package/dist/sdk/proxy/faulted-exchange.js +106 -0
- package/dist/sdk/proxy/faults.d.ts +133 -0
- package/dist/sdk/proxy/faults.js +147 -0
- package/dist/sdk/proxy/index.d.ts +3 -0
- package/dist/sdk/proxy/index.js +3 -0
- package/dist/sdk/proxy/proxy.d.ts +93 -0
- package/dist/sdk/proxy/proxy.js +99 -0
- package/dist/sdk/proxy/records.d.ts +56 -0
- package/dist/sdk/proxy/records.js +56 -0
- package/dist/sdk/records/body.d.ts +89 -0
- package/dist/sdk/records/body.js +236 -0
- package/dist/sdk/records/index.d.ts +2 -0
- package/dist/sdk/records/index.js +4 -0
- package/dist/sdk/records/records.d.ts +49 -0
- package/dist/sdk/records/records.js +16 -0
- package/dist/sdk/seed/index.d.ts +1 -0
- package/dist/sdk/seed/index.js +3 -0
- package/dist/sdk/seed/seed.d.ts +221 -0
- package/dist/sdk/seed/seed.js +171 -0
- package/dist/sdk/testserver/clock.d.ts +8 -0
- package/dist/sdk/testserver/clock.js +10 -0
- package/dist/sdk/testserver/failure.d.ts +73 -0
- package/dist/sdk/testserver/failure.js +61 -0
- package/dist/sdk/testserver/index.d.ts +5 -0
- package/dist/sdk/testserver/index.js +8 -0
- package/dist/sdk/testserver/live/connect-failure.d.ts +7 -0
- package/dist/sdk/testserver/live/connect-failure.js +30 -0
- package/dist/sdk/testserver/live/request.d.ts +69 -0
- package/dist/sdk/testserver/live/request.js +89 -0
- package/dist/sdk/testserver/service-ids.d.ts +19 -0
- package/dist/sdk/testserver/service-ids.js +77 -0
- package/dist/sdk/testserver/test-id.d.ts +15 -0
- package/dist/sdk/testserver/test-id.js +28 -0
- package/dist/story/align.d.ts +37 -0
- package/dist/story/align.js +39 -0
- package/dist/story/artifact.d.ts +60 -0
- package/dist/story/artifact.js +93 -0
- package/dist/story/definition.d.ts +52 -0
- package/dist/story/definition.js +9 -0
- package/dist/story/diff.d.ts +9 -0
- package/dist/story/diff.js +97 -0
- package/dist/story/errors.d.ts +14 -0
- package/dist/story/errors.js +21 -0
- package/dist/story/gateways.d.ts +74 -0
- package/dist/story/gateways.js +3 -0
- package/dist/story/host.d.ts +27 -0
- package/dist/story/host.js +97 -0
- package/dist/story/index.d.ts +7 -0
- package/dist/story/index.js +9 -0
- package/dist/story/json.d.ts +16 -0
- package/dist/story/json.js +59 -0
- package/dist/story/live/artifact-gateway.d.ts +2 -0
- package/dist/story/live/artifact-gateway.js +82 -0
- package/dist/story/mode.d.ts +17 -0
- package/dist/story/mode.js +21 -0
- package/dist/story/orphans.d.ts +17 -0
- package/dist/story/orphans.js +15 -0
- package/dist/story/report.d.ts +30 -0
- package/dist/story/report.js +118 -0
- package/dist/story/run.d.ts +49 -0
- package/dist/story/run.js +160 -0
- package/dist/story/sequence.d.ts +30 -0
- package/dist/story/sequence.js +74 -0
- package/dist/story/settle.d.ts +94 -0
- package/dist/story/settle.js +70 -0
- package/dist/time/duration.d.ts +19 -0
- package/dist/time/duration.js +37 -0
- package/dist/time/index.d.ts +2 -0
- package/dist/time/index.js +4 -0
- package/dist/time/time.d.ts +15 -0
- package/dist/time/time.js +23 -0
- package/dist/vercel-cli/ansi.d.ts +13 -0
- package/dist/vercel-cli/ansi.js +32 -0
- package/dist/vercel-cli/arguments.d.ts +25 -0
- package/dist/vercel-cli/arguments.js +78 -0
- package/dist/vercel-cli/auth-config.d.ts +43 -0
- package/dist/vercel-cli/auth-config.js +36 -0
- package/dist/vercel-cli/clock.d.ts +9 -0
- package/dist/vercel-cli/clock.js +10 -0
- package/dist/vercel-cli/config-files.d.ts +24 -0
- package/dist/vercel-cli/config-files.js +40 -0
- package/dist/vercel-cli/context.d.ts +12 -0
- package/dist/vercel-cli/context.js +12 -0
- package/dist/vercel-cli/driver.d.ts +218 -0
- package/dist/vercel-cli/driver.js +364 -0
- package/dist/vercel-cli/entry.d.ts +8 -0
- package/dist/vercel-cli/entry.js +13 -0
- package/dist/vercel-cli/environment.d.ts +33 -0
- package/dist/vercel-cli/environment.js +72 -0
- package/dist/vercel-cli/errors.d.ts +8 -0
- package/dist/vercel-cli/errors.js +8 -0
- package/dist/vercel-cli/gateways.d.ts +103 -0
- package/dist/vercel-cli/gateways.js +4 -0
- package/dist/vercel-cli/index.d.ts +10 -0
- package/dist/vercel-cli/index.js +15 -0
- package/dist/vercel-cli/invocation.d.ts +234 -0
- package/dist/vercel-cli/invocation.js +397 -0
- package/dist/vercel-cli/keys.d.ts +14 -0
- package/dist/vercel-cli/keys.js +12 -0
- package/dist/vercel-cli/live/config-files.d.ts +28 -0
- package/dist/vercel-cli/live/config-files.js +66 -0
- package/dist/vercel-cli/live/process-gateway.d.ts +14 -0
- package/dist/vercel-cli/live/process-gateway.js +178 -0
- package/dist/vercel-cli/redaction.d.ts +13 -0
- package/dist/vercel-cli/redaction.js +22 -0
- package/dist/vercel-cli/report.d.ts +22 -0
- package/dist/vercel-cli/report.js +110 -0
- package/dist/vercel-cli/verbose.d.ts +7 -0
- package/dist/vercel-cli/verbose.js +24 -0
- package/dist/version.d.ts +20 -0
- package/dist/version.js +57 -0
- package/dist/vitest/config.d.ts +51 -0
- package/dist/vitest/config.js +61 -0
- package/dist/vitest/container-scope.d.ts +108 -0
- package/dist/vitest/container-scope.js +234 -0
- package/dist/vitest/diagnostics.d.ts +146 -0
- package/dist/vitest/diagnostics.js +306 -0
- package/dist/vitest/find-vitest.d.ts +7 -0
- package/dist/vitest/find-vitest.js +28 -0
- package/dist/vitest/fixtures.d.ts +64 -0
- package/dist/vitest/fixtures.js +172 -0
- package/dist/vitest/gateways.d.ts +78 -0
- package/dist/vitest/gateways.js +4 -0
- package/dist/vitest/index.d.ts +3 -0
- package/dist/vitest/index.js +9 -0
- package/dist/vitest/list-output.d.ts +3 -0
- package/dist/vitest/list-output.js +19 -0
- package/dist/vitest/live/list-gateway.d.ts +11 -0
- package/dist/vitest/live/list-gateway.js +107 -0
- package/dist/vitest/ownership.d.ts +29 -0
- package/dist/vitest/ownership.js +68 -0
- package/dist/vitest/plan.d.ts +66 -0
- package/dist/vitest/plan.js +104 -0
- package/dist/vitest/sandbox.d.ts +16 -0
- package/dist/vitest/sandbox.js +35 -0
- package/dist/vitest/test-events.d.ts +41 -0
- package/dist/vitest/test-events.js +92 -0
- package/dist/vitest/test-results.d.ts +84 -0
- package/dist/vitest/test-results.js +160 -0
- package/dist/vitest/types.d.ts +68 -0
- package/dist/vitest/types.js +4 -0
- package/package.json +119 -3
- package/skills/overview.md +33 -0
- package/skills/read-run-output.md +65 -0
- package/README.md +0 -3
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* `{ [name]: value }` as the map `M` keyed by resource name that it is, such as `ResourceCleanup<K>`: `value` is what
|
|
4
|
+
* `M` holds under `name`.
|
|
5
|
+
*/
|
|
6
|
+
export declare function entry<M, N extends keyof M & string>(name: N, value: M[N]): M;
|
|
7
|
+
/**
|
|
8
|
+
* The schema of map `M`, keyed by resource name, from each resource's `[name, schema]`, where `schema` holds what `M`
|
|
9
|
+
* holds under `name`, made optional: what `z.object` builds of them, typed as `M`, as its input and its output, which
|
|
10
|
+
* zod can't infer from entries it builds at run time.
|
|
11
|
+
*/
|
|
12
|
+
export declare function keyedSchema<M>(entries: readonly (readonly [string, z.ZodType])[]): z.ZodType<M, M>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// The only cast that relates a resource's name to the kinds map `K`. Inside the core, one provider's name is a generic
|
|
2
|
+
// `N` indexing a generic `K`. An object built with `N` as a computed key, `{ [name]: value }`, is what a map keyed by
|
|
3
|
+
// resource name holds under `name`, but TypeScript widens it to `{ [x: string]: … }` and can't relate that to the map.
|
|
4
|
+
// `entry` states the fact once, for every call site; its parameters are typed by the caller's `N`, so a wrong value
|
|
5
|
+
// fails at the call, not here. Resources and commands never cast. The nested `resource` event and the
|
|
6
|
+
// `resource-refused` and `resource-unprepared` outcomes, distributed over every name, need no cast: TypeScript relates
|
|
7
|
+
// an object of one name's member to them. `keyedSchema` states the same fact of a schema zod builds at run time from
|
|
8
|
+
// each resource's entry.
|
|
9
|
+
import { z } from "zod";
|
|
10
|
+
/**
|
|
11
|
+
* `{ [name]: value }` as the map `M` keyed by resource name that it is, such as `ResourceCleanup<K>`: `value` is what
|
|
12
|
+
* `M` holds under `name`.
|
|
13
|
+
*/
|
|
14
|
+
export function entry(name, value) {
|
|
15
|
+
return { [name]: value };
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* The schema of map `M`, keyed by resource name, from each resource's `[name, schema]`, where `schema` holds what `M`
|
|
19
|
+
* holds under `name`, made optional: what `z.object` builds of them, typed as `M`, as its input and its output, which
|
|
20
|
+
* zod can't infer from entries it builds at run time.
|
|
21
|
+
*/
|
|
22
|
+
export function keyedSchema(entries) {
|
|
23
|
+
return z.object(Object.fromEntries(entries));
|
|
24
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { LaneOutcome } from "./events.ts";
|
|
2
|
+
import type { KindAt, ResourceKind } from "./resource.ts";
|
|
3
|
+
import type { Span } from "./run-state.ts";
|
|
4
|
+
/** A resource lane's row on the waterfall: its steps that started, in order, and what it holds, if it counts that. */
|
|
5
|
+
export interface LaneRow<Step extends string> {
|
|
6
|
+
readonly steps: readonly {
|
|
7
|
+
readonly name: Step;
|
|
8
|
+
readonly span: Span;
|
|
9
|
+
}[];
|
|
10
|
+
/** How many things the lane holds that it reused, and how many it created. */
|
|
11
|
+
readonly sandboxes?: {
|
|
12
|
+
readonly reused: number;
|
|
13
|
+
readonly created: number;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* The lane of resource `Name`, of kind `Kind`. It is pure: it applies events and projects state, and reaches nothing.
|
|
18
|
+
* Each operation is a function property, as `RunProvider`'s are, so its parameters are checked contravariantly.
|
|
19
|
+
*
|
|
20
|
+
* - `resource`: the resource's name, whose nested `resource` events the lane applies.
|
|
21
|
+
* - `lane`: the lane's name, which `lane-started` and `lane-ended` events name.
|
|
22
|
+
* - `start`: the lane's state when it starts, at `startedAt`.
|
|
23
|
+
* - `apply`: the lane after one of the resource's own events, at `at`.
|
|
24
|
+
* - `ended`: the lane once it ended as `outcome` at `at`: its span ends, and a lane that failed or stopped ends each of
|
|
25
|
+
* its steps still running the same way.
|
|
26
|
+
* - `row`: its waterfall row's steps and counts.
|
|
27
|
+
*/
|
|
28
|
+
export interface ResourceLane<Name extends string, Kind extends ResourceKind> {
|
|
29
|
+
readonly resource: Name;
|
|
30
|
+
readonly lane: Kind["lane"];
|
|
31
|
+
readonly start: (startedAt: number) => Kind["laneState"];
|
|
32
|
+
readonly apply: (state: Kind["laneState"], event: Kind["event"], at: number) => Kind["laneState"];
|
|
33
|
+
readonly ended: (state: Kind["laneState"], outcome: LaneOutcome, at: number) => Kind["laneState"];
|
|
34
|
+
readonly row: (state: Kind["laneState"]) => LaneRow<Kind["laneStep"]>;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Every resource lane of a registry, in the order the waterfall shows their rows: one union member per resource, as
|
|
38
|
+
* `Providers` has. A resource without a lane has none in the list.
|
|
39
|
+
*/
|
|
40
|
+
export type ResourceLanes<K> = readonly {
|
|
41
|
+
readonly [N in keyof K & string]: ResourceLane<N, KindAt<K, N>>;
|
|
42
|
+
}[keyof K & string][];
|
|
43
|
+
/** Each resource lane's state, by resource name; a resource whose lane hasn't started, or that has none, is absent. */
|
|
44
|
+
export type LaneStates<K> = {
|
|
45
|
+
readonly [N in keyof K]?: KindAt<K, N>["laneState"];
|
|
46
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// The lane contract: what a resource with a lane gives the run's state. Its lane applies the resource's own events to
|
|
2
|
+
// its own lane state, from the lane's start to its end, and projects its row on the waterfall. Each resource folder
|
|
3
|
+
// writes its lane against its own name and kind; the registry lists them, and the run's state applies every event
|
|
4
|
+
// through them (`applyRunEvent`). It names no resource.
|
|
5
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runs `task` for indexes `0` to `count - 1`, at most `limit` at a time, in index order. Before starting each
|
|
3
|
+
* task it asks `proceed`; once that says no, no further task starts, and the ones in flight still finish. The
|
|
4
|
+
* result holds each started task's value at its index and `undefined` for those never started.
|
|
5
|
+
*
|
|
6
|
+
* When a task rejects, no further task starts; once every started task has settled, it rejects with the first
|
|
7
|
+
* rejection. So nothing it started is still running when it returns or rejects.
|
|
8
|
+
*/
|
|
9
|
+
export declare function runLimited<T>(count: number, limit: number, proceed: () => boolean, task: (index: number) => Promise<T>): Promise<readonly (T | undefined)[]>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runs `task` for indexes `0` to `count - 1`, at most `limit` at a time, in index order. Before starting each
|
|
3
|
+
* task it asks `proceed`; once that says no, no further task starts, and the ones in flight still finish. The
|
|
4
|
+
* result holds each started task's value at its index and `undefined` for those never started.
|
|
5
|
+
*
|
|
6
|
+
* When a task rejects, no further task starts; once every started task has settled, it rejects with the first
|
|
7
|
+
* rejection. So nothing it started is still running when it returns or rejects.
|
|
8
|
+
*/
|
|
9
|
+
export async function runLimited(count, limit, proceed, task) {
|
|
10
|
+
const results = Array.from({ length: count }, () => undefined);
|
|
11
|
+
let failure;
|
|
12
|
+
let next = 0;
|
|
13
|
+
const worker = async () => {
|
|
14
|
+
while (failure === undefined && next < count && proceed()) {
|
|
15
|
+
const index = next;
|
|
16
|
+
next += 1;
|
|
17
|
+
try {
|
|
18
|
+
results[index] = await task(index);
|
|
19
|
+
}
|
|
20
|
+
catch (error) {
|
|
21
|
+
failure ??= { error };
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
await Promise.all(Array.from({ length: Math.min(limit, count) }, worker));
|
|
26
|
+
if (failure !== undefined)
|
|
27
|
+
throw failure.error;
|
|
28
|
+
return results;
|
|
29
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { CommandGateway } from "../gateways.ts";
|
|
2
|
+
/**
|
|
3
|
+
* The live command gateway: spawns `argv[0]` with the rest of `argv`, no shell, the given environment only, the
|
|
4
|
+
* terminal's stdin, and its stdout and stderr through pipes, each decoded as UTF-8 and handed to `onOutput` as it
|
|
5
|
+
* arrives. The command runs in storm's process group, so Ctrl+C and a closed terminal reach it directly. Aborting
|
|
6
|
+
* `terminate` sends SIGTERM. It settles once the process has exited and both pipes have closed, so no output is lost,
|
|
7
|
+
* or `PIPE_DRAIN_MS` after the process exited when a process it left behind still holds a pipe open: then it stops
|
|
8
|
+
* reading, so that process can't keep the run waiting. An `error` before the process spawns (ENOENT, EACCES) is
|
|
9
|
+
* `spawn-failed`.
|
|
10
|
+
*/
|
|
11
|
+
export declare function liveCommandGateway(): CommandGateway;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { spawn } from "node:child_process";
|
|
2
|
+
import { StringDecoder } from "node:string_decoder";
|
|
3
|
+
/**
|
|
4
|
+
* The live command gateway: spawns `argv[0]` with the rest of `argv`, no shell, the given environment only, the
|
|
5
|
+
* terminal's stdin, and its stdout and stderr through pipes, each decoded as UTF-8 and handed to `onOutput` as it
|
|
6
|
+
* arrives. The command runs in storm's process group, so Ctrl+C and a closed terminal reach it directly. Aborting
|
|
7
|
+
* `terminate` sends SIGTERM. It settles once the process has exited and both pipes have closed, so no output is lost,
|
|
8
|
+
* or `PIPE_DRAIN_MS` after the process exited when a process it left behind still holds a pipe open: then it stops
|
|
9
|
+
* reading, so that process can't keep the run waiting. An `error` before the process spawns (ENOENT, EACCES) is
|
|
10
|
+
* `spawn-failed`.
|
|
11
|
+
*/
|
|
12
|
+
export function liveCommandGateway() {
|
|
13
|
+
return {
|
|
14
|
+
run: (request) => runCommand(request),
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* How long the gateway waits for the pipes to close once the command exited: 2 seconds. A process the command left
|
|
19
|
+
* running, such as a server a global setup didn't stop, can hold them open for as long as it runs.
|
|
20
|
+
*/
|
|
21
|
+
const PIPE_DRAIN_MS = 2_000;
|
|
22
|
+
function runCommand(request) {
|
|
23
|
+
const [executable, ...args] = request.argv;
|
|
24
|
+
if (executable === undefined)
|
|
25
|
+
throw new Error("liveCommandGateway: the command's argv is empty");
|
|
26
|
+
return new Promise((resolve) => {
|
|
27
|
+
let started = false;
|
|
28
|
+
let settled = false;
|
|
29
|
+
let draining;
|
|
30
|
+
const settle = (outcome) => {
|
|
31
|
+
if (settled)
|
|
32
|
+
return;
|
|
33
|
+
settled = true;
|
|
34
|
+
clearTimeout(draining);
|
|
35
|
+
request.terminate.removeEventListener("abort", onTerminate);
|
|
36
|
+
resolve(outcome);
|
|
37
|
+
};
|
|
38
|
+
const ended = (code, signal) => signal !== null ? { kind: "signaled", signal } : { kind: "exited", code: code ?? 0 };
|
|
39
|
+
const command = spawn(executable, args, {
|
|
40
|
+
stdio: ["inherit", "pipe", "pipe"],
|
|
41
|
+
shell: false,
|
|
42
|
+
env: { ...request.env },
|
|
43
|
+
});
|
|
44
|
+
const onTerminate = () => {
|
|
45
|
+
if (started)
|
|
46
|
+
command.kill("SIGTERM");
|
|
47
|
+
};
|
|
48
|
+
// A multibyte character split across two chunks decodes whole.
|
|
49
|
+
for (const stream of ["stdout", "stderr"]) {
|
|
50
|
+
const decoder = new StringDecoder("utf8");
|
|
51
|
+
const pipe = command[stream];
|
|
52
|
+
pipe.on("data", (chunk) => {
|
|
53
|
+
const data = decoder.write(chunk);
|
|
54
|
+
if (data !== "")
|
|
55
|
+
request.onOutput({ stream, data });
|
|
56
|
+
});
|
|
57
|
+
pipe.on("end", () => {
|
|
58
|
+
const data = decoder.end();
|
|
59
|
+
if (data !== "")
|
|
60
|
+
request.onOutput({ stream, data });
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
command.once("spawn", () => {
|
|
64
|
+
started = true;
|
|
65
|
+
if (request.terminate.aborted)
|
|
66
|
+
command.kill("SIGTERM");
|
|
67
|
+
});
|
|
68
|
+
command.once("error", (error) => {
|
|
69
|
+
if (!started)
|
|
70
|
+
settle({ kind: "spawn-failed", message: error.message });
|
|
71
|
+
});
|
|
72
|
+
// `close` comes after `exit` once the pipes have closed too, so the last output has been handed on.
|
|
73
|
+
command.once("close", (code, signal) => settle(ended(code, signal)));
|
|
74
|
+
command.once("exit", (code, signal) => {
|
|
75
|
+
draining = setTimeout(() => {
|
|
76
|
+
command.stdout.destroy();
|
|
77
|
+
command.stderr.destroy();
|
|
78
|
+
settle(ended(code, signal));
|
|
79
|
+
}, PIPE_DRAIN_MS);
|
|
80
|
+
});
|
|
81
|
+
request.terminate.addEventListener("abort", onTerminate, { once: true });
|
|
82
|
+
});
|
|
83
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { JobSummaryGateway } from "../gateways.ts";
|
|
2
|
+
/** The job summary at `path`, the step's `GITHUB_STEP_SUMMARY`; with none, appending is `none`. */
|
|
3
|
+
export declare function liveJobSummaryGateway(options: {
|
|
4
|
+
readonly path: string | undefined;
|
|
5
|
+
}): JobSummaryGateway;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// The GitHub Actions job summary: the file `GITHUB_STEP_SUMMARY` names, which GitHub renders as Markdown on the job's
|
|
2
|
+
// page once the step ends.
|
|
3
|
+
import { appendFile } from "node:fs/promises";
|
|
4
|
+
/** The job summary at `path`, the step's `GITHUB_STEP_SUMMARY`; with none, appending is `none`. */
|
|
5
|
+
export function liveJobSummaryGateway(options) {
|
|
6
|
+
const { path } = options;
|
|
7
|
+
return {
|
|
8
|
+
appendJobSummary: async (markdown) => {
|
|
9
|
+
if (path === undefined || path === "")
|
|
10
|
+
return { kind: "none" };
|
|
11
|
+
try {
|
|
12
|
+
await appendFile(path, markdown.endsWith("\n") ? markdown : `${markdown}\n`);
|
|
13
|
+
return { kind: "appended" };
|
|
14
|
+
}
|
|
15
|
+
catch (error) {
|
|
16
|
+
return { kind: "failed", failure: { path, message: error instanceof Error ? error.message : String(error) } };
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { ProgressTerminal } from "../gateways.ts";
|
|
2
|
+
/** How often the live region is redrawn, so its spinners turn and its elapsed times count. */
|
|
3
|
+
export declare const LIVE_TICK_MS = 90;
|
|
4
|
+
/** The part of a writable stream the terminal uses: `process.stdout` and `process.stderr` have it. */
|
|
5
|
+
export interface ProgressStream {
|
|
6
|
+
readonly columns?: number;
|
|
7
|
+
readonly rows?: number | undefined;
|
|
8
|
+
write(text: string): unknown;
|
|
9
|
+
on(event: "error", listener: (error: Error) => void): unknown;
|
|
10
|
+
}
|
|
11
|
+
/** A progress terminal over `stdout` and `stderr`, by default this process's. */
|
|
12
|
+
export declare function liveProgressTerminal(options?: {
|
|
13
|
+
readonly stdout?: ProgressStream;
|
|
14
|
+
readonly stderr?: ProgressStream;
|
|
15
|
+
}): ProgressTerminal;
|
|
16
|
+
/**
|
|
17
|
+
* `line` cut to `width` visible columns, color codes kept whole and a reset added when it is cut. Each character
|
|
18
|
+
* counts as one column.
|
|
19
|
+
*/
|
|
20
|
+
export declare function clip(line: string, width: number): string;
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
// The live progress terminal: a live region at the bottom of this process's stderr, redrawn in place with ANSI
|
|
2
|
+
// cursor movement, and text printed above it to stdout or stderr. The region hides the cursor while it shows, turns
|
|
3
|
+
// autowrap off so a long row can't wrap into a row the next redraw doesn't erase, and restores both however the
|
|
4
|
+
// process exits. It draws no more rows than fit above the terminal's last row, since the cursor can't move back up
|
|
5
|
+
// into scrollback to erase them, and it remembers how wide each row it drew was: a terminal narrowed since reflows a
|
|
6
|
+
// row wider than its new width onto several, as xterm.js, iTerm2, Terminal.app and VS Code do, and the next redraw
|
|
7
|
+
// erases them all. An empty frame draws nothing. Once a write fails, as one does with EIO after SIGHUP closes the
|
|
8
|
+
// terminal, it writes nothing more.
|
|
9
|
+
/** How often the live region is redrawn, so its spinners turn and its elapsed times count. */
|
|
10
|
+
export const LIVE_TICK_MS = 90;
|
|
11
|
+
const CURSOR_HIDE = "\u001b[?25l";
|
|
12
|
+
const CURSOR_SHOW = "\u001b[?25h";
|
|
13
|
+
const AUTOWRAP_OFF = "\u001b[?7l";
|
|
14
|
+
const AUTOWRAP_ON = "\u001b[?7h";
|
|
15
|
+
const ERASE_DOWN = "\u001b[J";
|
|
16
|
+
/** A progress terminal over `stdout` and `stderr`, by default this process's. */
|
|
17
|
+
export function liveProgressTerminal(options = {}) {
|
|
18
|
+
const stdout = options.stdout ?? process.stdout;
|
|
19
|
+
const stderr = options.stderr ?? process.stderr;
|
|
20
|
+
let failed = false;
|
|
21
|
+
let listening = false;
|
|
22
|
+
let frame;
|
|
23
|
+
/** The visible width of each row the region drew and still shows; none when it is erased or settled. */
|
|
24
|
+
let drawn = [];
|
|
25
|
+
/** Whether the last text printed above the region ended its line. */
|
|
26
|
+
let lineEnded = true;
|
|
27
|
+
let ticker;
|
|
28
|
+
let redrawQueued = false;
|
|
29
|
+
const write = (stream, text) => {
|
|
30
|
+
if (failed || text === "")
|
|
31
|
+
return;
|
|
32
|
+
if (!listening) {
|
|
33
|
+
// An asynchronous write error arrives as an `error` event, which would crash the process unheard.
|
|
34
|
+
stdout.on("error", fail);
|
|
35
|
+
stderr.on("error", fail);
|
|
36
|
+
listening = true;
|
|
37
|
+
}
|
|
38
|
+
try {
|
|
39
|
+
stream.write(text);
|
|
40
|
+
}
|
|
41
|
+
catch {
|
|
42
|
+
fail();
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
const fail = () => {
|
|
46
|
+
failed = true;
|
|
47
|
+
stopTicking();
|
|
48
|
+
};
|
|
49
|
+
// A pseudo-terminal with no window size reports 0 columns, and 0 rows.
|
|
50
|
+
const terminalColumns = () => positive(stderr.columns) ?? 80;
|
|
51
|
+
const columns = () => {
|
|
52
|
+
const reported = positive(stderr.columns);
|
|
53
|
+
return reported === undefined ? 80 : Math.max(20, reported);
|
|
54
|
+
};
|
|
55
|
+
/** How many rows the drawn region takes now, at the terminal's current width. */
|
|
56
|
+
const occupied = () => {
|
|
57
|
+
const width = terminalColumns();
|
|
58
|
+
return drawn.reduce((rows, visible) => rows + Math.max(1, Math.ceil(visible / width)), 0);
|
|
59
|
+
};
|
|
60
|
+
/** What moves the cursor to the region's first row and erases from there down; nothing when nothing is drawn. */
|
|
61
|
+
const moveUp = () => {
|
|
62
|
+
const rows = occupied();
|
|
63
|
+
return rows > 0 ? `\u001b[${rows}F${ERASE_DOWN}` : "";
|
|
64
|
+
};
|
|
65
|
+
const erase = () => {
|
|
66
|
+
write(stderr, moveUp());
|
|
67
|
+
if (!failed)
|
|
68
|
+
drawn = [];
|
|
69
|
+
};
|
|
70
|
+
const draw = () => {
|
|
71
|
+
if (frame === undefined)
|
|
72
|
+
return;
|
|
73
|
+
const width = columns();
|
|
74
|
+
// The last row holds the cursor once the region is drawn, so the region fits in the rows above it.
|
|
75
|
+
const height = positive(stderr.rows);
|
|
76
|
+
const shown = frame();
|
|
77
|
+
const lines = (height === undefined ? shown : shown.slice(0, Math.max(1, height - 1))).map((line) => clip(line, width - 1));
|
|
78
|
+
// An empty frame draws nothing: the region is erased, and the cursor stays where the text above it ended.
|
|
79
|
+
if (lines.length === 0) {
|
|
80
|
+
erase();
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
const lead = lineEnded ? "" : "\n";
|
|
84
|
+
lineEnded = true;
|
|
85
|
+
write(stderr, `${moveUp()}${lead}${AUTOWRAP_OFF}${lines.map((line) => `${line}\n`).join("")}${AUTOWRAP_ON}`);
|
|
86
|
+
// With autowrap off, a row wider than the terminal stops at its last column.
|
|
87
|
+
const edge = terminalColumns();
|
|
88
|
+
drawn = lines.map((line) => Math.min(visibleWidth(line), edge));
|
|
89
|
+
};
|
|
90
|
+
const restore = () => write(stderr, CURSOR_SHOW);
|
|
91
|
+
const stopTicking = () => {
|
|
92
|
+
if (ticker !== undefined)
|
|
93
|
+
clearInterval(ticker);
|
|
94
|
+
ticker = undefined;
|
|
95
|
+
};
|
|
96
|
+
return {
|
|
97
|
+
columns,
|
|
98
|
+
show(next) {
|
|
99
|
+
if (frame === undefined) {
|
|
100
|
+
write(stderr, CURSOR_HIDE);
|
|
101
|
+
process.once("exit", restore);
|
|
102
|
+
}
|
|
103
|
+
frame = next;
|
|
104
|
+
draw();
|
|
105
|
+
if (ticker === undefined && !failed) {
|
|
106
|
+
ticker = setInterval(draw, LIVE_TICK_MS);
|
|
107
|
+
ticker.unref();
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
print(stream, text) {
|
|
111
|
+
if (text === "")
|
|
112
|
+
return;
|
|
113
|
+
erase();
|
|
114
|
+
write(stream === "stdout" ? stdout : stderr, text);
|
|
115
|
+
lineEnded = text.endsWith("\n");
|
|
116
|
+
if (frame === undefined || redrawQueued)
|
|
117
|
+
return;
|
|
118
|
+
// A burst of output redraws the region once, after it.
|
|
119
|
+
redrawQueued = true;
|
|
120
|
+
setImmediate(() => {
|
|
121
|
+
redrawQueued = false;
|
|
122
|
+
draw();
|
|
123
|
+
});
|
|
124
|
+
},
|
|
125
|
+
settle() {
|
|
126
|
+
if (frame === undefined)
|
|
127
|
+
return;
|
|
128
|
+
draw();
|
|
129
|
+
frame = undefined;
|
|
130
|
+
drawn = [];
|
|
131
|
+
stopTicking();
|
|
132
|
+
process.removeListener("exit", restore);
|
|
133
|
+
restore();
|
|
134
|
+
},
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
/** `value` when it is a positive whole number; undefined for a size a stream doesn't report, or reports as 0. */
|
|
138
|
+
function positive(value) {
|
|
139
|
+
return value !== undefined && Number.isInteger(value) && value > 0 ? value : undefined;
|
|
140
|
+
}
|
|
141
|
+
/** How many columns `line` takes, color codes aside. Each character counts as one column, as in `clip`. */
|
|
142
|
+
function visibleWidth(line) {
|
|
143
|
+
let visible = 0;
|
|
144
|
+
// oxlint-disable-next-line no-control-regex -- a color code starts with ESC.
|
|
145
|
+
for (const part of line.split(/(\u001b\[[0-9;]*m)/)) {
|
|
146
|
+
if (!part.startsWith("\u001b["))
|
|
147
|
+
visible += Array.from(part).length;
|
|
148
|
+
}
|
|
149
|
+
return visible;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* `line` cut to `width` visible columns, color codes kept whole and a reset added when it is cut. Each character
|
|
153
|
+
* counts as one column.
|
|
154
|
+
*/
|
|
155
|
+
export function clip(line, width) {
|
|
156
|
+
let visible = 0;
|
|
157
|
+
let out = "";
|
|
158
|
+
// oxlint-disable-next-line no-control-regex -- a color code starts with ESC.
|
|
159
|
+
const parts = line.split(/(\u001b\[[0-9;]*m)/);
|
|
160
|
+
for (const part of parts) {
|
|
161
|
+
if (part.startsWith("\u001b[")) {
|
|
162
|
+
out += part;
|
|
163
|
+
continue;
|
|
164
|
+
}
|
|
165
|
+
for (const character of part) {
|
|
166
|
+
if (visible >= width)
|
|
167
|
+
return `${out}\u001b[0m`;
|
|
168
|
+
out += character;
|
|
169
|
+
visible += 1;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
return out;
|
|
173
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { RunDirectoryGateway } from "../gateways.ts";
|
|
2
|
+
/** The process that holds a run directory: its pid, on which host. */
|
|
3
|
+
export interface RunDirectoryHolder {
|
|
4
|
+
readonly pid: number;
|
|
5
|
+
readonly hostname: string;
|
|
6
|
+
}
|
|
7
|
+
export interface LiveRunDirectoryOptions {
|
|
8
|
+
/** The root of the run directories, `$XDG_STATE_HOME/storm/runs`. */
|
|
9
|
+
readonly directory: string;
|
|
10
|
+
/** Who holds the run directories this gateway opens. Defaults to this process, `process.pid` on `os.hostname()`. */
|
|
11
|
+
readonly holder?: RunDirectoryHolder;
|
|
12
|
+
/**
|
|
13
|
+
* Whether process `pid` on this host runs. Defaults to `process.kill(pid, 0)`, where only `ESRCH` proves it
|
|
14
|
+
* doesn't: `EPERM` means it runs under another user.
|
|
15
|
+
*/
|
|
16
|
+
readonly isAlive?: (pid: number) => boolean;
|
|
17
|
+
}
|
|
18
|
+
/** The run directories under `options.directory`. */
|
|
19
|
+
export declare function liveRunDirectoryGateway(options: LiveRunDirectoryOptions): RunDirectoryGateway;
|
|
20
|
+
/**
|
|
21
|
+
* Run directories that can't be found, because neither `XDG_STATE_HOME` nor `HOME` names a place for them. Opening,
|
|
22
|
+
* listing or reading one fails with `reason`, at `location`.
|
|
23
|
+
*/
|
|
24
|
+
export declare function unavailableRunDirectoryGateway(location: string, reason: string): RunDirectoryGateway;
|