@cnc-tools/storm 0.14.2 → 0.16.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/dist/application.js +3 -1
- package/dist/bin/storm.js +9 -7
- package/dist/build-info.js +1 -1
- package/dist/chunks/chunk-2MAD5NKK.js +108 -0
- package/dist/chunks/{chunk-HDL4WKIB.js → chunk-3L52KNQA.js} +2 -2
- package/dist/chunks/{chunk-GSC6SRTW.js → chunk-5CCP36QQ.js} +1 -1
- package/dist/chunks/{chunk-43MWZLJR.js → chunk-5VXBKPW6.js} +1 -1
- package/dist/chunks/chunk-7EENF73W.js +782 -0
- package/dist/chunks/{chunk-RA4L2ACU.js → chunk-AWBSONHB.js} +88 -34
- package/dist/chunks/chunk-CK2GZEPK.js +40 -0
- package/dist/chunks/{chunk-BRUIATTR.js → chunk-CN4EFA5J.js} +59 -12
- package/dist/chunks/{chunk-I7AN3DIJ.js → chunk-DC2CDHNK.js} +1928 -738
- package/dist/chunks/{chunk-UUBZTGLV.js → chunk-DWEAHX4T.js} +140 -130
- package/dist/chunks/{chunk-T6AZIDZD.js → chunk-F6N34UWB.js} +12 -244
- package/dist/chunks/chunk-FCQUJDA4.js +963 -0
- package/dist/chunks/{chunk-VH2POPW5.js → chunk-FOZWA52V.js} +635 -79
- package/dist/chunks/{chunk-XZCDA5PE.js → chunk-G3PHMXH5.js} +7 -2
- package/dist/chunks/{chunk-3HBPNQ4Y.js → chunk-HVNK3I45.js} +2 -2
- package/dist/chunks/chunk-OIY3DMF2.js +74 -0
- package/dist/chunks/{chunk-GJOEPJJL.js → chunk-P357TZAY.js} +446 -52
- package/dist/chunks/{chunk-UC6DULWY.js → chunk-R7XVBZOY.js} +130 -39
- package/dist/chunks/chunk-TJNFVNKR.js +246 -0
- package/dist/chunks/{chunk-RUPD4TLT.js → chunk-V4IKA3WI.js} +198 -63
- package/dist/chunks/{chunk-BW2ADH7U.js → chunk-VUPZH7J2.js} +1 -1
- package/dist/chunks/{chunk-LUOHJ3LB.js → chunk-Z5PBVG3Y.js} +1131 -468
- package/dist/chunks/{chunk-GQIL3AHY.js → chunk-ZG3WQ4UF.js} +1 -1
- package/dist/chunks/{live-app-SZGEILCQ.js → live-app-WECQOQ4C.js} +28 -23
- package/dist/command-tree.d.ts +2 -2
- package/dist/command-tree.js +2 -2
- package/dist/commands/exec/across-sandboxes-outcomes.d.ts +364 -0
- package/dist/commands/exec/across-sandboxes-outcomes.js +230 -0
- package/dist/commands/exec/across-sandboxes-run.d.ts +180 -0
- package/dist/commands/exec/across-sandboxes-run.js +339 -0
- package/dist/commands/exec/command.d.ts +583 -75
- package/dist/commands/exec/command.js +165 -32
- package/dist/commands/exec/driver-plan.d.ts +8 -2
- package/dist/commands/exec/driver-plan.js +13 -3
- package/dist/commands/exec/exec-words.d.ts +17 -3
- package/dist/commands/exec/exec-words.js +27 -16
- package/dist/commands/exec/live-view.d.ts +3 -4
- package/dist/commands/exec/live-view.js +37 -28
- package/dist/commands/exec/metadata.js +2 -2
- package/dist/commands/exec/mint-failed.d.ts +4 -4
- package/dist/commands/exec/mint-failed.js +6 -6
- package/dist/commands/exec/outcomes.d.ts +533 -73
- package/dist/commands/exec/outcomes.js +203 -67
- package/dist/commands/exec/plan-only.d.ts +10 -0
- package/dist/commands/exec/plan-only.js +45 -0
- package/dist/commands/exec/plan-run.d.ts +54 -35
- package/dist/commands/exec/plan-run.js +81 -38
- package/dist/commands/exec/planned-outcome.d.ts +15 -0
- package/dist/commands/exec/planned-outcome.js +42 -0
- package/dist/commands/exec/progress.d.ts +2 -2
- package/dist/commands/exec/progress.js +35 -18
- package/dist/commands/exec/resource-refusals.d.ts +2 -2
- package/dist/commands/exec/resource-refusals.js +3 -3
- package/dist/commands/exec/run-bin.d.ts +1 -1
- package/dist/commands/exec/run-bin.js +2 -2
- package/dist/commands/exec/run-command.d.ts +344 -63
- package/dist/commands/exec/run-command.js +312 -263
- package/dist/commands/exec/run-metadata.d.ts +42 -8
- package/dist/commands/exec/run-metadata.js +40 -21
- package/dist/commands/exec/run-planned.d.ts +20 -0
- package/dist/commands/exec/run-planned.js +22 -0
- package/dist/commands/exec/sandbox-lines.d.ts +42 -0
- package/dist/commands/exec/sandbox-lines.js +59 -0
- package/dist/commands/exec/sandbox-progress.d.ts +30 -0
- package/dist/commands/exec/sandbox-progress.js +232 -0
- package/dist/commands/exec/sandbox-view.d.ts +19 -0
- package/dist/commands/exec/sandbox-view.js +72 -0
- package/dist/commands/exec/view.d.ts +3 -2
- package/dist/commands/exec/view.js +10 -6
- package/dist/commands/runs/facts.d.ts +53 -10
- package/dist/commands/runs/facts.js +60 -32
- package/dist/commands/runs/list/command.d.ts +82 -4
- package/dist/commands/runs/list/command.js +11 -10
- package/dist/commands/runs/list/metadata.js +1 -1
- package/dist/commands/runs/list/outcomes.d.ts +41 -2
- package/dist/commands/runs/logs/command.d.ts +109 -10
- package/dist/commands/runs/logs/command.js +139 -24
- package/dist/commands/runs/logs/metadata.d.ts +4 -0
- package/dist/commands/runs/logs/metadata.js +14 -7
- package/dist/commands/runs/logs/outcomes.d.ts +52 -3
- package/dist/commands/runs/logs/outcomes.js +110 -6
- package/dist/commands/runs/past-run.d.ts +91 -11
- package/dist/commands/runs/past-run.js +149 -9
- package/dist/commands/runs/show/command.d.ts +574 -12
- package/dist/commands/runs/show/command.js +634 -119
- package/dist/commands/runs/show/metadata.d.ts +17 -0
- package/dist/commands/runs/show/metadata.js +48 -7
- package/dist/commands/runs/show/outcomes.d.ts +279 -6
- package/dist/commands/runs/show/outcomes.js +484 -96
- package/dist/commands/snapshots/build/command.d.ts +109 -18
- package/dist/commands/snapshots/build/command.js +72 -36
- package/dist/commands/snapshots/build/metadata.d.ts +4 -0
- package/dist/commands/snapshots/build/metadata.js +5 -1
- package/dist/commands/snapshots/build/outcomes.d.ts +53 -8
- package/dist/commands/snapshots/build/outcomes.js +26 -3
- package/dist/commands/snapshots/list/command.d.ts +72 -7
- package/dist/commands/snapshots/list/command.js +57 -24
- package/dist/commands/snapshots/list/metadata.d.ts +4 -0
- package/dist/commands/snapshots/list/metadata.js +5 -1
- package/dist/commands/snapshots/list/outcomes.d.ts +31 -0
- package/dist/commands/snapshots/list/outcomes.js +25 -2
- package/dist/commands/suites/list/command.d.ts +129 -0
- package/dist/commands/suites/list/command.js +163 -0
- package/dist/commands/suites/list/metadata.d.ts +11 -0
- package/dist/commands/suites/list/metadata.js +15 -0
- package/dist/commands/suites/list/outcomes.d.ts +91 -0
- package/dist/commands/suites/list/outcomes.js +122 -0
- package/dist/commands/suites/metadata.js +8 -0
- package/dist/commands/test/command.d.ts +1395 -0
- package/dist/commands/test/command.js +581 -0
- package/dist/commands/test/metadata.js +8 -0
- package/dist/commands/test/outcomes.d.ts +768 -0
- package/dist/commands/test/outcomes.js +140 -0
- package/dist/commands/test/plan.d.ts +92 -0
- package/dist/commands/test/plan.js +125 -0
- package/dist/commands/test/test-words.d.ts +12 -0
- package/dist/commands/test/test-words.js +42 -0
- package/dist/config/check-resources.d.ts +14 -0
- package/dist/config/check-resources.js +98 -0
- package/dist/config/check-runner.d.ts +15 -0
- package/dist/config/check-runner.js +79 -0
- package/dist/config/check-suites.d.ts +14 -0
- package/dist/config/check-suites.js +100 -0
- package/dist/config/gateways.d.ts +31 -3
- package/dist/config/index.d.ts +8 -6
- package/dist/config/index.js +5 -4
- package/dist/config/live/config-gateway.js +5 -2
- package/dist/config/live/file-lists-file-gateway.d.ts +4 -0
- package/dist/config/live/file-lists-file-gateway.js +27 -0
- package/dist/config/load.d.ts +32 -14
- package/dist/config/load.js +162 -116
- package/dist/config/resolve.d.ts +3 -2
- package/dist/config/resolve.js +6 -3
- package/dist/config/resolver.d.ts +20 -6
- package/dist/config/resolver.js +11 -8
- package/dist/config/runner.d.ts +23 -0
- package/dist/config/runner.js +4 -0
- package/dist/config/schema.d.ts +39 -19
- package/dist/config/schema.js +50 -10
- package/dist/config/settings-file.d.ts +9 -3
- package/dist/config/settings-file.js +41 -4
- package/dist/config/suite.d.ts +39 -0
- package/dist/config/suite.js +5 -0
- package/dist/config/typed-options.d.ts +1 -6
- package/dist/config/typed-options.js +2 -10
- package/dist/config-file/define.d.ts +45 -24
- package/dist/config-file/define.js +9 -8
- package/dist/config-file/runner.d.ts +11 -0
- package/dist/config-file/runner.js +9 -0
- package/dist/config-file/toolchain.d.ts +13 -7
- package/dist/config-file/toolchain.js +51 -35
- package/dist/context.d.ts +12 -8
- package/dist/context.js +9 -3
- package/dist/core/across-sandboxes.d.ts +43 -0
- package/dist/core/across-sandboxes.js +319 -0
- package/dist/core/before-run.d.ts +5 -3
- package/dist/core/before-run.js +12 -1
- package/dist/core/events.d.ts +62 -6
- package/dist/core/events.js +14 -0
- package/dist/core/index.d.ts +4 -2
- package/dist/core/index.js +3 -1
- package/dist/core/payload.d.ts +2 -1
- package/dist/core/payload.js +2 -1
- package/dist/core/presentations.js +1 -1
- package/dist/core/resource.d.ts +1 -1
- package/dist/core/resources.d.ts +56 -6
- package/dist/core/resources.js +81 -5
- package/dist/core/run-state.js +9 -0
- package/dist/core/run.d.ts +77 -15
- package/dist/core/run.js +150 -86
- package/dist/core/sandbox-end.d.ts +64 -0
- package/dist/core/sandbox-end.js +128 -0
- package/dist/core/timeline.d.ts +4 -4
- package/dist/core/timeline.js +3 -3
- package/dist/credential/live/vercel-cli-gateway.d.ts +7 -0
- package/dist/credential/live/vercel-cli-gateway.js +14 -1
- package/dist/extensions/github/context.d.ts +1 -1
- package/dist/extensions/github/definition.d.ts +11 -9
- package/dist/extensions/github/definition.js +8 -6
- package/dist/extensions/github/extension.d.ts +3 -3
- package/dist/extensions/github/fixture-repo.d.ts +21 -2
- package/dist/extensions/github/fixture-repo.js +31 -2
- package/dist/extensions/github/index.d.ts +2 -2
- package/dist/extensions/github/index.js +2 -2
- package/dist/extensions/github/lifecycle.d.ts +16 -6
- package/dist/extensions/github/lifecycle.js +42 -25
- package/dist/extensions/github/options.d.ts +17 -11
- package/dist/extensions/github/options.js +14 -13
- package/dist/extensions/github/refusals.d.ts +23 -6
- package/dist/extensions/github/refusals.js +34 -12
- package/dist/extensions/github/resource.d.ts +21 -12
- package/dist/extensions/github/resource.js +16 -8
- package/dist/extensions/github/run/payload.d.ts +6 -6
- package/dist/extensions/github/run/payload.js +3 -5
- package/dist/extensions/github/split.d.ts +10 -0
- package/dist/extensions/github/split.js +12 -0
- package/dist/extensions/playwright/driver.js +6 -26
- package/dist/extensions/playwright/extension.js +1 -1
- package/dist/extensions/testserver/commands/pool/create/command.js +8 -8
- package/dist/extensions/testserver/commands/pool/list/command.js +4 -4
- package/dist/extensions/testserver/definition.d.ts +4 -4
- package/dist/extensions/testserver/definition.js +41 -31
- package/dist/extensions/testserver/extension.d.ts +4 -5
- package/dist/extensions/testserver/extension.js +14 -41
- package/dist/extensions/testserver/index.d.ts +1 -1
- package/dist/extensions/testserver/index.js +1 -1
- package/dist/extensions/testserver/lifecycle.d.ts +10 -2
- package/dist/extensions/testserver/lifecycle.js +29 -6
- package/dist/extensions/testserver/options/rules.d.ts +5 -5
- package/dist/extensions/testserver/options/rules.js +10 -8
- package/dist/extensions/testserver/options/sandboxes.d.ts +4 -2
- package/dist/extensions/testserver/options/sandboxes.js +8 -3
- package/dist/extensions/testserver/pool/gateways.d.ts +29 -4
- package/dist/extensions/testserver/pool/index.d.ts +2 -2
- package/dist/extensions/testserver/pool/index.js +1 -1
- package/dist/extensions/testserver/pool/lease.d.ts +10 -0
- package/dist/extensions/testserver/pool/lease.js +21 -0
- package/dist/extensions/testserver/pool/live/pool-store-gateway.js +38 -3
- package/dist/extensions/testserver/refusals.d.ts +12 -0
- package/dist/extensions/testserver/refusals.js +18 -0
- package/dist/extensions/testserver/release.d.ts +16 -0
- package/dist/extensions/testserver/release.js +56 -4
- package/dist/extensions/testserver/resource.d.ts +6 -6
- package/dist/extensions/testserver/resource.js +3 -3
- package/dist/extensions/testserver/split.d.ts +9 -0
- package/dist/extensions/testserver/split.js +22 -0
- package/dist/extensions/testserver/vitest/fixtures.d.ts +5 -5
- package/dist/extensions/testserver/vitest/fixtures.js +9 -38
- package/dist/extensions/vitest/driver.d.ts +7 -0
- package/dist/extensions/vitest/driver.js +33 -37
- package/dist/extensions/vitest/extension.js +1 -1
- package/dist/extensions/vitest/plan/plan-over.d.ts +8 -1
- package/dist/extensions/vitest/plan/plan-over.js +16 -2
- package/dist/extensions.d.ts +17 -16
- package/dist/extensions.js +5 -4
- package/dist/forward-sigterm.js +1 -1
- package/dist/launcher-resolvers/local-services.d.ts +1 -1
- package/dist/live-app.js +4 -3
- package/dist/local-services.js +1 -1
- package/dist/planning/driver-file-lists.d.ts +61 -0
- package/dist/planning/driver-file-lists.js +66 -0
- package/dist/{commands/exec → planning}/driver-refusals.d.ts +11 -10
- package/dist/{commands/exec → planning}/driver-refusals.js +18 -14
- package/dist/planning/file-lists-file.d.ts +58 -0
- package/dist/planning/file-lists-file.js +105 -0
- package/dist/planning/file-lists.d.ts +28 -0
- package/dist/planning/file-lists.js +52 -0
- package/dist/{commands/exec → planning}/final-results.d.ts +1 -1
- package/dist/{commands/exec → planning}/final-results.js +6 -6
- package/dist/planning/plan-only.d.ts +84 -0
- package/dist/planning/plan-only.js +86 -0
- package/dist/{commands/exec → planning}/redaction.d.ts +2 -2
- package/dist/{commands/exec → planning}/redaction.js +5 -4
- package/dist/{commands/exec → planning}/resource-flags.d.ts +5 -12
- package/dist/{commands/exec → planning}/resource-flags.js +6 -16
- package/dist/planning/run-kind-flags.d.ts +20 -0
- package/dist/planning/run-kind-flags.js +48 -0
- package/dist/planning/run-plan.d.ts +29 -0
- package/dist/planning/run-plan.js +4 -0
- package/dist/planning/sandbox-placeholders.d.ts +22 -0
- package/dist/planning/sandbox-placeholders.js +60 -0
- package/dist/planning/suite-not-found.d.ts +37 -0
- package/dist/planning/suite-not-found.js +36 -0
- package/dist/planning/suites.d.ts +43 -0
- package/dist/planning/suites.js +89 -0
- package/dist/{commands/exec → planning}/test-plan.d.ts +8 -3
- package/dist/{commands/exec → planning}/test-plan.js +32 -5
- package/dist/playwright/reporter.d.ts +20 -8
- package/dist/playwright/reporter.js +195 -15
- package/dist/presentation.d.ts +10 -6
- package/dist/presentation.js +13 -15
- package/dist/run-directory/gateways.d.ts +60 -4
- package/dist/run-directory/index.d.ts +4 -4
- package/dist/run-directory/index.js +2 -1
- package/dist/run-directory/live/run-directory-gateway.js +92 -16
- package/dist/run-directory/plan.d.ts +35 -2
- package/dist/run-directory/plan.js +44 -7
- package/dist/run-directory/reader.d.ts +26 -5
- package/dist/run-directory/reader.js +24 -1
- package/dist/run-directory/recording.d.ts +75 -49
- package/dist/run-directory/recording.js +214 -28
- package/dist/run-directory/run-directory.d.ts +22 -1
- package/dist/run-directory/run-directory.js +24 -0
- package/dist/run-directory/run-record.d.ts +144 -21
- package/dist/run-directory/run-record.js +118 -19
- package/dist/run-directory/timeline-facts.js +4 -4
- package/dist/runner/base.d.ts +0 -6
- package/dist/runner/base.js +0 -15
- package/dist/runner/build-snapshots.d.ts +7 -7
- package/dist/runner/build-snapshots.js +19 -24
- package/dist/runner/events.d.ts +29 -8
- package/dist/runner/gateways.d.ts +54 -6
- package/dist/runner/index.d.ts +6 -4
- package/dist/runner/index.js +3 -2
- package/dist/runner/live/sandbox-gateway.js +173 -31
- package/dist/runner/network-policy.d.ts +55 -0
- package/dist/runner/network-policy.js +46 -0
- package/dist/runner/policy-writes.d.ts +40 -0
- package/dist/runner/policy-writes.js +124 -0
- package/dist/runner/prepare.d.ts +16 -16
- package/dist/runner/prepare.js +11 -12
- package/dist/runner/ready.d.ts +39 -10
- package/dist/runner/ready.js +59 -47
- package/dist/runner/recipe-check.d.ts +6 -0
- package/dist/runner/recipe-check.js +29 -0
- package/dist/runner/recipe-secrets.d.ts +67 -0
- package/dist/runner/recipe-secrets.js +230 -0
- package/dist/runner/recipe.d.ts +151 -63
- package/dist/runner/recipe.js +277 -200
- package/dist/runner/sandboxed-command.d.ts +22 -8
- package/dist/runner/sandboxed-command.js +33 -10
- package/dist/runner/scope.d.ts +107 -21
- package/dist/runner/scope.js +274 -54
- package/dist/runner/secrets.d.ts +42 -31
- package/dist/runner/secrets.js +62 -40
- package/dist/runner/session.d.ts +59 -26
- package/dist/runner/session.js +82 -41
- package/dist/runner/snapshot-build.d.ts +8 -5
- package/dist/runner/snapshot-build.js +56 -29
- package/dist/runner/snapshot-choice.d.ts +37 -0
- package/dist/runner/snapshot-choice.js +38 -0
- package/dist/runner/snapshot-inspect.d.ts +4 -4
- package/dist/runner/snapshot-inspect.js +7 -7
- package/dist/runner/snapshot-key.d.ts +27 -17
- package/dist/runner/snapshot-key.js +51 -26
- package/dist/runner/steps.d.ts +13 -5
- package/dist/runner/steps.js +34 -4
- package/dist/runner/time-limit.d.ts +10 -0
- package/dist/runner/time-limit.js +43 -0
- package/dist/sdk/extension/commands.d.ts +1 -7
- package/dist/sdk/extension/driver.d.ts +39 -46
- package/dist/sdk/extension/driver.js +6 -6
- package/dist/sdk/extension/index.d.ts +3 -3
- package/dist/sdk/extension/index.js +3 -4
- package/dist/sdk/extension/lifecycle.d.ts +52 -9
- package/dist/sdk/extension/lifecycle.js +1 -1
- package/dist/sdk/extension/resource-definition.d.ts +16 -12
- package/dist/sdk/extension/resource-definition.js +10 -4
- package/dist/sdk/extension/resource-factory.js +3 -4
- package/dist/sdk/extension/resource.d.ts +2 -2
- package/dist/sdk/extension/secret-source.d.ts +58 -0
- package/dist/sdk/extension/secret-source.js +78 -0
- package/dist/sdk/index.d.ts +2 -2
- package/dist/sdk/index.js +1 -1
- package/dist/sdk/run/launcher.d.ts +1 -1
- package/dist/sdk/run/launcher.js +1 -1
- package/dist/sdk/run/payload.d.ts +16 -1
- package/dist/sdk/run/payload.js +17 -2
- package/dist/sdk/run/present.d.ts +3 -3
- package/dist/sdk/run/present.js +1 -3
- package/dist/sdk/run/redact.js +2 -2
- package/dist/sdk/run/test-events.d.ts +23 -6
- package/dist/sdk/run/test-events.js +6 -4
- package/dist/sdk/run/test-result-writer.d.ts +8 -3
- package/dist/sdk/run/test-result-writer.js +22 -2
- package/dist/{commands/exec → shared}/cleanup.d.ts +3 -3
- package/dist/{commands/exec → shared}/cleanup.js +11 -6
- package/dist/shared/job-summary.d.ts +19 -0
- package/dist/{commands/exec → shared}/job-summary.js +17 -0
- package/dist/shared/sandbox-table.d.ts +48 -0
- package/dist/shared/sandbox-table.js +109 -0
- package/dist/{commands/exec → shared}/snapshot-text.d.ts +1 -1
- package/dist/{commands/exec → shared}/tests-summary.d.ts +22 -6
- package/dist/{commands/exec → shared}/tests-summary.js +74 -31
- package/dist/{commands/exec → shared}/text.d.ts +7 -2
- package/dist/{commands/exec → shared}/text.js +9 -1
- package/dist/{commands/exec → shared}/waterfall.d.ts +8 -6
- package/dist/{commands/exec → shared}/waterfall.js +71 -24
- package/dist/shared/worker-chart.d.ts +172 -0
- package/dist/shared/worker-chart.js +623 -0
- package/dist/vitest/config.d.ts +35 -11
- package/dist/vitest/config.js +47 -14
- package/dist/vitest/index.d.ts +1 -1
- package/dist/vitest/index.js +3 -3
- package/dist/vitest/sequencer.d.ts +23 -0
- package/dist/vitest/sequencer.js +73 -0
- package/dist/vitest/setup.d.ts +1 -0
- package/dist/vitest/setup.js +34 -0
- package/dist/vitest/test-events.d.ts +32 -6
- package/dist/vitest/test-events.js +25 -5
- package/dist/vitest/test-results.d.ts +8 -3
- package/dist/vitest/test-results.js +6 -0
- package/package.json +7 -2
- package/skills/overview.md +23 -17
- package/skills/plan-runs.md +67 -0
- package/skills/read-run-output.md +51 -19
- package/dist/chunks/chunk-E3QU74NX.js +0 -49
- package/dist/chunks/chunk-HP54VHGY.js +0 -201
- package/dist/chunks/chunk-NMVODY3P.js +0 -19
- package/dist/chunks/chunk-TVMEKVOW.js +0 -607
- package/dist/commands/exec/define-run-command.d.ts +0 -671
- package/dist/commands/exec/define-run-command.js +0 -91
- package/dist/commands/exec/job-summary.d.ts +0 -10
- package/dist/commands/exec/worker-chart.d.ts +0 -87
- package/dist/commands/exec/worker-chart.js +0 -343
- package/dist/commands/playwright/command.d.ts +0 -661
- package/dist/commands/playwright/command.js +0 -31
- package/dist/commands/playwright/metadata.js +0 -8
- package/dist/commands/vitest/command.d.ts +0 -662
- package/dist/commands/vitest/command.js +0 -31
- package/dist/commands/vitest/metadata.js +0 -8
- package/dist/config/recipe-run.d.ts +0 -26
- package/dist/config/recipe-run.js +0 -27
- package/dist/sdk/extension/ci.d.ts +0 -2
- package/dist/sdk/extension/ci.js +0 -6
- package/dist/chunks/{chunk-YM6TZV4L.js → chunk-VL7WFTVQ.js} +52 -52
- package/dist/commands/{playwright → suites}/metadata.d.ts +1 -1
- package/dist/commands/{vitest → test}/metadata.d.ts +1 -1
- /package/dist/{commands → shared}/dashboard.d.ts +0 -0
- /package/dist/{commands → shared}/dashboard.js +0 -0
- /package/dist/{commands/exec → shared}/snapshot-text.js +0 -0
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
// The check of `suites` in `storm.config.ts`: each suite name matches `SUITE_NAME_PATTERN`, each suite holds only the
|
|
2
|
+
// four suite keys (`driver`, `args`, `runner`, `resources`), each `driver`, `args`, and `runner` passes the same rule
|
|
3
|
+
// as the top level (with a suite's `vercelSandbox` options merging over the top level's), and a suite with no `driver`
|
|
4
|
+
// requires a top-level `driver`.
|
|
5
|
+
import { describeValue } from "../sdk/extension/index.js";
|
|
6
|
+
import { checkResources } from "./check-resources.js";
|
|
7
|
+
import { checkSettingValue } from "./schema.js";
|
|
8
|
+
import { SUITE_NAME_PATTERN } from "./suite.js";
|
|
9
|
+
const SUITE_KEYS = new Set(["driver", "args", "runner", "resources"]);
|
|
10
|
+
/**
|
|
11
|
+
* Checks `suites` in `storm.config.ts`: each key is a valid suite name, each entry holds only `driver`, `args`,
|
|
12
|
+
* `runner`, and `resources`, every `driver` is in `drivers`, every `runner` merges over `topLevelRunnerOptions` when
|
|
13
|
+
* of the same kind, and every suite without its own `driver` requires the top level to name one (`hasTopLevelDriver`).
|
|
14
|
+
*/
|
|
15
|
+
export function checkSuites(value, options, problems) {
|
|
16
|
+
if (value === undefined)
|
|
17
|
+
return {};
|
|
18
|
+
if (!isRecord(value)) {
|
|
19
|
+
problems.push({ key: "suites", location: null, problem: `must be an object, not ${describeValue(value)}` });
|
|
20
|
+
return {};
|
|
21
|
+
}
|
|
22
|
+
const settingContext = {
|
|
23
|
+
definitions: options.definitions,
|
|
24
|
+
drivers: options.drivers,
|
|
25
|
+
topLevelRunnerOptions: options.topLevelRunnerOptions,
|
|
26
|
+
};
|
|
27
|
+
const checked = {};
|
|
28
|
+
for (const [name, raw] of Object.entries(value)) {
|
|
29
|
+
const at = `suites.${name}`;
|
|
30
|
+
if (!SUITE_NAME_PATTERN.test(name)) {
|
|
31
|
+
problems.push({
|
|
32
|
+
key: at,
|
|
33
|
+
location: null,
|
|
34
|
+
problem: "must hold only lowercase letters, digits, and hyphens, starting with a letter or a digit",
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
if (!isRecord(raw)) {
|
|
38
|
+
problems.push({ key: at, location: null, problem: `must be an object, not ${describeValue(raw)}` });
|
|
39
|
+
continue;
|
|
40
|
+
}
|
|
41
|
+
let driver;
|
|
42
|
+
let hasOwnDriverKey = false;
|
|
43
|
+
let args;
|
|
44
|
+
let runner;
|
|
45
|
+
let resources = {};
|
|
46
|
+
for (const [key, keyValue] of Object.entries(raw)) {
|
|
47
|
+
if (!SUITE_KEYS.has(key)) {
|
|
48
|
+
problems.push({ key: `${at}.${key}`, location: null, problem: "is not a suite key" });
|
|
49
|
+
continue;
|
|
50
|
+
}
|
|
51
|
+
if (keyValue === undefined)
|
|
52
|
+
continue;
|
|
53
|
+
if (key === "driver") {
|
|
54
|
+
hasOwnDriverKey = true;
|
|
55
|
+
const result = checkSettingValue("driver", keyValue, settingContext);
|
|
56
|
+
if (result.ok)
|
|
57
|
+
driver = result.value;
|
|
58
|
+
else
|
|
59
|
+
for (const { path: inside, problem } of result.problems)
|
|
60
|
+
problems.push({ key: [`${at}.driver`, ...inside].join("."), location: null, problem });
|
|
61
|
+
}
|
|
62
|
+
else if (key === "args") {
|
|
63
|
+
const result = checkSettingValue("args", keyValue, settingContext);
|
|
64
|
+
if (result.ok)
|
|
65
|
+
args = result.value;
|
|
66
|
+
else
|
|
67
|
+
for (const { path: inside, problem } of result.problems)
|
|
68
|
+
problems.push({ key: [`${at}.args`, ...inside].join("."), location: null, problem });
|
|
69
|
+
}
|
|
70
|
+
else if (key === "runner") {
|
|
71
|
+
const result = checkSettingValue("runner", keyValue, settingContext);
|
|
72
|
+
if (result.ok)
|
|
73
|
+
runner = result.value;
|
|
74
|
+
else
|
|
75
|
+
for (const { path: inside, problem } of result.problems)
|
|
76
|
+
problems.push({ key: [`${at}.runner`, ...inside].join("."), location: null, problem });
|
|
77
|
+
}
|
|
78
|
+
else if (key === "resources") {
|
|
79
|
+
resources = checkResources(keyValue, options.definitions, problems, `${at}.resources`);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
if (!hasOwnDriverKey && !options.hasTopLevelDriver) {
|
|
83
|
+
problems.push({
|
|
84
|
+
key: `${at}.driver`,
|
|
85
|
+
location: null,
|
|
86
|
+
problem: "must name a driver when the top level names none",
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
checked[name] = {
|
|
90
|
+
...(driver === undefined ? {} : { driver }),
|
|
91
|
+
...(args === undefined ? {} : { args }),
|
|
92
|
+
...(runner === undefined ? {} : { runner }),
|
|
93
|
+
resources,
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
return checked;
|
|
97
|
+
}
|
|
98
|
+
function isRecord(value) {
|
|
99
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
100
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ConfigFileName } from "./schema.ts";
|
|
1
2
|
/** Where Node said an import failed, in the config file: a line, and a column when it gave one. */
|
|
2
3
|
export interface ConfigLocation {
|
|
3
4
|
readonly line: number;
|
|
@@ -21,12 +22,39 @@ export type ConfigImport = {
|
|
|
21
22
|
readonly message: string;
|
|
22
23
|
readonly location?: ConfigLocation;
|
|
23
24
|
};
|
|
24
|
-
/** What finding and loading
|
|
25
|
+
/** What finding and loading the config file needs from the world. No method rejects. */
|
|
25
26
|
export interface ConfigGateway {
|
|
26
|
-
/**
|
|
27
|
-
|
|
27
|
+
/**
|
|
28
|
+
* The config file names (`CONFIG_FILE_NAMES`) that `directory` holds as files, in that list's order. A directory
|
|
29
|
+
* storm can't read holds none.
|
|
30
|
+
*/
|
|
31
|
+
configFileNames(directory: string): Promise<readonly ConfigFileName[]>;
|
|
28
32
|
/** Whether `directory` is a git worktree's root: it holds `.git`, a directory or a file. */
|
|
29
33
|
isWorktreeRoot(directory: string): Promise<boolean>;
|
|
30
34
|
/** Imports the config file at `path`, running it. */
|
|
31
35
|
importConfig(path: string): Promise<ConfigImport>;
|
|
32
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
* What reading a caller's file lists file (`--file-lists <path>`) gave:
|
|
39
|
+
*
|
|
40
|
+
* - `read`: the file's JSON, parsed, whatever its shape; the caller checks the shape.
|
|
41
|
+
* - `unreadable`: the file can't be read, such as a path with no file. `message` is the OS's.
|
|
42
|
+
* - `not-json`: the file's text is not JSON. `message` is the parser's.
|
|
43
|
+
*/
|
|
44
|
+
export type FileListsFileRead = {
|
|
45
|
+
readonly kind: "read";
|
|
46
|
+
readonly value: unknown;
|
|
47
|
+
} | {
|
|
48
|
+
readonly kind: "unreadable";
|
|
49
|
+
readonly message: string;
|
|
50
|
+
} | {
|
|
51
|
+
readonly kind: "not-json";
|
|
52
|
+
readonly message: string;
|
|
53
|
+
};
|
|
54
|
+
/** What reading a caller's file lists file needs from the world. No method rejects. */
|
|
55
|
+
export interface FileListsFileGateway {
|
|
56
|
+
/** Reads the file lists file at the absolute path `path`, or stdin when `path` is `"-"`, and parses its JSON. */
|
|
57
|
+
readFileListsFile(request: {
|
|
58
|
+
readonly path: string;
|
|
59
|
+
}): Promise<FileListsFileRead>;
|
|
60
|
+
}
|
package/dist/config/index.d.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
export { type CommandCredentialSource, type CredentialReport, credentialResolver, type CredentialResolver, credentialSourceError, type CredentialSourceError, credentialSourceErrors, type CredentialTarget, } from "./credential-resolver.ts";
|
|
2
2
|
export { credentialErrors, requireTarget, settleCredential } from "./credential-settle.ts";
|
|
3
3
|
export { configErrors, configProblemLine, optionProblemLine } from "./errors.ts";
|
|
4
|
-
export type { ConfigGateway, ConfigImport, ConfigLocation } from "./gateways.ts";
|
|
4
|
+
export type { ConfigGateway, ConfigImport, ConfigLocation, FileListsFileGateway, FileListsFileRead, } from "./gateways.ts";
|
|
5
5
|
export { liveConfigGateway } from "./live/config-gateway.ts";
|
|
6
|
-
export {
|
|
7
|
-
export { type
|
|
6
|
+
export { liveFileListsFileGateway } from "./live/file-lists-file-gateway.ts";
|
|
7
|
+
export { type ConfigFileLookup, type ConfigProblem, type ConfigValues, findConfigFile, type LoadedConfig, loadConfig, } from "./load.ts";
|
|
8
8
|
export { type MergedResourceOptions, type MergedRunResources, mergeRunResources, mergeResourceOptions, type PlannedOption, type ResolvedResourceOptions, type ResolvedResourceRecord, type ResolvedSettings, resolveSettings, type ResourceFlagOptions, type ResourceOptionProblem, type ResourceRecord, type SettingFlags, } from "./resolve.ts";
|
|
9
|
-
export
|
|
10
|
-
export { type
|
|
11
|
-
export {
|
|
9
|
+
export type { CheckedRunner, LaunchMachineRunner, RunnerConfig, RunnerKind, SuiteRunnerConfig, VercelSandboxRunner, } from "./runner.ts";
|
|
10
|
+
export { type CheckedSettings, checkWith, CONFIG_FILE_NAME, CONFIG_FILE_NAMES, CONFIG_FILE_NAMES_TEXT, CONFIG_SETTING_KEYS, type ConfigFileName, type ConfigKey, type ConfigSettingKey, type ConfigSettings, type SettingValue, } from "./schema.ts";
|
|
11
|
+
export { type ConfigLoadError, type ConfigResolver, configResolver, type LoadedResourceSettings, type StormConfigResolver, type TargetSettings, } from "./resolver.ts";
|
|
12
|
+
export { effectiveConfig, fileOptions, fileSettings, invalidConfig, invalidResourceOptions, loadSettingsFile, type SettingsFile, settleRunResources, } from "./settings-file.ts";
|
|
13
|
+
export { type CheckedSuite, type CheckedSuiteMap, SUITE_NAME_PATTERN, type SuiteConfig, type SuiteConfigMap, } from "./suite.ts";
|
package/dist/config/index.js
CHANGED
|
@@ -9,9 +9,10 @@ export { credentialResolver, credentialSourceError, credentialSourceErrors, } fr
|
|
|
9
9
|
export { credentialErrors, requireTarget, settleCredential } from "./credential-settle.js";
|
|
10
10
|
export { configErrors, configProblemLine, optionProblemLine } from "./errors.js";
|
|
11
11
|
export { liveConfigGateway } from "./live/config-gateway.js";
|
|
12
|
-
export {
|
|
13
|
-
export {
|
|
12
|
+
export { liveFileListsFileGateway } from "./live/file-lists-file-gateway.js";
|
|
13
|
+
export { findConfigFile, loadConfig, } from "./load.js";
|
|
14
14
|
export { mergeRunResources, mergeResourceOptions, resolveSettings, } from "./resolve.js";
|
|
15
|
-
export { checkWith, CONFIG_FILE_NAME, CONFIG_SETTING_KEYS, } from "./schema.js";
|
|
15
|
+
export { checkWith, CONFIG_FILE_NAME, CONFIG_FILE_NAMES, CONFIG_FILE_NAMES_TEXT, CONFIG_SETTING_KEYS, } from "./schema.js";
|
|
16
16
|
export { configResolver, } from "./resolver.js";
|
|
17
|
-
export { fileOptions, fileSettings, invalidConfig, invalidResourceOptions, loadSettingsFile, settleRunResources, } from "./settings-file.js";
|
|
17
|
+
export { effectiveConfig, fileOptions, fileSettings, invalidConfig, invalidResourceOptions, loadSettingsFile, settleRunResources, } from "./settings-file.js";
|
|
18
|
+
export { SUITE_NAME_PATTERN, } from "./suite.js";
|
|
@@ -9,14 +9,17 @@ var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExte
|
|
|
9
9
|
import { stat } from "node:fs/promises";
|
|
10
10
|
import { basename, join } from "node:path";
|
|
11
11
|
import { pathToFileURL } from "node:url";
|
|
12
|
-
import {
|
|
12
|
+
import { CONFIG_FILE_NAMES } from "../schema.js";
|
|
13
13
|
/**
|
|
14
14
|
* The live config gateway: `stat` for the config file and `.git`, and a plain `import()`, so Node's own type
|
|
15
15
|
* stripping loads the file. Node caches a module by its URL, so a process imports each config file once.
|
|
16
16
|
*/
|
|
17
17
|
export function liveConfigGateway() {
|
|
18
18
|
return {
|
|
19
|
-
|
|
19
|
+
configFileNames: async (directory) => {
|
|
20
|
+
const kinds = await Promise.all(CONFIG_FILE_NAMES.map((name) => kind(join(directory, name))));
|
|
21
|
+
return CONFIG_FILE_NAMES.filter((_, index) => kinds[index] === "file");
|
|
22
|
+
},
|
|
20
23
|
isWorktreeRoot: async (directory) => (await kind(join(directory, ".git"))) !== undefined,
|
|
21
24
|
importConfig: async (path) => {
|
|
22
25
|
try {
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Readable } from "node:stream";
|
|
2
|
+
import type { FileListsFileGateway } from "../gateways.ts";
|
|
3
|
+
/** The live file lists file gateway: reads UTF-8 from `path` (or `stdin` when `path` is `"-"`), then `JSON.parse`. */
|
|
4
|
+
export declare function liveFileListsFileGateway(stdin?: Readable): FileListsFileGateway;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { readFile } from "node:fs/promises";
|
|
2
|
+
async function readStream(stream) {
|
|
3
|
+
const chunks = [];
|
|
4
|
+
for await (const chunk of stream)
|
|
5
|
+
chunks.push(typeof chunk === "string" ? Buffer.from(chunk) : chunk);
|
|
6
|
+
return Buffer.concat(chunks).toString("utf8");
|
|
7
|
+
}
|
|
8
|
+
/** The live file lists file gateway: reads UTF-8 from `path` (or `stdin` when `path` is `"-"`), then `JSON.parse`. */
|
|
9
|
+
export function liveFileListsFileGateway(stdin = process.stdin) {
|
|
10
|
+
return {
|
|
11
|
+
readFileListsFile: async ({ path }) => {
|
|
12
|
+
let text;
|
|
13
|
+
try {
|
|
14
|
+
text = path === "-" ? await readStream(stdin) : await readFile(path, "utf8");
|
|
15
|
+
}
|
|
16
|
+
catch (error) {
|
|
17
|
+
return { kind: "unreadable", message: error instanceof Error ? error.message : String(error) };
|
|
18
|
+
}
|
|
19
|
+
try {
|
|
20
|
+
return { kind: "read", value: JSON.parse(text) };
|
|
21
|
+
}
|
|
22
|
+
catch (error) {
|
|
23
|
+
return { kind: "not-json", message: error instanceof Error ? error.message : String(error) };
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
}
|
package/dist/config/load.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import type { ConfigGateway, ConfigLocation } from "./gateways.ts";
|
|
2
1
|
import { type ResourceDefinition } from "../sdk/extension/index.ts";
|
|
3
|
-
import {
|
|
2
|
+
import type { ConfigGateway, ConfigLocation } from "./gateways.ts";
|
|
4
3
|
import type { ResourceRecord } from "./resolve.ts";
|
|
4
|
+
import { type CheckedSettings } from "./schema.ts";
|
|
5
|
+
import type { CheckedSuiteMap } from "./suite.ts";
|
|
5
6
|
/**
|
|
6
7
|
* One thing wrong with a config file: the key it is about (`null` when none is), where Node said an import failed
|
|
7
8
|
* (`null` otherwise), and the problem, worded to follow the key or the file name.
|
|
@@ -12,15 +13,15 @@ export interface ConfigProblem {
|
|
|
12
13
|
readonly problem: string;
|
|
13
14
|
}
|
|
14
15
|
/**
|
|
15
|
-
* What a loaded config file gave, every value checked: its top-level settings,
|
|
16
|
-
*
|
|
17
|
-
* with no options has empty options.
|
|
16
|
+
* What a loaded config file gave, every value checked: its top-level settings, each resource it has by resource key,
|
|
17
|
+
* and each suite it declares under `suites`. A resource the file holds with no options has empty options.
|
|
18
18
|
*/
|
|
19
19
|
export interface ConfigValues {
|
|
20
20
|
readonly settings: CheckedSettings;
|
|
21
21
|
readonly resources: {
|
|
22
22
|
readonly [key: string]: ResourceRecord;
|
|
23
23
|
};
|
|
24
|
+
readonly suites: CheckedSuiteMap;
|
|
24
25
|
}
|
|
25
26
|
/**
|
|
26
27
|
* What `loadConfig` found:
|
|
@@ -41,17 +42,34 @@ export type LoadedConfig = {
|
|
|
41
42
|
readonly problems: readonly ConfigProblem[];
|
|
42
43
|
};
|
|
43
44
|
/**
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
45
|
+
* What `findConfigFile` found:
|
|
46
|
+
*
|
|
47
|
+
* - `none`: no directory it looked in holds a config file.
|
|
48
|
+
* - `found`: the config file at `path`.
|
|
49
|
+
* - `conflict`: the nearest directory holding a config file holds more than one, at `paths`, in `CONFIG_FILE_NAMES`
|
|
50
|
+
* order. storm picks none of them.
|
|
51
|
+
*/
|
|
52
|
+
export type ConfigFileLookup = {
|
|
53
|
+
readonly kind: "none";
|
|
54
|
+
} | {
|
|
55
|
+
readonly kind: "found";
|
|
56
|
+
readonly path: string;
|
|
57
|
+
} | {
|
|
58
|
+
readonly kind: "conflict";
|
|
59
|
+
readonly paths: readonly [string, string, ...string[]];
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* Finds the config file for `startDirectory` (absolute): `storm.config.ts` or `storm.config.mts` in it, then in each
|
|
63
|
+
* parent up to the git worktree's root, the first directory holding `.git`; outside a git worktree, only in
|
|
64
|
+
* `startDirectory`. The nearest directory holding one wins, and it must hold only one.
|
|
47
65
|
*/
|
|
48
|
-
export declare function findConfigFile(gateway: ConfigGateway, startDirectory: string): Promise<
|
|
66
|
+
export declare function findConfigFile(gateway: ConfigGateway, startDirectory: string): Promise<ConfigFileLookup>;
|
|
49
67
|
/**
|
|
50
68
|
* Finds and imports the config file for `startDirectory` (see `findConfigFile`), and checks all of it, whatever
|
|
51
69
|
* command reads it. The file must default-export an object holding only known keys, each top-level setting by its
|
|
52
|
-
* rule,
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
70
|
+
* rule, a `resources` object holding only resources of `definitions`, and a `suites` object whose drivers are in
|
|
71
|
+
* `drivers` (when passed) and whose suites without a driver sit under a top-level `driver`. Every problem found goes
|
|
72
|
+
* into one `invalid`. Whether a resource's options fit together, and whether a required one is given, waits for the
|
|
73
|
+
* merge with the flags (`mergeRunResources`) and its plan.
|
|
56
74
|
*/
|
|
57
|
-
export declare function loadConfig(gateway: ConfigGateway, startDirectory: string, definitions: readonly ResourceDefinition[]): Promise<LoadedConfig>;
|
|
75
|
+
export declare function loadConfig(gateway: ConfigGateway, startDirectory: string, definitions: readonly ResourceDefinition[], drivers: readonly string[]): Promise<LoadedConfig>;
|
package/dist/config/load.js
CHANGED
|
@@ -1,24 +1,37 @@
|
|
|
1
|
-
import { dirname, join } from "node:path";
|
|
2
|
-
import { defaultResourceKey, resourceCall } from "../sdk/extension/index.js";
|
|
1
|
+
import { basename, dirname, join } from "node:path";
|
|
3
2
|
import { describeValue } from "../sdk/extension/index.js";
|
|
4
|
-
import {
|
|
3
|
+
import { checkResources } from "./check-resources.js";
|
|
4
|
+
import { rawVercelSandboxOptions } from "./check-runner.js";
|
|
5
|
+
import { checkSuites } from "./check-suites.js";
|
|
6
|
+
import { checkSettingValue, isConfigSettingKey, } from "./schema.js";
|
|
5
7
|
/**
|
|
6
|
-
* Finds the config file for `startDirectory` (absolute): `storm.config.ts` in it, then in each
|
|
7
|
-
* git worktree's root, the first directory holding `.git`; outside a git worktree, only in
|
|
8
|
-
*
|
|
8
|
+
* Finds the config file for `startDirectory` (absolute): `storm.config.ts` or `storm.config.mts` in it, then in each
|
|
9
|
+
* parent up to the git worktree's root, the first directory holding `.git`; outside a git worktree, only in
|
|
10
|
+
* `startDirectory`. The nearest directory holding one wins, and it must hold only one.
|
|
9
11
|
*/
|
|
10
12
|
export async function findConfigFile(gateway, startDirectory) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
+
const here = await lookIn(gateway, startDirectory);
|
|
14
|
+
if (here !== undefined)
|
|
15
|
+
return here;
|
|
13
16
|
const root = await worktreeRoot(gateway, startDirectory);
|
|
14
17
|
if (root === undefined)
|
|
15
|
-
return
|
|
18
|
+
return { kind: "none" };
|
|
16
19
|
for (let directory = startDirectory; directory !== root;) {
|
|
17
20
|
directory = dirname(directory);
|
|
18
|
-
|
|
19
|
-
|
|
21
|
+
const found = await lookIn(gateway, directory);
|
|
22
|
+
if (found !== undefined)
|
|
23
|
+
return found;
|
|
20
24
|
}
|
|
21
|
-
return
|
|
25
|
+
return { kind: "none" };
|
|
26
|
+
}
|
|
27
|
+
/** What `directory` holds: one config file, a conflict, or nothing (undefined). */
|
|
28
|
+
async function lookIn(gateway, directory) {
|
|
29
|
+
const [first, second, ...rest] = (await gateway.configFileNames(directory)).map((name) => join(directory, name));
|
|
30
|
+
if (first === undefined)
|
|
31
|
+
return undefined;
|
|
32
|
+
if (second === undefined)
|
|
33
|
+
return { kind: "found", path: first };
|
|
34
|
+
return { kind: "conflict", paths: [first, second, ...rest] };
|
|
22
35
|
}
|
|
23
36
|
/** The nearest directory at or above `directory` holding `.git`, if any. */
|
|
24
37
|
async function worktreeRoot(gateway, directory) {
|
|
@@ -32,15 +45,27 @@ async function worktreeRoot(gateway, directory) {
|
|
|
32
45
|
/**
|
|
33
46
|
* Finds and imports the config file for `startDirectory` (see `findConfigFile`), and checks all of it, whatever
|
|
34
47
|
* command reads it. The file must default-export an object holding only known keys, each top-level setting by its
|
|
35
|
-
* rule,
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
48
|
+
* rule, a `resources` object holding only resources of `definitions`, and a `suites` object whose drivers are in
|
|
49
|
+
* `drivers` (when passed) and whose suites without a driver sit under a top-level `driver`. Every problem found goes
|
|
50
|
+
* into one `invalid`. Whether a resource's options fit together, and whether a required one is given, waits for the
|
|
51
|
+
* merge with the flags (`mergeRunResources`) and its plan.
|
|
39
52
|
*/
|
|
40
|
-
export async function loadConfig(gateway, startDirectory, definitions) {
|
|
41
|
-
const
|
|
42
|
-
if (
|
|
53
|
+
export async function loadConfig(gateway, startDirectory, definitions, drivers) {
|
|
54
|
+
const found = await findConfigFile(gateway, startDirectory);
|
|
55
|
+
if (found.kind === "none")
|
|
43
56
|
return { kind: "none" };
|
|
57
|
+
if (found.kind === "conflict") {
|
|
58
|
+
const [path, ...others] = found.paths;
|
|
59
|
+
const names = others.map((other) => basename(other)).join(" and ");
|
|
60
|
+
return {
|
|
61
|
+
kind: "invalid",
|
|
62
|
+
path,
|
|
63
|
+
problems: [
|
|
64
|
+
fileProblem(`is in the same directory as ${names}, so storm can't tell which config file applies; keep one of them`),
|
|
65
|
+
],
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
const { path } = found;
|
|
44
69
|
const imported = await gateway.importConfig(path);
|
|
45
70
|
switch (imported.kind) {
|
|
46
71
|
case "import-failed":
|
|
@@ -56,10 +81,10 @@ export async function loadConfig(gateway, startDirectory, definitions) {
|
|
|
56
81
|
problems: [fileProblem("has no default export; export default defineConfig({ … })")],
|
|
57
82
|
};
|
|
58
83
|
case "default-export":
|
|
59
|
-
return checkFile(path, imported.value, definitions);
|
|
84
|
+
return checkFile(path, imported.value, definitions, drivers);
|
|
60
85
|
}
|
|
61
86
|
}
|
|
62
|
-
function checkFile(path, value, definitions) {
|
|
87
|
+
function checkFile(path, value, definitions, drivers) {
|
|
63
88
|
if (!isRecord(value))
|
|
64
89
|
return {
|
|
65
90
|
kind: "invalid",
|
|
@@ -69,23 +94,133 @@ function checkFile(path, value, definitions) {
|
|
|
69
94
|
const settings = {};
|
|
70
95
|
const problems = [];
|
|
71
96
|
let resources = {};
|
|
97
|
+
let rawSuites;
|
|
98
|
+
let hasSuitesKey = false;
|
|
99
|
+
const settingContext = { definitions, drivers };
|
|
100
|
+
const hasTopLevelDriver = value["driver"] !== undefined;
|
|
72
101
|
for (const [key, keyValue] of Object.entries(value)) {
|
|
73
102
|
if (key === "resources")
|
|
74
|
-
resources = checkResources(keyValue, definitions, problems);
|
|
103
|
+
resources = checkResources(keyValue, definitions, problems, "resources");
|
|
104
|
+
else if (key === "suites") {
|
|
105
|
+
hasSuitesKey = true;
|
|
106
|
+
rawSuites = keyValue;
|
|
107
|
+
}
|
|
75
108
|
else if (isConfigSettingKey(key)) {
|
|
76
109
|
if (keyValue !== undefined)
|
|
77
|
-
checkSetting(key, keyValue, settings, problems);
|
|
110
|
+
checkSetting(key, keyValue, settings, settingContext, problems);
|
|
78
111
|
}
|
|
79
112
|
else
|
|
80
|
-
problems.push({ key, location: null, problem: `is not a ${
|
|
113
|
+
problems.push({ key, location: null, problem: `is not a ${basename(path)} key` });
|
|
114
|
+
}
|
|
115
|
+
if (settings.args !== undefined && !hasTopLevelDriver) {
|
|
116
|
+
problems.push({ key: "args", location: null, problem: "requires a top-level driver" });
|
|
81
117
|
}
|
|
118
|
+
const suites = hasSuitesKey
|
|
119
|
+
? checkSuites(rawSuites, {
|
|
120
|
+
definitions,
|
|
121
|
+
drivers,
|
|
122
|
+
hasTopLevelDriver,
|
|
123
|
+
topLevelRunnerOptions: rawVercelSandboxOptions(value["runner"]),
|
|
124
|
+
}, problems)
|
|
125
|
+
: {};
|
|
126
|
+
checkPlainData(value, problems);
|
|
82
127
|
if (problems.length > 0)
|
|
83
128
|
return { kind: "invalid", path, problems };
|
|
84
|
-
return { kind: "loaded", path, values: { settings, resources } };
|
|
129
|
+
return { kind: "loaded", path, values: { settings, resources, suites } };
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Refuses any value JSON cannot hold anywhere in the loaded config object: functions, symbols, bigints, non-finite
|
|
133
|
+
* numbers (`NaN`, `Infinity`), `undefined` array elements, non-plain objects (such as `Date`, `RegExp`, `Map`, `Set`,
|
|
134
|
+
* or class instances), and circular references. Paths already reported by schema checks (such as a function at
|
|
135
|
+
* `runner.vcpus`, whose schema check names the declared form) are not duplicated.
|
|
136
|
+
*/
|
|
137
|
+
function checkPlainData(root, problems) {
|
|
138
|
+
const reported = new Set(problems.map(({ key }) => key).filter((key) => key !== null));
|
|
139
|
+
const visiting = new Set();
|
|
140
|
+
const addProblem = (path, problem) => {
|
|
141
|
+
const key = path.join(".");
|
|
142
|
+
if (reported.has(key))
|
|
143
|
+
return;
|
|
144
|
+
reported.add(key);
|
|
145
|
+
problems.push({ key: key.length === 0 ? null : key, location: null, problem });
|
|
146
|
+
};
|
|
147
|
+
const visit = (current, path) => {
|
|
148
|
+
if (current === null || typeof current === "string" || typeof current === "boolean")
|
|
149
|
+
return;
|
|
150
|
+
if (current === undefined) {
|
|
151
|
+
addProblem(path, "must be plain data (JSON cannot hold undefined in an array)");
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
if (typeof current === "number") {
|
|
155
|
+
if (!Number.isFinite(current))
|
|
156
|
+
addProblem(path, `must be plain data (JSON cannot hold ${String(current)})`);
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
if (typeof current === "function") {
|
|
160
|
+
addProblem(path, "must be plain data (JSON cannot hold a function)");
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
if (typeof current === "symbol") {
|
|
164
|
+
addProblem(path, "must be plain data (JSON cannot hold a symbol)");
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
if (typeof current === "bigint") {
|
|
168
|
+
addProblem(path, "must be plain data (JSON cannot hold a bigint)");
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
if (typeof current !== "object")
|
|
172
|
+
return;
|
|
173
|
+
if (visiting.has(current)) {
|
|
174
|
+
addProblem(path, "must be plain data (circular reference)");
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
if (Array.isArray(current)) {
|
|
178
|
+
visiting.add(current);
|
|
179
|
+
for (let index = 0; index < current.length; index += 1)
|
|
180
|
+
visit(current[index], [...path, String(index)]);
|
|
181
|
+
visiting.delete(current);
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
const proto = Object.getPrototypeOf(current);
|
|
185
|
+
if (proto !== Object.prototype && proto !== null) {
|
|
186
|
+
addProblem(path, `must be plain data (expected a plain object, not ${describeNonPlainObject(proto)})`);
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
visiting.add(current);
|
|
190
|
+
const isRunnerWrapper = (path.length === 1 && path[0] === "runner") ||
|
|
191
|
+
(path.length === 3 && path[0] === "suites" && path[2] === "runner");
|
|
192
|
+
const unwrapRunnerOptions = isRunnerWrapper && current["kind"] === "vercel-sandbox";
|
|
193
|
+
const isResourceWrapper = (path.length === 2 && path[0] === "resources") ||
|
|
194
|
+
(path.length === 4 && path[0] === "suites" && path[2] === "resources");
|
|
195
|
+
const unwrapResourceOptions = isResourceWrapper && typeof current["name"] === "string";
|
|
196
|
+
for (const [key, entry] of Object.entries(current)) {
|
|
197
|
+
if (entry === undefined)
|
|
198
|
+
continue;
|
|
199
|
+
if ((unwrapRunnerOptions || unwrapResourceOptions) && key === "options" && isPlainObject(entry)) {
|
|
200
|
+
visit(entry, path);
|
|
201
|
+
continue;
|
|
202
|
+
}
|
|
203
|
+
visit(entry, [...path, key]);
|
|
204
|
+
}
|
|
205
|
+
visiting.delete(current);
|
|
206
|
+
};
|
|
207
|
+
visit(root, []);
|
|
208
|
+
}
|
|
209
|
+
function isPlainObject(value) {
|
|
210
|
+
if (typeof value !== "object" || value === null || Array.isArray(value))
|
|
211
|
+
return false;
|
|
212
|
+
const proto = Object.getPrototypeOf(value);
|
|
213
|
+
return proto === Object.prototype || proto === null;
|
|
214
|
+
}
|
|
215
|
+
function describeNonPlainObject(proto) {
|
|
216
|
+
const ctor = typeof proto === "object" && proto !== null ? proto.constructor : undefined;
|
|
217
|
+
if (typeof ctor === "function" && ctor.name.length > 0 && ctor.name !== "Object")
|
|
218
|
+
return ctor.name;
|
|
219
|
+
return "a non-plain object";
|
|
85
220
|
}
|
|
86
221
|
/** Checks one top-level setting, putting its value in `settings` or each thing wrong with it onto `problems`. */
|
|
87
|
-
function checkSetting(key, value, settings, problems) {
|
|
88
|
-
const checked = checkSettingValue(key, value);
|
|
222
|
+
function checkSetting(key, value, settings, context, problems) {
|
|
223
|
+
const checked = checkSettingValue(key, value, context);
|
|
89
224
|
// `Object.assign`, since TypeScript can't relate a union key's value to the mapped type's entry for that key.
|
|
90
225
|
if (checked.ok)
|
|
91
226
|
Object.assign(settings, { [key]: checked.value });
|
|
@@ -93,95 +228,6 @@ function checkSetting(key, value, settings, problems) {
|
|
|
93
228
|
for (const { path: inside, problem } of checked.problems)
|
|
94
229
|
problems.push({ key: [key, ...inside].join("."), location: null, problem });
|
|
95
230
|
}
|
|
96
|
-
/**
|
|
97
|
-
* Each resource `resources` holds, by resource key, its options checked; empty when the file sets `resources`
|
|
98
|
-
* to undefined. Each thing wrong is pushed onto `problems`: a `resources` that isn't an object, a key no definition
|
|
99
|
-
* names, a value that isn't a resource its definition made, a resource whose key isn't its definition's name (for now a
|
|
100
|
-
* config file holds only default resources), an unknown option, or a value its option's rule refuses.
|
|
101
|
-
*/
|
|
102
|
-
function checkResources(value, definitions, problems) {
|
|
103
|
-
if (value === undefined)
|
|
104
|
-
return {};
|
|
105
|
-
if (!isRecord(value)) {
|
|
106
|
-
problems.push({ key: "resources", location: null, problem: `must be an object, not ${describeValue(value)}` });
|
|
107
|
-
return {};
|
|
108
|
-
}
|
|
109
|
-
const byName = new Map(definitions.map((definition) => [definition.name, definition]));
|
|
110
|
-
const holds = definitions.length === 0 ? "none" : definitions.map((each) => each.name).join(", ");
|
|
111
|
-
const found = {};
|
|
112
|
-
for (const [key, resource] of Object.entries(value)) {
|
|
113
|
-
const named = entryName(resource);
|
|
114
|
-
// The definition a resource names, when storm knows it; else the one the key names, which must have made it.
|
|
115
|
-
const definition = byName.get(named !== undefined && byName.has(named) ? named : key);
|
|
116
|
-
// A resource under a key other than its definition's name: `defineConfig` refuses it in the editor, and a file
|
|
117
|
-
// that skips `defineConfig` is refused here.
|
|
118
|
-
if (named !== undefined && definition !== undefined && key !== defaultResourceKey(definition)) {
|
|
119
|
-
problems.push({
|
|
120
|
-
key: `resources.${key}`,
|
|
121
|
-
location: null,
|
|
122
|
-
problem: `holds a ${named} resource; for now a resource's key must be its definition's name: name its key ${defaultResourceKey(definition)}`,
|
|
123
|
-
});
|
|
124
|
-
continue;
|
|
125
|
-
}
|
|
126
|
-
if (definition === undefined) {
|
|
127
|
-
problems.push({
|
|
128
|
-
key: `resources.${key}`,
|
|
129
|
-
location: null,
|
|
130
|
-
problem: `is not a resource; resources holds ${holds}`,
|
|
131
|
-
});
|
|
132
|
-
continue;
|
|
133
|
-
}
|
|
134
|
-
if (resource === undefined)
|
|
135
|
-
continue;
|
|
136
|
-
const options = checkResource(definition, key, resource, problems);
|
|
137
|
-
if (options !== undefined)
|
|
138
|
-
found[key] = { definition: definition.name, options };
|
|
139
|
-
}
|
|
140
|
-
return found;
|
|
141
|
-
}
|
|
142
|
-
/** The definition's name `value` carries, when it is shaped like a resource; undefined otherwise. */
|
|
143
|
-
function entryName(value) {
|
|
144
|
-
return isRecord(value) && typeof value["name"] === "string" ? value["name"] : undefined;
|
|
145
|
-
}
|
|
146
|
-
/**
|
|
147
|
-
* The options of resource `key`, of `definition`, each checked; undefined when the value isn't a resource its
|
|
148
|
-
* definition made, or holds an option `definition` doesn't define, or a value an option's rule refuses, each thing
|
|
149
|
-
* wrong pushed onto `problems`.
|
|
150
|
-
*/
|
|
151
|
-
function checkResource(definition, key, value, problems) {
|
|
152
|
-
const { name } = definition;
|
|
153
|
-
const options = isRecord(value) && value["name"] === name ? value["options"] : undefined;
|
|
154
|
-
if (!isRecord(options)) {
|
|
155
|
-
problems.push({
|
|
156
|
-
key: `resources.${key}`,
|
|
157
|
-
location: null,
|
|
158
|
-
problem: `must be made by ${resourceCall(name)}, not ${describeValue(value)}`,
|
|
159
|
-
});
|
|
160
|
-
return undefined;
|
|
161
|
-
}
|
|
162
|
-
const checked = {};
|
|
163
|
-
let valid = true;
|
|
164
|
-
for (const [option, optionValue] of Object.entries(options)) {
|
|
165
|
-
const path = `resources.${key}.${option}`;
|
|
166
|
-
const rule = Object.hasOwn(definition.options, option) ? definition.options[option] : undefined;
|
|
167
|
-
if (rule === undefined) {
|
|
168
|
-
valid = false;
|
|
169
|
-
problems.push({ key: path, location: null, problem: `is not a ${name} option` });
|
|
170
|
-
continue;
|
|
171
|
-
}
|
|
172
|
-
if (optionValue === undefined)
|
|
173
|
-
continue;
|
|
174
|
-
const result = checkWith(rule.schema, optionValue);
|
|
175
|
-
if (result.ok)
|
|
176
|
-
checked[option] = result.value;
|
|
177
|
-
else {
|
|
178
|
-
valid = false;
|
|
179
|
-
for (const { path: inside, problem } of result.problems)
|
|
180
|
-
problems.push({ key: [path, ...inside].join("."), location: null, problem });
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
return valid ? checked : undefined;
|
|
184
|
-
}
|
|
185
231
|
function isRecord(value) {
|
|
186
232
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
187
233
|
}
|