@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,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 the flags (`sets`: each
|
|
46
|
+
* `--set`, and a command's own flag for an option) give an option of. Each is merged (`mergeResourceOptions`) and
|
|
47
|
+
* then resolved by its config's `resolve`, which checks its options 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>>;
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
// Resolving what a command reads: each top-level setting from its flag or the file, and each held resource's options
|
|
2
|
+
// from its rules' defaults, the file and the flags, then the resource's own `resolve`.
|
|
3
|
+
import { resolvedResourcesByName } from "./by-name.js";
|
|
4
|
+
import { optionKeyPath, } from "./resource-config.js";
|
|
5
|
+
/**
|
|
6
|
+
* Resolves each top-level setting: the flag's value, else the config file's. `runner` has no flag. `file` is the
|
|
7
|
+
* loaded config file's settings, already checked, or `undefined` when no file applies.
|
|
8
|
+
*/
|
|
9
|
+
export function resolveSettings(flags, file) {
|
|
10
|
+
const pick = (flag, fromFile) => flag !== undefined
|
|
11
|
+
? { value: flag, source: "flag" }
|
|
12
|
+
: fromFile === undefined
|
|
13
|
+
? undefined
|
|
14
|
+
: { value: fromFile, source: "file" };
|
|
15
|
+
return {
|
|
16
|
+
scope: pick(flags.scope, file?.scope),
|
|
17
|
+
project: pick(flags.project, file?.project),
|
|
18
|
+
runner: pick(undefined, file?.runner),
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* One held resource's options merged: each option's rule's default, overridden by the file's value, overridden by a
|
|
23
|
+
* flag's (a `--set`, or a command's own flag for the option), each with its source. A required option none of them
|
|
24
|
+
* gives is a problem. The values are checked already, so nothing else is.
|
|
25
|
+
*/
|
|
26
|
+
export function mergeResourceOptions(config, file, flags) {
|
|
27
|
+
const fromFile = file ?? {};
|
|
28
|
+
const fromFlags = flags ?? {};
|
|
29
|
+
const merged = {};
|
|
30
|
+
const problems = [];
|
|
31
|
+
for (const [option, rule] of Object.entries(config.options)) {
|
|
32
|
+
const flag = fromFlags[option];
|
|
33
|
+
const given = fromFile[option];
|
|
34
|
+
if (flag !== undefined)
|
|
35
|
+
merged[option] = { value: flag, source: "flag" };
|
|
36
|
+
else if (given !== undefined)
|
|
37
|
+
merged[option] = { value: given, source: "file" };
|
|
38
|
+
else if (rule.default !== undefined)
|
|
39
|
+
merged[option] = { value: rule.default, source: "default" };
|
|
40
|
+
else if (rule.required === true) {
|
|
41
|
+
const key = optionKeyPath(config.name, option);
|
|
42
|
+
problems.push({
|
|
43
|
+
key,
|
|
44
|
+
problem: `is required; give it in ${config.factory.call} or with --set ${key}=<value>`,
|
|
45
|
+
values: [],
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
if (problems.length > 0)
|
|
50
|
+
return { ok: false, problems };
|
|
51
|
+
// Every option with a default or marked required is in `merged`, so it is what `config.resolve` takes.
|
|
52
|
+
return { ok: true, value: merged };
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* The resolved options of each resource the run holds, by name: one the file has, or one the flags (`sets`: each
|
|
56
|
+
* `--set`, and a command's own flag for an option) give an option of. Each is merged (`mergeResourceOptions`) and
|
|
57
|
+
* then resolved by its config's `resolve`, which checks its options against each other. Every problem of every held resource is returned at once, in config order.
|
|
58
|
+
*/
|
|
59
|
+
export function resolveResourceOptions(configs, file, sets) {
|
|
60
|
+
const fromFile = file ?? {};
|
|
61
|
+
const fromSets = sets;
|
|
62
|
+
const resolved = {};
|
|
63
|
+
const problems = [];
|
|
64
|
+
for (const config of configs) {
|
|
65
|
+
const given = fromFile[config.name];
|
|
66
|
+
const set = fromSets[config.name];
|
|
67
|
+
if (given === undefined && set === undefined)
|
|
68
|
+
continue;
|
|
69
|
+
const merged = mergeResourceOptions(config, given, set);
|
|
70
|
+
if (!merged.ok) {
|
|
71
|
+
problems.push(...merged.problems);
|
|
72
|
+
continue;
|
|
73
|
+
}
|
|
74
|
+
const settings = merged.value;
|
|
75
|
+
const result = config.resolve(merged.value);
|
|
76
|
+
if (result.ok)
|
|
77
|
+
resolved[config.name] = result.value;
|
|
78
|
+
else
|
|
79
|
+
for (const { option, problem, involves } of result.problems)
|
|
80
|
+
problems.push({
|
|
81
|
+
key: optionKeyPath(config.name, option),
|
|
82
|
+
problem,
|
|
83
|
+
values: involves.flatMap((each) => {
|
|
84
|
+
const setting = settings[each];
|
|
85
|
+
return setting === undefined
|
|
86
|
+
? []
|
|
87
|
+
: [{ key: optionKeyPath(config.name, each), value: setting.value, source: setting.source }];
|
|
88
|
+
}),
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
if (problems.length > 0)
|
|
92
|
+
return { ok: false, problems };
|
|
93
|
+
return { ok: true, value: resolvedResourcesByName(configs, resolved) };
|
|
94
|
+
}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import type { Checked } from "./schema.ts";
|
|
2
|
+
/** Where a value came from: a flag (`--scope`, `--set`, a command's own option flag), the file, or a default. */
|
|
3
|
+
export type SettingSource = "flag" | "file" | "default";
|
|
4
|
+
/** A value and where it came from. */
|
|
5
|
+
export interface Setting<T> {
|
|
6
|
+
readonly value: T;
|
|
7
|
+
readonly source: SettingSource;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* How one resource option is checked, read from `--set` text and defaulted.
|
|
11
|
+
*
|
|
12
|
+
* - `check`: the option's rule, for a value from the file, from `--set` once read, or from a command's own flag.
|
|
13
|
+
* - `readText`: a `--set` value's text as the value `check` reads, such as a whole number or a boolean. Text that
|
|
14
|
+
* doesn't read as its kind is passed on as text, which `check` refuses by name.
|
|
15
|
+
* - `default`: the value when neither the file nor a flag gives one.
|
|
16
|
+
* - `required`: a resource held without this option is a problem.
|
|
17
|
+
*/
|
|
18
|
+
export interface OptionRule<T> {
|
|
19
|
+
readonly check: (value: unknown) => Checked<T>;
|
|
20
|
+
readonly readText: (text: string) => unknown;
|
|
21
|
+
readonly default?: T;
|
|
22
|
+
readonly required?: boolean;
|
|
23
|
+
}
|
|
24
|
+
/** An option's value once given: its type in the options interface, without `undefined`. */
|
|
25
|
+
type OptionValue<Options, K extends keyof Options> = Exclude<Options[K], undefined>;
|
|
26
|
+
/**
|
|
27
|
+
* One rule for each option of `Options`. An option in `Present` has a default or is required, so a resource that
|
|
28
|
+
* holds it always has a value for it; any other option has neither. An option `Options` gains or loses fails to
|
|
29
|
+
* compile until its rule follows.
|
|
30
|
+
*/
|
|
31
|
+
export type OptionRules<Options, Present extends keyof Options> = {
|
|
32
|
+
readonly [K in keyof Options]-?: OptionRule<OptionValue<Options, K>> & (K extends Present ? {
|
|
33
|
+
readonly default: OptionValue<Options, K>;
|
|
34
|
+
} | {
|
|
35
|
+
readonly required: true;
|
|
36
|
+
} : {
|
|
37
|
+
readonly default?: undefined;
|
|
38
|
+
readonly required?: false;
|
|
39
|
+
});
|
|
40
|
+
};
|
|
41
|
+
/** Each option of a held resource as a `Setting`, once defaults, the file and `--set` are merged. */
|
|
42
|
+
export type OptionSettings<Options, Present extends keyof Options> = {
|
|
43
|
+
readonly [K in keyof Options]-?: K extends Present ? Setting<OptionValue<Options, K>> : Setting<OptionValue<Options, K>> | undefined;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* One thing wrong with a resource's merged options: the option it is about, what is wrong, worded to follow the
|
|
47
|
+
* option's key path, and every option whose value it is about, `option` included, whose sources the error names.
|
|
48
|
+
*/
|
|
49
|
+
export interface OptionProblem<Option extends string> {
|
|
50
|
+
readonly option: Option;
|
|
51
|
+
readonly problem: string;
|
|
52
|
+
readonly involves: readonly Option[];
|
|
53
|
+
}
|
|
54
|
+
/** A resource's options resolved: the value, or each thing wrong with them. */
|
|
55
|
+
export type OptionsResolution<T, Option extends string> = {
|
|
56
|
+
readonly ok: true;
|
|
57
|
+
readonly value: T;
|
|
58
|
+
} | {
|
|
59
|
+
readonly ok: false;
|
|
60
|
+
readonly problems: readonly OptionProblem<Option>[];
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* What a "must be made by …" problem names: the tag the factory's value carries (`kind`), how its call is written,
|
|
64
|
+
* such as `widget({ … })`, and the published subpath it comes from.
|
|
65
|
+
*/
|
|
66
|
+
export interface ResourceFactory {
|
|
67
|
+
readonly kind: string;
|
|
68
|
+
readonly call: string;
|
|
69
|
+
readonly subpath: string;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* What one resource declares about its section under `resources`:
|
|
73
|
+
*
|
|
74
|
+
* - `name`: its key under `resources`.
|
|
75
|
+
* - `factory`: the factory a config file makes its value with.
|
|
76
|
+
* - `options`: one rule for each option.
|
|
77
|
+
* - `resolve`: given each option of a held resource as a `Setting`, its resolved options, or what is wrong with them:
|
|
78
|
+
* the checks across options. A required option that is missing never reaches it.
|
|
79
|
+
*
|
|
80
|
+
* `resolve` is a method, so the registry's list of resource configs fits `AnyResourceConfig`: a method's parameter is
|
|
81
|
+
* checked both ways, where a function property's would be checked only contravariantly.
|
|
82
|
+
*/
|
|
83
|
+
export interface ResourceConfig<Name extends string, Options, Resolved, Present extends keyof Options = never> {
|
|
84
|
+
readonly name: Name;
|
|
85
|
+
readonly factory: ResourceFactory;
|
|
86
|
+
readonly options: OptionRules<Options, Present>;
|
|
87
|
+
resolve(settings: OptionSettings<Options, Present>): OptionsResolution<Resolved, keyof Options & string>;
|
|
88
|
+
}
|
|
89
|
+
/** Any resource config, as the generic machinery loops over them. */
|
|
90
|
+
export interface AnyResourceConfig {
|
|
91
|
+
readonly name: string;
|
|
92
|
+
readonly factory: ResourceFactory;
|
|
93
|
+
readonly options: {
|
|
94
|
+
readonly [option: string]: OptionRule<unknown>;
|
|
95
|
+
};
|
|
96
|
+
resolve(settings: {
|
|
97
|
+
readonly [option: string]: Setting<unknown> | undefined;
|
|
98
|
+
}): OptionsResolution<unknown, string>;
|
|
99
|
+
}
|
|
100
|
+
/** A resource config's option names. */
|
|
101
|
+
export type OptionOf<C extends AnyResourceConfig> = keyof C["options"] & string;
|
|
102
|
+
/** The value one rule checks to. */
|
|
103
|
+
type RuleValue<R> = R extends {
|
|
104
|
+
readonly check: (value: unknown) => Checked<infer T>;
|
|
105
|
+
} ? T : never;
|
|
106
|
+
/** A resource's options as the file or `--set` gives them, each checked; an option not given is absent. */
|
|
107
|
+
export type GivenOptions<C extends AnyResourceConfig> = {
|
|
108
|
+
readonly [K in OptionOf<C>]?: RuleValue<C["options"][K]>;
|
|
109
|
+
};
|
|
110
|
+
/** What a resource config's `resolve` takes: each option as a `Setting`. */
|
|
111
|
+
export type SettingsOf<C extends AnyResourceConfig> = Parameters<C["resolve"]>[0];
|
|
112
|
+
/** What a resource config's `resolve` resolves to. */
|
|
113
|
+
export type ResolvedOf<C extends AnyResourceConfig> = Extract<ReturnType<C["resolve"]>, {
|
|
114
|
+
readonly ok: true;
|
|
115
|
+
}>["value"];
|
|
116
|
+
/** The given options of each resource in `Configs`, by name; a resource none are given for is absent. */
|
|
117
|
+
export type GivenResources<Configs extends readonly AnyResourceConfig[]> = {
|
|
118
|
+
readonly [C in Configs[number] as C["name"]]?: GivenOptions<C>;
|
|
119
|
+
};
|
|
120
|
+
/** The resolved options of each resource in `Configs` a run holds, by name; a resource it doesn't hold is absent. */
|
|
121
|
+
export type ResolvedResources<Configs extends readonly AnyResourceConfig[]> = {
|
|
122
|
+
readonly [C in Configs[number] as C["name"]]?: ResolvedOf<C>;
|
|
123
|
+
};
|
|
124
|
+
/** A resource option's place in the file, as problems and `--set` name it: `resources.<name>.<option>`. */
|
|
125
|
+
export declare function optionKeyPath(resource: string, option: string): string;
|
|
126
|
+
/** `true` or `false` as the boolean; any other text as itself, which a true-or-false rule refuses by name. */
|
|
127
|
+
export declare function readBooleanText(text: string): unknown;
|
|
128
|
+
/** Digits as the whole number they spell; any other text as itself, which a number rule refuses by name. */
|
|
129
|
+
export declare function readWholeNumberText(text: string): unknown;
|
|
130
|
+
/** `--set` text as itself, for an option whose value is text. */
|
|
131
|
+
export declare function readTextAsIs(text: string): unknown;
|
|
132
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// The resource config: what one resource declares about its section under `resources` in `storm.config.ts`. Each
|
|
2
|
+
// resource folder implements one in its `config.ts`; this module declares the shape and names no resource. The
|
|
3
|
+
// generic machinery (`load.ts`, `set.ts`, `resolve.ts`) loops over the resource configs its caller passes in.
|
|
4
|
+
/** A resource option's place in the file, as problems and `--set` name it: `resources.<name>.<option>`. */
|
|
5
|
+
export function optionKeyPath(resource, option) {
|
|
6
|
+
return ["resources", resource, option].join(".");
|
|
7
|
+
}
|
|
8
|
+
/** `true` or `false` as the boolean; any other text as itself, which a true-or-false rule refuses by name. */
|
|
9
|
+
export function readBooleanText(text) {
|
|
10
|
+
return text === "true" ? true : text === "false" ? false : text;
|
|
11
|
+
}
|
|
12
|
+
/** Digits as the whole number they spell; any other text as itself, which a number rule refuses by name. */
|
|
13
|
+
export function readWholeNumberText(text) {
|
|
14
|
+
return /^\d+$/.test(text) ? Number(text) : text;
|
|
15
|
+
}
|
|
16
|
+
/** `--set` text as itself, for an option whose value is text. */
|
|
17
|
+
export function readTextAsIs(text) {
|
|
18
|
+
return text;
|
|
19
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { type CheckedRecipe, type RunnerRecipe } from "../runner/index.ts";
|
|
2
|
+
/** The config file's name. storm looks for it in the working directory and its parents. */
|
|
3
|
+
export declare const CONFIG_FILE_NAME = "storm.config.ts";
|
|
4
|
+
/**
|
|
5
|
+
* The settings a `storm.config.ts` can give at its top level, as the file gives them. A flag (`--scope`,
|
|
6
|
+
* `--project`) overrides the file; none has a built-in default. `@cnc-tools/storm/config`'s `StormConfig` adds
|
|
7
|
+
* `resources` to these.
|
|
8
|
+
*/
|
|
9
|
+
export interface ConfigSettings {
|
|
10
|
+
/** The control plane team (`--scope`), which a runner run also mints for. */
|
|
11
|
+
readonly scope?: string;
|
|
12
|
+
/** The control plane project (`--project`), which a runner run also mints for. */
|
|
13
|
+
readonly project?: string;
|
|
14
|
+
/** The runner recipe: what a run runs its command in, unless `--local`. Only a runner run reads it. */
|
|
15
|
+
readonly runner?: RunnerRecipe;
|
|
16
|
+
}
|
|
17
|
+
/** A top-level setting's name. */
|
|
18
|
+
export type ConfigSettingKey = keyof ConfigSettings;
|
|
19
|
+
/** A top-level key of `storm.config.ts`: a setting, or `resources`. */
|
|
20
|
+
export type ConfigKey = ConfigSettingKey | "resources";
|
|
21
|
+
/** The keys whose checked value differs from what the file gives: a recipe gains its defaults. */
|
|
22
|
+
interface CheckedSettingValues {
|
|
23
|
+
readonly runner: CheckedRecipe;
|
|
24
|
+
}
|
|
25
|
+
/** The value a top-level setting takes once checked. */
|
|
26
|
+
export type SettingValue<K extends ConfigSettingKey> = K extends keyof CheckedSettingValues ? CheckedSettingValues[K] : Exclude<ConfigSettings[K], undefined>;
|
|
27
|
+
/** The top-level settings a loaded config file gave, each checked; a setting the file doesn't give is absent. */
|
|
28
|
+
export type CheckedSettings = {
|
|
29
|
+
readonly [K in ConfigSettingKey]?: SettingValue<K>;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* One thing wrong with a value: the path inside the value (empty for the value itself, `["snapshot", "vcpus"]` inside
|
|
33
|
+
* a runner recipe), and what is wrong, worded to follow the key (`must be …, not …`).
|
|
34
|
+
*/
|
|
35
|
+
export interface ValueProblem {
|
|
36
|
+
readonly path: readonly string[];
|
|
37
|
+
readonly problem: string;
|
|
38
|
+
}
|
|
39
|
+
/** A value checked: the value, or each thing wrong with it. */
|
|
40
|
+
export type Checked<T> = {
|
|
41
|
+
readonly ok: true;
|
|
42
|
+
readonly value: T;
|
|
43
|
+
} | {
|
|
44
|
+
readonly ok: false;
|
|
45
|
+
readonly problems: readonly ValueProblem[];
|
|
46
|
+
};
|
|
47
|
+
/** A check that failed with one problem about the value itself. */
|
|
48
|
+
export declare function wrongValue(problem: string): {
|
|
49
|
+
readonly ok: false;
|
|
50
|
+
readonly problems: readonly ValueProblem[];
|
|
51
|
+
};
|
|
52
|
+
/** A string with at least one character. */
|
|
53
|
+
export declare function checkNonEmptyString(value: unknown): Checked<string>;
|
|
54
|
+
/** `true` or `false`. */
|
|
55
|
+
export declare function checkBoolean(value: unknown): Checked<boolean>;
|
|
56
|
+
/** Every top-level setting, in the order a config file's problems list them. */
|
|
57
|
+
export declare const CONFIG_SETTING_KEYS: readonly ConfigSettingKey[];
|
|
58
|
+
/** Whether `key` is a top-level setting. */
|
|
59
|
+
export declare function isConfigSettingKey(key: string): key is ConfigSettingKey;
|
|
60
|
+
/** Checks one top-level setting's value from the file. */
|
|
61
|
+
export declare function checkSettingValue<K extends ConfigSettingKey>(key: K, value: unknown): Checked<SettingValue<K>>;
|
|
62
|
+
/** A value as a problem names it: a string or number as written, otherwise its kind. */
|
|
63
|
+
export declare function describeValue(value: unknown): string;
|
|
64
|
+
export {};
|