@cnc-tools/storm 0.10.0 → 0.11.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 +17 -9
- package/dist/build-info.js +1 -1
- package/dist/chunks/{chunk-YF3ICDBY.js → chunk-3ZZVZPMG.js} +1 -1
- package/dist/chunks/{chunk-JQ2HK4RN.js → chunk-4EU4AH7E.js} +141 -6
- package/dist/chunks/{chunk-ZJ2USLAT.js → chunk-4PRAB24Y.js} +2 -22
- package/dist/chunks/chunk-AMTYHUYB.js +257 -0
- package/dist/chunks/{chunk-WF4KJ7YG.js → chunk-ETCZ6WP7.js} +1 -1
- package/dist/chunks/chunk-FVMQKYTT.js +10 -0
- package/dist/chunks/{chunk-XHJGHJBW.js → chunk-GRMD7G4J.js} +33 -275
- package/dist/chunks/chunk-ICB4BZJX.js +22 -0
- package/dist/chunks/{chunk-AGWW3HDT.js → chunk-KR7WIYLG.js} +1826 -2201
- package/dist/chunks/{chunk-OVXD7GES.js → chunk-L4ZPMSKQ.js} +4 -37
- package/dist/chunks/chunk-NPPJ57W7.js +569 -0
- package/dist/chunks/{chunk-VJQLMGOH.js → chunk-O4BUT7BE.js} +361 -1716
- package/dist/chunks/chunk-OJOKQRM6.js +1457 -0
- package/dist/chunks/chunk-SLNKW4ZM.js +40 -0
- package/dist/chunks/{chunk-AKKNF3WZ.js → chunk-TRFEAYNC.js} +277 -348
- package/dist/chunks/chunk-VZZTHCBW.js +93 -0
- package/dist/chunks/chunk-WNIQA5J6.js +19 -0
- package/dist/chunks/chunk-WSIF7SR6.js +10 -0
- package/dist/chunks/{live-app-RIJM3QFD.js → live-app-LOGYUBKB.js} +52 -7
- package/dist/commands/exec/cleanup.d.ts +3 -3
- package/dist/commands/exec/cleanup.js +6 -2
- package/dist/commands/exec/command.d.ts +3 -3
- package/dist/commands/exec/command.js +17 -10
- package/dist/commands/exec/job-summary.d.ts +1 -1
- package/dist/commands/exec/job-summary.js +1 -1
- package/dist/commands/exec/live-view.js +5 -5
- package/dist/commands/exec/mint-failed.js +1 -1
- package/dist/commands/exec/outcomes.d.ts +2 -2
- package/dist/commands/exec/outcomes.js +7 -8
- package/dist/commands/exec/plan-run.d.ts +3 -5
- package/dist/commands/exec/progress.d.ts +3 -3
- package/dist/commands/exec/progress.js +6 -6
- package/dist/commands/exec/resource-refusals.d.ts +1 -1
- package/dist/commands/exec/resource-refusals.js +1 -1
- package/dist/commands/exec/run-command.d.ts +14 -9
- package/dist/commands/exec/run-command.js +91 -202
- package/dist/commands/exec/run-metadata.d.ts +2 -2
- package/dist/commands/exec/run-metadata.js +3 -3
- package/dist/commands/exec/test-plan.d.ts +1 -35
- package/dist/commands/exec/test-plan.js +4 -24
- package/dist/commands/exec/view.js +3 -3
- package/dist/commands/exec/waterfall.d.ts +3 -1
- package/dist/commands/exec/waterfall.js +18 -1
- package/dist/commands/runs/facts.d.ts +2 -1
- package/dist/commands/runs/facts.js +1 -1
- package/dist/commands/runs/list/command.js +10 -9
- package/dist/commands/runs/logs/command.js +14 -12
- package/dist/commands/runs/past-run.d.ts +3 -27
- package/dist/commands/runs/past-run.js +3 -37
- package/dist/commands/runs/show/command.js +24 -21
- package/dist/commands/runs/show/outcomes.js +2 -2
- package/dist/commands/vitest/command.d.ts +3 -3
- package/dist/commands/vitest/command.js +24 -17
- package/dist/commands/vitest/outcomes.d.ts +1 -1
- package/dist/commands/vitest/outcomes.js +1 -1
- package/dist/config/credential-resolver.d.ts +6 -3
- package/dist/config/credential-resolver.js +6 -5
- package/dist/context.d.ts +27 -9
- package/dist/context.js +19 -8
- package/dist/core/before-run.d.ts +5 -4
- package/dist/core/before-run.js +6 -6
- package/dist/core/definition-lookup.d.ts +22 -0
- package/dist/core/definition-lookup.js +34 -0
- package/dist/core/events.d.ts +5 -19
- package/dist/core/gateways.d.ts +22 -162
- package/dist/core/index.d.ts +10 -11
- package/dist/core/index.js +9 -11
- package/dist/core/launcher-supplies.js +2 -2
- package/dist/core/live/terminal-command-gateway.d.ts +8 -0
- package/dist/core/live/terminal-command-gateway.js +49 -0
- package/dist/core/presentations.d.ts +4 -3
- package/dist/core/presentations.js +4 -5
- package/dist/core/resource-registry.d.ts +35 -51
- package/dist/core/resource-registry.js +27 -54
- package/dist/core/resource-reports.d.ts +37 -4
- package/dist/core/resource-reports.js +34 -5
- package/dist/core/resources.d.ts +4 -3
- package/dist/core/resources.js +2 -4
- package/dist/core/run-state.d.ts +1 -1
- package/dist/core/run-state.js +1 -1
- package/dist/core/run.d.ts +19 -37
- package/dist/core/run.js +59 -114
- package/dist/core/timeline.js +2 -1
- package/dist/credential/events.d.ts +20 -0
- package/dist/credential/events.js +4 -0
- package/dist/credential/index.d.ts +2 -1
- package/dist/credential/index.js +6 -5
- package/dist/credential/source.d.ts +38 -26
- package/dist/credential/source.js +25 -34
- package/dist/extension-commands.d.ts +12 -6
- package/dist/extension-commands.js +18 -11
- package/dist/extensions/story/command-tree.d.ts +6 -0
- package/dist/extensions/story/command-tree.js +21 -0
- package/dist/extensions/story/commands/app.d.ts +23 -0
- package/dist/extensions/story/commands/app.js +5 -0
- package/dist/extensions/story/commands/run/command.d.ts +211 -0
- package/dist/extensions/story/commands/run/command.js +259 -0
- package/dist/extensions/story/commands/run/metadata.d.ts +4 -0
- package/dist/extensions/story/commands/run/metadata.js +8 -0
- package/dist/extensions/story/commands/run/outcomes.d.ts +101 -0
- package/dist/extensions/story/commands/run/outcomes.js +73 -0
- package/dist/extensions/story/commands/tree.d.ts +2 -0
- package/dist/extensions/story/commands/tree.js +6 -0
- package/dist/extensions/story/extension.d.ts +2 -0
- package/dist/extensions/story/extension.js +8 -0
- package/dist/extensions/testserver/command-tree.d.ts +1 -1
- package/dist/extensions/testserver/command-tree.js +0 -1
- package/dist/extensions/testserver/commands/pool/create/command.js +14 -8
- package/dist/extensions/testserver/commands/pool/list/command.js +8 -4
- package/dist/extensions/testserver/vitest/config.d.ts +7 -5
- package/dist/extensions/testserver/vitest/config.js +7 -5
- package/dist/extensions/testserver/vitest/fixtures.d.ts +2 -0
- package/dist/extensions/testserver/vitest/fixtures.js +36 -5
- package/dist/extensions.d.ts +12 -21
- package/dist/extensions.js +22 -34
- package/dist/forward-sigterm.d.ts +8 -0
- package/dist/forward-sigterm.js +18 -0
- package/dist/launcher-resolvers/index.d.ts +1 -0
- package/dist/launcher-resolvers/index.js +2 -1
- package/dist/launcher-resolvers/local-services.d.ts +57 -0
- package/dist/launcher-resolvers/local-services.js +7 -0
- package/dist/live-app.js +2 -1
- package/dist/local-services.d.ts +19 -0
- package/dist/local-services.js +37 -0
- package/dist/run-directory/gateways.d.ts +167 -0
- package/dist/run-directory/gateways.js +2 -0
- package/dist/run-directory/index.d.ts +8 -0
- package/dist/run-directory/index.js +13 -0
- package/dist/run-directory/plan.d.ts +35 -0
- package/dist/run-directory/plan.js +24 -0
- package/dist/run-directory/reader.d.ts +70 -0
- package/dist/run-directory/reader.js +51 -0
- package/dist/run-directory/recording.d.ts +92 -0
- package/dist/run-directory/recording.js +85 -0
- package/dist/{commands/exec → run-directory}/run-collector.d.ts +9 -8
- package/dist/{commands/exec → run-directory}/run-collector.js +8 -10
- package/dist/{core → run-directory}/run-directory.d.ts +3 -3
- package/dist/{core → run-directory}/run-directory.js +2 -2
- package/dist/{commands/exec → run-directory}/run-record.d.ts +29 -7
- package/dist/{commands/exec → run-directory}/run-record.js +79 -5
- package/dist/{commands/exec → run-directory}/timeline-facts.d.ts +4 -8
- package/dist/{commands/exec → run-directory}/timeline-facts.js +8 -24
- package/dist/runner/events.d.ts +6 -5
- package/dist/runner/index.d.ts +13 -17
- package/dist/runner/index.js +10 -14
- package/dist/runner/prepare.d.ts +28 -6
- package/dist/runner/prepare.js +15 -9
- package/dist/runner/recipe.d.ts +14 -0
- package/dist/runner/recipe.js +12 -0
- package/dist/runner/scope.d.ts +18 -11
- package/dist/runner/scope.js +12 -10
- package/dist/runner/session.d.ts +100 -0
- package/dist/runner/session.js +109 -0
- package/dist/runner/snapshot-save.d.ts +3 -2
- package/dist/runner/snapshot-save.js +6 -5
- package/dist/sdk/extension/ci.d.ts +2 -0
- package/dist/sdk/extension/ci.js +6 -0
- package/dist/sdk/extension/commands.d.ts +11 -13
- package/dist/sdk/extension/commands.js +5 -5
- package/dist/sdk/extension/index.d.ts +1 -0
- package/dist/sdk/extension/index.js +1 -0
- package/dist/sdk/extension/lifecycle.d.ts +4 -3
- package/dist/sdk/extension/progress.js +2 -2
- package/dist/sdk/extension/resource.js +1 -1
- package/dist/story/align.d.ts +1 -1
- package/dist/story/align.js +1 -1
- package/dist/story/command-line.d.ts +6 -16
- package/dist/story/command-line.js +11 -23
- package/dist/story/errors.d.ts +1 -1
- package/dist/story/errors.js +1 -1
- package/dist/story/host.d.ts +1 -1
- package/dist/story/host.js +2 -2
- package/dist/story/index.d.ts +2 -2
- package/dist/story/index.js +4 -3
- package/dist/story/launch.d.ts +70 -0
- package/dist/story/launch.js +77 -0
- package/dist/story/report.d.ts +2 -2
- package/dist/story/report.js +3 -4
- package/dist/story/settle.d.ts +7 -7
- package/dist/story/settle.js +5 -5
- package/dist/story/start.d.ts +2 -2
- package/dist/vendor/testserver-sdk/container/container.d.ts +11 -6
- package/dist/vendor/testserver-sdk/container/container.js +38 -16
- package/dist/vendor/testserver-sdk/testserver/failure.d.ts +4 -3
- package/dist/vendor/testserver-sdk/testserver/failure.js +4 -3
- package/package.json +1 -1
- package/skills/overview.md +3 -0
- package/skills/read-run-output.md +2 -2
- package/dist/chunks/chunk-H2VCSNVU.js +0 -351
- package/dist/chunks/chunk-J6ZNYUDV.js +0 -21
- package/dist/core/mint.d.ts +0 -10
- package/dist/core/mint.js +0 -14
- package/dist/story/mode.d.ts +0 -17
- package/dist/story/mode.js +0 -21
- /package/dist/{core → run-directory}/live/run-directory-gateway.d.ts +0 -0
- /package/dist/{core → run-directory}/live/run-directory-gateway.js +0 -0
package/dist/bin/storm.js
CHANGED
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
import {
|
|
2
2
|
runNodeCli
|
|
3
|
-
} from "../chunks/chunk-
|
|
4
|
-
import {
|
|
5
|
-
stormCommands
|
|
6
|
-
} from "../chunks/chunk-YF3ICDBY.js";
|
|
3
|
+
} from "../chunks/chunk-ETCZ6WP7.js";
|
|
7
4
|
import {
|
|
5
|
+
storyExtensionCommands,
|
|
8
6
|
testserverExtensionCommands
|
|
9
|
-
} from "../chunks/chunk-
|
|
7
|
+
} from "../chunks/chunk-SLNKW4ZM.js";
|
|
8
|
+
import "../chunks/chunk-WSIF7SR6.js";
|
|
9
|
+
import "../chunks/chunk-FVMQKYTT.js";
|
|
10
|
+
import "../chunks/chunk-ICB4BZJX.js";
|
|
11
|
+
import {
|
|
12
|
+
stormCommands
|
|
13
|
+
} from "../chunks/chunk-3ZZVZPMG.js";
|
|
10
14
|
import {
|
|
11
15
|
createApplication
|
|
12
|
-
} from "../chunks/chunk-
|
|
16
|
+
} from "../chunks/chunk-4PRAB24Y.js";
|
|
13
17
|
|
|
14
18
|
// src/bin/storm.ts
|
|
15
19
|
import { readFileSync } from "node:fs";
|
|
@@ -63,9 +67,13 @@ function stormHelpLogo(terminal, options) {
|
|
|
63
67
|
}
|
|
64
68
|
|
|
65
69
|
// src/extension-commands.ts
|
|
66
|
-
var EXTENSION_COMMANDS = [
|
|
70
|
+
var EXTENSION_COMMANDS = [
|
|
71
|
+
{ commands: testserverExtensionCommands, path: ["ext", "testserver"] },
|
|
72
|
+
// A run command, beside `storm vitest`, not a resource tool: `storm story run`.
|
|
73
|
+
{ commands: storyExtensionCommands, path: ["story"] }
|
|
74
|
+
];
|
|
67
75
|
function extensionMounts(root2) {
|
|
68
|
-
return EXTENSION_COMMANDS.map(({
|
|
76
|
+
return EXTENSION_COMMANDS.map(({ commands, path }) => commands.mount({ path, root: root2 }));
|
|
69
77
|
}
|
|
70
78
|
|
|
71
79
|
// src/application.ts
|
|
@@ -98,7 +106,7 @@ var exit = { status: void 0 };
|
|
|
98
106
|
var accessible = process.env["VERCEL_ACCESSIBLE"] === "1";
|
|
99
107
|
var status = await runNodeCli(await loadStormApplication(version, { accessible, root }), {
|
|
100
108
|
app: async (host) => {
|
|
101
|
-
const [{ liveStormApp }, built] = await Promise.all([import("../chunks/live-app-
|
|
109
|
+
const [{ liveStormApp }, built] = await Promise.all([import("../chunks/live-app-LOGYUBKB.js"), commit()]);
|
|
102
110
|
return liveStormApp(host, { version: manifest.version, commit: built }, exit);
|
|
103
111
|
}
|
|
104
112
|
});
|
package/dist/build-info.js
CHANGED
|
@@ -1,16 +1,105 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
EXTENSIONS,
|
|
3
|
+
REGISTRY,
|
|
4
|
+
RESOURCES,
|
|
5
|
+
formatPlan
|
|
6
|
+
} from "./chunk-NPPJ57W7.js";
|
|
5
7
|
import {
|
|
6
8
|
median,
|
|
7
9
|
paint,
|
|
8
|
-
sameRow,
|
|
9
10
|
seconds,
|
|
10
11
|
shortFile,
|
|
11
12
|
truncate,
|
|
12
13
|
visibleLength
|
|
13
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-VZZTHCBW.js";
|
|
15
|
+
import {
|
|
16
|
+
sameRow
|
|
17
|
+
} from "./chunk-KR7WIYLG.js";
|
|
18
|
+
import {
|
|
19
|
+
CONFIG_FILE_NAME
|
|
20
|
+
} from "./chunk-O4BUT7BE.js";
|
|
21
|
+
import {
|
|
22
|
+
defaultResourceKey,
|
|
23
|
+
optionKeyPath
|
|
24
|
+
} from "./chunk-AMTYHUYB.js";
|
|
25
|
+
|
|
26
|
+
// src/commands/exec/resource-flags.ts
|
|
27
|
+
import { z } from "zod";
|
|
28
|
+
function flagField(prefix, option) {
|
|
29
|
+
return `${prefix}${option.charAt(0).toUpperCase()}${option.slice(1)}`;
|
|
30
|
+
}
|
|
31
|
+
function flagSpelling(field) {
|
|
32
|
+
return `--${field.replace(/([A-Z]+)([A-Z][a-z])/g, "$1-$2").replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase()}`;
|
|
33
|
+
}
|
|
34
|
+
var RESOURCE_FLAGS = RESOURCES.flatMap((definition) => {
|
|
35
|
+
const options = definition.options;
|
|
36
|
+
return Object.entries(options).flatMap(([option, rule]) => {
|
|
37
|
+
const help = rule.flag;
|
|
38
|
+
if (help === void 0) return [];
|
|
39
|
+
const field = flagField(definition.flagPrefix, option);
|
|
40
|
+
return [
|
|
41
|
+
{
|
|
42
|
+
definition: definition.name,
|
|
43
|
+
resource: defaultResourceKey(definition),
|
|
44
|
+
option,
|
|
45
|
+
field,
|
|
46
|
+
flag: flagSpelling(field),
|
|
47
|
+
rule,
|
|
48
|
+
help
|
|
49
|
+
}
|
|
50
|
+
];
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
var RESOURCE_FLAG_HELP = Object.fromEntries(
|
|
54
|
+
RESOURCE_FLAGS.map(({ field, help }) => [field, help])
|
|
55
|
+
);
|
|
56
|
+
var RESOURCE_USAGE_FLAGS = RESOURCE_FLAGS.map(({ flag, help, rule }) => {
|
|
57
|
+
if (help.valueLabel !== void 0) return `[${flag} <${help.valueLabel}>]`;
|
|
58
|
+
return rule.default === true ? `[${flag}=false]` : `[${flag}]`;
|
|
59
|
+
}).join(" ");
|
|
60
|
+
function resourceRunExamples(command) {
|
|
61
|
+
return EXTENSIONS.flatMap((extension) => extension.examples?.[command] ?? []);
|
|
62
|
+
}
|
|
63
|
+
function baseType(schema, field) {
|
|
64
|
+
let input = schema;
|
|
65
|
+
while (input instanceof z.ZodPipe) input = input.in;
|
|
66
|
+
if (input instanceof z.ZodNumber) return z.number();
|
|
67
|
+
if (input instanceof z.ZodString) return z.string();
|
|
68
|
+
if (input instanceof z.ZodBoolean) return z.boolean();
|
|
69
|
+
if (input instanceof z.ZodEnum) return input;
|
|
70
|
+
throw new Error(`The run flag ${field}'s option schema has no number, string, boolean or enum base`);
|
|
71
|
+
}
|
|
72
|
+
function resourceFlagFields(taken) {
|
|
73
|
+
const fields = {};
|
|
74
|
+
for (const { field, rule } of RESOURCE_FLAGS) {
|
|
75
|
+
if (Object.hasOwn(fields, field) || taken.includes(field))
|
|
76
|
+
throw new Error(`Two run flags share the request field ${field}`);
|
|
77
|
+
fields[field] = baseType(rule.schema, field).optional();
|
|
78
|
+
}
|
|
79
|
+
return fields;
|
|
80
|
+
}
|
|
81
|
+
function readResourceFlags(request) {
|
|
82
|
+
const values = {};
|
|
83
|
+
const problems = [];
|
|
84
|
+
for (const { definition, option, field, flag, rule } of RESOURCE_FLAGS) {
|
|
85
|
+
const value = request[field];
|
|
86
|
+
if (value === void 0) continue;
|
|
87
|
+
const checked = rule.schema.safeParse(value);
|
|
88
|
+
if (checked.success) values[definition] = { ...values[definition], [option]: checked.data };
|
|
89
|
+
else problems.push(...checked.error.issues.map(({ message }) => ({ field, message: `${flag} ${message}.` })));
|
|
90
|
+
}
|
|
91
|
+
if (problems.length > 0) return { ok: false, problems };
|
|
92
|
+
return { ok: true, values };
|
|
93
|
+
}
|
|
94
|
+
function resourceFlagProblems(request) {
|
|
95
|
+
const read = readResourceFlags(request);
|
|
96
|
+
return read.ok ? [] : read.problems;
|
|
97
|
+
}
|
|
98
|
+
function resourceFlagValues(request) {
|
|
99
|
+
const read = readResourceFlags(request);
|
|
100
|
+
if (!read.ok) throw new Error(`The flags should have been refused: ${read.problems.map((p) => p.message).join(" ")}`);
|
|
101
|
+
return read.values;
|
|
102
|
+
}
|
|
14
103
|
|
|
15
104
|
// src/commands/exec/tests-summary.ts
|
|
16
105
|
var SLOWEST_FILES = 3;
|
|
@@ -348,6 +437,18 @@ function fittingNames(names, room) {
|
|
|
348
437
|
}
|
|
349
438
|
|
|
350
439
|
// src/commands/exec/waterfall.ts
|
|
440
|
+
var LANE_LABELS = [
|
|
441
|
+
"credential",
|
|
442
|
+
"runner-setup",
|
|
443
|
+
"tests",
|
|
444
|
+
"cleanup",
|
|
445
|
+
...REGISTRY.presentations.laneKinds.map(({ label }) => label)
|
|
446
|
+
];
|
|
447
|
+
function criticalPathStep(step, timeline) {
|
|
448
|
+
const row = timeline.rows.find((candidate) => sameRow(candidate, step));
|
|
449
|
+
const label = row?.label ?? step.name;
|
|
450
|
+
return row?.snapshot === void 0 ? label : `${label} (snapshot ${row.snapshot})`;
|
|
451
|
+
}
|
|
351
452
|
var LABEL_WIDTH = Math.max(...LANE_LABELS.map((label) => label.length)) + 2;
|
|
352
453
|
var TAIL_WIDTH = 14;
|
|
353
454
|
var AXIS_STEPS = [1, 2, 5, 10, 15, 20, 30, 60, 120, 300, 600, 900, 1800, 3600, 7200];
|
|
@@ -418,8 +519,42 @@ function breakdownText(row) {
|
|
|
418
519
|
return [counts, ...steps.length > 1 ? steps : []].join(" \xB7 ");
|
|
419
520
|
}
|
|
420
521
|
|
|
522
|
+
// src/commands/exec/test-plan.ts
|
|
523
|
+
function recordedPlan(testPlan, options) {
|
|
524
|
+
return testPlan.kind === "counted" ? { tests: testPlan.tests, files: testPlan.files, options: options.map((option) => ({ ...option })) } : void 0;
|
|
525
|
+
}
|
|
526
|
+
function testPlanLine(plan) {
|
|
527
|
+
return `Running ${testPlanText(plan)}`;
|
|
528
|
+
}
|
|
529
|
+
function testPlanText(plan) {
|
|
530
|
+
return [formatPlan(plan), ...plan.options.map(planOptionText)].join("; ");
|
|
531
|
+
}
|
|
532
|
+
function planOptionText({ path, value, from }) {
|
|
533
|
+
return `${path} ${String(value)} (${fromText(path, from)})`;
|
|
534
|
+
}
|
|
535
|
+
function fromText(path, from) {
|
|
536
|
+
switch (from) {
|
|
537
|
+
case "flag":
|
|
538
|
+
return RESOURCE_FLAGS.find(({ resource, option }) => optionKeyPath(resource, option) === path)?.flag ?? "a flag";
|
|
539
|
+
case "file":
|
|
540
|
+
return CONFIG_FILE_NAME;
|
|
541
|
+
case "default":
|
|
542
|
+
return "default";
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
|
|
421
546
|
export {
|
|
547
|
+
RESOURCE_FLAG_HELP,
|
|
548
|
+
RESOURCE_USAGE_FLAGS,
|
|
549
|
+
resourceRunExamples,
|
|
550
|
+
resourceFlagFields,
|
|
551
|
+
resourceFlagProblems,
|
|
552
|
+
resourceFlagValues,
|
|
422
553
|
testsSummaryLines,
|
|
423
554
|
testsChart,
|
|
424
|
-
|
|
555
|
+
criticalPathStep,
|
|
556
|
+
waterfallLines,
|
|
557
|
+
recordedPlan,
|
|
558
|
+
testPlanLine,
|
|
559
|
+
testPlanText
|
|
425
560
|
};
|
|
@@ -4380,24 +4380,6 @@ function groupListing(application, commands) {
|
|
|
4380
4380
|
return listing.filter(([, rows]) => rows.length > 0);
|
|
4381
4381
|
}
|
|
4382
4382
|
|
|
4383
|
-
// src/sdk/extension/commands.ts
|
|
4384
|
-
import { join as join5 } from "node:path";
|
|
4385
|
-
function defineExtensionCommands(definition) {
|
|
4386
|
-
const { extension, description, tree, directory, app } = definition;
|
|
4387
|
-
return {
|
|
4388
|
-
extension,
|
|
4389
|
-
description,
|
|
4390
|
-
directory,
|
|
4391
|
-
mount: ({ path, root }) => mount(tree.directory(join5(root, directory)), { path, description, app })
|
|
4392
|
-
};
|
|
4393
|
-
}
|
|
4394
|
-
function defineExtension(extension) {
|
|
4395
|
-
return extension;
|
|
4396
|
-
}
|
|
4397
|
-
|
|
4398
|
-
// src/extensions/testserver/commands/tree.ts
|
|
4399
|
-
var testserverCommands = commandTree({ id: "testserver" });
|
|
4400
|
-
|
|
4401
4383
|
export {
|
|
4402
4384
|
appSourceOf,
|
|
4403
4385
|
lazyAppSource,
|
|
@@ -4411,10 +4393,8 @@ export {
|
|
|
4411
4393
|
resolveColorDepth,
|
|
4412
4394
|
resolveUnicode,
|
|
4413
4395
|
commandTree,
|
|
4396
|
+
mount,
|
|
4414
4397
|
runCliWith,
|
|
4415
4398
|
createApplication,
|
|
4416
|
-
refused
|
|
4417
|
-
defineExtensionCommands,
|
|
4418
|
-
defineExtension,
|
|
4419
|
-
testserverCommands
|
|
4399
|
+
refused
|
|
4420
4400
|
};
|
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
// src/sdk/extension/ci.ts
|
|
2
|
+
function isCi(env) {
|
|
3
|
+
const ci = env["CI"];
|
|
4
|
+
return ci !== void 0 && ci !== "" && ci !== "0" && ci.toLowerCase() !== "false";
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
// src/sdk/extension/resource-definition.ts
|
|
8
|
+
var NOT_COUNTED = Object.freeze({ testPlan: Object.freeze({ kind: "not-counted" }) });
|
|
9
|
+
function defaultResourceKey(definition) {
|
|
10
|
+
return definition.name;
|
|
11
|
+
}
|
|
12
|
+
function optionKeyPath(key, option) {
|
|
13
|
+
return ["resources", key, option].join(".");
|
|
14
|
+
}
|
|
15
|
+
function resourceCall(name) {
|
|
16
|
+
return `${name}({ \u2026 })`;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// src/sdk/extension/credential.ts
|
|
20
|
+
import { inspect } from "node:util";
|
|
21
|
+
var RENDERED = "[credential]";
|
|
22
|
+
var Credential = class {
|
|
23
|
+
#token;
|
|
24
|
+
#claims;
|
|
25
|
+
constructor(token) {
|
|
26
|
+
this.#token = token;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* The token itself, for the request header of the service a resource calls with it and the runner's live Sandbox
|
|
30
|
+
* gateway (which hands it to `@vercel/sandbox`) only.
|
|
31
|
+
*/
|
|
32
|
+
reveal() {
|
|
33
|
+
return this.#token;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* The team and project the token was minted for, from its `owner_id` and `project_id` JWT claims, decoded once.
|
|
37
|
+
* `undefined` when the token isn't a JWT or lacks either claim. The token itself never leaves the credential.
|
|
38
|
+
*/
|
|
39
|
+
vercelProject() {
|
|
40
|
+
const { owner_id: teamId, project_id: projectId } = this.#decoded() ?? {};
|
|
41
|
+
if (!isFilled(teamId) || !isFilled(projectId)) return void 0;
|
|
42
|
+
return { teamId, projectId };
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* The `aud` and `repository` claims of a GitHub Actions OIDC token, which a service's trust rules match on.
|
|
46
|
+
* `undefined` when the token isn't a JWT or lacks either claim as a non-empty string. The token itself never
|
|
47
|
+
* leaves the credential.
|
|
48
|
+
*/
|
|
49
|
+
githubActionsClaims() {
|
|
50
|
+
const { aud, repository } = this.#decoded() ?? {};
|
|
51
|
+
if (!isFilled(aud) || !isFilled(repository)) return void 0;
|
|
52
|
+
return { aud, repository };
|
|
53
|
+
}
|
|
54
|
+
/** The token's JWT claims, decoded once; `undefined` when it isn't a JWT with an object payload. */
|
|
55
|
+
#decoded() {
|
|
56
|
+
if (this.#claims === void 0) this.#claims = decodeClaims(this.#token) ?? null;
|
|
57
|
+
return this.#claims ?? void 0;
|
|
58
|
+
}
|
|
59
|
+
toString() {
|
|
60
|
+
return RENDERED;
|
|
61
|
+
}
|
|
62
|
+
toJSON() {
|
|
63
|
+
return RENDERED;
|
|
64
|
+
}
|
|
65
|
+
[inspect.custom]() {
|
|
66
|
+
return RENDERED;
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
function decodeClaims(token) {
|
|
70
|
+
const parts = token.split(".");
|
|
71
|
+
const payload = parts[1];
|
|
72
|
+
if (parts.length !== 3 || payload === void 0 || payload === "") return void 0;
|
|
73
|
+
let claims;
|
|
74
|
+
try {
|
|
75
|
+
claims = JSON.parse(Buffer.from(payload, "base64url").toString("utf8"));
|
|
76
|
+
} catch {
|
|
77
|
+
return void 0;
|
|
78
|
+
}
|
|
79
|
+
if (typeof claims !== "object" || claims === null || Array.isArray(claims)) return void 0;
|
|
80
|
+
return claims;
|
|
81
|
+
}
|
|
82
|
+
function isFilled(value) {
|
|
83
|
+
return typeof value === "string" && value !== "";
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// src/sdk/extension/credential-diagnosis.ts
|
|
87
|
+
function describeMintFailure(failure, target) {
|
|
88
|
+
const loginStep = `\`vercel login\` with an account on the \`${target.team}\` team`;
|
|
89
|
+
const networkFix = "Check your network connection and any VPN or proxy, then retry.";
|
|
90
|
+
switch (failure.kind) {
|
|
91
|
+
case "vercel-not-found":
|
|
92
|
+
return {
|
|
93
|
+
cause: "`vercel` is not on PATH",
|
|
94
|
+
fix: `Install it with \`npm i -g vercel@latest\`, run ${loginStep}, then retry.`
|
|
95
|
+
};
|
|
96
|
+
case "timeout":
|
|
97
|
+
return {
|
|
98
|
+
cause: failure.step.command === "project token" ? `\`vercel project token\` timed out after ${failure.seconds}s` : `${whoamiCheck(failure.step.mintSaid)} timed out after ${failure.seconds}s`,
|
|
99
|
+
fix: networkFix
|
|
100
|
+
};
|
|
101
|
+
case "unreachable":
|
|
102
|
+
return {
|
|
103
|
+
cause: failure.step.command === "project token" ? `\`vercel project token\` couldn't reach Vercel: ${failure.said}` : `${whoamiCheck(failure.step.mintSaid)} couldn't reach Vercel: ${failure.said}`,
|
|
104
|
+
fix: networkFix
|
|
105
|
+
};
|
|
106
|
+
case "outdated-cli":
|
|
107
|
+
return {
|
|
108
|
+
cause: `\`vercel\` on PATH is older than 53.3.0, the first with \`project token --format=json\`: ${failure.said}`,
|
|
109
|
+
fix: "Upgrade it with `npm i -g vercel@latest`, then retry."
|
|
110
|
+
};
|
|
111
|
+
case "project-not-found":
|
|
112
|
+
return {
|
|
113
|
+
cause: `\`vercel\` found no project \`${target.project}\` on team \`${target.team}\`: ${failure.said}`,
|
|
114
|
+
fix: `Check the project name in \`--project\` or \`storm.config.ts\` (\`project\`) for team \`${target.team}\`, then retry.`
|
|
115
|
+
};
|
|
116
|
+
case "unrecognized":
|
|
117
|
+
return {
|
|
118
|
+
cause: `\`vercel project token\` failed: ${failure.said}`,
|
|
119
|
+
fix: "Retry. If it fails the same way again, act on what `vercel` said."
|
|
120
|
+
};
|
|
121
|
+
case "login-lapsed":
|
|
122
|
+
return {
|
|
123
|
+
cause: `the saved \`vercel login\` is missing, expired or invalid (\`vercel whoami\`: ${failure.whoamiSaid}). \`vercel project token\` said: ${failure.said}`,
|
|
124
|
+
fix: `Run ${loginStep}, then retry.`
|
|
125
|
+
};
|
|
126
|
+
case "no-team-access": {
|
|
127
|
+
const user = failure.user ?? "the logged-in account";
|
|
128
|
+
const works = failure.user === void 0 ? "`vercel whoami` works" : `\`vercel whoami\` works, as ${failure.user}`;
|
|
129
|
+
return {
|
|
130
|
+
cause: `${failure.said} (${works})`,
|
|
131
|
+
fix: `Check the team name in \`--scope\` or \`storm.config.ts\` (\`scope\`). Then ask an owner of the \`${target.team}\` team to add ${user}; if ${user} is already a member, run \`vercel login\` again, then retry.`
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
function whoamiCheck(mintSaid) {
|
|
137
|
+
return `\`vercel project token\` failed: ${mintSaid}. \`vercel whoami\`, run to check the login,`;
|
|
138
|
+
}
|
|
139
|
+
function describeTokenRequestFailure(failure) {
|
|
140
|
+
if (failure.kind === "variables-missing")
|
|
141
|
+
return {
|
|
142
|
+
cause: `${variablesText(failure.missing)} ${failure.missing.length === 1 ? "isn't" : "aren't"} set; GitHub Actions sets them only in a job with \`id-token: write\``,
|
|
143
|
+
fix: "Add `permissions: id-token: write` to the job, then rerun it."
|
|
144
|
+
};
|
|
145
|
+
const { last, attempts } = failure;
|
|
146
|
+
const tries = attempts === 1 ? "" : ` (${attempts} attempts)`;
|
|
147
|
+
const fix = "Rerun the job. If the request fails again, act on what GitHub answered.";
|
|
148
|
+
switch (last.kind) {
|
|
149
|
+
case "unreachable":
|
|
150
|
+
return { cause: `the token request couldn't reach GitHub${tries}: ${last.said}`, fix };
|
|
151
|
+
case "timeout":
|
|
152
|
+
return { cause: `GitHub didn't answer the token request within ${last.seconds}s${tries}`, fix };
|
|
153
|
+
case "http-error":
|
|
154
|
+
return { cause: `GitHub answered the token request with HTTP ${last.status}${tries}: ${last.said}`, fix };
|
|
155
|
+
case "bad-response":
|
|
156
|
+
return { cause: `GitHub's answer to the token request held no token: ${last.said}`, fix };
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
function describeCredentialFailure(failure) {
|
|
160
|
+
return failure.source === "mint" ? describeMintFailure(failure.failure, failure.target) : describeTokenRequestFailure(failure.failure);
|
|
161
|
+
}
|
|
162
|
+
function variablesText(missing) {
|
|
163
|
+
return missing.map((name) => `\`${name}\``).join(" and ");
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
// src/sdk/extension/token-request-facts.ts
|
|
167
|
+
import { z } from "zod";
|
|
168
|
+
var tokenRequestFailureShape = {
|
|
169
|
+
/** Why it failed: the job's variables are missing, or the request failed. */
|
|
170
|
+
cause: z.enum(["variables-missing", "request-failed"]),
|
|
171
|
+
/** The variables that aren't set, under variables-missing; null otherwise. */
|
|
172
|
+
missing: z.array(z.enum(["ACTIONS_ID_TOKEN_REQUEST_URL", "ACTIONS_ID_TOKEN_REQUEST_TOKEN"])).nullable(),
|
|
173
|
+
/** The HTTP status GitHub answered the last attempt with; null when it answered none, or 2xx without a token. */
|
|
174
|
+
status: z.number().nullable(),
|
|
175
|
+
/** What GitHub or the connection said to the last attempt, at most 200 characters; null when nothing. */
|
|
176
|
+
said: z.string().nullable(),
|
|
177
|
+
/** The cause, for a person. */
|
|
178
|
+
detail: z.string(),
|
|
179
|
+
/** The one fix. */
|
|
180
|
+
fix: z.string()
|
|
181
|
+
};
|
|
182
|
+
function tokenRequestFailureFacts(failure) {
|
|
183
|
+
const { cause: detail, fix } = describeTokenRequestFailure(failure);
|
|
184
|
+
if (failure.kind === "variables-missing")
|
|
185
|
+
return { cause: failure.kind, missing: [...failure.missing], status: null, said: null, detail, fix };
|
|
186
|
+
const { last } = failure;
|
|
187
|
+
return {
|
|
188
|
+
cause: failure.kind,
|
|
189
|
+
missing: null,
|
|
190
|
+
status: last.kind === "http-error" ? last.status : null,
|
|
191
|
+
said: "said" in last ? last.said : null,
|
|
192
|
+
detail,
|
|
193
|
+
fix
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
// src/sdk/extension/resource.ts
|
|
198
|
+
function defineResource(spec) {
|
|
199
|
+
const { name, flagPrefix, options, check, payload, world, lifecycle, progress } = spec;
|
|
200
|
+
if (payload.name !== name) throw new Error(`The resource ${name}'s payload contract is ${payload.name}'s`);
|
|
201
|
+
const definition = {
|
|
202
|
+
name,
|
|
203
|
+
flagPrefix,
|
|
204
|
+
options,
|
|
205
|
+
check: check ?? (() => []),
|
|
206
|
+
payload,
|
|
207
|
+
world,
|
|
208
|
+
lifecycle,
|
|
209
|
+
...progress === void 0 ? {} : { progress }
|
|
210
|
+
};
|
|
211
|
+
return definition;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
// src/sdk/extension/resource-factory.ts
|
|
215
|
+
function resourceFactory(definition) {
|
|
216
|
+
const make = (given = {}) => ({
|
|
217
|
+
name: definition.name,
|
|
218
|
+
options: { ...given }
|
|
219
|
+
});
|
|
220
|
+
return Object.assign(make, { definition });
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
// src/sdk/extension/rules.ts
|
|
224
|
+
import { z as z2 } from "zod";
|
|
225
|
+
function describeValue(value) {
|
|
226
|
+
if (typeof value === "string") return JSON.stringify(value);
|
|
227
|
+
if (typeof value === "number" || typeof value === "boolean") return String(value);
|
|
228
|
+
if (value === null) return "null";
|
|
229
|
+
if (value === void 0) return "undefined";
|
|
230
|
+
if (typeof value === "function") return "a function";
|
|
231
|
+
if (Array.isArray(value)) return "an array";
|
|
232
|
+
return typeof value === "object" ? "an object" : `a ${typeof value}`;
|
|
233
|
+
}
|
|
234
|
+
function mustBe(rule) {
|
|
235
|
+
return { error: (issue) => `must be ${rule}, not ${describeValue(issue.input)}` };
|
|
236
|
+
}
|
|
237
|
+
var nonEmptyString = z2.string(mustBe("a non-empty string")).min(1, mustBe("a non-empty string"));
|
|
238
|
+
var booleanOption = z2.boolean(mustBe("true or false"));
|
|
239
|
+
|
|
240
|
+
export {
|
|
241
|
+
isCi,
|
|
242
|
+
Credential,
|
|
243
|
+
describeMintFailure,
|
|
244
|
+
describeCredentialFailure,
|
|
245
|
+
tokenRequestFailureShape,
|
|
246
|
+
tokenRequestFailureFacts,
|
|
247
|
+
defineResource,
|
|
248
|
+
NOT_COUNTED,
|
|
249
|
+
defaultResourceKey,
|
|
250
|
+
optionKeyPath,
|
|
251
|
+
resourceCall,
|
|
252
|
+
resourceFactory,
|
|
253
|
+
describeValue,
|
|
254
|
+
mustBe,
|
|
255
|
+
nonEmptyString,
|
|
256
|
+
booleanOption
|
|
257
|
+
};
|