@fluidgrids/cli 2026.1115.6 → 2026.1116.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 (3) hide show
  1. package/README.md +10 -2
  2. package/dist/cli.js +58 -21
  3. package/package.json +2 -2
package/README.md CHANGED
@@ -485,7 +485,8 @@ fluidgrids import export.json --from n8n --key my-flow --allow-missing-nodes
485
485
 
486
486
  # The replay debugger (local code needs no flag; --remote-code needs durable functions)
487
487
  fluidgrids replay histories/run.history.json --trace
488
- fluidgrids replay <runId> --trace --remote-code # the exact code that ran (DD8)
488
+ fluidgrids replay <runId> --trace --remote-code # the exact code that ran (DD8); asks first
489
+ fluidgrids replay <runId> --remote-code --yes --output json # scripts: no prompt, warning in the envelope
489
490
  fluidgrids replay <runId> --inspect # node --inspect-brk, stops at the mismatch
490
491
 
491
492
  # One node operation as a durable activity (fluidgrids.standalone-activities)
@@ -518,7 +519,14 @@ fluidgrids activity start internal:http request --args '{"url":"https://example.
518
519
  archive and refuses unless the `buildId` is the run's and this CLI bundles
519
520
  the `@fluidgrids/workflows` version that built it. The replay runs that code
520
521
  on your machine in a Node `vm`, which is not a sandbox (the managed workers
521
- use the QuickJS isolate), so debug only code from people you trust.
522
+ use the QuickJS isolate): the code can reach your process, files and
523
+ credentials, so debug only code from people you trust. Any workspace member
524
+ may have pushed that version, so `--remote-code` asks `Run the stored code of
525
+ <key> <version> on this machine? [y/N]` before it downloads anything, and
526
+ stops unless you answer yes. Without a terminal, and always with `--output
527
+ json`, it refuses unless you pass `--yes`. The warning goes to stderr and,
528
+ with `--output json`, is also a `debug.untrustedCode` warning in the
529
+ envelope. With `--inspect` it asks before starting the debuggee.
522
530
  - `activity start` (also `activities start`) takes literal arguments; routing
523
531
  nodes such as `internal:if` are refused. A repeated `--idempotency-key` (1 to
524
532
  128 letters, digits, `.`, `_`, `:` or `-`) from the same caller returns the
package/dist/cli.js CHANGED
@@ -4797,6 +4797,19 @@ var init_n8n_import = __esm(() => {
4797
4797
  IMPORT_SOURCES = ["n8n"];
4798
4798
  });
4799
4799
 
4800
+ // src/output/confirm.ts
4801
+ import { createInterface } from "readline/promises";
4802
+ async function confirmOnTerminal(question) {
4803
+ const rl = createInterface({ input: process.stdin, output: process.stderr });
4804
+ try {
4805
+ const answer = await rl.question(`${question} [y/N] `);
4806
+ return /^y(es)?$/i.test(answer.trim());
4807
+ } finally {
4808
+ rl.close();
4809
+ }
4810
+ }
4811
+ var init_confirm = () => {};
4812
+
4800
4813
  // src/phase-d/operations.ts
4801
4814
  var FIDELITY_FIELDS = "level items { kind nodeId path detail }", GENERATION_FIELDS = `
4802
4815
  id status message attempts prompt template modelUsed createdAt updatedAt
@@ -4950,7 +4963,7 @@ var init_api2 = __esm(() => {
4950
4963
  import { isAbsolute as isAbsolute2 } from "path";
4951
4964
  import { CliUserError as CliUserError26 } from "@burdenoff/cli-sdk/core";
4952
4965
  function phaseDEnv(env) {
4953
- return { ...env, pd: createPhaseDApi(env.ctx) };
4966
+ return { ...env, pd: createPhaseDApi(env.ctx), confirm: confirmOnTerminal };
4954
4967
  }
4955
4968
  function safeRelativePath2(raw, what) {
4956
4969
  const bad = raw === "" || raw.length > 512 || isAbsolute2(raw) || raw.startsWith("/") || /^[A-Za-z]:/.test(raw) || raw.includes("\\") || [...raw].some((char) => char.charCodeAt(0) < 32 || char.charCodeAt(0) === 127) || raw.split("/").some((segment) => segment === "" || segment === "." || segment === "..");
@@ -4974,6 +4987,7 @@ function parseJsonObjectArg(raw, flag, readFile) {
4974
4987
  return parsed;
4975
4988
  }
4976
4989
  var init_shared2 = __esm(() => {
4990
+ init_confirm();
4977
4991
  init_api2();
4978
4992
  });
4979
4993
 
@@ -5803,7 +5817,7 @@ var init_parity = __esm(() => {
5803
5817
  // src/code-first/commands/runs.ts
5804
5818
  import { writeFileSync as writeFileSync6 } from "fs";
5805
5819
  import { resolve as resolve7 } from "path";
5806
- import { createInterface } from "readline/promises";
5820
+ import { createInterface as createInterface2 } from "readline/promises";
5807
5821
  import { CliUserError as CliUserError31 } from "@burdenoff/cli-sdk/core";
5808
5822
  import { serializeHistoryFile as serializeHistoryFile2 } from "@fluidgrids/workflows/history";
5809
5823
  function parityRows(run) {
@@ -6094,7 +6108,7 @@ async function runSignal(env, first, second, options) {
6094
6108
  return result;
6095
6109
  }
6096
6110
  async function confirm(question) {
6097
- const rl = createInterface({ input: process.stdin, output: process.stderr });
6111
+ const rl = createInterface2({ input: process.stdin, output: process.stderr });
6098
6112
  try {
6099
6113
  const answer = await rl.question(`${question} [y/N] `);
6100
6114
  return /^y(es)?$/i.test(answer.trim());
@@ -6850,6 +6864,27 @@ function inspectMatches(raw, address) {
6850
6864
  return false;
6851
6865
  }
6852
6866
  }
6867
+ function remoteCodeWarning(what) {
6868
+ return `Replaying the stored code of ${what} on this machine: a Node vm is not a sandbox, so the code can reach this process, your files and your credentials. Only debug code from people you trust.`;
6869
+ }
6870
+ async function confirmRemoteCode(env, options, what) {
6871
+ const warning = remoteCodeWarning(what);
6872
+ console.error(warning);
6873
+ reportDiagnostics(env.ctx.output, [
6874
+ diagnostic({ severity: "warning", code: "debug.untrustedCode", message: warning })
6875
+ ]);
6876
+ if (options.yes === true)
6877
+ return;
6878
+ const question = `Run the stored code of ${what} on this machine?`;
6879
+ if (isEnvelopeOutput(env.ctx.output) || !env.interactive()) {
6880
+ throw new CliUserError34(`${question} This needs confirmation.`, {
6881
+ hint: "Pass --yes to replay it without a prompt, once you trust whoever pushed that version."
6882
+ });
6883
+ }
6884
+ if (!await env.confirm(question)) {
6885
+ throw new CliUserError34("Aborted: the stored code was not downloaded or run.");
6886
+ }
6887
+ }
6853
6888
  async function reexecUnderInspector(env, options, facts) {
6854
6889
  const address = inspectAddress(options.inspect ?? true);
6855
6890
  if (!facts.node) {
@@ -6860,8 +6895,19 @@ async function reexecUnderInspector(env, options, facts) {
6860
6895
  const script = facts.argv[1];
6861
6896
  if (script === undefined)
6862
6897
  throw new CliUserError34("--inspect: the CLI script path is unknown.");
6898
+ const args = childArgs(facts.argv, address);
6899
+ if (options.remoteCode === true) {
6900
+ await confirmRemoteCode(env, options, "the run");
6901
+ if (!args.includes("--yes")) {
6902
+ const end = args.indexOf("--");
6903
+ if (end < 0)
6904
+ args.push("--yes");
6905
+ else
6906
+ args.splice(end, 0, "--yes");
6907
+ }
6908
+ }
6863
6909
  console.error(`Debugger listening on ${address}; attach to continue (the replay stops at the mismatch).`);
6864
- const status = await env.exec(facts.execPath, [`--inspect-brk=${address}`, script, ...childArgs(facts.argv, address)], env.cwd(), { stdout: "inherit" });
6910
+ const status = await env.exec(facts.execPath, [`--inspect-brk=${address}`, script, ...args], env.cwd(), { stdout: "inherit" });
6865
6911
  throw new DelegatedExit(status);
6866
6912
  }
6867
6913
  async function loadHistory(env, target) {
@@ -6873,7 +6919,7 @@ async function loadHistory(env, target) {
6873
6919
  throw new CliUserError34(`History file not found: ${target}`);
6874
6920
  return { file: (await fetchHistory(env, target)).file, name: target };
6875
6921
  }
6876
- async function remoteScript(env, file, name) {
6922
+ async function remoteScript(env, options, file, name) {
6877
6923
  const key = file.info?.workflowKey;
6878
6924
  const version = file.info?.version;
6879
6925
  const buildId = file.info?.buildId;
@@ -6893,7 +6939,7 @@ async function remoteScript(env, file, name) {
6893
6939
  });
6894
6940
  }
6895
6941
  presignedUrl(archive.url, "source archive");
6896
- console.error(`Replaying the stored code of ${key} ${String(version)} on this machine: a Node vm is not a sandbox, so only debug code from people you trust.`);
6942
+ await confirmRemoteCode(env, options, `${key} ${String(version)}`);
6897
6943
  let response;
6898
6944
  try {
6899
6945
  response = await env.fetch(archive.url, { method: "GET" });
@@ -6983,9 +7029,9 @@ async function runDebugReplay(env, target, options, facts = currentProcess()) {
6983
7029
  throw new CliUserError34(`${name} is marked "replay": false (it uses Phase C features).`);
6984
7030
  }
6985
7031
  const remote = options.remoteCode === true;
6986
- const script = remote ? await remoteScript(env, file, name) : await localScript(env, options, file, name);
7032
+ const script = remote ? await remoteScript(env, options, file, name) : await localScript(env, options, file, name);
6987
7033
  const breakOnMismatch = options.breakOnMismatch === true;
6988
- const trace = await traceReplay(script.script, replayRequest2(file.workflowFn, file.events, file.info ?? {}, file.nowMs), breakOnMismatch ? { breakOnMismatch: true, onBreak: breakAtMismatch } : {});
7034
+ const trace = await traceReplay(script.script, replayRequest2(file.workflowFn, file.events, file.info ?? {}, file.nowMs), breakOnMismatch ? { trustedCode: true, breakOnMismatch: true, onBreak: breakAtMismatch } : { trustedCode: true });
6989
7035
  const runBuildId = file.info?.buildId ?? null;
6990
7036
  const result = {
6991
7037
  name,
@@ -7339,7 +7385,7 @@ var init_suite = __esm(() => {
7339
7385
  });
7340
7386
 
7341
7387
  // src/code-first/commands/versions.ts
7342
- import { createInterface as createInterface2 } from "readline/promises";
7388
+ import { createInterface as createInterface3 } from "readline/promises";
7343
7389
  import { CliUserError as CliUserError36 } from "@burdenoff/cli-sdk/core";
7344
7390
  async function runVersionsList(env, workflowKey, options) {
7345
7391
  const versions = sortVersions(await env.api.workflowVersions(workflowKey));
@@ -7426,7 +7472,7 @@ function rolloutDeleteOptions(options, parent) {
7426
7472
  return { ...options, environment: inherited };
7427
7473
  }
7428
7474
  async function confirm2(question) {
7429
- const rl = createInterface2({ input: process.stdin, output: process.stderr });
7475
+ const rl = createInterface3({ input: process.stdin, output: process.stderr });
7430
7476
  try {
7431
7477
  const answer = await rl.question(`${question} [y/N] `);
7432
7478
  return /^y(es)?$/i.test(answer.trim());
@@ -9160,17 +9206,7 @@ except BridgeClosedError as error:
9160
9206
  });
9161
9207
 
9162
9208
  // src/phase-c/shared.ts
9163
- import { createInterface as createInterface3 } from "readline/promises";
9164
9209
  import { CliUserError as CliUserError42 } from "@burdenoff/cli-sdk/core";
9165
- async function confirmOnTerminal(question) {
9166
- const rl = createInterface3({ input: process.stdin, output: process.stderr });
9167
- try {
9168
- const answer = await rl.question(`${question} [y/N] `);
9169
- return /^y(es)?$/i.test(answer.trim());
9170
- } finally {
9171
- rl.close();
9172
- }
9173
- }
9174
9210
  function phaseCEnv(env) {
9175
9211
  return {
9176
9212
  ...env,
@@ -9284,6 +9320,7 @@ function parseInstant(raw, flag) {
9284
9320
  return new Date(ms).toISOString();
9285
9321
  }
9286
9322
  var init_shared3 = __esm(() => {
9323
+ init_confirm();
9287
9324
  init_api3();
9288
9325
  });
9289
9326
 
@@ -11373,7 +11410,7 @@ function registerDurable(program, env) {
11373
11410
  });
11374
11411
  addHistory(program, env, "history");
11375
11412
  addSignal(program, env, "signal");
11376
- program.command("replay <history>").description("Replay a history file, a run archive's history.jsonl.gz or a run id against the local code; fails on non-determinism").option("--isolate", "Replay in the QuickJS isolate the managed workers use").option("--debug", "Print the full task result (commands, logs, stack)").option("--trace", "Print every step: the command, the recorded event and the source line").option("--break-on-mismatch", "Stop in an attached debugger where the code diverges").option("--inspect [address]", "Re-run under node --inspect-brk (loopback host:port, default 127.0.0.1:9229); implies --break-on-mismatch").option("--remote-code", "Rebuild the run's exact code from its source archive instead of the local project").option(...PROJECT_OPTION).option(...OUTPUT_OPTION).action(async (history, options, command) => {
11413
+ program.command("replay <history>").description("Replay a history file, a run archive's history.jsonl.gz or a run id against the local code; fails on non-determinism").option("--isolate", "Replay in the QuickJS isolate the managed workers use").option("--debug", "Print the full task result (commands, logs, stack)").option("--trace", "Print every step: the command, the recorded event and the source line").option("--break-on-mismatch", "Stop in an attached debugger where the code diverges").option("--inspect [address]", "Re-run under node --inspect-brk (loopback host:port, default 127.0.0.1:9229); implies --break-on-mismatch").option("--remote-code", "Rebuild the run's exact code from its source archive instead of the local project (asks first: it runs that code here)").option("--yes", "With --remote-code: run the stored code without asking (for scripts)").option(...PROJECT_OPTION).option(...OUTPUT_OPTION).action(async (history, options, command) => {
11377
11414
  const resolved = withGlobalFormat(options, command);
11378
11415
  if (resolved.trace || resolved.breakOnMismatch || resolved.inspect !== undefined || resolved.remoteCode) {
11379
11416
  await Promise.resolve().then(() => init_replay_debug());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluidgrids/cli",
3
- "version": "2026.1115.6",
3
+ "version": "2026.1116.1",
4
4
  "description": "CLI tool for FluidGrids — workflow automation management (thin shell over @burdenoff/cli-sdk)",
5
5
  "type": "module",
6
6
  "private": false,
@@ -55,7 +55,7 @@
55
55
  },
56
56
  "dependencies": {
57
57
  "@burdenoff/cli-sdk": "2026.1109.1",
58
- "@fluidgrids/workflows": "2026.1115.3",
58
+ "@fluidgrids/workflows": "2026.1116.1",
59
59
  "@napi-rs/keyring": "2.1.1",
60
60
  "commander": "^14.0.3",
61
61
  "esbuild": "0.28.2",