@cnc-tools/storm 0.6.0 → 0.8.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/build-info.js +1 -1
- package/dist/commands/exec/cleanup.d.ts +3 -3
- package/dist/commands/exec/cleanup.js +1 -1
- package/dist/commands/exec/command.d.ts +797 -1
- package/dist/commands/exec/command.js +1 -1
- package/dist/commands/exec/live-view.js +32 -15
- package/dist/commands/exec/metadata.d.ts +5 -2
- package/dist/commands/exec/metadata.js +4 -0
- package/dist/commands/exec/mint-failed.d.ts +28 -0
- package/dist/commands/exec/outcomes.d.ts +526 -0
- package/dist/commands/exec/outcomes.js +9 -0
- package/dist/commands/exec/progress.d.ts +14 -2
- package/dist/commands/exec/progress.js +57 -14
- package/dist/commands/exec/run-command.d.ts +10 -4
- package/dist/commands/exec/run-command.js +41 -8
- package/dist/commands/exec/run-metadata.d.ts +6 -3
- package/dist/commands/exec/run-metadata.js +6 -3
- package/dist/commands/exec/run-record.d.ts +83 -4
- package/dist/commands/exec/run-record.js +49 -1
- package/dist/commands/exec/tests-summary.d.ts +1 -1
- package/dist/commands/exec/tests-summary.js +1 -1
- package/dist/commands/exec/view.js +36 -4
- package/dist/commands/runs/facts.d.ts +25 -0
- package/dist/commands/runs/facts.js +36 -3
- package/dist/commands/runs/list/command.d.ts +154 -1
- package/dist/commands/runs/list/command.js +1 -1
- package/dist/commands/runs/list/outcomes.d.ts +41 -0
- package/dist/commands/runs/logs/command.d.ts +263 -1
- package/dist/commands/runs/logs/command.js +1 -1
- package/dist/commands/runs/logs/outcomes.d.ts +105 -0
- package/dist/commands/runs/show/command.d.ts +354 -1
- package/dist/commands/runs/show/command.js +1 -1
- package/dist/commands/runs/show/metadata.js +1 -1
- package/dist/commands/runs/show/outcomes.d.ts +96 -0
- package/dist/commands/runs/show/outcomes.js +30 -1
- package/dist/commands/vitest/command.d.ts +912 -1
- package/dist/commands/vitest/command.js +1 -1
- package/dist/commands/vitest/metadata.d.ts +5 -2
- package/dist/commands/vitest/metadata.js +4 -0
- package/dist/commands/vitest/outcomes.d.ts +320 -0
- package/dist/config/errors.d.ts +73 -0
- package/dist/config/schema.d.ts +1 -1
- package/dist/config-file/define.d.ts +4 -3
- package/dist/config-file/define.js +1 -1
- package/dist/config-file/toolchain.js +1 -1
- package/dist/core/command-slots.d.ts +8 -2
- package/dist/core/command-slots.js +6 -2
- package/dist/core/events.d.ts +9 -7
- package/dist/core/index.d.ts +1 -1
- package/dist/core/run-state.d.ts +30 -6
- package/dist/core/run-state.js +19 -4
- package/dist/core/run.d.ts +17 -4
- package/dist/core/run.js +61 -25
- package/dist/credential/index.d.ts +1 -0
- package/dist/credential/index.js +1 -0
- package/dist/credential/settle.d.ts +20 -0
- package/dist/credential/target.d.ts +6 -0
- package/dist/credential/target.js +7 -0
- package/dist/resources/github/command.d.ts +54 -2
- package/dist/resources/github/config.js +1 -1
- package/dist/resources/github/index.js +1 -1
- package/dist/resources/github/resource.js +2 -2
- package/dist/resources/testserver/command.d.ts +208 -10
- package/dist/resources/testserver/command.js +7 -0
- package/dist/resources/testserver/commands/create/command.d.ts +808 -1
- package/dist/resources/testserver/commands/create/command.js +64 -23
- package/dist/resources/testserver/commands/create/metadata.js +6 -2
- package/dist/resources/testserver/commands/create/outcomes.d.ts +347 -0
- package/dist/resources/testserver/commands/create/outcomes.js +14 -1
- package/dist/resources/testserver/commands/list/command.d.ts +84 -1
- package/dist/resources/testserver/commands/list/command.js +1 -1
- package/dist/resources/testserver/commands/list/outcomes.d.ts +16 -0
- package/dist/resources/testserver/config.js +14 -4
- package/dist/resources/testserver/events.d.ts +9 -0
- package/dist/resources/testserver/index.js +8 -7
- package/dist/resources/testserver/lane.js +1 -0
- package/dist/resources/testserver/live/gateways.d.ts +2 -0
- package/dist/resources/testserver/live/gateways.js +16 -3
- package/dist/resources/testserver/pool/channels.d.ts +5 -2
- package/dist/resources/testserver/pool/channels.js +1 -1
- package/dist/resources/testserver/pool/create.d.ts +6 -2
- package/dist/resources/testserver/pool/create.js +6 -5
- package/dist/resources/testserver/pool/index.d.ts +1 -0
- package/dist/resources/testserver/pool/index.js +1 -0
- package/dist/resources/testserver/pool/pull-request.d.ts +89 -0
- package/dist/resources/testserver/pool/pull-request.js +85 -0
- package/dist/resources/testserver/pr-build-facts.d.ts +130 -0
- package/dist/resources/testserver/pr-build-facts.js +261 -0
- package/dist/resources/testserver/presentation.d.ts +2 -2
- package/dist/resources/testserver/presentation.js +12 -3
- package/dist/resources/testserver/provider.d.ts +16 -6
- package/dist/resources/testserver/provider.js +46 -15
- package/dist/resources/testserver/pull-request/gateways.d.ts +117 -0
- package/dist/resources/testserver/pull-request/gateways.js +5 -0
- package/dist/resources/testserver/pull-request/index.d.ts +5 -0
- package/dist/resources/testserver/pull-request/index.js +6 -0
- package/dist/resources/testserver/pull-request/live/github-rest.d.ts +28 -0
- package/dist/resources/testserver/pull-request/live/github-rest.js +114 -0
- package/dist/resources/testserver/pull-request/live/github-token-gateway.d.ts +12 -0
- package/dist/resources/testserver/pull-request/live/github-token-gateway.js +39 -0
- package/dist/resources/testserver/pull-request/live/pull-request-gateway.d.ts +10 -0
- package/dist/resources/testserver/pull-request/live/pull-request-gateway.js +27 -0
- package/dist/resources/testserver/pull-request/live/testserver-workflow-gateway.d.ts +21 -0
- package/dist/resources/testserver/pull-request/live/testserver-workflow-gateway.js +64 -0
- package/dist/resources/testserver/ran.d.ts +5 -0
- package/dist/resources/testserver/ran.js +19 -3
- package/dist/resources/testserver/resource.d.ts +5 -1
- package/dist/resources/testserver/resource.js +2 -2
- package/dist/resources/testserver/sandbox/build-reference.d.ts +38 -0
- package/dist/resources/testserver/sandbox/build-reference.js +79 -0
- package/dist/resources/testserver/sandbox/index.d.ts +1 -0
- package/dist/resources/testserver/sandbox/index.js +1 -0
- package/dist/resources.d.ts +265 -15
- package/dist/runner/events.d.ts +64 -1
- package/dist/runner/gateways.d.ts +17 -6
- package/dist/runner/index.d.ts +5 -4
- package/dist/runner/index.js +4 -3
- package/dist/runner/live/snapshot-records.js +18 -4
- package/dist/runner/prepare.d.ts +23 -4
- package/dist/runner/prepare.js +13 -3
- package/dist/runner/ready.d.ts +7 -3
- package/dist/runner/ready.js +11 -5
- package/dist/runner/scope.d.ts +17 -1
- package/dist/runner/scope.js +4 -0
- package/dist/runner/snapshot-build.d.ts +3 -1
- package/dist/runner/snapshot-build.js +12 -2
- package/dist/runner/snapshot-cache.d.ts +46 -8
- package/dist/runner/snapshot-cache.js +60 -11
- package/dist/runner/snapshot-key.d.ts +12 -1
- package/dist/runner/snapshot-key.js +17 -1
- package/dist/runner/snapshot-save.d.ts +53 -0
- package/dist/runner/snapshot-save.js +148 -0
- package/dist/sdk/index.js +2 -2
- package/dist/story/align.d.ts +1 -1
- package/dist/story/align.js +1 -1
- package/dist/story/command-line.d.ts +34 -0
- package/dist/story/command-line.js +100 -0
- package/dist/story/definition.d.ts +22 -15
- package/dist/story/definition.js +2 -2
- package/dist/story/errors.js +1 -1
- package/dist/story/gateways.d.ts +45 -25
- package/dist/story/gateways.js +2 -2
- package/dist/story/host.d.ts +11 -8
- package/dist/story/host.js +37 -37
- package/dist/story/index.d.ts +2 -1
- package/dist/story/index.js +6 -5
- package/dist/story/json.d.ts +1 -1
- package/dist/story/json.js +2 -2
- package/dist/story/live/recording-gateway.d.ts +2 -0
- package/dist/story/live/{artifact-gateway.js → recording-gateway.js} +33 -12
- package/dist/story/mode.d.ts +2 -2
- package/dist/story/mode.js +1 -1
- package/dist/story/orphans.d.ts +23 -5
- package/dist/story/orphans.js +44 -8
- package/dist/story/recording.d.ts +62 -0
- package/dist/story/{artifact.js → recording.js} +31 -27
- package/dist/story/report.d.ts +21 -9
- package/dist/story/report.js +37 -25
- package/dist/story/settle.d.ts +23 -21
- package/dist/story/settle.js +17 -16
- package/dist/story/{run.d.ts → start.d.ts} +18 -17
- package/dist/story/{run.js → start.js} +66 -43
- package/dist/vercel-cli/context.js +1 -1
- package/dist/vercel-cli/index.js +1 -1
- package/dist/vitest/config.js +2 -2
- package/dist/vitest/fixtures.d.ts +1 -1
- package/dist/vitest/fixtures.js +1 -1
- package/dist/vitest/index.js +3 -3
- package/dist/vitest/plan.js +1 -1
- package/package.json +3 -3
- package/skills/overview.md +2 -0
- package/skills/testserver-builds.md +80 -0
- package/dist/story/artifact.d.ts +0 -60
- package/dist/story/live/artifact-gateway.d.ts +0 -2
|
@@ -12,7 +12,7 @@ export function command(cmd) {
|
|
|
12
12
|
command: z.array(z.string()).min(1, { message: "Give the command to run after --" }),
|
|
13
13
|
}),
|
|
14
14
|
cli: { options: RUN_CLI_OPTIONS, positionals: ["command"] },
|
|
15
|
-
outcomes,
|
|
15
|
+
response: outcomes,
|
|
16
16
|
validate: runProblems,
|
|
17
17
|
handler: async (context, request) => await runCommand(context, request, {
|
|
18
18
|
name: "exec",
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
// starts, it is printed above for good in its final form. Each resource lane's rows are its presentation's text
|
|
6
6
|
// (`RESOURCE_PRESENTATIONS`), laid out here.
|
|
7
7
|
import { cleanupProblems, megabytesText, } from "../../core/index.js";
|
|
8
|
+
import { mintTargetText } from "../../credential/index.js";
|
|
8
9
|
import { RESOURCE_PRESENTATIONS } from "../../resources.js";
|
|
9
10
|
import { versionText } from "../../version.js";
|
|
10
11
|
import { commandEnd, LANE_WIDTH } from "./progress.js";
|
|
@@ -72,7 +73,7 @@ export function phaseFrame(state, phase, now, width, paint) {
|
|
|
72
73
|
case "tests":
|
|
73
74
|
return testsFrame(state, view);
|
|
74
75
|
case "cleanup":
|
|
75
|
-
return state.cleanup === undefined ? [] : [cleanupLine(state.cleanup, state.runner
|
|
76
|
+
return state.cleanup === undefined ? [] : [cleanupLine(state.cleanup, state.runner, view, false)];
|
|
76
77
|
}
|
|
77
78
|
}
|
|
78
79
|
/**
|
|
@@ -102,7 +103,7 @@ export function phaseRecord(state, phase, width, paint) {
|
|
|
102
103
|
case "tests":
|
|
103
104
|
return state.command === undefined ? [] : [testsLine(state, state.command, view, false)];
|
|
104
105
|
case "cleanup":
|
|
105
|
-
return state.cleanup === undefined ? [] : [cleanupLine(state.cleanup, state.runner
|
|
106
|
+
return state.cleanup === undefined ? [] : [cleanupLine(state.cleanup, state.runner, view, true)];
|
|
106
107
|
}
|
|
107
108
|
}
|
|
108
109
|
/** What a resource lane's presentation draws with: `view`, with its span's time and durations. */
|
|
@@ -121,7 +122,7 @@ function elapsed(view, from, to) {
|
|
|
121
122
|
return from === undefined || end === undefined ? "" : seconds(end - from);
|
|
122
123
|
}
|
|
123
124
|
function credentialLine(mint, view) {
|
|
124
|
-
return view.row(` ${view.glyph(mint.status)} credential ${mint.target
|
|
125
|
+
return view.row(` ${view.glyph(mint.status)} credential ${mintTargetText(mint.target)}`, elapsed(view, mint.startedAt, mint.endedAt));
|
|
125
126
|
}
|
|
126
127
|
/**
|
|
127
128
|
* The lanes block: a row for each resource lane the run holds, a runner row with its current step and the steps it
|
|
@@ -272,7 +273,7 @@ function localResourcesFrame(state, view) {
|
|
|
272
273
|
const { mint } = state;
|
|
273
274
|
const draw = laneDraw(view);
|
|
274
275
|
const mintRow = mint !== undefined && mint.status === "running"
|
|
275
|
-
? view.row(` ${view.glyph("running")} minting a credential for ${mint.target
|
|
276
|
+
? view.row(` ${view.glyph("running")} minting a credential for ${mintTargetText(mint.target)}`, elapsed(view, mint.startedAt, mint.endedAt))
|
|
276
277
|
: undefined;
|
|
277
278
|
const rows = RESOURCE_PRESENTATIONS.lanes.flatMap((lane) => {
|
|
278
279
|
const row = lane.localRow(state.resources, draw);
|
|
@@ -354,27 +355,43 @@ function testsProgress(tests, view, room) {
|
|
|
354
355
|
return visibleLength(full) <= room ? full : text(false);
|
|
355
356
|
}
|
|
356
357
|
/**
|
|
357
|
-
* The cleanup row: what it does while it runs, what it did in its final form, with the runner sandbox it
|
|
358
|
-
* running, if it kept one.
|
|
358
|
+
* The cleanup row: what it does while it runs, what it did in its final form, with the runner sandbox it kept
|
|
359
|
+
* running, if it kept one, or the branch snapshot it saved it as.
|
|
359
360
|
*/
|
|
360
|
-
function cleanupLine(cleanup,
|
|
361
|
+
function cleanupLine(cleanup, runner, view, record) {
|
|
361
362
|
const done = record || cleanup.status !== "running";
|
|
362
363
|
const releases = RESOURCE_PRESENTATIONS.releaseTexts(cleanup.holdings, done ? "done" : "doing");
|
|
363
364
|
const release = releases.length === 0 ? undefined : releases.join(", ");
|
|
364
|
-
const
|
|
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`;
|
|
365
|
+
const { runnerSandbox } = cleanup;
|
|
369
366
|
const text = !done && cleanup.waiting
|
|
370
367
|
? `${WAITING_FOR_SNAPSHOT}…`
|
|
371
|
-
:
|
|
372
|
-
?
|
|
373
|
-
: (release
|
|
368
|
+
: runnerSandbox === null
|
|
369
|
+
? (release ?? "nothing to release")
|
|
370
|
+
: `${runnerSandboxText(runnerSandbox, runner, done)}${release === undefined ? "" : `, ${release}`}`;
|
|
374
371
|
const leftBehind = cleanupProblems(cleanup);
|
|
375
372
|
const ending = done ? (leftBehind === 0 ? "" : `: ${leftBehind} left behind`) : "…";
|
|
376
373
|
return view.row(` ${view.glyph(cleanup.status)} cleanup ${text}${!done && cleanup.waiting ? "" : ending}`, elapsed(view, cleanup.startedAt, cleanup.endedAt));
|
|
377
374
|
}
|
|
375
|
+
/**
|
|
376
|
+
* What cleanup does with the runner sandbox, as the cleanup row says: kept it running, keeps it running while cleanup
|
|
377
|
+
* runs (`keep`), saves it or saved it as a branch snapshot (`save`), or else stops and deletes it.
|
|
378
|
+
*/
|
|
379
|
+
function runnerSandboxText(sandbox, runner, done) {
|
|
380
|
+
const kept = runner?.kept;
|
|
381
|
+
if (kept !== undefined)
|
|
382
|
+
return `kept the runner sandbox until ${isoSecondsText(kept.stopsAt)}`;
|
|
383
|
+
const removed = `${done ? "stopped and deleted" : "stopping and deleting"} the runner sandbox`;
|
|
384
|
+
switch (sandbox.kind) {
|
|
385
|
+
case "keep":
|
|
386
|
+
return !done && sandbox.ms > 0 ? `keeping the runner sandbox running ${keepTimeText(sandbox.ms)}` : removed;
|
|
387
|
+
case "save": {
|
|
388
|
+
const save = runner?.save;
|
|
389
|
+
if (save?.kind === "saved")
|
|
390
|
+
return `saved branch snapshot ${save.id} of ${save.branch}`;
|
|
391
|
+
return !done && save?.kind !== "not-saved" ? `saving a branch snapshot of ${sandbox.branch}` : removed;
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
}
|
|
378
395
|
function statusGlyph(status, now, paint) {
|
|
379
396
|
switch (status) {
|
|
380
397
|
case "pending":
|
|
@@ -9,7 +9,7 @@ export declare const metadata: {
|
|
|
9
9
|
};
|
|
10
10
|
testserverBuild: {
|
|
11
11
|
readonly valueLabel: "BUILD";
|
|
12
|
-
readonly description: "The build the Testserver sandboxes run: a build name
|
|
12
|
+
readonly description: "The build the Testserver sandboxes run: a build name, the build channel stable or latest_main, or a vercel/api pull request as pr:<N> or its URL, overriding resources.testserverPool.build in storm.config.ts; default stable. A pull request runs on the newest build made from its head commit, which storm reads from GitHub with GITHUB_TOKEN, GH_TOKEN or gh auth token, or refuses. Gives the run a Testserver side.";
|
|
13
13
|
};
|
|
14
14
|
testserverMinTimeLeft: {
|
|
15
15
|
readonly valueLabel: "DURATION";
|
|
@@ -34,7 +34,10 @@ export declare const metadata: {
|
|
|
34
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
35
|
};
|
|
36
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. Not with --local. No config key.";
|
|
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.";
|
|
38
41
|
};
|
|
39
42
|
keepSandbox: {
|
|
40
43
|
readonly valueLabel: "DURATION";
|
|
@@ -35,6 +35,10 @@ export const metadata = {
|
|
|
35
35
|
argv: "--local --testserver-ttl 30m --testserver-min-time-left 25m -- pnpm test",
|
|
36
36
|
description: "Create Testserver sandboxes that live 30 minutes, with team and project from storm.config.ts.",
|
|
37
37
|
},
|
|
38
|
+
{
|
|
39
|
+
argv: "--local --testserver-build pr:104196 -- pnpm test",
|
|
40
|
+
description: "Run the tests on this machine against the Testserver build of vercel/api pull request 104196's head commit.",
|
|
41
|
+
},
|
|
38
42
|
{
|
|
39
43
|
argv: "--local --testserver-no-create --testserver-sandboxes 4 -- pnpm test",
|
|
40
44
|
description: "Run only on Testserver sandboxes already in the pool, never minting.",
|
|
@@ -8,4 +8,32 @@ export declare const mintFailedErrors: import("@vercel/clinkr").SharedErrors<{
|
|
|
8
8
|
runner: z.ZodBoolean;
|
|
9
9
|
cleanup: z.ZodType<import("./cleanup.ts").StormCleanupFacts, import("./cleanup.ts").StormCleanupFacts, z.core.$ZodTypeInternals<import("./cleanup.ts").StormCleanupFacts, import("./cleanup.ts").StormCleanupFacts>>;
|
|
10
10
|
}, z.core.$strip>;
|
|
11
|
+
}, {
|
|
12
|
+
readonly mintFailed: {
|
|
13
|
+
readonly exitCode: 1;
|
|
14
|
+
readonly description: "The vercel CLI couldn't mint a credential, so the command didn't run. In a runner run, the credential was for the runner sandbox, which always needs one; in a local run, for a resource that couldn't go on without it.";
|
|
15
|
+
readonly schema: z.ZodObject<{
|
|
16
|
+
team: z.ZodString;
|
|
17
|
+
project: z.ZodString;
|
|
18
|
+
cause: z.ZodString;
|
|
19
|
+
fix: z.ZodString;
|
|
20
|
+
runner: z.ZodBoolean;
|
|
21
|
+
cleanup: z.ZodType<import("./cleanup.ts").StormCleanupFacts, import("./cleanup.ts").StormCleanupFacts, z.core.$ZodTypeInternals<import("./cleanup.ts").StormCleanupFacts, import("./cleanup.ts").StormCleanupFacts>>;
|
|
22
|
+
}, z.core.$strip>;
|
|
23
|
+
readonly render: ({ cause, fix, runner, cleanup }: {
|
|
24
|
+
team: string;
|
|
25
|
+
project: string;
|
|
26
|
+
cause: string;
|
|
27
|
+
fix: string;
|
|
28
|
+
runner: boolean;
|
|
29
|
+
cleanup: import("./cleanup.ts").StormCleanupFacts;
|
|
30
|
+
}) => {
|
|
31
|
+
message: string;
|
|
32
|
+
rows?: readonly import("@vercel/clinkr").Row[];
|
|
33
|
+
next: {
|
|
34
|
+
type: "text";
|
|
35
|
+
text: string;
|
|
36
|
+
}[];
|
|
37
|
+
};
|
|
38
|
+
};
|
|
11
39
|
}>;
|