@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.
- package/dist/bin/storm.js +1 -1
- package/dist/build-info.js +1 -1
- package/dist/chunks/{chunk-4XT5RC5T.js → chunk-2NZXL6OH.js} +6 -42
- package/dist/chunks/{chunk-ISGQJIQM.js → chunk-5UMJNVKT.js} +1 -1
- package/dist/chunks/{chunk-FSP3SJ35.js → chunk-6EQKA7LI.js} +16 -46
- package/dist/chunks/{chunk-Y3BUNNRG.js → chunk-AX4EQZUS.js} +4 -4
- package/dist/chunks/{chunk-RYRJNHL7.js → chunk-DOFB2ACU.js} +3 -9
- package/dist/chunks/{chunk-SXW6XN4R.js → chunk-EGNP3S6C.js} +3 -3
- package/dist/chunks/{chunk-FK4RLDEK.js → chunk-N7E6DAUE.js} +1 -1
- package/dist/chunks/{chunk-U7M3ZB3Z.js → chunk-Q4TKRILH.js} +33 -167
- package/dist/chunks/{chunk-TMQQYHUX.js → chunk-RTILVSYQ.js} +1 -1
- package/dist/chunks/{chunk-7D6LC5JY.js → chunk-X4WBJIOF.js} +7 -39
- package/dist/chunks/{chunk-TEEZL3GA.js → chunk-YGS5VRQT.js} +11 -68
- package/dist/chunks/{chunk-ODQHQJLE.js → chunk-ZDJLKF2G.js} +742 -1117
- package/dist/chunks/{live-app-AZ5N5HBD.js → live-app-QFHS54SX.js} +4 -4
- package/dist/commands/exec/command.d.ts +2 -90
- package/dist/commands/exec/command.js +10 -10
- package/dist/commands/exec/define-run-command.d.ts +2 -90
- package/dist/commands/exec/live-view.js +18 -22
- package/dist/commands/exec/outcomes.d.ts +2 -106
- package/dist/commands/exec/outcomes.js +4 -35
- package/dist/commands/exec/progress.d.ts +3 -19
- package/dist/commands/exec/progress.js +16 -60
- package/dist/commands/exec/run-command.d.ts +4 -23
- package/dist/commands/exec/run-command.js +5 -79
- package/dist/commands/exec/run-metadata.d.ts +0 -6
- package/dist/commands/exec/run-metadata.js +2 -8
- package/dist/commands/exec/snapshot-text.d.ts +7 -16
- package/dist/commands/exec/snapshot-text.js +9 -49
- package/dist/commands/exec/view.js +2 -12
- package/dist/commands/playwright/command.d.ts +2 -90
- package/dist/commands/playwright/command.js +11 -11
- package/dist/commands/runs/facts.d.ts +1 -37
- package/dist/commands/runs/facts.js +4 -36
- package/dist/commands/runs/list/command.d.ts +0 -72
- package/dist/commands/runs/list/command.js +5 -5
- package/dist/commands/runs/list/outcomes.d.ts +0 -36
- package/dist/commands/runs/logs/command.js +5 -5
- package/dist/commands/runs/show/command.d.ts +0 -72
- package/dist/commands/runs/show/command.js +13 -40
- package/dist/commands/runs/show/metadata.js +1 -1
- package/dist/commands/runs/show/outcomes.d.ts +0 -36
- package/dist/commands/runs/show/outcomes.js +8 -42
- package/dist/commands/snapshots/build/command.d.ts +14 -411
- package/dist/commands/snapshots/build/command.js +56 -231
- package/dist/commands/snapshots/build/metadata.js +10 -7
- package/dist/commands/snapshots/build/outcomes.d.ts +11 -241
- package/dist/commands/snapshots/build/outcomes.js +29 -196
- package/dist/commands/snapshots/list/command.d.ts +2 -36
- package/dist/commands/snapshots/list/command.js +17 -53
- package/dist/commands/snapshots/list/metadata.js +1 -1
- package/dist/commands/snapshots/list/outcomes.d.ts +2 -37
- package/dist/commands/snapshots/list/outcomes.js +13 -53
- package/dist/commands/vitest/command.d.ts +2 -90
- package/dist/commands/vitest/command.js +11 -11
- package/dist/core/events.d.ts +5 -6
- package/dist/core/run-state.d.ts +7 -29
- package/dist/core/run-state.js +3 -26
- package/dist/core/run.d.ts +6 -14
- package/dist/core/run.js +17 -28
- package/dist/extensions/testserver/commands/pool/create/command.js +1 -1
- package/dist/run-directory/index.d.ts +1 -1
- package/dist/run-directory/index.js +0 -1
- package/dist/run-directory/recording.js +2 -2
- package/dist/run-directory/run-record.d.ts +14 -132
- package/dist/run-directory/run-record.js +8 -68
- package/dist/runner/build-snapshots.d.ts +50 -114
- package/dist/runner/build-snapshots.js +70 -159
- package/dist/runner/events.d.ts +4 -88
- package/dist/runner/gateways.d.ts +5 -23
- package/dist/runner/index.d.ts +5 -6
- package/dist/runner/index.js +1 -1
- package/dist/runner/live/snapshot-records.js +7 -18
- package/dist/runner/prepare.d.ts +11 -22
- package/dist/runner/prepare.js +6 -17
- package/dist/runner/ready.d.ts +16 -45
- package/dist/runner/ready.js +34 -59
- package/dist/runner/recipe.d.ts +0 -44
- package/dist/runner/recipe.js +0 -41
- package/dist/runner/scope.d.ts +8 -25
- package/dist/runner/scope.js +4 -8
- package/dist/runner/session.d.ts +18 -65
- package/dist/runner/session.js +15 -83
- package/dist/runner/snapshot-build.d.ts +2 -2
- package/dist/runner/snapshot-cache.d.ts +22 -74
- package/dist/runner/snapshot-cache.js +15 -107
- package/dist/runner/snapshot-inspect.d.ts +9 -13
- package/dist/runner/snapshot-inspect.js +48 -57
- package/dist/runner/snapshot-key.d.ts +9 -14
- package/dist/runner/snapshot-key.js +15 -22
- package/package.json +1 -1
- package/skills/read-run-output.md +8 -9
- package/dist/runner/snapshot-save.d.ts +0 -70
- package/dist/runner/snapshot-save.js +0 -160
- package/dist/runner/snapshot-start.d.ts +0 -25
- package/dist/runner/snapshot-start.js +0 -16
|
@@ -1,70 +1,17 @@
|
|
|
1
|
-
import { type Row } from "@vercel/clinkr";
|
|
2
1
|
import { z } from "zod";
|
|
3
|
-
import type {
|
|
2
|
+
import type { RunnerSnapshotEntry } from "../../../runner/index.ts";
|
|
4
3
|
import { RUN_CLEANUP } from "../../exec/cleanup.ts";
|
|
5
|
-
/** A cached
|
|
4
|
+
/** A cached base snapshot, as the result names it. */
|
|
6
5
|
declare const snapshotSchema: z.ZodObject<{
|
|
7
6
|
snapshotId: z.ZodString;
|
|
8
|
-
kind: z.ZodEnum<{
|
|
9
|
-
base: "base";
|
|
10
|
-
dev: "dev";
|
|
11
|
-
}>;
|
|
12
7
|
base: z.ZodString;
|
|
13
|
-
builtAt: z.ZodString;
|
|
14
|
-
branch: z.ZodNullable<z.ZodString>;
|
|
15
8
|
expiresAt: z.ZodString;
|
|
16
9
|
}, z.core.$strip>;
|
|
17
10
|
type SnapshotFacts = z.output<typeof snapshotSchema>;
|
|
18
|
-
/** The base snapshot this build built, and whether the cache wrote its entry; null when it built none. */
|
|
19
|
-
declare const baseSnapshotSchema: z.ZodNullable<z.ZodObject<{
|
|
20
|
-
snapshotId: z.ZodString;
|
|
21
|
-
kind: z.ZodEnum<{
|
|
22
|
-
base: "base";
|
|
23
|
-
dev: "dev";
|
|
24
|
-
}>;
|
|
25
|
-
base: z.ZodString;
|
|
26
|
-
builtAt: z.ZodString;
|
|
27
|
-
branch: z.ZodNullable<z.ZodString>;
|
|
28
|
-
expiresAt: z.ZodString;
|
|
29
|
-
cached: z.ZodBoolean;
|
|
30
|
-
}, z.core.$strip>>;
|
|
31
|
-
type BaseSnapshotFacts = z.output<typeof baseSnapshotSchema>;
|
|
32
|
-
/** A base snapshot this build built as the result names it, from the runner's; null when it built none. */
|
|
33
|
-
export declare function baseSnapshotOf(baseSnapshot: {
|
|
34
|
-
readonly entry: RunnerSnapshotEntry;
|
|
35
|
-
readonly cached: boolean;
|
|
36
|
-
} | null): BaseSnapshotFacts;
|
|
37
11
|
/** A cache entry as the result names it. */
|
|
38
12
|
export declare function snapshotOf(entry: RunnerSnapshotEntry): SnapshotFacts;
|
|
39
|
-
/**
|
|
40
|
-
|
|
41
|
-
* `--base` builds only a base snapshot (`base-only`).
|
|
42
|
-
*/
|
|
43
|
-
declare const noDevSnapshotReasonSchema: z.ZodEnum<{
|
|
44
|
-
"base-only": "base-only";
|
|
45
|
-
"not-trusted": "not-trusted";
|
|
46
|
-
"reuse-off": "reuse-off";
|
|
47
|
-
}>;
|
|
48
|
-
type NoDevSnapshotFact = z.output<typeof noDevSnapshotReasonSchema>;
|
|
49
|
-
/** What a `--base` build checked of its commit, for its warnings: null for a checkout build. */
|
|
50
|
-
export declare function baseChecksOf(warnings: readonly SnapshotBuildWarning[] | null): {
|
|
51
|
-
uncommitted: boolean | null;
|
|
52
|
-
onBaseRef: boolean | null;
|
|
53
|
-
};
|
|
54
|
-
/** What --full dropped from the cache: the dev snapshots built on the base snapshot it replaced, and what failed. */
|
|
55
|
-
declare const droppedSchema: z.ZodObject<{
|
|
56
|
-
snapshotIds: z.ZodArray<z.ZodString>;
|
|
57
|
-
failures: z.ZodArray<z.ZodString>;
|
|
58
|
-
}, z.core.$strip>;
|
|
59
|
-
/**
|
|
60
|
-
* A build's reason for saving no dev snapshot: from whether a checkout build uses dev snapshots, none when it does, or
|
|
61
|
-
* `base-only` for --base, which gives null.
|
|
62
|
-
*/
|
|
63
|
-
export declare function noDevSnapshotFact(devSnapshots: DevSnapshotReuse | null): NoDevSnapshotFact | null;
|
|
64
|
-
/** A snapshot in words: its kind, its id and its built-at commit. */
|
|
65
|
-
export declare function snapshotText({ kind, snapshotId, builtAt }: SnapshotFacts): string;
|
|
66
|
-
/** A drop as the result names it; null when the build dropped nothing. */
|
|
67
|
-
export declare function droppedOf(dropped: DevSnapshotDrop | null): z.output<typeof droppedSchema> | null;
|
|
13
|
+
/** A snapshot in words: its id and its base. */
|
|
14
|
+
export declare function snapshotText({ snapshotId, base }: SnapshotFacts): string;
|
|
68
15
|
/** How `snapshots build` ends. No outcome carries the credential. */
|
|
69
16
|
export declare const outcomes: import("@vercel/clinkr").Outcomes<{
|
|
70
17
|
built: z.ZodObject<{
|
|
@@ -75,57 +22,15 @@ export declare const outcomes: import("@vercel/clinkr").Outcomes<{
|
|
|
75
22
|
head: z.ZodString;
|
|
76
23
|
base: z.ZodString;
|
|
77
24
|
baseRef: z.ZodString;
|
|
78
|
-
noDevSnapshotReason: z.ZodNullable<z.ZodEnum<{
|
|
79
|
-
"base-only": "base-only";
|
|
80
|
-
"not-trusted": "not-trusted";
|
|
81
|
-
"reuse-off": "reuse-off";
|
|
82
|
-
}>>;
|
|
83
25
|
uncommitted: z.ZodNullable<z.ZodBoolean>;
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
snapshotId: z.ZodString;
|
|
87
|
-
kind: z.ZodEnum<{
|
|
88
|
-
base: "base";
|
|
89
|
-
dev: "dev";
|
|
90
|
-
}>;
|
|
91
|
-
base: z.ZodString;
|
|
92
|
-
builtAt: z.ZodString;
|
|
93
|
-
branch: z.ZodNullable<z.ZodString>;
|
|
94
|
-
expiresAt: z.ZodString;
|
|
95
|
-
cached: z.ZodBoolean;
|
|
96
|
-
}, z.core.$strip>>;
|
|
97
|
-
startedFrom: z.ZodNullable<z.ZodObject<{
|
|
98
|
-
snapshotId: z.ZodString;
|
|
99
|
-
kind: z.ZodEnum<{
|
|
100
|
-
base: "base";
|
|
101
|
-
dev: "dev";
|
|
102
|
-
}>;
|
|
103
|
-
base: z.ZodString;
|
|
104
|
-
builtAt: z.ZodString;
|
|
105
|
-
branch: z.ZodNullable<z.ZodString>;
|
|
106
|
-
expiresAt: z.ZodString;
|
|
107
|
-
}, z.core.$strip>>;
|
|
108
|
-
devSnapshot: z.ZodNullable<z.ZodObject<{
|
|
26
|
+
atMergeBase: z.ZodNullable<z.ZodBoolean>;
|
|
27
|
+
snapshot: z.ZodObject<{
|
|
109
28
|
snapshotId: z.ZodString;
|
|
110
|
-
kind: z.ZodEnum<{
|
|
111
|
-
base: "base";
|
|
112
|
-
dev: "dev";
|
|
113
|
-
}>;
|
|
114
29
|
base: z.ZodString;
|
|
115
|
-
builtAt: z.ZodString;
|
|
116
|
-
branch: z.ZodNullable<z.ZodString>;
|
|
117
30
|
expiresAt: z.ZodString;
|
|
118
|
-
ms: z.ZodNumber;
|
|
119
|
-
sizeBytes: z.ZodNumber;
|
|
120
|
-
}, z.core.$strip>>;
|
|
121
|
-
dropped: z.ZodObject<{
|
|
122
|
-
snapshotIds: z.ZodArray<z.ZodString>;
|
|
123
|
-
failures: z.ZodArray<z.ZodString>;
|
|
124
31
|
}, z.core.$strip>;
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
recipe: "recipe";
|
|
128
|
-
}>>;
|
|
32
|
+
ms: z.ZodNumber;
|
|
33
|
+
sizeBytes: z.ZodNumber;
|
|
129
34
|
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>>;
|
|
130
35
|
}, z.core.$strip>;
|
|
131
36
|
upToDate: z.ZodObject<{
|
|
@@ -136,22 +41,11 @@ export declare const outcomes: import("@vercel/clinkr").Outcomes<{
|
|
|
136
41
|
head: z.ZodString;
|
|
137
42
|
base: z.ZodString;
|
|
138
43
|
baseRef: z.ZodString;
|
|
139
|
-
noDevSnapshotReason: z.ZodNullable<z.ZodEnum<{
|
|
140
|
-
"base-only": "base-only";
|
|
141
|
-
"not-trusted": "not-trusted";
|
|
142
|
-
"reuse-off": "reuse-off";
|
|
143
|
-
}>>;
|
|
144
44
|
uncommitted: z.ZodNullable<z.ZodBoolean>;
|
|
145
|
-
|
|
45
|
+
atMergeBase: z.ZodNullable<z.ZodBoolean>;
|
|
146
46
|
snapshot: z.ZodObject<{
|
|
147
47
|
snapshotId: z.ZodString;
|
|
148
|
-
kind: z.ZodEnum<{
|
|
149
|
-
base: "base";
|
|
150
|
-
dev: "dev";
|
|
151
|
-
}>;
|
|
152
48
|
base: z.ZodString;
|
|
153
|
-
builtAt: z.ZodString;
|
|
154
|
-
branch: z.ZodNullable<z.ZodString>;
|
|
155
49
|
expiresAt: z.ZodString;
|
|
156
50
|
}, z.core.$strip>;
|
|
157
51
|
}, z.core.$strip>;
|
|
@@ -229,69 +123,17 @@ export declare const outcomes: import("@vercel/clinkr").Outcomes<{
|
|
|
229
123
|
};
|
|
230
124
|
cleanup: import("../../exec/cleanup.ts").StormCleanupFacts;
|
|
231
125
|
}]>;
|
|
232
|
-
snapshotGone: import("@vercel/clinkr").SharedError<"snapshot_gone", [data: {
|
|
233
|
-
snapshotId: string;
|
|
234
|
-
base: string;
|
|
235
|
-
removal: {
|
|
236
|
-
path: string;
|
|
237
|
-
message: string;
|
|
238
|
-
} | null;
|
|
239
|
-
cleanup: import("../../exec/cleanup.ts").StormCleanupFacts;
|
|
240
|
-
}]>;
|
|
241
126
|
refNotFound: z.ZodObject<{
|
|
242
127
|
ref: z.ZodString;
|
|
243
128
|
}, z.core.$strip>;
|
|
244
|
-
devSnapshotNotSaved: z.ZodObject<{
|
|
245
|
-
step: z.ZodEnum<{
|
|
246
|
-
"save-snapshot": "save-snapshot";
|
|
247
|
-
scrub: "scrub";
|
|
248
|
-
}>;
|
|
249
|
-
message: z.ZodString;
|
|
250
|
-
baseSnapshot: z.ZodNullable<z.ZodObject<{
|
|
251
|
-
snapshotId: z.ZodString;
|
|
252
|
-
kind: z.ZodEnum<{
|
|
253
|
-
base: "base";
|
|
254
|
-
dev: "dev";
|
|
255
|
-
}>;
|
|
256
|
-
base: z.ZodString;
|
|
257
|
-
builtAt: z.ZodString;
|
|
258
|
-
branch: z.ZodNullable<z.ZodString>;
|
|
259
|
-
expiresAt: z.ZodString;
|
|
260
|
-
cached: z.ZodBoolean;
|
|
261
|
-
}, z.core.$strip>>;
|
|
262
|
-
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>>;
|
|
263
|
-
}, z.core.$strip>;
|
|
264
129
|
snapshotNotCached: z.ZodObject<{
|
|
265
130
|
snapshot: z.ZodObject<{
|
|
266
131
|
snapshotId: z.ZodString;
|
|
267
|
-
kind: z.ZodEnum<{
|
|
268
|
-
base: "base";
|
|
269
|
-
dev: "dev";
|
|
270
|
-
}>;
|
|
271
132
|
base: z.ZodString;
|
|
272
|
-
builtAt: z.ZodString;
|
|
273
|
-
branch: z.ZodNullable<z.ZodString>;
|
|
274
133
|
expiresAt: z.ZodString;
|
|
275
134
|
}, z.core.$strip>;
|
|
276
135
|
path: z.ZodString;
|
|
277
136
|
message: z.ZodString;
|
|
278
|
-
baseSnapshot: z.ZodNullable<z.ZodObject<{
|
|
279
|
-
snapshotId: z.ZodString;
|
|
280
|
-
kind: z.ZodEnum<{
|
|
281
|
-
base: "base";
|
|
282
|
-
dev: "dev";
|
|
283
|
-
}>;
|
|
284
|
-
base: z.ZodString;
|
|
285
|
-
builtAt: z.ZodString;
|
|
286
|
-
branch: z.ZodNullable<z.ZodString>;
|
|
287
|
-
expiresAt: z.ZodString;
|
|
288
|
-
cached: z.ZodBoolean;
|
|
289
|
-
}, z.core.$strip>>;
|
|
290
|
-
full: z.ZodBoolean;
|
|
291
|
-
dropped: z.ZodNullable<z.ZodObject<{
|
|
292
|
-
snapshotIds: z.ZodArray<z.ZodString>;
|
|
293
|
-
failures: z.ZodArray<z.ZodString>;
|
|
294
|
-
}, z.core.$strip>>;
|
|
295
137
|
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>>;
|
|
296
138
|
}, z.core.$strip>;
|
|
297
139
|
}, {
|
|
@@ -365,15 +207,6 @@ export declare const outcomes: import("@vercel/clinkr").Outcomes<{
|
|
|
365
207
|
};
|
|
366
208
|
cleanup: import("../../exec/cleanup.ts").StormCleanupFacts;
|
|
367
209
|
}]>;
|
|
368
|
-
readonly snapshotGone: import("@vercel/clinkr").SharedError<"snapshot_gone", [data: {
|
|
369
|
-
snapshotId: string;
|
|
370
|
-
base: string;
|
|
371
|
-
removal: {
|
|
372
|
-
path: string;
|
|
373
|
-
message: string;
|
|
374
|
-
} | null;
|
|
375
|
-
cleanup: import("../../exec/cleanup.ts").StormCleanupFacts;
|
|
376
|
-
}]>;
|
|
377
210
|
readonly refNotFound: {
|
|
378
211
|
readonly exitCode: 1;
|
|
379
212
|
readonly description: "--base names no commit in this clone: storm resolves it from local refs only, and never fetches.";
|
|
@@ -390,90 +223,27 @@ export declare const outcomes: import("@vercel/clinkr").Outcomes<{
|
|
|
390
223
|
}[];
|
|
391
224
|
};
|
|
392
225
|
};
|
|
393
|
-
readonly devSnapshotNotSaved: {
|
|
394
|
-
readonly exitCode: 1;
|
|
395
|
-
readonly description: "It readied a runner sandbox for this checkout but couldn't save it as a dev snapshot: the scrub or the save failed. baseSnapshot names the base snapshot it built first, if any, and whether the cache holds it.";
|
|
396
|
-
readonly schema: z.ZodObject<{
|
|
397
|
-
step: z.ZodEnum<{
|
|
398
|
-
"save-snapshot": "save-snapshot";
|
|
399
|
-
scrub: "scrub";
|
|
400
|
-
}>;
|
|
401
|
-
message: z.ZodString;
|
|
402
|
-
baseSnapshot: z.ZodNullable<z.ZodObject<{
|
|
403
|
-
snapshotId: z.ZodString;
|
|
404
|
-
kind: z.ZodEnum<{
|
|
405
|
-
base: "base";
|
|
406
|
-
dev: "dev";
|
|
407
|
-
}>;
|
|
408
|
-
base: z.ZodString;
|
|
409
|
-
builtAt: z.ZodString;
|
|
410
|
-
branch: z.ZodNullable<z.ZodString>;
|
|
411
|
-
expiresAt: z.ZodString;
|
|
412
|
-
cached: z.ZodBoolean;
|
|
413
|
-
}, z.core.$strip>>;
|
|
414
|
-
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>>;
|
|
415
|
-
}, z.core.$strip>;
|
|
416
|
-
readonly render: ({ step, message, baseSnapshot, cleanup, }: {
|
|
417
|
-
readonly step: string;
|
|
418
|
-
readonly message: string;
|
|
419
|
-
readonly baseSnapshot: BaseSnapshotFacts;
|
|
420
|
-
readonly cleanup: z.output<typeof RUN_CLEANUP.schema>;
|
|
421
|
-
}) => {
|
|
422
|
-
message: string;
|
|
423
|
-
rows?: Row[];
|
|
424
|
-
next: {
|
|
425
|
-
type: "text";
|
|
426
|
-
text: string;
|
|
427
|
-
}[];
|
|
428
|
-
};
|
|
429
|
-
};
|
|
430
226
|
readonly snapshotNotCached: {
|
|
431
227
|
readonly exitCode: 1;
|
|
432
|
-
readonly description: "It
|
|
228
|
+
readonly description: "It built and saved the base snapshot, but couldn't write its cache entry, so no run finds it.";
|
|
433
229
|
readonly schema: z.ZodObject<{
|
|
434
230
|
snapshot: z.ZodObject<{
|
|
435
231
|
snapshotId: z.ZodString;
|
|
436
|
-
kind: z.ZodEnum<{
|
|
437
|
-
base: "base";
|
|
438
|
-
dev: "dev";
|
|
439
|
-
}>;
|
|
440
232
|
base: z.ZodString;
|
|
441
|
-
builtAt: z.ZodString;
|
|
442
|
-
branch: z.ZodNullable<z.ZodString>;
|
|
443
233
|
expiresAt: z.ZodString;
|
|
444
234
|
}, z.core.$strip>;
|
|
445
235
|
path: z.ZodString;
|
|
446
236
|
message: z.ZodString;
|
|
447
|
-
baseSnapshot: z.ZodNullable<z.ZodObject<{
|
|
448
|
-
snapshotId: z.ZodString;
|
|
449
|
-
kind: z.ZodEnum<{
|
|
450
|
-
base: "base";
|
|
451
|
-
dev: "dev";
|
|
452
|
-
}>;
|
|
453
|
-
base: z.ZodString;
|
|
454
|
-
builtAt: z.ZodString;
|
|
455
|
-
branch: z.ZodNullable<z.ZodString>;
|
|
456
|
-
expiresAt: z.ZodString;
|
|
457
|
-
cached: z.ZodBoolean;
|
|
458
|
-
}, z.core.$strip>>;
|
|
459
|
-
full: z.ZodBoolean;
|
|
460
|
-
dropped: z.ZodNullable<z.ZodObject<{
|
|
461
|
-
snapshotIds: z.ZodArray<z.ZodString>;
|
|
462
|
-
failures: z.ZodArray<z.ZodString>;
|
|
463
|
-
}, z.core.$strip>>;
|
|
464
237
|
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>>;
|
|
465
238
|
}, z.core.$strip>;
|
|
466
239
|
readonly render: (facts: {
|
|
467
240
|
readonly snapshot: SnapshotFacts;
|
|
468
241
|
readonly path: string;
|
|
469
242
|
readonly message: string;
|
|
470
|
-
readonly baseSnapshot: BaseSnapshotFacts;
|
|
471
|
-
readonly full: boolean;
|
|
472
|
-
readonly dropped: z.output<typeof droppedSchema> | null;
|
|
473
243
|
readonly cleanup: z.output<typeof RUN_CLEANUP.schema>;
|
|
474
244
|
}) => {
|
|
475
245
|
message: string;
|
|
476
|
-
rows: Row[];
|
|
246
|
+
rows: import("@vercel/clinkr").Row[];
|
|
477
247
|
next: {
|
|
478
248
|
type: "text";
|
|
479
249
|
text: string;
|
|
@@ -5,59 +5,22 @@ import { configErrors, credentialErrors, credentialSourceErrors } from "../../..
|
|
|
5
5
|
import { megabytesText } from "../../../core/index.js";
|
|
6
6
|
import { RUN_CLEANUP } from "../../exec/cleanup.js";
|
|
7
7
|
import { runErrors } from "../../exec/outcomes.js";
|
|
8
|
-
import { noSaveText } from "../../exec/snapshot-text.js";
|
|
9
8
|
import { seconds, short } from "../../exec/text.js";
|
|
10
|
-
/** A cached
|
|
9
|
+
/** A cached base snapshot, as the result names it. */
|
|
11
10
|
const snapshotSchema = z.object({
|
|
12
11
|
snapshotId: z.string(),
|
|
13
|
-
/**
|
|
14
|
-
kind: z.enum(["base", "dev"]),
|
|
15
|
-
/** Its base, a full SHA. */
|
|
12
|
+
/** Its base, the commit it was built at, a full SHA. */
|
|
16
13
|
base: z.string(),
|
|
17
|
-
/** The commit it was built at: a base snapshot's base, or the commit that saved a dev snapshot. */
|
|
18
|
-
builtAt: z.string(),
|
|
19
|
-
/** For a dev snapshot, the branch of the run that saved it; null for a base snapshot and a detached HEAD. */
|
|
20
|
-
branch: z.string().nullable(),
|
|
21
14
|
/** When it expires, as an ISO time. */
|
|
22
15
|
expiresAt: z.string(),
|
|
23
16
|
});
|
|
24
|
-
/** The base snapshot this build built, and whether the cache wrote its entry; null when it built none. */
|
|
25
|
-
const baseSnapshotSchema = snapshotSchema.extend({ cached: z.boolean() }).nullable();
|
|
26
|
-
/** A base snapshot this build built as the result names it, from the runner's; null when it built none. */
|
|
27
|
-
export function baseSnapshotOf(baseSnapshot) {
|
|
28
|
-
return baseSnapshot === null ? null : { ...snapshotOf(baseSnapshot.entry), cached: baseSnapshot.cached };
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* The "Built" row for the base snapshot this build built, saying when the cache doesn't hold it; none when it built
|
|
32
|
-
* none, or when it is the snapshot the result's message names (`named`).
|
|
33
|
-
*/
|
|
34
|
-
function builtRows(baseSnapshot, named) {
|
|
35
|
-
if (baseSnapshot === null || baseSnapshot.snapshotId === named?.snapshotId)
|
|
36
|
-
return [];
|
|
37
|
-
return [["Built", `${snapshotText(baseSnapshot)}${baseSnapshot.cached ? "" : ", not in the cache"}`]];
|
|
38
|
-
}
|
|
39
17
|
/** A cache entry as the result names it. */
|
|
40
18
|
export function snapshotOf(entry) {
|
|
41
|
-
return {
|
|
42
|
-
snapshotId: entry.snapshotId,
|
|
43
|
-
kind: entry.head === undefined ? "base" : "dev",
|
|
44
|
-
base: entry.base,
|
|
45
|
-
builtAt: entry.head ?? entry.base,
|
|
46
|
-
branch: entry.branch ?? null,
|
|
47
|
-
expiresAt: entry.expiresAt,
|
|
48
|
-
};
|
|
19
|
+
return { snapshotId: entry.snapshotId, base: entry.base, expiresAt: entry.expiresAt };
|
|
49
20
|
}
|
|
50
|
-
/**
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
*/
|
|
54
|
-
const noDevSnapshotReasonSchema = z.enum(["not-trusted", "reuse-off", "base-only"]);
|
|
55
|
-
/** What a `--base` build checked of its commit, for its warnings: null for a checkout build. */
|
|
56
|
-
export function baseChecksOf(warnings) {
|
|
57
|
-
return {
|
|
58
|
-
uncommitted: warnings === null ? null : warnings.some(({ kind }) => kind === "uncommitted"),
|
|
59
|
-
onBaseRef: warnings === null ? null : !warnings.some(({ kind }) => kind === "not-on-base-ref"),
|
|
60
|
-
};
|
|
21
|
+
/** A snapshot in words: its id and its base. */
|
|
22
|
+
export function snapshotText({ snapshotId, base }) {
|
|
23
|
+
return `base snapshot ${snapshotId} at ${short(base)}`;
|
|
61
24
|
}
|
|
62
25
|
/** What every result says of where the build ran, and of what it built at. */
|
|
63
26
|
const whereFields = {
|
|
@@ -72,85 +35,29 @@ const whereFields = {
|
|
|
72
35
|
/** What it built at: HEAD's merge-base with `baseRef`, or with --base the commit the ref names, a full SHA. */
|
|
73
36
|
base: z.string(),
|
|
74
37
|
baseRef: z.string(),
|
|
75
|
-
/** Why it saved no dev snapshot; null when it saved one, or the checkout's dev snapshot is up to date. */
|
|
76
|
-
noDevSnapshotReason: noDevSnapshotReasonSchema.nullable(),
|
|
77
38
|
/** With --base, whether the working tree had uncommitted changes, which a base snapshot doesn't hold; else null. */
|
|
78
39
|
uncommitted: z.boolean().nullable(),
|
|
79
40
|
/**
|
|
80
|
-
* With --base, whether
|
|
81
|
-
*
|
|
41
|
+
* With --base, whether the commit is HEAD's merge-base with a base ref; else null. A run here starts only from a
|
|
42
|
+
* snapshot at its merge-base.
|
|
82
43
|
*/
|
|
83
|
-
|
|
44
|
+
atMergeBase: z.boolean().nullable(),
|
|
84
45
|
};
|
|
85
|
-
/** The run defaults a build can save a dev snapshot against: the recipe's `saveDevSnapshot: false`, and `CI`. */
|
|
86
|
-
const savedAgainstRunDefaultSchema = z.enum(["recipe", "ci"]);
|
|
87
|
-
/** What --full dropped from the cache: the dev snapshots built on the base snapshot it replaced, and what failed. */
|
|
88
|
-
const droppedSchema = z.object({ snapshotIds: z.array(z.string()), failures: z.array(z.string()) });
|
|
89
46
|
const builtSchema = z.object({
|
|
90
47
|
...whereFields,
|
|
91
|
-
/** The base snapshot it built
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
devSnapshot: snapshotSchema.extend({ ms: z.number(), sizeBytes: z.number() }).nullable(),
|
|
97
|
-
/** What --full dropped from the cache: the dev snapshots built on the base snapshot it replaced, and what failed. */
|
|
98
|
-
dropped: droppedSchema,
|
|
99
|
-
/**
|
|
100
|
-
* Why a run here that gives no flag would save no dev snapshot, when this build saved one: the recipe sets
|
|
101
|
-
* `saveDevSnapshot: false` (`recipe`), or `CI` is set (`ci`), each a run's `noSaveReason`. Both are defaults for
|
|
102
|
-
* runs, and this command is not a run. Null when it saved none, or when such a run would save one too.
|
|
103
|
-
*/
|
|
104
|
-
savedAgainstRunDefault: savedAgainstRunDefaultSchema.nullable(),
|
|
48
|
+
/** The base snapshot it built and cached. */
|
|
49
|
+
snapshot: snapshotSchema,
|
|
50
|
+
/** How long the build took, and the snapshot's size. */
|
|
51
|
+
ms: z.number(),
|
|
52
|
+
sizeBytes: z.number(),
|
|
105
53
|
/** What the build couldn't clean up. */
|
|
106
54
|
cleanup: RUN_CLEANUP.schema,
|
|
107
55
|
});
|
|
108
56
|
const upToDateSchema = z.object({
|
|
109
57
|
...whereFields,
|
|
110
|
-
/** The
|
|
58
|
+
/** The base snapshot the cache holds at that commit for the team and project. */
|
|
111
59
|
snapshot: snapshotSchema,
|
|
112
60
|
});
|
|
113
|
-
/** Why the build saved no dev snapshot, as its line says after the colon. */
|
|
114
|
-
const NO_DEV_SNAPSHOT_TEXT = {
|
|
115
|
-
"not-trusted": "the runner recipe doesn't trust dev snapshots (trustDevSnapshots)",
|
|
116
|
-
"reuse-off": "the runner recipe reuses no dev snapshot (reuseDevSnapshot: false)",
|
|
117
|
-
"base-only": "--base builds only a base snapshot",
|
|
118
|
-
};
|
|
119
|
-
/**
|
|
120
|
-
* A build's reason for saving no dev snapshot: from whether a checkout build uses dev snapshots, none when it does, or
|
|
121
|
-
* `base-only` for --base, which gives null.
|
|
122
|
-
*/
|
|
123
|
-
export function noDevSnapshotFact(devSnapshots) {
|
|
124
|
-
if (devSnapshots === null)
|
|
125
|
-
return "base-only";
|
|
126
|
-
return devSnapshots === "reuse" ? null : devSnapshots;
|
|
127
|
-
}
|
|
128
|
-
/** A snapshot in words: its kind, its id and its built-at commit. */
|
|
129
|
-
export function snapshotText({ kind, snapshotId, builtAt }) {
|
|
130
|
-
return `${kind} snapshot ${snapshotId} at ${short(builtAt)}`;
|
|
131
|
-
}
|
|
132
|
-
/** A drop as the result names it; null when the build dropped nothing. */
|
|
133
|
-
export function droppedOf(dropped) {
|
|
134
|
-
return dropped === null
|
|
135
|
-
? null
|
|
136
|
-
: { snapshotIds: [...dropped.snapshotIds], failures: dropped.failures.map(({ message }) => message) };
|
|
137
|
-
}
|
|
138
|
-
/** The rows a result shows for what --full dropped, or why it dropped nothing. */
|
|
139
|
-
function droppedRows(full, dropped) {
|
|
140
|
-
if (dropped === null)
|
|
141
|
-
return full
|
|
142
|
-
? [
|
|
143
|
-
[
|
|
144
|
-
"Dropped",
|
|
145
|
-
"nothing: the new base snapshot isn't cached, so the one it replaces and its dev snapshots stay usable",
|
|
146
|
-
],
|
|
147
|
-
]
|
|
148
|
-
: [];
|
|
149
|
-
return [
|
|
150
|
-
...(dropped.snapshotIds.length === 0 ? [] : [["Dropped", dropped.snapshotIds.join(", ")]]),
|
|
151
|
-
...(dropped.failures.length === 0 ? [] : [["Not dropped", dropped.failures]]),
|
|
152
|
-
];
|
|
153
|
-
}
|
|
154
61
|
function warningsOf(facts) {
|
|
155
62
|
return [
|
|
156
63
|
...(facts.uncommitted === true
|
|
@@ -161,11 +68,11 @@ function warningsOf(facts) {
|
|
|
161
68
|
},
|
|
162
69
|
]
|
|
163
70
|
: []),
|
|
164
|
-
...(facts.
|
|
71
|
+
...(facts.atMergeBase === false
|
|
165
72
|
? [
|
|
166
73
|
{
|
|
167
|
-
reason: "
|
|
168
|
-
message: `${facts.baseRef}'s commit is
|
|
74
|
+
reason: "commit_not_merge_base",
|
|
75
|
+
message: `${facts.baseRef}'s commit is not HEAD's merge-base, so a run here doesn't start from the snapshot: a run starts only from a snapshot at its merge-base.`,
|
|
169
76
|
},
|
|
170
77
|
]
|
|
171
78
|
: []),
|
|
@@ -176,59 +83,24 @@ export const outcomes = defineOutcomes({
|
|
|
176
83
|
results: {
|
|
177
84
|
built: {
|
|
178
85
|
schema: builtSchema,
|
|
179
|
-
description: "It built
|
|
86
|
+
description: "It built a base snapshot that the cache lacked, at the merge-base or, with --base, at the commit the ref names, and cached it.",
|
|
180
87
|
render: (built) => {
|
|
181
|
-
const
|
|
182
|
-
|
|
183
|
-
["Recipe", built.recipe],
|
|
184
|
-
|
|
185
|
-
...(
|
|
186
|
-
|
|
187
|
-
: [["Started from", snapshotText(built.startedFrom)]]),
|
|
188
|
-
...(built.devSnapshot === null
|
|
189
|
-
? []
|
|
190
|
-
: [
|
|
191
|
-
[
|
|
192
|
-
"Saved",
|
|
193
|
-
`${snapshotText(built.devSnapshot)} in ${seconds(built.devSnapshot.ms)} (${megabytesText(built.devSnapshot.sizeBytes)})`,
|
|
194
|
-
],
|
|
195
|
-
]),
|
|
196
|
-
...(built.dropped.snapshotIds.length === 0
|
|
197
|
-
? []
|
|
198
|
-
: [["Dropped", built.dropped.snapshotIds.join(", ")]]),
|
|
199
|
-
...RUN_CLEANUP.rows(built.cleanup),
|
|
200
|
-
];
|
|
201
|
-
const message = built.noDevSnapshotReason === "base-only" || next === null
|
|
202
|
-
? `Built ${next === null ? "nothing" : snapshotText(next)}.`
|
|
203
|
-
: `The next run here starts from ${snapshotText(next)}.${built.noDevSnapshotReason === null
|
|
204
|
-
? ""
|
|
205
|
-
: ` It saved no dev snapshot: ${NO_DEV_SNAPSHOT_TEXT[built.noDevSnapshotReason]}.`}${built.savedAgainstRunDefault === null
|
|
206
|
-
? ""
|
|
207
|
-
: ` It saved a dev snapshot although ${noSaveText(built.savedAgainstRunDefault)}: that is a default for runs, and this command is not a run.`}`;
|
|
208
|
-
const warnings = [
|
|
209
|
-
...warningsOf(built),
|
|
210
|
-
...built.dropped.failures.map((failure) => ({
|
|
211
|
-
reason: "dev_snapshot_not_dropped",
|
|
212
|
-
message: `Couldn't drop a dev snapshot built on the replaced base snapshot from the cache: ${failure}. A later run may start from it.`,
|
|
213
|
-
})),
|
|
214
|
-
];
|
|
215
|
-
return renderOutcome({ rows, message, ...(warnings.length === 0 ? {} : { warnings }) });
|
|
88
|
+
const warnings = warningsOf(built);
|
|
89
|
+
return renderOutcome({
|
|
90
|
+
rows: [["Recipe", built.recipe], ...RUN_CLEANUP.rows(built.cleanup)],
|
|
91
|
+
message: `Built ${snapshotText(built.snapshot)} in ${seconds(built.ms)} (${megabytesText(built.sizeBytes)}).`,
|
|
92
|
+
...(warnings.length === 0 ? {} : { warnings }),
|
|
93
|
+
});
|
|
216
94
|
},
|
|
217
95
|
},
|
|
218
96
|
upToDate: {
|
|
219
97
|
schema: upToDateSchema,
|
|
220
|
-
description: "Nothing to build, so nothing started: the
|
|
98
|
+
description: "Nothing to build, so nothing started: the cache holds a base snapshot at the commit, the merge-base or the one --base names, for the team and project.",
|
|
221
99
|
render: (facts) => {
|
|
222
|
-
const { snapshot } = facts;
|
|
223
|
-
const message = facts.noDevSnapshotReason === "base-only"
|
|
224
|
-
? `The cache holds ${snapshotText(snapshot)} for this team and project. --full builds a new one.`
|
|
225
|
-
: `Up to date: the next run here starts from ${snapshotText(snapshot)}.${facts.noDevSnapshotReason === null
|
|
226
|
-
? ""
|
|
227
|
-
: ` It saves no dev snapshot: ${NO_DEV_SNAPSHOT_TEXT[facts.noDevSnapshotReason]}.`}`;
|
|
228
100
|
const warnings = warningsOf(facts);
|
|
229
101
|
return renderOutcome({
|
|
230
102
|
rows: [["Recipe", facts.recipe]],
|
|
231
|
-
message
|
|
103
|
+
message: `The cache holds ${snapshotText(facts.snapshot)} for this team and project. --full builds a new one.`,
|
|
232
104
|
...(warnings.length === 0 ? {} : { warnings }),
|
|
233
105
|
});
|
|
234
106
|
},
|
|
@@ -244,7 +116,6 @@ export const outcomes = defineOutcomes({
|
|
|
244
116
|
mintFailed: credentialSourceErrors.mintFailed,
|
|
245
117
|
tokenRequestFailed: credentialSourceErrors.tokenRequestFailed,
|
|
246
118
|
runnerFailed: runErrors.runnerFailed,
|
|
247
|
-
snapshotGone: runErrors.snapshotGone,
|
|
248
119
|
refNotFound: {
|
|
249
120
|
exitCode: 1,
|
|
250
121
|
description: "--base names no commit in this clone: storm resolves it from local refs only, and never fetches.",
|
|
@@ -257,29 +128,9 @@ export const outcomes = defineOutcomes({
|
|
|
257
128
|
next: [{ type: "text", text: `Fetch the ref, such as git fetch origin, then run again.` }],
|
|
258
129
|
}),
|
|
259
130
|
},
|
|
260
|
-
devSnapshotNotSaved: {
|
|
261
|
-
exitCode: 1,
|
|
262
|
-
description: "It readied a runner sandbox for this checkout but couldn't save it as a dev snapshot: the scrub or the save failed. baseSnapshot names the base snapshot it built first, if any, and whether the cache holds it.",
|
|
263
|
-
schema: z.object({
|
|
264
|
-
/** What failed, the scrub or the save, with what it said. */
|
|
265
|
-
step: z.enum(["scrub", "save-snapshot"]),
|
|
266
|
-
message: z.string(),
|
|
267
|
-
/** The base snapshot it built first, and whether the cache holds it; null when it built none. */
|
|
268
|
-
baseSnapshot: baseSnapshotSchema,
|
|
269
|
-
cleanup: RUN_CLEANUP.schema,
|
|
270
|
-
}),
|
|
271
|
-
render: ({ step, message, baseSnapshot, cleanup, }) => {
|
|
272
|
-
const rows = [...builtRows(baseSnapshot, null), ...RUN_CLEANUP.rows(cleanup)];
|
|
273
|
-
return {
|
|
274
|
-
message: `Couldn't save the dev snapshot: the ${step === "scrub" ? "scrub" : "save"} failed: ${message}`,
|
|
275
|
-
...(rows.length === 0 ? {} : { rows }),
|
|
276
|
-
next: [{ type: "text", text: "Run storm snapshots build again." }],
|
|
277
|
-
};
|
|
278
|
-
},
|
|
279
|
-
},
|
|
280
131
|
snapshotNotCached: {
|
|
281
132
|
exitCode: 1,
|
|
282
|
-
description: "It
|
|
133
|
+
description: "It built and saved the base snapshot, but couldn't write its cache entry, so no run finds it.",
|
|
283
134
|
schema: z.object({
|
|
284
135
|
/** The snapshot it saved, whose cache entry it couldn't write. */
|
|
285
136
|
snapshot: snapshotSchema,
|
|
@@ -287,29 +138,11 @@ export const outcomes = defineOutcomes({
|
|
|
287
138
|
path: z.string(),
|
|
288
139
|
/** What the operating system said. */
|
|
289
140
|
message: z.string(),
|
|
290
|
-
/**
|
|
291
|
-
* The base snapshot it built, and whether the cache holds it; null when it built none. With --base or a recipe
|
|
292
|
-
* that saves no dev snapshot, it is `snapshot`, not cached.
|
|
293
|
-
*/
|
|
294
|
-
baseSnapshot: baseSnapshotSchema,
|
|
295
|
-
/** Whether --full was given: build without the cache, and drop the dev snapshots on the base snapshot it replaces. */
|
|
296
|
-
full: z.boolean(),
|
|
297
|
-
/**
|
|
298
|
-
* What --full dropped from the cache: the dev snapshots built on the base snapshot it replaced, and what failed;
|
|
299
|
-
* null when it dropped nothing: without --full, or when the new base snapshot isn't cached, so the one it
|
|
300
|
-
* replaces and its dev snapshots stay usable.
|
|
301
|
-
*/
|
|
302
|
-
dropped: droppedSchema.nullable(),
|
|
303
141
|
cleanup: RUN_CLEANUP.schema,
|
|
304
142
|
}),
|
|
305
143
|
render: (facts) => ({
|
|
306
144
|
message: `Saved ${snapshotText(facts.snapshot)}, but couldn't write its cache entry: ${facts.message}`,
|
|
307
|
-
rows: [
|
|
308
|
-
["Path", facts.path],
|
|
309
|
-
...builtRows(facts.baseSnapshot, facts.snapshot),
|
|
310
|
-
...droppedRows(facts.full, facts.dropped),
|
|
311
|
-
...RUN_CLEANUP.rows(facts.cleanup),
|
|
312
|
-
],
|
|
145
|
+
rows: [["Path", facts.path], ...RUN_CLEANUP.rows(facts.cleanup)],
|
|
313
146
|
next: [
|
|
314
147
|
{
|
|
315
148
|
type: "text",
|