@cnc-tools/storm 0.5.0 → 0.7.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 (171) 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} +103 -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/{run → exec}/live-view.js +29 -13
  11. package/dist/commands/exec/metadata.d.ts +69 -0
  12. package/dist/commands/exec/metadata.js +55 -0
  13. package/dist/commands/{run → exec}/mint-failed.js +4 -4
  14. package/dist/commands/exec/outcomes.d.ts +664 -0
  15. package/dist/commands/exec/outcomes.js +347 -0
  16. package/dist/commands/{run → exec}/progress.d.ts +14 -2
  17. package/dist/commands/{run → exec}/progress.js +54 -9
  18. package/dist/commands/exec/run-command.d.ts +227 -0
  19. package/dist/commands/exec/run-command.js +696 -0
  20. package/dist/commands/exec/run-metadata.d.ts +59 -0
  21. package/dist/commands/exec/run-metadata.js +61 -0
  22. package/dist/commands/{run → exec}/run-record.d.ts +110 -5
  23. package/dist/commands/{run → exec}/run-record.js +57 -1
  24. package/dist/commands/exec/testserver-flags.d.ts +48 -0
  25. package/dist/commands/exec/testserver-flags.js +80 -0
  26. package/dist/commands/{run → exec}/view.js +36 -4
  27. package/dist/commands/runs/facts.d.ts +25 -0
  28. package/dist/commands/runs/facts.js +38 -5
  29. package/dist/commands/runs/list/command.d.ts +25 -0
  30. package/dist/commands/runs/list/outcomes.d.ts +25 -0
  31. package/dist/commands/runs/logs/metadata.js +1 -1
  32. package/dist/commands/runs/logs/outcomes.js +4 -1
  33. package/dist/commands/runs/past-run.d.ts +2 -2
  34. package/dist/commands/runs/past-run.js +2 -2
  35. package/dist/commands/runs/show/command.d.ts +25 -0
  36. package/dist/commands/runs/show/metadata.js +2 -2
  37. package/dist/commands/runs/show/outcomes.d.ts +25 -0
  38. package/dist/commands/runs/show/outcomes.js +37 -5
  39. package/dist/commands/vitest/command.d.ts +325 -0
  40. package/dist/commands/vitest/command.js +138 -0
  41. package/dist/commands/vitest/metadata.d.ts +69 -0
  42. package/dist/commands/vitest/metadata.js +35 -0
  43. package/dist/commands/vitest/outcomes.d.ts +298 -0
  44. package/dist/commands/vitest/outcomes.js +77 -0
  45. package/dist/config/index.d.ts +2 -1
  46. package/dist/config/index.js +1 -0
  47. package/dist/config/resolve.d.ts +3 -3
  48. package/dist/config/resolve.js +3 -3
  49. package/dist/config/resource-config.d.ts +2 -2
  50. package/dist/config/schema.d.ts +1 -1
  51. package/dist/config/set.d.ts +15 -4
  52. package/dist/config/set.js +28 -12
  53. package/dist/config-file/define.d.ts +8 -6
  54. package/dist/context.d.ts +6 -3
  55. package/dist/context.js +4 -2
  56. package/dist/core/command-provider.d.ts +1 -1
  57. package/dist/core/events.d.ts +9 -7
  58. package/dist/core/presentation.js +1 -1
  59. package/dist/core/presentations.js +1 -1
  60. package/dist/core/run-state.d.ts +30 -6
  61. package/dist/core/run-state.js +19 -4
  62. package/dist/core/run.d.ts +17 -4
  63. package/dist/core/run.js +61 -25
  64. package/dist/resources/testserver/command.d.ts +1 -1
  65. package/dist/resources/testserver/command.js +1 -1
  66. package/dist/resources/testserver/config.d.ts +1 -1
  67. package/dist/resources/testserver/config.js +3 -2
  68. package/dist/resources/testserver/credential-facts.js +1 -1
  69. package/dist/resources/testserver/resource.d.ts +2 -2
  70. package/dist/resources/testserver/sandbox/create.d.ts +2 -2
  71. package/dist/resources/testserver/sandbox/create.js +2 -2
  72. package/dist/resources.d.ts +9 -6
  73. package/dist/resources.js +3 -3
  74. package/dist/runner/events.d.ts +64 -1
  75. package/dist/runner/gateways.d.ts +17 -6
  76. package/dist/runner/index.d.ts +5 -4
  77. package/dist/runner/index.js +4 -3
  78. package/dist/runner/live/snapshot-records.js +18 -4
  79. package/dist/runner/prepare.d.ts +23 -4
  80. package/dist/runner/prepare.js +13 -3
  81. package/dist/runner/ready.d.ts +7 -3
  82. package/dist/runner/ready.js +11 -5
  83. package/dist/runner/scope.d.ts +17 -1
  84. package/dist/runner/scope.js +4 -0
  85. package/dist/runner/snapshot-build.d.ts +3 -1
  86. package/dist/runner/snapshot-build.js +12 -2
  87. package/dist/runner/snapshot-cache.d.ts +46 -8
  88. package/dist/runner/snapshot-cache.js +60 -11
  89. package/dist/runner/snapshot-key.d.ts +12 -1
  90. package/dist/runner/snapshot-key.js +17 -1
  91. package/dist/runner/snapshot-save.d.ts +53 -0
  92. package/dist/runner/snapshot-save.js +148 -0
  93. package/dist/sdk/index.js +1 -1
  94. package/dist/sdk/payload/payload.d.ts +2 -2
  95. package/dist/sdk/payload/payload.js +2 -2
  96. package/dist/story/align.d.ts +1 -1
  97. package/dist/story/align.js +1 -1
  98. package/dist/story/definition.d.ts +22 -15
  99. package/dist/story/definition.js +2 -2
  100. package/dist/story/errors.js +1 -1
  101. package/dist/story/gateways.d.ts +45 -25
  102. package/dist/story/gateways.js +2 -2
  103. package/dist/story/host.d.ts +11 -8
  104. package/dist/story/host.js +37 -37
  105. package/dist/story/index.d.ts +1 -1
  106. package/dist/story/index.js +4 -4
  107. package/dist/story/json.d.ts +1 -1
  108. package/dist/story/json.js +2 -2
  109. package/dist/story/live/recording-gateway.d.ts +2 -0
  110. package/dist/story/live/{artifact-gateway.js → recording-gateway.js} +33 -12
  111. package/dist/story/mode.d.ts +2 -2
  112. package/dist/story/mode.js +1 -1
  113. package/dist/story/orphans.d.ts +23 -5
  114. package/dist/story/orphans.js +44 -8
  115. package/dist/story/recording.d.ts +62 -0
  116. package/dist/story/{artifact.js → recording.js} +31 -27
  117. package/dist/story/report.d.ts +21 -9
  118. package/dist/story/report.js +37 -25
  119. package/dist/story/settle.d.ts +23 -21
  120. package/dist/story/settle.js +17 -16
  121. package/dist/story/{run.d.ts → start.d.ts} +18 -17
  122. package/dist/story/{run.js → start.js} +66 -43
  123. package/dist/vercel-cli/driver.d.ts +1 -1
  124. package/dist/vercel-cli/entry.d.ts +1 -1
  125. package/dist/vercel-cli/entry.js +1 -1
  126. package/dist/vercel-cli/verbose.d.ts +2 -2
  127. package/dist/vercel-cli/verbose.js +2 -2
  128. package/dist/vitest/config.d.ts +5 -5
  129. package/dist/vitest/config.js +5 -5
  130. package/dist/vitest/find-vitest.d.ts +7 -0
  131. package/dist/vitest/find-vitest.js +28 -0
  132. package/dist/vitest/fixtures.d.ts +2 -2
  133. package/dist/vitest/fixtures.js +3 -3
  134. package/dist/vitest/gateways.d.ts +37 -6
  135. package/dist/vitest/gateways.js +3 -2
  136. package/dist/vitest/live/list-gateway.d.ts +7 -3
  137. package/dist/vitest/live/list-gateway.js +55 -8
  138. package/dist/vitest/plan.d.ts +41 -8
  139. package/dist/vitest/plan.js +47 -16
  140. package/dist/vitest/sandbox.d.ts +1 -1
  141. package/dist/vitest/sandbox.js +1 -1
  142. package/dist/vitest/test-events.d.ts +2 -2
  143. package/dist/vitest/test-events.js +3 -3
  144. package/dist/vitest/test-results.d.ts +1 -1
  145. package/dist/vitest/test-results.js +1 -1
  146. package/dist/vitest/types.d.ts +1 -1
  147. package/package.json +2 -2
  148. package/skills/overview.md +5 -4
  149. package/skills/read-run-output.md +1 -1
  150. package/dist/commands/run/command.d.ts +0 -327
  151. package/dist/commands/run/command.js +0 -620
  152. package/dist/commands/run/metadata.d.ts +0 -47
  153. package/dist/commands/run/metadata.js +0 -83
  154. package/dist/commands/run/outcomes.js +0 -332
  155. package/dist/story/artifact.d.ts +0 -60
  156. package/dist/story/live/artifact-gateway.d.ts +0 -2
  157. /package/dist/commands/{run → exec}/live-view.d.ts +0 -0
  158. /package/dist/commands/{run → exec}/mint-failed.d.ts +0 -0
  159. /package/dist/commands/{run → exec}/redaction.d.ts +0 -0
  160. /package/dist/commands/{run → exec}/redaction.js +0 -0
  161. /package/dist/commands/{run → exec}/run-collector.d.ts +0 -0
  162. /package/dist/commands/{run → exec}/run-collector.js +0 -0
  163. /package/dist/commands/{run → exec}/tests-summary.d.ts +0 -0
  164. /package/dist/commands/{run → exec}/tests-summary.js +0 -0
  165. /package/dist/commands/{run → exec}/text.d.ts +0 -0
  166. /package/dist/commands/{run → exec}/text.js +0 -0
  167. /package/dist/commands/{run → exec}/view.d.ts +0 -0
  168. /package/dist/commands/{run → exec}/waterfall.d.ts +0 -0
  169. /package/dist/commands/{run → exec}/waterfall.js +0 -0
  170. /package/dist/commands/{run → exec}/worker-chart.d.ts +0 -0
  171. /package/dist/commands/{run → exec}/worker-chart.js +0 -0
@@ -1,3 +1,3 @@
1
1
  // Written by scripts/write-build-info.js when the package was built.
2
- export const sha = "f3a9531a351e";
2
+ export const sha = "4c286290a36f";
3
3
  export const dirty = false;
@@ -1,5 +1,5 @@
1
- // One record of named errors, or of error definitions, from several, for a command's `defineOutcomes`: the `run`
2
- // command lists every resource's errors this way, and defines every resource's refusal errors from their combined
1
+ // One record of named errors, or of error definitions, from several, for a command's `defineOutcomes`: `exec` and
2
+ // `vitest` list every resource's errors this way, and define every resource's refusal errors from their combined
3
3
  // definitions. Spreading the records would keep the last of two errors with the same key without a word, so this
4
4
  // refuses a key two records share. It moves into Clinkr once a second consumer needs it.
5
5
  /**
@@ -1,4 +1,4 @@
1
- // The Vercel dashboard's pages for a runner run's sandboxes and snapshots, which `storm run` and `storm runs`
1
+ // The Vercel dashboard's pages for a runner run's sandboxes and snapshots, which a run and `storm runs`
2
2
  // link to. Each URL takes the control plane team's slug, which `--scope` names, and the project's name.
3
3
  /** The project's page in the Vercel dashboard. */
4
4
  function projectPage({ team, project }) {
@@ -108,7 +108,7 @@ export type WithCleanup<R> = {
108
108
  ]>;
109
109
  };
110
110
  /**
111
- * A resource's refusal errors, as the `run` command lists and returns them: each defined with the run's cleanup beside
111
+ * A resource's refusal errors, as `exec` and `vitest` list and return them: each defined with the run's cleanup beside
112
112
  * its own data (`errors`), and `build`, the one a refusal fact names, with the run's cleanup.
113
113
  */
114
114
  export interface CleanupReporting<R> {
@@ -2,7 +2,7 @@
2
2
  // run's sandboxes and releasing each resource the run held couldn't do. The run owns it, not a resource: every outcome
3
3
  // after the run starts acquiring carries it as `cleanup`, with `runner` (the runner sandbox a runner run kept running
4
4
  // or couldn't keep, and the sandboxes it couldn't stop or delete; null with --local) and
5
- // `resources` (each held resource's cleanup facts, by name, from its cleanup report). The `run` command's own outcomes
5
+ // `resources` (each held resource's cleanup facts, by name, from its cleanup report). A run's own outcomes
6
6
  // declare `cleanup` in their schemas; a resource's refusal errors don't know it, so a resource hands their definitions,
7
7
  // and the registry defines them through `withCleanup`, with `cleanup` beside each one's data, and builds the one a
8
8
  // refusal names with the run's cleanup.
@@ -1,57 +1,31 @@
1
+ import type { CommandBuilder } from "@vercel/clinkr";
1
2
  import { z } from "zod";
2
- /** A run's waterfall (`Timeline`), times in milliseconds since the run started, as `timeline.json` holds it too. */
3
- export declare const timelineSchema: z.ZodObject<{
4
- startedAt: z.ZodString;
5
- totalMs: z.ZodNumber;
6
- rows: z.ZodArray<z.ZodObject<{
7
- name: z.ZodEnum<{
8
- cleanup: "cleanup";
9
- mint: "mint";
10
- runner: "runner";
11
- tests: "tests";
12
- testserver: "testserver";
13
- }>;
14
- startMs: z.ZodNumber;
15
- endMs: z.ZodNumber;
16
- outcome: z.ZodEnum<{
17
- done: "done";
18
- failed: "failed";
19
- stopped: "stopped";
20
- unfinished: "unfinished";
21
- }>;
22
- steps: z.ZodArray<z.ZodObject<{
23
- name: z.ZodEnum<{
24
- [x: string]: string;
25
- }>;
26
- startMs: z.ZodNumber;
27
- endMs: z.ZodNumber;
28
- outcome: z.ZodEnum<{
29
- done: "done";
30
- failed: "failed";
31
- stopped: "stopped";
32
- unfinished: "unfinished";
33
- }>;
34
- }, z.core.$strip>>;
35
- idleMs: z.ZodNumber;
36
- snapshot: z.ZodOptional<z.ZodEnum<{
37
- built: "built";
38
- reused: "reused";
39
- }>>;
40
- sandboxes: z.ZodOptional<z.ZodObject<{
41
- reused: z.ZodNumber;
42
- created: z.ZodNumber;
43
- }, z.core.$strip>>;
44
- }, z.core.$strip>>;
45
- criticalPath: z.ZodArray<z.ZodEnum<{
46
- cleanup: "cleanup";
3
+ import type { StormApp } from "../../context.ts";
4
+ /**
5
+ * `storm exec`: runs any command, the argument list after `--`, as it is, in a run (`runCommand`). It counts no
6
+ * tests and sizes nothing: `storm vitest` does both for vitest.
7
+ */
8
+ export declare function command(cmd: CommandBuilder<StormApp>): import("@vercel/clinkr").CommandDefinition<z.ZodObject<{
9
+ set: z.ZodDefault<z.ZodArray<z.ZodString>>;
10
+ testserverSandboxes: z.ZodOptional<z.ZodNumber>;
11
+ testserverBuild: z.ZodOptional<z.ZodString>;
12
+ testserverMinTimeLeft: z.ZodOptional<z.ZodString>;
13
+ testserverTtl: z.ZodOptional<z.ZodString>;
14
+ testserverNoCreate: z.ZodOptional<z.ZodBoolean>;
15
+ scope: z.ZodOptional<z.ZodString>;
16
+ project: z.ZodOptional<z.ZodString>;
17
+ credential: z.ZodOptional<z.ZodEnum<{
18
+ "github-actions": "github-actions";
47
19
  mint: "mint";
48
- runner: "runner";
49
- tests: "tests";
50
- testserver: "testserver";
51
20
  }>>;
52
- }, z.core.$strip>;
53
- /** How `run` ends. No outcome carries the credential. */
54
- export declare const outcomes: import("@vercel/clinkr").Outcomes<{
21
+ local: z.ZodDefault<z.ZodBoolean>;
22
+ rebuildSnapshot: z.ZodDefault<z.ZodBoolean>;
23
+ saveSnapshot: z.ZodDefault<z.ZodBoolean>;
24
+ showOutput: z.ZodDefault<z.ZodBoolean>;
25
+ keepSandbox: z.ZodOptional<z.ZodString>;
26
+ verbose: z.ZodDefault<z.ZodBoolean>;
27
+ command: z.ZodArray<z.ZodString>;
28
+ }, z.core.$strip>, import("@vercel/clinkr").Outcomes<{
55
29
  ran: z.ZodObject<{
56
30
  version: z.ZodString;
57
31
  commit: z.ZodNullable<z.ZodString>;
@@ -65,10 +39,35 @@ export declare const outcomes: import("@vercel/clinkr").Outcomes<{
65
39
  runner: z.ZodNullable<z.ZodObject<{
66
40
  snapshotId: z.ZodString;
67
41
  base: z.ZodString;
42
+ snapshotBranch: z.ZodNullable<z.ZodString>;
43
+ snapshotHead: z.ZodNullable<z.ZodString>;
68
44
  built: z.ZodBoolean;
69
45
  vcpus: z.ZodNumber;
70
46
  region: z.ZodString;
71
47
  runtime: z.ZodString;
48
+ buildMs: z.ZodNumber;
49
+ save: z.ZodNullable<z.ZodDiscriminatedUnion<[z.ZodObject<{
50
+ kind: z.ZodLiteral<"saved">;
51
+ snapshotId: z.ZodString;
52
+ base: z.ZodString;
53
+ branch: z.ZodString;
54
+ head: z.ZodString;
55
+ ms: z.ZodNumber;
56
+ sizeBytes: z.ZodNumber;
57
+ entryWritten: z.ZodBoolean;
58
+ }, z.core.$strip>, z.ZodObject<{
59
+ kind: z.ZodLiteral<"skipped">;
60
+ reason: z.ZodLiteral<"detached-head">;
61
+ }, z.core.$strip>, z.ZodObject<{
62
+ kind: z.ZodLiteral<"failed">;
63
+ step: z.ZodEnum<{
64
+ "save-snapshot": "save-snapshot";
65
+ scrub: "scrub";
66
+ }>;
67
+ message: z.ZodString;
68
+ }, z.core.$strip>, z.ZodObject<{
69
+ kind: z.ZodLiteral<"stopped">;
70
+ }, z.core.$strip>], "kind">>;
72
71
  }, z.core.$strip>>;
73
72
  timeline: z.ZodObject<{
74
73
  startedAt: z.ZodString;
@@ -125,66 +124,6 @@ export declare const outcomes: import("@vercel/clinkr").Outcomes<{
125
124
  }, {
126
125
  ran: unknown;
127
126
  }, {
128
- credentialUnused: z.ZodObject<{
129
- flags: z.ZodArray<z.ZodString>;
130
- configFile: z.ZodNullable<z.ZodString>;
131
- }, z.core.$strip>;
132
- missingRunner: z.ZodObject<{
133
- configFile: z.ZodNullable<z.ZodString>;
134
- }, z.core.$strip>;
135
- noBaseRef: z.ZodObject<{
136
- refs: z.ZodArray<z.ZodObject<{
137
- ref: z.ZodString;
138
- reason: z.ZodEnum<{
139
- missing: "missing";
140
- unrelated: "unrelated";
141
- }>;
142
- }, z.core.$strip>>;
143
- }, z.core.$strip>;
144
- submodulesRefused: z.ZodObject<{
145
- paths: z.ZodArray<z.ZodString>;
146
- }, z.core.$strip>;
147
- snapshotGone: z.ZodObject<{
148
- snapshotId: z.ZodString;
149
- base: z.ZodString;
150
- removal: z.ZodNullable<z.ZodObject<{
151
- path: z.ZodString;
152
- message: z.ZodString;
153
- }, z.core.$strip>>;
154
- cleanup: z.ZodType<import("./cleanup.ts").StormCleanupFacts, import("./cleanup.ts").StormCleanupFacts, z.core.$ZodTypeInternals<import("./cleanup.ts").StormCleanupFacts, import("./cleanup.ts").StormCleanupFacts>>;
155
- }, z.core.$strip>;
156
- runnerFailed: z.ZodObject<{
157
- failure: z.ZodUnion<readonly [z.ZodObject<{
158
- kind: z.ZodEnum<{
159
- "apply-failed": "apply-failed";
160
- "build-failed": "build-failed";
161
- "install-failed": "install-failed";
162
- "snapshot-build-step-failed": "snapshot-build-step-failed";
163
- }>;
164
- label: z.ZodString;
165
- exitCode: z.ZodNullable<z.ZodNumber>;
166
- tail: z.ZodArray<z.ZodString>;
167
- }, z.core.$strip>, z.ZodObject<{
168
- kind: z.ZodLiteral<"sandbox-api-failed">;
169
- operation: z.ZodString;
170
- status: z.ZodNullable<z.ZodNumber>;
171
- message: z.ZodString;
172
- }, z.core.$strip>, z.ZodObject<{
173
- kind: z.ZodLiteral<"checkout-failed">;
174
- message: z.ZodString;
175
- command: z.ZodNullable<z.ZodString>;
176
- }, z.core.$strip>, z.ZodObject<{
177
- kind: z.ZodLiteral<"credential-claims-missing">;
178
- team: z.ZodString;
179
- project: z.ZodString;
180
- }, z.core.$strip>]>;
181
- cleanup: z.ZodType<import("./cleanup.ts").StormCleanupFacts, import("./cleanup.ts").StormCleanupFacts, z.core.$ZodTypeInternals<import("./cleanup.ts").StormCleanupFacts, import("./cleanup.ts").StormCleanupFacts>>;
182
- }, z.core.$strip>;
183
- spawnFailed: z.ZodObject<{
184
- executable: z.ZodString;
185
- message: z.ZodString;
186
- cleanup: z.ZodType<import("./cleanup.ts").StormCleanupFacts, import("./cleanup.ts").StormCleanupFacts, z.core.$ZodTypeInternals<import("./cleanup.ts").StormCleanupFacts, import("./cleanup.ts").StormCleanupFacts>>;
187
- }, z.core.$strip>;
188
127
  credentialRejected: import("@vercel/clinkr").SharedError<"credential_rejected", [{
189
128
  origin: {
190
129
  source: "mint";
@@ -214,6 +153,10 @@ export declare const outcomes: import("@vercel/clinkr").Outcomes<{
214
153
  } & {
215
154
  readonly cleanup: import("./cleanup.ts").StormCleanupFacts;
216
155
  }]>;
156
+ credentialUnused: import("@vercel/clinkr").SharedError<"credential_unused", [data: {
157
+ flags: string[];
158
+ configFile: string | null;
159
+ }]>;
217
160
  githubFixtureRepoUnavailable: import("@vercel/clinkr").SharedError<"github_fixture_repo_unavailable", [{
218
161
  repo: string;
219
162
  status: number | null;
@@ -258,9 +201,18 @@ export declare const outcomes: import("@vercel/clinkr").Outcomes<{
258
201
  runner: boolean;
259
202
  cleanup: import("./cleanup.ts").StormCleanupFacts;
260
203
  }]>;
204
+ missingRunner: import("@vercel/clinkr").SharedError<"missing_runner", [data: {
205
+ configFile: string | null;
206
+ }]>;
261
207
  missingTarget: import("@vercel/clinkr").SharedError<"missing_target", [data: {
262
208
  missing: ("project" | "scope")[];
263
209
  }]>;
210
+ noBaseRef: import("@vercel/clinkr").SharedError<"no_base_ref", [data: {
211
+ refs: {
212
+ ref: string;
213
+ reason: "missing" | "unrelated";
214
+ }[];
215
+ }]>;
264
216
  noSandboxes: import("@vercel/clinkr").SharedError<"no_sandboxes", [{
265
217
  requested: number;
266
218
  ttlMinutes: number;
@@ -288,6 +240,45 @@ export declare const outcomes: import("@vercel/clinkr").Outcomes<{
288
240
  } & {
289
241
  readonly cleanup: import("./cleanup.ts").StormCleanupFacts;
290
242
  }]>;
243
+ runnerFailed: import("@vercel/clinkr").SharedError<"runner_failed", [data: {
244
+ failure: {
245
+ kind: "apply-failed" | "build-failed" | "install-failed" | "snapshot-build-step-failed";
246
+ label: string;
247
+ exitCode: number | null;
248
+ tail: string[];
249
+ } | {
250
+ kind: "sandbox-api-failed";
251
+ operation: string;
252
+ status: number | null;
253
+ message: string;
254
+ } | {
255
+ kind: "checkout-failed";
256
+ message: string;
257
+ command: string | null;
258
+ } | {
259
+ kind: "credential-claims-missing";
260
+ team: string;
261
+ project: string;
262
+ };
263
+ cleanup: import("./cleanup.ts").StormCleanupFacts;
264
+ }]>;
265
+ snapshotGone: import("@vercel/clinkr").SharedError<"snapshot_gone", [data: {
266
+ snapshotId: string;
267
+ base: string;
268
+ removal: {
269
+ path: string;
270
+ message: string;
271
+ } | null;
272
+ cleanup: import("./cleanup.ts").StormCleanupFacts;
273
+ }]>;
274
+ spawnFailed: import("@vercel/clinkr").SharedError<"spawn_failed", [data: {
275
+ executable: string;
276
+ message: string;
277
+ cleanup: import("./cleanup.ts").StormCleanupFacts;
278
+ }]>;
279
+ submodulesRefused: import("@vercel/clinkr").SharedError<"submodules_refused", [data: {
280
+ paths: string[];
281
+ }]>;
291
282
  tokenRequestFailed: import("@vercel/clinkr").SharedError<"token_request_failed", [{
292
283
  cause: "request-failed" | "variables-missing";
293
284
  missing: ("ACTIONS_ID_TOKEN_REQUEST_TOKEN" | "ACTIONS_ID_TOKEN_REQUEST_URL")[] | null;
@@ -304,4 +295,4 @@ export declare const outcomes: import("@vercel/clinkr").Outcomes<{
304
295
  } & {
305
296
  readonly cleanup: import("./cleanup.ts").StormCleanupFacts;
306
297
  }]>;
307
- }>;
298
+ }>, StormApp, false>;
@@ -0,0 +1,23 @@
1
+ import { z } from "zod";
2
+ import { outcomes } from "./outcomes.js";
3
+ import { RUN_CLI_OPTIONS, RUN_REQUEST_FIELDS, runCommand, runProblems } from "./run-command.js";
4
+ /**
5
+ * `storm exec`: runs any command, the argument list after `--`, as it is, in a run (`runCommand`). It counts no
6
+ * tests and sizes nothing: `storm vitest` does both for vitest.
7
+ */
8
+ export function command(cmd) {
9
+ return cmd.define({
10
+ requestSchema: z.object({
11
+ ...RUN_REQUEST_FIELDS,
12
+ command: z.array(z.string()).min(1, { message: "Give the command to run after --" }),
13
+ }),
14
+ cli: { options: RUN_CLI_OPTIONS, positionals: ["command"] },
15
+ outcomes,
16
+ validate: runProblems,
17
+ handler: async (context, request) => await runCommand(context, request, {
18
+ name: "exec",
19
+ prepare: async (settled) => ({ ok: true, argv: request.command, settled, plan: undefined }),
20
+ ran: (facts) => outcomes.ran(facts),
21
+ }),
22
+ });
23
+ }
@@ -1,6 +1,10 @@
1
1
  import type { StormTimeline } from "../../resources.ts";
2
- /** The job summary's Markdown for `timeline`; `details` are lines after the critical path, such as the tests'. */
2
+ /**
3
+ * The job summary's Markdown for `timeline`, headed with the invoking command, `storm <command>`; `details` are
4
+ * lines after the critical path, such as the tests'.
5
+ */
3
6
  export declare function jobSummaryMarkdown(timeline: StormTimeline, extras: {
7
+ readonly command: string;
4
8
  readonly logs: string | undefined;
5
9
  readonly details?: readonly string[];
6
10
  }): string;
@@ -2,9 +2,12 @@
2
2
  // and where its run directory is, so a CI run that uploads it as an artifact can find it.
3
3
  import { seconds } from "./text.js";
4
4
  import { criticalPathStep, laneLabel } from "./waterfall.js";
5
- /** The job summary's Markdown for `timeline`; `details` are lines after the critical path, such as the tests'. */
5
+ /**
6
+ * The job summary's Markdown for `timeline`, headed with the invoking command, `storm <command>`; `details` are
7
+ * lines after the critical path, such as the tests'.
8
+ */
6
9
  export function jobSummaryMarkdown(timeline, extras) {
7
- const lines = ["### storm run", ""];
10
+ const lines = [`### storm ${extras.command}`, ""];
8
11
  if (timeline.rows.length > 0) {
9
12
  lines.push("| Lane | Start | Duration | Idle | Steps |", "| --- | ---: | ---: | ---: | --- |");
10
13
  for (const row of timeline.rows)
@@ -72,7 +72,7 @@ export function phaseFrame(state, phase, now, width, paint) {
72
72
  case "tests":
73
73
  return testsFrame(state, view);
74
74
  case "cleanup":
75
- return state.cleanup === undefined ? [] : [cleanupLine(state.cleanup, state.runner?.kept, view, false)];
75
+ return state.cleanup === undefined ? [] : [cleanupLine(state.cleanup, state.runner, view, false)];
76
76
  }
77
77
  }
78
78
  /**
@@ -102,7 +102,7 @@ export function phaseRecord(state, phase, width, paint) {
102
102
  case "tests":
103
103
  return state.command === undefined ? [] : [testsLine(state, state.command, view, false)];
104
104
  case "cleanup":
105
- return state.cleanup === undefined ? [] : [cleanupLine(state.cleanup, state.runner?.kept, view, true)];
105
+ return state.cleanup === undefined ? [] : [cleanupLine(state.cleanup, state.runner, view, true)];
106
106
  }
107
107
  }
108
108
  /** What a resource lane's presentation draws with: `view`, with its span's time and durations. */
@@ -354,27 +354,43 @@ function testsProgress(tests, view, room) {
354
354
  return visibleLength(full) <= room ? full : text(false);
355
355
  }
356
356
  /**
357
- * The cleanup row: what it does while it runs, what it did in its final form, with the runner sandbox it `kept`
358
- * running, if it kept one.
357
+ * The cleanup row: what it does while it runs, what it did in its final form, with the runner sandbox it kept
358
+ * running, if it kept one, or the branch snapshot it saved it as.
359
359
  */
360
- function cleanupLine(cleanup, kept, view, record) {
360
+ function cleanupLine(cleanup, runner, view, record) {
361
361
  const done = record || cleanup.status !== "running";
362
362
  const releases = RESOURCE_PRESENTATIONS.releaseTexts(cleanup.holdings, done ? "done" : "doing");
363
363
  const release = releases.length === 0 ? undefined : releases.join(", ");
364
- const sandbox = kept !== undefined
365
- ? `kept the runner sandbox until ${isoSecondsText(kept.stopsAt)}`
366
- : !done && cleanup.keepSandboxMs > 0
367
- ? `keeping the runner sandbox running ${keepTimeText(cleanup.keepSandboxMs)}`
368
- : `${done ? "stopped and deleted" : "stopping and deleting"} the runner sandbox`;
364
+ const { runnerSandbox } = cleanup;
369
365
  const text = !done && cleanup.waiting
370
366
  ? `${WAITING_FOR_SNAPSHOT}…`
371
- : cleanup.runner
372
- ? `${sandbox}${release === undefined ? "" : `, ${release}`}`
373
- : (release ?? "nothing to release");
367
+ : runnerSandbox === null
368
+ ? (release ?? "nothing to release")
369
+ : `${runnerSandboxText(runnerSandbox, runner, done)}${release === undefined ? "" : `, ${release}`}`;
374
370
  const leftBehind = cleanupProblems(cleanup);
375
371
  const ending = done ? (leftBehind === 0 ? "" : `: ${leftBehind} left behind`) : "…";
376
372
  return view.row(` ${view.glyph(cleanup.status)} cleanup ${text}${!done && cleanup.waiting ? "" : ending}`, elapsed(view, cleanup.startedAt, cleanup.endedAt));
377
373
  }
374
+ /**
375
+ * What cleanup does with the runner sandbox, as the cleanup row says: kept it running, keeps it running while cleanup
376
+ * runs (`keep`), saves it or saved it as a branch snapshot (`save`), or else stops and deletes it.
377
+ */
378
+ function runnerSandboxText(sandbox, runner, done) {
379
+ const kept = runner?.kept;
380
+ if (kept !== undefined)
381
+ return `kept the runner sandbox until ${isoSecondsText(kept.stopsAt)}`;
382
+ const removed = `${done ? "stopped and deleted" : "stopping and deleting"} the runner sandbox`;
383
+ switch (sandbox.kind) {
384
+ case "keep":
385
+ return !done && sandbox.ms > 0 ? `keeping the runner sandbox running ${keepTimeText(sandbox.ms)}` : removed;
386
+ case "save": {
387
+ const save = runner?.save;
388
+ if (save?.kind === "saved")
389
+ return `saved branch snapshot ${save.id} of ${save.branch}`;
390
+ return !done && save?.kind !== "not-saved" ? `saving a branch snapshot of ${sandbox.branch}` : removed;
391
+ }
392
+ }
393
+ }
378
394
  function statusGlyph(status, now, paint) {
379
395
  switch (status) {
380
396
  case "pending":
@@ -0,0 +1,69 @@
1
+ export declare const metadata: {
2
+ description: string;
3
+ summary: string;
4
+ usages: string[];
5
+ fields: {
6
+ testserverSandboxes: {
7
+ readonly valueLabel: "N";
8
+ readonly description: "How many Testserver sandboxes the command gets, 1 to 32, overriding resources.testserverPool.sandboxes in storm.config.ts; default 1. Gives the run a Testserver side.";
9
+ };
10
+ testserverBuild: {
11
+ readonly valueLabel: "BUILD";
12
+ readonly description: "The build the Testserver sandboxes run: a build name or the build channel stable or latest_main, overriding resources.testserverPool.build in storm.config.ts; default stable. Gives the run a Testserver side.";
13
+ };
14
+ testserverMinTimeLeft: {
15
+ readonly valueLabel: "DURATION";
16
+ readonly description: "The least time left a Testserver sandbox from the pool needs, in whole minutes or hours (30m, 2h), overriding resources.testserverPool.minTimeLeft in storm.config.ts; default 30m. Gives the run a Testserver side.";
17
+ };
18
+ testserverTtl: {
19
+ readonly valueLabel: "DURATION";
20
+ readonly description: "How long each Testserver sandbox the run creates lives, 10m to 5h and longer than minTimeLeft, overriding resources.testserverPool.ttl in storm.config.ts; default 5h. Not with noCreate. Gives the run a Testserver side.";
21
+ };
22
+ testserverNoCreate: {
23
+ readonly description: "Run only on Testserver sandboxes already in the pool, never minting for Testserver or creating: needs no --scope or --project with --local, and takes no --testserver-ttl. Turns on resources.testserverPool.noCreate whatever storm.config.ts says; without it, the file's noCreate, default false, applies. Gives the run a Testserver side.";
24
+ };
25
+ set: {
26
+ readonly valueLabel: "KEY=VALUE";
27
+ readonly description: "Set a resource's option for this run by its key path in storm.config.ts, resources.<name>.<option>, overriding the file and the default; repeat it for each option. The key paths: resources.githubFixtureRepo.repo, the GitHub repository as owner/name, required; resources.githubFixtureRepo.tokenEnv, the host environment variable holding its token, required; resources.githubFixtureRepo.optional, true or false, default false: false refuses the run without the token, true goes on without the repository. The Testserver pool resource's options have their own flags, --testserver-<option>, which --set doesn't take. Any --set of a resource's option gives the run that resource, as storm.config.ts does. An unknown key path, one given twice, one with its own flag, or a value its option refuses is a usage error. Options that don't fit together once merged, or a required one nothing gives, are invalid_resource_options, naming where each value came from.";
28
+ };
29
+ credential: {
30
+ readonly valueLabel: "SOURCE";
31
+ readonly description: "The credential source: mint, the default, mints one with the vercel CLI for --scope and --project; github-actions requests a GitHub Actions OIDC token, in a GitHub Actions job with permissions id-token: write, anew once it is 4 minutes old, and needs no --scope or --project. Only --local takes it: a runner run needs the mint. Only a run holding a resource that takes a credential takes it, the Testserver pool resource without noCreate (resources.testserverPool in storm.config.ts, or any --testserver-* flag but --testserver-no-create); otherwise it is credential_unused. No config key.";
32
+ };
33
+ local: {
34
+ readonly description: "Run the command on this machine instead of in a runner sandbox. Without it, the command runs in a Vercel Sandbox started from a runner snapshot of the base, with this checkout's changes applied, installed and built, from the runner key of storm.config.ts, and its output streams back with paths rewritten to this checkout's. No config key.";
35
+ };
36
+ rebuildSnapshot: {
37
+ readonly description: "Build a runner snapshot of the base whatever the runner snapshot cache holds, replacing an entry for the same base, and drop this branch's saved branch snapshots from the cache. Not with --local. No config key.";
38
+ };
39
+ saveSnapshot: {
40
+ readonly description: "Once the command ends on its own after a successful install and build, save the runner sandbox as this branch's runner snapshot, so the next run on the branch starts from this run's install and build outputs. The run resets the working tree to the snapshot's base, keeps .git and ignored files such as node_modules and build outputs, and empties /tmp; the snapshot keeps whatever the command wrote there and to $HOME, a resource's token included. A run with it on a branch keeps no runner sandbox, even when it fails or stops before the save. With a detached HEAD it says so as it starts and keeps the runner sandbox as without the flag. Not with --local, or with --keep-sandbox above 0. No config key.";
41
+ };
42
+ keepSandbox: {
43
+ readonly valueLabel: "DURATION";
44
+ readonly description: "How long the runner sandbox keeps running once the run ends, however it ends, so you can connect to it from its page in the Vercel dashboard: 0, which stops and deletes it with the run's other sandboxes, or a whole number of minutes or hours up to 5h (30m, 2h). The run asks Vercel Sandbox to extend the runner sandbox's timeout when it would stop sooner; it never shortens it, so the sandbox may run past the keep time until its own timeout. The run says until when it runs, and storm runs show and runs list say so too. Default: keepSandbox in the runner recipe, else 30m, or 0 when CI is set. Not with --local.";
45
+ };
46
+ showOutput: {
47
+ readonly description: "In a runner run on a terminal, print the runner's step output (a snapshot build, the install, the build) above the live view instead of keeping only each step's last line there. Plain output always prints it. Either way, the run directory keeps it whole. Not with --local. No config key.";
48
+ };
49
+ verbose: {
50
+ readonly description: "Print more as it happens: each Testserver sandbox create's progress messages, the runner's step output as with --show-output, and verbose in the run payload, which has the Vitest adapter's reporters print each test as it finishes and its fixtures print each container start, proxied request and vercel invocation, for passing tests too. No config key.";
51
+ };
52
+ scope: {
53
+ readonly valueLabel: "TEAM";
54
+ readonly description: "The control plane team: the Vercel team whose project's development OIDC tokens the Testserver control plane trusts. Required, from this flag or scope in storm.config.ts, unless --local without a Testserver side, with noCreate or with --credential github-actions.";
55
+ };
56
+ project: {
57
+ readonly valueLabel: "PROJECT";
58
+ readonly description: "The control plane project: the Vercel project, within the team, to mint the credential for. Required, from this flag or project in storm.config.ts, unless --local without a Testserver side, with noCreate or with --credential github-actions.";
59
+ };
60
+ command: {
61
+ valueLabel: string;
62
+ description: string;
63
+ };
64
+ };
65
+ examples: {
66
+ argv: string;
67
+ description: string;
68
+ }[];
69
+ };
@@ -0,0 +1,55 @@
1
+ import { RUN_FIELDS, RUN_USAGE_FLAGS } from "./run-metadata.js";
2
+ export const metadata = {
3
+ description: "Run any command, the argument list after --, as it is, with the run payload in STORM_RUN. For vitest, use storm vitest, which counts the tests and sizes the run first; exec counts nothing and sizes nothing. In a local run (--local), the command runs on this machine in the working directory, with this machine's environment less the host variables a resource names (TESTSERVER_BASES and TESTSERVER_BASE), plus STORM_RUN, and FORCE_COLOR or NO_COLOR when neither is set. In a runner run, the default, it runs in a runner sandbox, a Vercel Sandbox readied from the runner recipe in storm.config.ts, in the recipe's cwd, with the runner sandbox's own environment, a PATH that starts with node_modules/.bin of that cwd and of the repository's root, the recipe's env and STORM_RUN, and nothing from this machine's environment; each path under the repository's root in its arguments points at the runner sandbox's copy, and each in its output back at this checkout. With a Testserver side (resources.testserverPool in storm.config.ts, or any --testserver-* flag), first lease usable Testserver sandboxes from the pool and create the rest, while a runner run readies its runner sandbox, and release the leases once the command ends; without one, the run payload names no Testserver sandbox. Shows on stderr what runs when and what runs at once, live on a terminal and one line at a time elsewhere, then a waterfall of the run's lanes naming its critical path, and exits with the command's code. Each run writes what it was and how it ended, its events, its steps' output, its command's output, its test events and its timeline to a run directory under ${XDG_STATE_HOME:-~/.local/state}/storm/runs/, named for its run id, keeping the newest 1000 completed ones and every one whose run is still going; the summary names the run id, storm runs show reads the run back, and storm runs logs prints its command's output and its steps' logs. A flag overrides storm.config.ts, found in the working directory or a parent up to the git worktree's root and checked whole, which overrides the built-in default. With resources.githubFixtureRepo, in storm.config.ts or by a --set of its options, the run reads a token for that GitHub repository from the host variable its tokenEnv names (refusing without it, unless optional), checks the token can read the repository, hands the command the repository, the token and a run prefix (run/<UTC timestamp>-<suffix>) in the run payload, shows the token as <token> in what it prints and writes, and deletes every branch under the run prefix once the command has stopped.",
4
+ summary: "Run any command, in a runner sandbox or locally.",
5
+ usages: [`${RUN_USAGE_FLAGS} -- <command...>`],
6
+ fields: {
7
+ ...RUN_FIELDS,
8
+ command: {
9
+ valueLabel: "command",
10
+ description: "The command to run, after --, as an argument list with no shell. Locally it gets this machine's working directory and environment, less TESTSERVER_BASES and TESTSERVER_BASE, plus STORM_RUN and FORCE_COLOR or NO_COLOR; in a runner run, the runner recipe's cwd, its env, the runner's PATH and STORM_RUN, with paths under the repository's root rewritten.",
11
+ },
12
+ },
13
+ examples: [
14
+ {
15
+ argv: "-- pnpm test",
16
+ description: "Run the package's test script in a runner sandbox, with the runner recipe, team and project from storm.config.ts, and its Testserver side, if it has one.",
17
+ },
18
+ {
19
+ argv: "--testserver-sandboxes 4 -- pnpm test:testserver",
20
+ description: "Run a script in a runner sandbox against 4 Testserver sandboxes.",
21
+ },
22
+ {
23
+ argv: "--local --testserver-sandboxes 4 --scope vercel --project vercel -- pnpm test",
24
+ description: "Run the tests on this machine against 4 Testserver sandboxes on the stable build channel.",
25
+ },
26
+ {
27
+ argv: "--keep-sandbox 2h -- pnpm test",
28
+ description: "Run the tests in a runner sandbox and keep it running 2 hours after the run, to debug in it.",
29
+ },
30
+ {
31
+ argv: "--local -- node scripts/smoke.mjs",
32
+ description: "Run a Node.js script on this machine, with no Testserver sandbox when storm.config.ts has no resources.testserverPool.",
33
+ },
34
+ {
35
+ argv: "--local --testserver-ttl 30m --testserver-min-time-left 25m -- pnpm test",
36
+ description: "Create Testserver sandboxes that live 30 minutes, with team and project from storm.config.ts.",
37
+ },
38
+ {
39
+ argv: "--local --testserver-no-create --testserver-sandboxes 4 -- pnpm test",
40
+ description: "Run only on Testserver sandboxes already in the pool, never minting.",
41
+ },
42
+ {
43
+ argv: "--local --verbose --testserver-sandboxes 2 -- pnpm test",
44
+ description: "Run the tests, printing each create's progress and, through the Vitest adapter, each test as it ends.",
45
+ },
46
+ {
47
+ argv: "--local --credential github-actions --testserver-ttl 30m --testserver-min-time-left 25m -- pnpm test",
48
+ description: "In a GitHub Actions job, create Testserver sandboxes with a GitHub Actions OIDC token.",
49
+ },
50
+ {
51
+ argv: "--local --testserver-build latest_main --testserver-min-time-left 75m --scope vercel --project vercel -- pnpm test",
52
+ description: "Run them on the newest main build, with Testserver sandboxes that live at least 75 more minutes.",
53
+ },
54
+ ],
55
+ };
@@ -1,7 +1,7 @@
1
- // The `run` command's `mint_failed`: the run's mint failed. In a runner run, the core mints for the runner sandbox
2
- // first, whatever the resources hold (`runner: true`); in a local run that settled the mint, the core's credential
3
- // source mints when a resource first asks for a credential, and the run ends this way when that resource can't go on
4
- // without it (`runner: false`).
1
+ // A run's `mint_failed`, `exec`'s and `vitest`'s: the run's mint failed. In a runner run, the core mints for the runner
2
+ // sandbox first, whatever the resources hold (`runner: true`); in a local run that settled the mint, the core's
3
+ // credential source mints when a resource first asks for a credential, and the run ends this way when that resource
4
+ // can't go on without it (`runner: false`).
5
5
  import { defineErrors } from "@vercel/clinkr";
6
6
  import { z } from "zod";
7
7
  import { RUN_CLEANUP } from "../../resources.js";