@cnc-tools/storm 0.5.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.
Files changed (113) hide show
  1. package/dist/build-info.js +1 -1
  2. package/dist/combine-errors.js +2 -2
  3. package/dist/commands/dashboard.js +1 -1
  4. package/dist/commands/{run → exec}/cleanup.d.ts +1 -1
  5. package/dist/commands/{run → exec}/cleanup.js +1 -1
  6. package/dist/commands/{run/outcomes.d.ts → exec/command.d.ts} +77 -112
  7. package/dist/commands/exec/command.js +23 -0
  8. package/dist/commands/{run → exec}/job-summary.d.ts +5 -1
  9. package/dist/commands/{run → exec}/job-summary.js +5 -2
  10. package/dist/commands/exec/metadata.d.ts +66 -0
  11. package/dist/commands/exec/metadata.js +55 -0
  12. package/dist/commands/{run → exec}/mint-failed.js +4 -4
  13. package/dist/commands/exec/outcomes.d.ts +614 -0
  14. package/dist/commands/exec/outcomes.js +338 -0
  15. package/dist/commands/exec/run-command.d.ts +221 -0
  16. package/dist/commands/exec/run-command.js +663 -0
  17. package/dist/commands/exec/run-metadata.d.ts +56 -0
  18. package/dist/commands/exec/run-metadata.js +58 -0
  19. package/dist/commands/{run → exec}/run-record.d.ts +27 -1
  20. package/dist/commands/{run → exec}/run-record.js +8 -0
  21. package/dist/commands/exec/testserver-flags.d.ts +48 -0
  22. package/dist/commands/exec/testserver-flags.js +80 -0
  23. package/dist/commands/runs/facts.js +2 -2
  24. package/dist/commands/runs/logs/metadata.js +1 -1
  25. package/dist/commands/runs/logs/outcomes.js +4 -1
  26. package/dist/commands/runs/past-run.d.ts +2 -2
  27. package/dist/commands/runs/past-run.js +2 -2
  28. package/dist/commands/runs/show/metadata.js +2 -2
  29. package/dist/commands/runs/show/outcomes.js +7 -4
  30. package/dist/commands/vitest/command.d.ts +299 -0
  31. package/dist/commands/vitest/command.js +138 -0
  32. package/dist/commands/vitest/metadata.d.ts +66 -0
  33. package/dist/commands/vitest/metadata.js +35 -0
  34. package/dist/commands/vitest/outcomes.d.ts +273 -0
  35. package/dist/commands/vitest/outcomes.js +77 -0
  36. package/dist/config/index.d.ts +2 -1
  37. package/dist/config/index.js +1 -0
  38. package/dist/config/resolve.d.ts +3 -3
  39. package/dist/config/resolve.js +3 -3
  40. package/dist/config/resource-config.d.ts +2 -2
  41. package/dist/config/schema.d.ts +1 -1
  42. package/dist/config/set.d.ts +15 -4
  43. package/dist/config/set.js +28 -12
  44. package/dist/config-file/define.d.ts +8 -6
  45. package/dist/context.d.ts +6 -3
  46. package/dist/context.js +4 -2
  47. package/dist/core/command-provider.d.ts +1 -1
  48. package/dist/core/presentation.js +1 -1
  49. package/dist/core/presentations.js +1 -1
  50. package/dist/resources/testserver/command.d.ts +1 -1
  51. package/dist/resources/testserver/command.js +1 -1
  52. package/dist/resources/testserver/config.d.ts +1 -1
  53. package/dist/resources/testserver/config.js +3 -2
  54. package/dist/resources/testserver/credential-facts.js +1 -1
  55. package/dist/resources/testserver/resource.d.ts +2 -2
  56. package/dist/resources/testserver/sandbox/create.d.ts +2 -2
  57. package/dist/resources/testserver/sandbox/create.js +2 -2
  58. package/dist/resources.d.ts +9 -6
  59. package/dist/resources.js +3 -3
  60. package/dist/sdk/index.js +1 -1
  61. package/dist/sdk/payload/payload.d.ts +2 -2
  62. package/dist/sdk/payload/payload.js +2 -2
  63. package/dist/vercel-cli/driver.d.ts +1 -1
  64. package/dist/vercel-cli/entry.d.ts +1 -1
  65. package/dist/vercel-cli/entry.js +1 -1
  66. package/dist/vercel-cli/verbose.d.ts +2 -2
  67. package/dist/vercel-cli/verbose.js +2 -2
  68. package/dist/vitest/config.d.ts +5 -5
  69. package/dist/vitest/config.js +5 -5
  70. package/dist/vitest/find-vitest.d.ts +7 -0
  71. package/dist/vitest/find-vitest.js +28 -0
  72. package/dist/vitest/fixtures.d.ts +2 -2
  73. package/dist/vitest/fixtures.js +3 -3
  74. package/dist/vitest/gateways.d.ts +37 -6
  75. package/dist/vitest/gateways.js +3 -2
  76. package/dist/vitest/live/list-gateway.d.ts +7 -3
  77. package/dist/vitest/live/list-gateway.js +55 -8
  78. package/dist/vitest/plan.d.ts +41 -8
  79. package/dist/vitest/plan.js +47 -16
  80. package/dist/vitest/sandbox.d.ts +1 -1
  81. package/dist/vitest/sandbox.js +1 -1
  82. package/dist/vitest/test-events.d.ts +2 -2
  83. package/dist/vitest/test-events.js +3 -3
  84. package/dist/vitest/test-results.d.ts +1 -1
  85. package/dist/vitest/test-results.js +1 -1
  86. package/dist/vitest/types.d.ts +1 -1
  87. package/package.json +2 -2
  88. package/skills/overview.md +5 -4
  89. package/skills/read-run-output.md +1 -1
  90. package/dist/commands/run/command.d.ts +0 -327
  91. package/dist/commands/run/command.js +0 -620
  92. package/dist/commands/run/metadata.d.ts +0 -47
  93. package/dist/commands/run/metadata.js +0 -83
  94. package/dist/commands/run/outcomes.js +0 -332
  95. /package/dist/commands/{run → exec}/live-view.d.ts +0 -0
  96. /package/dist/commands/{run → exec}/live-view.js +0 -0
  97. /package/dist/commands/{run → exec}/mint-failed.d.ts +0 -0
  98. /package/dist/commands/{run → exec}/progress.d.ts +0 -0
  99. /package/dist/commands/{run → exec}/progress.js +0 -0
  100. /package/dist/commands/{run → exec}/redaction.d.ts +0 -0
  101. /package/dist/commands/{run → exec}/redaction.js +0 -0
  102. /package/dist/commands/{run → exec}/run-collector.d.ts +0 -0
  103. /package/dist/commands/{run → exec}/run-collector.js +0 -0
  104. /package/dist/commands/{run → exec}/tests-summary.d.ts +0 -0
  105. /package/dist/commands/{run → exec}/tests-summary.js +0 -0
  106. /package/dist/commands/{run → exec}/text.d.ts +0 -0
  107. /package/dist/commands/{run → exec}/text.js +0 -0
  108. /package/dist/commands/{run → exec}/view.d.ts +0 -0
  109. /package/dist/commands/{run → exec}/view.js +0 -0
  110. /package/dist/commands/{run → exec}/waterfall.d.ts +0 -0
  111. /package/dist/commands/{run → exec}/waterfall.js +0 -0
  112. /package/dist/commands/{run → exec}/worker-chart.d.ts +0 -0
  113. /package/dist/commands/{run → exec}/worker-chart.js +0 -0
@@ -0,0 +1,273 @@
1
+ import { z } from "zod";
2
+ /** How `vitest` ends: as `exec` does, its `ran` with the test plan, or refused before the run when counting fails. */
3
+ export declare const outcomes: import("@vercel/clinkr").Outcomes<{
4
+ ran: z.ZodObject<{
5
+ version: z.ZodString;
6
+ commit: z.ZodNullable<z.ZodString>;
7
+ configFile: z.ZodNullable<z.ZodString>;
8
+ resources: z.ZodType<import("../../core/resource.ts").ResourceRanFacts<import("../../resources.ts").Resources>, import("../../core/resource.ts").ResourceRanFacts<import("../../resources.ts").Resources>, z.core.$ZodTypeInternals<import("../../core/resource.ts").ResourceRanFacts<import("../../resources.ts").Resources>, import("../../core/resource.ts").ResourceRanFacts<import("../../resources.ts").Resources>>>;
9
+ cleanup: z.ZodType<import("../exec/cleanup.ts").StormCleanupFacts, import("../exec/cleanup.ts").StormCleanupFacts, z.core.$ZodTypeInternals<import("../exec/cleanup.ts").StormCleanupFacts, import("../exec/cleanup.ts").StormCleanupFacts>>;
10
+ command: z.ZodObject<{
11
+ exitCode: z.ZodNullable<z.ZodNumber>;
12
+ signal: z.ZodNullable<z.ZodString>;
13
+ }, z.core.$strip>;
14
+ runner: z.ZodNullable<z.ZodObject<{
15
+ snapshotId: z.ZodString;
16
+ base: z.ZodString;
17
+ built: z.ZodBoolean;
18
+ vcpus: z.ZodNumber;
19
+ region: z.ZodString;
20
+ runtime: z.ZodString;
21
+ }, z.core.$strip>>;
22
+ timeline: z.ZodObject<{
23
+ startedAt: z.ZodString;
24
+ totalMs: z.ZodNumber;
25
+ rows: z.ZodArray<z.ZodObject<{
26
+ name: z.ZodEnum<{
27
+ cleanup: "cleanup";
28
+ mint: "mint";
29
+ runner: "runner";
30
+ tests: "tests";
31
+ testserver: "testserver";
32
+ }>;
33
+ startMs: z.ZodNumber;
34
+ endMs: z.ZodNumber;
35
+ outcome: z.ZodEnum<{
36
+ done: "done";
37
+ failed: "failed";
38
+ stopped: "stopped";
39
+ unfinished: "unfinished";
40
+ }>;
41
+ steps: z.ZodArray<z.ZodObject<{
42
+ name: z.ZodEnum<{
43
+ [x: string]: string;
44
+ }>;
45
+ startMs: z.ZodNumber;
46
+ endMs: z.ZodNumber;
47
+ outcome: z.ZodEnum<{
48
+ done: "done";
49
+ failed: "failed";
50
+ stopped: "stopped";
51
+ unfinished: "unfinished";
52
+ }>;
53
+ }, z.core.$strip>>;
54
+ idleMs: z.ZodNumber;
55
+ snapshot: z.ZodOptional<z.ZodEnum<{
56
+ built: "built";
57
+ reused: "reused";
58
+ }>>;
59
+ sandboxes: z.ZodOptional<z.ZodObject<{
60
+ reused: z.ZodNumber;
61
+ created: z.ZodNumber;
62
+ }, z.core.$strip>>;
63
+ }, z.core.$strip>>;
64
+ criticalPath: z.ZodArray<z.ZodEnum<{
65
+ cleanup: "cleanup";
66
+ mint: "mint";
67
+ runner: "runner";
68
+ tests: "tests";
69
+ testserver: "testserver";
70
+ }>>;
71
+ }, z.core.$strip>;
72
+ runId: z.ZodNullable<z.ZodString>;
73
+ plan: z.ZodObject<{
74
+ tests: z.ZodNumber;
75
+ files: z.ZodNumber;
76
+ sandboxes: z.ZodNullable<z.ZodNumber>;
77
+ sandboxesFrom: z.ZodNullable<z.ZodEnum<{
78
+ auto: "auto";
79
+ file: "file";
80
+ flag: "flag";
81
+ }>>;
82
+ }, z.core.$strip>;
83
+ }, z.core.$strip>;
84
+ }, {
85
+ ran: unknown;
86
+ }, {
87
+ noMatchingTests: z.ZodObject<{
88
+ args: z.ZodArray<z.ZodString>;
89
+ cwd: z.ZodString;
90
+ }, z.core.$strip>;
91
+ vitestListFailed: z.ZodObject<{
92
+ args: z.ZodArray<z.ZodString>;
93
+ cwd: z.ZodString;
94
+ kind: z.ZodEnum<{
95
+ exited: "exited";
96
+ "start-failed": "start-failed";
97
+ "timed-out": "timed-out";
98
+ "unreadable-output": "unreadable-output";
99
+ }>;
100
+ message: z.ZodString;
101
+ }, z.core.$strip>;
102
+ credentialRejected: import("@vercel/clinkr").SharedError<"credential_rejected", [{
103
+ origin: {
104
+ source: "mint";
105
+ team: string;
106
+ project: string;
107
+ } | {
108
+ source: "github-actions";
109
+ claims: {
110
+ aud: string;
111
+ repository: string;
112
+ } | null;
113
+ };
114
+ fix: string;
115
+ status: number;
116
+ vercelId: string | null;
117
+ ttlMinutes: number;
118
+ failedCreates: {
119
+ kind: "connect-failed" | "dropped" | "http-error" | "malformed" | "stream-ended" | "stream-error" | "timeout";
120
+ detail: string | null;
121
+ }[];
122
+ unpooled: {
123
+ testserverUrl: string;
124
+ path: string;
125
+ message: string;
126
+ }[];
127
+ sandboxMayExist: boolean;
128
+ } & {
129
+ readonly cleanup: import("../exec/cleanup.ts").StormCleanupFacts;
130
+ }]>;
131
+ credentialUnused: import("@vercel/clinkr").SharedError<"credential_unused", [data: {
132
+ flags: string[];
133
+ configFile: string | null;
134
+ }]>;
135
+ githubFixtureRepoUnavailable: import("@vercel/clinkr").SharedError<"github_fixture_repo_unavailable", [{
136
+ repo: string;
137
+ status: number | null;
138
+ message: string;
139
+ } & {
140
+ readonly cleanup: import("../exec/cleanup.ts").StormCleanupFacts;
141
+ }]>;
142
+ githubTokenMissing: import("@vercel/clinkr").SharedError<"github_token_missing", [data: {
143
+ tokenEnv: string;
144
+ repo: string;
145
+ configFile: string | null;
146
+ requiredBy: "config" | "set";
147
+ }]>;
148
+ invalidConfig: import("@vercel/clinkr").SharedError<"invalid_config", [data: {
149
+ file: string;
150
+ problems: {
151
+ key: string | null;
152
+ location: {
153
+ line: number;
154
+ column: number | null;
155
+ } | null;
156
+ problem: string;
157
+ }[];
158
+ }]>;
159
+ invalidResourceOptions: import("@vercel/clinkr").SharedError<"invalid_resource_options", [data: {
160
+ configFile: string | null;
161
+ problems: {
162
+ key: string;
163
+ problem: string;
164
+ values: {
165
+ key: string;
166
+ value: string;
167
+ source: "default" | "file" | "flag";
168
+ }[];
169
+ }[];
170
+ }]>;
171
+ mintFailed: import("@vercel/clinkr").SharedError<"mint_failed", [data: {
172
+ team: string;
173
+ project: string;
174
+ cause: string;
175
+ fix: string;
176
+ runner: boolean;
177
+ cleanup: import("../exec/cleanup.ts").StormCleanupFacts;
178
+ }]>;
179
+ missingRunner: import("@vercel/clinkr").SharedError<"missing_runner", [data: {
180
+ configFile: string | null;
181
+ }]>;
182
+ missingTarget: import("@vercel/clinkr").SharedError<"missing_target", [data: {
183
+ missing: ("project" | "scope")[];
184
+ }]>;
185
+ noBaseRef: import("@vercel/clinkr").SharedError<"no_base_ref", [data: {
186
+ refs: {
187
+ ref: string;
188
+ reason: "missing" | "unrelated";
189
+ }[];
190
+ }]>;
191
+ noSandboxes: import("@vercel/clinkr").SharedError<"no_sandboxes", [{
192
+ requested: number;
193
+ ttlMinutes: number;
194
+ failedCreates: {
195
+ kind: "connect-failed" | "dropped" | "http-error" | "malformed" | "stream-ended" | "stream-error" | "timeout";
196
+ detail: string | null;
197
+ }[];
198
+ sandboxMayExist: boolean;
199
+ } & {
200
+ readonly cleanup: import("../exec/cleanup.ts").StormCleanupFacts;
201
+ }]>;
202
+ noUsableSandboxes: import("@vercel/clinkr").SharedError<"no_usable_sandboxes", [{
203
+ requested: number;
204
+ build: string;
205
+ } & {
206
+ readonly cleanup: import("../exec/cleanup.ts").StormCleanupFacts;
207
+ }]>;
208
+ poolUnavailable: import("@vercel/clinkr").SharedError<"pool_unavailable", [data: {
209
+ path: string;
210
+ message: string;
211
+ }]>;
212
+ poolUnreadable: import("@vercel/clinkr").SharedError<"pool_unreadable", [{
213
+ path: string;
214
+ message: string;
215
+ } & {
216
+ readonly cleanup: import("../exec/cleanup.ts").StormCleanupFacts;
217
+ }]>;
218
+ runnerFailed: import("@vercel/clinkr").SharedError<"runner_failed", [data: {
219
+ failure: {
220
+ kind: "apply-failed" | "build-failed" | "install-failed" | "snapshot-build-step-failed";
221
+ label: string;
222
+ exitCode: number | null;
223
+ tail: string[];
224
+ } | {
225
+ kind: "sandbox-api-failed";
226
+ operation: string;
227
+ status: number | null;
228
+ message: string;
229
+ } | {
230
+ kind: "checkout-failed";
231
+ message: string;
232
+ command: string | null;
233
+ } | {
234
+ kind: "credential-claims-missing";
235
+ team: string;
236
+ project: string;
237
+ };
238
+ cleanup: import("../exec/cleanup.ts").StormCleanupFacts;
239
+ }]>;
240
+ snapshotGone: import("@vercel/clinkr").SharedError<"snapshot_gone", [data: {
241
+ snapshotId: string;
242
+ base: string;
243
+ removal: {
244
+ path: string;
245
+ message: string;
246
+ } | null;
247
+ cleanup: import("../exec/cleanup.ts").StormCleanupFacts;
248
+ }]>;
249
+ spawnFailed: import("@vercel/clinkr").SharedError<"spawn_failed", [data: {
250
+ executable: string;
251
+ message: string;
252
+ cleanup: import("../exec/cleanup.ts").StormCleanupFacts;
253
+ }]>;
254
+ submodulesRefused: import("@vercel/clinkr").SharedError<"submodules_refused", [data: {
255
+ paths: string[];
256
+ }]>;
257
+ tokenRequestFailed: import("@vercel/clinkr").SharedError<"token_request_failed", [{
258
+ cause: "request-failed" | "variables-missing";
259
+ missing: ("ACTIONS_ID_TOKEN_REQUEST_TOKEN" | "ACTIONS_ID_TOKEN_REQUEST_URL")[] | null;
260
+ status: number | null;
261
+ said: string | null;
262
+ detail: string;
263
+ fix: string;
264
+ ttlMinutes: number;
265
+ failedCreates: {
266
+ kind: "connect-failed" | "dropped" | "http-error" | "malformed" | "stream-ended" | "stream-error" | "timeout";
267
+ detail: string | null;
268
+ }[];
269
+ sandboxMayExist: boolean;
270
+ } & {
271
+ readonly cleanup: import("../exec/cleanup.ts").StormCleanupFacts;
272
+ }]>;
273
+ }>;
@@ -0,0 +1,77 @@
1
+ import { defineOutcomes } from "@vercel/clinkr";
2
+ import { z } from "zod";
3
+ import { RAN_DESCRIPTION, RUN_ERRORS, ranSchema, renderRan } from "../exec/outcomes.js";
4
+ /** What `vitest list` counted before the run, and the Testserver sandbox count the run asked for. */
5
+ const planSchema = z.object({
6
+ /** How many tests `vitest list --json <args>` counted. */
7
+ tests: z.number(),
8
+ /** How many distinct test files they are in. */
9
+ files: z.number(),
10
+ /** How many Testserver sandboxes the run asked for; null without a Testserver side. */
11
+ sandboxes: z.number().nullable(),
12
+ /** Where that count came from: `--testserver-sandboxes` (`flag`), `resources.testserverPool.sandboxes` in storm.config.ts (`file`), or one per 4 test files, at most 8 (`auto`); null without a Testserver side. */
13
+ sandboxesFrom: z.enum(["flag", "file", "auto"]).nullable(),
14
+ });
15
+ /** Where `vitest list` ran and what it was given, which both refusals report. */
16
+ const listedShape = {
17
+ /** The arguments given to `vitest run`, which `vitest list --json` was given too. */
18
+ args: z.array(z.string()),
19
+ /** The directory `vitest list` ran in, on this machine. */
20
+ cwd: z.string(),
21
+ };
22
+ /** How `vitest` ends: as `exec` does, its `ran` with the test plan, or refused before the run when counting fails. */
23
+ export const outcomes = defineOutcomes({
24
+ results: {
25
+ ran: {
26
+ schema: ranSchema.extend({
27
+ /** The test plan: what `vitest list` counted before the run, and how many Testserver sandboxes the run asked for and why. */
28
+ plan: planSchema,
29
+ }),
30
+ description: RAN_DESCRIPTION,
31
+ render: renderRan,
32
+ },
33
+ },
34
+ errors: {
35
+ ...RUN_ERRORS,
36
+ noMatchingTests: {
37
+ exitCode: 1,
38
+ description: "vitest list found no test for the arguments given to vitest run, so nothing was minted, leased or started.",
39
+ schema: z.object(listedShape),
40
+ render: ({ args, cwd }) => ({
41
+ message: `vitest list found no test for vitest run ${argsText(args)} in ${cwd}. The command didn't run.`,
42
+ next: [
43
+ {
44
+ type: "text",
45
+ text: `Change the arguments given to vitest run (${argsText(args)}), then retry. Put vitest's own dash options after --.`,
46
+ },
47
+ ],
48
+ }),
49
+ },
50
+ vitestListFailed: {
51
+ exitCode: 1,
52
+ description: "storm couldn't count the tests before the run: vitest wasn't found or failed to start, didn't finish within 60s, exited other than 0, or printed something other than a list of tests. Nothing was minted, leased or started.",
53
+ schema: z.object({
54
+ /** How listing failed: vitest wasn't found or couldn't start (`start-failed`), didn't finish (`timed-out`), exited other than 0 (`exited`), or printed something other than a list of tests (`unreadable-output`). */
55
+ kind: z.enum(["start-failed", "timed-out", "exited", "unreadable-output"]),
56
+ /** What went wrong, such as the directories searched for vitest, or the last line of vitest's stderr. */
57
+ message: z.string(),
58
+ ...listedShape,
59
+ }),
60
+ render: ({ kind, message, cwd }) => ({
61
+ message: `Couldn't count the tests in ${cwd}: ${/[.!?]$/.test(message) ? message : `${message}.`} The command didn't run.`,
62
+ next: [{ type: "text", text: LIST_FAILED_NEXT[kind] }],
63
+ }),
64
+ },
65
+ },
66
+ });
67
+ /** The arguments as a person reads them: `(none)` when there are none. */
68
+ function argsText(args) {
69
+ return args.length === 0 ? "(none)" : args.join(" ");
70
+ }
71
+ /** What to do about each kind of listing failure. */
72
+ const LIST_FAILED_NEXT = {
73
+ "start-failed": "Install vitest in the package, or run the command with storm exec, which counts nothing.",
74
+ "timed-out": "Check why vitest list doesn't finish, such as a global setup that waits, then retry.",
75
+ exited: "Fix what vitest list reports, then retry. vitest list takes the arguments vitest run does, but refuses some run-only options.",
76
+ "unreadable-output": "Check that the package's vitest prints its list with --json, then retry.",
77
+ };
@@ -1,3 +1,4 @@
1
+ export { givenOptionsOf } from "./by-name.ts";
1
2
  export { configErrors, configProblemLine, optionProblemLine } from "./errors.ts";
2
3
  export type { ConfigGateway, ConfigImport, ConfigLocation } from "./gateways.ts";
3
4
  export { liveConfigGateway } from "./live/config-gateway.ts";
@@ -5,5 +6,5 @@ export { type ConfigProblem, type ConfigValues, findConfigFile, type LoadedConfi
5
6
  export { type AnyResourceConfig, type GivenOptions, type GivenResources, optionKeyPath, type OptionOf, type OptionProblem, type OptionRule, type OptionRules, type OptionSettings, type OptionsResolution, readBooleanText, readTextAsIs, readWholeNumberText, type ResolvedOf, type ResolvedResources, type ResourceConfig, type ResourceFactory, type Setting, type SettingSource, type SettingsOf, } from "./resource-config.ts";
6
7
  export { mergeResourceOptions, type ResolvedSettings, resolveResourceOptions, resolveSettings, type ResourceOptionProblem, type ResourceOptionsResolution, type SettingFlags, } from "./resolve.ts";
7
8
  export { type Checked, checkBoolean, type CheckedSettings, checkNonEmptyString, CONFIG_FILE_NAME, CONFIG_SETTING_KEYS, type ConfigKey, type ConfigSettingKey, type ConfigSettings, describeValue, type SettingValue, type ValueProblem, wrongValue, } from "./schema.ts";
8
- export { parseSetFlags, type SetFlagsParse, setKeyPaths } from "./set.ts";
9
+ export { type OwnFlags, parseSetFlags, type SetFlagsParse, setKeyPaths } from "./set.ts";
9
10
  export { fileOptions, fileSettings, invalidConfig, invalidResourceOptions, loadSettingsFile, type SettingsFile, settleResourceOptions, } from "./settings-file.ts";
@@ -2,6 +2,7 @@
2
2
  // configs a caller passes in, reading `--set` against them, and resolving each top-level setting and each held
3
3
  // resource's options. It names no resource. Each resource folder imports the resource config vocabulary to declare its
4
4
  // own section; the composition layer passes the registry's resource configs in.
5
+ export { givenOptionsOf } from "./by-name.js";
5
6
  export { configErrors, configProblemLine, optionProblemLine } from "./errors.js";
6
7
  export { liveConfigGateway } from "./live/config-gateway.js";
7
8
  export { findConfigFile, loadConfig } from "./load.js";
@@ -42,8 +42,8 @@ export type ResourceOptionsResolution<T> = {
42
42
  */
43
43
  export declare function mergeResourceOptions<C extends AnyResourceConfig>(config: C, file: GivenOptions<C> | undefined, flags: GivenOptions<C> | undefined): ResourceOptionsResolution<SettingsOf<C>>;
44
44
  /**
45
- * The resolved options of each resource the run holds, by name: one the file has, or one any `--set` names an option
46
- * of. Each is merged (`mergeResourceOptions`) and then resolved by its config's `resolve`, which checks its options
47
- * against each other. Every problem of every held resource is returned at once, in config order.
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
48
  */
49
49
  export declare function resolveResourceOptions<Configs extends readonly AnyResourceConfig[]>(configs: Configs, file: GivenResources<Configs> | undefined, sets: GivenResources<Configs>): ResourceOptionsResolution<ResolvedResources<Configs>>;
@@ -52,9 +52,9 @@ export function mergeResourceOptions(config, file, flags) {
52
52
  return { ok: true, value: merged };
53
53
  }
54
54
  /**
55
- * The resolved options of each resource the run holds, by name: one the file has, or one any `--set` names an option
56
- * of. Each is merged (`mergeResourceOptions`) and then resolved by its config's `resolve`, which checks its options
57
- * against each other. Every problem of every held resource is returned at once, in config order.
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
58
  */
59
59
  export function resolveResourceOptions(configs, file, sets) {
60
60
  const fromFile = file ?? {};
@@ -9,10 +9,10 @@ export interface Setting<T> {
9
9
  /**
10
10
  * How one resource option is checked, read from `--set` text and defaulted.
11
11
  *
12
- * - `check`: the option's rule, for a value from the file or from `--set` once read.
12
+ * - `check`: the option's rule, for a value from the file, from `--set` once read, or from a command's own flag.
13
13
  * - `readText`: a `--set` value's text as the value `check` reads, such as a whole number or a boolean. Text that
14
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 `--set` gives one.
15
+ * - `default`: the value when neither the file nor a flag gives one.
16
16
  * - `required`: a resource held without this option is a problem.
17
17
  */
18
18
  export interface OptionRule<T> {
@@ -11,7 +11,7 @@ export interface ConfigSettings {
11
11
  readonly scope?: string;
12
12
  /** The control plane project (`--project`), which a runner run also mints for. */
13
13
  readonly project?: string;
14
- /** The runner recipe: what `storm run` runs the command in, unless `--local`. Only a runner run reads it. */
14
+ /** The runner recipe: what a run runs its command in, unless `--local`. Only a runner run reads it. */
15
15
  readonly runner?: RunnerRecipe;
16
16
  }
17
17
  /** A top-level setting's name. */
@@ -7,10 +7,21 @@ export type SetFlagsParse<Configs extends readonly AnyResourceConfig[]> = {
7
7
  readonly ok: false;
8
8
  readonly problems: readonly string[];
9
9
  };
10
- /** The key paths `--set` takes, such as `resources.<name>.<option>`, in config order, then option order. */
11
- export declare function setKeyPaths(configs: readonly AnyResourceConfig[]): readonly string[];
10
+ /**
11
+ * The options a command gives their own flags, by key path, such as `resources.<name>.<option>`, with each flag's
12
+ * spelling, such as `--<name>-<option>`. `--set` takes none of them: one option has one spelling on the command line.
13
+ */
14
+ export interface OwnFlags {
15
+ readonly [keyPath: string]: string;
16
+ }
17
+ /**
18
+ * The key paths `--set` takes, such as `resources.<name>.<option>`, in config order, then option order: every option of
19
+ * `configs` but those in `ownFlags`.
20
+ */
21
+ export declare function setKeyPaths(configs: readonly AnyResourceConfig[], ownFlags?: OwnFlags): readonly string[];
12
22
  /**
13
23
  * Reads each `--set <key path>=<value>` in `texts` against `configs`. Each problem names the `--set` as given: one
14
- * without `=`, a key path `--set` doesn't take, a key path given twice, or a value its option's rule refuses.
24
+ * without `=`, a key path with its own flag in `ownFlags`, which it names, a key path `--set` doesn't take, a key path
25
+ * given twice, or a value its option's rule refuses.
15
26
  */
16
- export declare function parseSetFlags<Configs extends readonly AnyResourceConfig[]>(texts: readonly string[], configs: Configs): SetFlagsParse<Configs>;
27
+ export declare function parseSetFlags<Configs extends readonly AnyResourceConfig[]>(texts: readonly string[], configs: Configs, ownFlags?: OwnFlags): SetFlagsParse<Configs>;
@@ -1,23 +1,34 @@
1
1
  // `--set <key path>=<value>`: a resource's option given on the command line by its key path in `storm.config.ts`,
2
- // `resources.<name>.<option>`. Every option of every resource config passed in takes one. Each value is text, read by
3
- // its option's rule (`readText`) and then checked by the rule, as a value from the file would be. The values come
4
- // back by resource, then by option.
2
+ // `resources.<name>.<option>`. Every option of every resource config passed in takes one, but an option the command
3
+ // gives its own flag (`OwnFlags`), which `--set` refuses by naming that flag. Each value is text, read by its option's
4
+ // rule (`readText`) and then checked by the rule, as a value from the file would be. The values come back by resource,
5
+ // then by option.
5
6
  import { givenResourcesByName } from "./by-name.js";
6
7
  import { optionKeyPath } from "./resource-config.js";
7
- /** Each key path `--set` takes, with the option it names, in config order, then option order. */
8
- function setTargets(configs) {
9
- return configs.flatMap((config) => Object.entries(config.options).map(([option, rule]) => [optionKeyPath(config.name, option), { resource: config.name, option, rule }]));
8
+ /**
9
+ * Each key path `--set` takes, with the option it names, in config order, then option order: every option of
10
+ * `configs` but those in `ownFlags`.
11
+ */
12
+ function setTargets(configs, ownFlags) {
13
+ return configs.flatMap((config) => Object.entries(config.options).flatMap(([option, rule]) => {
14
+ const path = optionKeyPath(config.name, option);
15
+ return Object.hasOwn(ownFlags, path) ? [] : [[path, { resource: config.name, option, rule }]];
16
+ }));
10
17
  }
11
- /** The key paths `--set` takes, such as `resources.<name>.<option>`, in config order, then option order. */
12
- export function setKeyPaths(configs) {
13
- return setTargets(configs).map(([path]) => path);
18
+ /**
19
+ * The key paths `--set` takes, such as `resources.<name>.<option>`, in config order, then option order: every option of
20
+ * `configs` but those in `ownFlags`.
21
+ */
22
+ export function setKeyPaths(configs, ownFlags = {}) {
23
+ return setTargets(configs, ownFlags).map(([path]) => path);
14
24
  }
15
25
  /**
16
26
  * Reads each `--set <key path>=<value>` in `texts` against `configs`. Each problem names the `--set` as given: one
17
- * without `=`, a key path `--set` doesn't take, a key path given twice, or a value its option's rule refuses.
27
+ * without `=`, a key path with its own flag in `ownFlags`, which it names, a key path `--set` doesn't take, a key path
28
+ * given twice, or a value its option's rule refuses.
18
29
  */
19
- export function parseSetFlags(texts, configs) {
20
- const targets = setTargets(configs);
30
+ export function parseSetFlags(texts, configs, ownFlags = {}) {
31
+ const targets = setTargets(configs, ownFlags);
21
32
  const byPath = new Map(targets);
22
33
  const paths = targets.map(([path]) => path);
23
34
  const values = {};
@@ -30,6 +41,11 @@ export function parseSetFlags(texts, configs) {
30
41
  continue;
31
42
  }
32
43
  const path = text.slice(0, equals);
44
+ const flag = Object.hasOwn(ownFlags, path) ? ownFlags[path] : undefined;
45
+ if (flag !== undefined) {
46
+ problems.push(`--set ${path} has its own flag; use ${flag}`);
47
+ continue;
48
+ }
33
49
  const target = byPath.get(path);
34
50
  if (target === undefined) {
35
51
  problems.push(paths.length === 0
@@ -5,8 +5,10 @@ export { pnpmToolchains } from "./toolchain.ts";
5
5
  export type { RunnerRecipe, RunnerResources, RunnerStep, RunnerStepContext, RunnerSteps } from "../runner/index.ts";
6
6
  /**
7
7
  * The resources a run holds for its command, each made by its own factory. Without one, a run holds nothing beside
8
- * its command. `storm run --set resources.<name>.<option>=<value>` sets any resource's option for one run, and
9
- * gives the run that resource when the file has none.
8
+ * its command. `storm vitest` and `storm exec` set any resource's option for one run, and gives the run that resource when the file
9
+ * has none: the Testserver pool resource's with its own flags (`--testserver-sandboxes`, `--testserver-build`,
10
+ * `--testserver-min-time-left`, `--testserver-ttl`, `--testserver-no-create`), any other's with
11
+ * `--set resources.<name>.<option>=<value>`.
10
12
  */
11
13
  export interface StormResources {
12
14
  /**
@@ -17,19 +19,19 @@ export interface StormResources {
17
19
  /**
18
20
  * The GitHub fixture repository resource, from `githubFixtureRepo()` in `@cnc-tools/storm/github`: one standing
19
21
  * GitHub repository, a token for it and a run prefix, handed to the command, whose branches under the run prefix the
20
- * run deletes once the command has stopped. Only `run` reads it.
22
+ * run deletes once the command has stopped. Only a run, `vitest`'s or `exec`'s, reads it.
21
23
  */
22
24
  readonly githubFixtureRepo?: GitHubFixtureRepoResource;
23
25
  }
24
26
  /**
25
27
  * What a `storm.config.ts` can give: the top-level settings, and the resources a run holds. A flag (`--scope`,
26
- * `--project`, or `--set` for a resource's option) overrides the file, and the file overrides the built-in default.
28
+ * `--project`, a `--testserver-*` flag, or `--set` for another resource's option) overrides the file, and the file overrides the built-in default.
27
29
  * storm checks the whole file whenever a command loads it.
28
30
  */
29
31
  export interface StormConfig extends ConfigSettings {
30
32
  /**
31
- * The resources a run holds. Without `resources.testserverPool`, and without a `--set resources.testserverPool.*`,
32
- * `storm run` holds no Testserver sandbox: it runs the command with a run payload that names none.
33
+ * The resources a run holds. Without `resources.testserverPool`, and without a `--testserver-*` flag,
34
+ * a run holds no Testserver sandbox: it runs the command with a run payload that names none.
33
35
  */
34
36
  readonly resources?: StormResources;
35
37
  }
package/dist/context.d.ts CHANGED
@@ -5,6 +5,7 @@ import { type RESOURCE_CONFIGS, type StormResourceGateways } from "./resources.t
5
5
  import { type CommandGateway, type JobSummaryGateway, type ProgressTerminal, type RunDirectoryGateway } from "./core/index.ts";
6
6
  import { type CheckoutGateway, type RunnerSandboxGateway, type RunnerSnapshotCacheGateway, type RunnerTerminal } from "./runner/index.ts";
7
7
  import { type Clock, type Timer } from "./time/index.ts";
8
+ import { type VitestListGateway } from "./vitest/plan.ts";
8
9
  /**
9
10
  * The gateways and DI seams storm's commands reach the world through, beside the resources' own
10
11
  * (`StormContext`).
@@ -29,6 +30,8 @@ export interface StormCoreContext {
29
30
  readonly progressTerminal: ProgressTerminal;
30
31
  /** The GitHub Actions job summary a run appends its summary to, in a step that has one. */
31
32
  readonly jobSummary: JobSummaryGateway;
33
+ /** vitest on this machine, which `storm vitest` finds and counts the tests with before a run starts. */
34
+ readonly vitestList: VitestListGateway;
32
35
  readonly timer: Timer;
33
36
  readonly clock: Clock;
34
37
  }
@@ -39,7 +42,7 @@ export interface StormCoreContext {
39
42
  export type StormContext = StormCoreContext & StormResourceGateways;
40
43
  /**
41
44
  * Where a command records the status the process exits with, past Clinkr's: a Clinkr handler's result exits only
42
- * 0 or 1, so `run` records its command's code (or `128 + n` for a signal) here, and `bin/storm.ts` exits with
45
+ * 0 or 1, so a run, `exec`'s or `vitest`'s, records its command's code (or `128 + n` for a signal) here, and `bin/storm.ts` exits with
43
46
  * it when it is set.
44
47
  */
45
48
  export interface StormExit {
@@ -76,8 +79,8 @@ export interface StormApp {
76
79
  * real process; `storm.config.ts` imported by Node; for a runner run, git and tar on the local checkout, the
77
80
  * runner snapshot cache under `env`'s `XDG_STATE_HOME` or `HOME`, Vercel Sandbox through `@vercel/sandbox` (loaded
78
81
  * only when a runner run first calls it) and this process's stdout and stderr; the run directories beside the runner
79
- * snapshot cache; the live view on this process's stderr; the job summary `GITHUB_STEP_SUMMARY` names, if any; the
80
- * system timer and clock; and each resource's own live gateways, which its folder builds from `env`. When `env` names
82
+ * snapshot cache; the live view on this process's stderr; the job summary `GITHUB_STEP_SUMMARY` names, if any;
83
+ * `vitest` found in `node_modules/.bin` and spawned as a real process; the system timer and clock; and each resource's own live gateways, which its folder builds from `env`. When `env` names
81
84
  * no place for the state directory, every runner snapshot cache operation fails and says why, which a run treats as an
82
85
  * empty cache, and so does opening a run directory, which a run goes on without.
83
86
  */
package/dist/context.js CHANGED
@@ -6,14 +6,15 @@ import { liveResourceGateways } from "./resources.js";
6
6
  import { liveCommandGateway, liveJobSummaryGateway, liveProgressTerminal, liveRunDirectoryGateway, resolveStateDirectory, RUNS_SUBPATH, stateDirectoryPattern, unavailableRunDirectoryGateway, } from "./core/index.js";
7
7
  import { liveCheckoutGateway, liveRunnerSandboxGateway, liveRunnerSnapshotCacheGateway, liveRunnerTerminal, RUNNER_SNAPSHOTS_SUBPATH, unavailableRunnerSnapshotCacheGateway, } from "./runner/index.js";
8
8
  import { systemClock, systemTimer } from "./time/index.js";
9
+ import { liveVitestListGateway } from "./vitest/plan.js";
9
10
  /**
10
11
  * The live Context: `vercel` for credentials, and for `--credential github-actions` GitHub Actions' token request, read
11
12
  * from `env`'s `ACTIONS_ID_TOKEN_REQUEST_*` at each request, with a 10-second timeout; a run's command spawned as a
12
13
  * real process; `storm.config.ts` imported by Node; for a runner run, git and tar on the local checkout, the
13
14
  * runner snapshot cache under `env`'s `XDG_STATE_HOME` or `HOME`, Vercel Sandbox through `@vercel/sandbox` (loaded
14
15
  * only when a runner run first calls it) and this process's stdout and stderr; the run directories beside the runner
15
- * snapshot cache; the live view on this process's stderr; the job summary `GITHUB_STEP_SUMMARY` names, if any; the
16
- * system timer and clock; and each resource's own live gateways, which its folder builds from `env`. When `env` names
16
+ * snapshot cache; the live view on this process's stderr; the job summary `GITHUB_STEP_SUMMARY` names, if any;
17
+ * `vitest` found in `node_modules/.bin` and spawned as a real process; the system timer and clock; and each resource's own live gateways, which its folder builds from `env`. When `env` names
17
18
  * no place for the state directory, every runner snapshot cache operation fails and says why, which a run treats as an
18
19
  * empty cache, and so does opening a run directory, which a run goes on without.
19
20
  */
@@ -37,6 +38,7 @@ export function liveContext(options) {
37
38
  : unavailableRunDirectoryGateway(stateDirectoryPattern(RUNS_SUBPATH), runs.reason),
38
39
  progressTerminal: liveProgressTerminal(),
39
40
  jobSummary: liveJobSummaryGateway({ path: options.env["GITHUB_STEP_SUMMARY"] }),
41
+ vitestList: liveVitestListGateway,
40
42
  timer: systemTimer,
41
43
  clock: systemClock,
42
44
  };
@@ -98,7 +98,7 @@ export declare function defineRefusals<const Schemas extends Readonly<Record<str
98
98
  export type UnpreparedErrorOf<Kind extends ResourceKind> = [Kind["prepareRefusal"]] extends [never] ? undefined : (refusal: Kind["prepareRefusal"]) => CommandError<Kind["reason"]>;
99
99
  /**
100
100
  * The command half of one resource, of kind `Kind`, whose refusal errors are `Refusals`. Every error a run ends with
101
- * for it is one of `errors` or `refusalErrors`, which the `run` command lists, and its reason is one of the kind's
101
+ * for it is one of `errors` or `refusalErrors`, which `exec` and `vitest` list, and its reason is one of the kind's
102
102
  * (`Kind["reason"]`), which the run's own outcomes check both ways. It knows nothing of the run's cleanup: the host
103
103
  * defines each refusal error with the run's cleanup beside its data.
104
104
  *
@@ -1,5 +1,5 @@
1
1
  // The presentation contract: how a resource shows in a run's progress. A resource renders its own events as plain
2
2
  // lines and as the live view's notices, and, with a lane, its lane's rows in the live view's blocks and its row's label
3
- // on the waterfall. The `run` command's views own the layout around them: the time and lane prefix of a plain line,
3
+ // on the waterfall. A run's views own the layout around them: the time and lane prefix of a plain line,
4
4
  // each block's rows and their order, the glyphs and the widths. It names no resource.
5
5
  export {};
@@ -1,4 +1,4 @@
1
- // How the `run` command's views ask every resource how it shows, through each provider's presentation, in provider
1
+ // How a run's views (`exec`'s and `vitest`'s) ask every resource how it shows, through each provider's presentation, in provider
2
2
  // order: the presentation counterpart of `command-slots.ts`. `presentationSlotOf` binds one provider's presentation
3
3
  // to its name, so each function below indexes the run's maps by that name and never relates a name to the kinds map.
4
4
  /** `provider`'s presentation, bound to its name. */