@cnc-tools/storm 0.9.0 → 0.9.1

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 (80) hide show
  1. package/bin/storm.js +3 -14
  2. package/dist/application.d.ts +18 -10
  3. package/dist/application.js +10 -11
  4. package/dist/bin/storm.js +97 -41
  5. package/dist/build-info.js +1 -1
  6. package/dist/chunks/chunk-5CQCRX2L.js +5768 -0
  7. package/dist/chunks/chunk-5U5Q6VZR.js +556 -0
  8. package/dist/chunks/chunk-7O6UN63H.js +63 -0
  9. package/dist/chunks/chunk-I5GZLOLQ.js +38 -0
  10. package/dist/chunks/chunk-NX55IJ5S.js +1842 -0
  11. package/dist/chunks/chunk-OCZJE5XV.js +910 -0
  12. package/dist/chunks/chunk-RRQ2ZGSE.js +1512 -0
  13. package/dist/chunks/chunk-S5NAIZYS.js +13 -0
  14. package/dist/chunks/chunk-UHO5OCEX.js +360 -0
  15. package/dist/chunks/chunk-WBIHJM7D.js +188 -0
  16. package/dist/chunks/chunk-WV6WQFC6.js +436 -0
  17. package/dist/chunks/live-app-X3PW2W42.js +89 -0
  18. package/dist/chunks/version-X7RMSKZI.js +12 -0
  19. package/dist/commands/exec/command.js +35 -21
  20. package/dist/commands/exec/metadata.js +66 -58
  21. package/dist/commands/exec/redaction.js +1 -1
  22. package/dist/commands/exec/run-collector.d.ts +1 -1
  23. package/dist/commands/exec/run-collector.js +1 -1
  24. package/dist/commands/exec/run-record.d.ts +1 -1
  25. package/dist/commands/exec/tests-summary.d.ts +1 -1
  26. package/dist/commands/exec/worker-chart.d.ts +1 -1
  27. package/dist/commands/runs/list/command.js +136 -33
  28. package/dist/commands/runs/list/metadata.js +22 -18
  29. package/dist/commands/runs/logs/command.js +131 -48
  30. package/dist/commands/runs/logs/metadata.js +24 -20
  31. package/dist/commands/runs/metadata.js +6 -2
  32. package/dist/commands/runs/past-run.d.ts +1 -1
  33. package/dist/commands/runs/past-run.js +1 -1
  34. package/dist/commands/runs/show/command.js +396 -74
  35. package/dist/commands/runs/show/metadata.js +24 -20
  36. package/dist/commands/vitest/command.js +195 -128
  37. package/dist/commands/vitest/metadata.js +45 -37
  38. package/dist/context.d.ts +1 -1
  39. package/dist/core/events.d.ts +1 -1
  40. package/dist/core/payload.d.ts +1 -1
  41. package/dist/core/payload.js +1 -1
  42. package/dist/core/provider.d.ts +12 -2
  43. package/dist/core/run.js +1 -1
  44. package/dist/live-app.d.ts +9 -0
  45. package/dist/live-app.js +21 -0
  46. package/dist/resource-commands.d.ts +13 -0
  47. package/dist/resource-commands.js +22 -0
  48. package/dist/resources/github/provider.d.ts +1 -1
  49. package/dist/resources/testserver/command-tree.d.ts +4 -0
  50. package/dist/resources/testserver/command-tree.js +12 -0
  51. package/dist/resources/testserver/commands/create/command.js +373 -194
  52. package/dist/resources/testserver/commands/create/metadata.js +52 -48
  53. package/dist/resources/testserver/commands/list/command.js +195 -50
  54. package/dist/resources/testserver/commands/list/metadata.js +12 -8
  55. package/dist/resources/testserver/provider.d.ts +1 -1
  56. package/dist/resources/testserver/resource-provider.js +2 -8
  57. package/dist/resources.d.ts +0 -3
  58. package/dist/resources.js +5 -10
  59. package/dist/runner/recipe.js +1 -1
  60. package/dist/runner/remote-command.js +1 -1
  61. package/dist/sdk/host.d.ts +2 -0
  62. package/dist/sdk/host.js +7 -0
  63. package/dist/version.d.ts +2 -2
  64. package/dist/version.js +10 -11
  65. package/dist/vitest/config.d.ts +4 -8
  66. package/dist/vitest/config.js +5 -9
  67. package/dist/vitest/container-scope.d.ts +12 -5
  68. package/dist/vitest/container-scope.js +27 -4
  69. package/dist/vitest/diagnostics.d.ts +8 -2
  70. package/dist/vitest/diagnostics.js +7 -4
  71. package/dist/vitest/fixtures.d.ts +4 -1
  72. package/dist/vitest/fixtures.js +17 -6
  73. package/dist/vitest/plan.d.ts +1 -1
  74. package/dist/vitest/plan.js +2 -2
  75. package/dist/vitest/sandbox.d.ts +6 -0
  76. package/dist/vitest/sandbox.js +6 -0
  77. package/package.json +4 -3
  78. package/bin/node-version.js +0 -24
  79. package/dist/closed-terminal.d.ts +0 -7
  80. package/dist/closed-terminal.js +0 -18
package/bin/storm.js CHANGED
@@ -1,16 +1,5 @@
1
1
  #!/usr/bin/env node
2
- // Checks the Node version first: an older Node stops here with the version storm needs, before
3
- // it loads any source. Then runs the TypeScript source in the cnc workspace (no build step), and the
4
- // built JavaScript in a published install, where Node cannot strip types under node_modules. The
5
- // entry is imported dynamically, because static imports load before the check runs.
6
- import { existsSync } from "node:fs";
7
- import { nodeVersionProblem } from "./node-version.js";
2
+ // Clinkr's launcher: checks the Node version, turns on the compile cache, and runs `src/` or, installed, `dist/`.
3
+ import { launch } from "@vercel/clinkr/node/launch";
8
4
 
9
- const problem = nodeVersionProblem(process.versions.node);
10
- if (problem !== undefined) {
11
- process.stderr.write(`${problem}\n`);
12
- process.exitCode = 1;
13
- } else {
14
- const source = new URL("../src/bin/storm.ts", import.meta.url);
15
- await import((existsSync(source) ? source : new URL("../dist/bin/storm.js", import.meta.url)).href);
16
- }
5
+ await launch({ name: "storm", bin: import.meta.url });
@@ -1,13 +1,21 @@
1
- import { type ClinkrApplication } from "@vercel/clinkr";
1
+ import { type ApplicationVersion, type ClinkrApplication } from "@vercel/clinkr";
2
2
  import type { StormApp } from "./context.ts";
3
+ /** Where storm's code is: `src/` from source, `dist/` built. Everything else resolves from it. */
4
+ export interface StormApplicationOptions {
5
+ /** Whether accessible mode is on (`VERCEL_ACCESSIBLE=1`), which leaves the help logo out of root help. */
6
+ readonly accessible: boolean;
7
+ /**
8
+ * storm's code root, the directory this module's source or build sits in: `src/` or `dist/`. The bin passes it,
9
+ * since a bundled build moves this module's code to another file, where `import.meta.dirname` names another
10
+ * directory.
11
+ */
12
+ readonly root: string;
13
+ }
3
14
  /**
4
- * Discovers the `storm` command tree under `commands/`, and mounts each resource's own command tree beside it
5
- * (`RESOURCE_MOUNTS`), such as the Testserver pool's `pool`; `version` is what root `--version` prints, the version
6
- * and commit as a run's version line shows them (`versionText`). `accessible` is whether accessible mode is on
7
- * (`VERCEL_ACCESSIBLE=1`), which leaves the help logo out of root help. Its skills, which `storm skills get` prints
8
- * for agents, are the Markdown files in `skills/`, beside `src/` and `dist/`, so the path resolves the same from the
9
- * source and the build.
15
+ * Discovers the `storm` command tree under `commands/` in `root`, and mounts each resource's own command tree beside
16
+ * it (`resourceMounts`, from `resource-commands.ts`, which loads no resource's run code), such as the Testserver pool's
17
+ * `pool`; `version` is what root `--version` prints, the version and commit as a run's version line shows them
18
+ * (`versionText`), or a function Clinkr calls only to print it. Its skills, which `storm skills get` prints for agents,
19
+ * are the Markdown files in `skills/`, beside `src/` and `dist/`.
10
20
  */
11
- export declare function loadStormApplication(version: string, options: {
12
- readonly accessible: boolean;
13
- }): Promise<ClinkrApplication<StormApp>>;
21
+ export declare function loadStormApplication(version: ApplicationVersion, options: StormApplicationOptions): Promise<ClinkrApplication<StormApp>>;
@@ -1,23 +1,22 @@
1
1
  import { join } from "node:path";
2
2
  import { createApplication } from "@vercel/clinkr";
3
3
  import { stormHelpLogo } from "./help-logo.js";
4
- import { RESOURCE_MOUNTS } from "./resources.js";
4
+ import { resourceMounts } from "./resource-commands.js";
5
5
  const DESCRIPTION = "Run a command against Vercel Testserver sandboxes.";
6
6
  /**
7
- * Discovers the `storm` command tree under `commands/`, and mounts each resource's own command tree beside it
8
- * (`RESOURCE_MOUNTS`), such as the Testserver pool's `pool`; `version` is what root `--version` prints, the version
9
- * and commit as a run's version line shows them (`versionText`). `accessible` is whether accessible mode is on
10
- * (`VERCEL_ACCESSIBLE=1`), which leaves the help logo out of root help. Its skills, which `storm skills get` prints
11
- * for agents, are the Markdown files in `skills/`, beside `src/` and `dist/`, so the path resolves the same from the
12
- * source and the build.
7
+ * Discovers the `storm` command tree under `commands/` in `root`, and mounts each resource's own command tree beside
8
+ * it (`resourceMounts`, from `resource-commands.ts`, which loads no resource's run code), such as the Testserver pool's
9
+ * `pool`; `version` is what root `--version` prints, the version and commit as a run's version line shows them
10
+ * (`versionText`), or a function Clinkr calls only to print it. Its skills, which `storm skills get` prints for agents,
11
+ * are the Markdown files in `skills/`, beside `src/` and `dist/`.
13
12
  */
14
13
  export async function loadStormApplication(version, options) {
15
- const { accessible } = options;
16
- return await createApplication("storm", import.meta.dirname, {
14
+ const { accessible, root } = options;
15
+ return await createApplication("storm", root, {
17
16
  description: DESCRIPTION,
18
17
  version,
19
18
  helpLogo: (terminal) => stormHelpLogo(terminal, { accessible }),
20
- mounts: RESOURCE_MOUNTS,
21
- skills: join(import.meta.dirname, "../skills"),
19
+ mounts: resourceMounts(root),
20
+ skills: join(root, "../skills"),
22
21
  });
23
22
  }
package/dist/bin/storm.js CHANGED
@@ -1,45 +1,101 @@
1
- // The `storm` executable that `bin/storm.js` loads after its Node version check: read the version and the
2
- // git commit it was built from, run the command tree under `runNodeCli` over the live Context, then exit with the
3
- // status a command recorded past Clinkr's (a run's command's code), or else Clinkr's. When the terminal has closed
4
- // before the outcome is written (EIO after SIGHUP), it exits with the status the run reached instead of failing.
1
+ import {
2
+ testserverPoolCommandTree
3
+ } from "../chunks/chunk-S5NAIZYS.js";
4
+
5
+ // src/bin/storm.ts
5
6
  import { readFileSync } from "node:fs";
7
+ import { fileURLToPath } from "node:url";
6
8
  import { runNodeCli } from "@vercel/clinkr/node";
7
- import { loadStormApplication } from "../application.js";
8
- import { closedTerminalStatus, isClosedTerminalError } from "../closed-terminal.js";
9
- import { liveContext } from "../context.js";
10
- import { resolvePresentation } from "../presentation.js";
11
- import { RESOURCE_CONFIGS } from "../resources.js";
12
- import { localUserName } from "../runner/index.js";
13
- import { buildCommit, versionText } from "../version.js";
14
- // `../../package.json` is the package manifest from both `src/bin/` and `dist/bin/`.
15
- const manifest = JSON.parse(readFileSync(new URL("../../package.json", import.meta.url), "utf8"));
16
- const commit = await buildCommit(import.meta.url);
17
- let app;
18
- let signalReason;
19
- let status;
20
- try {
21
- const accessible = process.env["VERCEL_ACCESSIBLE"] === "1";
22
- status = await runNodeCli(await loadStormApplication(versionText(manifest.version, commit), { accessible }), {
23
- app: (host) => {
24
- signalReason = () => host.signal.reason;
25
- app = {
26
- context: liveContext({ env: host.env }),
27
- resourceConfigs: RESOURCE_CONFIGS,
28
- env: host.env,
29
- cwd: host.cwd,
30
- version: manifest.version,
31
- commit,
32
- user: localUserName(),
33
- presentation: resolvePresentation(host),
34
- exit: { status: undefined },
35
- };
36
- return app;
37
- },
38
- });
9
+
10
+ // src/application.ts
11
+ import { join as join2 } from "node:path";
12
+ import { createApplication } from "@vercel/clinkr";
13
+
14
+ // src/help-logo.ts
15
+ var CLOUD_TOP = [" .-~~~~~-. .-~~~~-.", " .-~( )~-..-~( )~-."];
16
+ var CLOUD_WORDMARK = { indent: " ", left: "( ", wordmark: "storm", right: " )" };
17
+ var CLOUD_BOTTOM = " `~-.._______________________..-~'";
18
+ var BOLTS = 8;
19
+ var SANDBOX_ROWS = [3, 5];
20
+ var HELP_LOGO_WIDTH = CLOUD_WORDMARK.indent.length + CLOUD_WORDMARK.left.length + CLOUD_WORDMARK.wordmark.length + CLOUD_WORDMARK.right.length;
21
+ var code = (open, close) => (text) => text === "" ? text : `\x1B[${open}m${text}\x1B[${close}m`;
22
+ var COLOR = {
23
+ cloud: code("90", "39"),
24
+ wordmark: code("1;36", "22;39"),
25
+ bolt: code("1;93", "22;39"),
26
+ passed: code("32", "39"),
27
+ failed: code("31", "39"),
28
+ bracket: code("90", "39")
29
+ };
30
+ var NO_COLOR = Object.fromEntries(Object.keys(COLOR).map((role) => [role, (text) => text]));
31
+ var UNICODE = { bolt: "\u03DF", passed: "\u2713", failed: "\u2717" };
32
+ var ASCII = { bolt: "/", passed: "+", failed: "x" };
33
+ function stormHelpLogo(terminal, options) {
34
+ if (options.accessible) return void 0;
35
+ const { columns } = terminal.stdout;
36
+ if (columns !== void 0 && columns > 0 && columns < HELP_LOGO_WIDTH) return void 0;
37
+ const paint = terminal.stdout.color === "none" ? NO_COLOR : COLOR;
38
+ const glyph = terminal.unicode ? UNICODE : ASCII;
39
+ const cloudLine = (line) => {
40
+ const text = line.trimStart();
41
+ return `${line.slice(0, line.length - text.length)}${paint.cloud(text)}`;
42
+ };
43
+ const lines = [
44
+ ...CLOUD_TOP.map(cloudLine),
45
+ `${CLOUD_WORDMARK.indent}${paint.cloud(CLOUD_WORDMARK.left)}${paint.wordmark(CLOUD_WORDMARK.wordmark)}${paint.cloud(CLOUD_WORDMARK.right)}`,
46
+ cloudLine(CLOUD_BOTTOM),
47
+ ` ${paint.bolt(Array.from({ length: BOLTS }, () => glyph.bolt).join(" "))}`,
48
+ ...SANDBOX_ROWS.map(
49
+ (failed) => ` ${Array.from(
50
+ { length: BOLTS },
51
+ (_, index) => index === failed ? paint.failed(glyph.failed) : paint.passed(glyph.passed)
52
+ ).map((result) => `${paint.bracket("[")}${result}${paint.bracket("]")}`).join(" ")}`
53
+ )
54
+ ];
55
+ return lines.join("\n");
39
56
  }
40
- catch (error) {
41
- if (!isClosedTerminalError(error))
42
- throw error;
43
- status = closedTerminalStatus(app?.exit.status, signalReason?.());
57
+
58
+ // src/resource-commands.ts
59
+ import { join } from "node:path";
60
+ var RESOURCE_COMMAND_TREES = [testserverPoolCommandTree];
61
+ function resourceMounts(root2) {
62
+ return RESOURCE_COMMAND_TREES.map(({ mount, directory }) => ({
63
+ ...mount,
64
+ source: { ...mount.source, directory: join(root2, directory) }
65
+ }));
44
66
  }
45
- process.exitCode = app?.exit.status ?? status;
67
+
68
+ // src/application.ts
69
+ var DESCRIPTION = "Run a command against Vercel Testserver sandboxes.";
70
+ async function loadStormApplication(version2, options) {
71
+ const { accessible: accessible2, root: root2 } = options;
72
+ return await createApplication("storm", root2, {
73
+ description: DESCRIPTION,
74
+ version: version2,
75
+ helpLogo: (terminal) => stormHelpLogo(terminal, { accessible: accessible2 }),
76
+ mounts: resourceMounts(root2),
77
+ skills: join2(root2, "../skills")
78
+ });
79
+ }
80
+
81
+ // src/bin/storm.ts
82
+ var root = fileURLToPath(new URL("..", import.meta.url));
83
+ var manifest = JSON.parse(readFileSync(new URL("../../package.json", import.meta.url), "utf8"));
84
+ var commitRead;
85
+ function commit() {
86
+ commitRead ??= import("../chunks/version-X7RMSKZI.js").then(({ buildCommit }) => buildCommit(import.meta.url));
87
+ return commitRead;
88
+ }
89
+ async function version() {
90
+ const [{ versionText }, built] = await Promise.all([import("../chunks/version-X7RMSKZI.js"), commit()]);
91
+ return versionText(manifest.version, built);
92
+ }
93
+ var exit = { status: void 0 };
94
+ var accessible = process.env["VERCEL_ACCESSIBLE"] === "1";
95
+ var status = await runNodeCli(await loadStormApplication(version, { accessible, root }), {
96
+ app: async (host) => {
97
+ const [{ liveStormApp }, built] = await Promise.all([import("../chunks/live-app-X3PW2W42.js"), commit()]);
98
+ return liveStormApp(host, { version: manifest.version, commit: built }, exit);
99
+ }
100
+ });
101
+ process.exitCode = exit.status ?? status;
@@ -1,3 +1,3 @@
1
1
  // Written by scripts/write-build-info.js when the package was built.
2
- export const sha = "ac0aeb588460";
2
+ export const sha = "02abcb3f0bfb";
3
3
  export const dirty = false;