@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,122 @@
|
|
|
1
|
+
// Every pattern and parse of `vercel` output lives here, so a change in the CLI's wording is a one-file fix.
|
|
2
|
+
// The patterns come from vercel-internal's `packages/cli/scripts/testserver/vercel-cli.mjs` and the
|
|
3
|
+
// `vercel` CLI's source. `PROJECT_NOT_FOUND`'s "There is no project for" and `SCOPE_NOT_FOUND` match output
|
|
4
|
+
// captured from `vercel` 63.1.2, which printed both on stderr, with empty stdout, under `--format=json` and
|
|
5
|
+
// without it; the other patterns are still inferred from source.
|
|
6
|
+
import { VERCEL_TIMEOUT_SECONDS } from "./vercel-process.js";
|
|
7
|
+
/**
|
|
8
|
+
* `vercel` is older than 53.3.0, the first with `project token --format=json`: 50.25.0 to 53.2.x reject the
|
|
9
|
+
* flag, and older ones have no `project token`.
|
|
10
|
+
*/
|
|
11
|
+
export const OUTDATED = /unknown or unexpected option: --format|Please specify a valid subcommand/;
|
|
12
|
+
/** `vercel` couldn't reach the Vercel API. */
|
|
13
|
+
export const UNREACHABLE = /internet connectivity|could not be resolved|\b(?:ENOTFOUND|EAI_AGAIN|ECONNREFUSED|ECONNRESET|ETIMEDOUT|ENETUNREACH)\b|fetch failed|socket hang up/i;
|
|
14
|
+
/** The team has no project by that name: the CLI's project lookup, or a 404 from the token endpoint. */
|
|
15
|
+
export const PROJECT_NOT_FOUND = /There is no project for|No such project exists/;
|
|
16
|
+
/**
|
|
17
|
+
* The `--scope` matches no team the account belongs to. The CLI prints this for a misspelled team and for a
|
|
18
|
+
* team the account isn't in alike, and for a lapsed login too, so it sends the mint to `vercel whoami`.
|
|
19
|
+
*/
|
|
20
|
+
export const SCOPE_NOT_FOUND = "The specified scope does not exist";
|
|
21
|
+
/**
|
|
22
|
+
* The account can't reach the team: the CLI reports a lapsed login this way, as well as missing access, so
|
|
23
|
+
* it sends the mint to `vercel whoami`.
|
|
24
|
+
*/
|
|
25
|
+
export const ACCOUNT_ACCESS = "You do not have access to the specified account";
|
|
26
|
+
const ERROR_LINE = /^(?:> )?Error: (.*)$/m;
|
|
27
|
+
/** The `token` field of `vercel project token --format=json` output, when it is a non-empty string. */
|
|
28
|
+
export function parseToken(stdout) {
|
|
29
|
+
const parsed = parseJsonObject(stdout);
|
|
30
|
+
const token = parsed?.["token"];
|
|
31
|
+
return typeof token === "string" && token !== "" ? token : undefined;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* What `vercel` said went wrong: the `message` of a JSON error on stdout (with its `reason`), else the
|
|
35
|
+
* stderr `Error:` line, else the last stderr line. Never raw stdout, which may hold a token.
|
|
36
|
+
*/
|
|
37
|
+
export function errorText(run) {
|
|
38
|
+
const parsed = parseJsonObject(run.stdout);
|
|
39
|
+
const message = parsed?.["message"];
|
|
40
|
+
if (typeof message === "string") {
|
|
41
|
+
const reason = parsed?.["reason"];
|
|
42
|
+
return typeof reason === "string" && reason !== "" ? `${message} (${reason})` : message;
|
|
43
|
+
}
|
|
44
|
+
const errorLine = ERROR_LINE.exec(run.stderr)?.[1]?.trim();
|
|
45
|
+
if (errorLine !== undefined && errorLine !== "")
|
|
46
|
+
return errorLine;
|
|
47
|
+
return lastLine(run.stderr) ?? "";
|
|
48
|
+
}
|
|
49
|
+
/** The account `vercel whoami` names: the last non-empty line of its stdout. */
|
|
50
|
+
export function whoamiUser(stdout) {
|
|
51
|
+
return lastLine(stdout);
|
|
52
|
+
}
|
|
53
|
+
const MINT_STEP = { command: "project token" };
|
|
54
|
+
/**
|
|
55
|
+
* Classifies a `vercel project token` run, in order: a token, `vercel` missing, a timeout, an unreachable
|
|
56
|
+
* network, an outdated CLI, an unknown project, and an access failure (an unknown scope, or no access to
|
|
57
|
+
* the account), which needs `vercel whoami` to tell a lapsed login from missing team access. The project
|
|
58
|
+
* check comes before the access check because resolving the project means the login worked. Anything else,
|
|
59
|
+
* including a successful run that printed no token, is `unrecognized`: storm claims no cause for it.
|
|
60
|
+
*/
|
|
61
|
+
export function classifyMint(run) {
|
|
62
|
+
if (run.ok) {
|
|
63
|
+
const token = parseToken(run.stdout);
|
|
64
|
+
if (token !== undefined)
|
|
65
|
+
return { kind: "token", token };
|
|
66
|
+
}
|
|
67
|
+
else if (run.reason === "not-found") {
|
|
68
|
+
return { kind: "failure", failure: { kind: "vercel-not-found" } };
|
|
69
|
+
}
|
|
70
|
+
else if (run.reason === "timeout") {
|
|
71
|
+
return { kind: "failure", failure: { kind: "timeout", step: MINT_STEP, seconds: VERCEL_TIMEOUT_SECONDS } };
|
|
72
|
+
}
|
|
73
|
+
const said = errorText(run) || "`vercel project token` printed no token";
|
|
74
|
+
const output = `${run.stdout}\n${run.stderr}`;
|
|
75
|
+
if (UNREACHABLE.test(output))
|
|
76
|
+
return { kind: "failure", failure: { kind: "unreachable", step: MINT_STEP, said } };
|
|
77
|
+
if (OUTDATED.test(output))
|
|
78
|
+
return { kind: "failure", failure: { kind: "outdated-cli", said } };
|
|
79
|
+
if (PROJECT_NOT_FOUND.test(output))
|
|
80
|
+
return { kind: "failure", failure: { kind: "project-not-found", said } };
|
|
81
|
+
if (output.includes(SCOPE_NOT_FOUND) || output.includes(ACCOUNT_ACCESS))
|
|
82
|
+
return { kind: "needs-whoami", said };
|
|
83
|
+
return { kind: "failure", failure: { kind: "unrecognized", said } };
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Classifies the `vercel whoami` run that follows a mint's access failure; `mintSaid` is what the mint
|
|
87
|
+
* said. A working `whoami` means the account lacks access to the team. A `whoami` that `vercel` itself
|
|
88
|
+
* refuses means the saved login is missing, expired or invalid. A `whoami` that times out or can't reach
|
|
89
|
+
* Vercel is a network failure of the `whoami` step, never a lapsed login, and one that can't run is
|
|
90
|
+
* `vercel-not-found`.
|
|
91
|
+
*/
|
|
92
|
+
export function classifyWhoami(run, mintSaid) {
|
|
93
|
+
if (run.ok)
|
|
94
|
+
return { kind: "no-team-access", said: mintSaid, user: whoamiUser(run.stdout) };
|
|
95
|
+
const step = { command: "whoami", mintSaid };
|
|
96
|
+
if (run.reason === "not-found")
|
|
97
|
+
return { kind: "vercel-not-found" };
|
|
98
|
+
if (run.reason === "timeout")
|
|
99
|
+
return { kind: "timeout", step, seconds: VERCEL_TIMEOUT_SECONDS };
|
|
100
|
+
const whoamiSaid = errorText(run) || "it failed without an error message";
|
|
101
|
+
if (UNREACHABLE.test(`${run.stdout}\n${run.stderr}`))
|
|
102
|
+
return { kind: "unreachable", step, said: whoamiSaid };
|
|
103
|
+
return { kind: "login-lapsed", said: mintSaid, whoamiSaid };
|
|
104
|
+
}
|
|
105
|
+
function parseJsonObject(text) {
|
|
106
|
+
try {
|
|
107
|
+
const parsed = JSON.parse(text);
|
|
108
|
+
return typeof parsed === "object" && parsed !== null && !Array.isArray(parsed)
|
|
109
|
+
? parsed
|
|
110
|
+
: undefined;
|
|
111
|
+
}
|
|
112
|
+
catch {
|
|
113
|
+
return undefined;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
function lastLine(text) {
|
|
117
|
+
return text
|
|
118
|
+
.split("\n")
|
|
119
|
+
.map((line) => line.trim())
|
|
120
|
+
.filter((line) => line !== "")
|
|
121
|
+
.at(-1);
|
|
122
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** How long one `vercel` invocation may run before it is killed. */
|
|
2
|
+
export declare const VERCEL_TIMEOUT_MS = 30000;
|
|
3
|
+
export declare const VERCEL_TIMEOUT_SECONDS: number;
|
|
4
|
+
/** How a `vercel` invocation ended. `reason` says why a failed one failed. */
|
|
5
|
+
export type VercelRun = {
|
|
6
|
+
readonly ok: true;
|
|
7
|
+
readonly stdout: string;
|
|
8
|
+
readonly stderr: string;
|
|
9
|
+
} | {
|
|
10
|
+
readonly ok: false;
|
|
11
|
+
readonly reason: "not-found" | "timeout" | "exit";
|
|
12
|
+
readonly stdout: string;
|
|
13
|
+
readonly stderr: string;
|
|
14
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { type Refusable } from "@vercel/clinkr";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import type { MintTarget } from "./gateways.ts";
|
|
4
|
+
import type { CredentialSourceChoice } from "./source.ts";
|
|
5
|
+
/** The errors settling a credential source refuses a command with. */
|
|
6
|
+
export declare const credentialErrors: import("@vercel/clinkr").SharedErrors<{
|
|
7
|
+
missingTarget: z.ZodObject<{
|
|
8
|
+
missing: z.ZodArray<z.ZodEnum<{
|
|
9
|
+
project: "project";
|
|
10
|
+
scope: "scope";
|
|
11
|
+
}>>;
|
|
12
|
+
}, z.core.$strip>;
|
|
13
|
+
}>;
|
|
14
|
+
type MissingTarget = ReturnType<typeof credentialErrors.missingTarget>;
|
|
15
|
+
/** A setting a command resolved, from a flag or the config file; only its value matters here. */
|
|
16
|
+
interface GivenSetting {
|
|
17
|
+
readonly value: string;
|
|
18
|
+
}
|
|
19
|
+
/** The control plane team and project to mint for, refusing with `missing_target` when either is unset. */
|
|
20
|
+
export declare function requireTarget(scope: GivenSetting | undefined, project: GivenSetting | undefined): Refusable<{
|
|
21
|
+
readonly target: MintTarget;
|
|
22
|
+
}, MissingTarget>;
|
|
23
|
+
/**
|
|
24
|
+
* The credential source `--credential` names: the mint needs the control plane team and project, refusing with
|
|
25
|
+
* `missing_target` when either is unset; a GitHub Actions OIDC token request needs neither, and leaves any given
|
|
26
|
+
* unused.
|
|
27
|
+
*/
|
|
28
|
+
export declare function settleCredential(source: CredentialSourceChoice["source"], scope: GivenSetting | undefined, project: GivenSetting | undefined): Refusable<{
|
|
29
|
+
readonly credential: CredentialSourceChoice;
|
|
30
|
+
}, MissingTarget>;
|
|
31
|
+
export {};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
// How a command settles the credential source `--credential` names, before it gets a credential: the mint needs the
|
|
2
|
+
// control plane team and project, and refuses with `missing_target` without either; a GitHub Actions OIDC token request
|
|
3
|
+
// needs neither.
|
|
4
|
+
import { defineErrors, refused } from "@vercel/clinkr";
|
|
5
|
+
import { z } from "zod";
|
|
6
|
+
/** The errors settling a credential source refuses a command with. */
|
|
7
|
+
export const credentialErrors = defineErrors({
|
|
8
|
+
missingTarget: {
|
|
9
|
+
exitCode: 2,
|
|
10
|
+
description: "The command may mint a credential, and neither a flag nor storm.config.ts names the control plane team or project.",
|
|
11
|
+
schema: z.object({
|
|
12
|
+
/** The settings no flag or config file gave. */
|
|
13
|
+
missing: z.array(z.enum(["scope", "project"])),
|
|
14
|
+
}),
|
|
15
|
+
render: ({ missing }) => ({
|
|
16
|
+
message: `No control plane ${missing.map((key) => (key === "scope" ? "team" : "project")).join(" or ")} to mint a credential for.`,
|
|
17
|
+
next: [
|
|
18
|
+
{
|
|
19
|
+
type: "text",
|
|
20
|
+
text: `Give ${missing.map((key) => `--${key}`).join(" and ")}, or set ${missing.join(" and ")} in storm.config.ts.`,
|
|
21
|
+
},
|
|
22
|
+
],
|
|
23
|
+
}),
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
/** The control plane team and project to mint for, refusing with `missing_target` when either is unset. */
|
|
27
|
+
export function requireTarget(scope, project) {
|
|
28
|
+
if (scope === undefined || project === undefined)
|
|
29
|
+
return refused(credentialErrors.missingTarget({
|
|
30
|
+
missing: [
|
|
31
|
+
...(scope === undefined ? ["scope"] : []),
|
|
32
|
+
...(project === undefined ? ["project"] : []),
|
|
33
|
+
],
|
|
34
|
+
}));
|
|
35
|
+
return { ok: true, target: { team: scope.value, project: project.value } };
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* The credential source `--credential` names: the mint needs the control plane team and project, refusing with
|
|
39
|
+
* `missing_target` when either is unset; a GitHub Actions OIDC token request needs neither, and leaves any given
|
|
40
|
+
* unused.
|
|
41
|
+
*/
|
|
42
|
+
export function settleCredential(source, scope, project) {
|
|
43
|
+
if (source === "github-actions")
|
|
44
|
+
return { ok: true, credential: { source } };
|
|
45
|
+
const required = requireTarget(scope, project);
|
|
46
|
+
if (!required.ok)
|
|
47
|
+
return required;
|
|
48
|
+
return { ok: true, credential: { source, target: required.target } };
|
|
49
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import type { Credential, GitHubActionsClaims } from "./credential.ts";
|
|
2
|
+
import type { CredentialGateway, GitHubActionsTokenGateway, MintFailure, MintOutcome, MintTarget, TokenAttemptFailure, TokenRequestVariable } from "./gateways.ts";
|
|
3
|
+
/**
|
|
4
|
+
* Which credential source a run or `pool create` gets its credential from, picked with `--credential`: the mint, for
|
|
5
|
+
* `target`, or a GitHub Actions OIDC token request.
|
|
6
|
+
*/
|
|
7
|
+
export type CredentialSourceChoice = {
|
|
8
|
+
readonly source: "mint";
|
|
9
|
+
readonly target: MintTarget;
|
|
10
|
+
} | {
|
|
11
|
+
readonly source: "github-actions";
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Why a GitHub Actions OIDC token request failed, once its retries are spent: `variables-missing`, or
|
|
15
|
+
* `request-failed` with the last attempt's failure and how many attempts were made.
|
|
16
|
+
*/
|
|
17
|
+
export type TokenRequestFailure = {
|
|
18
|
+
readonly kind: "variables-missing";
|
|
19
|
+
readonly missing: readonly TokenRequestVariable[];
|
|
20
|
+
} | {
|
|
21
|
+
readonly kind: "request-failed";
|
|
22
|
+
readonly attempts: number;
|
|
23
|
+
readonly last: Exclude<TokenAttemptFailure, {
|
|
24
|
+
readonly kind: "variables-missing";
|
|
25
|
+
}>;
|
|
26
|
+
};
|
|
27
|
+
/** Why a credential source couldn't give a credential, tagged by the source. */
|
|
28
|
+
export type CredentialFailure = {
|
|
29
|
+
readonly source: "mint";
|
|
30
|
+
readonly failure: MintFailure;
|
|
31
|
+
readonly target: MintTarget;
|
|
32
|
+
} | {
|
|
33
|
+
readonly source: "github-actions";
|
|
34
|
+
readonly failure: TokenRequestFailure;
|
|
35
|
+
};
|
|
36
|
+
export type CredentialOutcome = {
|
|
37
|
+
readonly ok: true;
|
|
38
|
+
readonly credential: Credential;
|
|
39
|
+
} | {
|
|
40
|
+
readonly ok: false;
|
|
41
|
+
readonly failure: CredentialFailure;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Where a credential the Testserver control plane rejected came from: the mint, for `target`, or a GitHub Actions
|
|
45
|
+
* OIDC token, with the claims Trusted Sources match on (`undefined` when they can't be read).
|
|
46
|
+
*/
|
|
47
|
+
export type CredentialOrigin = {
|
|
48
|
+
readonly source: "mint";
|
|
49
|
+
readonly target: MintTarget;
|
|
50
|
+
} | {
|
|
51
|
+
readonly source: "github-actions";
|
|
52
|
+
readonly claims: GitHubActionsClaims | undefined;
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* Where a run gets its credential. A caller asks with `get()` right before each request that needs one, and the
|
|
56
|
+
* source decides whether to mint or request anew or hand back the one it holds.
|
|
57
|
+
*/
|
|
58
|
+
export interface CredentialSource {
|
|
59
|
+
/** A credential to use now, getting one first if the source holds none it would hand out. */
|
|
60
|
+
get(): Promise<CredentialOutcome>;
|
|
61
|
+
/** Where a credential this source gave came from. */
|
|
62
|
+
origin(credential: Credential): CredentialOrigin;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* The mint as a credential source: it mints at most once. The first `get()` calls `mint`; every later call,
|
|
66
|
+
* concurrent ones included, returns the same outcome. A failed mint is kept like a successful one and never retried
|
|
67
|
+
* within the run. A minted credential lasts 12 hours, longer than any run.
|
|
68
|
+
*
|
|
69
|
+
* `mint` must not reject (`CredentialGateway.mint` never does). If it does anyway, `get()` still never throws: it
|
|
70
|
+
* returns the rejected promise, and keeps returning it.
|
|
71
|
+
*/
|
|
72
|
+
export declare function mintSource(target: MintTarget, mint: () => Promise<MintOutcome>): CredentialSource;
|
|
73
|
+
/** A clock as a credential source reads it; structural so this module needs no other module's time seams. */
|
|
74
|
+
interface SourceClock {
|
|
75
|
+
now(): Date;
|
|
76
|
+
}
|
|
77
|
+
/** A timer as a credential source waits on it; structural so this module needs no other module's time seams. */
|
|
78
|
+
interface SourceTimer {
|
|
79
|
+
sleep(ms: number, signal?: AbortSignal): Promise<void>;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* The credential source `choice` names, over `context`'s gateways: the mint calls `report.onMint` before it mints,
|
|
83
|
+
* and a GitHub Actions OIDC token request calls `report.onRequest` before each request.
|
|
84
|
+
*/
|
|
85
|
+
export declare function credentialSourceFor(choice: CredentialSourceChoice, context: {
|
|
86
|
+
readonly credentials: CredentialGateway;
|
|
87
|
+
readonly githubActionsTokens: GitHubActionsTokenGateway;
|
|
88
|
+
readonly clock: SourceClock;
|
|
89
|
+
readonly timer: SourceTimer;
|
|
90
|
+
}, report: {
|
|
91
|
+
readonly onMint: (target: MintTarget) => Promise<void>;
|
|
92
|
+
readonly onRequest: () => Promise<void>;
|
|
93
|
+
}): CredentialSource;
|
|
94
|
+
/**
|
|
95
|
+
* A GitHub Actions OIDC token request as a credential source. The first `get()` requests a token; later ones hand
|
|
96
|
+
* back the same token while it is under 4 minutes old, counting from when its request was sent, and request a new
|
|
97
|
+
* one after. Concurrent `get()` calls share one request in flight. `onRequest` is called before each request,
|
|
98
|
+
* refreshes included, not before each retry.
|
|
99
|
+
*
|
|
100
|
+
* One request makes up to 3 attempts, retrying only a network failure, a timeout or HTTP 502, 503 or 504, after
|
|
101
|
+
* waiting 1s, then 2s, on `timer`. A failure isn't kept: the next `get()` requests again. A failed refresh is a
|
|
102
|
+
* failure even while the token held is under 5 minutes old.
|
|
103
|
+
*/
|
|
104
|
+
export declare function githubActionsSource(context: {
|
|
105
|
+
readonly gateway: GitHubActionsTokenGateway;
|
|
106
|
+
readonly clock: SourceClock;
|
|
107
|
+
readonly timer: SourceTimer;
|
|
108
|
+
readonly onRequest?: () => Promise<void>;
|
|
109
|
+
}): CredentialSource;
|
|
110
|
+
export {};
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The mint as a credential source: it mints at most once. The first `get()` calls `mint`; every later call,
|
|
3
|
+
* concurrent ones included, returns the same outcome. A failed mint is kept like a successful one and never retried
|
|
4
|
+
* within the run. A minted credential lasts 12 hours, longer than any run.
|
|
5
|
+
*
|
|
6
|
+
* `mint` must not reject (`CredentialGateway.mint` never does). If it does anyway, `get()` still never throws: it
|
|
7
|
+
* returns the rejected promise, and keeps returning it.
|
|
8
|
+
*/
|
|
9
|
+
export function mintSource(target, mint) {
|
|
10
|
+
let outcome;
|
|
11
|
+
return {
|
|
12
|
+
get() {
|
|
13
|
+
// The async wrapper turns a synchronous throw from `mint` into a rejection.
|
|
14
|
+
outcome ??= (async () => {
|
|
15
|
+
const minted = await mint();
|
|
16
|
+
return minted.ok ? minted : { ok: false, failure: { source: "mint", failure: minted.failure, target } };
|
|
17
|
+
})();
|
|
18
|
+
return outcome;
|
|
19
|
+
},
|
|
20
|
+
origin() {
|
|
21
|
+
return { source: "mint", target };
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* The credential source `choice` names, over `context`'s gateways: the mint calls `report.onMint` before it mints,
|
|
27
|
+
* and a GitHub Actions OIDC token request calls `report.onRequest` before each request.
|
|
28
|
+
*/
|
|
29
|
+
export function credentialSourceFor(choice, context, report) {
|
|
30
|
+
if (choice.source === "github-actions")
|
|
31
|
+
return githubActionsSource({
|
|
32
|
+
gateway: context.githubActionsTokens,
|
|
33
|
+
clock: context.clock,
|
|
34
|
+
timer: context.timer,
|
|
35
|
+
onRequest: report.onRequest,
|
|
36
|
+
});
|
|
37
|
+
const { target } = choice;
|
|
38
|
+
return mintSource(target, async () => {
|
|
39
|
+
await report.onMint(target);
|
|
40
|
+
return await context.credentials.mint(target);
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
/** How long a GitHub Actions OIDC token is handed out after its request was sent: it expires after 5 minutes. */
|
|
44
|
+
const TOKEN_REFRESH_MS = 4 * 60_000;
|
|
45
|
+
/** The waits before each retry of a token request: one request makes one attempt more than there are waits. */
|
|
46
|
+
const RETRY_WAITS_MS = [1_000, 2_000];
|
|
47
|
+
/**
|
|
48
|
+
* A GitHub Actions OIDC token request as a credential source. The first `get()` requests a token; later ones hand
|
|
49
|
+
* back the same token while it is under 4 minutes old, counting from when its request was sent, and request a new
|
|
50
|
+
* one after. Concurrent `get()` calls share one request in flight. `onRequest` is called before each request,
|
|
51
|
+
* refreshes included, not before each retry.
|
|
52
|
+
*
|
|
53
|
+
* One request makes up to 3 attempts, retrying only a network failure, a timeout or HTTP 502, 503 or 504, after
|
|
54
|
+
* waiting 1s, then 2s, on `timer`. A failure isn't kept: the next `get()` requests again. A failed refresh is a
|
|
55
|
+
* failure even while the token held is under 5 minutes old.
|
|
56
|
+
*/
|
|
57
|
+
export function githubActionsSource(context) {
|
|
58
|
+
let held;
|
|
59
|
+
let inFlight;
|
|
60
|
+
const request = async () => {
|
|
61
|
+
await context.onRequest?.();
|
|
62
|
+
for (let attempt = 1;; attempt += 1) {
|
|
63
|
+
const sentAt = context.clock.now().getTime();
|
|
64
|
+
const outcome = await context.gateway.request();
|
|
65
|
+
if (outcome.ok) {
|
|
66
|
+
held = { credential: outcome.credential, sentAt };
|
|
67
|
+
return outcome;
|
|
68
|
+
}
|
|
69
|
+
const { failure } = outcome;
|
|
70
|
+
if (failure.kind === "variables-missing")
|
|
71
|
+
return { ok: false, failure: { source: "github-actions", failure } };
|
|
72
|
+
const wait = RETRY_WAITS_MS[attempt - 1];
|
|
73
|
+
if (wait === undefined || !isRetryable(failure))
|
|
74
|
+
return {
|
|
75
|
+
ok: false,
|
|
76
|
+
failure: { source: "github-actions", failure: { kind: "request-failed", attempts: attempt, last: failure } },
|
|
77
|
+
};
|
|
78
|
+
await context.timer.sleep(wait);
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
return {
|
|
82
|
+
get() {
|
|
83
|
+
if (held !== undefined && context.clock.now().getTime() - held.sentAt < TOKEN_REFRESH_MS)
|
|
84
|
+
return Promise.resolve({ ok: true, credential: held.credential });
|
|
85
|
+
if (inFlight === undefined) {
|
|
86
|
+
held = undefined;
|
|
87
|
+
inFlight = (async () => {
|
|
88
|
+
try {
|
|
89
|
+
return await request();
|
|
90
|
+
}
|
|
91
|
+
finally {
|
|
92
|
+
inFlight = undefined;
|
|
93
|
+
}
|
|
94
|
+
})();
|
|
95
|
+
}
|
|
96
|
+
return inFlight;
|
|
97
|
+
},
|
|
98
|
+
origin(credential) {
|
|
99
|
+
return { source: "github-actions", claims: credential.githubActionsClaims() };
|
|
100
|
+
},
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
/** Whether a failed attempt is worth another: no answer, or a gateway status that says try again. */
|
|
104
|
+
function isRetryable(failure) {
|
|
105
|
+
switch (failure.kind) {
|
|
106
|
+
case "unreachable":
|
|
107
|
+
case "timeout":
|
|
108
|
+
return true;
|
|
109
|
+
case "http-error":
|
|
110
|
+
return failure.status === 502 || failure.status === 503 || failure.status === 504;
|
|
111
|
+
case "bad-response":
|
|
112
|
+
return false;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Terminal } from "@vercel/clinkr";
|
|
2
|
+
/** The logo's width in columns: its widest line, the one with the wordmark. */
|
|
3
|
+
export declare const HELP_LOGO_WIDTH: number;
|
|
4
|
+
/**
|
|
5
|
+
* The help logo for `terminal`, or `undefined` in accessible mode, where glyphs give way to words, or when stdout is
|
|
6
|
+
* narrower than `HELP_LOGO_WIDTH`. A terminal of unknown size reports 0 columns, which counts as unknown, as it does
|
|
7
|
+
* for Clinkr's help width. Its lines are joined with newlines, without a trailing one.
|
|
8
|
+
*/
|
|
9
|
+
export declare function stormHelpLogo(terminal: Terminal, options: {
|
|
10
|
+
readonly accessible: boolean;
|
|
11
|
+
}): string | undefined;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
// storm's help logo, which Clinkr prints above root help for a person at an interactive terminal: a storm cloud
|
|
2
|
+
// (the tool) with the wordmark, eight lightning bolts (parallel runs), and two rows of eight Testserver sandboxes
|
|
3
|
+
// with their results (the pool). It is drawn in 16-color codes when stdout takes color, in ASCII when the locale
|
|
4
|
+
// doesn't render Unicode, and omitted in accessible mode and on a terminal narrower than it.
|
|
5
|
+
const CLOUD_TOP = [" .-~~~~~-. .-~~~~-.", " .-~( )~-..-~( )~-."];
|
|
6
|
+
const CLOUD_WORDMARK = { indent: " ", left: "( ", wordmark: "storm", right: " )" };
|
|
7
|
+
const CLOUD_BOTTOM = " `~-.._______________________..-~'";
|
|
8
|
+
const BOLTS = 8;
|
|
9
|
+
/** Each row of sandboxes, its failed cell by index; every other cell passed. */
|
|
10
|
+
const SANDBOX_ROWS = [3, 5];
|
|
11
|
+
/** The logo's width in columns: its widest line, the one with the wordmark. */
|
|
12
|
+
export const HELP_LOGO_WIDTH = CLOUD_WORDMARK.indent.length +
|
|
13
|
+
CLOUD_WORDMARK.left.length +
|
|
14
|
+
CLOUD_WORDMARK.wordmark.length +
|
|
15
|
+
CLOUD_WORDMARK.right.length;
|
|
16
|
+
const code = (open, close) => (text) => text === "" ? text : `\u001b[${open}m${text}\u001b[${close}m`;
|
|
17
|
+
const COLOR = {
|
|
18
|
+
cloud: code("90", "39"),
|
|
19
|
+
wordmark: code("1;36", "22;39"),
|
|
20
|
+
bolt: code("1;93", "22;39"),
|
|
21
|
+
passed: code("32", "39"),
|
|
22
|
+
failed: code("31", "39"),
|
|
23
|
+
bracket: code("90", "39"),
|
|
24
|
+
};
|
|
25
|
+
const NO_COLOR = Object.fromEntries(Object.keys(COLOR).map((role) => [role, (text) => text]));
|
|
26
|
+
const UNICODE = { bolt: "ϟ", passed: "✓", failed: "✗" };
|
|
27
|
+
const ASCII = { bolt: "/", passed: "+", failed: "x" };
|
|
28
|
+
/**
|
|
29
|
+
* The help logo for `terminal`, or `undefined` in accessible mode, where glyphs give way to words, or when stdout is
|
|
30
|
+
* narrower than `HELP_LOGO_WIDTH`. A terminal of unknown size reports 0 columns, which counts as unknown, as it does
|
|
31
|
+
* for Clinkr's help width. Its lines are joined with newlines, without a trailing one.
|
|
32
|
+
*/
|
|
33
|
+
export function stormHelpLogo(terminal, options) {
|
|
34
|
+
if (options.accessible)
|
|
35
|
+
return undefined;
|
|
36
|
+
const { columns } = terminal.stdout;
|
|
37
|
+
if (columns !== undefined && columns > 0 && columns < HELP_LOGO_WIDTH)
|
|
38
|
+
return undefined;
|
|
39
|
+
const paint = terminal.stdout.color === "none" ? NO_COLOR : COLOR;
|
|
40
|
+
const glyph = terminal.unicode ? UNICODE : ASCII;
|
|
41
|
+
// The indent stays outside the color codes.
|
|
42
|
+
const cloudLine = (line) => {
|
|
43
|
+
const text = line.trimStart();
|
|
44
|
+
return `${line.slice(0, line.length - text.length)}${paint.cloud(text)}`;
|
|
45
|
+
};
|
|
46
|
+
const lines = [
|
|
47
|
+
...CLOUD_TOP.map(cloudLine),
|
|
48
|
+
`${CLOUD_WORDMARK.indent}${paint.cloud(CLOUD_WORDMARK.left)}${paint.wordmark(CLOUD_WORDMARK.wordmark)}${paint.cloud(CLOUD_WORDMARK.right)}`,
|
|
49
|
+
cloudLine(CLOUD_BOTTOM),
|
|
50
|
+
` ${paint.bolt(Array.from({ length: BOLTS }, () => glyph.bolt).join(" "))}`,
|
|
51
|
+
...SANDBOX_ROWS.map((failed) => ` ${Array.from({ length: BOLTS }, (_, index) => index === failed ? paint.failed(glyph.failed) : paint.passed(glyph.passed))
|
|
52
|
+
.map((result) => `${paint.bracket("[")}${result}${paint.bracket("]")}`)
|
|
53
|
+
.join(" ")}`),
|
|
54
|
+
];
|
|
55
|
+
return lines.join("\n");
|
|
56
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { NodeHost } from "@vercel/clinkr/node";
|
|
2
|
+
/**
|
|
3
|
+
* How a run's progress shows on stderr.
|
|
4
|
+
*
|
|
5
|
+
* - `live`: a live view redrawn in place, on a terminal a person watches: stderr is a terminal, `TERM` isn't
|
|
6
|
+
* `dumb`, neither CI nor a coding agent is detected, and `VERCEL_ACCESSIBLE` isn't `1`.
|
|
7
|
+
* - `plain`: one plain line at a time, never redrawn; `github` when it runs in GitHub Actions
|
|
8
|
+
* (`GITHUB_ACTIONS=true`), which folds each step's output.
|
|
9
|
+
*
|
|
10
|
+
* `color` is whether stderr shows color: `NO_COLOR` turns it off, else `FORCE_COLOR` decides, else whether stderr is
|
|
11
|
+
* a terminal whose `TERM` isn't `dumb`. `columns` is stderr's width when it reports one.
|
|
12
|
+
*/
|
|
13
|
+
export type Presentation = {
|
|
14
|
+
readonly kind: "live";
|
|
15
|
+
readonly color: boolean;
|
|
16
|
+
readonly columns: number | undefined;
|
|
17
|
+
} | {
|
|
18
|
+
readonly kind: "plain";
|
|
19
|
+
readonly github: boolean;
|
|
20
|
+
readonly color: boolean;
|
|
21
|
+
readonly columns: number | undefined;
|
|
22
|
+
};
|
|
23
|
+
/** The presentation of a non-interactive run: plain, without color, outside GitHub Actions. */
|
|
24
|
+
export declare const PLAIN_PRESENTATION: Presentation;
|
|
25
|
+
/** Resolves the presentation from what the Node host found. */
|
|
26
|
+
export declare function resolvePresentation(host: Pick<NodeHost, "env" | "ci" | "agent" | "stderr">): Presentation;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// How storm presents a run's progress on stderr, resolved once from the host, so no command checks a terminal,
|
|
2
|
+
// CI or an agent itself.
|
|
3
|
+
/** The presentation of a non-interactive run: plain, without color, outside GitHub Actions. */
|
|
4
|
+
export const PLAIN_PRESENTATION = { kind: "plain", github: false, color: false, columns: undefined };
|
|
5
|
+
/** Resolves the presentation from what the Node host found. */
|
|
6
|
+
export function resolvePresentation(host) {
|
|
7
|
+
const { env, stderr } = host;
|
|
8
|
+
const color = resolveColor(env, stderr.rich);
|
|
9
|
+
const columns = stderr.columns;
|
|
10
|
+
if (stderr.rich && !host.ci && host.agent === undefined && env["VERCEL_ACCESSIBLE"] !== "1")
|
|
11
|
+
return { kind: "live", color, columns };
|
|
12
|
+
return { kind: "plain", github: env["GITHUB_ACTIONS"] === "true", color, columns };
|
|
13
|
+
}
|
|
14
|
+
function resolveColor(env, rich) {
|
|
15
|
+
if (env["NO_COLOR"] !== undefined)
|
|
16
|
+
return false;
|
|
17
|
+
const forced = env["FORCE_COLOR"];
|
|
18
|
+
if (forced !== undefined && forced !== "")
|
|
19
|
+
return forced !== "0" && forced !== "false";
|
|
20
|
+
return rich;
|
|
21
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { ResourceCleanupReport } from "../../core/index.ts";
|
|
3
|
+
import type { FixtureRepoCleanup } from "./fixture-repo.ts";
|
|
4
|
+
/**
|
|
5
|
+
* What deleting the branches under a run's prefix in its GitHub fixture repository did: the branches deleted, and
|
|
6
|
+
* each it couldn't delete, or, with `branch` null, the listing it couldn't read.
|
|
7
|
+
*/
|
|
8
|
+
declare const schema: z.ZodObject<{
|
|
9
|
+
repo: z.ZodString;
|
|
10
|
+
runPrefix: z.ZodString;
|
|
11
|
+
deleted: z.ZodArray<z.ZodString>;
|
|
12
|
+
failures: z.ZodArray<z.ZodObject<{
|
|
13
|
+
branch: z.ZodNullable<z.ZodString>;
|
|
14
|
+
message: z.ZodString;
|
|
15
|
+
}, z.core.$strip>>;
|
|
16
|
+
}, z.core.$strip>;
|
|
17
|
+
/** What outcomes report of the GitHub fixture repository's cleanup. */
|
|
18
|
+
export type FixtureRepoCleanupFacts = z.infer<typeof schema>;
|
|
19
|
+
/** A branch the cleanup couldn't delete, or the listing it couldn't read, as a sentence. */
|
|
20
|
+
export declare function fixtureRepoCleanupFailureText(cleanup: Pick<FixtureRepoCleanupFacts, "repo" | "runPrefix">, failure: FixtureRepoCleanupFacts["failures"][number]): string;
|
|
21
|
+
/** The GitHub fixture repository's cleanup report: present once the run held the repository. */
|
|
22
|
+
export declare const githubFixtureRepoCleanupReport: ResourceCleanupReport<FixtureRepoCleanup, FixtureRepoCleanupFacts>;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// The GitHub fixture repository resource's cleanup as outcomes report it, under `cleanup.resources.githubFixtureRepo`:
|
|
2
|
+
// the branches the run deleted under its run prefix and each it couldn't, so a `--json` caller sees what was left
|
|
3
|
+
// behind.
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
/**
|
|
6
|
+
* What deleting the branches under a run's prefix in its GitHub fixture repository did: the branches deleted, and
|
|
7
|
+
* each it couldn't delete, or, with `branch` null, the listing it couldn't read.
|
|
8
|
+
*/
|
|
9
|
+
const schema = z.object({
|
|
10
|
+
repo: z.string(),
|
|
11
|
+
runPrefix: z.string(),
|
|
12
|
+
deleted: z.array(z.string()),
|
|
13
|
+
failures: z.array(z.object({ branch: z.string().nullable(), message: z.string() })),
|
|
14
|
+
});
|
|
15
|
+
/** A branch the cleanup couldn't delete, or the listing it couldn't read, as a sentence. */
|
|
16
|
+
export function fixtureRepoCleanupFailureText(cleanup, failure) {
|
|
17
|
+
return failure.branch === null
|
|
18
|
+
? `Couldn't list the branches under ${cleanup.runPrefix}/ in ${cleanup.repo}: ${failure.message}. Any there are left behind.`
|
|
19
|
+
: `Couldn't delete branch ${failure.branch} in ${cleanup.repo}: ${failure.message}. It is left behind.`;
|
|
20
|
+
}
|
|
21
|
+
/** The GitHub fixture repository's cleanup report: present once the run held the repository. */
|
|
22
|
+
export const githubFixtureRepoCleanupReport = {
|
|
23
|
+
schema,
|
|
24
|
+
facts: ({ repo, runPrefix, deleted, failures }) => ({
|
|
25
|
+
repo,
|
|
26
|
+
runPrefix,
|
|
27
|
+
deleted: [...deleted],
|
|
28
|
+
failures: failures.map(({ branch, message }) => ({ branch, message })),
|
|
29
|
+
}),
|
|
30
|
+
rows: (cleanup) => cleanup.failures.length === 0
|
|
31
|
+
? []
|
|
32
|
+
: [["Branches left behind", cleanup.failures.map((failure) => fixtureRepoCleanupFailureText(cleanup, failure))]],
|
|
33
|
+
warnings: (cleanup) => cleanup.failures.map((failure) => ({
|
|
34
|
+
reason: failure.branch === null ? "github_branches_not_listed" : "github_branch_not_deleted",
|
|
35
|
+
message: fixtureRepoCleanupFailureText(cleanup, failure),
|
|
36
|
+
})),
|
|
37
|
+
// A failed list counts as one, since it can't say how many branches it left.
|
|
38
|
+
failuresText: (failures) => `${failures} GitHub fixture repository cleanup ${failures === 1 ? "failure" : "failures"}`,
|
|
39
|
+
};
|