sim 2.1.6-preview.90.1 → 2.1.7-preview.92.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 (2) hide show
  1. package/dist/index.js +225 -230
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -19,13 +19,15 @@ var __toESM = (mod, isNodeMode, target) => {
19
19
  return cached;
20
20
  }
21
21
  target = mod != null ? __create(__getProtoOf(mod)) : {};
22
- const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
23
- for (let key of __getOwnPropNames(mod))
24
- if (!__hasOwnProp.call(to, key))
25
- __defProp(to, key, {
26
- get: __accessProp.bind(mod, key),
27
- enumerable: true
28
- });
22
+ const to = isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
23
+ if (mod && typeof mod === "object" || typeof mod === "function") {
24
+ for (let key of __getOwnPropNames(mod))
25
+ if (!__hasOwnProp.call(to, key))
26
+ __defProp(to, key, {
27
+ get: __accessProp.bind(mod, key),
28
+ enumerable: true
29
+ });
30
+ }
29
31
  if (canCache)
30
32
  cache.set(mod, to);
31
33
  return to;
@@ -34,7 +36,7 @@ var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports,
34
36
  var __require = /* @__PURE__ */ createRequire(import.meta.url);
35
37
 
36
38
  // ../../node_modules/commander/lib/error.js
37
- var require_error = __commonJS((exports) => {
39
+ var require_error = __commonJS(function(exports) {
38
40
  class CommanderError extends Error {
39
41
  constructor(exitCode, code, message) {
40
42
  super(message);
@@ -58,7 +60,7 @@ var require_error = __commonJS((exports) => {
58
60
  });
59
61
 
60
62
  // ../../node_modules/commander/lib/argument.js
61
- var require_argument = __commonJS((exports) => {
63
+ var require_argument = __commonJS(function(exports) {
62
64
  var { InvalidArgumentError } = require_error();
63
65
 
64
66
  class Argument {
@@ -137,7 +139,7 @@ var require_argument = __commonJS((exports) => {
137
139
  });
138
140
 
139
141
  // ../../node_modules/commander/lib/help.js
140
- var require_help = __commonJS((exports) => {
142
+ var require_help = __commonJS(function(exports) {
141
143
  var { humanReadableArgName } = require_argument();
142
144
 
143
145
  class Help {
@@ -148,7 +150,7 @@ var require_help = __commonJS((exports) => {
148
150
  this.showGlobalOptions = false;
149
151
  }
150
152
  visibleCommands(cmd) {
151
- const visibleCommands = cmd.commands.filter((cmd2) => !cmd2._hidden);
153
+ const visibleCommands = cmd.commands.filter((cmd) => !cmd._hidden);
152
154
  if (cmd._hasImplicitHelpCommand()) {
153
155
  const [, helpName, helpArgs] = cmd._helpCommandnameAndArgs.match(/([^ ]+) *(.*)/);
154
156
  const helpCommand = cmd.createCommand(helpName).helpOption(false);
@@ -341,8 +343,8 @@ var require_help = __commonJS((exports) => {
341
343
  output = output.concat(["Global Options:", formatList(globalOptionList), ""]);
342
344
  }
343
345
  }
344
- const commandList = helper.visibleCommands(cmd).map((cmd2) => {
345
- return formatItem(helper.subcommandTerm(cmd2), helper.subcommandDescription(cmd2));
346
+ const commandList = helper.visibleCommands(cmd).map((cmd) => {
347
+ return formatItem(helper.subcommandTerm(cmd), helper.subcommandDescription(cmd));
346
348
  });
347
349
  if (commandList.length > 0) {
348
350
  output = output.concat(["Commands:", formatList(commandList), ""]);
@@ -353,16 +355,16 @@ var require_help = __commonJS((exports) => {
353
355
  padWidth(cmd, helper) {
354
356
  return Math.max(helper.longestOptionTermLength(cmd, helper), helper.longestGlobalOptionTermLength(cmd, helper), helper.longestSubcommandTermLength(cmd, helper), helper.longestArgumentTermLength(cmd, helper));
355
357
  }
356
- wrap(str2, width, indent, minColumnWidth = 40) {
358
+ wrap(str, width, indent, minColumnWidth = 40) {
357
359
  const indents = " \\f\\t\\v   -    \uFEFF";
358
360
  const manualIndent = new RegExp(`[\\n][${indents}]+`);
359
- if (str2.match(manualIndent))
360
- return str2;
361
+ if (str.match(manualIndent))
362
+ return str;
361
363
  const columnWidth = width - indent;
362
364
  if (columnWidth < minColumnWidth)
363
- return str2;
364
- const leadingStr = str2.slice(0, indent);
365
- const columnText = str2.slice(indent).replace(`\r
365
+ return str;
366
+ const leadingStr = str.slice(0, indent);
367
+ const columnText = str.slice(indent).replace(`\r
366
368
  `, `
367
369
  `);
368
370
  const indentString = " ".repeat(indent);
@@ -384,7 +386,7 @@ var require_help = __commonJS((exports) => {
384
386
  });
385
387
 
386
388
  // ../../node_modules/commander/lib/option.js
387
- var require_option = __commonJS((exports) => {
389
+ var require_option = __commonJS(function(exports) {
388
390
  var { InvalidArgumentError } = require_error();
389
391
 
390
392
  class Option {
@@ -512,9 +514,9 @@ var require_option = __commonJS((exports) => {
512
514
  return option.negate === (negativeValue === value);
513
515
  }
514
516
  }
515
- function camelcase(str2) {
516
- return str2.split("-").reduce((str3, word) => {
517
- return str3 + word[0].toUpperCase() + word.slice(1);
517
+ function camelcase(str) {
518
+ return str.split("-").reduce((str, word) => {
519
+ return str + word[0].toUpperCase() + word.slice(1);
518
520
  });
519
521
  }
520
522
  function splitOptionFlags(flags) {
@@ -536,9 +538,9 @@ var require_option = __commonJS((exports) => {
536
538
  });
537
539
 
538
540
  // ../../node_modules/commander/lib/suggestSimilar.js
539
- var require_suggestSimilar = __commonJS((exports) => {
541
+ var require_suggestSimilar = __commonJS(function(exports) {
540
542
  var maxDistance = 3;
541
- function editDistance2(a, b) {
543
+ function editDistance(a, b) {
542
544
  if (Math.abs(a.length - b.length) > maxDistance)
543
545
  return Math.max(a.length, b.length);
544
546
  const d = [];
@@ -579,7 +581,7 @@ var require_suggestSimilar = __commonJS((exports) => {
579
581
  candidates.forEach((candidate) => {
580
582
  if (candidate.length <= 1)
581
583
  return;
582
- const distance = editDistance2(word, candidate);
584
+ const distance = editDistance(word, candidate);
583
585
  const length = Math.max(word.length, candidate.length);
584
586
  const similarity = (length - distance) / length;
585
587
  if (similarity > minSimilarity) {
@@ -609,12 +611,12 @@ var require_suggestSimilar = __commonJS((exports) => {
609
611
  });
610
612
 
611
613
  // ../../node_modules/commander/lib/command.js
612
- var require_command = __commonJS((exports) => {
614
+ var require_command = __commonJS(function(exports) {
613
615
  var EventEmitter = __require("events").EventEmitter;
614
616
  var childProcess = __require("child_process");
615
617
  var path = __require("path");
616
618
  var fs = __require("fs");
617
- var process3 = __require("process");
619
+ var process2 = __require("process");
618
620
  var { Argument, humanReadableArgName } = require_argument();
619
621
  var { CommanderError } = require_error();
620
622
  var { Help } = require_help();
@@ -656,11 +658,11 @@ var require_command = __commonJS((exports) => {
656
658
  this._showHelpAfterError = false;
657
659
  this._showSuggestionAfterError = true;
658
660
  this._outputConfiguration = {
659
- writeOut: (str2) => process3.stdout.write(str2),
660
- writeErr: (str2) => process3.stderr.write(str2),
661
- getOutHelpWidth: () => process3.stdout.isTTY ? process3.stdout.columns : undefined,
662
- getErrHelpWidth: () => process3.stderr.isTTY ? process3.stderr.columns : undefined,
663
- outputError: (str2, write) => write(str2)
661
+ writeOut: (str) => process2.stdout.write(str),
662
+ writeErr: (str) => process2.stderr.write(str),
663
+ getOutHelpWidth: () => process2.stdout.isTTY ? process2.stdout.columns : undefined,
664
+ getErrHelpWidth: () => process2.stderr.isTTY ? process2.stderr.columns : undefined,
665
+ outputError: (str, write) => write(str)
664
666
  };
665
667
  this._hidden = false;
666
668
  this._hasHelpOption = true;
@@ -848,7 +850,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
848
850
  if (this._exitCallback) {
849
851
  this._exitCallback(new CommanderError(exitCode, code, message));
850
852
  }
851
- process3.exit(exitCode);
853
+ process2.exit(exitCode);
852
854
  }
853
855
  action(fn) {
854
856
  const listener = (args) => {
@@ -1010,35 +1012,35 @@ Expecting one of '${allowedValues.join("', '")}'`);
1010
1012
  });
1011
1013
  return source;
1012
1014
  }
1013
- _prepareUserArgs(argv, parseOptions) {
1014
- if (argv !== undefined && !Array.isArray(argv)) {
1015
+ _prepareUserArgs(argv2, parseOptions) {
1016
+ if (argv2 !== undefined && !Array.isArray(argv2)) {
1015
1017
  throw new Error("first parameter to parse must be array or undefined");
1016
1018
  }
1017
1019
  parseOptions = parseOptions || {};
1018
- if (argv === undefined) {
1019
- argv = process3.argv;
1020
- if (process3.versions && process3.versions.electron) {
1020
+ if (argv2 === undefined) {
1021
+ argv2 = process2.argv;
1022
+ if (process2.versions && process2.versions.electron) {
1021
1023
  parseOptions.from = "electron";
1022
1024
  }
1023
1025
  }
1024
- this.rawArgs = argv.slice();
1026
+ this.rawArgs = argv2.slice();
1025
1027
  let userArgs;
1026
1028
  switch (parseOptions.from) {
1027
1029
  case undefined:
1028
1030
  case "node":
1029
- this._scriptPath = argv[1];
1030
- userArgs = argv.slice(2);
1031
+ this._scriptPath = argv2[1];
1032
+ userArgs = argv2.slice(2);
1031
1033
  break;
1032
1034
  case "electron":
1033
- if (process3.defaultApp) {
1034
- this._scriptPath = argv[1];
1035
- userArgs = argv.slice(2);
1035
+ if (process2.defaultApp) {
1036
+ this._scriptPath = argv2[1];
1037
+ userArgs = argv2.slice(2);
1036
1038
  } else {
1037
- userArgs = argv.slice(1);
1039
+ userArgs = argv2.slice(1);
1038
1040
  }
1039
1041
  break;
1040
1042
  case "user":
1041
- userArgs = argv.slice(0);
1043
+ userArgs = argv2.slice(0);
1042
1044
  break;
1043
1045
  default:
1044
1046
  throw new Error(`unexpected parse option { from: '${parseOptions.from}' }`);
@@ -1098,23 +1100,23 @@ Expecting one of '${allowedValues.join("', '")}'`);
1098
1100
  }
1099
1101
  launchWithNode = sourceExt.includes(path.extname(executableFile));
1100
1102
  let proc;
1101
- if (process3.platform !== "win32") {
1103
+ if (process2.platform !== "win32") {
1102
1104
  if (launchWithNode) {
1103
1105
  args.unshift(executableFile);
1104
- args = incrementNodeInspectorPort(process3.execArgv).concat(args);
1105
- proc = childProcess.spawn(process3.argv[0], args, { stdio: "inherit" });
1106
+ args = incrementNodeInspectorPort(process2.execArgv).concat(args);
1107
+ proc = childProcess.spawn(process2.argv[0], args, { stdio: "inherit" });
1106
1108
  } else {
1107
1109
  proc = childProcess.spawn(executableFile, args, { stdio: "inherit" });
1108
1110
  }
1109
1111
  } else {
1110
1112
  args.unshift(executableFile);
1111
- args = incrementNodeInspectorPort(process3.execArgv).concat(args);
1112
- proc = childProcess.spawn(process3.execPath, args, { stdio: "inherit" });
1113
+ args = incrementNodeInspectorPort(process2.execArgv).concat(args);
1114
+ proc = childProcess.spawn(process2.execPath, args, { stdio: "inherit" });
1113
1115
  }
1114
1116
  if (!proc.killed) {
1115
1117
  const signals = ["SIGUSR1", "SIGUSR2", "SIGTERM", "SIGINT", "SIGHUP"];
1116
1118
  signals.forEach((signal) => {
1117
- process3.on(signal, () => {
1119
+ process2.on(signal, () => {
1118
1120
  if (proc.killed === false && proc.exitCode === null) {
1119
1121
  proc.kill(signal);
1120
1122
  }
@@ -1123,10 +1125,10 @@ Expecting one of '${allowedValues.join("', '")}'`);
1123
1125
  }
1124
1126
  const exitCallback = this._exitCallback;
1125
1127
  if (!exitCallback) {
1126
- proc.on("close", process3.exit.bind(process3));
1128
+ proc.on("close", process2.exit.bind(process2));
1127
1129
  } else {
1128
1130
  proc.on("close", () => {
1129
- exitCallback(new CommanderError(process3.exitCode || 0, "commander.executeSubCommandAsync", "(close)"));
1131
+ exitCallback(new CommanderError(process2.exitCode || 0, "commander.executeSubCommandAsync", "(close)"));
1130
1132
  });
1131
1133
  }
1132
1134
  proc.on("error", (err) => {
@@ -1141,7 +1143,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
1141
1143
  throw new Error(`'${executableFile}' not executable`);
1142
1144
  }
1143
1145
  if (!exitCallback) {
1144
- process3.exit(1);
1146
+ process2.exit(1);
1145
1147
  } else {
1146
1148
  const wrappedError = new CommanderError(1, "commander.executeSubCommandAsync", "(error)");
1147
1149
  wrappedError.nestedError = err;
@@ -1491,11 +1493,11 @@ Expecting one of '${allowedValues.join("', '")}'`);
1491
1493
  }
1492
1494
  _parseOptionsEnv() {
1493
1495
  this.options.forEach((option) => {
1494
- if (option.envVar && option.envVar in process3.env) {
1496
+ if (option.envVar && option.envVar in process2.env) {
1495
1497
  const optionKey = option.attributeName();
1496
1498
  if (this.getOptionValue(optionKey) === undefined || ["default", "config", "env"].includes(this.getOptionValueSource(optionKey))) {
1497
1499
  if (option.required || option.optional) {
1498
- this.emit(`optionEnv:${option.name()}`, process3.env[option.envVar]);
1500
+ this.emit(`optionEnv:${option.name()}`, process2.env[option.envVar]);
1499
1501
  } else {
1500
1502
  this.emit(`optionEnv:${option.name()}`);
1501
1503
  }
@@ -1527,18 +1529,18 @@ Expecting one of '${allowedValues.join("', '")}'`);
1527
1529
  this.error(message, { code: "commander.missingMandatoryOptionValue" });
1528
1530
  }
1529
1531
  _conflictingOption(option, conflictingOption) {
1530
- const findBestOptionFromValue = (option2) => {
1531
- const optionKey = option2.attributeName();
1532
+ const findBestOptionFromValue = (option) => {
1533
+ const optionKey = option.attributeName();
1532
1534
  const optionValue = this.getOptionValue(optionKey);
1533
1535
  const negativeOption = this.options.find((target) => target.negate && optionKey === target.attributeName());
1534
1536
  const positiveOption = this.options.find((target) => !target.negate && optionKey === target.attributeName());
1535
1537
  if (negativeOption && (negativeOption.presetArg === undefined && optionValue === false || negativeOption.presetArg !== undefined && optionValue === negativeOption.presetArg)) {
1536
1538
  return negativeOption;
1537
1539
  }
1538
- return positiveOption || option2;
1540
+ return positiveOption || option;
1539
1541
  };
1540
- const getErrorMessage = (option2) => {
1541
- const bestOption = findBestOptionFromValue(option2);
1542
+ const getErrorMessage = (option) => {
1543
+ const bestOption = findBestOptionFromValue(option);
1542
1544
  const optionKey = bestOption.attributeName();
1543
1545
  const source = this.getOptionValueSource(optionKey);
1544
1546
  if (source === "env") {
@@ -1590,35 +1592,35 @@ Expecting one of '${allowedValues.join("', '")}'`);
1590
1592
  const message = `error: unknown command '${unknownName}'${suggestion}`;
1591
1593
  this.error(message, { code: "commander.unknownCommand" });
1592
1594
  }
1593
- version(str2, flags, description) {
1594
- if (str2 === undefined)
1595
+ version(str, flags, description) {
1596
+ if (str === undefined)
1595
1597
  return this._version;
1596
- this._version = str2;
1598
+ this._version = str;
1597
1599
  flags = flags || "-V, --version";
1598
1600
  description = description || "output the version number";
1599
1601
  const versionOption = this.createOption(flags, description);
1600
1602
  this._versionOptionName = versionOption.attributeName();
1601
1603
  this.options.push(versionOption);
1602
1604
  this.on("option:" + versionOption.name(), () => {
1603
- this._outputConfiguration.writeOut(`${str2}
1605
+ this._outputConfiguration.writeOut(`${str}
1604
1606
  `);
1605
- this._exit(0, "commander.version", str2);
1607
+ this._exit(0, "commander.version", str);
1606
1608
  });
1607
1609
  return this;
1608
1610
  }
1609
- description(str2, argsDescription) {
1610
- if (str2 === undefined && argsDescription === undefined)
1611
+ description(str, argsDescription) {
1612
+ if (str === undefined && argsDescription === undefined)
1611
1613
  return this._description;
1612
- this._description = str2;
1614
+ this._description = str;
1613
1615
  if (argsDescription) {
1614
1616
  this._argsDescription = argsDescription;
1615
1617
  }
1616
1618
  return this;
1617
1619
  }
1618
- summary(str2) {
1619
- if (str2 === undefined)
1620
+ summary(str) {
1621
+ if (str === undefined)
1620
1622
  return this._summary;
1621
- this._summary = str2;
1623
+ this._summary = str;
1622
1624
  return this;
1623
1625
  }
1624
1626
  alias(alias) {
@@ -1639,8 +1641,8 @@ Expecting one of '${allowedValues.join("', '")}'`);
1639
1641
  aliases.forEach((alias) => this.alias(alias));
1640
1642
  return this;
1641
1643
  }
1642
- usage(str2) {
1643
- if (str2 === undefined) {
1644
+ usage(str) {
1645
+ if (str === undefined) {
1644
1646
  if (this._usage)
1645
1647
  return this._usage;
1646
1648
  const args = this.registeredArguments.map((arg) => {
@@ -1648,23 +1650,23 @@ Expecting one of '${allowedValues.join("', '")}'`);
1648
1650
  });
1649
1651
  return [].concat(this.options.length || this._hasHelpOption ? "[options]" : [], this.commands.length ? "[command]" : [], this.registeredArguments.length ? args : []).join(" ");
1650
1652
  }
1651
- this._usage = str2;
1653
+ this._usage = str;
1652
1654
  return this;
1653
1655
  }
1654
- name(str2) {
1655
- if (str2 === undefined)
1656
+ name(str) {
1657
+ if (str === undefined)
1656
1658
  return this._name;
1657
- this._name = str2;
1659
+ this._name = str;
1658
1660
  return this;
1659
1661
  }
1660
1662
  nameFromFilename(filename) {
1661
1663
  this._name = path.basename(filename, path.extname(filename));
1662
1664
  return this;
1663
1665
  }
1664
- executableDir(path2) {
1665
- if (path2 === undefined)
1666
+ executableDir(path) {
1667
+ if (path === undefined)
1666
1668
  return this._executableDir;
1667
- this._executableDir = path2;
1669
+ this._executableDir = path;
1668
1670
  return this;
1669
1671
  }
1670
1672
  helpInformation(contextOptions) {
@@ -1724,13 +1726,13 @@ Expecting one of '${allowedValues.join("', '")}'`);
1724
1726
  }
1725
1727
  help(contextOptions) {
1726
1728
  this.outputHelp(contextOptions);
1727
- let exitCode = process3.exitCode || 0;
1728
- if (exitCode === 0 && contextOptions && typeof contextOptions !== "function" && contextOptions.error) {
1729
- exitCode = 1;
1729
+ let exitCode2 = process2.exitCode || 0;
1730
+ if (exitCode2 === 0 && contextOptions && typeof contextOptions !== "function" && contextOptions.error) {
1731
+ exitCode2 = 1;
1730
1732
  }
1731
- this._exit(exitCode, "commander.help", "(outputHelp)");
1733
+ this._exit(exitCode2, "commander.help", "(outputHelp)");
1732
1734
  }
1733
- addHelpText(position, text2) {
1735
+ addHelpText(position, text) {
1734
1736
  const allowedValues = ["beforeAll", "before", "after", "afterAll"];
1735
1737
  if (!allowedValues.includes(position)) {
1736
1738
  throw new Error(`Unexpected value for position to addHelpText.
@@ -1739,10 +1741,10 @@ Expecting one of '${allowedValues.join("', '")}'`);
1739
1741
  const helpEvent = `${position}Help`;
1740
1742
  this.on(helpEvent, (context) => {
1741
1743
  let helpStr;
1742
- if (typeof text2 === "function") {
1743
- helpStr = text2({ error: context.error, command: context.command });
1744
+ if (typeof text === "function") {
1745
+ helpStr = text({ error: context.error, command: context.command });
1744
1746
  } else {
1745
- helpStr = text2;
1747
+ helpStr = text;
1746
1748
  }
1747
1749
  if (helpStr) {
1748
1750
  context.write(`${helpStr}
@@ -1792,7 +1794,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
1792
1794
  });
1793
1795
 
1794
1796
  // ../../node_modules/commander/index.js
1795
- var require_commander = __commonJS((exports, module) => {
1797
+ var require_commander = __commonJS(function(exports, module) {
1796
1798
  var { Argument } = require_argument();
1797
1799
  var { Command } = require_command();
1798
1800
  var { CommanderError, InvalidArgumentError } = require_error();
@@ -2714,11 +2716,11 @@ function runtimeCanProxy(version) {
2714
2716
  return minor >= firstSupportedMinor;
2715
2717
  return major > FIRST_SUPPORTED_MAJOR;
2716
2718
  }
2717
- function warnIfProxyIgnored(env2 = process.env, version = process.version) {
2718
- const variable = PROXY_VARIABLES.find((name) => env2[name]);
2719
+ function warnIfProxyIgnored(env = process.env, version = process.version) {
2720
+ const variable = PROXY_VARIABLES.find((name) => env[name]);
2719
2721
  if (!variable)
2720
2722
  return;
2721
- if (env2.NODE_USE_ENV_PROXY && runtimeCanProxy(version))
2723
+ if (env.NODE_USE_ENV_PROXY && runtimeCanProxy(version))
2722
2724
  return;
2723
2725
  once("proxy", runtimeCanProxy(version) ? `${variable} is set but Node only uses it when NODE_USE_ENV_PROXY=1. Re-run with NODE_USE_ENV_PROXY=1 to route through the proxy.` : `${variable} is set but Node ${version} cannot use it. Upgrade to Node 22.21 or 24.5 and set NODE_USE_ENV_PROXY=1 to route through the proxy.`);
2724
2726
  }
@@ -2830,8 +2832,8 @@ var RAISE_TIMEOUT_HINT = "Raise SIM_TIMEOUT_SECONDS, or set it to 0 to wait inde
2830
2832
  function isRequestTimeout(error) {
2831
2833
  return error instanceof DOMException && error.name === "TimeoutError";
2832
2834
  }
2833
- function resolveTimeoutMs(env2 = process.env) {
2834
- const raw = env2.SIM_TIMEOUT_SECONDS;
2835
+ function resolveTimeoutMs(env = process.env) {
2836
+ const raw = env.SIM_TIMEOUT_SECONDS;
2835
2837
  if (raw === undefined || raw.trim() === "")
2836
2838
  return DEFAULT_TIMEOUT_SECONDS * 1000;
2837
2839
  const seconds = Number(raw);
@@ -2861,8 +2863,8 @@ function combineSignals(caller, timeout) {
2861
2863
  }
2862
2864
  return controller.signal;
2863
2865
  }
2864
- function debugEnabled(env2 = process.env) {
2865
- const raw = env2.SIM_DEBUG;
2866
+ function debugEnabled(env = process.env) {
2867
+ const raw = env.SIM_DEBUG;
2866
2868
  return raw !== undefined && raw !== "" && raw !== "0" && raw.toLowerCase() !== "false";
2867
2869
  }
2868
2870
  function traceRequest(method, url, status, startedAt) {
@@ -3036,16 +3038,16 @@ function redirectEndpoint(endpoint, requestPath, target) {
3036
3038
  return suggested === endpoint.replace(/\/+$/, "") ? null : suggested;
3037
3039
  }
3038
3040
  function pageProgress() {
3039
- let reported2 = false;
3041
+ let reported = false;
3040
3042
  return {
3041
3043
  advance: (fetched) => {
3042
3044
  if (!process.stderr.isTTY)
3043
3045
  return;
3044
- reported2 = true;
3046
+ reported = true;
3045
3047
  process.stderr.write(`\r${source_default.dim(`fetched ${fetched}…`)}\x1B[K`);
3046
3048
  },
3047
3049
  finish: () => {
3048
- if (reported2)
3050
+ if (reported)
3049
3051
  process.stderr.write("\r\x1B[K");
3050
3052
  }
3051
3053
  };
@@ -6406,7 +6408,7 @@ import { createHash, randomBytes, randomInt } from "node:crypto";
6406
6408
 
6407
6409
  // src/helpers.ts
6408
6410
  function sleep(ms) {
6409
- return new Promise((resolve2) => setTimeout(resolve2, ms));
6411
+ return new Promise((resolve) => setTimeout(resolve, ms));
6410
6412
  }
6411
6413
 
6412
6414
  // src/auth/device-flow.ts
@@ -7049,13 +7051,6 @@ var V2_OPERATIONS = {
7049
7051
  responseMode: "json",
7050
7052
  summary: "Create Credential Connection",
7051
7053
  personalKeyOnly: true,
7052
- body: {
7053
- workspaceId: {
7054
- kind: "string",
7055
- required: true,
7056
- describe: "Workspace that will own the credential."
7057
- }
7058
- },
7059
7054
  opaqueBody: true
7060
7055
  },
7061
7056
  createCustomTool: {
@@ -13769,20 +13764,20 @@ function buildRequest(operation, positional, flags, workspaceId) {
13769
13764
  const headerSlot = Object.keys(headers).length > 0 ? { headers } : {};
13770
13765
  if (spec.opaqueBody) {
13771
13766
  if (commandSpec.bodyVariants) {
13772
- const provided = commandSpec.bodyVariants.filter((variant2) => flags[camel(variant2.name)] !== undefined);
13773
- const names = commandSpec.bodyVariants.map((variant2) => `--${variant2.name}`).join(" or ");
13767
+ const provided = commandSpec.bodyVariants.filter((variant) => flags[camel(variant.name)] !== undefined);
13768
+ const names = commandSpec.bodyVariants.map((variant) => `--${variant.name}`).join(" or ");
13774
13769
  if (provided.length !== 1) {
13775
13770
  throw new SimApiError(`Pass exactly one of ${names}`, 0);
13776
13771
  }
13777
13772
  const variant = provided[0];
13778
- const raw2 = flags[camel(variant.name)];
13779
- if (typeof raw2 !== "string")
13773
+ const raw = flags[camel(variant.name)];
13774
+ if (typeof raw !== "string")
13780
13775
  throw new SimApiError(`--${variant.name} is required`, 0);
13781
- const parsed2 = coerce(raw2, { kind: variant.kind }, { json: true }, variant.name);
13782
- if (variant.kind === "object" && (!parsed2 || typeof parsed2 !== "object" || Array.isArray(parsed2)) || variant.kind === "array" && !Array.isArray(parsed2)) {
13776
+ const parsed = coerce(raw, { kind: variant.kind }, { json: true }, variant.name);
13777
+ if (variant.kind === "object" && (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) || variant.kind === "array" && !Array.isArray(parsed)) {
13783
13778
  throw new SimApiError(`--${variant.name} must be a JSON ${variant.kind}`, 0);
13784
13779
  }
13785
- return { path, query, body: { ...body, [variant.property]: parsed2 }, ...headerSlot };
13780
+ return { path, query, body: { ...body, [variant.property]: parsed }, ...headerSlot };
13786
13781
  }
13787
13782
  const raw = flags.body;
13788
13783
  if (typeof raw !== "string")
@@ -13980,13 +13975,13 @@ function renderSpan(value, depth) {
13980
13975
  const indent = " ".repeat(depth);
13981
13976
  const detailIndent = `${indent} `;
13982
13977
  const name = requiredText(span, "name");
13983
- const type2 = requiredText(span, "type");
13978
+ const type = requiredText(span, "type");
13984
13979
  const status = optionalText(span, "status");
13985
13980
  const elapsed = optionalNumber(span, "durationMs") ?? optionalNumber(span, "duration");
13986
13981
  const totalCost = costTotal(span);
13987
13982
  const summary = [
13988
13983
  `${indent}- ${name}`,
13989
- `[${type2}]`,
13984
+ `[${type}]`,
13990
13985
  status,
13991
13986
  elapsed === undefined ? undefined : duration(Math.round(elapsed)),
13992
13987
  totalCost === undefined ? undefined : `$${totalCost.toFixed(4)}`
@@ -14293,8 +14288,8 @@ function runFailureMessage(operation, payload) {
14293
14288
  const fallback = failureMessages[status];
14294
14289
  if (!fallback)
14295
14290
  return null;
14296
- const reported2 = error?.message;
14297
- return safeOneLine(typeof reported2 === "string" && reported2 ? reported2 : fallback);
14291
+ const reported = error?.message;
14292
+ return safeOneLine(typeof reported === "string" && reported ? reported : fallback);
14298
14293
  }
14299
14294
  var BULK_OUTCOME_CHECKS = {
14300
14295
  bulkDeleteFiles: (payload, body) => {
@@ -14329,8 +14324,8 @@ var BULK_OUTCOME_CHECKS = {
14329
14324
  const requested = lengthOf(body?.chunkIds);
14330
14325
  if (requested === 0)
14331
14326
  return null;
14332
- const reported2 = payload.errors?.[0];
14333
- return typeof reported2 === "string" && reported2 ? safeOneLine(reported2) : `Updated nothing: none of the ${requested} requested ${requested === 1 ? "chunk" : "chunks"} matched.`;
14327
+ const reported = payload.errors?.[0];
14328
+ return typeof reported === "string" && reported ? safeOneLine(reported) : `Updated nothing: none of the ${requested} requested ${requested === 1 ? "chunk" : "chunks"} matched.`;
14334
14329
  },
14335
14330
  deleteTableRows: (payload) => {
14336
14331
  if (countOf(payload.deletedCount) > 0)
@@ -14375,8 +14370,8 @@ var EXCLUSIVE_CAP_FIELDS = {
14375
14370
  deleteTableRows: { cap: "limit", ids: "rowIds" }
14376
14371
  };
14377
14372
  function readPagedLimit(raw) {
14378
- const text2 = String(raw ?? DEFAULT_LIMIT).trim();
14379
- const value = text2 === "" ? Number.NaN : Number(text2);
14373
+ const text = String(raw ?? DEFAULT_LIMIT).trim();
14374
+ const value = text === "" ? Number.NaN : Number(text);
14380
14375
  if (!Number.isInteger(value) || value < 0) {
14381
14376
  throw new SimApiError("--limit must be a whole number of 0 or more (0 for everything)", 0);
14382
14377
  }
@@ -14550,7 +14545,7 @@ function retypeMessage(message, spellings) {
14550
14545
  }
14551
14546
  function retypeDetails(details, spellings) {
14552
14547
  if (Array.isArray(details))
14553
- return details.map((issue2) => retypeDetails(issue2, spellings));
14548
+ return details.map((issue) => retypeDetails(issue, spellings));
14554
14549
  if (!details || typeof details !== "object")
14555
14550
  return details;
14556
14551
  const issue = details;
@@ -14613,8 +14608,8 @@ function commandPath(command) {
14613
14608
  return names.join(" ");
14614
14609
  }
14615
14610
  var UNKNOWN_OPTION_TOKEN = /^error: unknown option '(.+?)'/;
14616
- function looksLikeAnId(token2) {
14617
- return token2.length > 2 && !token2.startsWith("--") && /^-[A-Za-z0-9_-]*[A-Z0-9][A-Za-z0-9_-]*$/.test(token2);
14611
+ function looksLikeAnId(token) {
14612
+ return token.length > 2 && !token.startsWith("--") && /^-[A-Za-z0-9_-]*[A-Z0-9][A-Za-z0-9_-]*$/.test(token);
14618
14613
  }
14619
14614
  function addArgumentExamples(command) {
14620
14615
  const outputError = command.configureOutput().outputError;
@@ -14632,10 +14627,10 @@ function addArgumentExamples(command) {
14632
14627
  }
14633
14628
  if (command.registeredArguments.length === 0)
14634
14629
  return;
14635
- const token2 = UNKNOWN_OPTION_TOKEN.exec(message)?.[1];
14636
- if (!token2 || !looksLikeAnId(token2))
14630
+ const token = UNKNOWN_OPTION_TOKEN.exec(message)?.[1];
14631
+ if (!token || !looksLikeAnId(token))
14637
14632
  return;
14638
- write(`Example: ${commandPath(command)} -- ${token2}
14633
+ write(`Example: ${commandPath(command)} -- ${token}
14639
14634
  `);
14640
14635
  }
14641
14636
  });
@@ -14651,7 +14646,7 @@ function assertNoReservedFlags(command, operation) {
14651
14646
  }
14652
14647
  }
14653
14648
  var RESERVED_FLAG_EXEMPTIONS = new Set(["profiles add"]);
14654
- function assertNoReservedProgramFlags(program2) {
14649
+ function assertNoReservedProgramFlags(program) {
14655
14650
  const walk = (command, prefix) => {
14656
14651
  const path = [...prefix, command.name()];
14657
14652
  const name = path.join(" ");
@@ -14667,10 +14662,10 @@ function assertNoReservedProgramFlags(program2) {
14667
14662
  for (const child of command.commands)
14668
14663
  walk(child, path);
14669
14664
  };
14670
- for (const child of program2.commands)
14665
+ for (const child of program.commands)
14671
14666
  walk(child, []);
14672
14667
  }
14673
- function refuseHelpAfterUnknownCommand(program2) {
14668
+ function refuseHelpAfterUnknownCommand(program) {
14674
14669
  const walk = (command) => {
14675
14670
  const internals = command;
14676
14671
  const dispatchesOnly = command.commands.length > 0 && !internals._actionHandler && command.registeredArguments.length === 0;
@@ -14691,7 +14686,7 @@ function refuseHelpAfterUnknownCommand(program2) {
14691
14686
  for (const child of command.commands)
14692
14687
  walk(child);
14693
14688
  };
14694
- walk(program2);
14689
+ walk(program);
14695
14690
  }
14696
14691
  function configureOperation(command, operation, spec) {
14697
14692
  const operationSpec = V2_OPERATIONS[operation];
@@ -14975,8 +14970,8 @@ function acceptNameOnUpdate(credentials) {
14975
14970
  options.displayName = options.name;
14976
14971
  });
14977
14972
  }
14978
- function attachCredentialCommands(program2) {
14979
- const credentials = program2.commands.find((command) => command.name() === "credentials");
14973
+ function attachCredentialCommands(program) {
14974
+ const credentials = program.commands.find((command) => command.name() === "credentials");
14980
14975
  if (!credentials)
14981
14976
  throw new Error("The generated credentials command group is missing");
14982
14977
  acceptNameOnUpdate(credentials);
@@ -15070,8 +15065,8 @@ function ignoreBrokenPipe(stream) {
15070
15065
  stream.off("error", onError);
15071
15066
  };
15072
15067
  }
15073
- function attachChat(program2) {
15074
- program2.command("chat").description("Ask Sim and print the reply").argument("<message>", "What to ask Sim").allowExcessArguments(false).option("-c, --conversation <id>", "Continue the conversation with this ID").addHelpText("after", `
15068
+ function attachChat(program) {
15069
+ program.command("chat").description("Ask Sim and print the reply").argument("<message>", "What to ask Sim").allowExcessArguments(false).option("-c, --conversation <id>", "Continue the conversation with this ID").addHelpText("after", `
15075
15070
  Each turn prints the reply on stdout and the conversation ID on stderr; pass
15076
15071
  that ID back with -c to continue the same conversation. With --output json or
15077
15072
  yaml the reply is not streamed — the finished result is printed as one
@@ -15112,11 +15107,11 @@ Examples:
15112
15107
  };
15113
15108
  const restorePipeHandling = streaming ? ignoreBrokenPipe(process.stdout) : undefined;
15114
15109
  try {
15115
- const result = await readChatStream(response, (content2) => {
15110
+ const result = await readChatStream(response, (content) => {
15116
15111
  if (!streaming)
15117
15112
  return;
15118
- streamed += content2;
15119
- process.stdout.write(content2);
15113
+ streamed += content;
15114
+ process.stdout.write(content);
15120
15115
  });
15121
15116
  if (!streaming) {
15122
15117
  printProtocolResult(profile.output, result);
@@ -15627,26 +15622,26 @@ ${dump(row, { lineWidth: 0, noRefs: true }).trimEnd()}`);
15627
15622
  return createTableWriter();
15628
15623
  }
15629
15624
  function followStatus() {
15630
- let reported2 = false;
15625
+ let reported = false;
15631
15626
  return {
15632
15627
  note: (message) => {
15633
15628
  if (!process.stderr.isTTY)
15634
15629
  return;
15635
- reported2 = true;
15630
+ reported = true;
15636
15631
  process.stderr.write(`\r${source_default.dim(message)}${ERASE_LINE}`);
15637
15632
  },
15638
15633
  warn: (message) => {
15639
- if (reported2) {
15640
- reported2 = false;
15634
+ if (reported) {
15635
+ reported = false;
15641
15636
  process.stderr.write(`\r${ERASE_LINE}`);
15642
15637
  }
15643
15638
  process.stderr.write(`warning: ${message}
15644
15639
  `);
15645
15640
  },
15646
15641
  clear: () => {
15647
- if (!reported2)
15642
+ if (!reported)
15648
15643
  return;
15649
- reported2 = false;
15644
+ reported = false;
15650
15645
  process.stderr.write(`\r${ERASE_LINE}`);
15651
15646
  }
15652
15647
  };
@@ -15934,18 +15929,18 @@ function progressLine(job) {
15934
15929
  }
15935
15930
  async function watchImport(client, workspaceId, job) {
15936
15931
  let current = job;
15937
- let reported2 = null;
15932
+ let reported = null;
15938
15933
  while (!IMPORT_SETTLED.has(current.status)) {
15939
15934
  await sleep2(IMPORT_POLL_MS);
15940
15935
  const next = await client.request(`/api/v2/tables/imports/${encodeURIComponent(current.id)}`, { query: { workspaceId } });
15941
15936
  current = next.data;
15942
15937
  const line = progressLine(current);
15943
- if (process.stderr.isTTY && line !== reported2) {
15944
- reported2 = line;
15938
+ if (process.stderr.isTTY && line !== reported) {
15939
+ reported = line;
15945
15940
  process.stderr.write(`\r${source_default.dim(line)}\x1B[K`);
15946
15941
  }
15947
15942
  }
15948
- if (process.stderr.isTTY && reported2 !== null)
15943
+ if (process.stderr.isTTY && reported !== null)
15949
15944
  process.stderr.write("\r\x1B[K");
15950
15945
  return current;
15951
15946
  }
@@ -16132,16 +16127,16 @@ class Commentary {
16132
16127
  constructor(sink) {
16133
16128
  this.sink = sink;
16134
16129
  }
16135
- inline(text2) {
16136
- if (text2.length === 0)
16130
+ inline(text) {
16131
+ if (text.length === 0)
16137
16132
  return;
16138
- this.sink.write(text2);
16139
- this.atLineStart = text2.endsWith(`
16133
+ this.sink.write(text);
16134
+ this.atLineStart = text.endsWith(`
16140
16135
  `);
16141
16136
  }
16142
- line(text2) {
16137
+ line(text) {
16143
16138
  this.sink.write(`${this.atLineStart ? "" : `
16144
- `}${text2}
16139
+ `}${text}
16145
16140
  `);
16146
16141
  this.atLineStart = true;
16147
16142
  }
@@ -16331,18 +16326,18 @@ function classify(snapshot) {
16331
16326
  return snapshot.status === "completed" ? "completed" : snapshot.status === "cancelled" ? "cancelled" : "failed";
16332
16327
  }
16333
16328
  function waitProgress() {
16334
- let reported2 = false;
16329
+ let reported = false;
16335
16330
  return {
16336
16331
  advance: (status, elapsedMs) => {
16337
16332
  if (!process.stderr.isTTY)
16338
16333
  return;
16339
- reported2 = true;
16334
+ reported = true;
16340
16335
  process.stderr.write(`\r${source_default.dim(`${status} — waiting ${Math.round(elapsedMs / 1000)}s…`)}\x1B[K`);
16341
16336
  },
16342
16337
  finish: () => {
16343
- if (!reported2)
16338
+ if (!reported)
16344
16339
  return;
16345
- reported2 = false;
16340
+ reported = false;
16346
16341
  process.stderr.write("\r\x1B[K");
16347
16342
  }
16348
16343
  };
@@ -16410,16 +16405,16 @@ function attachWorkflowRunWait(runs) {
16410
16405
  }
16411
16406
 
16412
16407
  // src/commands/protocol/index.ts
16413
- function group(program2, name) {
16414
- const existing = program2.commands.find((command) => command.name() === name);
16408
+ function group(program, name) {
16409
+ const existing = program.commands.find((command) => command.name() === name);
16415
16410
  if (existing)
16416
16411
  return existing;
16417
16412
  const created = new Command(name);
16418
- program2.addCommand(created);
16413
+ program.addCommand(created);
16419
16414
  return created;
16420
16415
  }
16421
- function attachProtocolCommands(program2) {
16422
- const files = group(program2, "files");
16416
+ function attachProtocolCommands(program) {
16417
+ const files = group(program, "files");
16423
16418
  attachFileUpload(files);
16424
16419
  attachFileGet(files);
16425
16420
  attachResourceDirectoryCommands(files, {
@@ -16428,7 +16423,7 @@ function attachProtocolCommands(program2) {
16428
16423
  folders: "listFileFolders",
16429
16424
  createFolder: "createFileFolder"
16430
16425
  });
16431
- const knowledge = group(program2, "knowledge");
16426
+ const knowledge = group(program, "knowledge");
16432
16427
  attachKnowledgeDocumentUpload(group(knowledge, "documents"));
16433
16428
  attachResourceDirectoryCommands(knowledge, {
16434
16429
  kind: "knowledge",
@@ -16436,7 +16431,7 @@ function attachProtocolCommands(program2) {
16436
16431
  folders: "listKnowledgeFolders",
16437
16432
  createFolder: "createKnowledgeFolder"
16438
16433
  });
16439
- const tables = group(program2, "tables");
16434
+ const tables = group(program, "tables");
16440
16435
  attachTableImport(tables);
16441
16436
  attachResourceDirectoryCommands(tables, {
16442
16437
  kind: "table",
@@ -16444,7 +16439,7 @@ function attachProtocolCommands(program2) {
16444
16439
  folders: "listTableFolders",
16445
16440
  createFolder: "createTableFolder"
16446
16441
  });
16447
- const workflows = group(program2, "workflows");
16442
+ const workflows = group(program, "workflows");
16448
16443
  attachResourceDirectoryCommands(workflows, {
16449
16444
  kind: "workflow",
16450
16445
  resources: "listWorkflows",
@@ -16453,8 +16448,8 @@ function attachProtocolCommands(program2) {
16453
16448
  });
16454
16449
  attachWorkflowRunFollow(workflows);
16455
16450
  attachWorkflowRunWait(group(workflows, "runs"));
16456
- attachLogsFollow(group(program2, "logs"));
16457
- attachChat(program2);
16451
+ attachLogsFollow(group(program, "logs"));
16452
+ attachChat(program);
16458
16453
  }
16459
16454
 
16460
16455
  // src/terminal/secret-input.ts
@@ -16486,7 +16481,7 @@ function promptSecret(input = process.stdin, output = process.stderr) {
16486
16481
  emitKeypressEvents(input);
16487
16482
  input.setRawMode(true);
16488
16483
  input.resume();
16489
- return new Promise((resolve3, reject) => {
16484
+ return new Promise((resolve, reject) => {
16490
16485
  const cleanup = () => {
16491
16486
  input.removeListener("keypress", onKeypress);
16492
16487
  input.setRawMode(wasRaw);
@@ -16507,7 +16502,7 @@ function promptSecret(input = process.stdin, output = process.stderr) {
16507
16502
  };
16508
16503
  const fail = (message) => finish(() => reject(new SimApiError(message, 0)));
16509
16504
  const cancel = () => finish(() => reject(new SecretInputCancelledError));
16510
- function onKeypress(text2, key) {
16505
+ function onKeypress(text, key) {
16511
16506
  if (key.ctrl && (key.name === "c" || key.name === "d")) {
16512
16507
  cancel();
16513
16508
  return;
@@ -16516,7 +16511,7 @@ function promptSecret(input = process.stdin, output = process.stderr) {
16516
16511
  if (value.length === 0)
16517
16512
  fail("Secret value cannot be empty.");
16518
16513
  else
16519
- finish(() => resolve3(value));
16514
+ finish(() => resolve(value));
16520
16515
  return;
16521
16516
  }
16522
16517
  if (key.name === "backspace") {
@@ -16528,7 +16523,7 @@ function promptSecret(input = process.stdin, output = process.stderr) {
16528
16523
  }
16529
16524
  return;
16530
16525
  }
16531
- const entered = text2 || metaCharacter(key);
16526
+ const entered = text || metaCharacter(key);
16532
16527
  if (!entered || key.ctrl || key.name === "escape")
16533
16528
  return;
16534
16529
  if (value.length + entered.length > MAX_SECRET_LENGTH) {
@@ -16613,8 +16608,8 @@ async function setSecret(name, options, command, redactionSpellings) {
16613
16608
  });
16614
16609
  renderResult("setSecret", profile.output, response.data, SECRET_RESULT);
16615
16610
  }
16616
- function attachSecretCommands(program2) {
16617
- const secrets = program2.commands.find((command) => command.name() === "secrets");
16611
+ function attachSecretCommands(program) {
16612
+ const secrets = program.commands.find((command) => command.name() === "secrets");
16618
16613
  if (!secrets)
16619
16614
  throw new Error("The generated secrets command group is missing");
16620
16615
  const redactionSpellings = new Set;
@@ -16683,16 +16678,16 @@ function isProjectLocalInstall(modulePath, cwd) {
16683
16678
  const workingDirectory = normalizeModulePath(cwd).replace(/\/+$/, "");
16684
16679
  return workingDirectory === installRoot || workingDirectory.startsWith(`${installRoot}/`);
16685
16680
  }
16686
- function isUnadvisableInstall(modulePath, env2, cwd) {
16681
+ function isUnadvisableInstall(modulePath, env, cwd) {
16687
16682
  const normalized = normalizeModulePath(modulePath);
16688
- return env2.npm_command === "exec" || normalized.includes("/_npx/") || normalized.includes("/packages/sim-cli/") || isProjectLocalInstall(modulePath, cwd);
16683
+ return env.npm_command === "exec" || normalized.includes("/_npx/") || normalized.includes("/packages/sim-cli/") || isProjectLocalInstall(modulePath, cwd);
16689
16684
  }
16690
16685
  function normalizeModulePath(modulePath) {
16691
16686
  return modulePath.replace(/\\/g, "/").toLowerCase();
16692
16687
  }
16693
- function registryUrl(env2) {
16688
+ function registryUrl(env) {
16694
16689
  const fallback = new URL(DIST_TAGS_PATH, DEFAULT_REGISTRY);
16695
- const configured = env2.npm_config_registry?.trim();
16690
+ const configured = env.npm_config_registry?.trim();
16696
16691
  if (!configured)
16697
16692
  return fallback;
16698
16693
  try {
@@ -16743,16 +16738,16 @@ try {
16743
16738
  }
16744
16739
  `;
16745
16740
  function registryProcessEnv() {
16746
- const env2 = { ...process.env };
16747
- for (const key of Object.keys(env2)) {
16741
+ const env = { ...process.env };
16742
+ for (const key of Object.keys(env)) {
16748
16743
  const normalized = key.toLowerCase();
16749
16744
  if (normalized === "npm_config_registry" || normalized === "sim_api_key")
16750
- delete env2[key];
16745
+ delete env[key];
16751
16746
  }
16752
- return env2;
16747
+ return env;
16753
16748
  }
16754
16749
  function requestRegistry(url, { headers, maxResponseBytes, timeoutMs }) {
16755
- return new Promise((resolve3, reject) => {
16750
+ return new Promise((resolve, reject) => {
16756
16751
  const proxyArguments = process.execArgv.filter((argument) => argument === "--use-env-proxy" || argument === "--no-use-env-proxy");
16757
16752
  const child = spawn2(process.execPath, [...proxyArguments, "--input-type=module", "--eval", REGISTRY_REQUEST_SCRIPT], {
16758
16753
  env: registryProcessEnv(),
@@ -16780,24 +16775,24 @@ function requestRegistry(url, { headers, maxResponseBytes, timeoutMs }) {
16780
16775
  child.stdin.on("error", () => {});
16781
16776
  child.once("error", reject);
16782
16777
  child.once("close", (code) => {
16783
- resolve3(code === 0 && !failed ? Buffer.concat(chunks).toString("utf8") : null);
16778
+ resolve(code === 0 && !failed ? Buffer.concat(chunks).toString("utf8") : null);
16784
16779
  });
16785
16780
  child.stdin.end(JSON.stringify({ headers, maxResponseBytes, timeoutMs, url: url.href }));
16786
16781
  });
16787
16782
  }
16788
- async function fetchDistTags(env2, request) {
16783
+ async function fetchDistTags(env, request) {
16789
16784
  try {
16790
- const url = registryUrl(env2);
16785
+ const url = registryUrl(env);
16791
16786
  if (!url)
16792
16787
  return null;
16793
- const text2 = await request(url, {
16788
+ const text = await request(url, {
16794
16789
  headers: { accept: "application/json", "user-agent": `${PACKAGE_NAME}-cli/${CLI_VERSION}` },
16795
16790
  maxResponseBytes: MAX_RESPONSE_BYTES,
16796
16791
  timeoutMs: REGISTRY_TIMEOUT_MS
16797
16792
  });
16798
- if (text2 === null || Buffer.byteLength(text2) > MAX_RESPONSE_BYTES)
16793
+ if (text === null || Buffer.byteLength(text) > MAX_RESPONSE_BYTES)
16799
16794
  return null;
16800
- const body = JSON.parse(text2);
16795
+ const body = JSON.parse(text);
16801
16796
  if (typeof body !== "object" || body === null || Array.isArray(body))
16802
16797
  return null;
16803
16798
  const tags = {};
@@ -16883,7 +16878,7 @@ function isFresh(entry, now) {
16883
16878
  const age = now.getTime() - Date.parse(entry.checkedAt);
16884
16879
  return age >= 0 && age < CHECK_INTERVAL_MS;
16885
16880
  }
16886
- function upgradeCommand(modulePath = fileURLToPath(import.meta.url), env2 = process.env) {
16881
+ function upgradeCommand(modulePath = fileURLToPath(import.meta.url), env = process.env) {
16887
16882
  const target = `${PACKAGE_NAME}@latest`;
16888
16883
  const normalized = normalizeModulePath(modulePath);
16889
16884
  if (normalized.includes(".bun/install/global"))
@@ -16894,7 +16889,7 @@ function upgradeCommand(modulePath = fileURLToPath(import.meta.url), env2 = proc
16894
16889
  if (normalized.includes("/.yarn/") || normalized.includes("/yarn/")) {
16895
16890
  return `yarn global add ${target}`;
16896
16891
  }
16897
- const agent = env2.npm_config_user_agent ?? "";
16892
+ const agent = env.npm_config_user_agent ?? "";
16898
16893
  if (agent.startsWith("pnpm/"))
16899
16894
  return `pnpm add -g ${target}`;
16900
16895
  if (agent.startsWith("yarn/"))
@@ -16905,18 +16900,18 @@ function upgradeCommand(modulePath = fileURLToPath(import.meta.url), env2 = proc
16905
16900
  }
16906
16901
  async function announceUpdateIfAvailable(options = {}) {
16907
16902
  try {
16908
- const env2 = options.env ?? process.env;
16903
+ const env = options.env ?? process.env;
16909
16904
  const isTty = options.isTty ?? process.stderr.isTTY === true;
16910
16905
  const modulePath = options.modulePath ?? fileURLToPath(import.meta.url);
16911
16906
  const cwd = options.cwd ?? process.cwd();
16912
16907
  const now = options.now ?? new Date;
16913
- if (isEnabled(env2.SIM_NO_UPDATE_CHECK))
16908
+ if (isEnabled(env.SIM_NO_UPDATE_CHECK))
16914
16909
  return;
16915
16910
  if (!isTty)
16916
16911
  return;
16917
- if (CI_VARIABLES.some((variable) => isEnabled(env2[variable])))
16912
+ if (CI_VARIABLES.some((variable) => isEnabled(env[variable])))
16918
16913
  return;
16919
- if (isUnadvisableInstall(modulePath, env2, cwd))
16914
+ if (isUnadvisableInstall(modulePath, env, cwd))
16920
16915
  return;
16921
16916
  const currentVersion = options.currentVersion ?? CLI_VERSION;
16922
16917
  const current = parseStableVersion(currentVersion);
@@ -16926,7 +16921,7 @@ async function announceUpdateIfAvailable(options = {}) {
16926
16921
  const cached = readCache(cachePath);
16927
16922
  if (cached && isFresh(cached, now))
16928
16923
  return;
16929
- const tags = await fetchDistTags(env2, options.registryRequest ?? requestRegistry);
16924
+ const tags = await fetchDistTags(env, options.registryRequest ?? requestRegistry);
16930
16925
  const latest = tags?.latest ?? null;
16931
16926
  const available = latest ? parseStableVersion(latest) : null;
16932
16927
  writeCache(cachePath, {
@@ -16938,7 +16933,7 @@ async function announceUpdateIfAvailable(options = {}) {
16938
16933
  if (!isNewerVersion(available, current))
16939
16934
  return;
16940
16935
  const write = options.write ?? ((message) => void process.stderr.write(message));
16941
- write(`Update available: sim ${currentVersion} → ${latest}. Run: ${upgradeCommand(modulePath, env2)}
16936
+ write(`Update available: sim ${currentVersion} → ${latest}. Run: ${upgradeCommand(modulePath, env)}
16942
16937
  `);
16943
16938
  } catch {}
16944
16939
  }
@@ -16979,53 +16974,53 @@ var ROOT_VALUE_FLAGS = new Set([
16979
16974
  function namesASubcommandFirst(rawArgs) {
16980
16975
  const tokens = rawArgs.slice(2);
16981
16976
  for (let index = 0;index < tokens.length; index += 1) {
16982
- const token2 = tokens[index];
16983
- if (token2 === "--version" || token2 === "-V")
16977
+ const token = tokens[index];
16978
+ if (token === "--version" || token === "-V")
16984
16979
  return false;
16985
- if (ROOT_VALUE_FLAGS.has(token2)) {
16980
+ if (ROOT_VALUE_FLAGS.has(token)) {
16986
16981
  index += 1;
16987
16982
  continue;
16988
16983
  }
16989
- if (token2.startsWith("-"))
16984
+ if (token.startsWith("-"))
16990
16985
  continue;
16991
16986
  return true;
16992
16987
  }
16993
16988
  return false;
16994
16989
  }
16995
- function addVersionOption(program2) {
16996
- program2.on("option:version", (value) => {
16990
+ function addVersionOption(program) {
16991
+ program.on("option:version", (value) => {
16997
16992
  if (value === null || value === undefined) {
16998
- const { rawArgs } = program2;
16993
+ const { rawArgs } = program;
16999
16994
  if (!namesASubcommandFirst(rawArgs ?? []))
17000
16995
  return;
17001
- program2.error("error: --version reports the Sim CLI version and is not a command flag. A command that acts on a deployment version reads it from --to-version.");
16996
+ program.error("error: --version reports the Sim CLI version and is not a command flag. A command that acts on a deployment version reads it from --to-version.");
17002
16997
  }
17003
- program2.error("error: --version reports the Sim CLI version and takes no value. A command that acts on a deployment version reads it from --to-version.");
16998
+ program.error("error: --version reports the Sim CLI version and takes no value. A command that acts on a deployment version reads it from --to-version.");
17004
16999
  });
17005
- program2.version(CLI_VERSION, "-V, --version [none]", "output the version number (takes no value)");
17000
+ program.version(CLI_VERSION, "-V, --version [none]", "output the version number (takes no value)");
17006
17001
  }
17007
17002
  function buildProgram(options = {}) {
17008
- const program2 = new Command;
17009
- program2.name("sim").description(PROGRAM_DESCRIPTION);
17003
+ const program = new Command;
17004
+ program.name("sim").description(PROGRAM_DESCRIPTION);
17010
17005
  if (options.version !== false)
17011
- addVersionOption(program2);
17012
- program2.option("-P, --profile <name>", "Profile to use (env: SIM_PROFILE)").option("--endpoint <url>", "Sim deployment to talk to (env: SIM_ENDPOINT)").option("-w, --workspace <id>", "Workspace to target (env: SIM_WORKSPACE)").addOption(new Option("--output <format>", "Output format for this command").choices([...OUTPUT_FORMATS]));
17013
- program2.addCommand(loginCommand());
17014
- program2.addCommand(logoutCommand());
17015
- program2.addCommand(whoamiCommand());
17016
- program2.addCommand(profilesCommand());
17017
- program2.addCommand(configureCommand());
17006
+ addVersionOption(program);
17007
+ program.option("-P, --profile <name>", "Profile to use (env: SIM_PROFILE)").option("--endpoint <url>", "Sim deployment to talk to (env: SIM_ENDPOINT)").option("-w, --workspace <id>", "Workspace to target (env: SIM_WORKSPACE)").addOption(new Option("--output <format>", "Output format for this command").choices([...OUTPUT_FORMATS]));
17008
+ program.addCommand(loginCommand());
17009
+ program.addCommand(logoutCommand());
17010
+ program.addCommand(whoamiCommand());
17011
+ program.addCommand(profilesCommand());
17012
+ program.addCommand(configureCommand());
17018
17013
  for (const command of buildGeneratedCommands()) {
17019
- program2.addCommand(command);
17020
- }
17021
- attachCredentialCommands(program2);
17022
- attachProtocolCommands(program2);
17023
- attachSecretCommands(program2);
17024
- program2.addHelpText("after", HELP_EPILOGUE);
17025
- program2.hook("preAction", () => announceUpdateIfAvailable());
17026
- refuseHelpAfterUnknownCommand(program2);
17027
- assertNoReservedProgramFlags(program2);
17028
- return program2;
17014
+ program.addCommand(command);
17015
+ }
17016
+ attachCredentialCommands(program);
17017
+ attachProtocolCommands(program);
17018
+ attachSecretCommands(program);
17019
+ program.addHelpText("after", HELP_EPILOGUE);
17020
+ program.hook("preAction", () => announceUpdateIfAvailable());
17021
+ refuseHelpAfterUnknownCommand(program);
17022
+ assertNoReservedProgramFlags(program);
17023
+ return program;
17029
17024
  }
17030
17025
 
17031
17026
  // src/index.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sim",
3
- "version": "2.1.6-preview.90.1",
3
+ "version": "2.1.7-preview.92.1",
4
4
  "description": "Sim CLI - talk to the Sim API from your terminal",
5
5
  "type": "module",
6
6
  "bin": {