@cnc-tools/storm 0.12.0 → 0.13.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 (96) hide show
  1. package/dist/bin/storm.js +1 -1
  2. package/dist/build-info.js +1 -1
  3. package/dist/chunks/{chunk-4XT5RC5T.js → chunk-2NZXL6OH.js} +6 -42
  4. package/dist/chunks/{chunk-ISGQJIQM.js → chunk-5UMJNVKT.js} +1 -1
  5. package/dist/chunks/{chunk-FSP3SJ35.js → chunk-6EQKA7LI.js} +16 -46
  6. package/dist/chunks/{chunk-Y3BUNNRG.js → chunk-AX4EQZUS.js} +4 -4
  7. package/dist/chunks/{chunk-RYRJNHL7.js → chunk-DOFB2ACU.js} +3 -9
  8. package/dist/chunks/{chunk-SXW6XN4R.js → chunk-EGNP3S6C.js} +3 -3
  9. package/dist/chunks/{chunk-FK4RLDEK.js → chunk-N7E6DAUE.js} +1 -1
  10. package/dist/chunks/{chunk-U7M3ZB3Z.js → chunk-Q4TKRILH.js} +33 -167
  11. package/dist/chunks/{chunk-TMQQYHUX.js → chunk-RTILVSYQ.js} +1 -1
  12. package/dist/chunks/{chunk-7D6LC5JY.js → chunk-X4WBJIOF.js} +7 -39
  13. package/dist/chunks/{chunk-TEEZL3GA.js → chunk-YGS5VRQT.js} +11 -68
  14. package/dist/chunks/{chunk-ODQHQJLE.js → chunk-ZDJLKF2G.js} +742 -1117
  15. package/dist/chunks/{live-app-AZ5N5HBD.js → live-app-QFHS54SX.js} +4 -4
  16. package/dist/commands/exec/command.d.ts +2 -90
  17. package/dist/commands/exec/command.js +10 -10
  18. package/dist/commands/exec/define-run-command.d.ts +2 -90
  19. package/dist/commands/exec/live-view.js +18 -22
  20. package/dist/commands/exec/outcomes.d.ts +2 -106
  21. package/dist/commands/exec/outcomes.js +4 -35
  22. package/dist/commands/exec/progress.d.ts +3 -19
  23. package/dist/commands/exec/progress.js +16 -60
  24. package/dist/commands/exec/run-command.d.ts +4 -23
  25. package/dist/commands/exec/run-command.js +5 -79
  26. package/dist/commands/exec/run-metadata.d.ts +0 -6
  27. package/dist/commands/exec/run-metadata.js +2 -8
  28. package/dist/commands/exec/snapshot-text.d.ts +7 -16
  29. package/dist/commands/exec/snapshot-text.js +9 -49
  30. package/dist/commands/exec/view.js +2 -12
  31. package/dist/commands/playwright/command.d.ts +2 -90
  32. package/dist/commands/playwright/command.js +11 -11
  33. package/dist/commands/runs/facts.d.ts +1 -37
  34. package/dist/commands/runs/facts.js +4 -36
  35. package/dist/commands/runs/list/command.d.ts +0 -72
  36. package/dist/commands/runs/list/command.js +5 -5
  37. package/dist/commands/runs/list/outcomes.d.ts +0 -36
  38. package/dist/commands/runs/logs/command.js +5 -5
  39. package/dist/commands/runs/show/command.d.ts +0 -72
  40. package/dist/commands/runs/show/command.js +13 -40
  41. package/dist/commands/runs/show/metadata.js +1 -1
  42. package/dist/commands/runs/show/outcomes.d.ts +0 -36
  43. package/dist/commands/runs/show/outcomes.js +8 -42
  44. package/dist/commands/snapshots/build/command.d.ts +14 -411
  45. package/dist/commands/snapshots/build/command.js +56 -231
  46. package/dist/commands/snapshots/build/metadata.js +10 -7
  47. package/dist/commands/snapshots/build/outcomes.d.ts +11 -241
  48. package/dist/commands/snapshots/build/outcomes.js +29 -196
  49. package/dist/commands/snapshots/list/command.d.ts +2 -36
  50. package/dist/commands/snapshots/list/command.js +17 -53
  51. package/dist/commands/snapshots/list/metadata.js +1 -1
  52. package/dist/commands/snapshots/list/outcomes.d.ts +2 -37
  53. package/dist/commands/snapshots/list/outcomes.js +13 -53
  54. package/dist/commands/vitest/command.d.ts +2 -90
  55. package/dist/commands/vitest/command.js +11 -11
  56. package/dist/core/events.d.ts +5 -6
  57. package/dist/core/run-state.d.ts +7 -29
  58. package/dist/core/run-state.js +3 -26
  59. package/dist/core/run.d.ts +6 -14
  60. package/dist/core/run.js +17 -28
  61. package/dist/extensions/testserver/commands/pool/create/command.js +1 -1
  62. package/dist/run-directory/index.d.ts +1 -1
  63. package/dist/run-directory/index.js +0 -1
  64. package/dist/run-directory/recording.js +2 -2
  65. package/dist/run-directory/run-record.d.ts +14 -132
  66. package/dist/run-directory/run-record.js +8 -68
  67. package/dist/runner/build-snapshots.d.ts +50 -114
  68. package/dist/runner/build-snapshots.js +70 -159
  69. package/dist/runner/events.d.ts +4 -88
  70. package/dist/runner/gateways.d.ts +5 -23
  71. package/dist/runner/index.d.ts +5 -6
  72. package/dist/runner/index.js +1 -1
  73. package/dist/runner/live/snapshot-records.js +7 -18
  74. package/dist/runner/prepare.d.ts +11 -22
  75. package/dist/runner/prepare.js +6 -17
  76. package/dist/runner/ready.d.ts +16 -45
  77. package/dist/runner/ready.js +34 -59
  78. package/dist/runner/recipe.d.ts +0 -44
  79. package/dist/runner/recipe.js +0 -41
  80. package/dist/runner/scope.d.ts +8 -25
  81. package/dist/runner/scope.js +4 -8
  82. package/dist/runner/session.d.ts +18 -65
  83. package/dist/runner/session.js +15 -83
  84. package/dist/runner/snapshot-build.d.ts +2 -2
  85. package/dist/runner/snapshot-cache.d.ts +22 -74
  86. package/dist/runner/snapshot-cache.js +15 -107
  87. package/dist/runner/snapshot-inspect.d.ts +9 -13
  88. package/dist/runner/snapshot-inspect.js +48 -57
  89. package/dist/runner/snapshot-key.d.ts +9 -14
  90. package/dist/runner/snapshot-key.js +15 -22
  91. package/package.json +1 -1
  92. package/skills/read-run-output.md +8 -9
  93. package/dist/runner/snapshot-save.d.ts +0 -70
  94. package/dist/runner/snapshot-save.js +0 -160
  95. package/dist/runner/snapshot-start.d.ts +0 -25
  96. package/dist/runner/snapshot-start.js +0 -16
@@ -32,26 +32,14 @@ declare const _default: import("@vercel/clinkr").CommandDefinition<z.ZodObject<{
32
32
  readAt: z.ZodString;
33
33
  snapshots: z.ZodArray<z.ZodObject<{
34
34
  snapshotId: z.ZodString;
35
- kind: z.ZodEnum<{
36
- base: "base";
37
- dev: "dev";
38
- }>;
39
35
  recipe: z.ZodString;
40
36
  region: z.ZodString;
41
37
  runtime: z.ZodString;
42
38
  teamId: z.ZodString;
43
39
  projectId: z.ZodString;
44
40
  base: z.ZodString;
45
- builtAt: z.ZodString;
46
41
  inHistory: z.ZodNullable<z.ZodBoolean>;
47
42
  builtBehind: z.ZodNullable<z.ZodNumber>;
48
- checkout: z.ZodNullable<z.ZodEnum<{
49
- any: "any";
50
- here: "here";
51
- other: "other";
52
- }>>;
53
- repoRoot: z.ZodNullable<z.ZodString>;
54
- branch: z.ZodNullable<z.ZodString>;
55
43
  createdAt: z.ZodString;
56
44
  expiresAt: z.ZodString;
57
45
  expired: z.ZodBoolean;
@@ -59,14 +47,9 @@ declare const _default: import("@vercel/clinkr").CommandDefinition<z.ZodObject<{
59
47
  reason: z.ZodNullable<z.ZodEnum<{
60
48
  expired: "expired";
61
49
  "expires-soon": "expires-soon";
62
- "not-in-history": "not-in-history";
63
- "not-picked": "not-picked";
64
- "not-trusted": "not-trusted";
65
50
  "other-base": "other-base";
66
- "other-checkout": "other-checkout";
67
51
  "other-owner": "other-owner";
68
52
  "other-recipe": "other-recipe";
69
- "reuse-off": "reuse-off";
70
53
  "steps-changed": "steps-changed";
71
54
  }>>;
72
55
  }, z.core.$strip>>;
@@ -125,7 +108,7 @@ declare const _default: import("@vercel/clinkr").CommandDefinition<z.ZodObject<{
125
108
  };
126
109
  readonly checkoutFailed: {
127
110
  readonly exitCode: 1;
128
- readonly description: "git failed while storm checked the checkout or a cached snapshot's commit, as a run here would refuse.";
111
+ readonly description: "git failed while storm checked the checkout or a cached snapshot's base, as a run here would refuse.";
129
112
  readonly schema: z.ZodObject<{
130
113
  message: z.ZodString;
131
114
  }, z.core.$strip>;
@@ -161,26 +144,14 @@ declare const _default: import("@vercel/clinkr").CommandDefinition<z.ZodObject<{
161
144
  readAt: z.ZodString;
162
145
  snapshots: z.ZodArray<z.ZodObject<{
163
146
  snapshotId: z.ZodString;
164
- kind: z.ZodEnum<{
165
- base: "base";
166
- dev: "dev";
167
- }>;
168
147
  recipe: z.ZodString;
169
148
  region: z.ZodString;
170
149
  runtime: z.ZodString;
171
150
  teamId: z.ZodString;
172
151
  projectId: z.ZodString;
173
152
  base: z.ZodString;
174
- builtAt: z.ZodString;
175
153
  inHistory: z.ZodNullable<z.ZodBoolean>;
176
154
  builtBehind: z.ZodNullable<z.ZodNumber>;
177
- checkout: z.ZodNullable<z.ZodEnum<{
178
- any: "any";
179
- here: "here";
180
- other: "other";
181
- }>>;
182
- repoRoot: z.ZodNullable<z.ZodString>;
183
- branch: z.ZodNullable<z.ZodString>;
184
155
  createdAt: z.ZodString;
185
156
  expiresAt: z.ZodString;
186
157
  expired: z.ZodBoolean;
@@ -188,14 +159,9 @@ declare const _default: import("@vercel/clinkr").CommandDefinition<z.ZodObject<{
188
159
  reason: z.ZodNullable<z.ZodEnum<{
189
160
  expired: "expired";
190
161
  "expires-soon": "expires-soon";
191
- "not-in-history": "not-in-history";
192
- "not-picked": "not-picked";
193
- "not-trusted": "not-trusted";
194
162
  "other-base": "other-base";
195
- "other-checkout": "other-checkout";
196
163
  "other-owner": "other-owner";
197
164
  "other-recipe": "other-recipe";
198
- "reuse-off": "reuse-off";
199
165
  "steps-changed": "steps-changed";
200
166
  }>>;
201
167
  }, z.core.$strip>>;
@@ -254,7 +220,7 @@ declare const _default: import("@vercel/clinkr").CommandDefinition<z.ZodObject<{
254
220
  };
255
221
  readonly checkoutFailed: {
256
222
  readonly exitCode: 1;
257
- readonly description: "git failed while storm checked the checkout or a cached snapshot's commit, as a run here would refuse.";
223
+ readonly description: "git failed while storm checked the checkout or a cached snapshot's base, as a run here would refuse.";
258
224
  readonly schema: z.ZodObject<{
259
225
  message: z.ZodString;
260
226
  }, z.core.$strip>;
@@ -1,33 +1,32 @@
1
1
  import {
2
- muted,
3
2
  path,
4
3
  renderOutcome
5
4
  } from "../../../chunks/chunk-T6AZIDZD.js";
6
5
  import {
7
6
  redactor
8
- } from "../../../chunks/chunk-FK4RLDEK.js";
7
+ } from "../../../chunks/chunk-N7E6DAUE.js";
9
8
  import {
10
9
  REJECTIONS_SHOWN,
11
10
  REJECTION_REASONS,
12
11
  builtAtText,
13
12
  rejectionText
14
- } from "../../../chunks/chunk-4XT5RC5T.js";
13
+ } from "../../../chunks/chunk-2NZXL6OH.js";
15
14
  import {
16
15
  RESOURCES
17
- } from "../../../chunks/chunk-ISGQJIQM.js";
16
+ } from "../../../chunks/chunk-5UMJNVKT.js";
18
17
  import "../../../chunks/chunk-IYM44FUX.js";
19
18
  import "../../../chunks/chunk-LQKNI3EG.js";
20
19
  import {
21
20
  short
22
- } from "../../../chunks/chunk-TMQQYHUX.js";
23
- import "../../../chunks/chunk-FSP3SJ35.js";
21
+ } from "../../../chunks/chunk-RTILVSYQ.js";
22
+ import "../../../chunks/chunk-6EQKA7LI.js";
24
23
  import {
25
24
  configErrors,
26
25
  declaredSecretValues,
27
26
  inspectSnapshotCache,
28
27
  invalidConfig,
29
28
  loadSettingsFile
30
- } from "../../../chunks/chunk-ODQHQJLE.js";
29
+ } from "../../../chunks/chunk-ZDJLKF2G.js";
31
30
  import "../../../chunks/chunk-YT5OROR7.js";
32
31
  import "../../../chunks/chunk-GQIL3AHY.js";
33
32
  import "../../../chunks/chunk-GSC6SRTW.js";
@@ -42,14 +41,11 @@ import {
42
41
  import { z as z2 } from "zod";
43
42
 
44
43
  // src/commands/snapshots/list/outcomes.ts
45
- import { basename } from "node:path";
46
44
  import { z } from "zod";
47
45
  var reasonSchema = z.enum([...REJECTION_REASONS, "other-recipe"]);
48
46
  var snapshotSchema = z.object({
49
47
  /** The snapshot's id in Vercel Sandbox. */
50
48
  snapshotId: z.string(),
51
- /** A base snapshot, built from a base by the recipe's toolchain and prebuild steps, or a dev snapshot, saved from a run's runner sandbox. */
52
- kind: z.enum(["base", "dev"]),
53
49
  /** The runner recipe's name, region and runtime it was built for. */
54
50
  recipe: z.string(),
55
51
  region: z.string(),
@@ -57,20 +53,12 @@ var snapshotSchema = z.object({
57
53
  /** The team and project ids it was built for. */
58
54
  teamId: z.string(),
59
55
  projectId: z.string(),
60
- /** Its base, a full SHA: the commit whose tracked files its repository holds. */
56
+ /** Its base, a full SHA: the commit it was built at, whose tracked files its repository holds. */
61
57
  base: z.string(),
62
- /** The commit it was built at, a full SHA: a base snapshot's base, or the commit that saved a dev snapshot. */
63
- builtAt: z.string(),
64
- /** Whether HEAD is the built-at commit or holds it in its history; null when storm didn't check. */
58
+ /** Whether HEAD is the base or holds it in its history; null when storm didn't check. An amend or a rebase can take a commit out of it. */
65
59
  inHistory: z.boolean().nullable(),
66
- /** How many commits HEAD has that the built-at commit lacks, 0 for HEAD's commit; null when HEAD's history doesn't hold it or storm didn't count. */
60
+ /** How many commits HEAD has that the base lacks, 0 for HEAD's commit; null when HEAD's history doesn't hold it or storm didn't count. */
67
61
  builtBehind: z.number().nullable(),
68
- /** Which checkout may start from it: any for a base snapshot; for a dev snapshot, here when this checkout saved it, other when another did; null for a dev snapshot outside a Git checkout. */
69
- checkout: z.enum(["any", "here", "other"]).nullable(),
70
- /** For a dev snapshot, the root of the checkout that saved it; null for a base snapshot. */
71
- repoRoot: z.string().nullable(),
72
- /** For a dev snapshot, the branch of the run that saved it; null for a base snapshot and for a run on a detached HEAD. */
73
- branch: z.string().nullable(),
74
62
  /** When it was created and when it expires, as ISO times. */
75
63
  createdAt: z.string(),
76
64
  expiresAt: z.string(),
@@ -109,19 +97,14 @@ function snapshotFacts(snapshot) {
109
97
  const { entry } = snapshot;
110
98
  return {
111
99
  snapshotId: entry.snapshotId,
112
- kind: snapshot.kind,
113
100
  recipe: entry.recipeName,
114
101
  region: entry.region,
115
102
  runtime: entry.runtime,
116
103
  teamId: entry.teamId,
117
104
  projectId: entry.projectId,
118
105
  base: entry.base,
119
- builtAt: snapshot.builtAt,
120
106
  inHistory: snapshot.inHistory,
121
107
  builtBehind: snapshot.builtBehind,
122
- checkout: snapshot.kind === "base" ? "any" : snapshot.savedHere === null ? null : snapshot.savedHere ? "here" : "other",
123
- repoRoot: entry.repoRoot ?? null,
124
- branch: entry.branch ?? null,
125
108
  createdAt: entry.createdAt,
126
109
  expiresAt: entry.expiresAt,
127
110
  expired: snapshot.expired,
@@ -132,7 +115,7 @@ function snapshotFacts(snapshot) {
132
115
  function inTableOrder(snapshots) {
133
116
  const last = Number.MAX_SAFE_INTEGER;
134
117
  return snapshots.toSorted(
135
- (a, b) => (a.builtBehind ?? last) - (b.builtBehind ?? last) || Number(a.kind === "dev") - Number(b.kind === "dev") || Number(b.checkout === "here") - Number(a.checkout === "here") || Date.parse(b.createdAt) - Date.parse(a.createdAt) || a.snapshotId.localeCompare(b.snapshotId)
118
+ (a, b) => (a.builtBehind ?? last) - (b.builtBehind ?? last) || Date.parse(b.createdAt) - Date.parse(a.createdAt) || a.snapshotId.localeCompare(b.snapshotId)
136
119
  );
137
120
  }
138
121
  function spanText(ms) {
@@ -140,37 +123,18 @@ function spanText(ms) {
140
123
  if (minutes >= 24 * 60) return `${Math.floor(minutes / (24 * 60))}d`;
141
124
  return minutes >= 60 ? `${Math.floor(minutes / 60)}h` : `${minutes}m`;
142
125
  }
143
- function builtAtCell(snapshot) {
126
+ function baseCell(snapshot) {
144
127
  const where = snapshot.builtBehind === 0 ? ", HEAD" : snapshot.inHistory === false ? ", not in history" : "";
145
- return `${short(snapshot.builtAt)}${where}`;
146
- }
147
- function checkoutCell(snapshot) {
148
- if (snapshot.checkout === "any" || snapshot.checkout === "here") return snapshot.checkout;
149
- return snapshot.repoRoot === null ? muted("-") : basename(snapshot.repoRoot);
128
+ return `${short(snapshot.base)}${where}`;
150
129
  }
151
130
  function tableOf(listed) {
152
131
  const now = Date.parse(listed.readAt);
153
132
  const recipeColumn = listed.all || listed.picking.kind === "none";
154
133
  return {
155
- columns: [
156
- "",
157
- "KIND",
158
- "BUILT AT",
159
- "BASE",
160
- "CHECKOUT",
161
- "BRANCH",
162
- "CREATED",
163
- "EXPIRES",
164
- ...recipeColumn ? ["RECIPE"] : [],
165
- "ID"
166
- ],
134
+ columns: ["", "BASE", "CREATED", "EXPIRES", ...recipeColumn ? ["RECIPE"] : [], "ID"],
167
135
  rows: listed.snapshots.map((snapshot) => [
168
136
  snapshot.picked ? "\u25B8" : "",
169
- snapshot.kind,
170
- builtAtCell(snapshot),
171
- short(snapshot.base),
172
- checkoutCell(snapshot),
173
- snapshot.branch ?? "",
137
+ baseCell(snapshot),
174
138
  `${spanText(now - Date.parse(snapshot.createdAt))} ago`,
175
139
  snapshot.expired ? "expired" : `in ${spanText(Date.parse(snapshot.expiresAt) - now)}`,
176
140
  ...recipeColumn ? [snapshot.recipe] : [],
@@ -196,7 +160,7 @@ function explanationOf(listed) {
196
160
  const owned = ofRecipe.filter((snapshot) => `${snapshot.teamId}/${snapshot.projectId}` === owner);
197
161
  const pick = owned.find((snapshot) => snapshot.picked);
198
162
  lines.push(
199
- pick !== void 0 ? `${who} starts from ${pick.snapshotId}, ${builtAtText({ ...pick, atMergeBase: pick.builtAt === listed.mergeBase })}.` : `${who} ${building}: no cached snapshot fits.`
163
+ pick !== void 0 ? `${who} starts from ${pick.snapshotId}, ${builtAtText({ base: pick.base, builtBehind: pick.builtBehind, mergeBase: listed.mergeBase ?? void 0 })}.` : `${who} ${building}: no cached snapshot fits.`
200
164
  );
201
165
  }
202
166
  if (owners.length > 1) lines.push("The run's credential decides the team and project.");
@@ -231,7 +195,7 @@ var outcomes = defineOutcomes({
231
195
  next: [
232
196
  {
233
197
  type: "text",
234
- text: "storm snapshots build builds what a run here would start from, without a test run: a base snapshot when none fits, then a dev snapshot at HEAD's commit."
198
+ text: "storm snapshots build builds a base snapshot at the merge-base without a test run."
235
199
  }
236
200
  ]
237
201
  })
@@ -255,7 +219,7 @@ var outcomes = defineOutcomes({
255
219
  },
256
220
  checkoutFailed: {
257
221
  exitCode: 1,
258
- description: "git failed while storm checked the checkout or a cached snapshot's commit, as a run here would refuse.",
222
+ description: "git failed while storm checked the checkout or a cached snapshot's base, as a run here would refuse.",
259
223
  schema: z.object({
260
224
  /** What git said. */
261
225
  message: z.string()
@@ -1,6 +1,6 @@
1
1
  // src/commands/snapshots/list/metadata.ts
2
2
  var metadata = {
3
- description: "List the runner snapshots cached on this machine, under ${XDG_STATE_HOME:-~/.local/state}/storm/runner/snapshots/, and mark the one a run here starts from. A runner snapshot is a base snapshot, built from a base by the runner recipe's toolchain and prebuild steps, or a dev snapshot, saved from a run's runner sandbox with that run's installed packages and build outputs. A run starts only from a snapshot whose base is HEAD's merge-base with a base ref and whose snapshot steps are the recipe's at that base, and of those from the one whose built-at commit is the fewest commits behind HEAD, in HEAD's history: a base snapshot's built-at commit is its base, and a dev snapshot's is the commit that saved it. Only the checkout that saved a dev snapshot starts from it. By default it lists the snapshots of the runner recipe in the storm.config.ts found from the working directory; without one it lists every snapshot and marks none. Each row gives the snapshot's kind, its built-at commit (with HEAD when it is HEAD's commit, and not in history when HEAD's history doesn't hold it), its base, the checkout that may start from it (any for a base snapshot, here for a dev snapshot this checkout saved, else the other checkout's directory name), the branch of the run that saved it, when it was created, when it expires, and its id. The lines after the table say why a run here starts from the marked one, or why it builds a base snapshot, and why it starts from none of the others. It reads the cache and Git and runs the recipe's step functions at the merge-base, as a run does: it mints no credential, starts nothing, and changes nothing. A git failure or a step function that fails ends it with an error, as it would end a run here.",
3
+ description: "List the runner snapshots cached on this machine, under ${XDG_STATE_HOME:-~/.local/state}/storm/runner/snapshots/, and mark the one a run here starts from. A runner snapshot is a base snapshot, built at a base by the runner recipe's toolchain and prebuild steps: a run builds one at HEAD's merge-base with a base ref when nothing fits, and storm snapshots build builds one without a run. A run starts only from a snapshot whose base is its merge-base and whose snapshot steps are the recipe's there. By default it lists the snapshots of the runner recipe in the storm.config.ts found from the working directory; without one it lists every snapshot and marks none. Each row gives the snapshot's base (with HEAD when it is HEAD's commit, and not in history when HEAD's history doesn't hold it, as after an amend or a rebase), when it was created, when it expires, and its id. The lines after the table say why a run here starts from the marked one, or why it builds a base snapshot, and why it starts from none of the others. It reads the cache and Git and runs the recipe's step functions at the merge-base, as a run does: it mints no credential, starts nothing, and changes nothing. A git failure or a step function that fails at the merge-base ends it with an error, as it would end a run here.",
4
4
  summary: "List the cached runner snapshots.",
5
5
  aliases: ["ls"],
6
6
  help: {
@@ -2,26 +2,14 @@ import { z } from "zod";
2
2
  import type { InspectedSnapshot } from "../../../runner/index.ts";
3
3
  declare const snapshotSchema: z.ZodObject<{
4
4
  snapshotId: z.ZodString;
5
- kind: z.ZodEnum<{
6
- base: "base";
7
- dev: "dev";
8
- }>;
9
5
  recipe: z.ZodString;
10
6
  region: z.ZodString;
11
7
  runtime: z.ZodString;
12
8
  teamId: z.ZodString;
13
9
  projectId: z.ZodString;
14
10
  base: z.ZodString;
15
- builtAt: z.ZodString;
16
11
  inHistory: z.ZodNullable<z.ZodBoolean>;
17
12
  builtBehind: z.ZodNullable<z.ZodNumber>;
18
- checkout: z.ZodNullable<z.ZodEnum<{
19
- any: "any";
20
- here: "here";
21
- other: "other";
22
- }>>;
23
- repoRoot: z.ZodNullable<z.ZodString>;
24
- branch: z.ZodNullable<z.ZodString>;
25
13
  createdAt: z.ZodString;
26
14
  expiresAt: z.ZodString;
27
15
  expired: z.ZodBoolean;
@@ -29,14 +17,9 @@ declare const snapshotSchema: z.ZodObject<{
29
17
  reason: z.ZodNullable<z.ZodEnum<{
30
18
  expired: "expired";
31
19
  "expires-soon": "expires-soon";
32
- "not-in-history": "not-in-history";
33
- "not-picked": "not-picked";
34
- "not-trusted": "not-trusted";
35
20
  "other-base": "other-base";
36
- "other-checkout": "other-checkout";
37
21
  "other-owner": "other-owner";
38
22
  "other-recipe": "other-recipe";
39
- "reuse-off": "reuse-off";
40
23
  "steps-changed": "steps-changed";
41
24
  }>>;
42
25
  }, z.core.$strip>;
@@ -45,8 +28,7 @@ type SnapshotFacts = z.output<typeof snapshotSchema>;
45
28
  export declare function snapshotFacts(snapshot: InspectedSnapshot): SnapshotFacts;
46
29
  /**
47
30
  * The snapshots in the table's order: those built in HEAD's history first, fewest commits behind HEAD first, and
48
- * those storm couldn't count last; at one count the base snapshot before a dev snapshot, this checkout's before
49
- * another's; then the newest, then by id.
31
+ * those storm couldn't count last; then the newest, then by id.
50
32
  */
51
33
  export declare function inTableOrder(snapshots: readonly SnapshotFacts[]): SnapshotFacts[];
52
34
  /** How `snapshots list` ends. */
@@ -72,26 +54,14 @@ export declare const outcomes: import("@vercel/clinkr").Outcomes<{
72
54
  readAt: z.ZodString;
73
55
  snapshots: z.ZodArray<z.ZodObject<{
74
56
  snapshotId: z.ZodString;
75
- kind: z.ZodEnum<{
76
- base: "base";
77
- dev: "dev";
78
- }>;
79
57
  recipe: z.ZodString;
80
58
  region: z.ZodString;
81
59
  runtime: z.ZodString;
82
60
  teamId: z.ZodString;
83
61
  projectId: z.ZodString;
84
62
  base: z.ZodString;
85
- builtAt: z.ZodString;
86
63
  inHistory: z.ZodNullable<z.ZodBoolean>;
87
64
  builtBehind: z.ZodNullable<z.ZodNumber>;
88
- checkout: z.ZodNullable<z.ZodEnum<{
89
- any: "any";
90
- here: "here";
91
- other: "other";
92
- }>>;
93
- repoRoot: z.ZodNullable<z.ZodString>;
94
- branch: z.ZodNullable<z.ZodString>;
95
65
  createdAt: z.ZodString;
96
66
  expiresAt: z.ZodString;
97
67
  expired: z.ZodBoolean;
@@ -99,14 +69,9 @@ export declare const outcomes: import("@vercel/clinkr").Outcomes<{
99
69
  reason: z.ZodNullable<z.ZodEnum<{
100
70
  expired: "expired";
101
71
  "expires-soon": "expires-soon";
102
- "not-in-history": "not-in-history";
103
- "not-picked": "not-picked";
104
- "not-trusted": "not-trusted";
105
72
  "other-base": "other-base";
106
- "other-checkout": "other-checkout";
107
73
  "other-owner": "other-owner";
108
74
  "other-recipe": "other-recipe";
109
- "reuse-off": "reuse-off";
110
75
  "steps-changed": "steps-changed";
111
76
  }>>;
112
77
  }, z.core.$strip>>;
@@ -165,7 +130,7 @@ export declare const outcomes: import("@vercel/clinkr").Outcomes<{
165
130
  };
166
131
  readonly checkoutFailed: {
167
132
  readonly exitCode: 1;
168
- readonly description: "git failed while storm checked the checkout or a cached snapshot's commit, as a run here would refuse.";
133
+ readonly description: "git failed while storm checked the checkout or a cached snapshot's base, as a run here would refuse.";
169
134
  readonly schema: z.ZodObject<{
170
135
  message: z.ZodString;
171
136
  }, z.core.$strip>;
@@ -1,5 +1,4 @@
1
- import { basename } from "node:path";
2
- import { muted, path, renderOutcome } from "@vercel/clinkr/vcli-kit";
1
+ import { path, renderOutcome } from "@vercel/clinkr/vcli-kit";
3
2
  import { defineOutcomes } from "@vercel/clinkr";
4
3
  import { z } from "zod";
5
4
  import { configErrors } from "../../../config/index.js";
@@ -10,8 +9,6 @@ const reasonSchema = z.enum([...REJECTION_REASONS, "other-recipe"]);
10
9
  const snapshotSchema = z.object({
11
10
  /** The snapshot's id in Vercel Sandbox. */
12
11
  snapshotId: z.string(),
13
- /** A base snapshot, built from a base by the recipe's toolchain and prebuild steps, or a dev snapshot, saved from a run's runner sandbox. */
14
- kind: z.enum(["base", "dev"]),
15
12
  /** The runner recipe's name, region and runtime it was built for. */
16
13
  recipe: z.string(),
17
14
  region: z.string(),
@@ -19,20 +16,12 @@ const snapshotSchema = z.object({
19
16
  /** The team and project ids it was built for. */
20
17
  teamId: z.string(),
21
18
  projectId: z.string(),
22
- /** Its base, a full SHA: the commit whose tracked files its repository holds. */
19
+ /** Its base, a full SHA: the commit it was built at, whose tracked files its repository holds. */
23
20
  base: z.string(),
24
- /** The commit it was built at, a full SHA: a base snapshot's base, or the commit that saved a dev snapshot. */
25
- builtAt: z.string(),
26
- /** Whether HEAD is the built-at commit or holds it in its history; null when storm didn't check. */
21
+ /** Whether HEAD is the base or holds it in its history; null when storm didn't check. An amend or a rebase can take a commit out of it. */
27
22
  inHistory: z.boolean().nullable(),
28
- /** How many commits HEAD has that the built-at commit lacks, 0 for HEAD's commit; null when HEAD's history doesn't hold it or storm didn't count. */
23
+ /** How many commits HEAD has that the base lacks, 0 for HEAD's commit; null when HEAD's history doesn't hold it or storm didn't count. */
29
24
  builtBehind: z.number().nullable(),
30
- /** Which checkout may start from it: any for a base snapshot; for a dev snapshot, here when this checkout saved it, other when another did; null for a dev snapshot outside a Git checkout. */
31
- checkout: z.enum(["any", "here", "other"]).nullable(),
32
- /** For a dev snapshot, the root of the checkout that saved it; null for a base snapshot. */
33
- repoRoot: z.string().nullable(),
34
- /** For a dev snapshot, the branch of the run that saved it; null for a base snapshot and for a run on a detached HEAD. */
35
- branch: z.string().nullable(),
36
25
  /** When it was created and when it expires, as ISO times. */
37
26
  createdAt: z.string(),
38
27
  expiresAt: z.string(),
@@ -72,19 +61,14 @@ export function snapshotFacts(snapshot) {
72
61
  const { entry } = snapshot;
73
62
  return {
74
63
  snapshotId: entry.snapshotId,
75
- kind: snapshot.kind,
76
64
  recipe: entry.recipeName,
77
65
  region: entry.region,
78
66
  runtime: entry.runtime,
79
67
  teamId: entry.teamId,
80
68
  projectId: entry.projectId,
81
69
  base: entry.base,
82
- builtAt: snapshot.builtAt,
83
70
  inHistory: snapshot.inHistory,
84
71
  builtBehind: snapshot.builtBehind,
85
- checkout: snapshot.kind === "base" ? "any" : snapshot.savedHere === null ? null : snapshot.savedHere ? "here" : "other",
86
- repoRoot: entry.repoRoot ?? null,
87
- branch: entry.branch ?? null,
88
72
  createdAt: entry.createdAt,
89
73
  expiresAt: entry.expiresAt,
90
74
  expired: snapshot.expired,
@@ -94,14 +78,11 @@ export function snapshotFacts(snapshot) {
94
78
  }
95
79
  /**
96
80
  * The snapshots in the table's order: those built in HEAD's history first, fewest commits behind HEAD first, and
97
- * those storm couldn't count last; at one count the base snapshot before a dev snapshot, this checkout's before
98
- * another's; then the newest, then by id.
81
+ * those storm couldn't count last; then the newest, then by id.
99
82
  */
100
83
  export function inTableOrder(snapshots) {
101
84
  const last = Number.MAX_SAFE_INTEGER;
102
85
  return snapshots.toSorted((a, b) => (a.builtBehind ?? last) - (b.builtBehind ?? last) ||
103
- Number(a.kind === "dev") - Number(b.kind === "dev") ||
104
- Number(b.checkout === "here") - Number(a.checkout === "here") ||
105
86
  Date.parse(b.createdAt) - Date.parse(a.createdAt) ||
106
87
  a.snapshotId.localeCompare(b.snapshotId));
107
88
  }
@@ -112,41 +93,20 @@ function spanText(ms) {
112
93
  return `${Math.floor(minutes / (24 * 60))}d`;
113
94
  return minutes >= 60 ? `${Math.floor(minutes / 60)}h` : `${minutes}m`;
114
95
  }
115
- /** The built-at cell: the commit, with `HEAD` when it is HEAD's commit and `not in history` when HEAD lacks it. */
116
- function builtAtCell(snapshot) {
96
+ /** The base cell: the commit, with `HEAD` when it is HEAD's commit and `not in history` when HEAD lacks it. */
97
+ function baseCell(snapshot) {
117
98
  const where = snapshot.builtBehind === 0 ? ", HEAD" : snapshot.inHistory === false ? ", not in history" : "";
118
- return `${short(snapshot.builtAt)}${where}`;
119
- }
120
- /** The checkout cell: `any`, `here`, or the other checkout's directory name. */
121
- function checkoutCell(snapshot) {
122
- if (snapshot.checkout === "any" || snapshot.checkout === "here")
123
- return snapshot.checkout;
124
- return snapshot.repoRoot === null ? muted("-") : basename(snapshot.repoRoot);
99
+ return `${short(snapshot.base)}${where}`;
125
100
  }
126
101
  /** The table's rows, one per snapshot, with a `RECIPE` column under `--all`. */
127
102
  function tableOf(listed) {
128
103
  const now = Date.parse(listed.readAt);
129
104
  const recipeColumn = listed.all || listed.picking.kind === "none";
130
105
  return {
131
- columns: [
132
- "",
133
- "KIND",
134
- "BUILT AT",
135
- "BASE",
136
- "CHECKOUT",
137
- "BRANCH",
138
- "CREATED",
139
- "EXPIRES",
140
- ...(recipeColumn ? ["RECIPE"] : []),
141
- "ID",
142
- ],
106
+ columns: ["", "BASE", "CREATED", "EXPIRES", ...(recipeColumn ? ["RECIPE"] : []), "ID"],
143
107
  rows: listed.snapshots.map((snapshot) => [
144
108
  snapshot.picked ? "▸" : "",
145
- snapshot.kind,
146
- builtAtCell(snapshot),
147
- short(snapshot.base),
148
- checkoutCell(snapshot),
149
- snapshot.branch ?? "",
109
+ baseCell(snapshot),
150
110
  `${spanText(now - Date.parse(snapshot.createdAt))} ago`,
151
111
  snapshot.expired ? "expired" : `in ${spanText(Date.parse(snapshot.expiresAt) - now)}`,
152
112
  ...(recipeColumn ? [snapshot.recipe] : []),
@@ -180,7 +140,7 @@ function explanationOf(listed) {
180
140
  const owned = ofRecipe.filter((snapshot) => `${snapshot.teamId}/${snapshot.projectId}` === owner);
181
141
  const pick = owned.find((snapshot) => snapshot.picked);
182
142
  lines.push(pick !== undefined
183
- ? `${who} starts from ${pick.snapshotId}, ${builtAtText({ ...pick, atMergeBase: pick.builtAt === listed.mergeBase })}.`
143
+ ? `${who} starts from ${pick.snapshotId}, ${builtAtText({ base: pick.base, builtBehind: pick.builtBehind, mergeBase: listed.mergeBase ?? undefined })}.`
184
144
  : `${who} ${building}: no cached snapshot fits.`);
185
145
  }
186
146
  if (owners.length > 1)
@@ -219,7 +179,7 @@ export const outcomes = defineOutcomes({
219
179
  next: [
220
180
  {
221
181
  type: "text",
222
- text: "storm snapshots build builds what a run here would start from, without a test run: a base snapshot when none fits, then a dev snapshot at HEAD's commit.",
182
+ text: "storm snapshots build builds a base snapshot at the merge-base without a test run.",
223
183
  },
224
184
  ],
225
185
  }),
@@ -243,7 +203,7 @@ export const outcomes = defineOutcomes({
243
203
  },
244
204
  checkoutFailed: {
245
205
  exitCode: 1,
246
- description: "git failed while storm checked the checkout or a cached snapshot's commit, as a run here would refuse.",
206
+ description: "git failed while storm checked the checkout or a cached snapshot's base, as a run here would refuse.",
247
207
  schema: z.object({
248
208
  /** What git said. */
249
209
  message: z.string(),