@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,78 @@
|
|
|
1
|
+
import { REDACTED } from "../sdk/index.js";
|
|
2
|
+
/** Flags the driver adds to every invocation, so a call's arguments may not. */
|
|
3
|
+
const DRIVER_FLAGS = ["--api", "--token", "-t", "--global-config", "-Q"];
|
|
4
|
+
/** Flags that name the scope, which a call's arguments may not pass along with its `scope` option. */
|
|
5
|
+
const SCOPE_FLAGS = ["--scope", "-S", "--team"];
|
|
6
|
+
/** Flags whose next argument is a token. */
|
|
7
|
+
const TOKEN_FLAGS = new Set(["--token", "-t"]);
|
|
8
|
+
/**
|
|
9
|
+
* An invocation's `vercel` arguments: `args`, then the hidden `--api` flag pointing the CLI at the proxy, `--token`
|
|
10
|
+
* when a token is given, `--global-config`, and `--scope` when one is given. Throws a `TypeError` when `args` already
|
|
11
|
+
* passes a flag the driver adds, `--token` included when no token is given, or a scope flag along with `scope`: the
|
|
12
|
+
* driver never sends a flag twice, and owns how an invocation authenticates.
|
|
13
|
+
*/
|
|
14
|
+
export function vercelArguments(options) {
|
|
15
|
+
const given = flagsIn(options.args);
|
|
16
|
+
const owned = DRIVER_FLAGS.filter((flag) => given.has(flag));
|
|
17
|
+
if (owned.length > 0) {
|
|
18
|
+
throw new TypeError(`vercel-cli: the driver passes ${owned.join(", ")} itself; leave it out of the arguments`);
|
|
19
|
+
}
|
|
20
|
+
if (options.scope !== undefined) {
|
|
21
|
+
const scoped = SCOPE_FLAGS.filter((flag) => given.has(flag));
|
|
22
|
+
if (scoped.length > 0) {
|
|
23
|
+
throw new TypeError(`vercel-cli: pass the scope either as the scope option or as ${scoped.join(", ")}, not both`);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return [
|
|
27
|
+
...options.args,
|
|
28
|
+
"--api",
|
|
29
|
+
options.proxyUrl,
|
|
30
|
+
...(options.token === undefined ? [] : ["--token", options.token]),
|
|
31
|
+
"--global-config",
|
|
32
|
+
options.globalConfigDir,
|
|
33
|
+
...(options.scope === undefined ? [] : ["--scope", options.scope]),
|
|
34
|
+
];
|
|
35
|
+
}
|
|
36
|
+
/** Whether `args` names the scope with `--scope`, `-S` or `--team`, alone or with `=`, before any `--`. */
|
|
37
|
+
export function passesScopeFlag(args) {
|
|
38
|
+
const given = flagsIn(args);
|
|
39
|
+
return SCOPE_FLAGS.some((flag) => given.has(flag));
|
|
40
|
+
}
|
|
41
|
+
/** Whether `args` already passes `flag`, alone or as `flag=value`, before any `--`. */
|
|
42
|
+
export function passesFlag(args, flag) {
|
|
43
|
+
return flagsIn(args).has(flag);
|
|
44
|
+
}
|
|
45
|
+
function flagsIn(args) {
|
|
46
|
+
const flags = new Set();
|
|
47
|
+
for (const arg of args) {
|
|
48
|
+
if (arg === "--")
|
|
49
|
+
break;
|
|
50
|
+
if (!arg.startsWith("-"))
|
|
51
|
+
continue;
|
|
52
|
+
const equals = arg.indexOf("=");
|
|
53
|
+
flags.add(equals === -1 ? arg : arg.slice(0, equals));
|
|
54
|
+
}
|
|
55
|
+
return flags;
|
|
56
|
+
}
|
|
57
|
+
/** `arg` as a POSIX shell reads it: as is when it has nothing the shell treats specially, else single-quoted. */
|
|
58
|
+
export function shellQuote(arg) {
|
|
59
|
+
if (/^[\w@%+=:,./-]+$/.test(arg))
|
|
60
|
+
return arg;
|
|
61
|
+
return `'${arg.replaceAll("'", `'\\''`)}'`;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* A command line for a report: each argument shell-quoted, the argument after `--token` or `-t` and the value of
|
|
65
|
+
* `--token=` as `<token>`, and every token `redactor` knows replaced.
|
|
66
|
+
*/
|
|
67
|
+
export function displayCommand(argv, redactor) {
|
|
68
|
+
return argv
|
|
69
|
+
.map((arg, index) => {
|
|
70
|
+
const previous = index === 0 ? undefined : argv[index - 1];
|
|
71
|
+
if (previous !== undefined && TOKEN_FLAGS.has(previous))
|
|
72
|
+
return REDACTED;
|
|
73
|
+
if (arg.startsWith("--token="))
|
|
74
|
+
return `--token=${REDACTED}`;
|
|
75
|
+
return redactor.redact(shellQuote(arg));
|
|
76
|
+
})
|
|
77
|
+
.join(" ");
|
|
78
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { AuthConfig } from "./config-files.ts";
|
|
2
|
+
/** The ways an invocation authenticates. */
|
|
3
|
+
export declare const VERCEL_AUTH_MODES: readonly ["flag", "saved", "none"];
|
|
4
|
+
/**
|
|
5
|
+
* How an invocation authenticates:
|
|
6
|
+
*
|
|
7
|
+
* - `"flag"`: `--token <secret>`. The driver never touches `auth.json`.
|
|
8
|
+
* - `"saved"`: no `--token`. The driver saves the token in `auth.json` first, so `vercel` reads it as it reads a
|
|
9
|
+
* `vercel login`: a saved login.
|
|
10
|
+
* - `"none"`: no `--token`, and none of the login keys (`LOGIN_KEYS`) in `auth.json`: a logged-out run.
|
|
11
|
+
*/
|
|
12
|
+
export type VercelAuth = (typeof VERCEL_AUTH_MODES)[number];
|
|
13
|
+
/** How one invocation authenticates, resolved from its call: its mode, with the token it runs as unless logged out. */
|
|
14
|
+
export type Authentication = {
|
|
15
|
+
readonly mode: "flag";
|
|
16
|
+
readonly token: string;
|
|
17
|
+
} | {
|
|
18
|
+
readonly mode: "saved";
|
|
19
|
+
readonly token: string;
|
|
20
|
+
} | {
|
|
21
|
+
readonly mode: "none";
|
|
22
|
+
};
|
|
23
|
+
/** A saved login or a logged-out run: an `Authentication` that needs `auth.json` to hold its token, or none. */
|
|
24
|
+
export type AuthFileAuthentication = Extract<Authentication, {
|
|
25
|
+
readonly mode: "saved" | "none";
|
|
26
|
+
}>;
|
|
27
|
+
/**
|
|
28
|
+
* Whether `a` and `b` need different `auth.json` contents, so they can't run at once: both are a saved login or a
|
|
29
|
+
* logged-out run, and one needs a token the other doesn't, or another token. `"flag"` needs nothing of the file.
|
|
30
|
+
*/
|
|
31
|
+
export declare function authFileConflict(a: Authentication, b: Authentication): boolean;
|
|
32
|
+
/**
|
|
33
|
+
* The `auth.json` keys a logged-out run removes. `vercel` treats a `refreshToken` as a login as much as a `token`, and
|
|
34
|
+
* `expiresAt` belongs to them.
|
|
35
|
+
*/
|
|
36
|
+
export declare const LOGIN_KEYS: readonly ["token", "refreshToken", "expiresAt"];
|
|
37
|
+
/** Whether `config` already holds what `authentication` needs: its token, or none of the login keys. */
|
|
38
|
+
export declare function authFileSettled(config: AuthConfig, authentication: AuthFileAuthentication): boolean;
|
|
39
|
+
/**
|
|
40
|
+
* `config` as `authentication` needs it: its `token` set to the saved token, or the login keys removed, every other
|
|
41
|
+
* key kept.
|
|
42
|
+
*/
|
|
43
|
+
export declare function settledAuthConfig(config: AuthConfig, authentication: AuthFileAuthentication): AuthConfig;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// The ways an invocation authenticates, which decide what the driver leaves in the CLI's `auth.json`
|
|
2
|
+
// (`AUTH_CONFIG_FILE`, `config-files.ts`), as plain data.
|
|
3
|
+
/** The ways an invocation authenticates. */
|
|
4
|
+
export const VERCEL_AUTH_MODES = ["flag", "saved", "none"];
|
|
5
|
+
/**
|
|
6
|
+
* Whether `a` and `b` need different `auth.json` contents, so they can't run at once: both are a saved login or a
|
|
7
|
+
* logged-out run, and one needs a token the other doesn't, or another token. `"flag"` needs nothing of the file.
|
|
8
|
+
*/
|
|
9
|
+
export function authFileConflict(a, b) {
|
|
10
|
+
if (a.mode === "flag" || b.mode === "flag")
|
|
11
|
+
return false;
|
|
12
|
+
if (a.mode === "none" || b.mode === "none")
|
|
13
|
+
return a.mode !== b.mode;
|
|
14
|
+
return a.token !== b.token;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* The `auth.json` keys a logged-out run removes. `vercel` treats a `refreshToken` as a login as much as a `token`, and
|
|
18
|
+
* `expiresAt` belongs to them.
|
|
19
|
+
*/
|
|
20
|
+
export const LOGIN_KEYS = ["token", "refreshToken", "expiresAt"];
|
|
21
|
+
/** Whether `config` already holds what `authentication` needs: its token, or none of the login keys. */
|
|
22
|
+
export function authFileSettled(config, authentication) {
|
|
23
|
+
return authentication.mode === "none"
|
|
24
|
+
? LOGIN_KEYS.every((key) => !Object.hasOwn(config, key))
|
|
25
|
+
: config["token"] === authentication.token;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* `config` as `authentication` needs it: its `token` set to the saved token, or the login keys removed, every other
|
|
29
|
+
* key kept.
|
|
30
|
+
*/
|
|
31
|
+
export function settledAuthConfig(config, authentication) {
|
|
32
|
+
if (authentication.mode === "saved")
|
|
33
|
+
return { ...config, token: authentication.token };
|
|
34
|
+
const loginKeys = new Set(LOGIN_KEYS);
|
|
35
|
+
return Object.fromEntries(Object.entries(config).filter(([key]) => !loginKeys.has(key)));
|
|
36
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** Tells monotonic time and schedules callbacks. */
|
|
2
|
+
export interface VercelCliClock {
|
|
3
|
+
/** Monotonic time in milliseconds from an arbitrary origin. */
|
|
4
|
+
now(): number;
|
|
5
|
+
/** Calls `callback` once after `ms`, unless the returned function is called first. */
|
|
6
|
+
schedule(ms: number, callback: () => void): () => void;
|
|
7
|
+
}
|
|
8
|
+
/** The system clock: `performance.now()` and `setTimeout`. */
|
|
9
|
+
export declare const systemVercelCliClock: VercelCliClock;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// Time as a DI seam, not a gateway: the driver times invocations and kills them on a timeout. Only
|
|
2
|
+
// `systemVercelCliClock` touches real time; tests pass one driven by hand.
|
|
3
|
+
/** The system clock: `performance.now()` and `setTimeout`. */
|
|
4
|
+
export const systemVercelCliClock = {
|
|
5
|
+
now: () => performance.now(),
|
|
6
|
+
schedule: (ms, callback) => {
|
|
7
|
+
const timer = setTimeout(callback, ms);
|
|
8
|
+
return () => clearTimeout(timer);
|
|
9
|
+
},
|
|
10
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/** The file in a global-config directory that holds the CLI's settings, such as `currentTeam`. */
|
|
2
|
+
export declare const GLOBAL_CONFIG_FILE = "config.json";
|
|
3
|
+
/** The file in a global-config directory that holds the CLI's login: `token`, `userId`, `cachedUser` and so on. */
|
|
4
|
+
export declare const AUTH_CONFIG_FILE = "auth.json";
|
|
5
|
+
/** One of the CLI's JSON object files in a global-config directory. */
|
|
6
|
+
export type ConfigFileName = typeof GLOBAL_CONFIG_FILE | typeof AUTH_CONFIG_FILE;
|
|
7
|
+
/** A JSON object file's contents. */
|
|
8
|
+
export type JsonObject = Readonly<Record<string, unknown>>;
|
|
9
|
+
/** The CLI's `config.json`: a JSON object. */
|
|
10
|
+
export type GlobalConfig = JsonObject;
|
|
11
|
+
/** The CLI's `auth.json`: a JSON object. */
|
|
12
|
+
export type AuthConfig = JsonObject;
|
|
13
|
+
/** `text`, read from `path`, as a JSON object, or why it isn't one, naming `path`. */
|
|
14
|
+
export declare function readConfigText(text: string, path: string): {
|
|
15
|
+
readonly ok: true;
|
|
16
|
+
readonly value: JsonObject;
|
|
17
|
+
} | {
|
|
18
|
+
readonly ok: false;
|
|
19
|
+
readonly message: string;
|
|
20
|
+
};
|
|
21
|
+
/** `text`, read from `path`, as a JSON object. Throws a `VercelCliError` naming `path` unless it's one. */
|
|
22
|
+
export declare function parseConfigText(text: string, path: string): JsonObject;
|
|
23
|
+
/** `config` as the CLI writes its JSON files: indented JSON with a trailing newline. */
|
|
24
|
+
export declare function serializeConfig(config: JsonObject): string;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// The `vercel` CLI's JSON object files in a test's global-config directory, `config.json` and `auth.json`, as plain
|
|
2
|
+
// data. The file I/O is `live/config-files.ts` for tests, and the process gateway's `readAuthFile` and
|
|
3
|
+
// `writeAuthFile` for the driver.
|
|
4
|
+
import { VercelCliError } from "./errors.js";
|
|
5
|
+
/** The file in a global-config directory that holds the CLI's settings, such as `currentTeam`. */
|
|
6
|
+
export const GLOBAL_CONFIG_FILE = "config.json";
|
|
7
|
+
/** The file in a global-config directory that holds the CLI's login: `token`, `userId`, `cachedUser` and so on. */
|
|
8
|
+
export const AUTH_CONFIG_FILE = "auth.json";
|
|
9
|
+
/** `text`, read from `path`, as a JSON object, or why it isn't one, naming `path`. */
|
|
10
|
+
export function readConfigText(text, path) {
|
|
11
|
+
let value;
|
|
12
|
+
try {
|
|
13
|
+
value = JSON.parse(text);
|
|
14
|
+
}
|
|
15
|
+
catch (error) {
|
|
16
|
+
return { ok: false, message: `${path} isn't JSON: ${error instanceof Error ? error.message : String(error)}` };
|
|
17
|
+
}
|
|
18
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
19
|
+
return { ok: false, message: `${path} holds ${describeJson(value)}, not a JSON object` };
|
|
20
|
+
}
|
|
21
|
+
return { ok: true, value: value };
|
|
22
|
+
}
|
|
23
|
+
/** `text`, read from `path`, as a JSON object. Throws a `VercelCliError` naming `path` unless it's one. */
|
|
24
|
+
export function parseConfigText(text, path) {
|
|
25
|
+
const read = readConfigText(text, path);
|
|
26
|
+
if (!read.ok)
|
|
27
|
+
throw new VercelCliError(`vercel-cli: ${read.message}`);
|
|
28
|
+
return read.value;
|
|
29
|
+
}
|
|
30
|
+
/** `config` as the CLI writes its JSON files: indented JSON with a trailing newline. */
|
|
31
|
+
export function serializeConfig(config) {
|
|
32
|
+
return `${JSON.stringify(config, null, 2)}\n`;
|
|
33
|
+
}
|
|
34
|
+
function describeJson(value) {
|
|
35
|
+
if (value === null)
|
|
36
|
+
return "null";
|
|
37
|
+
if (Array.isArray(value))
|
|
38
|
+
return "an array";
|
|
39
|
+
return `a ${typeof value}`;
|
|
40
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type VercelCliClock } from "./clock.ts";
|
|
2
|
+
import type { VercelCliProcessGateway } from "./gateways.ts";
|
|
3
|
+
export interface VercelCliContext {
|
|
4
|
+
readonly processes: VercelCliProcessGateway;
|
|
5
|
+
readonly clock: VercelCliClock;
|
|
6
|
+
}
|
|
7
|
+
/** The live Context: real processes and the system clock. */
|
|
8
|
+
export declare function liveVercelCliContext(): VercelCliContext;
|
|
9
|
+
export { systemVercelCliClock, type VercelCliClock } from "./clock.ts";
|
|
10
|
+
export { createVercelCli } from "./driver.ts";
|
|
11
|
+
export type { AuthFileReadResult, AuthFileWriteResult, InvocationRequest, OutputStream, PrepareResult, ProcessExit, ProcessSignal, StartError, StartResult, VercelCliProcessGateway, VercelProcess, } from "./gateways.ts";
|
|
12
|
+
export { liveVercelCliProcessGateway } from "./live/process-gateway.ts";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// The Vercel CLI driver's gateway seams: its Context (the process gateway and clock, which travel together), the
|
|
2
|
+
// live Context, and `createVercelCli`, which takes a Context. Tests build the same shape over the fake and a clock
|
|
3
|
+
// driven by hand. Not part of `@cnc-tools/storm/vercel-cli`'s published surface.
|
|
4
|
+
import { systemVercelCliClock } from "./clock.js";
|
|
5
|
+
import { liveVercelCliProcessGateway } from "./live/process-gateway.js";
|
|
6
|
+
/** The live Context: real processes and the system clock. */
|
|
7
|
+
export function liveVercelCliContext() {
|
|
8
|
+
return { processes: liveVercelCliProcessGateway(), clock: systemVercelCliClock };
|
|
9
|
+
}
|
|
10
|
+
export { systemVercelCliClock } from "./clock.js";
|
|
11
|
+
export { createVercelCli } from "./driver.js";
|
|
12
|
+
export { liveVercelCliProcessGateway } from "./live/process-gateway.js";
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
import type { z } from "zod";
|
|
2
|
+
import type { ProxyRequestRecord } from "../sdk/index.ts";
|
|
3
|
+
import { type VercelAuth } from "./auth-config.ts";
|
|
4
|
+
import type { VercelCliContext } from "./context.ts";
|
|
5
|
+
import { type VercelInvocation, type VercelResult, type VercelStopSignal } from "./invocation.ts";
|
|
6
|
+
import { type VercelKey } from "./keys.ts";
|
|
7
|
+
/** How long an invocation may run before the driver kills it, unless the driver or the call says otherwise. */
|
|
8
|
+
export declare const VERCEL_TIMEOUT_MS = 45000;
|
|
9
|
+
export interface VercelCliOptions {
|
|
10
|
+
/**
|
|
11
|
+
* A directory the test created for itself, and removes after it. It is each invocation's `HOME`; the driver
|
|
12
|
+
* makes `<home>/global-config` and `<home>/work` in it.
|
|
13
|
+
*/
|
|
14
|
+
readonly home: string;
|
|
15
|
+
/**
|
|
16
|
+
* The test's proxy: invocations send to its `url`, and results hold the records added to `requests`. Its
|
|
17
|
+
* `redact`, when given, redacts everything the driver returns or prints after the driver's own tokens, so a token
|
|
18
|
+
* the proxy's container has seen reads `<token>` too. A `ContainerProxy` has one.
|
|
19
|
+
*/
|
|
20
|
+
readonly proxy: {
|
|
21
|
+
readonly url: string;
|
|
22
|
+
readonly requests: readonly ProxyRequestRecord[];
|
|
23
|
+
readonly redact?: (text: string) => string;
|
|
24
|
+
};
|
|
25
|
+
/** Aborting it kills every invocation still running, such as when vitest times the test out. */
|
|
26
|
+
readonly signal?: AbortSignal;
|
|
27
|
+
/** The `vercel` to run: `file`, found on `PATH` unless it's a path, with `args` before each call's. */
|
|
28
|
+
readonly command?: {
|
|
29
|
+
readonly file: string;
|
|
30
|
+
readonly args?: readonly string[];
|
|
31
|
+
};
|
|
32
|
+
/** How long an invocation may run before it's killed, unless the call says otherwise; default 45s. */
|
|
33
|
+
readonly timeoutMs?: number;
|
|
34
|
+
/**
|
|
35
|
+
* Where `PATH`, `SystemRoot` and `TEMP` come from; default `process.env`. Nothing else in it reaches `vercel`. A
|
|
36
|
+
* call's `env.PATH` replaces its `PATH` for that invocation.
|
|
37
|
+
*/
|
|
38
|
+
readonly hostEnv?: Readonly<Record<string, string | undefined>>;
|
|
39
|
+
/**
|
|
40
|
+
* Hears each invocation once it has ended, or failed to start, tokens redacted, such as to print it with
|
|
41
|
+
* `describeInvocation` as the test goes. What it throws is dropped. Without one, `vercelCli` prints each invocation
|
|
42
|
+
* with `describeInvocation` to stderr in a verbose run (its `--verbose`) and does nothing otherwise; a
|
|
43
|
+
* listener replaces that, so `() => {}` silences it.
|
|
44
|
+
*/
|
|
45
|
+
readonly onInvocationEnd?: (invocation: VercelInvocation) => void;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Who `vercel` acts as by default: a token and the team it runs in. A login from the SDK's `seed.login` is one, as
|
|
49
|
+
* is any `{ token, team }` with those fields.
|
|
50
|
+
*/
|
|
51
|
+
export interface VercelIdentity {
|
|
52
|
+
/** The token `--token` sends: a seeded token. */
|
|
53
|
+
readonly token: {
|
|
54
|
+
readonly secretString: string;
|
|
55
|
+
};
|
|
56
|
+
/** The team `--scope` names: a seeded team, or `null` for no default `--scope`, such as for a teamless user. */
|
|
57
|
+
readonly team: {
|
|
58
|
+
readonly slug: string;
|
|
59
|
+
} | null;
|
|
60
|
+
}
|
|
61
|
+
/** Who one invocation acts as, and where it runs: the options every call takes. */
|
|
62
|
+
export interface VercelCallOptions {
|
|
63
|
+
/**
|
|
64
|
+
* The token it runs as, in place of the default identity's: a seeded token, or a raw bearer secret. Under
|
|
65
|
+
* `auth: "saved"`, the token the driver saves; under `auth: "none"`, a usage error.
|
|
66
|
+
*/
|
|
67
|
+
readonly as?: {
|
|
68
|
+
readonly secretString: string;
|
|
69
|
+
} | string;
|
|
70
|
+
/**
|
|
71
|
+
* How it authenticates, in place of the default `actAs` set, else `"flag"`:
|
|
72
|
+
*
|
|
73
|
+
* - `"flag"`: `--token <secret>`, with the token `as` or the default identity names.
|
|
74
|
+
* - `"saved"`: no `--token`. The driver first saves that token as `token` in `<globalConfigDir>/auth.json`,
|
|
75
|
+
* keeping the file's other keys, so `vercel` reads it as it reads a `vercel login`.
|
|
76
|
+
* - `"none"`: no `--token`, and the driver removes `token`, `refreshToken` and `expiresAt` from `auth.json`, keeping
|
|
77
|
+
* its other keys: a logged-out `vercel`. It needs no default identity.
|
|
78
|
+
*
|
|
79
|
+
* The driver writes `auth.json` only when it differs from what the call needs in those keys. Under `"saved"` and
|
|
80
|
+
* `"none"`, only the call's own `scope` sends `--scope`: `vercel` picks the team as after a login, the saved
|
|
81
|
+
* `currentTeam` or else the user's default team. Starting a call whose `auth.json` differs from what an invocation
|
|
82
|
+
* still running needs (another token, or none) is a usage error.
|
|
83
|
+
*/
|
|
84
|
+
readonly auth?: VercelAuth;
|
|
85
|
+
/**
|
|
86
|
+
* The team it runs in, as `--scope`, in place of the default identity's: a seeded team, or its slug. `null`
|
|
87
|
+
* sends no `--scope`.
|
|
88
|
+
*/
|
|
89
|
+
readonly scope?: {
|
|
90
|
+
readonly slug: string;
|
|
91
|
+
} | string | null;
|
|
92
|
+
/** Where it runs; default `<home>/work`. */
|
|
93
|
+
readonly cwd?: string;
|
|
94
|
+
/**
|
|
95
|
+
* Variables added to its environment. `PATH` replaces the one from `hostEnv`; setting any other variable the
|
|
96
|
+
* driver sets (`HOME`, `SystemRoot`, `TEMP`, `FORCE_TTY`, `CI`, `CLI_WIDTH`, `COLUMNS`, `NO_COLOR`,
|
|
97
|
+
* `NO_UPDATE_NOTIFIER`, `VERCEL_TELEMETRY_DISABLED`, `VERCEL_TEST_KEYRING_UNAVAILABLE`), or `VERCEL_TOKEN`, which
|
|
98
|
+
* would undo `auth`, is a usage error. A bare `command.file`,
|
|
99
|
+
* such as the default `vercel`, is looked up on this `PATH`, so a `PATH` without `vercel` needs an absolute
|
|
100
|
+
* `command`.
|
|
101
|
+
*/
|
|
102
|
+
readonly env?: Readonly<Record<string, string>>;
|
|
103
|
+
/** How long it may run before it's killed; default the driver's `timeoutMs`. */
|
|
104
|
+
readonly timeoutMs?: number;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* A stdin piped to `vercel` without a terminal, as a script pipes one: `{ text }`, written as it starts, then
|
|
108
|
+
* closed, as `echo value | vercel env add NAME production` does, or `"open"`, a pipe that stays silent and open.
|
|
109
|
+
*/
|
|
110
|
+
export type VercelStdin = {
|
|
111
|
+
readonly text: string;
|
|
112
|
+
} | "open";
|
|
113
|
+
/** A `run`'s options: a call's, whether `vercel` runs at a terminal, and a piped stdin. */
|
|
114
|
+
export interface VercelRunOptions extends VercelCallOptions {
|
|
115
|
+
/**
|
|
116
|
+
* Whether `vercel` runs at a terminal, as a person runs it: stdin, stdout and stderr piped, `FORCE_TTY=1` and no
|
|
117
|
+
* `CI`, so it prompts, charge prompts included, and an `interact` block can answer with `press` and `type`. With
|
|
118
|
+
* `run`, stdin closes at once, so a prompt reads the end of its input. Default `false`: stdin ignored, no
|
|
119
|
+
* `FORCE_TTY` and `CI=1`, as a script or CI runs it, so it takes its non-interactive paths.
|
|
120
|
+
*/
|
|
121
|
+
readonly terminal?: boolean;
|
|
122
|
+
/**
|
|
123
|
+
* The terminal's width, a positive integer, as `CLI_WIDTH` and `COLUMNS`; default `TERMINAL_COLUMNS` (400), so a
|
|
124
|
+
* long prompt stays on one line for `waitFor`: `vercel`'s prompts wrap at the width they read, 80 without one. Only
|
|
125
|
+
* with `terminal: true`; otherwise it is a `TypeError`, as a script has no width.
|
|
126
|
+
*/
|
|
127
|
+
readonly columns?: number;
|
|
128
|
+
/**
|
|
129
|
+
* A stdin piped to `vercel` without a terminal: still `CI=1` and no `FORCE_TTY`, so `process.stdin.isTTY` isn't
|
|
130
|
+
* true. `{ text }` writes `text` as soon as `vercel` starts, then closes stdin, so a command reading it gets the
|
|
131
|
+
* text and the end of its input. `"open"` pipes stdin and never writes or closes it, not even once an `interact`
|
|
132
|
+
* block returns: it closes only when `vercel` ends, is killed or stopped, so a command that reads stdin to its end
|
|
133
|
+
* waits until its timeout. Default: stdin ignored. With `terminal: true` it is a `TypeError`: a terminal already
|
|
134
|
+
* pipes stdin, and a test answers its prompts with `type` and `press`.
|
|
135
|
+
*/
|
|
136
|
+
readonly stdin?: VercelStdin;
|
|
137
|
+
}
|
|
138
|
+
/** An invocation a test acts on while it runs, inside a `vercel.interact` block. */
|
|
139
|
+
export interface InteractiveInvocation {
|
|
140
|
+
/**
|
|
141
|
+
* Waits for `pattern` in stdout and stderr together, in arrival order, with ANSI codes removed, searching after
|
|
142
|
+
* the previous match, and resolves with the matched text. Rejects with a `VercelCliError` after `timeoutMs`
|
|
143
|
+
* (default 10s) or once `vercel` has ended without a match.
|
|
144
|
+
*/
|
|
145
|
+
waitFor(pattern: string | RegExp, options?: {
|
|
146
|
+
readonly timeoutMs?: number;
|
|
147
|
+
}): Promise<string>;
|
|
148
|
+
/**
|
|
149
|
+
* Sends `signal` (default SIGINT) to `vercel` itself, not its process group; attempts SIGKILL if completion
|
|
150
|
+
* (including output drain) is still pending `STOP_GRACE_MS` (10s) later; and resolves with its result, as `run` does,
|
|
151
|
+
* with `stopped: true`. Once `vercel` has ended, or is being killed after its timeout, an abort or `close()`, it
|
|
152
|
+
* sends nothing and resolves with that ending. Calling it again returns the same promise.
|
|
153
|
+
*/
|
|
154
|
+
stop(signal?: VercelStopSignal): Promise<VercelResult>;
|
|
155
|
+
}
|
|
156
|
+
/** An interactive invocation at a terminal (`terminal: true`), whose prompts a test answers. */
|
|
157
|
+
export interface TerminalInvocation extends InteractiveInvocation {
|
|
158
|
+
/** Sends a key. Throws a `VercelCliError` once `vercel` has ended, was stopped, or its stdin is closed. */
|
|
159
|
+
press(key: VercelKey): void;
|
|
160
|
+
/** Sends `text` as given. Throws a `VercelCliError` once `vercel` has ended, was stopped, or its stdin is closed. */
|
|
161
|
+
type(text: string): void;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* What an `interact` block does with the running invocation: waits for its output, answers its prompts at a
|
|
165
|
+
* terminal, and stops a command that runs until stopped.
|
|
166
|
+
*/
|
|
167
|
+
export type InteractBlock<I extends InteractiveInvocation> = (invocation: I) => Promise<unknown> | void;
|
|
168
|
+
/** The production `vercel` CLI, pointed at one test's proxy, in that test's directories. */
|
|
169
|
+
export interface VercelCli {
|
|
170
|
+
/** The test's directory, each invocation's `HOME`. */
|
|
171
|
+
readonly home: string;
|
|
172
|
+
/** `<home>/global-config`, every invocation's `--global-config`. */
|
|
173
|
+
readonly globalConfigDir: string;
|
|
174
|
+
/** `<home>/work`, where an invocation runs unless the call names a `cwd`. */
|
|
175
|
+
readonly workDir: string;
|
|
176
|
+
/**
|
|
177
|
+
* Sets who `vercel` acts as by default: `token.secretString` for `--token` and `team.slug` for `--scope` (none for
|
|
178
|
+
* `team: null`), and `auth`, how a call authenticates unless it says otherwise (default `"flag"`). Calling it again
|
|
179
|
+
* replaces the default, `auth` included. The token reads `<token>` in everything the driver returns or prints from now on. A
|
|
180
|
+
* call's `as`, `scope` or `auth` overrides it; the default scope steps aside when a call's arguments name
|
|
181
|
+
* `--scope`, `-S` or `--team`, and under `"saved"` and `"none"`.
|
|
182
|
+
*/
|
|
183
|
+
actAs(identity: VercelIdentity, options?: {
|
|
184
|
+
readonly auth?: VercelAuth;
|
|
185
|
+
}): void;
|
|
186
|
+
/**
|
|
187
|
+
* Runs `vercel` with `args`, and resolves however it ends: its `stdout` and `stderr` with ANSI codes removed, as
|
|
188
|
+
* `waitFor` removes them, and `rawStdout` and `rawStderr` as they arrived. At a terminal, stdin closes at once:
|
|
189
|
+
* nobody types. Rejects with a `VercelCliError` only when it can't start, and with a `TypeError` for arguments or
|
|
190
|
+
* options the driver refuses, or when there is no token to act as.
|
|
191
|
+
*/
|
|
192
|
+
run(args: readonly string[], options?: VercelRunOptions): Promise<VercelResult>;
|
|
193
|
+
/**
|
|
194
|
+
* Runs `vercel` with `args` and hands the running invocation to `block`, which waits for its output, answers its
|
|
195
|
+
* prompts at a terminal (`terminal: true`), or stops it. Once `block` returns, closes stdin at a terminal (an open
|
|
196
|
+
* `stdin` stays open), waits for `vercel` to end, and resolves with its result, as `run` does: a command that runs until stopped, such as
|
|
197
|
+
* `vercel dev`, needs `stop()` in the block, or it runs until its timeout. When `block` throws, kills `vercel` if it
|
|
198
|
+
* still runs (it ends `abandoned`) and rejects with what `block` threw. Rejects as `run` does otherwise.
|
|
199
|
+
*/
|
|
200
|
+
interact(args: readonly string[], block: InteractBlock<InteractiveInvocation>): Promise<VercelResult>;
|
|
201
|
+
interact(args: readonly string[], options: VercelRunOptions & {
|
|
202
|
+
readonly terminal: true;
|
|
203
|
+
}, block: InteractBlock<TerminalInvocation>): Promise<VercelResult>;
|
|
204
|
+
interact(args: readonly string[], options: VercelRunOptions, block: InteractBlock<InteractiveInvocation>): Promise<VercelResult>;
|
|
205
|
+
/**
|
|
206
|
+
* Runs `vercel` with `args` and `--format json`, and returns its stripped stdout parsed by `schema`. Throws a
|
|
207
|
+
* `VercelCliError` when it can't start or doesn't exit 0, or prints something other than JSON `schema` accepts.
|
|
208
|
+
*/
|
|
209
|
+
json<S extends z.ZodType>(args: readonly string[], schema: S, options?: VercelCallOptions): Promise<z.output<S>>;
|
|
210
|
+
/** Every invocation so far, in order, as the report shows it. */
|
|
211
|
+
readonly invocations: readonly VercelInvocation[];
|
|
212
|
+
/** Kills every invocation still running, and resolves once each has ended. */
|
|
213
|
+
close(): Promise<void>;
|
|
214
|
+
/** What a failed test prints about `vercel`: every invocation so far. */
|
|
215
|
+
failureReport(): string;
|
|
216
|
+
}
|
|
217
|
+
/** A `VercelCli` over `context`. It prepares `<home>/global-config` and `<home>/work` first. */
|
|
218
|
+
export declare function createVercelCli(options: VercelCliOptions, context: VercelCliContext): Promise<VercelCli>;
|