@cnc-tools/storm 0.0.0-stage → 0.5.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/run/cleanup.d.ts +135 -0
- package/dist/commands/run/cleanup.js +171 -0
- package/dist/commands/run/command.d.ts +327 -0
- package/dist/commands/run/command.js +620 -0
- package/dist/commands/run/job-summary.d.ts +6 -0
- package/dist/commands/run/job-summary.js +31 -0
- package/dist/commands/run/live-view.d.ts +22 -0
- package/dist/commands/run/live-view.js +395 -0
- package/dist/commands/run/metadata.d.ts +47 -0
- package/dist/commands/run/metadata.js +83 -0
- package/dist/commands/run/mint-failed.d.ts +11 -0
- package/dist/commands/run/mint-failed.js +33 -0
- package/dist/commands/run/outcomes.d.ts +307 -0
- package/dist/commands/run/outcomes.js +332 -0
- package/dist/commands/run/progress.d.ts +44 -0
- package/dist/commands/run/progress.js +277 -0
- package/dist/commands/run/redaction.d.ts +15 -0
- package/dist/commands/run/redaction.js +40 -0
- package/dist/commands/run/run-collector.d.ts +30 -0
- package/dist/commands/run/run-collector.js +73 -0
- package/dist/commands/run/run-record.d.ts +144 -0
- package/dist/commands/run/run-record.js +96 -0
- package/dist/commands/run/tests-summary.d.ts +34 -0
- package/dist/commands/run/tests-summary.js +141 -0
- package/dist/commands/run/text.d.ts +22 -0
- package/dist/commands/run/text.js +74 -0
- package/dist/commands/run/view.d.ts +35 -0
- package/dist/commands/run/view.js +163 -0
- package/dist/commands/run/waterfall.d.ts +25 -0
- package/dist/commands/run/waterfall.js +108 -0
- package/dist/commands/run/worker-chart.d.ts +79 -0
- package/dist/commands/run/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 +77 -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 +317 -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 +9 -0
- package/dist/config/index.js +12 -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 +16 -0
- package/dist/config/set.js +55 -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 +37 -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 +86 -0
- package/dist/context.js +43 -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 +77 -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 +452 -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/fixtures.d.ts +64 -0
- package/dist/vitest/fixtures.js +172 -0
- package/dist/vitest/gateways.d.ts +47 -0
- package/dist/vitest/gateways.js +3 -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 +7 -0
- package/dist/vitest/live/list-gateway.js +60 -0
- package/dist/vitest/ownership.d.ts +29 -0
- package/dist/vitest/ownership.js +68 -0
- package/dist/vitest/plan.d.ts +33 -0
- package/dist/vitest/plan.js +73 -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 +123 -4
- package/skills/overview.md +32 -0
- package/skills/read-run-output.md +65 -0
- package/README.md +0 -3
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
import { type ProxyRequestRecord } from "../sdk/index.ts";
|
|
2
|
+
import type { Authentication, VercelAuth } from "./auth-config.ts";
|
|
3
|
+
import type { VercelCliClock } from "./clock.ts";
|
|
4
|
+
import type { OutputStream, StartError, VercelProcess } from "./gateways.ts";
|
|
5
|
+
import type { Redactor } from "./redaction.ts";
|
|
6
|
+
/** The most characters of output `waitFor` shows when it rejects. */
|
|
7
|
+
export declare const WAIT_FOR_OUTPUT_CHARS = 2000;
|
|
8
|
+
/** How long `waitFor` waits by default. */
|
|
9
|
+
export declare const WAIT_FOR_TIMEOUT_MS = 10000;
|
|
10
|
+
/** How long `stop()` waits for completion after its signal before it attempts SIGKILL. */
|
|
11
|
+
export declare const STOP_GRACE_MS = 10000;
|
|
12
|
+
/**
|
|
13
|
+
* How long a result waits, after the process completes, for the proxy to end the exchanges among its requests that
|
|
14
|
+
* were still open; a record still open after that is reported open.
|
|
15
|
+
*/
|
|
16
|
+
export declare const REQUEST_SETTLE_MS = 1000;
|
|
17
|
+
/** How often a result re-reads `proxy.requests` while it waits for its open records to end. */
|
|
18
|
+
export declare const REQUEST_SETTLE_POLL_MS = 10;
|
|
19
|
+
/** The signals `stop()` takes. */
|
|
20
|
+
export declare const STOP_SIGNALS: readonly ["SIGINT", "SIGTERM"];
|
|
21
|
+
/** A signal `stop()` sends. */
|
|
22
|
+
export type VercelStopSignal = (typeof STOP_SIGNALS)[number];
|
|
23
|
+
/**
|
|
24
|
+
* How an invocation ended:
|
|
25
|
+
*
|
|
26
|
+
* - `exited`: `vercel` exited on its own, with `exitCode`, or a signal the driver didn't send ended it.
|
|
27
|
+
* - `stopped`: the test's `stop()` sent `stopSignal`, and it then ended with `exitCode` or `signal`.
|
|
28
|
+
* `killAttemptedAfterGrace` says the driver attempted SIGKILL after `STOP_GRACE_MS` while still awaiting
|
|
29
|
+
* completion. It does not confirm delivery: the child may have exited while its output pipes remain open.
|
|
30
|
+
* - `timed-out`, `aborted`, `closed`, `abandoned`: the driver killed it after `timeoutMs`, when the test's signal
|
|
31
|
+
* aborted, when `close()` was called, or when its `interact` block threw while it still ran, and it then ended
|
|
32
|
+
* with `exitCode` or `signal`.
|
|
33
|
+
* - `not-started`: it never started: `missing` when its executable wasn't found (or its `cwd` doesn't exist),
|
|
34
|
+
* `auth-config` when the driver couldn't read or write the `auth.json` its saved login or logged-out run needs.
|
|
35
|
+
*/
|
|
36
|
+
export type InvocationEnd = {
|
|
37
|
+
readonly kind: "exited";
|
|
38
|
+
readonly exitCode: number | null;
|
|
39
|
+
readonly signal: string | null;
|
|
40
|
+
} | {
|
|
41
|
+
readonly kind: "stopped";
|
|
42
|
+
readonly stopSignal: VercelStopSignal;
|
|
43
|
+
readonly killAttemptedAfterGrace: boolean;
|
|
44
|
+
readonly exitCode: number | null;
|
|
45
|
+
readonly signal: string | null;
|
|
46
|
+
} | {
|
|
47
|
+
readonly kind: "timed-out";
|
|
48
|
+
readonly timeoutMs: number;
|
|
49
|
+
readonly exitCode: number | null;
|
|
50
|
+
readonly signal: string | null;
|
|
51
|
+
} | {
|
|
52
|
+
readonly kind: "aborted";
|
|
53
|
+
readonly exitCode: number | null;
|
|
54
|
+
readonly signal: string | null;
|
|
55
|
+
} | {
|
|
56
|
+
readonly kind: "closed";
|
|
57
|
+
readonly exitCode: number | null;
|
|
58
|
+
readonly signal: string | null;
|
|
59
|
+
} | {
|
|
60
|
+
readonly kind: "abandoned";
|
|
61
|
+
readonly exitCode: number | null;
|
|
62
|
+
readonly signal: string | null;
|
|
63
|
+
} | {
|
|
64
|
+
readonly kind: "not-started";
|
|
65
|
+
readonly reason: NotStartedReason;
|
|
66
|
+
readonly message: string;
|
|
67
|
+
};
|
|
68
|
+
/** Why an invocation never started: the process gateway's start failure, or `auth.json` the driver couldn't settle. */
|
|
69
|
+
export type NotStartedReason = StartError["code"] | "auth-config";
|
|
70
|
+
/**
|
|
71
|
+
* What an invocation's stdin was: `ignored` (`/dev/null`, a script's), `terminal` (piped for `press` and `type`,
|
|
72
|
+
* with `terminal: true`), `text` (piped, the text written as it started, then closed) or `open` (piped, never
|
|
73
|
+
* written or closed until it ended).
|
|
74
|
+
*/
|
|
75
|
+
export type VercelInvocationStdin = {
|
|
76
|
+
readonly kind: "ignored";
|
|
77
|
+
} | {
|
|
78
|
+
readonly kind: "terminal";
|
|
79
|
+
} | {
|
|
80
|
+
readonly kind: "text";
|
|
81
|
+
readonly text: string;
|
|
82
|
+
} | {
|
|
83
|
+
readonly kind: "open";
|
|
84
|
+
};
|
|
85
|
+
/** One `vercel` process the driver started, as a test's report shows it. Every token reads `<token>`. */
|
|
86
|
+
export interface VercelInvocation {
|
|
87
|
+
/** 1 for a test's first invocation, and so on. */
|
|
88
|
+
readonly number: number;
|
|
89
|
+
/** The command line, shell-quoted, such as `vercel whoami --api http://127.0.0.1:5000 --token <token> …`. */
|
|
90
|
+
readonly command: string;
|
|
91
|
+
readonly cwd: string;
|
|
92
|
+
/** Whether a test acted on it while it ran, in a `vercel.interact` block. */
|
|
93
|
+
readonly interactive: boolean;
|
|
94
|
+
/** Whether it ran at a terminal: `run`'s `terminal: true`, with piped stdin and `FORCE_TTY=1`. */
|
|
95
|
+
readonly terminal: boolean;
|
|
96
|
+
/** What its stdin was; piped text with every token reading `<token>`. */
|
|
97
|
+
readonly stdin: VercelInvocationStdin;
|
|
98
|
+
/** How it authenticated: `--token` (`"flag"`), a saved login (`"saved"`), or logged out (`"none"`). */
|
|
99
|
+
readonly auth: VercelAuth;
|
|
100
|
+
/** How it ended; absent while it runs. */
|
|
101
|
+
readonly end?: InvocationEnd;
|
|
102
|
+
/**
|
|
103
|
+
* Whether every byte of stdout and stderr reached the driver. False only when a hard kill's bounded drain ran out
|
|
104
|
+
* because a descendant still held an output pipe.
|
|
105
|
+
*/
|
|
106
|
+
readonly outputComplete: boolean;
|
|
107
|
+
/** How long it ran, or has run so far. */
|
|
108
|
+
readonly durationMs: number;
|
|
109
|
+
/**
|
|
110
|
+
* Its stdout with the same ANSI stripping `waitFor` uses: escape sequences removed, a spinner's `\r` frames kept.
|
|
111
|
+
*/
|
|
112
|
+
readonly stdout: string;
|
|
113
|
+
/** Its stderr, stripped as `stdout` is. */
|
|
114
|
+
readonly stderr: string;
|
|
115
|
+
/** Its stdout as it arrived, escape sequences included. */
|
|
116
|
+
readonly rawStdout: string;
|
|
117
|
+
/** Its stderr as it arrived, escape sequences included. */
|
|
118
|
+
readonly rawStderr: string;
|
|
119
|
+
/**
|
|
120
|
+
* The proxy's records of the requests that arrived while it ran, as they stand now, so some may be open. Those of
|
|
121
|
+
* an invocation that overlapped another include the other's.
|
|
122
|
+
*/
|
|
123
|
+
readonly requests: readonly ProxyRequestRecord[];
|
|
124
|
+
/** The numbers of the test's invocations that ran at the same time as this one. */
|
|
125
|
+
readonly overlapped: readonly number[];
|
|
126
|
+
}
|
|
127
|
+
/** How a `vercel` invocation ended, its output and the proxy's records added while it ran. Tokens read `<token>`. */
|
|
128
|
+
export interface VercelResult {
|
|
129
|
+
/** Its exit code; `null` when a signal ended it. */
|
|
130
|
+
readonly exitCode: number | null;
|
|
131
|
+
/** The signal that ended it, such as `SIGKILL`; `null` when it exited. */
|
|
132
|
+
readonly signal: string | null;
|
|
133
|
+
/** Whether the driver killed it after its timeout. */
|
|
134
|
+
readonly timedOut: boolean;
|
|
135
|
+
/** Whether the driver killed it because the test's signal aborted. */
|
|
136
|
+
readonly aborted: boolean;
|
|
137
|
+
/** Whether the test's `stop()` signalled it. */
|
|
138
|
+
readonly stopped: boolean;
|
|
139
|
+
/** Whether every byte of stdout and stderr reached the driver; false after a hard kill's drain ran out. */
|
|
140
|
+
readonly outputComplete: boolean;
|
|
141
|
+
/**
|
|
142
|
+
* Its stdout with the same ANSI stripping `waitFor` uses: escape sequences removed, a spinner's `\r` frames kept.
|
|
143
|
+
*/
|
|
144
|
+
readonly stdout: string;
|
|
145
|
+
/** Its stderr, stripped as `stdout` is. */
|
|
146
|
+
readonly stderr: string;
|
|
147
|
+
/** Its stdout as it arrived, escape sequences included. */
|
|
148
|
+
readonly rawStdout: string;
|
|
149
|
+
/** Its stderr as it arrived, escape sequences included. */
|
|
150
|
+
readonly rawStderr: string;
|
|
151
|
+
readonly durationMs: number;
|
|
152
|
+
/**
|
|
153
|
+
* The proxy's records of the requests that arrived while it ran, up to its exit, in arrival order. A request
|
|
154
|
+
* still in flight at its exit is among them: the result waits up to `REQUEST_SETTLE_MS` (1s) for the proxy to end
|
|
155
|
+
* such an exchange, which it does once Testserver answers or `vercel`'s connection closes, and a record still open
|
|
156
|
+
* after that has `open: true`.
|
|
157
|
+
*/
|
|
158
|
+
readonly requests: readonly ProxyRequestRecord[];
|
|
159
|
+
}
|
|
160
|
+
/** What an invocation needs from the driver that started it. */
|
|
161
|
+
export interface InvocationDeps {
|
|
162
|
+
readonly clock: VercelCliClock;
|
|
163
|
+
readonly redactor: Redactor;
|
|
164
|
+
readonly proxy: {
|
|
165
|
+
readonly requests: readonly ProxyRequestRecord[];
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
/** Why the driver hard-terminates an invocation's process tree. */
|
|
169
|
+
type KillReason = "timeout" | "abort" | "close" | "abandon";
|
|
170
|
+
export declare class Invocation {
|
|
171
|
+
#private;
|
|
172
|
+
readonly number: number;
|
|
173
|
+
/** How it authenticates, with the token it runs as unless logged out. */
|
|
174
|
+
readonly authentication: Authentication;
|
|
175
|
+
constructor(options: {
|
|
176
|
+
readonly number: number;
|
|
177
|
+
readonly command: string;
|
|
178
|
+
readonly cwd: string;
|
|
179
|
+
readonly interactive: boolean;
|
|
180
|
+
readonly stdin: VercelInvocationStdin;
|
|
181
|
+
readonly authentication: Authentication;
|
|
182
|
+
readonly deps: InvocationDeps;
|
|
183
|
+
});
|
|
184
|
+
get running(): boolean;
|
|
185
|
+
/** Records that `other` ran at the same time as this invocation. */
|
|
186
|
+
overlaps(other: number): void;
|
|
187
|
+
/** Takes each chunk of output as it arrives. */
|
|
188
|
+
readonly output: (stream: OutputStream, text: string) => void;
|
|
189
|
+
/** Records that the process never started. */
|
|
190
|
+
notStarted(error: {
|
|
191
|
+
readonly code: NotStartedReason;
|
|
192
|
+
readonly message: string;
|
|
193
|
+
}): void;
|
|
194
|
+
/**
|
|
195
|
+
* Takes the started process: kills it after `timeoutMs` or when `signal` aborts, and records how it ends.
|
|
196
|
+
*/
|
|
197
|
+
attach(process: VercelProcess, options: {
|
|
198
|
+
readonly timeoutMs: number;
|
|
199
|
+
readonly signal?: AbortSignal | undefined;
|
|
200
|
+
}): void;
|
|
201
|
+
/**
|
|
202
|
+
* Hard-terminates the process tree, recording why, unless it has ended or is already being killed. During a stop's
|
|
203
|
+
* grace period it terminates at once, and the invocation still ends as stopped. Before the process has started, it
|
|
204
|
+
* is terminated as soon as it starts.
|
|
205
|
+
*/
|
|
206
|
+
kill(reason: KillReason): void;
|
|
207
|
+
/**
|
|
208
|
+
* Sends `signal`, then attempts SIGKILL if completion (including output drain) is still pending `STOP_GRACE_MS`
|
|
209
|
+
* later, and resolves with its result. Sends nothing once it has ended or is being killed; then it resolves with that
|
|
210
|
+
* ending. Every call after the first returns the first one's promise. Only for a started invocation.
|
|
211
|
+
*/
|
|
212
|
+
stop(signal: VercelStopSignal): Promise<VercelResult>;
|
|
213
|
+
/** Resolves once the invocation has ended. */
|
|
214
|
+
ended(): Promise<void>;
|
|
215
|
+
/** Its result, once it has ended and the proxy has ended its open exchanges, or `REQUEST_SETTLE_MS` has passed. */
|
|
216
|
+
result(): Promise<VercelResult>;
|
|
217
|
+
/** The invocation as its report shows it, now. */
|
|
218
|
+
snapshot(): VercelInvocation;
|
|
219
|
+
/**
|
|
220
|
+
* Waits for `pattern` in the transcript after the cursor, and moves the cursor past the match. Rejects after
|
|
221
|
+
* `timeoutMs`, or once the process has ended without a match.
|
|
222
|
+
*/
|
|
223
|
+
waitFor(pattern: string | RegExp, timeoutMs: number): Promise<string>;
|
|
224
|
+
/** Writes `text` to stdin. Throws once the process has ended or its stdin is closed. */
|
|
225
|
+
write(text: string, what: string): void;
|
|
226
|
+
/**
|
|
227
|
+
* Writes `text` to stdin, then closes it. Does nothing once the process has ended, is being killed or stopped, or
|
|
228
|
+
* its stdin is closed: `close()` may have come while the process was starting.
|
|
229
|
+
*/
|
|
230
|
+
feed(text: string): void;
|
|
231
|
+
/** Closes stdin. */
|
|
232
|
+
closeStdin(): void;
|
|
233
|
+
}
|
|
234
|
+
export {};
|
|
@@ -0,0 +1,397 @@
|
|
|
1
|
+
// One invocation: a `vercel` process the driver started, with its output, how it ended, the proxy's records added
|
|
2
|
+
// while it ran, and, for an interactive invocation, the cursor `waitFor` searches from.
|
|
3
|
+
import { isOpenRecord } from "../sdk/index.js";
|
|
4
|
+
import { AnsiStripper } from "./ansi.js";
|
|
5
|
+
import { VercelCliError } from "./errors.js";
|
|
6
|
+
/** The most characters of output `waitFor` shows when it rejects. */
|
|
7
|
+
export const WAIT_FOR_OUTPUT_CHARS = 2000;
|
|
8
|
+
/** How long `waitFor` waits by default. */
|
|
9
|
+
export const WAIT_FOR_TIMEOUT_MS = 10_000;
|
|
10
|
+
/** How long `stop()` waits for completion after its signal before it attempts SIGKILL. */
|
|
11
|
+
export const STOP_GRACE_MS = 10_000;
|
|
12
|
+
/**
|
|
13
|
+
* How long a result waits, after the process completes, for the proxy to end the exchanges among its requests that
|
|
14
|
+
* were still open; a record still open after that is reported open.
|
|
15
|
+
*/
|
|
16
|
+
export const REQUEST_SETTLE_MS = 1000;
|
|
17
|
+
/** How often a result re-reads `proxy.requests` while it waits for its open records to end. */
|
|
18
|
+
export const REQUEST_SETTLE_POLL_MS = 10;
|
|
19
|
+
/** The signals `stop()` takes. */
|
|
20
|
+
export const STOP_SIGNALS = ["SIGINT", "SIGTERM"];
|
|
21
|
+
export class Invocation {
|
|
22
|
+
number;
|
|
23
|
+
/** How it authenticates, with the token it runs as unless logged out. */
|
|
24
|
+
authentication;
|
|
25
|
+
#argv;
|
|
26
|
+
#cwd;
|
|
27
|
+
#interactive;
|
|
28
|
+
#stdin;
|
|
29
|
+
#deps;
|
|
30
|
+
#startedAt;
|
|
31
|
+
#requestsFrom;
|
|
32
|
+
#overlapped = new Set();
|
|
33
|
+
#strippers = { stdout: new AnsiStripper(), stderr: new AnsiStripper() };
|
|
34
|
+
/** Each stream as it arrived. */
|
|
35
|
+
#raw = { stdout: "", stderr: "" };
|
|
36
|
+
/** Each stream with ANSI codes removed, as `#strippers` releases it. */
|
|
37
|
+
#text = { stdout: "", stderr: "" };
|
|
38
|
+
/** stdout and stderr together, in arrival order, ANSI codes removed: what `waitFor` searches. */
|
|
39
|
+
#transcript = "";
|
|
40
|
+
/** Where the next `waitFor` starts searching: the end of the previous match. */
|
|
41
|
+
#cursor = 0;
|
|
42
|
+
#process;
|
|
43
|
+
#stdinOpen = false;
|
|
44
|
+
#ending;
|
|
45
|
+
/** What `stop()` returns, from its first call on. */
|
|
46
|
+
#stopped;
|
|
47
|
+
#timeoutMs = 0;
|
|
48
|
+
#end;
|
|
49
|
+
#outputComplete = true;
|
|
50
|
+
#endedAt;
|
|
51
|
+
#requestsTo;
|
|
52
|
+
#waiter;
|
|
53
|
+
/** Resolves once no record in its window is open, or `REQUEST_SETTLE_MS` after its first call. */
|
|
54
|
+
#settled;
|
|
55
|
+
#ended;
|
|
56
|
+
#markEnded = () => undefined;
|
|
57
|
+
constructor(options) {
|
|
58
|
+
this.number = options.number;
|
|
59
|
+
this.#argv = options.command;
|
|
60
|
+
this.#cwd = options.cwd;
|
|
61
|
+
this.#interactive = options.interactive;
|
|
62
|
+
this.#stdin = options.stdin;
|
|
63
|
+
this.authentication = options.authentication;
|
|
64
|
+
this.#deps = options.deps;
|
|
65
|
+
this.#startedAt = options.deps.clock.now();
|
|
66
|
+
this.#requestsFrom = options.deps.proxy.requests.length;
|
|
67
|
+
this.#ended = new Promise((resolve) => {
|
|
68
|
+
this.#markEnded = resolve;
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
get running() {
|
|
72
|
+
return this.#end === undefined;
|
|
73
|
+
}
|
|
74
|
+
/** Records that `other` ran at the same time as this invocation. */
|
|
75
|
+
overlaps(other) {
|
|
76
|
+
this.#overlapped.add(other);
|
|
77
|
+
}
|
|
78
|
+
/** Takes each chunk of output as it arrives. */
|
|
79
|
+
output = (stream, text) => {
|
|
80
|
+
this.#raw[stream] += text;
|
|
81
|
+
const stripped = this.#strippers[stream].push(text);
|
|
82
|
+
this.#text[stream] += stripped;
|
|
83
|
+
this.#transcript += stripped;
|
|
84
|
+
this.#checkWaiter();
|
|
85
|
+
};
|
|
86
|
+
/** Records that the process never started. */
|
|
87
|
+
notStarted(error) {
|
|
88
|
+
this.#finish({ kind: "not-started", reason: error.code, message: error.message });
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Takes the started process: kills it after `timeoutMs` or when `signal` aborts, and records how it ends.
|
|
92
|
+
*/
|
|
93
|
+
attach(process, options) {
|
|
94
|
+
this.#process = process;
|
|
95
|
+
// Every stdin but an ignored one is a pipe, open until something closes it.
|
|
96
|
+
this.#stdinOpen = this.#stdin.kind !== "ignored" && this.#ending === undefined;
|
|
97
|
+
// `close()` may have come while the process was starting; a stop can't, since it needs the process.
|
|
98
|
+
if (this.#ending !== undefined)
|
|
99
|
+
process.terminate();
|
|
100
|
+
this.#timeoutMs = options.timeoutMs;
|
|
101
|
+
const cancelTimeout = this.#deps.clock.schedule(options.timeoutMs, () => this.kill("timeout"));
|
|
102
|
+
const onAbort = () => this.kill("abort");
|
|
103
|
+
options.signal?.addEventListener("abort", onAbort, { once: true });
|
|
104
|
+
if (options.signal?.aborted === true)
|
|
105
|
+
this.kill("abort");
|
|
106
|
+
void process.exited.then((exit) => {
|
|
107
|
+
cancelTimeout();
|
|
108
|
+
if (this.#ending?.kind === "stop")
|
|
109
|
+
this.#ending.cancelGrace();
|
|
110
|
+
options.signal?.removeEventListener("abort", onAbort);
|
|
111
|
+
this.#finish(this.#endFor(exit));
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Hard-terminates the process tree, recording why, unless it has ended or is already being killed. During a stop's
|
|
116
|
+
* grace period it terminates at once, and the invocation still ends as stopped. Before the process has started, it
|
|
117
|
+
* is terminated as soon as it starts.
|
|
118
|
+
*/
|
|
119
|
+
kill(reason) {
|
|
120
|
+
if (this.#end !== undefined)
|
|
121
|
+
return;
|
|
122
|
+
const ending = this.#ending;
|
|
123
|
+
if (ending === undefined)
|
|
124
|
+
this.#ending = { kind: "kill", reason };
|
|
125
|
+
else if (ending.kind === "kill" || ending.killedDuringGrace)
|
|
126
|
+
return;
|
|
127
|
+
else {
|
|
128
|
+
ending.killedDuringGrace = true;
|
|
129
|
+
ending.cancelGrace();
|
|
130
|
+
}
|
|
131
|
+
this.#stdinOpen = false;
|
|
132
|
+
this.#process?.terminate();
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Sends `signal`, then attempts SIGKILL if completion (including output drain) is still pending `STOP_GRACE_MS`
|
|
136
|
+
* later, and resolves with its result. Sends nothing once it has ended or is being killed; then it resolves with that
|
|
137
|
+
* ending. Every call after the first returns the first one's promise. Only for a started invocation.
|
|
138
|
+
*/
|
|
139
|
+
stop(signal) {
|
|
140
|
+
if (this.#stopped !== undefined)
|
|
141
|
+
return this.#stopped;
|
|
142
|
+
const process = this.#process;
|
|
143
|
+
if (this.#end === undefined && this.#ending === undefined && process !== undefined) {
|
|
144
|
+
const stopping = {
|
|
145
|
+
kind: "stop",
|
|
146
|
+
signal,
|
|
147
|
+
cancelGrace: () => undefined,
|
|
148
|
+
killAttemptedAfterGrace: false,
|
|
149
|
+
killedDuringGrace: false,
|
|
150
|
+
};
|
|
151
|
+
this.#ending = stopping;
|
|
152
|
+
this.#stdinOpen = false;
|
|
153
|
+
stopping.cancelGrace = this.#deps.clock.schedule(STOP_GRACE_MS, () => {
|
|
154
|
+
stopping.killAttemptedAfterGrace = true;
|
|
155
|
+
process.terminate();
|
|
156
|
+
});
|
|
157
|
+
process.signal(signal);
|
|
158
|
+
}
|
|
159
|
+
this.#stopped = this.result();
|
|
160
|
+
return this.#stopped;
|
|
161
|
+
}
|
|
162
|
+
/** Resolves once the invocation has ended. */
|
|
163
|
+
ended() {
|
|
164
|
+
return this.#ended;
|
|
165
|
+
}
|
|
166
|
+
/** Its result, once it has ended and the proxy has ended its open exchanges, or `REQUEST_SETTLE_MS` has passed. */
|
|
167
|
+
async result() {
|
|
168
|
+
await this.#ended;
|
|
169
|
+
await this.#settle();
|
|
170
|
+
const end = this.#end;
|
|
171
|
+
const exit = end === undefined || end.kind === "not-started" ? { exitCode: null, signal: null } : end;
|
|
172
|
+
const { redactor } = this.#deps;
|
|
173
|
+
return {
|
|
174
|
+
exitCode: exit.exitCode,
|
|
175
|
+
signal: exit.signal,
|
|
176
|
+
timedOut: end?.kind === "timed-out",
|
|
177
|
+
aborted: end?.kind === "aborted",
|
|
178
|
+
stopped: end?.kind === "stopped",
|
|
179
|
+
outputComplete: this.#outputComplete,
|
|
180
|
+
...this.#output(redactor),
|
|
181
|
+
durationMs: this.#duration(),
|
|
182
|
+
requests: this.#requests(),
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
/** The invocation as its report shows it, now. */
|
|
186
|
+
snapshot() {
|
|
187
|
+
const { redactor } = this.#deps;
|
|
188
|
+
return {
|
|
189
|
+
number: this.number,
|
|
190
|
+
command: this.#argv,
|
|
191
|
+
cwd: this.#cwd,
|
|
192
|
+
interactive: this.#interactive,
|
|
193
|
+
terminal: this.#stdin.kind === "terminal",
|
|
194
|
+
stdin: this.#stdin.kind === "text" ? { kind: "text", text: redactor.redact(this.#stdin.text) } : this.#stdin,
|
|
195
|
+
auth: this.authentication.mode,
|
|
196
|
+
...(this.#end === undefined ? {} : { end: redactEnd(this.#end, redactor) }),
|
|
197
|
+
outputComplete: this.#outputComplete,
|
|
198
|
+
durationMs: this.#duration(),
|
|
199
|
+
...this.#output(redactor),
|
|
200
|
+
requests: this.#requests(),
|
|
201
|
+
overlapped: [...this.#overlapped].toSorted((a, b) => a - b),
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Waits for `pattern` in the transcript after the cursor, and moves the cursor past the match. Rejects after
|
|
206
|
+
* `timeoutMs`, or once the process has ended without a match.
|
|
207
|
+
*/
|
|
208
|
+
waitFor(pattern, timeoutMs) {
|
|
209
|
+
if (this.#waiter !== undefined) {
|
|
210
|
+
throw new TypeError("vercel-cli: wait for one pattern at a time; the previous waitFor hasn't settled");
|
|
211
|
+
}
|
|
212
|
+
return new Promise((resolve, reject) => {
|
|
213
|
+
const matcher = matcherFor(pattern);
|
|
214
|
+
let cancelTimeout = () => undefined;
|
|
215
|
+
const settle = () => {
|
|
216
|
+
this.#waiter = undefined;
|
|
217
|
+
cancelTimeout();
|
|
218
|
+
};
|
|
219
|
+
const check = () => {
|
|
220
|
+
const match = matcher(this.#transcript, this.#cursor);
|
|
221
|
+
if (match === undefined)
|
|
222
|
+
return false;
|
|
223
|
+
this.#cursor = match.end;
|
|
224
|
+
settle();
|
|
225
|
+
resolve(match.text);
|
|
226
|
+
return true;
|
|
227
|
+
};
|
|
228
|
+
const fail = (why) => {
|
|
229
|
+
settle();
|
|
230
|
+
reject(new VercelCliError(this.#waitFailure(pattern, why)));
|
|
231
|
+
};
|
|
232
|
+
if (check())
|
|
233
|
+
return;
|
|
234
|
+
if (this.#end !== undefined) {
|
|
235
|
+
fail(`${this.#describeEnd()} before it matched`);
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
238
|
+
this.#waiter = { check, fail };
|
|
239
|
+
cancelTimeout = this.#deps.clock.schedule(timeoutMs, () => fail(`it didn't match within ${timeoutMs}ms`));
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
/** Writes `text` to stdin. Throws once the process has ended or its stdin is closed. */
|
|
243
|
+
write(text, what) {
|
|
244
|
+
if (this.#end !== undefined || this.#process === undefined) {
|
|
245
|
+
throw new VercelCliError(`vercel-cli: can't send ${what} to invocation ${this.number}: ${this.#describeEnd()}`);
|
|
246
|
+
}
|
|
247
|
+
if (this.#ending?.kind === "stop") {
|
|
248
|
+
throw new VercelCliError(`vercel-cli: can't send ${what} to invocation ${this.number}: it was stopped with ${this.#ending.signal}`);
|
|
249
|
+
}
|
|
250
|
+
if (!this.#stdinOpen) {
|
|
251
|
+
throw new VercelCliError(`vercel-cli: can't send ${what} to invocation ${this.number}: its stdin is closed`);
|
|
252
|
+
}
|
|
253
|
+
this.#process.write(text);
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* Writes `text` to stdin, then closes it. Does nothing once the process has ended, is being killed or stopped, or
|
|
257
|
+
* its stdin is closed: `close()` may have come while the process was starting.
|
|
258
|
+
*/
|
|
259
|
+
feed(text) {
|
|
260
|
+
if (!this.#stdinOpen)
|
|
261
|
+
return;
|
|
262
|
+
if (text !== "")
|
|
263
|
+
this.#process?.write(text);
|
|
264
|
+
this.closeStdin();
|
|
265
|
+
}
|
|
266
|
+
/** Closes stdin. */
|
|
267
|
+
closeStdin() {
|
|
268
|
+
if (!this.#stdinOpen)
|
|
269
|
+
return;
|
|
270
|
+
this.#stdinOpen = false;
|
|
271
|
+
this.#process?.closeStdin();
|
|
272
|
+
}
|
|
273
|
+
#endFor(processExit) {
|
|
274
|
+
const { outputComplete, ...exit } = processExit;
|
|
275
|
+
this.#outputComplete = outputComplete;
|
|
276
|
+
const ending = this.#ending;
|
|
277
|
+
if (ending === undefined)
|
|
278
|
+
return { kind: "exited", ...exit };
|
|
279
|
+
if (ending.kind === "stop")
|
|
280
|
+
return {
|
|
281
|
+
kind: "stopped",
|
|
282
|
+
stopSignal: ending.signal,
|
|
283
|
+
killAttemptedAfterGrace: ending.killAttemptedAfterGrace,
|
|
284
|
+
...exit,
|
|
285
|
+
};
|
|
286
|
+
switch (ending.reason) {
|
|
287
|
+
case "timeout":
|
|
288
|
+
return { kind: "timed-out", timeoutMs: this.#timeoutMs, ...exit };
|
|
289
|
+
case "abort":
|
|
290
|
+
return { kind: "aborted", ...exit };
|
|
291
|
+
case "close":
|
|
292
|
+
return { kind: "closed", ...exit };
|
|
293
|
+
case "abandon":
|
|
294
|
+
return { kind: "abandoned", ...exit };
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
#finish(end) {
|
|
298
|
+
if (this.#end !== undefined)
|
|
299
|
+
return;
|
|
300
|
+
for (const stream of ["stdout", "stderr"]) {
|
|
301
|
+
const rest = this.#strippers[stream].flush();
|
|
302
|
+
this.#text[stream] += rest;
|
|
303
|
+
this.#transcript += rest;
|
|
304
|
+
}
|
|
305
|
+
this.#end = end;
|
|
306
|
+
this.#stdinOpen = false;
|
|
307
|
+
this.#endedAt = this.#deps.clock.now();
|
|
308
|
+
this.#requestsTo = this.#deps.proxy.requests.length;
|
|
309
|
+
const waiter = this.#waiter;
|
|
310
|
+
if (waiter !== undefined && !waiter.check())
|
|
311
|
+
waiter.fail(`${this.#describeEnd()} before it matched`);
|
|
312
|
+
this.#markEnded();
|
|
313
|
+
}
|
|
314
|
+
/** Its four output fields, tokens redacted. */
|
|
315
|
+
#output(redactor) {
|
|
316
|
+
return {
|
|
317
|
+
stdout: redactor.redact(this.#text.stdout),
|
|
318
|
+
stderr: redactor.redact(this.#text.stderr),
|
|
319
|
+
rawStdout: redactor.redact(this.#raw.stdout),
|
|
320
|
+
rawStderr: redactor.redact(this.#raw.stderr),
|
|
321
|
+
};
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* Re-reads its window of `proxy.requests` every `REQUEST_SETTLE_POLL_MS` on the clock until none is open, for at
|
|
325
|
+
* most `REQUEST_SETTLE_MS`. The window is fixed at its end, so only its own requests can delay it.
|
|
326
|
+
*/
|
|
327
|
+
#settle() {
|
|
328
|
+
this.#settled ??= new Promise((resolve) => {
|
|
329
|
+
const deadline = this.#deps.clock.now() + REQUEST_SETTLE_MS;
|
|
330
|
+
const poll = () => {
|
|
331
|
+
if (!this.#requests().some(isOpenRecord) || this.#deps.clock.now() >= deadline)
|
|
332
|
+
resolve();
|
|
333
|
+
else
|
|
334
|
+
this.#deps.clock.schedule(REQUEST_SETTLE_POLL_MS, poll);
|
|
335
|
+
};
|
|
336
|
+
poll();
|
|
337
|
+
});
|
|
338
|
+
return this.#settled;
|
|
339
|
+
}
|
|
340
|
+
#checkWaiter() {
|
|
341
|
+
this.#waiter?.check();
|
|
342
|
+
}
|
|
343
|
+
#duration() {
|
|
344
|
+
return (this.#endedAt ?? this.#deps.clock.now()) - this.#startedAt;
|
|
345
|
+
}
|
|
346
|
+
#requests() {
|
|
347
|
+
return this.#deps.proxy.requests.slice(this.#requestsFrom, this.#requestsTo);
|
|
348
|
+
}
|
|
349
|
+
#describeEnd() {
|
|
350
|
+
const end = this.#end;
|
|
351
|
+
if (end === undefined)
|
|
352
|
+
return "vercel is still running";
|
|
353
|
+
switch (end.kind) {
|
|
354
|
+
case "exited":
|
|
355
|
+
return end.exitCode === null
|
|
356
|
+
? `vercel was ended by ${end.signal ?? "a signal"}`
|
|
357
|
+
: `vercel exited ${end.exitCode}`;
|
|
358
|
+
case "stopped":
|
|
359
|
+
return end.killAttemptedAfterGrace
|
|
360
|
+
? `vercel was stopped with ${end.stopSignal}; SIGKILL attempted after the ${STOP_GRACE_MS}ms grace`
|
|
361
|
+
: `vercel was stopped with ${end.stopSignal}`;
|
|
362
|
+
case "timed-out":
|
|
363
|
+
return `vercel was killed after its ${end.timeoutMs}ms timeout`;
|
|
364
|
+
case "aborted":
|
|
365
|
+
return "vercel was killed when the test's signal aborted";
|
|
366
|
+
case "closed":
|
|
367
|
+
return "vercel was killed by close()";
|
|
368
|
+
case "abandoned":
|
|
369
|
+
return "vercel was killed when its interactive block threw";
|
|
370
|
+
case "not-started":
|
|
371
|
+
return "vercel never started";
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
#waitFailure(pattern, why) {
|
|
375
|
+
const output = this.#deps.redactor.redact(this.#transcript).slice(-WAIT_FOR_OUTPUT_CHARS);
|
|
376
|
+
const shown = this.#deps.redactor.redact(typeof pattern === "string" ? JSON.stringify(pattern) : String(pattern));
|
|
377
|
+
return (`vercel-cli: waitFor(${shown}) failed in invocation ${this.number} (${this.#argv}): ${why}\n` +
|
|
378
|
+
`--- output (last ${WAIT_FOR_OUTPUT_CHARS} characters, stdout and stderr together)\n${output}`);
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
function matcherFor(pattern) {
|
|
382
|
+
if (typeof pattern === "string") {
|
|
383
|
+
return (text, from) => {
|
|
384
|
+
const index = text.indexOf(pattern, from);
|
|
385
|
+
return index === -1 ? undefined : { text: pattern, end: index + pattern.length };
|
|
386
|
+
};
|
|
387
|
+
}
|
|
388
|
+
// A global or sticky expression keeps `lastIndex` between calls; a copy without those flags searches afresh.
|
|
389
|
+
const expression = new RegExp(pattern.source, pattern.flags.replaceAll(/[gy]/g, ""));
|
|
390
|
+
return (text, from) => {
|
|
391
|
+
const match = expression.exec(text.slice(from));
|
|
392
|
+
return match === null ? undefined : { text: match[0], end: from + match.index + match[0].length };
|
|
393
|
+
};
|
|
394
|
+
}
|
|
395
|
+
function redactEnd(end, redactor) {
|
|
396
|
+
return end.kind === "not-started" ? { ...end, message: redactor.redact(end.message) } : end;
|
|
397
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** What `press` sends for each key: the bytes a terminal sends for it. */
|
|
2
|
+
export declare const KEY_SEQUENCES: {
|
|
3
|
+
readonly enter: "\r";
|
|
4
|
+
readonly up: "\u001B[A";
|
|
5
|
+
readonly down: "\u001B[B";
|
|
6
|
+
readonly right: "\u001B[C";
|
|
7
|
+
readonly left: "\u001B[D";
|
|
8
|
+
readonly escape: "\u001B";
|
|
9
|
+
readonly tab: "\t";
|
|
10
|
+
readonly backspace: "";
|
|
11
|
+
readonly space: " ";
|
|
12
|
+
};
|
|
13
|
+
/** A key `press` can send. */
|
|
14
|
+
export type VercelKey = keyof typeof KEY_SEQUENCES;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** What `press` sends for each key: the bytes a terminal sends for it. */
|
|
2
|
+
export const KEY_SEQUENCES = {
|
|
3
|
+
enter: "\r",
|
|
4
|
+
up: "\u001b[A",
|
|
5
|
+
down: "\u001b[B",
|
|
6
|
+
right: "\u001b[C",
|
|
7
|
+
left: "\u001b[D",
|
|
8
|
+
escape: "\u001b",
|
|
9
|
+
tab: "\t",
|
|
10
|
+
backspace: "\u007f",
|
|
11
|
+
space: " ",
|
|
12
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type AuthConfig, type ConfigFileName, type GlobalConfig } from "../config-files.ts";
|
|
2
|
+
/**
|
|
3
|
+
* The CLI's `config.json` in `globalConfigDir`, such as a test's `vercel.globalConfigDir`, or `undefined` when
|
|
4
|
+
* there is none. Throws a `VercelCliError` when it isn't a JSON object.
|
|
5
|
+
*/
|
|
6
|
+
export declare function readGlobalConfig(globalConfigDir: string): Promise<GlobalConfig | undefined>;
|
|
7
|
+
/**
|
|
8
|
+
* Writes `config` as the CLI's `config.json` in `globalConfigDir`, creating the directory if needed, at once
|
|
9
|
+
* (`replaceConfigFile`).
|
|
10
|
+
*/
|
|
11
|
+
export declare function writeGlobalConfig(globalConfigDir: string, config: GlobalConfig): Promise<void>;
|
|
12
|
+
/**
|
|
13
|
+
* The CLI's `auth.json` in `globalConfigDir`, such as a test's `vercel.globalConfigDir`, or `undefined` when there is
|
|
14
|
+
* none. Throws a `VercelCliError` when it isn't a JSON object.
|
|
15
|
+
*/
|
|
16
|
+
export declare function readAuthConfig(globalConfigDir: string): Promise<AuthConfig | undefined>;
|
|
17
|
+
/**
|
|
18
|
+
* Writes `config` as the CLI's `auth.json` in `globalConfigDir`, creating the directory if needed, at once
|
|
19
|
+
* (`replaceConfigFile`), so a running `vercel` never reads part of it. Under a saved login the driver replaces its
|
|
20
|
+
* `token` before each invocation, and under a logged-out run removes it; every other key is the test's.
|
|
21
|
+
*/
|
|
22
|
+
export declare function writeAuthConfig(globalConfigDir: string, config: AuthConfig): Promise<void>;
|
|
23
|
+
/**
|
|
24
|
+
* Replaces `name` in `globalConfigDir`, an existing directory, with `text` at once: it writes a temporary file in
|
|
25
|
+
* that directory, then renames it over `name`, so a reader sees the old file or the new one, never part of it. The
|
|
26
|
+
* temporary file is removed when either step fails.
|
|
27
|
+
*/
|
|
28
|
+
export declare function replaceConfigFile(globalConfigDir: string, name: ConfigFileName, text: string): Promise<void>;
|