@cnc-tools/storm 0.0.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/node-version.js +24 -0
- package/bin/storm.js +16 -0
- package/dist/application.d.ts +13 -0
- package/dist/application.js +23 -0
- package/dist/bin/storm.d.ts +1 -0
- package/dist/bin/storm.js +45 -0
- package/dist/build-info.js +3 -0
- package/dist/closed-terminal.d.ts +7 -0
- package/dist/closed-terminal.js +18 -0
- package/dist/combine-errors.d.ts +11 -0
- package/dist/combine-errors.js +19 -0
- package/dist/commands/dashboard.d.ts +11 -0
- package/dist/commands/dashboard.js +18 -0
- package/dist/commands/run/cleanup.d.ts +135 -0
- package/dist/commands/run/cleanup.js +171 -0
- package/dist/commands/run/command.d.ts +327 -0
- package/dist/commands/run/command.js +620 -0
- package/dist/commands/run/job-summary.d.ts +6 -0
- package/dist/commands/run/job-summary.js +31 -0
- package/dist/commands/run/live-view.d.ts +22 -0
- package/dist/commands/run/live-view.js +395 -0
- package/dist/commands/run/metadata.d.ts +47 -0
- package/dist/commands/run/metadata.js +83 -0
- package/dist/commands/run/mint-failed.d.ts +11 -0
- package/dist/commands/run/mint-failed.js +33 -0
- package/dist/commands/run/outcomes.d.ts +307 -0
- package/dist/commands/run/outcomes.js +332 -0
- package/dist/commands/run/progress.d.ts +44 -0
- package/dist/commands/run/progress.js +277 -0
- package/dist/commands/run/redaction.d.ts +15 -0
- package/dist/commands/run/redaction.js +40 -0
- package/dist/commands/run/run-collector.d.ts +30 -0
- package/dist/commands/run/run-collector.js +73 -0
- package/dist/commands/run/run-record.d.ts +144 -0
- package/dist/commands/run/run-record.js +96 -0
- package/dist/commands/run/tests-summary.d.ts +34 -0
- package/dist/commands/run/tests-summary.js +141 -0
- package/dist/commands/run/text.d.ts +22 -0
- package/dist/commands/run/text.js +74 -0
- package/dist/commands/run/view.d.ts +35 -0
- package/dist/commands/run/view.js +163 -0
- package/dist/commands/run/waterfall.d.ts +25 -0
- package/dist/commands/run/waterfall.js +108 -0
- package/dist/commands/run/worker-chart.d.ts +79 -0
- package/dist/commands/run/worker-chart.js +313 -0
- package/dist/commands/runs/facts.d.ts +150 -0
- package/dist/commands/runs/facts.js +292 -0
- package/dist/commands/runs/list/command.d.ts +86 -0
- package/dist/commands/runs/list/command.js +36 -0
- package/dist/commands/runs/list/metadata.d.ts +22 -0
- package/dist/commands/runs/list/metadata.js +19 -0
- package/dist/commands/runs/list/outcomes.d.ts +74 -0
- package/dist/commands/runs/list/outcomes.js +89 -0
- package/dist/commands/runs/logs/command.d.ts +72 -0
- package/dist/commands/runs/logs/command.js +51 -0
- package/dist/commands/runs/logs/metadata.d.ts +22 -0
- package/dist/commands/runs/logs/metadata.js +22 -0
- package/dist/commands/runs/logs/outcomes.d.ts +55 -0
- package/dist/commands/runs/logs/outcomes.js +77 -0
- package/dist/commands/runs/metadata.d.ts +3 -0
- package/dist/commands/runs/metadata.js +3 -0
- package/dist/commands/runs/past-run.d.ts +72 -0
- package/dist/commands/runs/past-run.js +99 -0
- package/dist/commands/runs/show/command.d.ts +176 -0
- package/dist/commands/runs/show/command.js +76 -0
- package/dist/commands/runs/show/metadata.d.ts +25 -0
- package/dist/commands/runs/show/metadata.js +22 -0
- package/dist/commands/runs/show/outcomes.d.ts +164 -0
- package/dist/commands/runs/show/outcomes.js +317 -0
- package/dist/config/by-name.d.ts +24 -0
- package/dist/config/by-name.js +26 -0
- package/dist/config/errors.d.ts +58 -0
- package/dist/config/errors.js +101 -0
- package/dist/config/gateways.d.ts +32 -0
- package/dist/config/gateways.js +1 -0
- package/dist/config/index.d.ts +9 -0
- package/dist/config/index.js +12 -0
- package/dist/config/live/config-gateway.d.ts +6 -0
- package/dist/config/live/config-gateway.js +71 -0
- package/dist/config/load.d.ts +54 -0
- package/dist/config/load.js +175 -0
- package/dist/config/resolve.d.ts +49 -0
- package/dist/config/resolve.js +94 -0
- package/dist/config/resource-config.d.ts +132 -0
- package/dist/config/resource-config.js +19 -0
- package/dist/config/schema.d.ts +64 -0
- package/dist/config/schema.js +57 -0
- package/dist/config/set.d.ts +16 -0
- package/dist/config/set.js +55 -0
- package/dist/config/settings-file.d.ts +41 -0
- package/dist/config/settings-file.js +72 -0
- package/dist/config-file/define.d.ts +37 -0
- package/dist/config-file/define.js +9 -0
- package/dist/config-file/toolchain.d.ts +9 -0
- package/dist/config-file/toolchain.js +41 -0
- package/dist/context.d.ts +86 -0
- package/dist/context.js +43 -0
- package/dist/core/command-provider.d.ts +126 -0
- package/dist/core/command-provider.js +13 -0
- package/dist/core/command-slots.d.ts +67 -0
- package/dist/core/command-slots.js +136 -0
- package/dist/core/events.d.ts +128 -0
- package/dist/core/events.js +15 -0
- package/dist/core/gateways.d.ts +249 -0
- package/dist/core/gateways.js +1 -0
- package/dist/core/index.d.ts +20 -0
- package/dist/core/index.js +18 -0
- package/dist/core/keyed.d.ts +12 -0
- package/dist/core/keyed.js +24 -0
- package/dist/core/lane.d.ts +46 -0
- package/dist/core/lane.js +5 -0
- package/dist/core/limit.d.ts +9 -0
- package/dist/core/limit.js +29 -0
- package/dist/core/live/command-gateway.d.ts +11 -0
- package/dist/core/live/command-gateway.js +83 -0
- package/dist/core/live/job-summary-gateway.d.ts +5 -0
- package/dist/core/live/job-summary-gateway.js +20 -0
- package/dist/core/live/progress-terminal.d.ts +20 -0
- package/dist/core/live/progress-terminal.js +173 -0
- package/dist/core/live/run-directory-gateway.d.ts +24 -0
- package/dist/core/live/run-directory-gateway.js +437 -0
- package/dist/core/mint.d.ts +10 -0
- package/dist/core/mint.js +14 -0
- package/dist/core/payload.d.ts +26 -0
- package/dist/core/payload.js +33 -0
- package/dist/core/presentation.d.ts +87 -0
- package/dist/core/presentation.js +5 -0
- package/dist/core/presentations.d.ts +56 -0
- package/dist/core/presentations.js +66 -0
- package/dist/core/provider.d.ts +69 -0
- package/dist/core/provider.js +5 -0
- package/dist/core/resource.d.ts +262 -0
- package/dist/core/resource.js +6 -0
- package/dist/core/resources.d.ts +131 -0
- package/dist/core/resources.js +254 -0
- package/dist/core/run-directory.d.ts +69 -0
- package/dist/core/run-directory.js +94 -0
- package/dist/core/run-state.d.ts +152 -0
- package/dist/core/run-state.js +313 -0
- package/dist/core/run.d.ts +187 -0
- package/dist/core/run.js +321 -0
- package/dist/core/state-directory.d.ts +19 -0
- package/dist/core/state-directory.js +29 -0
- package/dist/core/timeline.d.ts +63 -0
- package/dist/core/timeline.js +97 -0
- package/dist/core/timing.d.ts +22 -0
- package/dist/core/timing.js +26 -0
- package/dist/credential/credential.d.ts +46 -0
- package/dist/credential/credential.js +80 -0
- package/dist/credential/diagnosis.d.ts +18 -0
- package/dist/credential/diagnosis.js +99 -0
- package/dist/credential/gateways.d.ts +109 -0
- package/dist/credential/gateways.js +1 -0
- package/dist/credential/index.d.ts +7 -0
- package/dist/credential/index.js +7 -0
- package/dist/credential/live/github-actions-token-gateway.d.ts +15 -0
- package/dist/credential/live/github-actions-token-gateway.js +43 -0
- package/dist/credential/live/github-actions-token-response.d.ts +19 -0
- package/dist/credential/live/github-actions-token-response.js +49 -0
- package/dist/credential/live/vercel-cli-gateway.d.ts +9 -0
- package/dist/credential/live/vercel-cli-gateway.js +64 -0
- package/dist/credential/live/vercel-output.d.ts +60 -0
- package/dist/credential/live/vercel-output.js +122 -0
- package/dist/credential/live/vercel-process.d.ts +14 -0
- package/dist/credential/live/vercel-process.js +3 -0
- package/dist/credential/settle.d.ts +31 -0
- package/dist/credential/settle.js +49 -0
- package/dist/credential/source.d.ts +110 -0
- package/dist/credential/source.js +114 -0
- package/dist/help-logo.d.ts +11 -0
- package/dist/help-logo.js +56 -0
- package/dist/presentation.d.ts +26 -0
- package/dist/presentation.js +21 -0
- package/dist/resources/github/cleanup.d.ts +23 -0
- package/dist/resources/github/cleanup.js +39 -0
- package/dist/resources/github/command.d.ts +74 -0
- package/dist/resources/github/command.js +117 -0
- package/dist/resources/github/config.d.ts +16 -0
- package/dist/resources/github/config.js +37 -0
- package/dist/resources/github/events.d.ts +26 -0
- package/dist/resources/github/events.js +2 -0
- package/dist/resources/github/fixture-repo.d.ts +69 -0
- package/dist/resources/github/fixture-repo.js +60 -0
- package/dist/resources/github/gateways.d.ts +62 -0
- package/dist/resources/github/gateways.js +1 -0
- package/dist/resources/github/index.d.ts +12 -0
- package/dist/resources/github/index.js +15 -0
- package/dist/resources/github/live/fixture-repo-gateway.d.ts +12 -0
- package/dist/resources/github/live/fixture-repo-gateway.js +92 -0
- package/dist/resources/github/live/gateways.d.ts +6 -0
- package/dist/resources/github/live/gateways.js +13 -0
- package/dist/resources/github/presentation.d.ts +13 -0
- package/dist/resources/github/presentation.js +43 -0
- package/dist/resources/github/provider.d.ts +66 -0
- package/dist/resources/github/provider.js +58 -0
- package/dist/resources/github/resource-provider.d.ts +6 -0
- package/dist/resources/github/resource-provider.js +20 -0
- package/dist/resources/github/resource.d.ts +33 -0
- package/dist/resources/github/resource.js +12 -0
- package/dist/resources/testserver/cleanup.d.ts +14 -0
- package/dist/resources/testserver/cleanup.js +22 -0
- package/dist/resources/testserver/command.d.ts +322 -0
- package/dist/resources/testserver/command.js +245 -0
- package/dist/resources/testserver/commands/app.d.ts +18 -0
- package/dist/resources/testserver/commands/app.js +3 -0
- package/dist/resources/testserver/commands/create/command.d.ts +136 -0
- package/dist/resources/testserver/commands/create/command.js +158 -0
- package/dist/resources/testserver/commands/create/metadata.d.ts +31 -0
- package/dist/resources/testserver/commands/create/metadata.js +45 -0
- package/dist/resources/testserver/commands/create/outcomes.d.ts +111 -0
- package/dist/resources/testserver/commands/create/outcomes.js +172 -0
- package/dist/resources/testserver/commands/list/command.d.ts +60 -0
- package/dist/resources/testserver/commands/list/command.js +56 -0
- package/dist/resources/testserver/commands/list/metadata.d.ts +9 -0
- package/dist/resources/testserver/commands/list/metadata.js +9 -0
- package/dist/resources/testserver/commands/list/outcomes.d.ts +54 -0
- package/dist/resources/testserver/commands/list/outcomes.js +152 -0
- package/dist/resources/testserver/config.d.ts +18 -0
- package/dist/resources/testserver/config.js +77 -0
- package/dist/resources/testserver/credential-facts.d.ts +80 -0
- package/dist/resources/testserver/credential-facts.js +83 -0
- package/dist/resources/testserver/events.d.ts +59 -0
- package/dist/resources/testserver/events.js +4 -0
- package/dist/resources/testserver/index.d.ts +16 -0
- package/dist/resources/testserver/index.js +24 -0
- package/dist/resources/testserver/lane.d.ts +28 -0
- package/dist/resources/testserver/lane.js +139 -0
- package/dist/resources/testserver/live/gateways.d.ts +6 -0
- package/dist/resources/testserver/live/gateways.js +26 -0
- package/dist/resources/testserver/options.d.ts +5 -0
- package/dist/resources/testserver/options.js +5 -0
- package/dist/resources/testserver/pool/channels.d.ts +80 -0
- package/dist/resources/testserver/pool/channels.js +48 -0
- package/dist/resources/testserver/pool/create.d.ts +48 -0
- package/dist/resources/testserver/pool/create.js +45 -0
- package/dist/resources/testserver/pool/directory.d.ts +4 -0
- package/dist/resources/testserver/pool/directory.js +5 -0
- package/dist/resources/testserver/pool/gateways.d.ts +190 -0
- package/dist/resources/testserver/pool/gateways.js +1 -0
- package/dist/resources/testserver/pool/host.d.ts +8 -0
- package/dist/resources/testserver/pool/host.js +21 -0
- package/dist/resources/testserver/pool/index.d.ts +9 -0
- package/dist/resources/testserver/pool/index.js +10 -0
- package/dist/resources/testserver/pool/inspect.d.ts +53 -0
- package/dist/resources/testserver/pool/inspect.js +45 -0
- package/dist/resources/testserver/pool/lease.d.ts +84 -0
- package/dist/resources/testserver/pool/lease.js +125 -0
- package/dist/resources/testserver/pool/live/pool-records.d.ts +17 -0
- package/dist/resources/testserver/pool/live/pool-records.js +70 -0
- package/dist/resources/testserver/pool/live/pool-store-gateway.d.ts +12 -0
- package/dist/resources/testserver/pool/live/pool-store-gateway.js +435 -0
- package/dist/resources/testserver/pool/staleness.d.ts +16 -0
- package/dist/resources/testserver/pool/staleness.js +27 -0
- package/dist/resources/testserver/presentation.d.ts +9 -0
- package/dist/resources/testserver/presentation.js +217 -0
- package/dist/resources/testserver/provider.d.ts +177 -0
- package/dist/resources/testserver/provider.js +254 -0
- package/dist/resources/testserver/ran.d.ts +87 -0
- package/dist/resources/testserver/ran.js +140 -0
- package/dist/resources/testserver/resource-provider.d.ts +12 -0
- package/dist/resources/testserver/resource-provider.js +38 -0
- package/dist/resources/testserver/resource.d.ts +32 -0
- package/dist/resources/testserver/resource.js +10 -0
- package/dist/resources/testserver/run-sandbox.d.ts +13 -0
- package/dist/resources/testserver/run-sandbox.js +6 -0
- package/dist/resources/testserver/sandbox/channels.d.ts +12 -0
- package/dist/resources/testserver/sandbox/channels.js +21 -0
- package/dist/resources/testserver/sandbox/create-failure.d.ts +35 -0
- package/dist/resources/testserver/sandbox/create-failure.js +65 -0
- package/dist/resources/testserver/sandbox/create.d.ts +29 -0
- package/dist/resources/testserver/sandbox/create.js +37 -0
- package/dist/resources/testserver/sandbox/gateways.d.ts +150 -0
- package/dist/resources/testserver/sandbox/gateways.js +1 -0
- package/dist/resources/testserver/sandbox/index.d.ts +6 -0
- package/dist/resources/testserver/sandbox/index.js +7 -0
- package/dist/resources/testserver/sandbox/live/builds-response.d.ts +9 -0
- package/dist/resources/testserver/sandbox/live/builds-response.js +27 -0
- package/dist/resources/testserver/sandbox/live/control-plane-gateway.d.ts +17 -0
- package/dist/resources/testserver/sandbox/live/control-plane-gateway.js +133 -0
- package/dist/resources/testserver/sandbox/live/create-response.d.ts +35 -0
- package/dist/resources/testserver/sandbox/live/create-response.js +78 -0
- package/dist/resources/testserver/sandbox/live/fetch-failure.d.ts +24 -0
- package/dist/resources/testserver/sandbox/live/fetch-failure.js +45 -0
- package/dist/resources/testserver/sandbox/live/health-check-gateway.d.ts +11 -0
- package/dist/resources/testserver/sandbox/live/health-check-gateway.js +36 -0
- package/dist/resources/testserver/sandbox/live/sse.d.ts +12 -0
- package/dist/resources/testserver/sandbox/live/sse.js +32 -0
- package/dist/resources.d.ts +452 -0
- package/dist/resources.js +88 -0
- package/dist/runner/base.d.ts +40 -0
- package/dist/runner/base.js +52 -0
- package/dist/runner/context.d.ts +13 -0
- package/dist/runner/context.js +9 -0
- package/dist/runner/events.d.ts +179 -0
- package/dist/runner/events.js +16 -0
- package/dist/runner/gateways.d.ts +351 -0
- package/dist/runner/gateways.js +3 -0
- package/dist/runner/index.d.ts +19 -0
- package/dist/runner/index.js +18 -0
- package/dist/runner/live/checkout-gateway.d.ts +3 -0
- package/dist/runner/live/checkout-gateway.js +206 -0
- package/dist/runner/live/git-output.d.ts +14 -0
- package/dist/runner/live/git-output.js +32 -0
- package/dist/runner/live/sandbox-errors.d.ts +7 -0
- package/dist/runner/live/sandbox-errors.js +21 -0
- package/dist/runner/live/sandbox-gateway.d.ts +7 -0
- package/dist/runner/live/sandbox-gateway.js +427 -0
- package/dist/runner/live/snapshot-cache-gateway.d.ts +12 -0
- package/dist/runner/live/snapshot-cache-gateway.js +104 -0
- package/dist/runner/live/snapshot-records.d.ts +11 -0
- package/dist/runner/live/snapshot-records.js +57 -0
- package/dist/runner/live/terminal.d.ts +16 -0
- package/dist/runner/live/terminal.js +37 -0
- package/dist/runner/live/user.d.ts +2 -0
- package/dist/runner/live/user.js +11 -0
- package/dist/runner/output.d.ts +23 -0
- package/dist/runner/output.js +58 -0
- package/dist/runner/prepare.d.ts +67 -0
- package/dist/runner/prepare.js +59 -0
- package/dist/runner/ready.d.ts +68 -0
- package/dist/runner/ready.js +159 -0
- package/dist/runner/recipe.d.ts +126 -0
- package/dist/runner/recipe.js +302 -0
- package/dist/runner/remote-command.d.ts +77 -0
- package/dist/runner/remote-command.js +127 -0
- package/dist/runner/scope.d.ts +58 -0
- package/dist/runner/scope.js +117 -0
- package/dist/runner/snapshot-build.d.ts +33 -0
- package/dist/runner/snapshot-build.js +112 -0
- package/dist/runner/snapshot-cache.d.ts +84 -0
- package/dist/runner/snapshot-cache.js +126 -0
- package/dist/runner/snapshot-key.d.ts +52 -0
- package/dist/runner/snapshot-key.js +91 -0
- package/dist/runner/steps.d.ts +41 -0
- package/dist/runner/steps.js +49 -0
- package/dist/sdk/container/api-request.d.ts +32 -0
- package/dist/sdk/container/api-request.js +46 -0
- package/dist/sdk/container/container.d.ts +144 -0
- package/dist/sdk/container/container.js +346 -0
- package/dist/sdk/container/feature-flags.d.ts +37 -0
- package/dist/sdk/container/feature-flags.js +118 -0
- package/dist/sdk/container/gateways.d.ts +108 -0
- package/dist/sdk/container/gateways.js +1 -0
- package/dist/sdk/container/index.d.ts +5 -0
- package/dist/sdk/container/index.js +5 -0
- package/dist/sdk/container/live/container-gateway.d.ts +17 -0
- package/dist/sdk/container/live/container-gateway.js +114 -0
- package/dist/sdk/factories/build.d.ts +66 -0
- package/dist/sdk/factories/build.js +98 -0
- package/dist/sdk/factories/definition.d.ts +28 -0
- package/dist/sdk/factories/definition.js +16 -0
- package/dist/sdk/factories/definitions.d.ts +166 -0
- package/dist/sdk/factories/definitions.js +235 -0
- package/dist/sdk/factories/gateways.d.ts +25 -0
- package/dist/sdk/factories/gateways.js +1 -0
- package/dist/sdk/factories/index.d.ts +5 -0
- package/dist/sdk/factories/index.js +5 -0
- package/dist/sdk/factories/live/factory-gateway.d.ts +10 -0
- package/dist/sdk/factories/live/factory-gateway.js +29 -0
- package/dist/sdk/index.d.ts +7 -0
- package/dist/sdk/index.js +15 -0
- package/dist/sdk/payload/index.d.ts +2 -0
- package/dist/sdk/payload/index.js +4 -0
- package/dist/sdk/payload/payload.d.ts +47 -0
- package/dist/sdk/payload/payload.js +74 -0
- package/dist/sdk/payload/test-events.d.ts +102 -0
- package/dist/sdk/payload/test-events.js +59 -0
- package/dist/sdk/proxy/exchange.d.ts +58 -0
- package/dist/sdk/proxy/exchange.js +173 -0
- package/dist/sdk/proxy/faulted-exchange.d.ts +10 -0
- package/dist/sdk/proxy/faulted-exchange.js +106 -0
- package/dist/sdk/proxy/faults.d.ts +133 -0
- package/dist/sdk/proxy/faults.js +147 -0
- package/dist/sdk/proxy/index.d.ts +3 -0
- package/dist/sdk/proxy/index.js +3 -0
- package/dist/sdk/proxy/proxy.d.ts +93 -0
- package/dist/sdk/proxy/proxy.js +99 -0
- package/dist/sdk/proxy/records.d.ts +56 -0
- package/dist/sdk/proxy/records.js +56 -0
- package/dist/sdk/records/body.d.ts +89 -0
- package/dist/sdk/records/body.js +236 -0
- package/dist/sdk/records/index.d.ts +2 -0
- package/dist/sdk/records/index.js +4 -0
- package/dist/sdk/records/records.d.ts +49 -0
- package/dist/sdk/records/records.js +16 -0
- package/dist/sdk/seed/index.d.ts +1 -0
- package/dist/sdk/seed/index.js +3 -0
- package/dist/sdk/seed/seed.d.ts +221 -0
- package/dist/sdk/seed/seed.js +171 -0
- package/dist/sdk/testserver/clock.d.ts +8 -0
- package/dist/sdk/testserver/clock.js +10 -0
- package/dist/sdk/testserver/failure.d.ts +73 -0
- package/dist/sdk/testserver/failure.js +61 -0
- package/dist/sdk/testserver/index.d.ts +5 -0
- package/dist/sdk/testserver/index.js +8 -0
- package/dist/sdk/testserver/live/connect-failure.d.ts +7 -0
- package/dist/sdk/testserver/live/connect-failure.js +30 -0
- package/dist/sdk/testserver/live/request.d.ts +69 -0
- package/dist/sdk/testserver/live/request.js +89 -0
- package/dist/sdk/testserver/service-ids.d.ts +19 -0
- package/dist/sdk/testserver/service-ids.js +77 -0
- package/dist/sdk/testserver/test-id.d.ts +15 -0
- package/dist/sdk/testserver/test-id.js +28 -0
- package/dist/story/align.d.ts +37 -0
- package/dist/story/align.js +39 -0
- package/dist/story/artifact.d.ts +60 -0
- package/dist/story/artifact.js +93 -0
- package/dist/story/definition.d.ts +52 -0
- package/dist/story/definition.js +9 -0
- package/dist/story/diff.d.ts +9 -0
- package/dist/story/diff.js +97 -0
- package/dist/story/errors.d.ts +14 -0
- package/dist/story/errors.js +21 -0
- package/dist/story/gateways.d.ts +74 -0
- package/dist/story/gateways.js +3 -0
- package/dist/story/host.d.ts +27 -0
- package/dist/story/host.js +97 -0
- package/dist/story/index.d.ts +7 -0
- package/dist/story/index.js +9 -0
- package/dist/story/json.d.ts +16 -0
- package/dist/story/json.js +59 -0
- package/dist/story/live/artifact-gateway.d.ts +2 -0
- package/dist/story/live/artifact-gateway.js +82 -0
- package/dist/story/mode.d.ts +17 -0
- package/dist/story/mode.js +21 -0
- package/dist/story/orphans.d.ts +17 -0
- package/dist/story/orphans.js +15 -0
- package/dist/story/report.d.ts +30 -0
- package/dist/story/report.js +118 -0
- package/dist/story/run.d.ts +49 -0
- package/dist/story/run.js +160 -0
- package/dist/story/sequence.d.ts +30 -0
- package/dist/story/sequence.js +74 -0
- package/dist/story/settle.d.ts +94 -0
- package/dist/story/settle.js +70 -0
- package/dist/time/duration.d.ts +19 -0
- package/dist/time/duration.js +37 -0
- package/dist/time/index.d.ts +2 -0
- package/dist/time/index.js +4 -0
- package/dist/time/time.d.ts +15 -0
- package/dist/time/time.js +23 -0
- package/dist/vercel-cli/ansi.d.ts +13 -0
- package/dist/vercel-cli/ansi.js +32 -0
- package/dist/vercel-cli/arguments.d.ts +25 -0
- package/dist/vercel-cli/arguments.js +78 -0
- package/dist/vercel-cli/auth-config.d.ts +43 -0
- package/dist/vercel-cli/auth-config.js +36 -0
- package/dist/vercel-cli/clock.d.ts +9 -0
- package/dist/vercel-cli/clock.js +10 -0
- package/dist/vercel-cli/config-files.d.ts +24 -0
- package/dist/vercel-cli/config-files.js +40 -0
- package/dist/vercel-cli/context.d.ts +12 -0
- package/dist/vercel-cli/context.js +12 -0
- package/dist/vercel-cli/driver.d.ts +218 -0
- package/dist/vercel-cli/driver.js +364 -0
- package/dist/vercel-cli/entry.d.ts +8 -0
- package/dist/vercel-cli/entry.js +13 -0
- package/dist/vercel-cli/environment.d.ts +33 -0
- package/dist/vercel-cli/environment.js +72 -0
- package/dist/vercel-cli/errors.d.ts +8 -0
- package/dist/vercel-cli/errors.js +8 -0
- package/dist/vercel-cli/gateways.d.ts +103 -0
- package/dist/vercel-cli/gateways.js +4 -0
- package/dist/vercel-cli/index.d.ts +10 -0
- package/dist/vercel-cli/index.js +15 -0
- package/dist/vercel-cli/invocation.d.ts +234 -0
- package/dist/vercel-cli/invocation.js +397 -0
- package/dist/vercel-cli/keys.d.ts +14 -0
- package/dist/vercel-cli/keys.js +12 -0
- package/dist/vercel-cli/live/config-files.d.ts +28 -0
- package/dist/vercel-cli/live/config-files.js +66 -0
- package/dist/vercel-cli/live/process-gateway.d.ts +14 -0
- package/dist/vercel-cli/live/process-gateway.js +178 -0
- package/dist/vercel-cli/redaction.d.ts +13 -0
- package/dist/vercel-cli/redaction.js +22 -0
- package/dist/vercel-cli/report.d.ts +22 -0
- package/dist/vercel-cli/report.js +110 -0
- package/dist/vercel-cli/verbose.d.ts +7 -0
- package/dist/vercel-cli/verbose.js +24 -0
- package/dist/version.d.ts +20 -0
- package/dist/version.js +57 -0
- package/dist/vitest/config.d.ts +51 -0
- package/dist/vitest/config.js +61 -0
- package/dist/vitest/container-scope.d.ts +108 -0
- package/dist/vitest/container-scope.js +234 -0
- package/dist/vitest/diagnostics.d.ts +146 -0
- package/dist/vitest/diagnostics.js +306 -0
- package/dist/vitest/fixtures.d.ts +64 -0
- package/dist/vitest/fixtures.js +172 -0
- package/dist/vitest/gateways.d.ts +47 -0
- package/dist/vitest/gateways.js +3 -0
- package/dist/vitest/index.d.ts +3 -0
- package/dist/vitest/index.js +9 -0
- package/dist/vitest/list-output.d.ts +3 -0
- package/dist/vitest/list-output.js +19 -0
- package/dist/vitest/live/list-gateway.d.ts +7 -0
- package/dist/vitest/live/list-gateway.js +60 -0
- package/dist/vitest/ownership.d.ts +29 -0
- package/dist/vitest/ownership.js +68 -0
- package/dist/vitest/plan.d.ts +33 -0
- package/dist/vitest/plan.js +73 -0
- package/dist/vitest/sandbox.d.ts +16 -0
- package/dist/vitest/sandbox.js +35 -0
- package/dist/vitest/test-events.d.ts +41 -0
- package/dist/vitest/test-events.js +92 -0
- package/dist/vitest/test-results.d.ts +84 -0
- package/dist/vitest/test-results.js +160 -0
- package/dist/vitest/types.d.ts +68 -0
- package/dist/vitest/types.js +4 -0
- package/package.json +119 -3
- package/skills/overview.md +32 -0
- package/skills/read-run-output.md +65 -0
- package/README.md +0 -3
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
declare const problemSchema: z.ZodObject<{
|
|
3
|
+
key: z.ZodNullable<z.ZodString>;
|
|
4
|
+
location: z.ZodNullable<z.ZodObject<{
|
|
5
|
+
line: z.ZodNumber;
|
|
6
|
+
column: z.ZodNullable<z.ZodNumber>;
|
|
7
|
+
}, z.core.$strip>>;
|
|
8
|
+
problem: z.ZodString;
|
|
9
|
+
}, z.core.$strip>;
|
|
10
|
+
type Problem = z.output<typeof problemSchema>;
|
|
11
|
+
/** One problem as a person reads it: `<file>: <key> <problem>.`, `<file>:<line>:<col> <problem>.` or `<file>: <problem>.` */
|
|
12
|
+
export declare function configProblemLine(file: string, { key, location, problem }: Problem): string;
|
|
13
|
+
declare const optionProblemSchema: z.ZodObject<{
|
|
14
|
+
key: z.ZodString;
|
|
15
|
+
problem: z.ZodString;
|
|
16
|
+
values: z.ZodArray<z.ZodObject<{
|
|
17
|
+
key: z.ZodString;
|
|
18
|
+
value: z.ZodString;
|
|
19
|
+
source: z.ZodEnum<{
|
|
20
|
+
default: "default";
|
|
21
|
+
file: "file";
|
|
22
|
+
flag: "flag";
|
|
23
|
+
}>;
|
|
24
|
+
}, z.core.$strip>>;
|
|
25
|
+
}, z.core.$strip>;
|
|
26
|
+
type OptionProblem = z.output<typeof optionProblemSchema>;
|
|
27
|
+
/** One resource option problem as a person reads it: `<key> <problem>: <where each value came from>.` */
|
|
28
|
+
export declare function optionProblemLine({ key, problem, values }: OptionProblem, configFile: string | null): string;
|
|
29
|
+
export declare const configErrors: import("@vercel/clinkr").SharedErrors<{
|
|
30
|
+
invalidConfig: z.ZodObject<{
|
|
31
|
+
file: z.ZodString;
|
|
32
|
+
problems: z.ZodArray<z.ZodObject<{
|
|
33
|
+
key: z.ZodNullable<z.ZodString>;
|
|
34
|
+
location: z.ZodNullable<z.ZodObject<{
|
|
35
|
+
line: z.ZodNumber;
|
|
36
|
+
column: z.ZodNullable<z.ZodNumber>;
|
|
37
|
+
}, z.core.$strip>>;
|
|
38
|
+
problem: z.ZodString;
|
|
39
|
+
}, z.core.$strip>>;
|
|
40
|
+
}, z.core.$strip>;
|
|
41
|
+
invalidResourceOptions: z.ZodObject<{
|
|
42
|
+
configFile: z.ZodNullable<z.ZodString>;
|
|
43
|
+
problems: z.ZodArray<z.ZodObject<{
|
|
44
|
+
key: z.ZodString;
|
|
45
|
+
problem: z.ZodString;
|
|
46
|
+
values: z.ZodArray<z.ZodObject<{
|
|
47
|
+
key: z.ZodString;
|
|
48
|
+
value: z.ZodString;
|
|
49
|
+
source: z.ZodEnum<{
|
|
50
|
+
default: "default";
|
|
51
|
+
file: "file";
|
|
52
|
+
flag: "flag";
|
|
53
|
+
}>;
|
|
54
|
+
}, z.core.$strip>>;
|
|
55
|
+
}, z.core.$strip>>;
|
|
56
|
+
}, z.core.$strip>;
|
|
57
|
+
}>;
|
|
58
|
+
export {};
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
// The errors the commands that read `storm.config.ts` share about it: a file they can't use, and a held resource's
|
|
2
|
+
// options that don't fit together once the file and the flags are merged. Both exit 2. A missing control plane team
|
|
3
|
+
// or project is the credential module's (`missing_target`).
|
|
4
|
+
import { defineErrors } from "@vercel/clinkr";
|
|
5
|
+
import { z } from "zod";
|
|
6
|
+
const problemSchema = z.object({
|
|
7
|
+
/** The key the problem is about; null when it is about the whole file. */
|
|
8
|
+
key: z.string().nullable(),
|
|
9
|
+
/** Where Node said the import failed; null otherwise. */
|
|
10
|
+
location: z.object({ line: z.number(), column: z.number().nullable() }).nullable(),
|
|
11
|
+
/** What is wrong, worded to follow the key, or the file name when there is no key. */
|
|
12
|
+
problem: z.string(),
|
|
13
|
+
});
|
|
14
|
+
/** One problem as a person reads it: `<file>: <key> <problem>.`, `<file>:<line>:<col> <problem>.` or `<file>: <problem>.` */
|
|
15
|
+
export function configProblemLine(file, { key, location, problem }) {
|
|
16
|
+
const sentence = `${problem.replace(/\.$/, "")}.`;
|
|
17
|
+
if (key !== null)
|
|
18
|
+
return `${file}: ${key} ${sentence}`;
|
|
19
|
+
if (location !== null)
|
|
20
|
+
return `${file}:${location.line}${location.column === null ? "" : `:${location.column}`} ${sentence}`;
|
|
21
|
+
return `${file}: ${sentence}`;
|
|
22
|
+
}
|
|
23
|
+
/** A value one resource option problem is about: its key path, its value as text, and where it came from. */
|
|
24
|
+
const optionValueSchema = z.object({
|
|
25
|
+
/** The option's key path, such as resources.testserverPool.ttl. */
|
|
26
|
+
key: z.string(),
|
|
27
|
+
/** Its value, as text. */
|
|
28
|
+
value: z.string(),
|
|
29
|
+
/** Where it came from: a flag (a --set, or the command's own flag for the option), the config file or the default. */
|
|
30
|
+
source: z.enum(["flag", "file", "default"]),
|
|
31
|
+
});
|
|
32
|
+
const optionProblemSchema = z.object({
|
|
33
|
+
/** The key path of the option the problem is about, such as resources.testserverPool.ttl. */
|
|
34
|
+
key: z.string(),
|
|
35
|
+
/** What is wrong, worded to follow the key path, as the resource's rule words it. */
|
|
36
|
+
problem: z.string(),
|
|
37
|
+
/** Each value the problem is about, with its source; empty for a required option nothing gave. */
|
|
38
|
+
values: z.array(optionValueSchema),
|
|
39
|
+
});
|
|
40
|
+
/** Where one value came from, for a person: `resources.x.y is 20m from the command line`. */
|
|
41
|
+
function optionValueText({ key, value, source }, configFile) {
|
|
42
|
+
switch (source) {
|
|
43
|
+
case "flag":
|
|
44
|
+
return `${key} is ${value} from the command line`;
|
|
45
|
+
case "file":
|
|
46
|
+
return `${key} is ${value} in ${configFile ?? "storm.config.ts"}`;
|
|
47
|
+
case "default":
|
|
48
|
+
return `${key} is ${value} by default`;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
/** One resource option problem as a person reads it: `<key> <problem>: <where each value came from>.` */
|
|
52
|
+
export function optionProblemLine({ key, problem, values }, configFile) {
|
|
53
|
+
const where = values.map((value) => optionValueText(value, configFile));
|
|
54
|
+
const sources = where.length === 0
|
|
55
|
+
? ""
|
|
56
|
+
: `: ${where.length === 1 ? where.join("") : `${where.slice(0, -1).join(", ")} and ${where.at(-1) ?? ""}`}`;
|
|
57
|
+
return `${key} ${problem.replace(/\.$/, "")}${sources}.`;
|
|
58
|
+
}
|
|
59
|
+
export const configErrors = defineErrors({
|
|
60
|
+
invalidConfig: {
|
|
61
|
+
exitCode: 2,
|
|
62
|
+
description: "storm.config.ts can't be used: it can't be imported, doesn't default-export an object, has an unknown key, or a value in it is invalid. storm checks the whole file whenever a command loads it.",
|
|
63
|
+
schema: z.object({
|
|
64
|
+
/** The config file's absolute path. */
|
|
65
|
+
file: z.string(),
|
|
66
|
+
problems: z.array(problemSchema),
|
|
67
|
+
}),
|
|
68
|
+
render: ({ file, problems }) => {
|
|
69
|
+
const [first, ...rest] = problems;
|
|
70
|
+
return {
|
|
71
|
+
message: first === undefined ? `${file} can't be used.` : configProblemLine(file, first),
|
|
72
|
+
...(rest.length === 0 ? {} : { rows: [["Also", rest.map((problem) => configProblemLine(file, problem))]] }),
|
|
73
|
+
next: [{ type: "text", text: `Fix ${file}, then retry.` }],
|
|
74
|
+
};
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
invalidResourceOptions: {
|
|
78
|
+
exitCode: 2,
|
|
79
|
+
description: "A resource's options, once its defaults, storm.config.ts and the flags are merged, don't fit together, or one it requires is missing: such as resources.testserverPool.ttl not longer than its minTimeLeft. Each problem names the values it is about and where each came from.",
|
|
80
|
+
schema: z.object({
|
|
81
|
+
/** The config file that applied; null when none did. */
|
|
82
|
+
configFile: z.string().nullable(),
|
|
83
|
+
problems: z.array(optionProblemSchema),
|
|
84
|
+
}),
|
|
85
|
+
render: ({ configFile, problems }) => {
|
|
86
|
+
const [first, ...rest] = problems;
|
|
87
|
+
return {
|
|
88
|
+
message: first === undefined ? "A resource's options don't fit together." : optionProblemLine(first, configFile),
|
|
89
|
+
...(rest.length === 0
|
|
90
|
+
? {}
|
|
91
|
+
: { rows: [["Also", rest.map((problem) => optionProblemLine(problem, configFile))]] }),
|
|
92
|
+
next: [
|
|
93
|
+
{
|
|
94
|
+
type: "text",
|
|
95
|
+
text: `Change the options on the command line or in ${configFile ?? "storm.config.ts"}, then retry.`,
|
|
96
|
+
},
|
|
97
|
+
],
|
|
98
|
+
};
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
});
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/** Where Node said an import failed, in the config file: a line, and a column when it gave one. */
|
|
2
|
+
export interface ConfigLocation {
|
|
3
|
+
readonly line: number;
|
|
4
|
+
readonly column?: number;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* What importing a config file gave:
|
|
8
|
+
*
|
|
9
|
+
* - `default-export`: the module's default export, whatever it is.
|
|
10
|
+
* - `no-default-export`: the module imported but exports no default.
|
|
11
|
+
* - `import-failed`: Node couldn't import it: a syntax error, TypeScript it can't strip, a throw while it ran, or a
|
|
12
|
+
* file it can't read. `message` is Node's, and `location` where Node gave one in the config file.
|
|
13
|
+
*/
|
|
14
|
+
export type ConfigImport = {
|
|
15
|
+
readonly kind: "default-export";
|
|
16
|
+
readonly value: unknown;
|
|
17
|
+
} | {
|
|
18
|
+
readonly kind: "no-default-export";
|
|
19
|
+
} | {
|
|
20
|
+
readonly kind: "import-failed";
|
|
21
|
+
readonly message: string;
|
|
22
|
+
readonly location?: ConfigLocation;
|
|
23
|
+
};
|
|
24
|
+
/** What finding and loading `storm.config.ts` needs from the world. No method rejects. */
|
|
25
|
+
export interface ConfigGateway {
|
|
26
|
+
/** Whether `directory` holds a `storm.config.ts` file. A directory storm can't read holds none. */
|
|
27
|
+
hasConfigFile(directory: string): Promise<boolean>;
|
|
28
|
+
/** Whether `directory` is a git worktree's root: it holds `.git`, a directory or a file. */
|
|
29
|
+
isWorktreeRoot(directory: string): Promise<boolean>;
|
|
30
|
+
/** Imports the config file at `path`, running it. */
|
|
31
|
+
importConfig(path: string): Promise<ConfigImport>;
|
|
32
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { configErrors, configProblemLine, optionProblemLine } from "./errors.ts";
|
|
2
|
+
export type { ConfigGateway, ConfigImport, ConfigLocation } from "./gateways.ts";
|
|
3
|
+
export { liveConfigGateway } from "./live/config-gateway.ts";
|
|
4
|
+
export { type ConfigProblem, type ConfigValues, findConfigFile, type LoadedConfig, loadConfig } from "./load.ts";
|
|
5
|
+
export { type AnyResourceConfig, type GivenOptions, type GivenResources, optionKeyPath, type OptionOf, type OptionProblem, type OptionRule, type OptionRules, type OptionSettings, type OptionsResolution, readBooleanText, readTextAsIs, readWholeNumberText, type ResolvedOf, type ResolvedResources, type ResourceConfig, type ResourceFactory, type Setting, type SettingSource, type SettingsOf, } from "./resource-config.ts";
|
|
6
|
+
export { mergeResourceOptions, type ResolvedSettings, resolveResourceOptions, resolveSettings, type ResourceOptionProblem, type ResourceOptionsResolution, type SettingFlags, } from "./resolve.ts";
|
|
7
|
+
export { type Checked, checkBoolean, type CheckedSettings, checkNonEmptyString, CONFIG_FILE_NAME, CONFIG_SETTING_KEYS, type ConfigKey, type ConfigSettingKey, type ConfigSettings, describeValue, type SettingValue, type ValueProblem, wrongValue, } from "./schema.ts";
|
|
8
|
+
export { parseSetFlags, type SetFlagsParse, setKeyPaths } from "./set.ts";
|
|
9
|
+
export { fileOptions, fileSettings, invalidConfig, invalidResourceOptions, loadSettingsFile, type SettingsFile, settleResourceOptions, } from "./settings-file.ts";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// The `config` module's public surface: finding, loading and checking `storm.config.ts` against the resource
|
|
2
|
+
// configs a caller passes in, reading `--set` against them, and resolving each top-level setting and each held
|
|
3
|
+
// resource's options. It names no resource. Each resource folder imports the resource config vocabulary to declare its
|
|
4
|
+
// own section; the composition layer passes the registry's resource configs in.
|
|
5
|
+
export { configErrors, configProblemLine, optionProblemLine } from "./errors.js";
|
|
6
|
+
export { liveConfigGateway } from "./live/config-gateway.js";
|
|
7
|
+
export { findConfigFile, loadConfig } from "./load.js";
|
|
8
|
+
export { optionKeyPath, readBooleanText, readTextAsIs, readWholeNumberText, } from "./resource-config.js";
|
|
9
|
+
export { mergeResourceOptions, resolveResourceOptions, resolveSettings, } from "./resolve.js";
|
|
10
|
+
export { checkBoolean, checkNonEmptyString, CONFIG_FILE_NAME, CONFIG_SETTING_KEYS, describeValue, wrongValue, } from "./schema.js";
|
|
11
|
+
export { parseSetFlags, setKeyPaths } from "./set.js";
|
|
12
|
+
export { fileOptions, fileSettings, invalidConfig, invalidResourceOptions, loadSettingsFile, settleResourceOptions, } from "./settings-file.js";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ConfigGateway } from "../gateways.ts";
|
|
2
|
+
/**
|
|
3
|
+
* The live config gateway: `stat` for the config file and `.git`, and a plain `import()`, so Node's own type
|
|
4
|
+
* stripping loads the file. Node caches a module by its URL, so a process imports each config file once.
|
|
5
|
+
*/
|
|
6
|
+
export declare function liveConfigGateway(): ConfigGateway;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExtension) || function (path, preserveJsx) {
|
|
2
|
+
if (typeof path === "string" && /^\.\.?\//.test(path)) {
|
|
3
|
+
return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
|
|
4
|
+
return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
|
|
5
|
+
});
|
|
6
|
+
}
|
|
7
|
+
return path;
|
|
8
|
+
};
|
|
9
|
+
import { stat } from "node:fs/promises";
|
|
10
|
+
import { basename, join } from "node:path";
|
|
11
|
+
import { pathToFileURL } from "node:url";
|
|
12
|
+
import { CONFIG_FILE_NAME } from "../schema.js";
|
|
13
|
+
/**
|
|
14
|
+
* The live config gateway: `stat` for the config file and `.git`, and a plain `import()`, so Node's own type
|
|
15
|
+
* stripping loads the file. Node caches a module by its URL, so a process imports each config file once.
|
|
16
|
+
*/
|
|
17
|
+
export function liveConfigGateway() {
|
|
18
|
+
return {
|
|
19
|
+
hasConfigFile: async (directory) => (await kind(join(directory, CONFIG_FILE_NAME))) === "file",
|
|
20
|
+
isWorktreeRoot: async (directory) => (await kind(join(directory, ".git"))) !== undefined,
|
|
21
|
+
importConfig: async (path) => {
|
|
22
|
+
try {
|
|
23
|
+
const module = (await import(__rewriteRelativeImportExtension(pathToFileURL(path).href)));
|
|
24
|
+
return "default" in module
|
|
25
|
+
? { kind: "default-export", value: module["default"] }
|
|
26
|
+
: { kind: "no-default-export" };
|
|
27
|
+
}
|
|
28
|
+
catch (error) {
|
|
29
|
+
return importFailure(error, path);
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
async function kind(path) {
|
|
35
|
+
try {
|
|
36
|
+
return (await stat(path)).isFile() ? "file" : "other";
|
|
37
|
+
}
|
|
38
|
+
catch {
|
|
39
|
+
return undefined;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
/** Node's message for a failed import, with where in the config file it failed when its stack says. */
|
|
43
|
+
function importFailure(error, path) {
|
|
44
|
+
if (!(error instanceof Error))
|
|
45
|
+
return { kind: "import-failed", message: String(error) };
|
|
46
|
+
const location = errorLocation(error, basename(path));
|
|
47
|
+
return { kind: "import-failed", message: error.message, ...(location === undefined ? {} : { location }) };
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Where an error happened in the file named `name`. A syntax error's stack starts `<path>:<line>`, then a code frame
|
|
51
|
+
* of a few source lines, carets under the failing one, and a blank line; a thrown error's stack has a frame
|
|
52
|
+
* `<url>:<line>:<column>`. The path in a stack may be the file's real path, so only its name is matched.
|
|
53
|
+
*/
|
|
54
|
+
function errorLocation(error, name) {
|
|
55
|
+
const lines = (error.stack ?? "").split("\n");
|
|
56
|
+
const escaped = name.replaceAll(".", "\\.");
|
|
57
|
+
if (error instanceof SyntaxError) {
|
|
58
|
+
const line = new RegExp(`${escaped}:(\\d+)$`).exec(lines[0] ?? "")?.[1];
|
|
59
|
+
if (line === undefined)
|
|
60
|
+
return undefined;
|
|
61
|
+
const frame = lines.slice(1);
|
|
62
|
+
const carets = frame.slice(0, frame.indexOf("")).find((text) => /^ *\^+$/.test(text));
|
|
63
|
+
return carets === undefined ? { line: Number(line) } : { line: Number(line), column: carets.indexOf("^") + 1 };
|
|
64
|
+
}
|
|
65
|
+
for (const text of lines) {
|
|
66
|
+
const frame = new RegExp(`${escaped}:(\\d+):(\\d+)\\)?$`).exec(text);
|
|
67
|
+
if (frame !== null)
|
|
68
|
+
return { line: Number(frame[1]), column: Number(frame[2]) };
|
|
69
|
+
}
|
|
70
|
+
return undefined;
|
|
71
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { ConfigGateway, ConfigLocation } from "./gateways.ts";
|
|
2
|
+
import type { AnyResourceConfig, GivenResources } from "./resource-config.ts";
|
|
3
|
+
import { type CheckedSettings } from "./schema.ts";
|
|
4
|
+
/**
|
|
5
|
+
* One thing wrong with a config file: the key it is about (`null` when none is), where Node said an import failed
|
|
6
|
+
* (`null` otherwise), and the problem, worded to follow the key or the file name.
|
|
7
|
+
*/
|
|
8
|
+
export interface ConfigProblem {
|
|
9
|
+
readonly key: string | null;
|
|
10
|
+
readonly location: ConfigLocation | null;
|
|
11
|
+
readonly problem: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* What a loaded config file gave, every value checked: its top-level settings, and the options of each resource it
|
|
15
|
+
* holds, by name, as written. A resource the file holds with no options has an empty entry; one it doesn't hold is
|
|
16
|
+
* absent.
|
|
17
|
+
*/
|
|
18
|
+
export interface ConfigValues<Configs extends readonly AnyResourceConfig[]> {
|
|
19
|
+
readonly settings: CheckedSettings;
|
|
20
|
+
readonly resources: GivenResources<Configs>;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* What `loadConfig` found:
|
|
24
|
+
*
|
|
25
|
+
* - `none`: no config file applies.
|
|
26
|
+
* - `loaded`: the file at `path` default-exports an object of known keys, every value checked.
|
|
27
|
+
* - `invalid`: the file at `path` can't be used, and `problems` say why. A command never treats it as absent.
|
|
28
|
+
*/
|
|
29
|
+
export type LoadedConfig<Configs extends readonly AnyResourceConfig[]> = {
|
|
30
|
+
readonly kind: "none";
|
|
31
|
+
} | {
|
|
32
|
+
readonly kind: "loaded";
|
|
33
|
+
readonly path: string;
|
|
34
|
+
readonly values: ConfigValues<Configs>;
|
|
35
|
+
} | {
|
|
36
|
+
readonly kind: "invalid";
|
|
37
|
+
readonly path: string;
|
|
38
|
+
readonly problems: readonly ConfigProblem[];
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Finds the config file for `startDirectory` (absolute): `storm.config.ts` in it, then in each parent up to the
|
|
42
|
+
* git worktree's root, the first directory holding `.git`; outside a git worktree, only in `startDirectory`. The
|
|
43
|
+
* first file found wins.
|
|
44
|
+
*/
|
|
45
|
+
export declare function findConfigFile(gateway: ConfigGateway, startDirectory: string): Promise<string | undefined>;
|
|
46
|
+
/**
|
|
47
|
+
* Finds and imports the config file for `startDirectory` (see `findConfigFile`), and checks all of it, whatever
|
|
48
|
+
* command reads it. The file must default-export an object holding only known keys, each top-level setting by its
|
|
49
|
+
* rule, and a `resources` that is an object holding only the resources `configs` describe, each a value its factory
|
|
50
|
+
* made, holding only that resource's options, each by its rule. Every problem found goes into one `invalid`.
|
|
51
|
+
* Whether a held resource's options fit together, and whether a required one is given, waits for `--set`
|
|
52
|
+
* (`resolveResourceOptions`).
|
|
53
|
+
*/
|
|
54
|
+
export declare function loadConfig<Configs extends readonly AnyResourceConfig[]>(gateway: ConfigGateway, startDirectory: string, configs: Configs): Promise<LoadedConfig<Configs>>;
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import { dirname, join } from "node:path";
|
|
2
|
+
import { givenOptionsOf, givenResourcesByName } from "./by-name.js";
|
|
3
|
+
import { CONFIG_FILE_NAME, checkSettingValue, describeValue, isConfigSettingKey, } from "./schema.js";
|
|
4
|
+
/**
|
|
5
|
+
* Finds the config file for `startDirectory` (absolute): `storm.config.ts` in it, then in each parent up to the
|
|
6
|
+
* git worktree's root, the first directory holding `.git`; outside a git worktree, only in `startDirectory`. The
|
|
7
|
+
* first file found wins.
|
|
8
|
+
*/
|
|
9
|
+
export async function findConfigFile(gateway, startDirectory) {
|
|
10
|
+
if (await gateway.hasConfigFile(startDirectory))
|
|
11
|
+
return join(startDirectory, CONFIG_FILE_NAME);
|
|
12
|
+
const root = await worktreeRoot(gateway, startDirectory);
|
|
13
|
+
if (root === undefined)
|
|
14
|
+
return undefined;
|
|
15
|
+
for (let directory = startDirectory; directory !== root;) {
|
|
16
|
+
directory = dirname(directory);
|
|
17
|
+
if (await gateway.hasConfigFile(directory))
|
|
18
|
+
return join(directory, CONFIG_FILE_NAME);
|
|
19
|
+
}
|
|
20
|
+
return undefined;
|
|
21
|
+
}
|
|
22
|
+
/** The nearest directory at or above `directory` holding `.git`, if any. */
|
|
23
|
+
async function worktreeRoot(gateway, directory) {
|
|
24
|
+
for (let current = directory;; current = dirname(current)) {
|
|
25
|
+
if (await gateway.isWorktreeRoot(current))
|
|
26
|
+
return current;
|
|
27
|
+
if (dirname(current) === current)
|
|
28
|
+
return undefined;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Finds and imports the config file for `startDirectory` (see `findConfigFile`), and checks all of it, whatever
|
|
33
|
+
* command reads it. The file must default-export an object holding only known keys, each top-level setting by its
|
|
34
|
+
* rule, and a `resources` that is an object holding only the resources `configs` describe, each a value its factory
|
|
35
|
+
* made, holding only that resource's options, each by its rule. Every problem found goes into one `invalid`.
|
|
36
|
+
* Whether a held resource's options fit together, and whether a required one is given, waits for `--set`
|
|
37
|
+
* (`resolveResourceOptions`).
|
|
38
|
+
*/
|
|
39
|
+
export async function loadConfig(gateway, startDirectory, configs) {
|
|
40
|
+
const path = await findConfigFile(gateway, startDirectory);
|
|
41
|
+
if (path === undefined)
|
|
42
|
+
return { kind: "none" };
|
|
43
|
+
const imported = await gateway.importConfig(path);
|
|
44
|
+
switch (imported.kind) {
|
|
45
|
+
case "import-failed":
|
|
46
|
+
return {
|
|
47
|
+
kind: "invalid",
|
|
48
|
+
path,
|
|
49
|
+
problems: [{ key: null, location: imported.location ?? null, problem: imported.message }],
|
|
50
|
+
};
|
|
51
|
+
case "no-default-export":
|
|
52
|
+
return {
|
|
53
|
+
kind: "invalid",
|
|
54
|
+
path,
|
|
55
|
+
problems: [fileProblem("has no default export; export default defineConfig({ … })")],
|
|
56
|
+
};
|
|
57
|
+
case "default-export":
|
|
58
|
+
return checkFile(path, imported.value, configs);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
function checkFile(path, value, configs) {
|
|
62
|
+
if (!isRecord(value))
|
|
63
|
+
return {
|
|
64
|
+
kind: "invalid",
|
|
65
|
+
path,
|
|
66
|
+
problems: [fileProblem(`must default-export an object, not ${describeValue(value)}`)],
|
|
67
|
+
};
|
|
68
|
+
const settings = {};
|
|
69
|
+
const problems = [];
|
|
70
|
+
let resources = {};
|
|
71
|
+
for (const [key, keyValue] of Object.entries(value)) {
|
|
72
|
+
if (key === "resources")
|
|
73
|
+
resources = checkResources(keyValue, configs, problems);
|
|
74
|
+
else if (isConfigSettingKey(key)) {
|
|
75
|
+
if (keyValue !== undefined)
|
|
76
|
+
checkSetting(key, keyValue, settings, problems);
|
|
77
|
+
}
|
|
78
|
+
else
|
|
79
|
+
problems.push({ key, location: null, problem: `is not a ${CONFIG_FILE_NAME} key` });
|
|
80
|
+
}
|
|
81
|
+
if (problems.length > 0)
|
|
82
|
+
return { kind: "invalid", path, problems };
|
|
83
|
+
return {
|
|
84
|
+
kind: "loaded",
|
|
85
|
+
path,
|
|
86
|
+
values: { settings, resources: givenResourcesByName(configs, resources) },
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
/** Checks one top-level setting, putting its value in `settings` or each thing wrong with it onto `problems`. */
|
|
90
|
+
function checkSetting(key, value, settings, problems) {
|
|
91
|
+
const checked = checkSettingValue(key, value);
|
|
92
|
+
// `Object.assign`, since TypeScript can't relate a union key's value to the mapped type's entry for that key.
|
|
93
|
+
if (checked.ok)
|
|
94
|
+
Object.assign(settings, { [key]: checked.value });
|
|
95
|
+
else
|
|
96
|
+
for (const { path: inside, problem } of checked.problems)
|
|
97
|
+
problems.push({ key: [key, ...inside].join("."), location: null, problem });
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* The options of each resource `resources` holds, by name, each checked; empty when the file sets `resources` to
|
|
101
|
+
* undefined. Each thing wrong is pushed onto `problems`: a `resources` that isn't an object, a resource no config
|
|
102
|
+
* describes, a value its factory didn't make, an unknown option, or a value its option's rule refuses.
|
|
103
|
+
*/
|
|
104
|
+
function checkResources(value, configs, problems) {
|
|
105
|
+
if (value === undefined)
|
|
106
|
+
return {};
|
|
107
|
+
if (!isRecord(value)) {
|
|
108
|
+
problems.push({ key: "resources", location: null, problem: `must be an object, not ${describeValue(value)}` });
|
|
109
|
+
return {};
|
|
110
|
+
}
|
|
111
|
+
const byName = new Map(configs.map((config) => [config.name, config]));
|
|
112
|
+
const holds = configs.length === 0 ? "none" : configs.map((each) => each.name).join(", ");
|
|
113
|
+
const found = {};
|
|
114
|
+
for (const [name, resource] of Object.entries(value)) {
|
|
115
|
+
const config = byName.get(name);
|
|
116
|
+
if (config === undefined) {
|
|
117
|
+
problems.push({
|
|
118
|
+
key: `resources.${name}`,
|
|
119
|
+
location: null,
|
|
120
|
+
problem: `is not a resource; resources holds ${holds}`,
|
|
121
|
+
});
|
|
122
|
+
continue;
|
|
123
|
+
}
|
|
124
|
+
if (resource === undefined)
|
|
125
|
+
continue;
|
|
126
|
+
const options = checkResource(config, resource, problems);
|
|
127
|
+
if (options !== undefined)
|
|
128
|
+
found[name] = options;
|
|
129
|
+
}
|
|
130
|
+
return found;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* One resource's options, each checked; undefined when the value isn't one its factory made, or holds an option
|
|
134
|
+
* `config` doesn't describe, or a value an option's rule refuses, each thing wrong pushed onto `problems`.
|
|
135
|
+
*/
|
|
136
|
+
function checkResource(config, value, problems) {
|
|
137
|
+
const { name, factory } = config;
|
|
138
|
+
const options = isRecord(value) && value["kind"] === factory.kind ? value["options"] : undefined;
|
|
139
|
+
if (!isRecord(options)) {
|
|
140
|
+
problems.push({
|
|
141
|
+
key: `resources.${name}`,
|
|
142
|
+
location: null,
|
|
143
|
+
problem: `must be made by ${factory.call} from ${factory.subpath}, not ${describeValue(value)}`,
|
|
144
|
+
});
|
|
145
|
+
return undefined;
|
|
146
|
+
}
|
|
147
|
+
const checked = {};
|
|
148
|
+
let valid = true;
|
|
149
|
+
for (const [option, optionValue] of Object.entries(options)) {
|
|
150
|
+
const key = `resources.${name}.${option}`;
|
|
151
|
+
const rule = Object.hasOwn(config.options, option) ? config.options[option] : undefined;
|
|
152
|
+
if (rule === undefined) {
|
|
153
|
+
valid = false;
|
|
154
|
+
problems.push({ key, location: null, problem: `is not a ${name} option` });
|
|
155
|
+
continue;
|
|
156
|
+
}
|
|
157
|
+
if (optionValue === undefined)
|
|
158
|
+
continue;
|
|
159
|
+
const result = rule.check(optionValue);
|
|
160
|
+
if (result.ok)
|
|
161
|
+
checked[option] = result.value;
|
|
162
|
+
else {
|
|
163
|
+
valid = false;
|
|
164
|
+
for (const { path: inside, problem } of result.problems)
|
|
165
|
+
problems.push({ key: [key, ...inside].join("."), location: null, problem });
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
return valid ? givenOptionsOf(config, checked) : undefined;
|
|
169
|
+
}
|
|
170
|
+
function isRecord(value) {
|
|
171
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
172
|
+
}
|
|
173
|
+
function fileProblem(problem) {
|
|
174
|
+
return { key: null, location: null, problem };
|
|
175
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { type AnyResourceConfig, type GivenOptions, type GivenResources, type ResolvedResources, type Setting, type SettingSource, type SettingsOf } from "./resource-config.ts";
|
|
2
|
+
import type { CheckedSettings, SettingValue } from "./schema.ts";
|
|
3
|
+
/** Each top-level setting a command reads: set only when a flag or the file gave it. None has a default. */
|
|
4
|
+
export type ResolvedSettings = {
|
|
5
|
+
readonly [K in keyof CheckedSettings]-?: Setting<SettingValue<K>> | undefined;
|
|
6
|
+
};
|
|
7
|
+
/** The flag values a command was given for the top-level settings, already checked; `undefined` for one not given. */
|
|
8
|
+
export interface SettingFlags {
|
|
9
|
+
readonly scope?: string | undefined;
|
|
10
|
+
readonly project?: string | undefined;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Resolves each top-level setting: the flag's value, else the config file's. `runner` has no flag. `file` is the
|
|
14
|
+
* loaded config file's settings, already checked, or `undefined` when no file applies.
|
|
15
|
+
*/
|
|
16
|
+
export declare function resolveSettings(flags: SettingFlags, file: CheckedSettings | undefined): ResolvedSettings;
|
|
17
|
+
/**
|
|
18
|
+
* One thing wrong with a held resource's merged options, as an error reports it: the key path it is about, what is
|
|
19
|
+
* wrong, and each value it is about, by key path, with where it came from.
|
|
20
|
+
*/
|
|
21
|
+
export interface ResourceOptionProblem {
|
|
22
|
+
readonly key: string;
|
|
23
|
+
readonly problem: string;
|
|
24
|
+
readonly values: readonly {
|
|
25
|
+
readonly key: string;
|
|
26
|
+
readonly value: unknown;
|
|
27
|
+
readonly source: SettingSource;
|
|
28
|
+
}[];
|
|
29
|
+
}
|
|
30
|
+
/** Merged or resolved options, or what is wrong with them. */
|
|
31
|
+
export type ResourceOptionsResolution<T> = {
|
|
32
|
+
readonly ok: true;
|
|
33
|
+
readonly value: T;
|
|
34
|
+
} | {
|
|
35
|
+
readonly ok: false;
|
|
36
|
+
readonly problems: readonly ResourceOptionProblem[];
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* One held resource's options merged: each option's rule's default, overridden by the file's value, overridden by a
|
|
40
|
+
* flag's (a `--set`, or a command's own flag for the option), each with its source. A required option none of them
|
|
41
|
+
* gives is a problem. The values are checked already, so nothing else is.
|
|
42
|
+
*/
|
|
43
|
+
export declare function mergeResourceOptions<C extends AnyResourceConfig>(config: C, file: GivenOptions<C> | undefined, flags: GivenOptions<C> | undefined): ResourceOptionsResolution<SettingsOf<C>>;
|
|
44
|
+
/**
|
|
45
|
+
* The resolved options of each resource the run holds, by name: one the file has, or one any `--set` names an option
|
|
46
|
+
* of. Each is merged (`mergeResourceOptions`) and then resolved by its config's `resolve`, which checks its options
|
|
47
|
+
* against each other. Every problem of every held resource is returned at once, in config order.
|
|
48
|
+
*/
|
|
49
|
+
export declare function resolveResourceOptions<Configs extends readonly AnyResourceConfig[]>(configs: Configs, file: GivenResources<Configs> | undefined, sets: GivenResources<Configs>): ResourceOptionsResolution<ResolvedResources<Configs>>;
|