@cnc-tools/storm 0.14.1 → 0.14.2

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 (41) hide show
  1. package/dist/bin/storm.js +10 -2
  2. package/dist/build-info.js +1 -1
  3. package/dist/chunks/{chunk-27P2QSIM.js → chunk-3HBPNQ4Y.js} +1 -1
  4. package/dist/chunks/{chunk-HOKDKP5A.js → chunk-E3QU74NX.js} +1 -1
  5. package/dist/chunks/{chunk-RKONDLPS.js → chunk-GJOEPJJL.js} +2 -2
  6. package/dist/chunks/{chunk-XPCUINWS.js → chunk-HDL4WKIB.js} +1 -1
  7. package/dist/chunks/{chunk-IVRRGGCD.js → chunk-HP54VHGY.js} +4 -4
  8. package/dist/chunks/{chunk-5ED3IDUJ.js → chunk-I7AN3DIJ.js} +25 -4
  9. package/dist/chunks/{chunk-YBPTMJUM.js → chunk-LUOHJ3LB.js} +9 -9
  10. package/dist/chunks/{chunk-ZH5R7W4A.js → chunk-RUPD4TLT.js} +1 -1
  11. package/dist/chunks/{chunk-BFLYGMG3.js → chunk-TVMEKVOW.js} +4 -4
  12. package/dist/chunks/{chunk-Z5OXOZD3.js → chunk-UUBZTGLV.js} +1 -1
  13. package/dist/chunks/{chunk-5TMHYH7G.js → chunk-VH2POPW5.js} +4 -2
  14. package/dist/chunks/{chunk-QBR5VHJ7.js → chunk-XZCDA5PE.js} +1 -1
  15. package/dist/chunks/{live-app-FBVWUUMT.js → live-app-SZGEILCQ.js} +13 -7
  16. package/dist/commands/exec/command.js +10 -10
  17. package/dist/commands/exec/exec-words.js +1 -1
  18. package/dist/commands/exec/metadata.js +1 -1
  19. package/dist/commands/playwright/command.js +11 -11
  20. package/dist/commands/runs/list/command.js +5 -5
  21. package/dist/commands/runs/logs/command.js +5 -5
  22. package/dist/commands/runs/show/command.js +8 -8
  23. package/dist/commands/snapshots/build/command.js +9 -9
  24. package/dist/commands/snapshots/list/command.js +6 -6
  25. package/dist/commands/vitest/command.js +11 -11
  26. package/dist/context.d.ts +1 -0
  27. package/dist/context.js +4 -1
  28. package/dist/core/payload.d.ts +5 -3
  29. package/dist/core/payload.js +8 -3
  30. package/dist/extensions/testserver/commands/pool/create/command.js +1 -1
  31. package/dist/live-app.d.ts +3 -1
  32. package/dist/live-app.js +5 -2
  33. package/dist/runner/gateways.d.ts +10 -2
  34. package/dist/runner/index.d.ts +1 -1
  35. package/dist/runner/live/sandbox-gateway.js +16 -2
  36. package/dist/runner/live/terminal.d.ts +15 -3
  37. package/dist/runner/live/terminal.js +25 -3
  38. package/dist/runner/recipe.d.ts +3 -2
  39. package/dist/runner/sandboxed-command.d.ts +5 -5
  40. package/dist/runner/sandboxed-command.js +7 -5
  41. package/package.json +1 -1
package/dist/bin/storm.js CHANGED
@@ -102,11 +102,19 @@ async function version() {
102
102
  return versionText(manifest.version, built);
103
103
  }
104
104
  var exit = { status: void 0 };
105
+ function hasNoColorFlag(argv) {
106
+ for (const token of argv) {
107
+ if (token === "--") return false;
108
+ if (token === "--no-color") return true;
109
+ }
110
+ return false;
111
+ }
105
112
  var accessible = process.env["VERCEL_ACCESSIBLE"] === "1";
113
+ var noColor = hasNoColorFlag(process.argv.slice(2));
106
114
  var status = await runNodeCli(await loadStormApplication(version, { accessible, root }), {
107
115
  app: async (host) => {
108
- const [{ liveStormApp }, built] = await Promise.all([import("../chunks/live-app-FBVWUUMT.js"), commit()]);
109
- return liveStormApp(host, { version: manifest.version, commit: built }, exit);
116
+ const [{ liveStormApp }, built] = await Promise.all([import("../chunks/live-app-SZGEILCQ.js"), commit()]);
117
+ return liveStormApp(host, { version: manifest.version, commit: built }, exit, { noColor });
110
118
  }
111
119
  });
112
120
  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 = "36a0a0305429";
2
+ export const sha = "d37810580bd7";
3
3
  export const dirty = false;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  redactSecrets
3
- } from "./chunk-5ED3IDUJ.js";
3
+ } from "./chunk-I7AN3DIJ.js";
4
4
 
5
5
  // src/commands/exec/redaction.ts
6
6
  function redactor(secrets) {
@@ -2,7 +2,7 @@ import {
2
2
  RESOURCE_FLAG_HELP,
3
3
  RESOURCE_USAGE_FLAGS,
4
4
  resourceRunExamples
5
- } from "./chunk-BFLYGMG3.js";
5
+ } from "./chunk-TVMEKVOW.js";
6
6
 
7
7
  // src/commands/exec/run-metadata.ts
8
8
  var RUN_USAGE_FLAGS = `${RESOURCE_USAGE_FLAGS} [--credential <SOURCE>] [--scope <TEAM> --project <PROJECT>] [--unsandboxed | [--show-output] [--keep-sandbox <DURATION>]] [--verbose]`;
@@ -2,11 +2,11 @@ import {
2
2
  EMPTY_RUN_STATE,
3
3
  commandExitStatus,
4
4
  observeAll
5
- } from "./chunk-5TMHYH7G.js";
5
+ } from "./chunk-VH2POPW5.js";
6
6
  import {
7
7
  parseTestEvent,
8
8
  testEventLine
9
- } from "./chunk-5ED3IDUJ.js";
9
+ } from "./chunk-I7AN3DIJ.js";
10
10
 
11
11
  // src/run-directory/run-directory.ts
12
12
  import { join } from "node:path";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  short
3
- } from "./chunk-QBR5VHJ7.js";
3
+ } from "./chunk-XZCDA5PE.js";
4
4
 
5
5
  // src/commands/exec/snapshot-text.ts
6
6
  var REJECTIONS_SHOWN = 5;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  runHelp
3
- } from "./chunk-HOKDKP5A.js";
3
+ } from "./chunk-E3QU74NX.js";
4
4
  import {
5
5
  RAN_DESCRIPTION,
6
6
  RUN_CLI_OPTIONS,
@@ -12,13 +12,13 @@ import {
12
12
  ranSchema,
13
13
  runCommand,
14
14
  runProblems
15
- } from "./chunk-YBPTMJUM.js";
15
+ } from "./chunk-LUOHJ3LB.js";
16
16
  import {
17
17
  recordedPlan
18
- } from "./chunk-BFLYGMG3.js";
18
+ } from "./chunk-TVMEKVOW.js";
19
19
  import {
20
20
  planSchema
21
- } from "./chunk-RKONDLPS.js";
21
+ } from "./chunk-GJOEPJJL.js";
22
22
  import {
23
23
  DRIVER_PLAN_FAILURE_KINDS,
24
24
  NOT_COUNTED
@@ -1552,6 +1552,13 @@ var TERMINATE_GRACE_MS = 1e4;
1552
1552
  var KILL_GRACE_MS = 5e3;
1553
1553
  var STDERR_MESSAGE_CHARS = 1e3;
1554
1554
  var SNAPSHOT_GONE_STATUS = 410;
1555
+ var DROP_CAPABILITIES_ARGS = [
1556
+ "--inh-caps=-all",
1557
+ "--ambient-caps=-all",
1558
+ "--bounding-set=-all",
1559
+ "--no-new-privs",
1560
+ "--"
1561
+ ];
1555
1562
  function liveRunnerSandboxGateway() {
1556
1563
  let loading;
1557
1564
  const sdk = () => loading ??= import("@vercel/sandbox");
@@ -1651,8 +1658,8 @@ function liveRunnerSandboxGateway() {
1651
1658
  const cmd = await resolveExecutable(holder, request2);
1652
1659
  if (kill.aborted) return { ok: false, failure: { kind: "aborted" } };
1653
1660
  const command = await startDetached(holder, {
1654
- cmd,
1655
- args: [...request2.args],
1661
+ cmd: "setpriv",
1662
+ args: [...DROP_CAPABILITIES_ARGS, cmd, ...request2.args],
1656
1663
  cwd: request2.cwd,
1657
1664
  env: { ...request2.env }
1658
1665
  });
@@ -1909,6 +1916,16 @@ function isAborted(signal) {
1909
1916
  }
1910
1917
 
1911
1918
  // src/runner/live/terminal.ts
1919
+ function resolveRunnerTerminalColor(options) {
1920
+ if (options.noColor === true) return "off";
1921
+ const noColor = options.env["NO_COLOR"];
1922
+ if (noColor !== void 0 && noColor !== "") return "off";
1923
+ const forced = options.env["FORCE_COLOR"];
1924
+ if (forced !== void 0 && forced !== "") {
1925
+ return forced === "0" || forced === "false" ? "auto" : "on";
1926
+ }
1927
+ return options.isTTY && options.env["TERM"] !== "dumb" ? "on" : "auto";
1928
+ }
1912
1929
  function liveRunnerTerminal(options) {
1913
1930
  const stdout = options.stdout ?? process.stdout;
1914
1931
  const stderr = options.stderr ?? process.stderr;
@@ -1931,7 +1948,11 @@ function liveRunnerTerminal(options) {
1931
1948
  }
1932
1949
  };
1933
1950
  return {
1934
- color: stdout.isTTY === true && options.env["NO_COLOR"] === void 0,
1951
+ color: resolveRunnerTerminalColor({
1952
+ isTTY: stdout.isTTY === true,
1953
+ env: options.env,
1954
+ ...options.noColor === void 0 ? {} : { noColor: options.noColor }
1955
+ }),
1935
1956
  writeStdout: (text) => write(stdout, text),
1936
1957
  writeStderr: (text) => write(stderr, text)
1937
1958
  };
@@ -2143,7 +2164,7 @@ function sandboxEnvironment(request2) {
2143
2164
  return {
2144
2165
  PATH: [...bins, request2.loginPath].filter((part) => part !== "").join(":"),
2145
2166
  NO_UPDATE_NOTIFIER: "1",
2146
- ...request2.env["FORCE_COLOR"] !== void 0 || request2.env["NO_COLOR"] !== void 0 ? {} : request2.color ? { FORCE_COLOR: "1" } : { NO_COLOR: "1" },
2167
+ ...request2.env["FORCE_COLOR"] !== void 0 || request2.env["NO_COLOR"] !== void 0 ? {} : request2.color === "on" ? { FORCE_COLOR: "1" } : request2.color === "off" ? { NO_COLOR: "1" } : {},
2147
2168
  ...request2.env,
2148
2169
  [RUN_PAYLOAD_VARIABLE]: request2.runPayload
2149
2170
  };
@@ -6,7 +6,7 @@ import {
6
6
  redactingObserver,
7
7
  redactingTerminal,
8
8
  redactor
9
- } from "./chunk-27P2QSIM.js";
9
+ } from "./chunk-3HBPNQ4Y.js";
10
10
  import {
11
11
  criticalPathStep,
12
12
  recordedPlan,
@@ -17,23 +17,23 @@ import {
17
17
  testsChart,
18
18
  testsSummaryLines,
19
19
  waterfallLines
20
- } from "./chunk-BFLYGMG3.js";
20
+ } from "./chunk-TVMEKVOW.js";
21
21
  import {
22
22
  builtAtText,
23
23
  rejectionLines,
24
24
  snapshotCacheNoteText
25
- } from "./chunk-XPCUINWS.js";
25
+ } from "./chunk-HDL4WKIB.js";
26
26
  import {
27
27
  DEFINITION_SET,
28
28
  RESOURCES
29
- } from "./chunk-Z5OXOZD3.js";
29
+ } from "./chunk-UUBZTGLV.js";
30
30
  import {
31
31
  sandboxConnectPage
32
32
  } from "./chunk-NMVODY3P.js";
33
33
  import {
34
34
  recordRun,
35
35
  timelineSchema
36
- } from "./chunk-RKONDLPS.js";
36
+ } from "./chunk-GJOEPJJL.js";
37
37
  import {
38
38
  isoSecondsText,
39
39
  keepTimeText,
@@ -46,7 +46,7 @@ import {
46
46
  truncate,
47
47
  visibleLength,
48
48
  withArticle
49
- } from "./chunk-QBR5VHJ7.js";
49
+ } from "./chunk-XZCDA5PE.js";
50
50
  import {
51
51
  EMPTY_RUN_STATE,
52
52
  cleanupProblems,
@@ -59,7 +59,7 @@ import {
59
59
  setupPhaseWords,
60
60
  timedProgress,
61
61
  warningTally
62
- } from "./chunk-5TMHYH7G.js";
62
+ } from "./chunk-VH2POPW5.js";
63
63
  import {
64
64
  RUNNER_SECRET_MIN_LENGTH,
65
65
  configErrors,
@@ -75,7 +75,7 @@ import {
75
75
  requireTarget,
76
76
  settleCredential,
77
77
  settleRunResources
78
- } from "./chunk-5ED3IDUJ.js";
78
+ } from "./chunk-I7AN3DIJ.js";
79
79
  import {
80
80
  describeMintFailure,
81
81
  isCi
@@ -93,7 +93,7 @@ import {
93
93
  // src/commands/exec/exec-words.ts
94
94
  var EXEC_HELP = {
95
95
  usage: "-- <command...>",
96
- args: "The command to run, after --, as an argument list with no shell. Unsandboxed, it gets this machine's working directory and environment, less the launcher variables its resources hide, plus STORM_RUN, and FORCE_COLOR or NO_COLOR when neither is set; in a sandboxed run, the runner recipe's cwd, its env, the runner's PATH, STORM_RUN, and FORCE_COLOR or NO_COLOR when that env sets neither, with paths under the repository's root rewritten.",
96
+ args: "The command to run, after --, as an argument list with no shell. Unsandboxed, it gets this machine's working directory and environment, less the launcher variables its resources hide, plus STORM_RUN, and FORCE_COLOR or NO_COLOR only when neither is set and the launcher asks for or opts out of color; in a sandboxed run, the runner recipe's cwd, its env, the runner's PATH, STORM_RUN, and FORCE_COLOR or NO_COLOR only when that env sets neither and the launcher asks for or opts out of color, with paths under the repository's root rewritten.",
97
97
  verbose: "which asks the command to print what each test does as it happens, for passing tests too",
98
98
  examples: [
99
99
  {
@@ -9,7 +9,7 @@ import {
9
9
  isoSecondsText,
10
10
  seconds,
11
11
  short
12
- } from "./chunk-QBR5VHJ7.js";
12
+ } from "./chunk-XZCDA5PE.js";
13
13
 
14
14
  // src/commands/runs/facts.ts
15
15
  import { z } from "zod";
@@ -2,7 +2,7 @@ import {
2
2
  DEFINITION_SET,
3
3
  EXTENSIONS,
4
4
  RESOURCES
5
- } from "./chunk-Z5OXOZD3.js";
5
+ } from "./chunk-UUBZTGLV.js";
6
6
  import {
7
7
  median,
8
8
  paint,
@@ -10,16 +10,16 @@ import {
10
10
  shortFile,
11
11
  truncate,
12
12
  visibleLength
13
- } from "./chunk-QBR5VHJ7.js";
13
+ } from "./chunk-XZCDA5PE.js";
14
14
  import {
15
15
  megabytesText,
16
16
  sameRow,
17
17
  setupPhaseKey,
18
18
  setupPhaseWords
19
- } from "./chunk-5TMHYH7G.js";
19
+ } from "./chunk-VH2POPW5.js";
20
20
  import {
21
21
  CONFIG_FILE_NAME
22
- } from "./chunk-5ED3IDUJ.js";
22
+ } from "./chunk-I7AN3DIJ.js";
23
23
  import {
24
24
  defaultResourceKey,
25
25
  optionKeyPath
@@ -6,7 +6,7 @@ import {
6
6
  driversOf,
7
7
  resourceDefinitionSet,
8
8
  resourcesOf
9
- } from "./chunk-5TMHYH7G.js";
9
+ } from "./chunk-VH2POPW5.js";
10
10
  import {
11
11
  argsText,
12
12
  booleanOption,
@@ -7,7 +7,7 @@ import {
7
7
  parseTestEvent,
8
8
  systemClock,
9
9
  systemTimer
10
- } from "./chunk-5ED3IDUJ.js";
10
+ } from "./chunk-I7AN3DIJ.js";
11
11
 
12
12
  // src/core/reports.ts
13
13
  var WARNINGS_HEADING = "Warnings";
@@ -976,7 +976,9 @@ function commandEnvironment(env, payload) {
976
976
  }
977
977
  function colorEnvironment(env, color) {
978
978
  if (env["FORCE_COLOR"] !== void 0 || env["NO_COLOR"] !== void 0) return env;
979
- return { ...env, ...color ? { FORCE_COLOR: "1" } : { NO_COLOR: "1" } };
979
+ if (color === "on") return { ...env, FORCE_COLOR: "1" };
980
+ if (color === "off") return { ...env, NO_COLOR: "1" };
981
+ return env;
980
982
  }
981
983
 
982
984
  // src/core/resources.ts
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  secondsOf,
3
3
  secondsText
4
- } from "./chunk-5TMHYH7G.js";
4
+ } from "./chunk-VH2POPW5.js";
5
5
 
6
6
  // src/commands/exec/text.ts
7
7
  function seconds(ms) {
@@ -2,14 +2,14 @@ import {
2
2
  RESOURCES,
3
3
  liveDriverContexts,
4
4
  liveResourceContexts
5
- } from "./chunk-Z5OXOZD3.js";
5
+ } from "./chunk-UUBZTGLV.js";
6
6
  import "./chunk-UC6DULWY.js";
7
7
  import "./chunk-BRUIATTR.js";
8
8
  import {
9
9
  RUNS_SUBPATH,
10
10
  liveRunDirectoryGateway,
11
11
  unavailableRunDirectoryGateway
12
- } from "./chunk-RKONDLPS.js";
12
+ } from "./chunk-GJOEPJJL.js";
13
13
  import {
14
14
  liveCommandGateway,
15
15
  liveJobSummaryGateway,
@@ -17,7 +17,7 @@ import {
17
17
  liveProgressTerminal,
18
18
  resolveStateDirectory,
19
19
  stateDirectoryPattern
20
- } from "./chunk-5TMHYH7G.js";
20
+ } from "./chunk-VH2POPW5.js";
21
21
  import {
22
22
  RUNNER_SNAPSHOTS_SUBPATH,
23
23
  configResolver,
@@ -33,7 +33,7 @@ import {
33
33
  systemClock,
34
34
  systemTimer,
35
35
  unavailableRunnerSnapshotCacheGateway
36
- } from "./chunk-5ED3IDUJ.js";
36
+ } from "./chunk-I7AN3DIJ.js";
37
37
  import "./chunk-RA4L2ACU.js";
38
38
  import "./chunk-GQIL3AHY.js";
39
39
  import "./chunk-GSC6SRTW.js";
@@ -71,7 +71,10 @@ function liveContext(options) {
71
71
  checkout: liveCheckoutGateway(),
72
72
  runnerSnapshots: snapshots.ok ? liveRunnerSnapshotCacheGateway({ directory: snapshots.directory }) : unavailableRunnerSnapshotCacheGateway(stateDirectoryPattern(RUNNER_SNAPSHOTS_SUBPATH), snapshots.reason),
73
73
  runnerSandboxes: liveRunnerSandboxGateway(),
74
- runnerTerminal: liveRunnerTerminal({ env: options.env }),
74
+ runnerTerminal: liveRunnerTerminal({
75
+ env: options.env,
76
+ ...options.noColor === void 0 ? {} : { noColor: options.noColor }
77
+ }),
75
78
  runDirectories: runs.ok ? liveRunDirectoryGateway({ directory: runs.directory }) : unavailableRunDirectoryGateway(stateDirectoryPattern(RUNS_SUBPATH), runs.reason),
76
79
  progressTerminal: liveProgressTerminal(),
77
80
  jobSummary: liveJobSummaryGateway({ path: options.env["GITHUB_STEP_SUMMARY"] }),
@@ -98,8 +101,11 @@ function resolveColor(env, rich) {
98
101
  }
99
102
 
100
103
  // src/live-app.ts
101
- function liveStormApp(host, build, exit) {
102
- const context = liveContext({ env: host.env });
104
+ function liveStormApp(host, build, exit, options = {}) {
105
+ const context = liveContext({
106
+ env: host.env,
107
+ ...options.noColor === void 0 ? {} : { noColor: options.noColor }
108
+ });
103
109
  return {
104
110
  context,
105
111
  resourceContexts: liveResourceContexts(host.env),
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  runHelp
3
- } from "../../chunks/chunk-HOKDKP5A.js";
3
+ } from "../../chunks/chunk-E3QU74NX.js";
4
4
  import {
5
5
  EXEC_HELP,
6
6
  EXEC_HINTS,
@@ -9,19 +9,19 @@ import {
9
9
  outcomes,
10
10
  runCommand,
11
11
  runProblems
12
- } from "../../chunks/chunk-YBPTMJUM.js";
12
+ } from "../../chunks/chunk-LUOHJ3LB.js";
13
13
  import "../../chunks/chunk-I5GZLOLQ.js";
14
- import "../../chunks/chunk-27P2QSIM.js";
15
- import "../../chunks/chunk-BFLYGMG3.js";
16
- import "../../chunks/chunk-XPCUINWS.js";
17
- import "../../chunks/chunk-Z5OXOZD3.js";
14
+ import "../../chunks/chunk-3HBPNQ4Y.js";
15
+ import "../../chunks/chunk-TVMEKVOW.js";
16
+ import "../../chunks/chunk-HDL4WKIB.js";
17
+ import "../../chunks/chunk-UUBZTGLV.js";
18
18
  import "../../chunks/chunk-UC6DULWY.js";
19
19
  import "../../chunks/chunk-BRUIATTR.js";
20
20
  import "../../chunks/chunk-NMVODY3P.js";
21
- import "../../chunks/chunk-RKONDLPS.js";
22
- import "../../chunks/chunk-QBR5VHJ7.js";
23
- import "../../chunks/chunk-5TMHYH7G.js";
24
- import "../../chunks/chunk-5ED3IDUJ.js";
21
+ import "../../chunks/chunk-GJOEPJJL.js";
22
+ import "../../chunks/chunk-XZCDA5PE.js";
23
+ import "../../chunks/chunk-VH2POPW5.js";
24
+ import "../../chunks/chunk-I7AN3DIJ.js";
25
25
  import {
26
26
  NOT_COUNTED
27
27
  } from "../../chunks/chunk-RA4L2ACU.js";
@@ -6,7 +6,7 @@
6
6
  /** `exec`'s part of its leaf help: its usage after the run flags, its arguments, `--verbose`'s ending and its examples. */
7
7
  export const EXEC_HELP = {
8
8
  usage: "-- <command...>",
9
- args: "The command to run, after --, as an argument list with no shell. Unsandboxed, it gets this machine's working directory and environment, less the launcher variables its resources hide, plus STORM_RUN, and FORCE_COLOR or NO_COLOR when neither is set; in a sandboxed run, the runner recipe's cwd, its env, the runner's PATH, STORM_RUN, and FORCE_COLOR or NO_COLOR when that env sets neither, with paths under the repository's root rewritten.",
9
+ args: "The command to run, after --, as an argument list with no shell. Unsandboxed, it gets this machine's working directory and environment, less the launcher variables its resources hide, plus STORM_RUN, and FORCE_COLOR or NO_COLOR only when neither is set and the launcher asks for or opts out of color; in a sandboxed run, the runner recipe's cwd, its env, the runner's PATH, STORM_RUN, and FORCE_COLOR or NO_COLOR only when that env sets neither and the launcher asks for or opts out of color, with paths under the repository's root rewritten.",
10
10
  verbose: "which asks the command to print what each test does as it happens, for passing tests too",
11
11
  examples: [
12
12
  {
@@ -1,6 +1,6 @@
1
1
  // src/commands/exec/metadata.ts
2
2
  var metadata = {
3
- description: "Run any command, the argument list after --, as it is, with the run payload in STORM_RUN. For vitest, use storm vitest, which finds vitest and can count the tests and size the run first (testPlan in storm.config.ts); exec counts nothing and sizes nothing. In an unsandboxed run (--unsandboxed), the command runs on this machine in the working directory, with this machine's environment less the launcher environment variables the run's resources hide, plus STORM_RUN, and FORCE_COLOR or NO_COLOR when neither is set. In a sandboxed run, the default, it runs in a runner sandbox, a Vercel Sandbox readied from the runner recipe in storm.config.ts, in the recipe's cwd, with the runner sandbox's own environment, a PATH that starts with node_modules/.bin of that cwd and of the repository's root, the recipe's env, FORCE_COLOR or NO_COLOR only when that env sets neither (an env that sets FORCE_COLOR gets no NO_COLOR), and STORM_RUN, and nothing from this machine's environment; each recipe step that names a runner secret, never the command, also gets that launcher environment variable, one its secrets key declares, shown as <token> in what storm prints and writes, and a sandboxed run refuses before it starts when one of them is unset, holds a line break or is shorter than 8 characters; each path under the repository's root in its arguments points at the runner sandbox's copy, and each in its output back at this checkout. The run has each resource that storm.config.ts declares under resources or that one of the resource's own flags names, unless the resource skips itself: it first acquires each one, while a sandboxed run readies its runner sandbox, hands it to the command under the run payload's resources, and releases it once the command has stopped; without one, the run payload names no resource. Each resource's flags and examples are below, and its own commands are under storm ext. Shows on stderr what runs when and what runs at once, live on a terminal and one line at a time elsewhere, then a waterfall of the run's lanes naming its critical path, and exits with the command's code. A run whose command exits 0 but saves no final test result warns no_final_test_results, whose next steps say how to add storm's reporter if the command runs tests. Each run writes what it was and how it ended, its events, its steps' output, its command's output, its test events and its timeline to a run directory under ${XDG_STATE_HOME:-~/.local/state}/storm/runs/, named for its run id, keeping the newest 1000 completed ones and every one whose run is still going; the summary names the run id, storm runs show reads the run back, and storm runs logs prints its command's output and its steps' logs. A flag overrides storm.config.ts, found in the working directory or a parent up to the git worktree's root and checked whole, which overrides the built-in default. A secret a resource hands its command, such as a test-data token, shows as <token> in what the run prints and writes.",
3
+ description: "Run any command, the argument list after --, as it is, with the run payload in STORM_RUN. For vitest, use storm vitest, which finds vitest and can count the tests and size the run first (testPlan in storm.config.ts); exec counts nothing and sizes nothing. In an unsandboxed run (--unsandboxed), the command runs on this machine in the working directory, with this machine's environment less the launcher environment variables the run's resources hide, plus STORM_RUN, and FORCE_COLOR or NO_COLOR only when neither is set and the launcher asks for or opts out of color. In a sandboxed run, the default, it runs in a runner sandbox, a Vercel Sandbox readied from the runner recipe in storm.config.ts, in the recipe's cwd, with the runner sandbox's own environment, a PATH that starts with node_modules/.bin of that cwd and of the repository's root, the recipe's env, FORCE_COLOR or NO_COLOR only when that env sets neither and the launcher asks for or opts out of color (a plain non-TTY launcher gets neither), and STORM_RUN, and nothing else from this machine's environment; each recipe step that names a runner secret, never the command, also gets that launcher environment variable, one its secrets key declares, shown as <token> in what storm prints and writes, and a sandboxed run refuses before it starts when one of them is unset, holds a line break or is shorter than 8 characters; each path under the repository's root in its arguments points at the runner sandbox's copy, and each in its output back at this checkout. The run has each resource that storm.config.ts declares under resources or that one of the resource's own flags names, unless the resource skips itself: it first acquires each one, while a sandboxed run readies its runner sandbox, hands it to the command under the run payload's resources, and releases it once the command has stopped; without one, the run payload names no resource. Each resource's flags and examples are below, and its own commands are under storm ext. Shows on stderr what runs when and what runs at once, live on a terminal and one line at a time elsewhere, then a waterfall of the run's lanes naming its critical path, and exits with the command's code. A run whose command exits 0 but saves no final test result warns no_final_test_results, whose next steps say how to add storm's reporter if the command runs tests. Each run writes what it was and how it ended, its events, its steps' output, its command's output, its test events and its timeline to a run directory under ${XDG_STATE_HOME:-~/.local/state}/storm/runs/, named for its run id, keeping the newest 1000 completed ones and every one whose run is still going; the summary names the run id, storm runs show reads the run back, and storm runs logs prints its command's output and its steps' logs. A flag overrides storm.config.ts, found in the working directory or a parent up to the git worktree's root and checked whole, which overrides the built-in default. A secret a resource hands its command, such as a test-data token, shows as <token> in what the run prints and writes.",
4
4
  summary: "Run any command, in a runner sandbox or unsandboxed."
5
5
  };
6
6
  export {
@@ -1,22 +1,22 @@
1
1
  import {
2
2
  defineRunCommand
3
- } from "../../chunks/chunk-IVRRGGCD.js";
4
- import "../../chunks/chunk-HOKDKP5A.js";
5
- import "../../chunks/chunk-YBPTMJUM.js";
3
+ } from "../../chunks/chunk-HP54VHGY.js";
4
+ import "../../chunks/chunk-E3QU74NX.js";
5
+ import "../../chunks/chunk-LUOHJ3LB.js";
6
6
  import "../../chunks/chunk-I5GZLOLQ.js";
7
- import "../../chunks/chunk-27P2QSIM.js";
8
- import "../../chunks/chunk-BFLYGMG3.js";
9
- import "../../chunks/chunk-XPCUINWS.js";
7
+ import "../../chunks/chunk-3HBPNQ4Y.js";
8
+ import "../../chunks/chunk-TVMEKVOW.js";
9
+ import "../../chunks/chunk-HDL4WKIB.js";
10
10
  import {
11
11
  driverNamed
12
- } from "../../chunks/chunk-Z5OXOZD3.js";
12
+ } from "../../chunks/chunk-UUBZTGLV.js";
13
13
  import "../../chunks/chunk-UC6DULWY.js";
14
14
  import "../../chunks/chunk-BRUIATTR.js";
15
15
  import "../../chunks/chunk-NMVODY3P.js";
16
- import "../../chunks/chunk-RKONDLPS.js";
17
- import "../../chunks/chunk-QBR5VHJ7.js";
18
- import "../../chunks/chunk-5TMHYH7G.js";
19
- import "../../chunks/chunk-5ED3IDUJ.js";
16
+ import "../../chunks/chunk-GJOEPJJL.js";
17
+ import "../../chunks/chunk-XZCDA5PE.js";
18
+ import "../../chunks/chunk-VH2POPW5.js";
19
+ import "../../chunks/chunk-I7AN3DIJ.js";
20
20
  import "../../chunks/chunk-RA4L2ACU.js";
21
21
  import "../../chunks/chunk-BW2ADH7U.js";
22
22
  import "../../chunks/chunk-GQIL3AHY.js";
@@ -17,7 +17,7 @@ import {
17
17
  tookText,
18
18
  totalsText,
19
19
  totalsTone
20
- } from "../../../chunks/chunk-ZH5R7W4A.js";
20
+ } from "../../../chunks/chunk-RUPD4TLT.js";
21
21
  import {
22
22
  muted,
23
23
  path,
@@ -27,12 +27,12 @@ import {
27
27
  import "../../../chunks/chunk-NMVODY3P.js";
28
28
  import {
29
29
  pastRuns
30
- } from "../../../chunks/chunk-RKONDLPS.js";
31
- import "../../../chunks/chunk-QBR5VHJ7.js";
32
- import "../../../chunks/chunk-5TMHYH7G.js";
30
+ } from "../../../chunks/chunk-GJOEPJJL.js";
31
+ import "../../../chunks/chunk-XZCDA5PE.js";
32
+ import "../../../chunks/chunk-VH2POPW5.js";
33
33
  import {
34
34
  findConfigFile
35
- } from "../../../chunks/chunk-5ED3IDUJ.js";
35
+ } from "../../../chunks/chunk-I7AN3DIJ.js";
36
36
  import "../../../chunks/chunk-RA4L2ACU.js";
37
37
  import {
38
38
  stormCommands
@@ -7,19 +7,19 @@ import {
7
7
  runsUnreadable,
8
8
  scopeFacts,
9
9
  scopeSchema
10
- } from "../../../chunks/chunk-ZH5R7W4A.js";
10
+ } from "../../../chunks/chunk-RUPD4TLT.js";
11
11
  import {
12
12
  renderOutcome
13
13
  } from "../../../chunks/chunk-T6AZIDZD.js";
14
14
  import "../../../chunks/chunk-NMVODY3P.js";
15
15
  import {
16
16
  pastRuns
17
- } from "../../../chunks/chunk-RKONDLPS.js";
18
- import "../../../chunks/chunk-QBR5VHJ7.js";
19
- import "../../../chunks/chunk-5TMHYH7G.js";
17
+ } from "../../../chunks/chunk-GJOEPJJL.js";
18
+ import "../../../chunks/chunk-XZCDA5PE.js";
19
+ import "../../../chunks/chunk-VH2POPW5.js";
20
20
  import {
21
21
  findConfigFile
22
- } from "../../../chunks/chunk-5ED3IDUJ.js";
22
+ } from "../../../chunks/chunk-I7AN3DIJ.js";
23
23
  import "../../../chunks/chunk-RA4L2ACU.js";
24
24
  import {
25
25
  stormCommands
@@ -20,7 +20,7 @@ import {
20
20
  tookText,
21
21
  totalsText,
22
22
  totalsTone
23
- } from "../../../chunks/chunk-ZH5R7W4A.js";
23
+ } from "../../../chunks/chunk-RUPD4TLT.js";
24
24
  import {
25
25
  bold,
26
26
  capsFor,
@@ -29,11 +29,11 @@ import {
29
29
  import {
30
30
  testPlanText,
31
31
  waterfallLines
32
- } from "../../../chunks/chunk-BFLYGMG3.js";
32
+ } from "../../../chunks/chunk-TVMEKVOW.js";
33
33
  import {
34
34
  builtAtText
35
- } from "../../../chunks/chunk-XPCUINWS.js";
36
- import "../../../chunks/chunk-Z5OXOZD3.js";
35
+ } from "../../../chunks/chunk-HDL4WKIB.js";
36
+ import "../../../chunks/chunk-UUBZTGLV.js";
37
37
  import "../../../chunks/chunk-UC6DULWY.js";
38
38
  import "../../../chunks/chunk-BRUIATTR.js";
39
39
  import "../../../chunks/chunk-NMVODY3P.js";
@@ -41,16 +41,16 @@ import {
41
41
  pastRuns,
42
42
  planSchema,
43
43
  timelineSchema
44
- } from "../../../chunks/chunk-RKONDLPS.js";
44
+ } from "../../../chunks/chunk-GJOEPJJL.js";
45
45
  import {
46
46
  short
47
- } from "../../../chunks/chunk-QBR5VHJ7.js";
47
+ } from "../../../chunks/chunk-XZCDA5PE.js";
48
48
  import {
49
49
  megabytesText
50
- } from "../../../chunks/chunk-5TMHYH7G.js";
50
+ } from "../../../chunks/chunk-VH2POPW5.js";
51
51
  import {
52
52
  findConfigFile
53
- } from "../../../chunks/chunk-5ED3IDUJ.js";
53
+ } from "../../../chunks/chunk-I7AN3DIJ.js";
54
54
  import "../../../chunks/chunk-RA4L2ACU.js";
55
55
  import "../../../chunks/chunk-GQIL3AHY.js";
56
56
  import "../../../chunks/chunk-GSC6SRTW.js";
@@ -9,28 +9,28 @@ import {
9
9
  prepareRefusal,
10
10
  runErrors,
11
11
  runnerFailureFacts
12
- } from "../../../chunks/chunk-YBPTMJUM.js";
12
+ } from "../../../chunks/chunk-LUOHJ3LB.js";
13
13
  import "../../../chunks/chunk-I5GZLOLQ.js";
14
14
  import {
15
15
  redactStrings,
16
16
  redactor
17
- } from "../../../chunks/chunk-27P2QSIM.js";
18
- import "../../../chunks/chunk-BFLYGMG3.js";
19
- import "../../../chunks/chunk-XPCUINWS.js";
17
+ } from "../../../chunks/chunk-3HBPNQ4Y.js";
18
+ import "../../../chunks/chunk-TVMEKVOW.js";
19
+ import "../../../chunks/chunk-HDL4WKIB.js";
20
20
  import {
21
21
  RESOURCES
22
- } from "../../../chunks/chunk-Z5OXOZD3.js";
22
+ } from "../../../chunks/chunk-UUBZTGLV.js";
23
23
  import "../../../chunks/chunk-UC6DULWY.js";
24
24
  import "../../../chunks/chunk-BRUIATTR.js";
25
25
  import "../../../chunks/chunk-NMVODY3P.js";
26
- import "../../../chunks/chunk-RKONDLPS.js";
26
+ import "../../../chunks/chunk-GJOEPJJL.js";
27
27
  import {
28
28
  seconds,
29
29
  short
30
- } from "../../../chunks/chunk-QBR5VHJ7.js";
30
+ } from "../../../chunks/chunk-XZCDA5PE.js";
31
31
  import {
32
32
  megabytesText
33
- } from "../../../chunks/chunk-5TMHYH7G.js";
33
+ } from "../../../chunks/chunk-VH2POPW5.js";
34
34
  import {
35
35
  RUNNER_SECRET_MIN_LENGTH,
36
36
  buildSnapshots,
@@ -42,7 +42,7 @@ import {
42
42
  prepareSnapshotBuild,
43
43
  readRunnerSecrets,
44
44
  requireTarget
45
- } from "../../../chunks/chunk-5ED3IDUJ.js";
45
+ } from "../../../chunks/chunk-I7AN3DIJ.js";
46
46
  import "../../../chunks/chunk-RA4L2ACU.js";
47
47
  import "../../../chunks/chunk-BW2ADH7U.js";
48
48
  import "../../../chunks/chunk-GQIL3AHY.js";
@@ -4,29 +4,29 @@ import {
4
4
  } from "../../../chunks/chunk-T6AZIDZD.js";
5
5
  import {
6
6
  redactor
7
- } from "../../../chunks/chunk-27P2QSIM.js";
7
+ } from "../../../chunks/chunk-3HBPNQ4Y.js";
8
8
  import {
9
9
  REJECTIONS_SHOWN,
10
10
  REJECTION_REASONS,
11
11
  builtAtText,
12
12
  rejectionText
13
- } from "../../../chunks/chunk-XPCUINWS.js";
13
+ } from "../../../chunks/chunk-HDL4WKIB.js";
14
14
  import {
15
15
  RESOURCES
16
- } from "../../../chunks/chunk-Z5OXOZD3.js";
16
+ } from "../../../chunks/chunk-UUBZTGLV.js";
17
17
  import "../../../chunks/chunk-UC6DULWY.js";
18
18
  import "../../../chunks/chunk-BRUIATTR.js";
19
19
  import {
20
20
  short
21
- } from "../../../chunks/chunk-QBR5VHJ7.js";
22
- import "../../../chunks/chunk-5TMHYH7G.js";
21
+ } from "../../../chunks/chunk-XZCDA5PE.js";
22
+ import "../../../chunks/chunk-VH2POPW5.js";
23
23
  import {
24
24
  configErrors,
25
25
  declaredSecretValues,
26
26
  inspectSnapshotCache,
27
27
  invalidConfig,
28
28
  loadSettingsFile
29
- } from "../../../chunks/chunk-5ED3IDUJ.js";
29
+ } from "../../../chunks/chunk-I7AN3DIJ.js";
30
30
  import "../../../chunks/chunk-RA4L2ACU.js";
31
31
  import "../../../chunks/chunk-GQIL3AHY.js";
32
32
  import "../../../chunks/chunk-GSC6SRTW.js";
@@ -1,22 +1,22 @@
1
1
  import {
2
2
  defineRunCommand
3
- } from "../../chunks/chunk-IVRRGGCD.js";
4
- import "../../chunks/chunk-HOKDKP5A.js";
5
- import "../../chunks/chunk-YBPTMJUM.js";
3
+ } from "../../chunks/chunk-HP54VHGY.js";
4
+ import "../../chunks/chunk-E3QU74NX.js";
5
+ import "../../chunks/chunk-LUOHJ3LB.js";
6
6
  import "../../chunks/chunk-I5GZLOLQ.js";
7
- import "../../chunks/chunk-27P2QSIM.js";
8
- import "../../chunks/chunk-BFLYGMG3.js";
9
- import "../../chunks/chunk-XPCUINWS.js";
7
+ import "../../chunks/chunk-3HBPNQ4Y.js";
8
+ import "../../chunks/chunk-TVMEKVOW.js";
9
+ import "../../chunks/chunk-HDL4WKIB.js";
10
10
  import {
11
11
  driverNamed
12
- } from "../../chunks/chunk-Z5OXOZD3.js";
12
+ } from "../../chunks/chunk-UUBZTGLV.js";
13
13
  import "../../chunks/chunk-UC6DULWY.js";
14
14
  import "../../chunks/chunk-BRUIATTR.js";
15
15
  import "../../chunks/chunk-NMVODY3P.js";
16
- import "../../chunks/chunk-RKONDLPS.js";
17
- import "../../chunks/chunk-QBR5VHJ7.js";
18
- import "../../chunks/chunk-5TMHYH7G.js";
19
- import "../../chunks/chunk-5ED3IDUJ.js";
16
+ import "../../chunks/chunk-GJOEPJJL.js";
17
+ import "../../chunks/chunk-XZCDA5PE.js";
18
+ import "../../chunks/chunk-VH2POPW5.js";
19
+ import "../../chunks/chunk-I7AN3DIJ.js";
20
20
  import "../../chunks/chunk-RA4L2ACU.js";
21
21
  import "../../chunks/chunk-BW2ADH7U.js";
22
22
  import "../../chunks/chunk-GQIL3AHY.js";
package/dist/context.d.ts CHANGED
@@ -119,4 +119,5 @@ export declare function localServices(launcher: {
119
119
  */
120
120
  export declare function liveContext(options: {
121
121
  readonly env: Readonly<Record<string, string | undefined>>;
122
+ readonly noColor?: boolean;
122
123
  }): StormContext;
package/dist/context.js CHANGED
@@ -47,7 +47,10 @@ export function liveContext(options) {
47
47
  ? liveRunnerSnapshotCacheGateway({ directory: snapshots.directory })
48
48
  : unavailableRunnerSnapshotCacheGateway(stateDirectoryPattern(RUNNER_SNAPSHOTS_SUBPATH), snapshots.reason),
49
49
  runnerSandboxes: liveRunnerSandboxGateway(),
50
- runnerTerminal: liveRunnerTerminal({ env: options.env }),
50
+ runnerTerminal: liveRunnerTerminal({
51
+ env: options.env,
52
+ ...(options.noColor === undefined ? {} : { noColor: options.noColor }),
53
+ }),
51
54
  runDirectories: runs.ok
52
55
  ? liveRunDirectoryGateway({ directory: runs.directory })
53
56
  : unavailableRunDirectoryGateway(stateDirectoryPattern(RUNS_SUBPATH), runs.reason),
@@ -1,3 +1,4 @@
1
+ import type { RunnerTerminalColor } from "../runner/index.ts";
1
2
  import { type RunPayloadInstance, type RunPayloadJson } from "../sdk/run/launcher.ts";
2
3
  /**
3
4
  * The run payload for a run with `resources`, what each acquired resource instance hands the command, under its
@@ -19,7 +20,8 @@ export declare function runPayload<R extends {
19
20
  export declare function commandEnvironment(env: Readonly<Record<string, string | undefined>>, payload: RunPayloadJson): Readonly<Record<string, string>>;
20
21
  /**
21
22
  * `env` with color set for a spawned command whose stdout and stderr are pipes, so it can't tell whether a
22
- * terminal shows color: `FORCE_COLOR=1` when the terminal storm writes its output to shows color, else `NO_COLOR=1`. An
23
- * `env` that sets either already is left as it is.
23
+ * terminal shows color: `FORCE_COLOR=1` when the launcher terminal asks for color (`"on"`), `NO_COLOR=1` when the
24
+ * launcher explicitly opted out (`"off"`), and neither on a plain non-TTY launcher (`"auto"`). An `env` that sets
25
+ * either already is left as it is.
24
26
  */
25
- export declare function colorEnvironment(env: Readonly<Record<string, string | undefined>>, color: boolean): Readonly<Record<string, string | undefined>>;
27
+ export declare function colorEnvironment(env: Readonly<Record<string, string | undefined>>, color: RunnerTerminalColor): Readonly<Record<string, string | undefined>>;
@@ -24,11 +24,16 @@ export function commandEnvironment(env, payload) {
24
24
  }
25
25
  /**
26
26
  * `env` with color set for a spawned command whose stdout and stderr are pipes, so it can't tell whether a
27
- * terminal shows color: `FORCE_COLOR=1` when the terminal storm writes its output to shows color, else `NO_COLOR=1`. An
28
- * `env` that sets either already is left as it is.
27
+ * terminal shows color: `FORCE_COLOR=1` when the launcher terminal asks for color (`"on"`), `NO_COLOR=1` when the
28
+ * launcher explicitly opted out (`"off"`), and neither on a plain non-TTY launcher (`"auto"`). An `env` that sets
29
+ * either already is left as it is.
29
30
  */
30
31
  export function colorEnvironment(env, color) {
31
32
  if (env["FORCE_COLOR"] !== undefined || env["NO_COLOR"] !== undefined)
32
33
  return env;
33
- return { ...env, ...(color ? { FORCE_COLOR: "1" } : { NO_COLOR: "1" }) };
34
+ if (color === "on")
35
+ return { ...env, FORCE_COLOR: "1" };
36
+ if (color === "off")
37
+ return { ...env, NO_COLOR: "1" };
38
+ return env;
34
39
  }
@@ -24,7 +24,7 @@ import {
24
24
  configErrors,
25
25
  credentialErrors,
26
26
  credentialSourceErrors
27
- } from "../../../../../chunks/chunk-5ED3IDUJ.js";
27
+ } from "../../../../../chunks/chunk-I7AN3DIJ.js";
28
28
  import "../../../../../chunks/chunk-RA4L2ACU.js";
29
29
  import {
30
30
  testserverCommands
@@ -6,4 +6,6 @@ export interface StormBuild {
6
6
  readonly commit: string | null;
7
7
  }
8
8
  /** The live app over the resolved host, whose commands record their status in `exit`, which the executable reads. */
9
- export declare function liveStormApp(host: NodeHost, build: StormBuild, exit: StormExit): StormApp;
9
+ export declare function liveStormApp(host: NodeHost, build: StormBuild, exit: StormExit, options?: {
10
+ readonly noColor?: boolean;
11
+ }): StormApp;
package/dist/live-app.js CHANGED
@@ -7,8 +7,11 @@ import { resolvePresentation } from "./presentation.js";
7
7
  import { liveDriverContexts, liveResourceContexts, RESOURCES } from "./extensions.js";
8
8
  import { localUserName } from "./runner/index.js";
9
9
  /** The live app over the resolved host, whose commands record their status in `exit`, which the executable reads. */
10
- export function liveStormApp(host, build, exit) {
11
- const context = liveContext({ env: host.env });
10
+ export function liveStormApp(host, build, exit, options = {}) {
11
+ const context = liveContext({
12
+ env: host.env,
13
+ ...(options.noColor === undefined ? {} : { noColor: options.noColor }),
14
+ });
12
15
  return {
13
16
  context,
14
17
  resourceContexts: liveResourceContexts(host.env),
@@ -353,12 +353,20 @@ export interface RunnerSandboxGateway {
353
353
  /** Deletes a sandbox, keeping every snapshot it was started from or saved as. */
354
354
  delete(sandbox: RunnerSandbox): Promise<RunnerSandboxOperation>;
355
355
  }
356
+ /**
357
+ * What color environment variable the launcher terminal asks the command to receive when the command's own
358
+ * environment sets neither `FORCE_COLOR` nor `NO_COLOR`:
359
+ * - `"on"`: set `FORCE_COLOR=1` (stdout is a TTY, or launcher `FORCE_COLOR` turns color on).
360
+ * - `"off"`: set `NO_COLOR=1` (`--no-color` was passed, or launcher `NO_COLOR` is set and non-empty).
361
+ * - `"auto"`: set neither (non-TTY launcher with no explicit color setting, or `FORCE_COLOR` set to `0` or `false`).
362
+ */
363
+ export type RunnerTerminalColor = "on" | "off" | "auto";
356
364
  /**
357
365
  * The terminal the command's output reaches, wherever the command runs, a DI seam: stdout and stderr, and whether the
358
- * terminal shows color. Writes never throw.
366
+ * launcher terminal asks the command for color. Writes never throw.
359
367
  */
360
368
  export interface RunnerTerminal {
361
- readonly color: boolean;
369
+ readonly color: RunnerTerminalColor;
362
370
  writeStdout(text: string): void;
363
371
  writeStderr(text: string): void;
364
372
  }
@@ -1,7 +1,7 @@
1
1
  export type { RunnerContext } from "./context.ts";
2
2
  export { buildSnapshots, prepareSnapshotBuild, type PrepareSnapshotBuildOutcome, type SnapshotBuildOutcome, } from "./build-snapshots.ts";
3
3
  export { type KeptSandbox, type RunnerEvent, type RunnerFailure, type RunnerProgress, type RunnerStepPhase, type SnapshotBuildReason, } from "./events.ts";
4
- export type { CheckoutFailure, CheckoutGateway, RunnerSandboxGateway, RunnerSnapshotCacheFailure, RunnerSnapshotCacheGateway, RunnerSnapshotEntry, RunnerTerminal, } from "./gateways.ts";
4
+ export type { CheckoutFailure, CheckoutGateway, RunnerSandboxGateway, RunnerSnapshotCacheFailure, RunnerSnapshotCacheGateway, RunnerSnapshotEntry, RunnerTerminal, RunnerTerminalColor, } from "./gateways.ts";
5
5
  export { liveCheckoutGateway } from "./live/checkout-gateway.ts";
6
6
  export { liveRunnerSandboxGateway } from "./live/sandbox-gateway.ts";
7
7
  export { liveRunnerTerminal } from "./live/terminal.ts";
@@ -15,6 +15,20 @@ export const KILL_GRACE_MS = 5_000;
15
15
  const STDERR_MESSAGE_CHARS = 1000;
16
16
  /** The Sandbox API's answer when a snapshot to start from has expired or been deleted. */
17
17
  const SNAPSHOT_GONE_STATUS = 410;
18
+ /**
19
+ * `setpriv` flags used to drop every Linux capability and block privilege escalation before `execve` of the user
20
+ * command. Vercel Sandbox's default `vercel-sandbox` user (uid 1000) holds full capabilities (`CAP_DAC_OVERRIDE`,
21
+ * `CAP_DAC_READ_SEARCH`, etc.), which causes filesystem permission tests (`chmod 0500` / `0444`) to pass writes
22
+ * instead of failing with `EACCES`. Only `runCommand` uses this; `runScript` keeps capabilities so toolchain steps
23
+ * can run `sudo dnf install`.
24
+ */
25
+ const DROP_CAPABILITIES_ARGS = [
26
+ "--inh-caps=-all",
27
+ "--ambient-caps=-all",
28
+ "--bounding-set=-all",
29
+ "--no-new-privs",
30
+ "--",
31
+ ];
18
32
  /** Vercel Sandbox through `@vercel/sandbox`. */
19
33
  export function liveRunnerSandboxGateway() {
20
34
  let loading;
@@ -125,8 +139,8 @@ export function liveRunnerSandboxGateway() {
125
139
  if (kill.aborted)
126
140
  return { ok: false, failure: { kind: "aborted" } };
127
141
  const command = await startDetached(holder, {
128
- cmd,
129
- args: [...request.args],
142
+ cmd: "setpriv",
143
+ args: [...DROP_CAPABILITIES_ARGS, cmd, ...request.args],
130
144
  cwd: request.cwd,
131
145
  env: { ...request.env },
132
146
  });
@@ -1,4 +1,4 @@
1
- import type { RunnerTerminal } from "../gateways.ts";
1
+ import type { RunnerTerminal, RunnerTerminalColor } from "../gateways.ts";
2
2
  /** The part of a writable stream the terminal uses: `process.stdout` and `process.stderr` have it. */
3
3
  export interface TerminalStream {
4
4
  readonly isTTY?: boolean;
@@ -6,11 +6,23 @@ export interface TerminalStream {
6
6
  on(event: "error", listener: (error: Error) => void): unknown;
7
7
  }
8
8
  /**
9
- * A terminal over `stdout` and `stderr`, by default this process's. It shows color when stdout is a TTY and the
10
- * launcher environment doesn't set `NO_COLOR`.
9
+ * Resolves the color policy for a command launched from this terminal:
10
+ * - `"off"` when `--no-color` was passed or launcher `NO_COLOR` is set and non-empty.
11
+ * - `"on"` when launcher `FORCE_COLOR` is set to a non-empty value other than `"0"` or `"false"`, or `stdout` is a TTY and `TERM` isn't `"dumb"`.
12
+ * - `"auto"` otherwise, so a non-TTY or `TERM=dumb` launcher with no explicit color opt-out sets neither `FORCE_COLOR` nor `NO_COLOR`.
13
+ */
14
+ export declare function resolveRunnerTerminalColor(options: {
15
+ readonly isTTY: boolean;
16
+ readonly env: Readonly<Record<string, string | undefined>>;
17
+ readonly noColor?: boolean;
18
+ }): RunnerTerminalColor;
19
+ /**
20
+ * A terminal over `stdout` and `stderr`, by default this process's. Its `color` reflects explicit `--no-color` /
21
+ * `NO_COLOR`, explicit `FORCE_COLOR`, or an interactive TTY stdout, and stays `"auto"` on a plain non-TTY launcher.
11
22
  */
12
23
  export declare function liveRunnerTerminal(options: {
13
24
  readonly env: Readonly<Record<string, string | undefined>>;
25
+ readonly noColor?: boolean;
14
26
  readonly stdout?: TerminalStream;
15
27
  readonly stderr?: TerminalStream;
16
28
  }): RunnerTerminal;
@@ -2,8 +2,26 @@
2
2
  // EPIPE after SIGHUP closes the terminal, it stops writing, so a closed terminal can't crash storm before it
3
3
  // cleans up its sandboxes.
4
4
  /**
5
- * A terminal over `stdout` and `stderr`, by default this process's. It shows color when stdout is a TTY and the
6
- * launcher environment doesn't set `NO_COLOR`.
5
+ * Resolves the color policy for a command launched from this terminal:
6
+ * - `"off"` when `--no-color` was passed or launcher `NO_COLOR` is set and non-empty.
7
+ * - `"on"` when launcher `FORCE_COLOR` is set to a non-empty value other than `"0"` or `"false"`, or `stdout` is a TTY and `TERM` isn't `"dumb"`.
8
+ * - `"auto"` otherwise, so a non-TTY or `TERM=dumb` launcher with no explicit color opt-out sets neither `FORCE_COLOR` nor `NO_COLOR`.
9
+ */
10
+ export function resolveRunnerTerminalColor(options) {
11
+ if (options.noColor === true)
12
+ return "off";
13
+ const noColor = options.env["NO_COLOR"];
14
+ if (noColor !== undefined && noColor !== "")
15
+ return "off";
16
+ const forced = options.env["FORCE_COLOR"];
17
+ if (forced !== undefined && forced !== "") {
18
+ return forced === "0" || forced === "false" ? "auto" : "on";
19
+ }
20
+ return options.isTTY && options.env["TERM"] !== "dumb" ? "on" : "auto";
21
+ }
22
+ /**
23
+ * A terminal over `stdout` and `stderr`, by default this process's. Its `color` reflects explicit `--no-color` /
24
+ * `NO_COLOR`, explicit `FORCE_COLOR`, or an interactive TTY stdout, and stays `"auto"` on a plain non-TTY launcher.
7
25
  */
8
26
  export function liveRunnerTerminal(options) {
9
27
  const stdout = options.stdout ?? process.stdout;
@@ -30,7 +48,11 @@ export function liveRunnerTerminal(options) {
30
48
  }
31
49
  };
32
50
  return {
33
- color: stdout.isTTY === true && options.env["NO_COLOR"] === undefined,
51
+ color: resolveRunnerTerminalColor({
52
+ isTTY: stdout.isTTY === true,
53
+ env: options.env,
54
+ ...(options.noColor === undefined ? {} : { noColor: options.noColor }),
55
+ }),
34
56
  writeStdout: (text) => write(stdout, text),
35
57
  writeStderr: (text) => write(stderr, text),
36
58
  };
@@ -54,8 +54,9 @@ export interface RunnerRecipe<Run = never> {
54
54
  readonly vcpus: number | ((run: Run) => number);
55
55
  /**
56
56
  * Extra environment variables for the command. It can't set `STORM_RUN`. When it sets neither `FORCE_COLOR` nor
57
- * `NO_COLOR`, storm sets `FORCE_COLOR=1` when the local terminal shows color, else `NO_COLOR=1`; when it sets
58
- * either, storm sets neither, so `{ FORCE_COLOR: "1" }` gets color and no `NO_COLOR`.
57
+ * `NO_COLOR`, storm sets `FORCE_COLOR=1` when the local terminal asks for color (a TTY or `FORCE_COLOR`),
58
+ * `NO_COLOR=1` when the launcher explicitly opted out (`--no-color` or a non-empty `NO_COLOR`), and neither on a
59
+ * plain non-TTY launcher; when the recipe sets either, storm sets neither.
59
60
  */
60
61
  readonly env?: Readonly<Record<string, string>>;
61
62
  /**
@@ -1,6 +1,6 @@
1
1
  import type { Clock } from "../time/index.ts";
2
2
  import type { RunnerFailure, RunnerProgress } from "./events.ts";
3
- import type { RunnerSandboxGateway, RunnerTerminal } from "./gateways.ts";
3
+ import type { RunnerSandboxGateway, RunnerTerminal, RunnerTerminalColor } from "./gateways.ts";
4
4
  import type { ReadyRunner } from "./ready.ts";
5
5
  /**
6
6
  * The command as the runner sandbox runs it: each `<repoRoot>/` in its arguments, the executable's included, points
@@ -18,14 +18,14 @@ export declare function sandboxedCommand(request: {
18
18
  * What the command's environment adds to the runner sandbox's own: `PATH` with the sandbox `cwd`'s and the
19
19
  * repository's `node_modules/.bin` before the login shell's, no update checks, the recipe's `env`, and `STORM_RUN`
20
20
  * last, so nothing overrides it. When the recipe's `env` sets neither `FORCE_COLOR` nor `NO_COLOR`, it also gets
21
- * `FORCE_COLOR=1` when the local terminal shows color, else `NO_COLOR=1`, as a run with no runner does
22
- * (`colorEnvironment` in `core/payload.ts`); a recipe that sets either gets neither from storm. Nothing comes from
23
- * the local environment.
21
+ * `FORCE_COLOR=1` when the local terminal asks for color (`"on"`), `NO_COLOR=1` when the launcher explicitly opted out
22
+ * (`"off"`), and neither on a plain non-TTY launcher (`"auto"`), as a run with no runner does (`colorEnvironment` in
23
+ * `core/payload.ts`); a recipe that sets either gets neither from storm. Nothing else comes from the local environment.
24
24
  */
25
25
  export declare function sandboxEnvironment(request: {
26
26
  readonly cwd: string;
27
27
  readonly loginPath: string;
28
- readonly color: boolean;
28
+ readonly color: RunnerTerminalColor;
29
29
  readonly env: Readonly<Record<string, string>>;
30
30
  readonly runPayload: string;
31
31
  }): Record<string, string>;
@@ -18,9 +18,9 @@ export function sandboxedCommand(request) {
18
18
  * What the command's environment adds to the runner sandbox's own: `PATH` with the sandbox `cwd`'s and the
19
19
  * repository's `node_modules/.bin` before the login shell's, no update checks, the recipe's `env`, and `STORM_RUN`
20
20
  * last, so nothing overrides it. When the recipe's `env` sets neither `FORCE_COLOR` nor `NO_COLOR`, it also gets
21
- * `FORCE_COLOR=1` when the local terminal shows color, else `NO_COLOR=1`, as a run with no runner does
22
- * (`colorEnvironment` in `core/payload.ts`); a recipe that sets either gets neither from storm. Nothing comes from
23
- * the local environment.
21
+ * `FORCE_COLOR=1` when the local terminal asks for color (`"on"`), `NO_COLOR=1` when the launcher explicitly opted out
22
+ * (`"off"`), and neither on a plain non-TTY launcher (`"auto"`), as a run with no runner does (`colorEnvironment` in
23
+ * `core/payload.ts`); a recipe that sets either gets neither from storm. Nothing else comes from the local environment.
24
24
  */
25
25
  export function sandboxEnvironment(request) {
26
26
  const bins = [
@@ -31,9 +31,11 @@ export function sandboxEnvironment(request) {
31
31
  NO_UPDATE_NOTIFIER: "1",
32
32
  ...(request.env["FORCE_COLOR"] !== undefined || request.env["NO_COLOR"] !== undefined
33
33
  ? {}
34
- : request.color
34
+ : request.color === "on"
35
35
  ? { FORCE_COLOR: "1" }
36
- : { NO_COLOR: "1" }),
36
+ : request.color === "off"
37
+ ? { NO_COLOR: "1" }
38
+ : {}),
37
39
  ...request.env,
38
40
  [RUN_PAYLOAD_VARIABLE]: request.runPayload,
39
41
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cnc-tools/storm",
3
- "version": "0.14.1",
3
+ "version": "0.14.2",
4
4
  "description": "A test orchestrator: run your tests in the inner loop of development, in the cloud, in a test environment that you define",
5
5
  "repository": {
6
6
  "type": "git",