@gapi/gcli 1.8.250 → 1.8.251

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/release/index.js CHANGED
@@ -12391,7 +12391,7 @@ var require_lastValueFrom = __commonJS({
12391
12391
  Object.defineProperty(exports2, "__esModule", { value: true });
12392
12392
  exports2.lastValueFrom = void 0;
12393
12393
  var EmptyError_1 = require_EmptyError();
12394
- function lastValueFrom57(source, config2) {
12394
+ function lastValueFrom59(source, config2) {
12395
12395
  var hasConfig = typeof config2 === "object";
12396
12396
  return new Promise(function(resolve2, reject) {
12397
12397
  var _hasValue = false;
@@ -12414,7 +12414,7 @@ var require_lastValueFrom = __commonJS({
12414
12414
  });
12415
12415
  });
12416
12416
  }
12417
- exports2.lastValueFrom = lastValueFrom57;
12417
+ exports2.lastValueFrom = lastValueFrom59;
12418
12418
  }
12419
12419
  });
12420
12420
 
@@ -27839,7 +27839,7 @@ var require_auth = __commonJS({
27839
27839
  this.a = this.c;
27840
27840
  qm(this, true);
27841
27841
  };
27842
- function rm4(a, b) {
27842
+ function rm5(a, b) {
27843
27843
  if (b) return a.a = a.c, a.g();
27844
27844
  b = a.a;
27845
27845
  a.a *= 2;
@@ -27848,7 +27848,7 @@ var require_auth = __commonJS({
27848
27848
  }
27849
27849
  function qm(a, b) {
27850
27850
  a.stop();
27851
- a.b = Bd(rm4(a, b)).then(function() {
27851
+ a.b = Bd(rm5(a, b)).then(function() {
27852
27852
  return Ye();
27853
27853
  }).then(function() {
27854
27854
  return a.h();
@@ -29867,7 +29867,7 @@ var require_buffer_list = __commonJS({
29867
29867
  }
29868
29868
  }, {
29869
29869
  key: "join",
29870
- value: function join4(s2) {
29870
+ value: function join6(s2) {
29871
29871
  if (this.length === 0) return "";
29872
29872
  var p = this.head;
29873
29873
  var ret = "" + p.data;
@@ -32885,7 +32885,7 @@ var require_buffer_list2 = __commonJS({
32885
32885
  }
32886
32886
  }, {
32887
32887
  key: "join",
32888
- value: function join4(s2) {
32888
+ value: function join6(s2) {
32889
32889
  if (this.length === 0) return "";
32890
32890
  var p = this.head;
32891
32891
  var ret = "" + p.data;
@@ -37294,6 +37294,29 @@ var init_gql_client = __esm({
37294
37294
  variables: { clusterId, includeCloud }
37295
37295
  }).pipe((0, import_operators.map)((res) => res.clusterNodes ?? []));
37296
37296
  }
37297
+ static clusterTalosconfig(projectId, clusterId, ttlMinutes) {
37298
+ return this.query({
37299
+ query: gql`
37300
+ query clusterTalosconfig(
37301
+ $projectId: String!
37302
+ $clusterId: String!
37303
+ $ttlMinutes: Int
37304
+ ) {
37305
+ clusterTalosconfig(
37306
+ projectId: $projectId
37307
+ clusterId: $clusterId
37308
+ ttlMinutes: $ttlMinutes
37309
+ ) {
37310
+ talosconfig
37311
+ expiresAt
37312
+ endpoint
37313
+ talosVersion
37314
+ }
37315
+ }
37316
+ `,
37317
+ variables: { projectId, clusterId, ttlMinutes }
37318
+ }).pipe((0, import_operators.map)((res) => res.clusterTalosconfig));
37319
+ }
37297
37320
  static setClusterNodePaused(clusterId, name2, paused) {
37298
37321
  return this.query({
37299
37322
  query: gql`
@@ -38695,7 +38718,7 @@ var require_util = __commonJS({
38695
38718
  return path2;
38696
38719
  }
38697
38720
  exports2.normalize = normalize2;
38698
- function join4(aRoot, aPath) {
38721
+ function join6(aRoot, aPath) {
38699
38722
  if (aRoot === "") {
38700
38723
  aRoot = ".";
38701
38724
  }
@@ -38727,7 +38750,7 @@ var require_util = __commonJS({
38727
38750
  }
38728
38751
  return joined;
38729
38752
  }
38730
- exports2.join = join4;
38753
+ exports2.join = join6;
38731
38754
  exports2.isAbsolute = function(aPath) {
38732
38755
  return aPath.charAt(0) === "/" || urlRegexp.test(aPath);
38733
38756
  };
@@ -38900,7 +38923,7 @@ var require_util = __commonJS({
38900
38923
  parsed.path = parsed.path.substring(0, index + 1);
38901
38924
  }
38902
38925
  }
38903
- sourceURL = join4(urlGenerate(parsed), sourceURL);
38926
+ sourceURL = join6(urlGenerate(parsed), sourceURL);
38904
38927
  }
38905
38928
  return normalize2(sourceURL);
38906
38929
  }
@@ -43026,7 +43049,7 @@ var require_typescript = __commonJS({
43026
43049
  walkUpParenthesizedTypesAndGetParentAndChild: () => walkUpParenthesizedTypesAndGetParentAndChild,
43027
43050
  whitespaceOrMapCommentRegExp: () => whitespaceOrMapCommentRegExp,
43028
43051
  writeCommentRange: () => writeCommentRange,
43029
- writeFile: () => writeFile10,
43052
+ writeFile: () => writeFile13,
43030
43053
  writeFileEnsuringDirectories: () => writeFileEnsuringDirectories,
43031
43054
  zipWith: () => zipWith
43032
43055
  });
@@ -61669,7 +61692,7 @@ ${lanes.join("\n")}
61669
61692
  sourceFilePath = isSourceFileInCommonSourceDirectory ? sourceFilePath.substring(commonSourceDirectory.length) : sourceFilePath;
61670
61693
  return combinePaths(newDirPath, sourceFilePath);
61671
61694
  }
61672
- function writeFile10(host, diagnostics, fileName, text, writeByteOrderMark, sourceFiles, data) {
61695
+ function writeFile13(host, diagnostics, fileName, text, writeByteOrderMark, sourceFiles, data) {
61673
61696
  host.writeFile(
61674
61697
  fileName,
61675
61698
  text,
@@ -74191,8 +74214,8 @@ ${lanes.join("\n")}
74191
74214
  return void 0;
74192
74215
  }
74193
74216
  function tryRenameExternalModule(factory2, moduleName, sourceFile) {
74194
- const rename = sourceFile.renamedDependencies && sourceFile.renamedDependencies.get(moduleName.text);
74195
- return rename ? factory2.createStringLiteral(rename) : void 0;
74217
+ const rename2 = sourceFile.renamedDependencies && sourceFile.renamedDependencies.get(moduleName.text);
74218
+ return rename2 ? factory2.createStringLiteral(rename2) : void 0;
74196
74219
  }
74197
74220
  function tryGetModuleNameFromFile(factory2, file2, host, options) {
74198
74221
  if (!file2) {
@@ -170420,7 +170443,7 @@ ${lanes.join("\n")}
170420
170443
  return;
170421
170444
  }
170422
170445
  const buildInfo = host.getBuildInfo() || { version: version2 };
170423
- writeFile10(
170446
+ writeFile13(
170424
170447
  host,
170425
170448
  emitterDiagnostics,
170426
170449
  buildInfoPath,
@@ -170632,7 +170655,7 @@ ${lanes.join("\n")}
170632
170655
  }
170633
170656
  if (sourceMapFilePath) {
170634
170657
  const sourceMap = sourceMapGenerator.toString();
170635
- writeFile10(
170658
+ writeFile13(
170636
170659
  host,
170637
170660
  emitterDiagnostics,
170638
170661
  sourceMapFilePath,
@@ -170647,7 +170670,7 @@ ${lanes.join("\n")}
170647
170670
  }
170648
170671
  const text = writer.getText();
170649
170672
  const data = { sourceMapUrlPos, diagnostics: transform22.diagnostics };
170650
- writeFile10(host, emitterDiagnostics, jsFilePath, text, !!compilerOptions.emitBOM, sourceFiles, data);
170673
+ writeFile13(host, emitterDiagnostics, jsFilePath, text, !!compilerOptions.emitBOM, sourceFiles, data);
170651
170674
  writer.clear();
170652
170675
  return !data.skippedDtsWrite;
170653
170676
  }
@@ -208313,19 +208336,19 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
208313
208336
  }
208314
208337
  function convertNamedExport(sourceFile, assignment, changes, exports22) {
208315
208338
  const { text } = assignment.left.name;
208316
- const rename = exports22.get(text);
208317
- if (rename !== void 0) {
208339
+ const rename2 = exports22.get(text);
208340
+ if (rename2 !== void 0) {
208318
208341
  const newNodes = [
208319
208342
  makeConst(
208320
208343
  /*modifiers*/
208321
208344
  void 0,
208322
- rename,
208345
+ rename2,
208323
208346
  assignment.right
208324
208347
  ),
208325
208348
  makeExportDeclaration([factory.createExportSpecifier(
208326
208349
  /*isTypeOnly*/
208327
208350
  false,
208328
- rename,
208351
+ rename2,
208329
208352
  text
208330
208353
  )])
208331
208354
  ];
@@ -238529,7 +238552,7 @@ ${options.prefix}` : "\n" : options.prefix
238529
238552
  walkUpParenthesizedTypesAndGetParentAndChild: () => walkUpParenthesizedTypesAndGetParentAndChild,
238530
238553
  whitespaceOrMapCommentRegExp: () => whitespaceOrMapCommentRegExp,
238531
238554
  writeCommentRange: () => writeCommentRange,
238532
- writeFile: () => writeFile10,
238555
+ writeFile: () => writeFile13,
238533
238556
  writeFileEnsuringDirectories: () => writeFileEnsuringDirectories,
238534
238557
  zipWith: () => zipWith
238535
238558
  });
@@ -255660,31 +255683,97 @@ var init_attach = __esm({
255660
255683
  ...own && !n.recorded ? { note: "joined by hand" } : {}
255661
255684
  };
255662
255685
  };
255663
- resetHint = (ip = "<machine-ip>") => `talosctl --talosconfig <cluster talosconfig> -n ${ip} -e ${ip} reset --graceful=false --reboot --system-labels-to-wipe STATE --system-labels-to-wipe EPHEMERAL`;
255686
+ resetHint = (clusterId = "<cluster-id>", name2 = "<machine-name>", ip = "<machine-ip>") => `gcli cluster:reset-machine --cluster ${clusterId} --name ${name2} --node-ip ${ip}`;
255664
255687
  }
255665
255688
  });
255666
255689
 
255667
- // src/commands/cluster/attach.ts
255668
- var attach_exports = {};
255669
- __export(attach_exports, {
255670
- default: () => attach_default
255671
- });
255672
- var import_child_process, import_promises, import_os2, import_path, import_readline, import_rxjs17, talosctl, sleep, ask, attach_default;
255673
- var init_attach2 = __esm({
255674
- "src/commands/cluster/attach.ts"() {
255690
+ // src/commands/cluster/helpers/talosctl.ts
255691
+ function talosctlAssetName(platform = process.platform, arch = process.arch) {
255692
+ const os2 = platform === "win32" ? "windows" : platform === "darwin" ? "darwin" : platform === "linux" ? "linux" : null;
255693
+ const cpu = arch === "x64" ? "amd64" : arch === "arm64" ? "arm64" : null;
255694
+ if (!os2 || !cpu) {
255695
+ throw new Error(
255696
+ `No talosctl release for ${platform}/${arch}. Install talosctl yourself: https://www.talos.dev/latest/talos-guides/install/talosctl/`
255697
+ );
255698
+ }
255699
+ return `talosctl-${os2}-${cpu}${os2 === "windows" ? ".exe" : ""}`;
255700
+ }
255701
+ function checksumFor(sums, asset) {
255702
+ for (const line of sums.split("\n")) {
255703
+ const [hash2, name2] = line.trim().split(/\s+\*?/);
255704
+ if (name2 === asset && /^[a-f0-9]{64}$/i.test(hash2 ?? "")) {
255705
+ return hash2.toLowerCase();
255706
+ }
255707
+ }
255708
+ return null;
255709
+ }
255710
+ async function download(url2) {
255711
+ const res = await fetch(url2);
255712
+ if (!res.ok) {
255713
+ throw new Error(`Download failed (${res.status}): ${url2}`);
255714
+ }
255715
+ return Buffer.from(await res.arrayBuffer());
255716
+ }
255717
+ async function ensureTalosctl(version2) {
255718
+ if (!VERSION_RE.test(version2)) {
255719
+ throw new Error(`Unknown Talos version "${version2}"`);
255720
+ }
255721
+ const onPath = await runBinary("talosctl", [
255722
+ "version",
255723
+ "--client",
255724
+ "--short"
255725
+ ]);
255726
+ if (onPath.code === 0 && clientVersionOf(onPath.stdout) === version2) {
255727
+ return "talosctl";
255728
+ }
255729
+ const asset = talosctlAssetName();
255730
+ const dir = (0, import_path.join)(mainDirectory, "bin");
255731
+ const binary = (0, import_path.join)(
255732
+ dir,
255733
+ `talosctl-${version2}${asset.endsWith(".exe") ? ".exe" : ""}`
255734
+ );
255735
+ if ((0, import_fs3.existsSync)(binary)) {
255736
+ return binary;
255737
+ }
255738
+ Logger.info(
255739
+ `Downloading talosctl ${version2} (${asset}, about 90 MB, once) from the Talos releases ...`
255740
+ );
255741
+ const sums = (await download(`${RELEASES}/${version2}/sha256sum.txt`)).toString("utf8");
255742
+ const expected = checksumFor(sums, asset);
255743
+ if (!expected) {
255744
+ throw new Error(`The ${version2} release lists no checksum for ${asset}.`);
255745
+ }
255746
+ const body = await download(`${RELEASES}/${version2}/${asset}`);
255747
+ const actual = (0, import_crypto.createHash)("sha256").update(body).digest("hex");
255748
+ if (actual !== expected) {
255749
+ throw new Error(
255750
+ `Checksum mismatch for ${asset} ${version2} - the download was not used.`
255751
+ );
255752
+ }
255753
+ await (0, import_promises.mkdir)(dir, { recursive: true });
255754
+ const partial2 = `${binary}.partial`;
255755
+ await (0, import_promises.writeFile)(partial2, body, { mode: 493 });
255756
+ await (0, import_promises.chmod)(partial2, 493);
255757
+ await (0, import_promises.rename)(partial2, binary);
255758
+ Logger.info(`talosctl ${version2} saved to ${binary}`);
255759
+ return binary;
255760
+ }
255761
+ var import_child_process, import_crypto, import_fs3, import_promises, import_path, RELEASES, VERSION_RE, clientVersionOf, runBinary;
255762
+ var init_talosctl = __esm({
255763
+ "src/commands/cluster/helpers/talosctl.ts"() {
255675
255764
  import_child_process = require("child_process");
255765
+ import_crypto = require("crypto");
255766
+ import_fs3 = require("fs");
255676
255767
  import_promises = require("fs/promises");
255677
- import_os2 = require("os");
255678
255768
  import_path = require("path");
255679
- import_readline = require("readline");
255680
- import_rxjs17 = __toESM(require_cjs());
255681
- init_gql_client();
255682
255769
  init_log();
255683
- init_attach();
255684
- init_cluster_change();
255685
- talosctl = (args, timeoutMs = 2e4) => new Promise(
255770
+ init_types();
255771
+ RELEASES = "https://github.com/siderolabs/talos/releases/download";
255772
+ VERSION_RE = /^v\d+\.\d+\.\d+$/;
255773
+ clientVersionOf = (output) => output.match(/Talos (v\d+\.\d+\.\d+\S*)/)?.[1] ?? null;
255774
+ runBinary = (binary, args, timeoutMs = 2e4) => new Promise(
255686
255775
  (resolve2) => (0, import_child_process.execFile)(
255687
- "talosctl",
255776
+ binary,
255688
255777
  args,
255689
255778
  { timeout: timeoutMs, maxBuffer: 10 * 1024 * 1024 },
255690
255779
  (error48, stdout, stderr) => resolve2({
@@ -255694,6 +255783,27 @@ var init_attach2 = __esm({
255694
255783
  })
255695
255784
  )
255696
255785
  );
255786
+ }
255787
+ });
255788
+
255789
+ // src/commands/cluster/attach.ts
255790
+ var attach_exports = {};
255791
+ __export(attach_exports, {
255792
+ default: () => attach_default
255793
+ });
255794
+ var import_promises2, import_os2, import_path2, import_readline, import_rxjs17, sleep, ask, attach_default;
255795
+ var init_attach2 = __esm({
255796
+ "src/commands/cluster/attach.ts"() {
255797
+ import_promises2 = require("fs/promises");
255798
+ import_os2 = require("os");
255799
+ import_path2 = require("path");
255800
+ import_readline = require("readline");
255801
+ import_rxjs17 = __toESM(require_cjs());
255802
+ init_gql_client();
255803
+ init_log();
255804
+ init_attach();
255805
+ init_cluster_change();
255806
+ init_talosctl();
255697
255807
  sleep = (ms) => new Promise((r2) => setTimeout(r2, ms));
255698
255808
  ask = (question) => new Promise((resolve2) => {
255699
255809
  const rl = (0, import_readline.createInterface)({
@@ -255716,9 +255826,11 @@ var init_attach2 = __esm({
255716
255826
  info.reason ?? "Machines cannot be attached to this cluster."
255717
255827
  );
255718
255828
  }
255829
+ const binary = info.talosVersion ? await ensureTalosctl(info.talosVersion) : "talosctl";
255830
+ const talosctl = (args, timeoutMs = 2e4) => runBinary(binary, args, timeoutMs);
255719
255831
  if ((await talosctl(["version", "--client"])).code !== 0) {
255720
255832
  throw new Error(
255721
- "talosctl is not installed. Install it (https://www.talos.dev/latest/talos-guides/install/talosctl/) - e.g. curl -sL https://talos.dev/install | sh"
255833
+ "talosctl is not available. Install it: https://www.talos.dev/latest/talos-guides/install/talosctl/"
255722
255834
  );
255723
255835
  }
255724
255836
  Logger.info(`Looking for the Talos installer at ${opts.nodeIp}:50000 ...`);
@@ -255778,10 +255890,10 @@ var init_attach2 = __esm({
255778
255890
  `The cluster runs Talos ${join_.talosVersion}, the machine booted ${version2}. It installs ${join_.talosVersion} anyway; if the join fails, boot ${join_.isoUrl}.`
255779
255891
  );
255780
255892
  }
255781
- const dir = await (0, import_promises.mkdtemp)((0, import_path.join)((0, import_os2.tmpdir)(), "gcli-attach-"));
255782
- const file2 = (0, import_path.join)(dir, "machine.yaml");
255893
+ const dir = await (0, import_promises2.mkdtemp)((0, import_path2.join)((0, import_os2.tmpdir)(), "gcli-attach-"));
255894
+ const file2 = (0, import_path2.join)(dir, "machine.yaml");
255783
255895
  try {
255784
- await (0, import_promises.writeFile)(file2, join_.config, { mode: 384 });
255896
+ await (0, import_promises2.writeFile)(file2, join_.config, { mode: 384 });
255785
255897
  const applied = await talosctl(
255786
255898
  ["-n", opts.nodeIp, "apply-config", "--insecure", "--file", file2],
255787
255899
  6e4
@@ -255792,7 +255904,7 @@ var init_attach2 = __esm({
255792
255904
  );
255793
255905
  }
255794
255906
  } finally {
255795
- await (0, import_promises.rm)(dir, { recursive: true, force: true });
255907
+ await (0, import_promises2.rm)(dir, { recursive: true, force: true });
255796
255908
  }
255797
255909
  Logger.info(
255798
255910
  `Config applied - ${opts.name} installs Talos and reboots, then joins "${join_.clusterName}" (pool ${join_.pool}, ${join_.reserved ? "reserved" : "extra capacity"}).`
@@ -255816,7 +255928,7 @@ var init_attach2 = __esm({
255816
255928
  }
255817
255929
  }
255818
255930
  Logger.warn(
255819
- `${opts.name} has not joined yet. Check gcli cluster:nodes later; if it never joins, reset it (${resetHint(opts.nodeIp)}) and attach again.`
255931
+ `${opts.name} has not joined yet. Check gcli cluster:nodes later; if it never joins, reset it (${resetHint(clusterId, opts.name, opts.nodeIp)}) and attach again.`
255820
255932
  );
255821
255933
  };
255822
255934
  }
@@ -255885,16 +255997,170 @@ var init_pause = __esm({
255885
255997
  }
255886
255998
  });
255887
255999
 
256000
+ // src/commands/cluster/reset-machine.ts
256001
+ var reset_machine_exports = {};
256002
+ __export(reset_machine_exports, {
256003
+ default: () => reset_machine_default,
256004
+ hostnameOf: () => hostnameOf
256005
+ });
256006
+ var import_promises3, import_os3, import_path3, import_readline2, import_rxjs20, hostnameOf, reset_machine_default;
256007
+ var init_reset_machine = __esm({
256008
+ "src/commands/cluster/reset-machine.ts"() {
256009
+ import_promises3 = require("fs/promises");
256010
+ import_os3 = require("os");
256011
+ import_path3 = require("path");
256012
+ import_readline2 = require("readline");
256013
+ import_rxjs20 = __toESM(require_cjs());
256014
+ init_gql_client();
256015
+ init_log();
256016
+ init_attach();
256017
+ init_cluster_change();
256018
+ init_talosctl();
256019
+ hostnameOf = (yaml) => yaml.match(/^\s*hostname:\s*(\S+)/m)?.[1] ?? null;
256020
+ reset_machine_default = async (cmd) => {
256021
+ const name2 = (cmd.name ?? "").trim();
256022
+ const ip = (cmd.nodeIp ?? "").trim();
256023
+ if (!NAME_RE.test(name2)) {
256024
+ throw new Error(
256025
+ "--name is required: the machine name (see gcli cluster:nodes)"
256026
+ );
256027
+ }
256028
+ if (!HOST_RE.test(ip)) {
256029
+ throw new Error(
256030
+ "--node-ip is required: the machine's address on your network"
256031
+ );
256032
+ }
256033
+ const { projectId, clusterId } = await resolveClusterTarget(cmd);
256034
+ const node = (await (0, import_rxjs20.lastValueFrom)(GraphqlClienAPI.clusterNodes(clusterId, true))).find((n) => n.name === name2);
256035
+ if (node?.source === "hetzner") {
256036
+ throw new Error(
256037
+ `${name2} is a Hetzner node - those are removed by scaling the cluster.`
256038
+ );
256039
+ }
256040
+ if (node && (node.status === "ready" || node.status === "not-ready")) {
256041
+ throw new Error(
256042
+ `${name2} is still in the cluster. Detach it first: gcli cluster:detach --cluster ${clusterId} --name ${name2}`
256043
+ );
256044
+ }
256045
+ const access = await (0, import_rxjs20.lastValueFrom)(
256046
+ GraphqlClienAPI.clusterTalosconfig(projectId, clusterId, 15)
256047
+ );
256048
+ const binary = access.talosVersion ? await ensureTalosctl(access.talosVersion) : "talosctl";
256049
+ const dir = await (0, import_promises3.mkdtemp)((0, import_path3.join)((0, import_os3.tmpdir)(), "gcli-reset-"));
256050
+ const config2 = (0, import_path3.join)(dir, "talosconfig");
256051
+ try {
256052
+ await (0, import_promises3.writeFile)(config2, access.talosconfig, { mode: 384 });
256053
+ const talos = (args, timeoutMs = 3e4) => runBinary(
256054
+ binary,
256055
+ ["--talosconfig", config2, "-e", ip, "-n", ip, ...args],
256056
+ timeoutMs
256057
+ );
256058
+ const status2 = await talos(["get", "hostnamestatus", "-o", "yaml"]);
256059
+ if (status2.code !== 0) {
256060
+ throw new Error(
256061
+ `Cannot reach the machine at ${ip} with this cluster's credentials: ${(status2.stderr || status2.stdout).trim().split("\n")[0]}. It must be on this network and still configured for this cluster (a machine in maintenance mode needs no reset).`
256062
+ );
256063
+ }
256064
+ const actual = hostnameOf(status2.stdout);
256065
+ if (actual !== name2) {
256066
+ throw new Error(
256067
+ `The machine at ${ip} is "${actual ?? "unknown"}", not "${name2}" - nothing was changed.`
256068
+ );
256069
+ }
256070
+ if (!cmd.yes) {
256071
+ const answer = await new Promise((resolve2) => {
256072
+ const rl = (0, import_readline2.createInterface)({
256073
+ input: process.stdin,
256074
+ output: process.stdout
256075
+ });
256076
+ rl.question(
256077
+ `Wipe the config and data of ${name2} (${ip})? It reboots into maintenance mode, ready to attach again. Type the machine name to continue: `,
256078
+ (a) => {
256079
+ rl.close();
256080
+ resolve2(a.trim());
256081
+ }
256082
+ );
256083
+ });
256084
+ if (answer !== name2) {
256085
+ Logger.warn("Cancelled - nothing was changed.");
256086
+ return;
256087
+ }
256088
+ }
256089
+ const reset = await talos(
256090
+ [
256091
+ "reset",
256092
+ "--graceful=false",
256093
+ "--reboot",
256094
+ "--wait=false",
256095
+ "--system-labels-to-wipe",
256096
+ "STATE",
256097
+ "--system-labels-to-wipe",
256098
+ "EPHEMERAL"
256099
+ ],
256100
+ 6e4
256101
+ );
256102
+ if (reset.code !== 0) {
256103
+ throw new Error(
256104
+ `Reset failed: ${(reset.stderr || reset.stdout).trim().split("\n")[0]}`
256105
+ );
256106
+ }
256107
+ Logger.log(
256108
+ `${name2} is resetting. In a few minutes its screen shows "Maintenance"; attach it again with gcli cluster:attach.`
256109
+ );
256110
+ } finally {
256111
+ await (0, import_promises3.rm)(dir, { recursive: true, force: true });
256112
+ }
256113
+ };
256114
+ }
256115
+ });
256116
+
256117
+ // src/commands/cluster/talosconfig.ts
256118
+ var talosconfig_exports = {};
256119
+ __export(talosconfig_exports, {
256120
+ default: () => talosconfig_default
256121
+ });
256122
+ var import_promises4, import_rxjs21, talosconfig_default;
256123
+ var init_talosconfig = __esm({
256124
+ "src/commands/cluster/talosconfig.ts"() {
256125
+ import_promises4 = require("fs/promises");
256126
+ import_rxjs21 = __toESM(require_cjs());
256127
+ init_gql_client();
256128
+ init_log();
256129
+ init_cluster_change();
256130
+ talosconfig_default = async (cmd) => {
256131
+ const ttl = cmd.ttl === void 0 ? void 0 : Number(cmd.ttl);
256132
+ if (ttl !== void 0 && (!Number.isInteger(ttl) || ttl < 5 || ttl > 1440)) {
256133
+ throw new Error("--ttl is in minutes, 5 to 1440");
256134
+ }
256135
+ const { projectId, clusterId } = await resolveClusterTarget(cmd);
256136
+ const res = await (0, import_rxjs21.lastValueFrom)(
256137
+ GraphqlClienAPI.clusterTalosconfig(projectId, clusterId, ttl)
256138
+ );
256139
+ if (!cmd.output) {
256140
+ process.stdout.write(res.talosconfig);
256141
+ return;
256142
+ }
256143
+ await (0, import_promises4.writeFile)(cmd.output, res.talosconfig, { mode: 384 });
256144
+ Logger.log(
256145
+ `Wrote talosconfig to ${cmd.output} (valid until ${res.expiresAt}).`
256146
+ );
256147
+ Logger.info(
256148
+ `Use it with: talosctl --talosconfig ${cmd.output} -n <node-ip> <command> (Talos ${res.talosVersion ?? ""})`
256149
+ );
256150
+ };
256151
+ }
256152
+ });
256153
+
255888
256154
  // src/commands/cluster/detach.ts
255889
256155
  var detach_exports = {};
255890
256156
  __export(detach_exports, {
255891
256157
  default: () => detach_default
255892
256158
  });
255893
- var import_readline2, import_rxjs20, detach_default;
256159
+ var import_readline3, import_rxjs22, detach_default;
255894
256160
  var init_detach = __esm({
255895
256161
  "src/commands/cluster/detach.ts"() {
255896
- import_readline2 = require("readline");
255897
- import_rxjs20 = __toESM(require_cjs());
256162
+ import_readline3 = require("readline");
256163
+ import_rxjs22 = __toESM(require_cjs());
255898
256164
  init_gql_client();
255899
256165
  init_log();
255900
256166
  init_attach();
@@ -255907,7 +256173,7 @@ var init_detach = __esm({
255907
256173
  const { clusterId } = await resolveClusterTarget(cmd);
255908
256174
  if (!cmd.yes) {
255909
256175
  const answer = await new Promise((resolve2) => {
255910
- const rl = (0, import_readline2.createInterface)({
256176
+ const rl = (0, import_readline3.createInterface)({
255911
256177
  input: process.stdin,
255912
256178
  output: process.stdout
255913
256179
  });
@@ -255924,12 +256190,12 @@ var init_detach = __esm({
255924
256190
  return;
255925
256191
  }
255926
256192
  }
255927
- const node = await (0, import_rxjs20.lastValueFrom)(
256193
+ const node = await (0, import_rxjs22.lastValueFrom)(
255928
256194
  GraphqlClienAPI.detachClusterNode(clusterId, name2)
255929
256195
  );
255930
256196
  Logger.log(`${node.name} is detached.`);
255931
256197
  Logger.info(
255932
- `The machine still runs Talos. To reuse it, reset it from its network: ${resetHint()}`
256198
+ `The machine still runs Talos. To attach it again (or anywhere else), reset it from its network: ${resetHint(clusterId, node.name)}`
255933
256199
  );
255934
256200
  };
255935
256201
  }
@@ -255940,17 +256206,17 @@ var health_exports = {};
255940
256206
  __export(health_exports, {
255941
256207
  default: () => health_default
255942
256208
  });
255943
- var import_rxjs21, pct2, health_default;
256209
+ var import_rxjs23, pct2, health_default;
255944
256210
  var init_health = __esm({
255945
256211
  "src/commands/cluster/health.ts"() {
255946
- import_rxjs21 = __toESM(require_cjs());
256212
+ import_rxjs23 = __toESM(require_cjs());
255947
256213
  init_gql_client();
255948
256214
  init_log();
255949
256215
  init_cluster_change();
255950
256216
  pct2 = (v) => v == null ? "-" : `${Math.round(v)}%`;
255951
256217
  health_default = async (cmd) => {
255952
256218
  const { projectId, clusterId } = await resolveClusterTarget(cmd);
255953
- const [latest] = await (0, import_rxjs21.lastValueFrom)(
256219
+ const [latest] = await (0, import_rxjs23.lastValueFrom)(
255954
256220
  GraphqlClienAPI.clusterHealth(projectId, clusterId, 1)
255955
256221
  );
255956
256222
  Logger.log("-------------------");
@@ -255997,17 +256263,17 @@ var scale_events_exports = {};
255997
256263
  __export(scale_events_exports, {
255998
256264
  default: () => scale_events_default
255999
256265
  });
256000
- var import_rxjs22, scale_events_default;
256266
+ var import_rxjs24, scale_events_default;
256001
256267
  var init_scale_events = __esm({
256002
256268
  "src/commands/cluster/scale-events.ts"() {
256003
- import_rxjs22 = __toESM(require_cjs());
256269
+ import_rxjs24 = __toESM(require_cjs());
256004
256270
  init_gql_client();
256005
256271
  init_log();
256006
256272
  init_cluster_change();
256007
256273
  scale_events_default = async (cmd) => {
256008
256274
  const limit = cmd.limit === void 0 ? 20 : parseIntOption("limit", cmd.limit, 1, 200);
256009
256275
  const { projectId, clusterId } = await resolveClusterTarget(cmd);
256010
- const events = await (0, import_rxjs22.lastValueFrom)(
256276
+ const events = await (0, import_rxjs24.lastValueFrom)(
256011
256277
  GraphqlClienAPI.clusterScaleEvents(projectId, clusterId, limit)
256012
256278
  );
256013
256279
  Logger.log("-------------------");
@@ -256037,17 +256303,17 @@ var cost_exports = {};
256037
256303
  __export(cost_exports, {
256038
256304
  default: () => cost_default
256039
256305
  });
256040
- var import_rxjs23, money, cost_default;
256306
+ var import_rxjs25, money, cost_default;
256041
256307
  var init_cost = __esm({
256042
256308
  "src/commands/cluster/cost.ts"() {
256043
- import_rxjs23 = __toESM(require_cjs());
256309
+ import_rxjs25 = __toESM(require_cjs());
256044
256310
  init_helpers();
256045
256311
  init_gql_client();
256046
256312
  init_log();
256047
256313
  money = (v, sign = "\u20AC") => v == null ? "-" : `${sign}${v.toFixed(2)}`;
256048
256314
  cost_default = async (cmd) => {
256049
- const projectId = await (0, import_rxjs23.lastValueFrom)(parseProjectId(cmd.project));
256050
- const rows = await (0, import_rxjs23.lastValueFrom)(
256315
+ const projectId = await (0, import_rxjs25.lastValueFrom)(parseProjectId(cmd.project));
256316
+ const rows = await (0, import_rxjs25.lastValueFrom)(
256051
256317
  GraphqlClienAPI.projectClustersOverview(projectId)
256052
256318
  );
256053
256319
  Logger.log("-------------------");
@@ -256135,10 +256401,10 @@ __export(autoscale_exports, {
256135
256401
  default: () => autoscale_default,
256136
256402
  toAutoscaleInput: () => toAutoscaleInput
256137
256403
  });
256138
- var import_rxjs24, toAutoscaleInput, autoscale_default;
256404
+ var import_rxjs26, toAutoscaleInput, autoscale_default;
256139
256405
  var init_autoscale = __esm({
256140
256406
  "src/commands/cluster/autoscale.ts"() {
256141
- import_rxjs24 = __toESM(require_cjs());
256407
+ import_rxjs26 = __toESM(require_cjs());
256142
256408
  init_gql_client();
256143
256409
  init_log();
256144
256410
  init_cluster_change();
@@ -256179,7 +256445,7 @@ var init_autoscale = __esm({
256179
256445
  autoscale_default = async (cmd) => {
256180
256446
  const input = toAutoscaleInput(cmd);
256181
256447
  const { projectId, clusterId } = await resolveClusterTarget(cmd);
256182
- const cluster = await (0, import_rxjs24.lastValueFrom)(
256448
+ const cluster = await (0, import_rxjs26.lastValueFrom)(
256183
256449
  GraphqlClienAPI.updateProjectClusterAutoscale(projectId, clusterId, input)
256184
256450
  );
256185
256451
  const a = cluster.autoscale ?? {};
@@ -256287,15 +256553,15 @@ var list_environments_exports = {};
256287
256553
  __export(list_environments_exports, {
256288
256554
  default: () => list_environments_default
256289
256555
  });
256290
- var import_rxjs25, import_operators12, list_environments_default;
256556
+ var import_rxjs27, import_operators12, list_environments_default;
256291
256557
  var init_list_environments = __esm({
256292
256558
  "src/commands/environment/list-environments.ts"() {
256293
- import_rxjs25 = __toESM(require_cjs());
256559
+ import_rxjs27 = __toESM(require_cjs());
256294
256560
  import_operators12 = __toESM(require_operators());
256295
256561
  init_helpers();
256296
256562
  init_gql_client();
256297
256563
  init_log();
256298
- list_environments_default = (cmd) => (0, import_rxjs25.lastValueFrom)(
256564
+ list_environments_default = (cmd) => (0, import_rxjs27.lastValueFrom)(
256299
256565
  parseProjectId(cmd.project).pipe(
256300
256566
  (0, import_operators12.switchMap)((projectId) => GraphqlClienAPI.listEnvironments(projectId)),
256301
256567
  (0, import_operators12.tap)((data) => {
@@ -256328,10 +256594,10 @@ var create_environment_exports = {};
256328
256594
  __export(create_environment_exports, {
256329
256595
  default: () => create_environment_default
256330
256596
  });
256331
- var import_rxjs26, import_operators13, create_environment_default;
256597
+ var import_rxjs28, import_operators13, create_environment_default;
256332
256598
  var init_create_environment = __esm({
256333
256599
  "src/commands/environment/create-environment.ts"() {
256334
- import_rxjs26 = __toESM(require_cjs());
256600
+ import_rxjs28 = __toESM(require_cjs());
256335
256601
  import_operators13 = __toESM(require_operators());
256336
256602
  init_helpers();
256337
256603
  init_gql_client();
@@ -256339,7 +256605,7 @@ var init_create_environment = __esm({
256339
256605
  init_load_spec();
256340
256606
  create_environment_default = (cmd) => {
256341
256607
  const { clusterName: cmdClusterName, ...cmdRest } = cmd;
256342
- return (0, import_rxjs26.lastValueFrom)(
256608
+ return (0, import_rxjs28.lastValueFrom)(
256343
256609
  parseProjectId(cmd.project).pipe(
256344
256610
  (0, import_operators13.switchMap)(
256345
256611
  (projectId) => loadSpec(cmd.spec ?? "env.yaml").pipe(
@@ -256394,10 +256660,10 @@ var update_environment_exports = {};
256394
256660
  __export(update_environment_exports, {
256395
256661
  default: () => update_environment_default
256396
256662
  });
256397
- var import_rxjs27, import_operators14, update_environment_default;
256663
+ var import_rxjs29, import_operators14, update_environment_default;
256398
256664
  var init_update_environment = __esm({
256399
256665
  "src/commands/environment/update-environment.ts"() {
256400
- import_rxjs27 = __toESM(require_cjs());
256666
+ import_rxjs29 = __toESM(require_cjs());
256401
256667
  import_operators14 = __toESM(require_operators());
256402
256668
  init_helpers();
256403
256669
  init_gql_client();
@@ -256405,7 +256671,7 @@ var init_update_environment = __esm({
256405
256671
  init_load_spec();
256406
256672
  update_environment_default = (cmd) => {
256407
256673
  const { clusterName: cmdClusterName, ...cmdRest } = cmd;
256408
- return (0, import_rxjs27.lastValueFrom)(
256674
+ return (0, import_rxjs29.lastValueFrom)(
256409
256675
  parseProjectId(cmd.project).pipe(
256410
256676
  (0, import_operators14.switchMap)(
256411
256677
  (projectId) => loadSpec(cmd.spec ?? "env.yaml").pipe(
@@ -256461,16 +256727,16 @@ var delete_environment_exports = {};
256461
256727
  __export(delete_environment_exports, {
256462
256728
  default: () => delete_environment_default
256463
256729
  });
256464
- var import_rxjs28, import_operators15, delete_environment_default;
256730
+ var import_rxjs30, import_operators15, delete_environment_default;
256465
256731
  var init_delete_environment = __esm({
256466
256732
  "src/commands/environment/delete-environment.ts"() {
256467
- import_rxjs28 = __toESM(require_cjs());
256733
+ import_rxjs30 = __toESM(require_cjs());
256468
256734
  import_operators15 = __toESM(require_operators());
256469
256735
  init_helpers();
256470
256736
  init_gql_client();
256471
256737
  init_log();
256472
256738
  init_load_spec();
256473
- delete_environment_default = (cmd) => (0, import_rxjs28.lastValueFrom)(
256739
+ delete_environment_default = (cmd) => (0, import_rxjs30.lastValueFrom)(
256474
256740
  parseProjectId(cmd.project).pipe(
256475
256741
  (0, import_operators15.switchMap)(
256476
256742
  (projectId) => loadSpec(cmd.spec ?? "env.yaml").pipe(
@@ -256523,16 +256789,16 @@ var get_environment_exports = {};
256523
256789
  __export(get_environment_exports, {
256524
256790
  default: () => get_environment_default
256525
256791
  });
256526
- var import_rxjs29, import_operators16, get_environment_default;
256792
+ var import_rxjs31, import_operators16, get_environment_default;
256527
256793
  var init_get_environment = __esm({
256528
256794
  "src/commands/environment/get-environment.ts"() {
256529
- import_rxjs29 = __toESM(require_cjs());
256795
+ import_rxjs31 = __toESM(require_cjs());
256530
256796
  import_operators16 = __toESM(require_operators());
256531
256797
  init_helpers();
256532
256798
  init_gql_client();
256533
256799
  init_log();
256534
256800
  init_load_spec();
256535
- get_environment_default = (cmd) => (0, import_rxjs29.lastValueFrom)(
256801
+ get_environment_default = (cmd) => (0, import_rxjs31.lastValueFrom)(
256536
256802
  parseProjectId(cmd.project).pipe(
256537
256803
  (0, import_operators16.switchMap)(
256538
256804
  (projectId) => loadSpec(cmd.spec ?? "env.yaml").pipe(
@@ -270241,8 +270507,8 @@ var require_graceful_fs = __commonJS({
270241
270507
  }
270242
270508
  }
270243
270509
  var fs$writeFile = fs4.writeFile;
270244
- fs4.writeFile = writeFile10;
270245
- function writeFile10(path2, data, options, cb) {
270510
+ fs4.writeFile = writeFile13;
270511
+ function writeFile13(path2, data, options, cb) {
270246
270512
  if (typeof options === "function")
270247
270513
  cb = options, options = null;
270248
270514
  return go$writeFile(path2, data, options, cb);
@@ -270691,7 +270957,7 @@ var require_BufferList2 = __commonJS({
270691
270957
  this.head = this.tail = null;
270692
270958
  this.length = 0;
270693
270959
  };
270694
- BufferList.prototype.join = function join4(s2) {
270960
+ BufferList.prototype.join = function join6(s2) {
270695
270961
  if (this.length === 0) return "";
270696
270962
  var p = this.head;
270697
270963
  var ret = "" + p.data;
@@ -275491,7 +275757,7 @@ var require_buffer_list3 = __commonJS({
275491
275757
  }
275492
275758
  }, {
275493
275759
  key: "join",
275494
- value: function join4(s2) {
275760
+ value: function join6(s2) {
275495
275761
  if (this.length === 0) return "";
275496
275762
  var p = this.head;
275497
275763
  var ret = "" + p.data;
@@ -278833,7 +279099,7 @@ var require_buffer_list4 = __commonJS({
278833
279099
  }
278834
279100
  }, {
278835
279101
  key: "join",
278836
- value: function join4(s2) {
279102
+ value: function join6(s2) {
278837
279103
  if (this.length === 0) return "";
278838
279104
  var p = this.head;
278839
279105
  var ret = "" + p.data;
@@ -281605,7 +281871,7 @@ var require_buffer_list5 = __commonJS({
281605
281871
  }
281606
281872
  }, {
281607
281873
  key: "join",
281608
- value: function join4(s2) {
281874
+ value: function join6(s2) {
281609
281875
  if (this.length === 0) return "";
281610
281876
  var p = this.head;
281611
281877
  var ret = "" + p.data;
@@ -284842,7 +285108,7 @@ var require_buffer_list6 = __commonJS({
284842
285108
  }
284843
285109
  }, {
284844
285110
  key: "join",
284845
- value: function join4(s2) {
285111
+ value: function join6(s2) {
284846
285112
  if (this.length === 0) return "";
284847
285113
  var p = this.head;
284848
285114
  var ret = "" + p.data;
@@ -287790,22 +288056,22 @@ var package_exports = {};
287790
288056
  __export(package_exports, {
287791
288057
  default: () => package_default
287792
288058
  });
287793
- var import_archiver, import_child_process2, import_fs3, import_rxjs30, import_operators17, import_util3, ReadFile, package_default;
288059
+ var import_archiver, import_child_process2, import_fs4, import_rxjs32, import_operators17, import_util3, ReadFile, package_default;
287794
288060
  var init_package = __esm({
287795
288061
  "src/commands/lambda/package.ts"() {
287796
288062
  import_archiver = __toESM(require_archiver());
287797
288063
  import_child_process2 = require("child_process");
287798
- import_fs3 = require("fs");
287799
- import_rxjs30 = __toESM(require_cjs());
288064
+ import_fs4 = require("fs");
288065
+ import_rxjs32 = __toESM(require_cjs());
287800
288066
  import_operators17 = __toESM(require_operators());
287801
288067
  import_util3 = require("util");
287802
288068
  init_helpers2();
287803
288069
  init_load_spec();
287804
288070
  init_parse_ignore();
287805
288071
  init_read_file();
287806
- ReadFile = (file2) => readFileAsObservable(file2).pipe((0, import_operators17.catchError)(() => (0, import_rxjs30.of)("")));
288072
+ ReadFile = (file2) => readFileAsObservable(file2).pipe((0, import_operators17.catchError)(() => (0, import_rxjs32.of)("")));
287807
288073
  package_default = (cmd) => {
287808
- return (0, import_rxjs30.lastValueFrom)(
288074
+ return (0, import_rxjs32.lastValueFrom)(
287809
288075
  loadSpec(cmd.spec).pipe(
287810
288076
  (0, import_operators17.map)((spec) => spec?.function ?? spec),
287811
288077
  (0, import_operators17.switchMap)(async (data) => {
@@ -287814,7 +288080,7 @@ var init_package = __esm({
287814
288080
  // Sets the compression level.
287815
288081
  });
287816
288082
  await (0, import_util3.promisify)(import_child_process2.exec)(["chmod", "+x", data.script].join(" "));
287817
- const ignore = await (0, import_rxjs30.lastValueFrom)(
288083
+ const ignore = await (0, import_rxjs32.lastValueFrom)(
287818
288084
  ReadFile(".gignore").pipe(
287819
288085
  (0, import_operators17.map)((ignore2) => parseIgnoredFiles(ignore2))
287820
288086
  )
@@ -287823,13 +288089,13 @@ var init_package = __esm({
287823
288089
  ignore: [".gcache/**", ...ignore]
287824
288090
  });
287825
288091
  archive.finalize();
287826
- return (0, import_rxjs30.lastValueFrom)(
287827
- (0, import_rxjs30.from)(streamToBufferPromise(archive)).pipe(
288092
+ return (0, import_rxjs32.lastValueFrom)(
288093
+ (0, import_rxjs32.from)(streamToBufferPromise(archive)).pipe(
287828
288094
  (0, import_operators17.switchMap)(
287829
- (buffer) => (0, import_rxjs30.from)((0, import_util3.promisify)(import_fs3.mkdir)(".gcache")).pipe(
287830
- (0, import_operators17.catchError)(() => (0, import_rxjs30.of)(true)),
288095
+ (buffer) => (0, import_rxjs32.from)((0, import_util3.promisify)(import_fs4.mkdir)(".gcache")).pipe(
288096
+ (0, import_operators17.catchError)(() => (0, import_rxjs32.of)(true)),
287831
288097
  (0, import_operators17.switchMap)(
287832
- () => (0, import_util3.promisify)(import_fs3.writeFile)(`.gcache/${data.name}.zip`, buffer)
288098
+ () => (0, import_util3.promisify)(import_fs4.writeFile)(`.gcache/${data.name}.zip`, buffer)
287833
288099
  )
287834
288100
  )
287835
288101
  )
@@ -287853,13 +288119,13 @@ function streamToBufferPromise(file2) {
287853
288119
  });
287854
288120
  });
287855
288121
  }
287856
- var import_form_data, import_fs4, import_rxjs31, import_operators18, import_stream_to_buffer, ReadFile2, createOrUpdateLambda, createCommand;
288122
+ var import_form_data, import_fs5, import_rxjs33, import_operators18, import_stream_to_buffer, ReadFile2, createOrUpdateLambda, createCommand;
287857
288123
  var init_helpers2 = __esm({
287858
288124
  "src/commands/lambda/helpers/index.ts"() {
287859
288125
  import_form_data = __toESM(require_form_data());
287860
- import_fs4 = require("fs");
288126
+ import_fs5 = require("fs");
287861
288127
  init_src();
287862
- import_rxjs31 = __toESM(require_cjs());
288128
+ import_rxjs33 = __toESM(require_cjs());
287863
288129
  import_operators18 = __toESM(require_operators());
287864
288130
  import_stream_to_buffer = __toESM(require_stream_to_buffer());
287865
288131
  init_helpers();
@@ -287868,14 +288134,14 @@ var init_helpers2 = __esm({
287868
288134
  init_package();
287869
288135
  init_load_spec();
287870
288136
  init_read_file();
287871
- ReadFile2 = (file2) => readFileAsObservable(file2).pipe((0, import_operators18.catchError)(() => (0, import_rxjs31.of)("")));
287872
- createOrUpdateLambda = (cmd, type) => (0, import_rxjs31.lastValueFrom)(
288137
+ ReadFile2 = (file2) => readFileAsObservable(file2).pipe((0, import_operators18.catchError)(() => (0, import_rxjs33.of)("")));
288138
+ createOrUpdateLambda = (cmd, type) => (0, import_rxjs33.lastValueFrom)(
287873
288139
  parseProjectId(cmd.project).pipe(
287874
288140
  (0, import_operators18.switchMap)(
287875
288141
  (projectId) => GraphqlClienAPI.getProject(projectId).pipe((0, import_operators18.map)(() => projectId))
287876
288142
  ),
287877
288143
  (0, import_operators18.switchMap)(async (projectId) => {
287878
- const spec = await (0, import_rxjs31.lastValueFrom)(loadSpec(cmd.spec));
288144
+ const spec = await (0, import_rxjs33.lastValueFrom)(loadSpec(cmd.spec));
287879
288145
  return {
287880
288146
  projectId,
287881
288147
  ...spec?.function ?? spec
@@ -287889,10 +288155,10 @@ var init_helpers2 = __esm({
287889
288155
  }
287890
288156
  await package_default(cmd);
287891
288157
  const body = new import_form_data.default();
287892
- body.append("file[]", (0, import_fs4.createReadStream)(`.gcache/${data.name}.zip`));
287893
- const config2 = await (0, import_rxjs31.lastValueFrom)(GraphqlClienAPI.getConfig());
287894
- return (0, import_rxjs31.lastValueFrom)(
287895
- (0, import_rxjs31.from)(
288158
+ body.append("file[]", (0, import_fs5.createReadStream)(`.gcache/${data.name}.zip`));
288159
+ const config2 = await (0, import_rxjs33.lastValueFrom)(GraphqlClienAPI.getConfig());
288160
+ return (0, import_rxjs33.lastValueFrom)(
288161
+ (0, import_rxjs33.from)(
287896
288162
  fetch2(config2.uploadUrl, {
287897
288163
  method: "POST",
287898
288164
  body,
@@ -287913,23 +288179,23 @@ var init_helpers2 = __esm({
287913
288179
  );
287914
288180
  }),
287915
288181
  (0, import_operators18.switchMap)(async (payload) => {
287916
- const clusterId = await (0, import_rxjs31.lastValueFrom)(
288182
+ const clusterId = await (0, import_rxjs33.lastValueFrom)(
287917
288183
  resolveClusterId(payload.projectId, {
287918
288184
  clusterId: cmd.clusterId || payload.clusterId,
287919
288185
  clusterName: cmd.clusterName || payload.clusterName
287920
288186
  })
287921
288187
  );
287922
- return (0, import_rxjs31.lastValueFrom)(
288188
+ return (0, import_rxjs33.lastValueFrom)(
287923
288189
  GraphqlClienAPI[type]({
287924
- code: cmd.code || await (0, import_rxjs31.lastValueFrom)(ReadFile2(cmd.file || payload.file)) || "",
288190
+ code: cmd.code || await (0, import_rxjs33.lastValueFrom)(ReadFile2(cmd.file || payload.file)) || "",
287925
288191
  name: cmd.name || payload.name || "",
287926
288192
  projectId: payload.projectId,
287927
288193
  route: cmd.route || payload.route || "",
287928
- buildBashScript: cmd.buildBashScript || await (0, import_rxjs31.lastValueFrom)(ReadFile2(cmd.script || payload.script)) || "",
288194
+ buildBashScript: cmd.buildBashScript || await (0, import_rxjs33.lastValueFrom)(ReadFile2(cmd.script || payload.script)) || "",
287929
288195
  configs: cmd.configs || payload.configs || [],
287930
288196
  env: cmd.env || payload.env || "nodejs",
287931
288197
  method: cmd.method || payload.method || ["GET"],
287932
- packageJson: cmd.packageJson || await (0, import_rxjs31.lastValueFrom)(ReadFile2(cmd.package || payload.package)) || "{}",
288198
+ packageJson: cmd.packageJson || await (0, import_rxjs33.lastValueFrom)(ReadFile2(cmd.package || payload.package)) || "{}",
287933
288199
  params: cmd.params || payload.params || [],
287934
288200
  secrets: cmd.secrets || payload.secrets || [],
287935
288201
  envSecrets: cmd.envSecrets || payload.envSecrets || [],
@@ -287985,15 +288251,15 @@ var list_exports2 = {};
287985
288251
  __export(list_exports2, {
287986
288252
  default: () => list_default2
287987
288253
  });
287988
- var import_rxjs32, import_operators19, list_default2;
288254
+ var import_rxjs34, import_operators19, list_default2;
287989
288255
  var init_list2 = __esm({
287990
288256
  "src/commands/lambda/list.ts"() {
287991
- import_rxjs32 = __toESM(require_cjs());
288257
+ import_rxjs34 = __toESM(require_cjs());
287992
288258
  import_operators19 = __toESM(require_operators());
287993
288259
  init_helpers();
287994
288260
  init_gql_client();
287995
288261
  init_log();
287996
- list_default2 = (cmd) => (0, import_rxjs32.lastValueFrom)(
288262
+ list_default2 = (cmd) => (0, import_rxjs34.lastValueFrom)(
287997
288263
  parseProjectId(cmd.project).pipe(
287998
288264
  (0, import_operators19.switchMap)(
287999
288265
  (projectId) => resolveClusterId(projectId, {
@@ -288028,10 +288294,10 @@ var get_exports = {};
288028
288294
  __export(get_exports, {
288029
288295
  default: () => get_default
288030
288296
  });
288031
- var import_rxjs33, import_operators20, get_default;
288297
+ var import_rxjs35, import_operators20, get_default;
288032
288298
  var init_get = __esm({
288033
288299
  "src/commands/lambda/get.ts"() {
288034
- import_rxjs33 = __toESM(require_cjs());
288300
+ import_rxjs35 = __toESM(require_cjs());
288035
288301
  import_operators20 = __toESM(require_operators());
288036
288302
  init_helpers();
288037
288303
  init_gql_client();
@@ -288053,26 +288319,26 @@ var init_get = __esm({
288053
288319
  Logger.log("-------------------");
288054
288320
  });
288055
288321
  if (cmd.lambda) {
288056
- return (0, import_rxjs33.lastValueFrom)(
288322
+ return (0, import_rxjs35.lastValueFrom)(
288057
288323
  isMongoId(cmd.lambda).pipe(
288058
288324
  (0, import_operators20.switchMap)((id) => GraphqlClienAPI.getLambda(id)),
288059
288325
  table
288060
288326
  )
288061
288327
  );
288062
288328
  }
288063
- const spec = await (0, import_rxjs33.lastValueFrom)(loadSpec(cmd.spec));
288329
+ const spec = await (0, import_rxjs35.lastValueFrom)(loadSpec(cmd.spec));
288064
288330
  const name2 = typeof cmd.name === "string" ? cmd.name : spec.function?.name ?? spec.name;
288065
288331
  if (name2) {
288066
- return (0, import_rxjs33.lastValueFrom)(
288332
+ return (0, import_rxjs35.lastValueFrom)(
288067
288333
  parseProjectId(cmd.project).pipe(
288068
288334
  (0, import_operators20.catchError)((error48) => {
288069
288335
  if (!cmd.project) {
288070
- return (0, import_rxjs33.throwError)(
288336
+ return (0, import_rxjs35.throwError)(
288071
288337
  () => `No project id try with "gcli use --project your-project-id" to specify one
288072
288338
  Hint: "gcli lambda:get --name ${name2} --project your-project-id"`
288073
288339
  );
288074
288340
  }
288075
- return (0, import_rxjs33.throwError)(() => error48);
288341
+ return (0, import_rxjs35.throwError)(() => error48);
288076
288342
  }),
288077
288343
  (0, import_operators20.switchMap)(
288078
288344
  (projectId) => resolveClusterId(projectId, {
@@ -288129,22 +288395,22 @@ var delete_exports = {};
288129
288395
  __export(delete_exports, {
288130
288396
  default: () => delete_default
288131
288397
  });
288132
- var import_rxjs34, import_operators21, delete_default;
288398
+ var import_rxjs36, import_operators21, delete_default;
288133
288399
  var init_delete = __esm({
288134
288400
  "src/commands/lambda/delete.ts"() {
288135
- import_rxjs34 = __toESM(require_cjs());
288401
+ import_rxjs36 = __toESM(require_cjs());
288136
288402
  import_operators21 = __toESM(require_operators());
288137
288403
  init_helpers();
288138
288404
  init_gql_client();
288139
288405
  init_log();
288140
288406
  init_load_spec();
288141
288407
  delete_default = async (cmd) => {
288142
- const spec = await (0, import_rxjs34.lastValueFrom)(loadSpec(cmd.spec));
288408
+ const spec = await (0, import_rxjs36.lastValueFrom)(loadSpec(cmd.spec));
288143
288409
  const name2 = typeof cmd.name === "string" ? cmd.name : spec.function?.name ?? spec.name;
288144
288410
  const env = cmd.env ?? spec.function?.env ?? spec.env;
288145
288411
  const clusterIdHint = cmd.clusterId ?? spec.function?.clusterId ?? spec.clusterId;
288146
288412
  const clusterNameHint = cmd.clusterName ?? spec.function?.clusterName ?? spec.clusterName;
288147
- return (0, import_rxjs34.lastValueFrom)(
288413
+ return (0, import_rxjs36.lastValueFrom)(
288148
288414
  parseProjectId(cmd.project).pipe(
288149
288415
  (0, import_operators21.switchMap)(
288150
288416
  (projectId) => resolveClusterId(projectId, {
@@ -288179,10 +288445,10 @@ var logs_exports = {};
288179
288445
  __export(logs_exports, {
288180
288446
  default: () => logs_default
288181
288447
  });
288182
- var import_rxjs35, import_operators22, logs_default;
288448
+ var import_rxjs37, import_operators22, logs_default;
288183
288449
  var init_logs = __esm({
288184
288450
  "src/commands/lambda/logs.ts"() {
288185
- import_rxjs35 = __toESM(require_cjs());
288451
+ import_rxjs37 = __toESM(require_cjs());
288186
288452
  import_operators22 = __toESM(require_operators());
288187
288453
  init_helpers();
288188
288454
  init_gql_client();
@@ -288191,26 +288457,26 @@ var init_logs = __esm({
288191
288457
  logs_default = async (cmd) => {
288192
288458
  const result = (0, import_operators22.tap)(({ data }) => Logger.log(data));
288193
288459
  if (cmd.lambda) {
288194
- return (0, import_rxjs35.lastValueFrom)(
288460
+ return (0, import_rxjs37.lastValueFrom)(
288195
288461
  isMongoId(cmd.lambda).pipe(
288196
288462
  (0, import_operators22.switchMap)((id) => GraphqlClienAPI.getLambdaLogs(id)),
288197
288463
  result
288198
288464
  )
288199
288465
  );
288200
288466
  }
288201
- const spec = await (0, import_rxjs35.lastValueFrom)(loadSpec(cmd.spec));
288467
+ const spec = await (0, import_rxjs37.lastValueFrom)(loadSpec(cmd.spec));
288202
288468
  const name2 = typeof cmd.name === "string" ? cmd.name : spec.function?.name ?? spec.name;
288203
288469
  if (name2) {
288204
- return (0, import_rxjs35.lastValueFrom)(
288470
+ return (0, import_rxjs37.lastValueFrom)(
288205
288471
  parseProjectId(cmd.project).pipe(
288206
288472
  (0, import_operators22.catchError)((error48) => {
288207
288473
  if (!cmd.project) {
288208
- return (0, import_rxjs35.throwError)(
288474
+ return (0, import_rxjs37.throwError)(
288209
288475
  () => `No project id try with "gcli use --project your-project-id" to specify one
288210
288476
  Hint: "gcli lambda:logs --name ${name2} --project your-project-id"`
288211
288477
  );
288212
288478
  }
288213
- return (0, import_rxjs35.throwError)(() => error48);
288479
+ return (0, import_rxjs37.throwError)(() => error48);
288214
288480
  }),
288215
288481
  (0, import_operators22.switchMap)(
288216
288482
  (projectId) => resolveClusterId(projectId, {
@@ -288236,10 +288502,10 @@ var logs_builder_exports = {};
288236
288502
  __export(logs_builder_exports, {
288237
288503
  default: () => logs_builder_default
288238
288504
  });
288239
- var import_rxjs36, import_operators23, logs_builder_default;
288505
+ var import_rxjs38, import_operators23, logs_builder_default;
288240
288506
  var init_logs_builder = __esm({
288241
288507
  "src/commands/lambda/logs-builder.ts"() {
288242
- import_rxjs36 = __toESM(require_cjs());
288508
+ import_rxjs38 = __toESM(require_cjs());
288243
288509
  import_operators23 = __toESM(require_operators());
288244
288510
  init_helpers();
288245
288511
  init_gql_client();
@@ -288248,26 +288514,26 @@ var init_logs_builder = __esm({
288248
288514
  logs_builder_default = async (cmd) => {
288249
288515
  const result = (0, import_operators23.tap)(({ data }) => Logger.log(data));
288250
288516
  if (cmd.lambda) {
288251
- return (0, import_rxjs36.lastValueFrom)(
288517
+ return (0, import_rxjs38.lastValueFrom)(
288252
288518
  isMongoId(cmd.lambda).pipe(
288253
288519
  (0, import_operators23.switchMap)((id) => GraphqlClienAPI.getLambdaBuilderLogs(id)),
288254
288520
  result
288255
288521
  )
288256
288522
  );
288257
288523
  }
288258
- const spec = await (0, import_rxjs36.lastValueFrom)(loadSpec(cmd.spec));
288524
+ const spec = await (0, import_rxjs38.lastValueFrom)(loadSpec(cmd.spec));
288259
288525
  const name2 = typeof cmd.name === "string" ? cmd.name : spec.function?.name ?? spec.name;
288260
288526
  if (name2) {
288261
- return (0, import_rxjs36.lastValueFrom)(
288527
+ return (0, import_rxjs38.lastValueFrom)(
288262
288528
  parseProjectId(cmd.project).pipe(
288263
288529
  (0, import_operators23.catchError)((error48) => {
288264
288530
  if (!cmd.project) {
288265
- return (0, import_rxjs36.throwError)(
288531
+ return (0, import_rxjs38.throwError)(
288266
288532
  () => `No project id try with "gcli use --project your-project-id" to specify one
288267
288533
  Hint: "gcli lambda:logs --name ${name2} --project your-project-id"`
288268
288534
  );
288269
288535
  }
288270
- return (0, import_rxjs36.throwError)(() => error48);
288536
+ return (0, import_rxjs38.throwError)(() => error48);
288271
288537
  }),
288272
288538
  (0, import_operators23.switchMap)(
288273
288539
  (projectId) => resolveClusterId(projectId, {
@@ -288297,18 +288563,18 @@ var test_exports = {};
288297
288563
  __export(test_exports, {
288298
288564
  default: () => test_default
288299
288565
  });
288300
- var import_rxjs37, import_operators24, test_default;
288566
+ var import_rxjs39, import_operators24, test_default;
288301
288567
  var init_test = __esm({
288302
288568
  "src/commands/lambda/test.ts"() {
288303
- import_rxjs37 = __toESM(require_cjs());
288569
+ import_rxjs39 = __toESM(require_cjs());
288304
288570
  import_operators24 = __toESM(require_operators());
288305
288571
  init_helpers();
288306
288572
  init_gql_client();
288307
288573
  init_log();
288308
288574
  init_load_spec();
288309
288575
  test_default = async (cmd) => {
288310
- const spec = await (0, import_rxjs37.lastValueFrom)(loadSpec(cmd.spec));
288311
- const processParameters = (lambda) => (0, import_rxjs37.of)(lambda).pipe(
288576
+ const spec = await (0, import_rxjs39.lastValueFrom)(loadSpec(cmd.spec));
288577
+ const processParameters = (lambda) => (0, import_rxjs39.of)(lambda).pipe(
288312
288578
  (0, import_operators24.map)((lambda2) => ({
288313
288579
  ...lambda2,
288314
288580
  url: cmd.pathParams ? cmd.pathParams.split(";").map((param) => param.split("=")).reduce(
@@ -288322,7 +288588,7 @@ var init_test = __esm({
288322
288588
  );
288323
288589
  }),
288324
288590
  (0, import_operators24.switchMap)(
288325
- (lambda2) => (0, import_rxjs37.from)(
288591
+ (lambda2) => (0, import_rxjs39.from)(
288326
288592
  fetch([lambda2.url, cmd.queryParams].filter((i2) => !!i2).join(""), {
288327
288593
  method: cmd?.method ?? "GET",
288328
288594
  body: cmd.body
@@ -288338,7 +288604,7 @@ var init_test = __esm({
288338
288604
  })
288339
288605
  );
288340
288606
  if (cmd.lambda) {
288341
- return (0, import_rxjs37.lastValueFrom)(
288607
+ return (0, import_rxjs39.lastValueFrom)(
288342
288608
  isMongoId(cmd.lambda).pipe(
288343
288609
  (0, import_operators24.switchMap)(
288344
288610
  (id) => GraphqlClienAPI.getLambda(id, ["id", "url", "method", "params"])
@@ -288349,16 +288615,16 @@ var init_test = __esm({
288349
288615
  }
288350
288616
  const name2 = typeof cmd.name === "string" ? cmd.name : spec.function?.name ?? spec.name;
288351
288617
  if (name2) {
288352
- return (0, import_rxjs37.lastValueFrom)(
288618
+ return (0, import_rxjs39.lastValueFrom)(
288353
288619
  parseProjectId(cmd.project).pipe(
288354
288620
  (0, import_operators24.catchError)((error48) => {
288355
288621
  if (!cmd.project) {
288356
- return (0, import_rxjs37.throwError)(
288622
+ return (0, import_rxjs39.throwError)(
288357
288623
  () => `No project id try with "gcli use --project your-project-id" to specify one
288358
288624
  Hint: "gcli lambda:get --name ${name2} --project your-project-id"`
288359
288625
  );
288360
288626
  }
288361
- return (0, import_rxjs37.throwError)(() => error48);
288627
+ return (0, import_rxjs39.throwError)(() => error48);
288362
288628
  }),
288363
288629
  (0, import_operators24.switchMap)(
288364
288630
  (projectId) => GraphqlClienAPI.getLambdaByName(name2, projectId, [
@@ -288382,14 +288648,14 @@ var list_exports3 = {};
288382
288648
  __export(list_exports3, {
288383
288649
  default: () => list_default3
288384
288650
  });
288385
- var import_rxjs38, import_operators25, list_default3;
288651
+ var import_rxjs40, import_operators25, list_default3;
288386
288652
  var init_list3 = __esm({
288387
288653
  "src/commands/plugin/list.ts"() {
288388
- import_rxjs38 = __toESM(require_cjs());
288654
+ import_rxjs40 = __toESM(require_cjs());
288389
288655
  import_operators25 = __toESM(require_operators());
288390
288656
  init_gql_client();
288391
288657
  init_log();
288392
- list_default3 = () => (0, import_rxjs38.lastValueFrom)(
288658
+ list_default3 = () => (0, import_rxjs40.lastValueFrom)(
288393
288659
  GraphqlClienAPI.listAvailablePlugins().pipe(
288394
288660
  (0, import_operators25.tap)((plugins) => {
288395
288661
  Logger.log("-------------------");
@@ -288414,15 +288680,15 @@ var installed_exports = {};
288414
288680
  __export(installed_exports, {
288415
288681
  default: () => installed_default
288416
288682
  });
288417
- var import_rxjs39, import_operators26, installed_default;
288683
+ var import_rxjs41, import_operators26, installed_default;
288418
288684
  var init_installed = __esm({
288419
288685
  "src/commands/plugin/installed.ts"() {
288420
- import_rxjs39 = __toESM(require_cjs());
288686
+ import_rxjs41 = __toESM(require_cjs());
288421
288687
  import_operators26 = __toESM(require_operators());
288422
288688
  init_helpers();
288423
288689
  init_gql_client();
288424
288690
  init_log();
288425
- installed_default = (cmd) => (0, import_rxjs39.lastValueFrom)(
288691
+ installed_default = (cmd) => (0, import_rxjs41.lastValueFrom)(
288426
288692
  parseProjectId(cmd.project).pipe(
288427
288693
  (0, import_operators26.switchMap)((projectId) => GraphqlClienAPI.listInstalledPlugins(projectId)),
288428
288694
  (0, import_operators26.tap)((installed) => {
@@ -288453,16 +288719,16 @@ var install_exports = {};
288453
288719
  __export(install_exports, {
288454
288720
  default: () => install_default
288455
288721
  });
288456
- var import_rxjs40, import_operators27, install_default;
288722
+ var import_rxjs42, import_operators27, install_default;
288457
288723
  var init_install = __esm({
288458
288724
  "src/commands/plugin/install.ts"() {
288459
- import_rxjs40 = __toESM(require_cjs());
288725
+ import_rxjs42 = __toESM(require_cjs());
288460
288726
  import_operators27 = __toESM(require_operators());
288461
288727
  init_helpers();
288462
288728
  init_gql_client();
288463
288729
  init_log();
288464
288730
  init_load_spec();
288465
- install_default = (cmd) => (0, import_rxjs40.lastValueFrom)(
288731
+ install_default = (cmd) => (0, import_rxjs42.lastValueFrom)(
288466
288732
  parseProjectId(cmd.project).pipe(
288467
288733
  (0, import_operators27.switchMap)(
288468
288734
  (projectId) => loadSpec(
@@ -288471,7 +288737,7 @@ var init_install = __esm({
288471
288737
  // No spec file is required at all if --name/--cluster fully
288472
288738
  // cover it (unlike every other resource here, a plugin install
288473
288739
  // is often just "install this by name", no YAML needed).
288474
- (0, import_operators27.catchError)(() => (0, import_rxjs40.of)(void 0)),
288740
+ (0, import_operators27.catchError)(() => (0, import_rxjs42.of)(void 0)),
288475
288741
  (0, import_operators27.map)((data) => ({
288476
288742
  projectId,
288477
288743
  ...data ? data.plugin ?? data : {}
@@ -288502,15 +288768,15 @@ var uninstall_exports = {};
288502
288768
  __export(uninstall_exports, {
288503
288769
  default: () => uninstall_default
288504
288770
  });
288505
- var import_rxjs41, import_operators28, uninstall_default;
288771
+ var import_rxjs43, import_operators28, uninstall_default;
288506
288772
  var init_uninstall = __esm({
288507
288773
  "src/commands/plugin/uninstall.ts"() {
288508
- import_rxjs41 = __toESM(require_cjs());
288774
+ import_rxjs43 = __toESM(require_cjs());
288509
288775
  import_operators28 = __toESM(require_operators());
288510
288776
  init_helpers();
288511
288777
  init_gql_client();
288512
288778
  init_log();
288513
- uninstall_default = (cmd) => (0, import_rxjs41.lastValueFrom)(
288779
+ uninstall_default = (cmd) => (0, import_rxjs43.lastValueFrom)(
288514
288780
  parseProjectId(cmd.project).pipe(
288515
288781
  (0, import_operators28.switchMap)(
288516
288782
  (projectId) => GraphqlClienAPI.uninstallPlugin(projectId, cmd.name, cmd.cluster)
@@ -288530,14 +288796,14 @@ var list_exports4 = {};
288530
288796
  __export(list_exports4, {
288531
288797
  default: () => list_default4
288532
288798
  });
288533
- var import_rxjs42, import_operators29, list_default4;
288799
+ var import_rxjs44, import_operators29, list_default4;
288534
288800
  var init_list4 = __esm({
288535
288801
  "src/commands/project/list.ts"() {
288536
- import_rxjs42 = __toESM(require_cjs());
288802
+ import_rxjs44 = __toESM(require_cjs());
288537
288803
  import_operators29 = __toESM(require_operators());
288538
288804
  init_gql_client();
288539
288805
  init_log();
288540
- list_default4 = async () => (0, import_rxjs42.lastValueFrom)(
288806
+ list_default4 = async () => (0, import_rxjs44.lastValueFrom)(
288541
288807
  GraphqlClienAPI.listProjects().pipe(
288542
288808
  (0, import_operators29.tap)((project) => {
288543
288809
  const columns = ["id", "name"];
@@ -288556,25 +288822,25 @@ var use_exports = {};
288556
288822
  __export(use_exports, {
288557
288823
  default: () => use_default
288558
288824
  });
288559
- var import_fs5, import_rxjs43, import_operators30, import_util4, use_default;
288825
+ var import_fs6, import_rxjs45, import_operators30, import_util4, use_default;
288560
288826
  var init_use = __esm({
288561
288827
  "src/commands/project/use.ts"() {
288562
- import_fs5 = require("fs");
288563
- import_rxjs43 = __toESM(require_cjs());
288828
+ import_fs6 = require("fs");
288829
+ import_rxjs45 = __toESM(require_cjs());
288564
288830
  import_operators30 = __toESM(require_operators());
288565
288831
  import_util4 = require("util");
288566
288832
  init_helpers();
288567
288833
  init_gql_client();
288568
288834
  init_types();
288569
288835
  use_default = async (cmd) => {
288570
- return (0, import_rxjs43.lastValueFrom)(
288836
+ return (0, import_rxjs45.lastValueFrom)(
288571
288837
  parseProjectId(cmd).pipe(
288572
288838
  (0, import_operators30.switchMap)(
288573
288839
  (projectId) => GraphqlClienAPI.getProject(projectId).pipe((0, import_operators30.map)(() => projectId))
288574
288840
  ),
288575
288841
  (0, import_operators30.switchMap)(
288576
- (projectId) => (0, import_rxjs43.from)(
288577
- (0, import_util4.promisify)(import_fs5.writeFile)(projectDirectory, projectId, {
288842
+ (projectId) => (0, import_rxjs45.from)(
288843
+ (0, import_util4.promisify)(import_fs6.writeFile)(projectDirectory, projectId, {
288578
288844
  encoding: "utf-8"
288579
288845
  })
288580
288846
  )
@@ -288590,13 +288856,13 @@ var clear_exports = {};
288590
288856
  __export(clear_exports, {
288591
288857
  default: () => clear_default
288592
288858
  });
288593
- var import_fs6, import_util5, clear_default;
288859
+ var import_fs7, import_util5, clear_default;
288594
288860
  var init_clear = __esm({
288595
288861
  "src/commands/project/clear.ts"() {
288596
- import_fs6 = require("fs");
288862
+ import_fs7 = require("fs");
288597
288863
  import_util5 = require("util");
288598
288864
  init_types();
288599
- clear_default = async () => (0, import_util5.promisify)(import_fs6.unlink)(projectDirectory);
288865
+ clear_default = async () => (0, import_util5.promisify)(import_fs7.unlink)(projectDirectory);
288600
288866
  }
288601
288867
  });
288602
288868
 
@@ -319410,7 +319676,7 @@ __export(start_exports, {
319410
319676
  default: () => startProxy
319411
319677
  });
319412
319678
  async function startProxy(cmd) {
319413
- return (0, import_rxjs44.lastValueFrom)(
319679
+ return (0, import_rxjs46.lastValueFrom)(
319414
319680
  GraphqlClienAPI.getConfig().pipe(
319415
319681
  (0, import_operators31.take)(1),
319416
319682
  (0, import_operators31.map)((config2) => ({
@@ -319426,7 +319692,7 @@ async function startProxy(cmd) {
319426
319692
  process.stderr.write("Retrieving config for auth...\n");
319427
319693
  }),
319428
319694
  (0, import_operators31.switchMap)(
319429
- (config2) => config2?.token ? (0, import_rxjs44.of)(config2) : (0, import_rxjs44.throwError)(
319695
+ (config2) => config2?.token ? (0, import_rxjs46.of)(config2) : (0, import_rxjs46.throwError)(
319430
319696
  () => new Error("User is not authenticated (no token in config)")
319431
319697
  )
319432
319698
  ),
@@ -319444,7 +319710,7 @@ async function startProxy(cmd) {
319444
319710
  Authorization: config2.token
319445
319711
  }
319446
319712
  },
319447
- fetch: (input, init) => (0, import_rxjs44.lastValueFrom)(performFetch(input, init))
319713
+ fetch: (input, init) => (0, import_rxjs46.lastValueFrom)(performFetch(input, init))
319448
319714
  }),
319449
319715
  client: new Client({
319450
319716
  name: "gapi-proxy-client",
@@ -319455,7 +319721,7 @@ async function startProxy(cmd) {
319455
319721
  process.stderr.write("Connecting to upstream...\n");
319456
319722
  }),
319457
319723
  (0, import_operators31.switchMap)(
319458
- (config2) => (0, import_rxjs44.from)(config2.client.connect(config2.transport)).pipe((0, import_operators31.map)(() => config2))
319724
+ (config2) => (0, import_rxjs46.from)(config2.client.connect(config2.transport)).pipe((0, import_operators31.map)(() => config2))
319459
319725
  ),
319460
319726
  (0, import_operators31.tap)(() => {
319461
319727
  process.stderr.write("Connected to upstream MCP server\n");
@@ -319481,25 +319747,25 @@ async function startProxy(cmd) {
319481
319747
  capabilities: config2.capabilities || {}
319482
319748
  }
319483
319749
  );
319484
- server2.fallbackRequestHandler = async (request) => (0, import_rxjs44.lastValueFrom)(
319485
- (0, import_rxjs44.defer)(() => config2.client.request(request, external_exports3.any())).pipe(
319750
+ server2.fallbackRequestHandler = async (request) => (0, import_rxjs46.lastValueFrom)(
319751
+ (0, import_rxjs46.defer)(() => config2.client.request(request, external_exports3.any())).pipe(
319486
319752
  (0, import_operators31.catchError)((e2) => {
319487
319753
  process.stderr.write(`Upstream error: ${e2.message}
319488
319754
  `);
319489
- return (0, import_rxjs44.throwError)(() => e2);
319755
+ return (0, import_rxjs46.throwError)(() => e2);
319490
319756
  })
319491
319757
  )
319492
319758
  );
319493
319759
  server2.fallbackNotificationHandler = async (notification) => {
319494
- await (0, import_rxjs44.lastValueFrom)(
319495
- (0, import_rxjs44.of)(notification).pipe(
319760
+ await (0, import_rxjs46.lastValueFrom)(
319761
+ (0, import_rxjs46.of)(notification).pipe(
319496
319762
  (0, import_operators31.filter)((n) => n.method !== "notifications/initialized"),
319497
319763
  (0, import_operators31.switchMap)(
319498
- (n) => (0, import_rxjs44.defer)(() => config2.client.notification(n)).pipe(
319764
+ (n) => (0, import_rxjs46.defer)(() => config2.client.notification(n)).pipe(
319499
319765
  (0, import_operators31.catchError)((e2) => {
319500
319766
  process.stderr.write(`Notification error: ${e2}
319501
319767
  `);
319502
- return import_rxjs44.EMPTY;
319768
+ return import_rxjs46.EMPTY;
319503
319769
  })
319504
319770
  )
319505
319771
  ),
@@ -319509,7 +319775,7 @@ async function startProxy(cmd) {
319509
319775
  };
319510
319776
  return server2;
319511
319777
  }),
319512
- (0, import_operators31.switchMap)((server2) => (0, import_rxjs44.from)(server2.connect(new StdioServerTransport()))),
319778
+ (0, import_operators31.switchMap)((server2) => (0, import_rxjs46.from)(server2.connect(new StdioServerTransport()))),
319513
319779
  (0, import_operators31.tap)(() => {
319514
319780
  process.stderr.write("MCP stdio server ready\n");
319515
319781
  }),
@@ -319519,20 +319785,20 @@ async function startProxy(cmd) {
319519
319785
  )
319520
319786
  );
319521
319787
  }
319522
- var import_rxjs44, import_operators31, import_stream2, performFetch;
319788
+ var import_rxjs46, import_operators31, import_stream2, performFetch;
319523
319789
  var init_start = __esm({
319524
319790
  "src/commands/proxy/start.ts"() {
319525
319791
  init_client2();
319526
319792
  init_streamableHttp();
319527
319793
  init_server2();
319528
319794
  init_stdio2();
319529
- import_rxjs44 = __toESM(require_cjs());
319795
+ import_rxjs46 = __toESM(require_cjs());
319530
319796
  import_operators31 = __toESM(require_operators());
319531
319797
  import_stream2 = require("stream");
319532
319798
  init_zod();
319533
319799
  init_gql_client();
319534
319800
  performFetch = (input, init) => {
319535
- return (0, import_rxjs44.from)(fetch(input, init)).pipe(
319801
+ return (0, import_rxjs46.from)(fetch(input, init)).pipe(
319536
319802
  (0, import_operators31.switchMap)((res) => {
319537
319803
  if (res.status === 401 || res.status === 403) {
319538
319804
  process.stderr.write(
@@ -319554,7 +319820,7 @@ var init_start = __esm({
319554
319820
  })
319555
319821
  );
319556
319822
  }
319557
- return (0, import_rxjs44.of)(res);
319823
+ return (0, import_rxjs46.of)(res);
319558
319824
  }),
319559
319825
  (0, import_operators31.map)((res) => {
319560
319826
  if (typeof res?.body?.pipeThrough !== "function") {
@@ -319573,7 +319839,7 @@ var init_start = __esm({
319573
319839
  (0, import_operators31.catchError)((e2) => {
319574
319840
  process.stderr.write(`[ERROR] Fetch error: ${e2.message}
319575
319841
  `);
319576
- return (0, import_rxjs44.throwError)(() => e2);
319842
+ return (0, import_rxjs46.throwError)(() => e2);
319577
319843
  })
319578
319844
  );
319579
319845
  };
@@ -319585,16 +319851,16 @@ var create_exports3 = {};
319585
319851
  __export(create_exports3, {
319586
319852
  default: () => create_default3
319587
319853
  });
319588
- var import_rxjs45, import_operators32, create_default3;
319854
+ var import_rxjs47, import_operators32, create_default3;
319589
319855
  var init_create3 = __esm({
319590
319856
  "src/commands/rabbitmq/create.ts"() {
319591
- import_rxjs45 = __toESM(require_cjs());
319857
+ import_rxjs47 = __toESM(require_cjs());
319592
319858
  import_operators32 = __toESM(require_operators());
319593
319859
  init_helpers();
319594
319860
  init_gql_client();
319595
319861
  init_log();
319596
319862
  init_load_spec();
319597
- create_default3 = (cmd) => (0, import_rxjs45.lastValueFrom)(
319863
+ create_default3 = (cmd) => (0, import_rxjs47.lastValueFrom)(
319598
319864
  parseProjectId(cmd.project).pipe(
319599
319865
  (0, import_operators32.switchMap)(
319600
319866
  (projectId) => loadSpec(
@@ -319633,15 +319899,15 @@ var list_exports5 = {};
319633
319899
  __export(list_exports5, {
319634
319900
  default: () => list_default5
319635
319901
  });
319636
- var import_rxjs46, import_operators33, list_default5;
319902
+ var import_rxjs48, import_operators33, list_default5;
319637
319903
  var init_list5 = __esm({
319638
319904
  "src/commands/rabbitmq/list.ts"() {
319639
- import_rxjs46 = __toESM(require_cjs());
319905
+ import_rxjs48 = __toESM(require_cjs());
319640
319906
  import_operators33 = __toESM(require_operators());
319641
319907
  init_helpers();
319642
319908
  init_gql_client();
319643
319909
  init_log();
319644
- list_default5 = (cmd) => (0, import_rxjs46.lastValueFrom)(
319910
+ list_default5 = (cmd) => (0, import_rxjs48.lastValueFrom)(
319645
319911
  parseProjectId(cmd.project).pipe(
319646
319912
  (0, import_operators33.switchMap)(
319647
319913
  (projectId) => GraphqlClienAPI.listRabbitMqInstances(projectId)
@@ -319676,15 +319942,15 @@ var delete_exports2 = {};
319676
319942
  __export(delete_exports2, {
319677
319943
  default: () => delete_default2
319678
319944
  });
319679
- var import_rxjs47, import_operators34, delete_default2;
319945
+ var import_rxjs49, import_operators34, delete_default2;
319680
319946
  var init_delete2 = __esm({
319681
319947
  "src/commands/rabbitmq/delete.ts"() {
319682
- import_rxjs47 = __toESM(require_cjs());
319948
+ import_rxjs49 = __toESM(require_cjs());
319683
319949
  import_operators34 = __toESM(require_operators());
319684
319950
  init_helpers();
319685
319951
  init_gql_client();
319686
319952
  init_log();
319687
- delete_default2 = (cmd) => (0, import_rxjs47.lastValueFrom)(
319953
+ delete_default2 = (cmd) => (0, import_rxjs49.lastValueFrom)(
319688
319954
  parseProjectId(cmd.project).pipe(
319689
319955
  (0, import_operators34.switchMap)(
319690
319956
  (projectId) => GraphqlClienAPI.uninstallRabbitMq(cmd.id, projectId)
@@ -319701,10 +319967,10 @@ var init_delete2 = __esm({
319701
319967
  });
319702
319968
 
319703
319969
  // src/commands/runner/config.ts
319704
- var import_promises2, DEFAULT_WS_URL, deriveSubscriptionsUrl, readLoginApiUrl, readSavedRunner, saveRunner, forgetRunner;
319970
+ var import_promises5, DEFAULT_WS_URL, deriveSubscriptionsUrl, readLoginApiUrl, readSavedRunner, saveRunner, forgetRunner;
319705
319971
  var init_config = __esm({
319706
319972
  "src/commands/runner/config.ts"() {
319707
- import_promises2 = require("fs/promises");
319973
+ import_promises5 = require("fs/promises");
319708
319974
  init_types();
319709
319975
  DEFAULT_WS_URL = "wss://api.lambforge.com/subscriptions";
319710
319976
  deriveSubscriptionsUrl = (apiUrl) => {
@@ -319720,21 +319986,21 @@ var init_config = __esm({
319720
319986
  url2.search = "";
319721
319987
  return url2.toString();
319722
319988
  };
319723
- readLoginApiUrl = () => (0, import_promises2.readFile)(urlDirectory, "utf-8").catch(() => "");
319989
+ readLoginApiUrl = () => (0, import_promises5.readFile)(urlDirectory, "utf-8").catch(() => "");
319724
319990
  readSavedRunner = async () => {
319725
319991
  try {
319726
- const saved = JSON.parse(await (0, import_promises2.readFile)(runnerDirectory, "utf-8"));
319992
+ const saved = JSON.parse(await (0, import_promises5.readFile)(runnerDirectory, "utf-8"));
319727
319993
  return saved?.id && saved?.token ? saved : null;
319728
319994
  } catch {
319729
319995
  return null;
319730
319996
  }
319731
319997
  };
319732
319998
  saveRunner = async (runner) => {
319733
- await (0, import_promises2.mkdir)(mainDirectory, { recursive: true });
319734
- await (0, import_promises2.writeFile)(runnerDirectory, JSON.stringify(runner, null, 2), "utf-8");
319735
- await (0, import_promises2.chmod)(runnerDirectory, 384);
319999
+ await (0, import_promises5.mkdir)(mainDirectory, { recursive: true });
320000
+ await (0, import_promises5.writeFile)(runnerDirectory, JSON.stringify(runner, null, 2), "utf-8");
320001
+ await (0, import_promises5.chmod)(runnerDirectory, 384);
319736
320002
  };
319737
- forgetRunner = () => (0, import_promises2.rm)(runnerDirectory, { force: true });
320003
+ forgetRunner = () => (0, import_promises5.rm)(runnerDirectory, { force: true });
319738
320004
  }
319739
320005
  });
319740
320006
 
@@ -320256,19 +320522,19 @@ var init_connection = __esm({
320256
320522
  });
320257
320523
 
320258
320524
  // src/commands/runner/daemon.ts
320259
- var import_child_process3, import_fs7, import_promises3, import_os3, import_path2, import_util11, DEFAULT_SERVICE_NAME, RUNNER_AUTH_EXIT_CODE, systemdQuote, unitPath, buildUnit, resolveGcliCommand, defaultExec, SystemdUserService, assertSystemdAvailable;
320525
+ var import_child_process3, import_fs8, import_promises6, import_os4, import_path4, import_util11, DEFAULT_SERVICE_NAME, RUNNER_AUTH_EXIT_CODE, systemdQuote, unitPath, buildUnit, resolveGcliCommand, defaultExec, SystemdUserService, assertSystemdAvailable;
320260
320526
  var init_daemon = __esm({
320261
320527
  "src/commands/runner/daemon.ts"() {
320262
320528
  import_child_process3 = require("child_process");
320263
- import_fs7 = require("fs");
320264
- import_promises3 = require("fs/promises");
320265
- import_os3 = require("os");
320266
- import_path2 = require("path");
320529
+ import_fs8 = require("fs");
320530
+ import_promises6 = require("fs/promises");
320531
+ import_os4 = require("os");
320532
+ import_path4 = require("path");
320267
320533
  import_util11 = require("util");
320268
320534
  DEFAULT_SERVICE_NAME = "lambforge-runner";
320269
320535
  RUNNER_AUTH_EXIT_CODE = 78;
320270
320536
  systemdQuote = (word) => /^[A-Za-z0-9_@%+=:,./-]+$/.test(word) ? word : `"${word.replace(/\\/g, "\\\\").replace(/"/g, '\\"')}"`;
320271
- unitPath = (serviceName, home = (0, import_os3.homedir)()) => (0, import_path2.join)(home, ".config", "systemd", "user", `${serviceName}.service`);
320537
+ unitPath = (serviceName, home = (0, import_os4.homedir)()) => (0, import_path4.join)(home, ".config", "systemd", "user", `${serviceName}.service`);
320272
320538
  buildUnit = ({
320273
320539
  serviceName,
320274
320540
  execStart,
@@ -320307,7 +320573,7 @@ var init_daemon = __esm({
320307
320573
  }
320308
320574
  let script = argv[1];
320309
320575
  try {
320310
- script = (0, import_fs7.realpathSync)(script);
320576
+ script = (0, import_fs8.realpathSync)(script);
320311
320577
  } catch {
320312
320578
  }
320313
320579
  const ephemeral = /[/\\]_npx[/\\]|[/\\]\.npm[/\\]_cacache/.test(script);
@@ -320318,7 +320584,7 @@ var init_daemon = __esm({
320318
320584
  };
320319
320585
  defaultExec = (file2, args) => (0, import_util11.promisify)(import_child_process3.execFile)(file2, args, { encoding: "utf8" });
320320
320586
  SystemdUserService = class {
320321
- constructor(serviceName = DEFAULT_SERVICE_NAME, exec2 = defaultExec, home = (0, import_os3.homedir)()) {
320587
+ constructor(serviceName = DEFAULT_SERVICE_NAME, exec2 = defaultExec, home = (0, import_os4.homedir)()) {
320322
320588
  this.serviceName = serviceName;
320323
320589
  this.exec = exec2;
320324
320590
  this.home = home;
@@ -320329,8 +320595,8 @@ var init_daemon = __esm({
320329
320595
  /** install -> daemon-reload -> enable -> restart (picks up a changed unit). */
320330
320596
  async install(unitContent) {
320331
320597
  const path2 = unitPath(this.serviceName, this.home);
320332
- await (0, import_promises3.mkdir)((0, import_path2.join)(path2, ".."), { recursive: true });
320333
- await (0, import_promises3.writeFile)(path2, unitContent, "utf-8");
320598
+ await (0, import_promises6.mkdir)((0, import_path4.join)(path2, ".."), { recursive: true });
320599
+ await (0, import_promises6.writeFile)(path2, unitContent, "utf-8");
320334
320600
  await this.systemctl("daemon-reload");
320335
320601
  await this.systemctl("enable", this.unit);
320336
320602
  await this.systemctl("restart", this.unit);
@@ -320339,13 +320605,13 @@ var init_daemon = __esm({
320339
320605
  async uninstall() {
320340
320606
  await this.systemctl("disable", "--now", this.unit).catch(() => void 0);
320341
320607
  const path2 = unitPath(this.serviceName, this.home);
320342
- await (0, import_promises3.rm)(path2, { force: true });
320608
+ await (0, import_promises6.rm)(path2, { force: true });
320343
320609
  await this.systemctl("daemon-reload");
320344
320610
  return path2;
320345
320611
  }
320346
320612
  /** Whether `runner:daemon:install` wrote the unit. */
320347
320613
  installed() {
320348
- return (0, import_fs7.existsSync)(unitPath(this.serviceName, this.home));
320614
+ return (0, import_fs8.existsSync)(unitPath(this.serviceName, this.home));
320349
320615
  }
320350
320616
  start() {
320351
320617
  return this.systemctl("start", this.unit);
@@ -320409,11 +320675,11 @@ __export(start_exports2, {
320409
320675
  default: () => start_default,
320410
320676
  resolveRunner: () => resolveRunner
320411
320677
  });
320412
- var import_os4, import_rxjs48, RUNNER_VERSION, resolveRunner, start_default;
320678
+ var import_os5, import_rxjs50, RUNNER_VERSION, resolveRunner, start_default;
320413
320679
  var init_start2 = __esm({
320414
320680
  "src/commands/runner/start.ts"() {
320415
- import_os4 = require("os");
320416
- import_rxjs48 = __toESM(require_cjs());
320681
+ import_os5 = require("os");
320682
+ import_rxjs50 = __toESM(require_cjs());
320417
320683
  init_gql_client();
320418
320684
  init_log();
320419
320685
  init_config();
@@ -320432,9 +320698,9 @@ var init_start2 = __esm({
320432
320698
  if (saved) {
320433
320699
  return saved;
320434
320700
  }
320435
- const name2 = cmd.name || (0, import_os4.hostname)();
320701
+ const name2 = cmd.name || (0, import_os5.hostname)();
320436
320702
  Logger.info(`Registering this machine as local runner "${name2}"...`);
320437
- const { runner, token } = await (0, import_rxjs48.lastValueFrom)(
320703
+ const { runner, token } = await (0, import_rxjs50.lastValueFrom)(
320438
320704
  GraphqlClienAPI.createLocalRunner(name2)
320439
320705
  ).catch((e2) => {
320440
320706
  throw new Error(
@@ -320629,14 +320895,14 @@ var list_exports6 = {};
320629
320895
  __export(list_exports6, {
320630
320896
  default: () => list_default6
320631
320897
  });
320632
- var import_rxjs49, import_operators35, list_default6;
320898
+ var import_rxjs51, import_operators35, list_default6;
320633
320899
  var init_list6 = __esm({
320634
320900
  "src/commands/runner/list.ts"() {
320635
- import_rxjs49 = __toESM(require_cjs());
320901
+ import_rxjs51 = __toESM(require_cjs());
320636
320902
  import_operators35 = __toESM(require_operators());
320637
320903
  init_gql_client();
320638
320904
  init_log();
320639
- list_default6 = () => (0, import_rxjs49.lastValueFrom)(
320905
+ list_default6 = () => (0, import_rxjs51.lastValueFrom)(
320640
320906
  GraphqlClienAPI.listLocalRunners().pipe(
320641
320907
  (0, import_operators35.tap)((runners) => {
320642
320908
  Logger.log("-------------------");
@@ -320669,10 +320935,10 @@ __export(models_exports, {
320669
320935
  default: () => models_default,
320670
320936
  parseSelection: () => parseSelection
320671
320937
  });
320672
- var import_rxjs50, isShown, parseSelection, models_default;
320938
+ var import_rxjs52, isShown, parseSelection, models_default;
320673
320939
  var init_models = __esm({
320674
320940
  "src/commands/runner/models.ts"() {
320675
- import_rxjs50 = __toESM(require_cjs());
320941
+ import_rxjs52 = __toESM(require_cjs());
320676
320942
  init_gql_client();
320677
320943
  init_log();
320678
320944
  init_config();
@@ -320702,11 +320968,11 @@ var init_models = __esm({
320702
320968
  }
320703
320969
  let runner;
320704
320970
  if (selection) {
320705
- runner = await (0, import_rxjs50.lastValueFrom)(
320971
+ runner = await (0, import_rxjs52.lastValueFrom)(
320706
320972
  GraphqlClienAPI.setLocalRunnerModels(runnerId, selection.models)
320707
320973
  );
320708
320974
  } else {
320709
- const runners = await (0, import_rxjs50.lastValueFrom)(GraphqlClienAPI.listLocalRunners());
320975
+ const runners = await (0, import_rxjs52.lastValueFrom)(GraphqlClienAPI.listLocalRunners());
320710
320976
  runner = runners.find((r2) => r2.id === runnerId);
320711
320977
  }
320712
320978
  if (!runner) {
@@ -320741,10 +321007,10 @@ var delete_exports3 = {};
320741
321007
  __export(delete_exports3, {
320742
321008
  default: () => delete_default3
320743
321009
  });
320744
- var import_rxjs51, delete_default3;
321010
+ var import_rxjs53, delete_default3;
320745
321011
  var init_delete3 = __esm({
320746
321012
  "src/commands/runner/delete.ts"() {
320747
- import_rxjs51 = __toESM(require_cjs());
321013
+ import_rxjs53 = __toESM(require_cjs());
320748
321014
  init_gql_client();
320749
321015
  init_log();
320750
321016
  init_config();
@@ -320754,7 +321020,7 @@ var init_delete3 = __esm({
320754
321020
  if (!runnerId) {
320755
321021
  throw new Error("Specify the runner with --id (see `gcli runner:list`).");
320756
321022
  }
320757
- await (0, import_rxjs51.lastValueFrom)(GraphqlClienAPI.deleteLocalRunner(runnerId));
321023
+ await (0, import_rxjs53.lastValueFrom)(GraphqlClienAPI.deleteLocalRunner(runnerId));
320758
321024
  if (saved?.id === runnerId) {
320759
321025
  await forgetRunner();
320760
321026
  }
@@ -320770,10 +321036,10 @@ __export(start_exports3, {
320770
321036
  });
320771
321037
  async function start2(args) {
320772
321038
  Logger.log("---------------------------------");
320773
- return (0, import_rxjs52.lastValueFrom)(
321039
+ return (0, import_rxjs54.lastValueFrom)(
320774
321040
  loadSpec().pipe(
320775
321041
  (0, import_operators36.switchMap)(
320776
- (config2) => (0, import_rxjs52.of)({
321042
+ (config2) => (0, import_rxjs54.of)({
320777
321043
  watcher: (0, import_node_fs2.watch)(process.cwd(), {
320778
321044
  recursive: true
320779
321045
  }),
@@ -320802,7 +321068,7 @@ async function start2(args) {
320802
321068
  outfile,
320803
321069
  startCommand,
320804
321070
  ignorelist
320805
- }) => (0, import_rxjs52.from)(build_default(args)).pipe(
321071
+ }) => (0, import_rxjs54.from)(build_default(args)).pipe(
320806
321072
  (0, import_operators36.tap)(() => {
320807
321073
  Logger.warn(
320808
321074
  `\u{1F4E2} Starting script "${startCommand} ${outfile}"`
@@ -320820,10 +321086,10 @@ async function start2(args) {
320820
321086
  );
320821
321087
  }),
320822
321088
  (0, import_operators36.tap)(
320823
- () => (0, import_rxjs52.merge)(
320824
- (0, import_rxjs52.fromEvent)(process, "SIGINT"),
320825
- (0, import_rxjs52.fromEvent)(process, "SIGTERM"),
320826
- (0, import_rxjs52.fromEvent)(process, "exit")
321089
+ () => (0, import_rxjs54.merge)(
321090
+ (0, import_rxjs54.fromEvent)(process, "SIGINT"),
321091
+ (0, import_rxjs54.fromEvent)(process, "SIGTERM"),
321092
+ (0, import_rxjs54.fromEvent)(process, "exit")
320827
321093
  ).pipe(
320828
321094
  (0, import_operators36.debounceTime)(100),
320829
321095
  (0, import_operators36.tap)(() => {
@@ -320835,7 +321101,7 @@ async function start2(args) {
320835
321101
  ).subscribe()
320836
321102
  ),
320837
321103
  (0, import_operators36.switchMap)(
320838
- () => (0, import_rxjs52.fromEvent)(watcher, "change").pipe(
321104
+ () => (0, import_rxjs54.fromEvent)(watcher, "change").pipe(
320839
321105
  (0, import_operators36.map)(([event, filename]) => ({
320840
321106
  event,
320841
321107
  filename
@@ -320884,12 +321150,12 @@ async function start2(args) {
320884
321150
  )
320885
321151
  );
320886
321152
  }
320887
- var import_node_child_process, import_node_fs2, import_rxjs52, import_operators36;
321153
+ var import_node_child_process, import_node_fs2, import_rxjs54, import_operators36;
320888
321154
  var init_start3 = __esm({
320889
321155
  "src/commands/start/start.ts"() {
320890
321156
  import_node_child_process = require("node:child_process");
320891
321157
  import_node_fs2 = require("node:fs");
320892
- import_rxjs52 = __toESM(require_cjs());
321158
+ import_rxjs54 = __toESM(require_cjs());
320893
321159
  import_operators36 = __toESM(require_operators());
320894
321160
  init_log();
320895
321161
  init_build();
@@ -320902,16 +321168,16 @@ var create_cron_exports = {};
320902
321168
  __export(create_cron_exports, {
320903
321169
  default: () => create_cron_default
320904
321170
  });
320905
- var import_rxjs53, import_operators37, create_cron_default;
321171
+ var import_rxjs55, import_operators37, create_cron_default;
320906
321172
  var init_create_cron = __esm({
320907
321173
  "src/commands/triggers/cron/create-cron.ts"() {
320908
- import_rxjs53 = __toESM(require_cjs());
321174
+ import_rxjs55 = __toESM(require_cjs());
320909
321175
  import_operators37 = __toESM(require_operators());
320910
321176
  init_helpers();
320911
321177
  init_gql_client();
320912
321178
  init_log();
320913
321179
  init_load_spec();
320914
- create_cron_default = (cmd) => (0, import_rxjs53.lastValueFrom)(
321180
+ create_cron_default = (cmd) => (0, import_rxjs55.lastValueFrom)(
320915
321181
  parseProjectId(cmd.project).pipe(
320916
321182
  (0, import_operators37.switchMap)(
320917
321183
  (projectId) => loadSpec(cmd.spec ?? "cron.yaml").pipe(
@@ -320934,7 +321200,7 @@ var init_create_cron = __esm({
320934
321200
  )
320935
321201
  ),
320936
321202
  (0, import_operators37.switchMap)(
320937
- ({ lambdaId, cron, triggerName, lambdaName }) => !cron || !triggerName ? (0, import_rxjs53.throwError)(
321203
+ ({ lambdaId, cron, triggerName, lambdaName }) => !cron || !triggerName ? (0, import_rxjs55.throwError)(
320938
321204
  () => new Error(
320939
321205
  "cron:create needs --cron and --triggerName (or triggers.time.cron / triggerName in lambforge.yaml)"
320940
321206
  )
@@ -320967,16 +321233,16 @@ var delete_cron_exports = {};
320967
321233
  __export(delete_cron_exports, {
320968
321234
  default: () => delete_cron_default
320969
321235
  });
320970
- var import_rxjs54, import_operators38, delete_cron_default;
321236
+ var import_rxjs56, import_operators38, delete_cron_default;
320971
321237
  var init_delete_cron = __esm({
320972
321238
  "src/commands/triggers/cron/delete-cron.ts"() {
320973
- import_rxjs54 = __toESM(require_cjs());
321239
+ import_rxjs56 = __toESM(require_cjs());
320974
321240
  import_operators38 = __toESM(require_operators());
320975
321241
  init_helpers();
320976
321242
  init_gql_client();
320977
321243
  init_log();
320978
321244
  init_load_spec();
320979
- delete_cron_default = (cmd) => (0, import_rxjs54.lastValueFrom)(
321245
+ delete_cron_default = (cmd) => (0, import_rxjs56.lastValueFrom)(
320980
321246
  parseProjectId(cmd.project).pipe(
320981
321247
  (0, import_operators38.switchMap)(
320982
321248
  (projectId) => loadSpec(cmd.spec ?? "cron.yaml").pipe(
@@ -321020,18 +321286,18 @@ var list_crons_exports = {};
321020
321286
  __export(list_crons_exports, {
321021
321287
  default: () => list_crons_default
321022
321288
  });
321023
- var import_rxjs55, import_operators39, list_crons_default;
321289
+ var import_rxjs57, import_operators39, list_crons_default;
321024
321290
  var init_list_crons = __esm({
321025
321291
  "src/commands/triggers/cron/list-crons.ts"() {
321026
- import_rxjs55 = __toESM(require_cjs());
321292
+ import_rxjs57 = __toESM(require_cjs());
321027
321293
  import_operators39 = __toESM(require_operators());
321028
321294
  init_helpers();
321029
321295
  init_gql_client();
321030
321296
  init_log();
321031
- list_crons_default = (cmd) => (0, import_rxjs55.lastValueFrom)(
321297
+ list_crons_default = (cmd) => (0, import_rxjs57.lastValueFrom)(
321032
321298
  parseProjectId(cmd.project).pipe(
321033
321299
  (0, import_operators39.switchMap)(
321034
- (projectId) => (0, import_rxjs55.combineLatest)([
321300
+ (projectId) => (0, import_rxjs57.combineLatest)([
321035
321301
  GraphqlClienAPI.listProjectTimeTriggers(projectId),
321036
321302
  GraphqlClienAPI.listLambdas(projectId)
321037
321303
  ])
@@ -321064,15 +321330,15 @@ var list_exports7 = {};
321064
321330
  __export(list_exports7, {
321065
321331
  default: () => list_default7
321066
321332
  });
321067
- var import_rxjs56, import_operators40, list_default7;
321333
+ var import_rxjs58, import_operators40, list_default7;
321068
321334
  var init_list7 = __esm({
321069
321335
  "src/commands/triggers/message-queue/list.ts"() {
321070
- import_rxjs56 = __toESM(require_cjs());
321336
+ import_rxjs58 = __toESM(require_cjs());
321071
321337
  import_operators40 = __toESM(require_operators());
321072
321338
  init_helpers();
321073
321339
  init_gql_client();
321074
321340
  init_log();
321075
- list_default7 = (cmd) => (0, import_rxjs56.lastValueFrom)(
321341
+ list_default7 = (cmd) => (0, import_rxjs58.lastValueFrom)(
321076
321342
  parseProjectId(cmd.project).pipe(
321077
321343
  (0, import_operators40.switchMap)(
321078
321344
  (projectId) => GraphqlClienAPI.listMessageQueueTriggers(projectId)
@@ -321108,10 +321374,10 @@ __export(save_exports, {
321108
321374
  mergeOverExisting: () => mergeOverExisting,
321109
321375
  toTriggerInput: () => toTriggerInput
321110
321376
  });
321111
- var import_rxjs57, import_operators41, int2, toTriggerInput, mergeOverExisting, save_default;
321377
+ var import_rxjs59, import_operators41, int2, toTriggerInput, mergeOverExisting, save_default;
321112
321378
  var init_save = __esm({
321113
321379
  "src/commands/triggers/message-queue/save.ts"() {
321114
- import_rxjs57 = __toESM(require_cjs());
321380
+ import_rxjs59 = __toESM(require_cjs());
321115
321381
  import_operators41 = __toESM(require_operators());
321116
321382
  init_helpers();
321117
321383
  init_gql_client();
@@ -321174,11 +321440,11 @@ var init_save = __esm({
321174
321440
  )
321175
321441
  );
321176
321442
  };
321177
- save_default = (mode, cmd) => (0, import_rxjs57.lastValueFrom)(
321443
+ save_default = (mode, cmd) => (0, import_rxjs59.lastValueFrom)(
321178
321444
  parseProjectId(cmd.project).pipe(
321179
321445
  (0, import_operators41.switchMap)((projectId) => {
321180
321446
  const changes = toTriggerInput(mode, cmd);
321181
- const payload$ = mode === "create" ? (0, import_rxjs57.of)(changes) : GraphqlClienAPI.listMessageQueueTriggers(projectId).pipe(
321447
+ const payload$ = mode === "create" ? (0, import_rxjs59.of)(changes) : GraphqlClienAPI.listMessageQueueTriggers(projectId).pipe(
321182
321448
  (0, import_operators41.map)(
321183
321449
  (triggers) => mergeOverExisting(
321184
321450
  triggers.find((t2) => t2.name === cmd.name),
@@ -321216,15 +321482,15 @@ var delete_exports4 = {};
321216
321482
  __export(delete_exports4, {
321217
321483
  default: () => delete_default4
321218
321484
  });
321219
- var import_rxjs58, import_operators42, delete_default4;
321485
+ var import_rxjs60, import_operators42, delete_default4;
321220
321486
  var init_delete4 = __esm({
321221
321487
  "src/commands/triggers/message-queue/delete.ts"() {
321222
- import_rxjs58 = __toESM(require_cjs());
321488
+ import_rxjs60 = __toESM(require_cjs());
321223
321489
  import_operators42 = __toESM(require_operators());
321224
321490
  init_helpers();
321225
321491
  init_gql_client();
321226
321492
  init_log();
321227
- delete_default4 = (cmd) => (0, import_rxjs58.lastValueFrom)(
321493
+ delete_default4 = (cmd) => (0, import_rxjs60.lastValueFrom)(
321228
321494
  parseProjectId(cmd.project).pipe(
321229
321495
  (0, import_operators42.switchMap)(
321230
321496
  (projectId) => GraphqlClienAPI.deleteMessageQueueTrigger(projectId, cmd.name)
@@ -321334,11 +321600,11 @@ var init_definition = __esm({
321334
321600
  });
321335
321601
 
321336
321602
  // src/commands/workflow/helpers.ts
321337
- var import_promises4, import_rxjs59, import_operators43, resolveWorkflow, withProject, readWorkflowFile, writeTextFile, POLL_MS, followRun, printRunResult;
321603
+ var import_promises7, import_rxjs61, import_operators43, resolveWorkflow, withProject, readWorkflowFile, writeTextFile, POLL_MS, followRun, printRunResult;
321338
321604
  var init_helpers4 = __esm({
321339
321605
  "src/commands/workflow/helpers.ts"() {
321340
- import_promises4 = require("fs/promises");
321341
- import_rxjs59 = __toESM(require_cjs());
321606
+ import_promises7 = require("fs/promises");
321607
+ import_rxjs61 = __toESM(require_cjs());
321342
321608
  import_operators43 = __toESM(require_operators());
321343
321609
  init_helpers();
321344
321610
  init_gql_client();
@@ -321360,18 +321626,18 @@ var init_helpers4 = __esm({
321360
321626
  })
321361
321627
  );
321362
321628
  };
321363
- withProject = (project, fn) => (0, import_rxjs59.lastValueFrom)(parseProjectId(project).pipe((0, import_operators43.switchMap)(fn)));
321629
+ withProject = (project, fn) => (0, import_rxjs61.lastValueFrom)(parseProjectId(project).pipe((0, import_operators43.switchMap)(fn)));
321364
321630
  readWorkflowFile = (path2) => {
321365
321631
  if (!path2) {
321366
321632
  throw new Error("--file is required (a workflow YAML or JSON file)");
321367
321633
  }
321368
- return (0, import_rxjs59.from)((0, import_promises4.readFile)(path2, "utf8")).pipe((0, import_operators43.map)(parseWorkflowFile));
321634
+ return (0, import_rxjs61.from)((0, import_promises7.readFile)(path2, "utf8")).pipe((0, import_operators43.map)(parseWorkflowFile));
321369
321635
  };
321370
- writeTextFile = (path2, text) => (0, import_rxjs59.from)((0, import_promises4.writeFile)(path2, text, "utf8"));
321636
+ writeTextFile = (path2, text) => (0, import_rxjs61.from)((0, import_promises7.writeFile)(path2, text, "utf8"));
321371
321637
  POLL_MS = 2e3;
321372
321638
  followRun = (projectId, workflowId, runName) => {
321373
321639
  let printed = 0;
321374
- return (0, import_rxjs59.timer)(0, POLL_MS).pipe(
321640
+ return (0, import_rxjs61.timer)(0, POLL_MS).pipe(
321375
321641
  (0, import_operators43.switchMap)(
321376
321642
  () => GraphqlClienAPI.getWorkflowRun(projectId, workflowId, runName)
321377
321643
  ),
@@ -321444,10 +321710,10 @@ var get_exports2 = {};
321444
321710
  __export(get_exports2, {
321445
321711
  default: () => get_default2
321446
321712
  });
321447
- var import_rxjs60, import_operators45, get_default2;
321713
+ var import_rxjs62, import_operators45, get_default2;
321448
321714
  var init_get2 = __esm({
321449
321715
  "src/commands/workflow/get.ts"() {
321450
- import_rxjs60 = __toESM(require_cjs());
321716
+ import_rxjs62 = __toESM(require_cjs());
321451
321717
  import_operators45 = __toESM(require_operators());
321452
321718
  init_log();
321453
321719
  init_definition();
@@ -321463,7 +321729,7 @@ var init_get2 = __esm({
321463
321729
  });
321464
321730
  if (!cmd.out) {
321465
321731
  Logger.log(text);
321466
- return (0, import_rxjs60.of)(null);
321732
+ return (0, import_rxjs62.of)(null);
321467
321733
  }
321468
321734
  return writeTextFile(cmd.out, text).pipe(
321469
321735
  (0, import_operators45.tap)(() => Logger.info(`Wrote ${cmd.out}`))
@@ -321533,11 +321799,11 @@ var generate_exports = {};
321533
321799
  __export(generate_exports, {
321534
321800
  default: () => generate_default
321535
321801
  });
321536
- var import_promises5, import_rxjs61, import_operators47, generate_default;
321802
+ var import_promises8, import_rxjs63, import_operators47, generate_default;
321537
321803
  var init_generate = __esm({
321538
321804
  "src/commands/workflow/generate.ts"() {
321539
- import_promises5 = require("fs/promises");
321540
- import_rxjs61 = __toESM(require_cjs());
321805
+ import_promises8 = require("fs/promises");
321806
+ import_rxjs63 = __toESM(require_cjs());
321541
321807
  import_operators47 = __toESM(require_operators());
321542
321808
  init_gql_client();
321543
321809
  init_log();
@@ -321550,7 +321816,7 @@ var init_generate = __esm({
321550
321816
  'Describe the workflow: --description "charge the card with retries, then email the receipt"'
321551
321817
  );
321552
321818
  }
321553
- const base$ = cmd.from ? (0, import_rxjs61.from)((0, import_promises5.readFile)(cmd.from, "utf8")).pipe((0, import_operators47.map)(parseWorkflowFile)) : cmd.name ? GraphqlClienAPI.listWorkflows(projectId).pipe(
321819
+ const base$ = cmd.from ? (0, import_rxjs63.from)((0, import_promises8.readFile)(cmd.from, "utf8")).pipe((0, import_operators47.map)(parseWorkflowFile)) : cmd.name ? GraphqlClienAPI.listWorkflows(projectId).pipe(
321554
321820
  (0, import_operators47.switchMap)(
321555
321821
  (workflows) => workflows.some((w) => w.name === cmd.name) ? resolveWorkflow(projectId, cmd.name).pipe(
321556
321822
  (0, import_operators47.map)((w) => ({
@@ -321558,9 +321824,9 @@ var init_generate = __esm({
321558
321824
  description: w.description ?? void 0,
321559
321825
  definition: w.definition
321560
321826
  }))
321561
- ) : (0, import_rxjs61.of)(null)
321827
+ ) : (0, import_rxjs63.of)(null)
321562
321828
  )
321563
- ) : (0, import_rxjs61.of)(null);
321829
+ ) : (0, import_rxjs63.of)(null);
321564
321830
  return base$.pipe(
321565
321831
  (0, import_operators47.tap)(() => Logger.info("Asking the AI for a draft...")),
321566
321832
  (0, import_operators47.switchMap)(
@@ -321587,10 +321853,10 @@ var init_generate = __esm({
321587
321853
  const text = toWorkflowYaml(file2);
321588
321854
  const written$ = cmd.out ? writeTextFile(cmd.out, text).pipe(
321589
321855
  (0, import_operators47.tap)(() => Logger.info(`Wrote ${cmd.out}`))
321590
- ) : (0, import_rxjs61.of)(null).pipe((0, import_operators47.tap)(() => !cmd.apply && Logger.log(text)));
321856
+ ) : (0, import_rxjs63.of)(null).pipe((0, import_operators47.tap)(() => !cmd.apply && Logger.log(text)));
321591
321857
  return written$.pipe(
321592
321858
  (0, import_operators47.switchMap)(
321593
- () => cmd.apply ? applyWorkflow(projectId, file2) : (0, import_rxjs61.of)(null).pipe(
321859
+ () => cmd.apply ? applyWorkflow(projectId, file2) : (0, import_rxjs63.of)(null).pipe(
321594
321860
  (0, import_operators47.tap)(
321595
321861
  () => Logger.info(
321596
321862
  cmd.out ? `Review it, then: gcli workflow:apply --file ${cmd.out}${file2.name ? "" : " --name <name>"}` : "Save it with -o <file>, or re-run with --apply --name <name>"
@@ -321664,11 +321930,11 @@ var run_exports = {};
321664
321930
  __export(run_exports, {
321665
321931
  default: () => run_default
321666
321932
  });
321667
- var import_promises6, import_rxjs62, import_operators50, run_default;
321933
+ var import_promises9, import_rxjs64, import_operators50, run_default;
321668
321934
  var init_run = __esm({
321669
321935
  "src/commands/workflow/run.ts"() {
321670
- import_promises6 = require("fs/promises");
321671
- import_rxjs62 = __toESM(require_cjs());
321936
+ import_promises9 = require("fs/promises");
321937
+ import_rxjs64 = __toESM(require_cjs());
321672
321938
  import_operators50 = __toESM(require_operators());
321673
321939
  init_gql_client();
321674
321940
  init_log();
@@ -321676,7 +321942,7 @@ var init_run = __esm({
321676
321942
  init_helpers4();
321677
321943
  run_default = (cmd) => withProject(
321678
321944
  cmd.project,
321679
- (projectId) => (cmd.inputFile ? (0, import_rxjs62.from)((0, import_promises6.readFile)(cmd.inputFile, "utf8")) : (0, import_rxjs62.of)(cmd.input)).pipe(
321945
+ (projectId) => (cmd.inputFile ? (0, import_rxjs64.from)((0, import_promises9.readFile)(cmd.inputFile, "utf8")) : (0, import_rxjs64.of)(cmd.input)).pipe(
321680
321946
  (0, import_operators50.map)(parseRunInput),
321681
321947
  (0, import_operators50.switchMap)(
321682
321948
  (input) => resolveWorkflow(projectId, cmd.name).pipe(
@@ -321684,7 +321950,7 @@ var init_run = __esm({
321684
321950
  (w) => GraphqlClienAPI.startWorkflowRun(projectId, w.id, input).pipe(
321685
321951
  (0, import_operators50.tap)((run2) => Logger.info(`Started run ${run2.name}`)),
321686
321952
  (0, import_operators50.switchMap)(
321687
- (run2) => cmd.wait ? followRun(projectId, w.id, run2.name) : (0, import_rxjs62.of)(run2).pipe(
321953
+ (run2) => cmd.wait ? followRun(projectId, w.id, run2.name) : (0, import_rxjs64.of)(run2).pipe(
321688
321954
  (0, import_operators50.tap)(
321689
321955
  () => Logger.info(
321690
321956
  `Follow it: gcli workflow:status --name ${w.name} --run ${run2.name} --follow`
@@ -321858,11 +322124,11 @@ var trigger_add_exports = {};
321858
322124
  __export(trigger_add_exports, {
321859
322125
  default: () => trigger_add_default
321860
322126
  });
321861
- var import_promises7, import_rxjs63, import_operators54, trigger_add_default;
322127
+ var import_promises10, import_rxjs65, import_operators54, trigger_add_default;
321862
322128
  var init_trigger_add = __esm({
321863
322129
  "src/commands/workflow/trigger-add.ts"() {
321864
- import_promises7 = require("fs/promises");
321865
- import_rxjs63 = __toESM(require_cjs());
322130
+ import_promises10 = require("fs/promises");
322131
+ import_rxjs65 = __toESM(require_cjs());
321866
322132
  import_operators54 = __toESM(require_operators());
321867
322133
  init_gql_client();
321868
322134
  init_log();
@@ -321870,7 +322136,7 @@ var init_trigger_add = __esm({
321870
322136
  init_triggers();
321871
322137
  trigger_add_default = (cmd) => withProject(
321872
322138
  cmd.project,
321873
- (projectId) => (cmd.inputFile ? (0, import_rxjs63.from)((0, import_promises7.readFile)(cmd.inputFile, "utf8")) : (0, import_rxjs63.of)(void 0)).pipe(
322139
+ (projectId) => (cmd.inputFile ? (0, import_rxjs65.from)((0, import_promises10.readFile)(cmd.inputFile, "utf8")) : (0, import_rxjs65.of)(void 0)).pipe(
321874
322140
  (0, import_operators54.map)((inputText) => buildTriggerInput({ ...cmd, inputText })),
321875
322141
  (0, import_operators54.switchMap)(
321876
322142
  (trigger) => resolveWorkflow(projectId, cmd.name).pipe(
@@ -321959,10 +322225,10 @@ var init_trigger_remove = __esm({
321959
322225
  });
321960
322226
 
321961
322227
  // src/commands/workspace/approvals.ts
321962
- var import_readline3, APPROVAL_TIMEOUT_MS, TerminalPrompt, ApprovalGate;
322228
+ var import_readline4, APPROVAL_TIMEOUT_MS, TerminalPrompt, ApprovalGate;
321963
322229
  var init_approvals = __esm({
321964
322230
  "src/commands/workspace/approvals.ts"() {
321965
- import_readline3 = require("readline");
322231
+ import_readline4 = require("readline");
321966
322232
  APPROVAL_TIMEOUT_MS = 5 * 6e4;
321967
322233
  TerminalPrompt = class {
321968
322234
  constructor() {
@@ -321976,7 +322242,7 @@ var init_approvals = __esm({
321976
322242
  askNow(question, signal) {
321977
322243
  if (signal.aborted) return Promise.resolve(null);
321978
322244
  return new Promise((resolve2) => {
321979
- const rl = (0, import_readline3.createInterface)({
322245
+ const rl = (0, import_readline4.createInterface)({
321980
322246
  input: process.stdin,
321981
322247
  output: process.stdout
321982
322248
  });
@@ -322086,23 +322352,23 @@ var init_approvals = __esm({
322086
322352
  });
322087
322353
 
322088
322354
  // src/commands/workspace/config.ts
322089
- var import_promises8, readSavedWorkspaces, writeAll, readSavedWorkspace, saveWorkspace, forgetWorkspace;
322355
+ var import_promises11, readSavedWorkspaces, writeAll, readSavedWorkspace, saveWorkspace, forgetWorkspace;
322090
322356
  var init_config2 = __esm({
322091
322357
  "src/commands/workspace/config.ts"() {
322092
- import_promises8 = require("fs/promises");
322358
+ import_promises11 = require("fs/promises");
322093
322359
  init_types();
322094
322360
  readSavedWorkspaces = async () => {
322095
322361
  try {
322096
- const saved = JSON.parse(await (0, import_promises8.readFile)(workspacesDirectory, "utf-8"));
322362
+ const saved = JSON.parse(await (0, import_promises11.readFile)(workspacesDirectory, "utf-8"));
322097
322363
  return saved && typeof saved === "object" ? saved : {};
322098
322364
  } catch {
322099
322365
  return {};
322100
322366
  }
322101
322367
  };
322102
322368
  writeAll = async (all) => {
322103
- await (0, import_promises8.mkdir)(mainDirectory, { recursive: true });
322104
- await (0, import_promises8.writeFile)(workspacesDirectory, JSON.stringify(all, null, 2), "utf-8");
322105
- await (0, import_promises8.chmod)(workspacesDirectory, 384);
322369
+ await (0, import_promises11.mkdir)(mainDirectory, { recursive: true });
322370
+ await (0, import_promises11.writeFile)(workspacesDirectory, JSON.stringify(all, null, 2), "utf-8");
322371
+ await (0, import_promises11.chmod)(workspacesDirectory, 384);
322106
322372
  };
322107
322373
  readSavedWorkspace = async (root) => {
322108
322374
  const saved = (await readSavedWorkspaces())[root];
@@ -322131,13 +322397,13 @@ var init_config2 = __esm({
322131
322397
  });
322132
322398
 
322133
322399
  // src/commands/workspace/files.ts
322134
- var import_child_process5, import_crypto, import_fs8, import_path3, import_util12, run, WorkspaceError, MAX_READ_BYTES, MAX_WRITE_BYTES, DEFAULT_LIST_LIMIT, MAX_LIST_LIMIT, DEFAULT_SEARCH_RESULTS, MAX_SEARCH_RESULTS, MAX_MATCH_TEXT, SKIP_DIRS, SECRET_FILE, SECRET_TEMPLATE, isSecretFile, contentHash, toPosix, WorkspaceFiles;
322400
+ var import_child_process5, import_crypto2, import_fs9, import_path5, import_util12, run, WorkspaceError, MAX_READ_BYTES, MAX_WRITE_BYTES, DEFAULT_LIST_LIMIT, MAX_LIST_LIMIT, DEFAULT_SEARCH_RESULTS, MAX_SEARCH_RESULTS, MAX_MATCH_TEXT, SKIP_DIRS, SECRET_FILE, SECRET_TEMPLATE, isSecretFile, contentHash, toPosix, WorkspaceFiles;
322135
322401
  var init_files = __esm({
322136
322402
  "src/commands/workspace/files.ts"() {
322137
322403
  import_child_process5 = require("child_process");
322138
- import_crypto = require("crypto");
322139
- import_fs8 = require("fs");
322140
- import_path3 = require("path");
322404
+ import_crypto2 = require("crypto");
322405
+ import_fs9 = require("fs");
322406
+ import_path5 = require("path");
322141
322407
  import_util12 = require("util");
322142
322408
  run = (0, import_util12.promisify)(import_child_process5.execFile);
322143
322409
  WorkspaceError = class extends Error {
@@ -322157,11 +322423,11 @@ var init_files = __esm({
322157
322423
  SECRET_FILE = /^(\.env(\..+)?|.*\.(pem|key|p12|pfx|keystore|jks)|id_(rsa|dsa|ecdsa|ed25519)(\.pub)?|\.npmrc|\.pypirc|\.netrc|credentials(\.json)?)$/i;
322158
322424
  SECRET_TEMPLATE = /\.(example|sample|template|dist|defaults)$/i;
322159
322425
  isSecretFile = (path2) => {
322160
- const name2 = (0, import_path3.basename)(path2);
322426
+ const name2 = (0, import_path5.basename)(path2);
322161
322427
  return SECRET_FILE.test(name2) && !SECRET_TEMPLATE.test(name2);
322162
322428
  };
322163
- contentHash = (content) => (0, import_crypto.createHash)("sha256").update(content).digest("hex").slice(0, 16);
322164
- toPosix = (p) => p.split(import_path3.sep).join("/");
322429
+ contentHash = (content) => (0, import_crypto2.createHash)("sha256").update(content).digest("hex").slice(0, 16);
322430
+ toPosix = (p) => p.split(import_path5.sep).join("/");
322165
322431
  WorkspaceFiles = class {
322166
322432
  constructor(root, options = {}) {
322167
322433
  this.root = root;
@@ -322170,9 +322436,9 @@ var init_files = __esm({
322170
322436
  /** Absolute path for a workspace-relative one, or a WorkspaceError. */
322171
322437
  async resolvePath(input, { forWrite = false } = {}) {
322172
322438
  const rel = (input ?? ".").trim() || ".";
322173
- const abs = (0, import_path3.resolve)(this.root, rel);
322174
- const fromRoot = (0, import_path3.relative)(this.root, abs);
322175
- if (fromRoot.startsWith("..") || (0, import_path3.isAbsolute)(fromRoot)) {
322439
+ const abs = (0, import_path5.resolve)(this.root, rel);
322440
+ const fromRoot = (0, import_path5.relative)(this.root, abs);
322441
+ if (fromRoot.startsWith("..") || (0, import_path5.isAbsolute)(fromRoot)) {
322176
322442
  throw new WorkspaceError(
322177
322443
  `${input} is outside the workspace root - paths are relative to ${this.root}`,
322178
322444
  403
@@ -322181,9 +322447,9 @@ var init_files = __esm({
322181
322447
  let existing = abs;
322182
322448
  for (; ; ) {
322183
322449
  try {
322184
- const real = await import_fs8.promises.realpath(existing);
322185
- const realFromRoot = (0, import_path3.relative)(this.root, real);
322186
- if (realFromRoot.startsWith("..") || (0, import_path3.isAbsolute)(realFromRoot)) {
322450
+ const real = await import_fs9.promises.realpath(existing);
322451
+ const realFromRoot = (0, import_path5.relative)(this.root, real);
322452
+ if (realFromRoot.startsWith("..") || (0, import_path5.isAbsolute)(realFromRoot)) {
322187
322453
  throw new WorkspaceError(
322188
322454
  `${input} resolves outside the workspace root (symlink)`,
322189
322455
  403
@@ -322192,7 +322458,7 @@ var init_files = __esm({
322192
322458
  break;
322193
322459
  } catch (e2) {
322194
322460
  if (e2 instanceof WorkspaceError) throw e2;
322195
- const parent = (0, import_path3.dirname)(existing);
322461
+ const parent = (0, import_path5.dirname)(existing);
322196
322462
  if (parent === existing) break;
322197
322463
  existing = parent;
322198
322464
  }
@@ -322240,7 +322506,7 @@ var init_files = __esm({
322240
322506
  const out = [];
322241
322507
  const walk = async (relDir) => {
322242
322508
  if (out.length > limit) return;
322243
- const entries = await import_fs8.promises.readdir((0, import_path3.join)(this.root, relDir), { withFileTypes: true }).catch(() => []);
322509
+ const entries = await import_fs9.promises.readdir((0, import_path5.join)(this.root, relDir), { withFileTypes: true }).catch(() => []);
322244
322510
  for (const entry of entries) {
322245
322511
  if (SKIP_DIRS.has(entry.name)) continue;
322246
322512
  const rel = relDir === "." ? entry.name : `${relDir}/${entry.name}`;
@@ -322283,7 +322549,7 @@ var init_files = __esm({
322283
322549
  entries = entries.slice(0, limit);
322284
322550
  await Promise.all(
322285
322551
  entries.filter((e2) => e2.type === "file").map(async (e2) => {
322286
- e2.size = await import_fs8.promises.stat((0, import_path3.join)(this.root, e2.path)).then((s2) => s2.size).catch(() => void 0);
322552
+ e2.size = await import_fs9.promises.stat((0, import_path5.join)(this.root, e2.path)).then((s2) => s2.size).catch(() => void 0);
322287
322553
  })
322288
322554
  );
322289
322555
  return {
@@ -322294,12 +322560,12 @@ var init_files = __esm({
322294
322560
  async read(args) {
322295
322561
  if (!args.path) throw new WorkspaceError("path is required");
322296
322562
  const { abs, rel } = await this.resolvePath(args.path);
322297
- const stat2 = await import_fs8.promises.stat(abs).catch(() => null);
322563
+ const stat2 = await import_fs9.promises.stat(abs).catch(() => null);
322298
322564
  if (!stat2) throw new WorkspaceError(`${rel} does not exist`, 404);
322299
322565
  if (stat2.isDirectory()) {
322300
322566
  throw new WorkspaceError(`${rel} is a directory - use LocalListFiles`);
322301
322567
  }
322302
- const buffer = await import_fs8.promises.readFile(abs);
322568
+ const buffer = await import_fs9.promises.readFile(abs);
322303
322569
  if (buffer.subarray(0, 8e3).includes(0)) {
322304
322570
  return { path: rel, size: stat2.size, binary: true, content: "" };
322305
322571
  }
@@ -322328,7 +322594,7 @@ var init_files = __esm({
322328
322594
  };
322329
322595
  }
322330
322596
  async currentText(abs) {
322331
- return import_fs8.promises.readFile(abs, "utf-8").catch((e2) => {
322597
+ return import_fs9.promises.readFile(abs, "utf-8").catch((e2) => {
322332
322598
  if (e2?.code === "ENOENT") return null;
322333
322599
  throw e2;
322334
322600
  });
@@ -322349,8 +322615,8 @@ var init_files = __esm({
322349
322615
  );
322350
322616
  }
322351
322617
  }
322352
- await import_fs8.promises.mkdir((0, import_path3.dirname)(abs), { recursive: true });
322353
- await import_fs8.promises.writeFile(abs, content, "utf-8");
322618
+ await import_fs9.promises.mkdir((0, import_path5.dirname)(abs), { recursive: true });
322619
+ await import_fs9.promises.writeFile(abs, content, "utf-8");
322354
322620
  return {
322355
322621
  path: rel,
322356
322622
  size: Buffer.byteLength(content),
@@ -322382,7 +322648,7 @@ var init_files = __esm({
322382
322648
  );
322383
322649
  }
322384
322650
  const after = args.replaceAll ? before.split(args.oldText).join(args.newText ?? "") : before.replace(args.oldText, () => args.newText ?? "");
322385
- await import_fs8.promises.writeFile(abs, after, "utf-8");
322651
+ await import_fs9.promises.writeFile(abs, after, "utf-8");
322386
322652
  return {
322387
322653
  path: rel,
322388
322654
  replacements: args.replaceAll ? count : 1,
@@ -322393,14 +322659,14 @@ var init_files = __esm({
322393
322659
  async delete(args) {
322394
322660
  if (!args.path) throw new WorkspaceError("path is required");
322395
322661
  const { abs, rel } = await this.resolvePath(args.path, { forWrite: true });
322396
- const stat2 = await import_fs8.promises.lstat(abs).catch(() => null);
322662
+ const stat2 = await import_fs9.promises.lstat(abs).catch(() => null);
322397
322663
  if (!stat2) return { path: rel, deleted: false };
322398
322664
  if (stat2.isDirectory()) {
322399
322665
  throw new WorkspaceError(
322400
322666
  `${rel} is a directory - only files can be deleted (use RunCommand for more)`
322401
322667
  );
322402
322668
  }
322403
- await import_fs8.promises.unlink(abs);
322669
+ await import_fs9.promises.unlink(abs);
322404
322670
  return { path: rel, deleted: true };
322405
322671
  }
322406
322672
  async search(args) {
@@ -322452,7 +322718,7 @@ var init_files = __esm({
322452
322718
  raw = [];
322453
322719
  for (const file2 of await this.allFiles(rel, 2e4)) {
322454
322720
  if (globRe && !globRe.test(file2)) continue;
322455
- const text = await import_fs8.promises.readFile((0, import_path3.join)(this.root, file2)).catch(() => null);
322721
+ const text = await import_fs9.promises.readFile((0, import_path5.join)(this.root, file2)).catch(() => null);
322456
322722
  if (!text || text.subarray(0, 8e3).includes(0)) continue;
322457
322723
  text.toString("utf-8").split("\n").forEach((line, i2) => {
322458
322724
  if (raw.length <= max && re.test(line)) {
@@ -322847,10 +323113,10 @@ ${this.text}` : this.text;
322847
323113
  });
322848
323114
 
322849
323115
  // src/commands/workspace/connection.ts
322850
- var import_os5, WORKSPACE_PATH_PREFIX, WORKSPACE_OPS, HEARTBEAT_MUTATION2, REQUEST_APPROVAL_MUTATION, SETTLE_APPROVAL_MUTATION, str, num, short, WorkspaceConnection;
323116
+ var import_os6, WORKSPACE_PATH_PREFIX, WORKSPACE_OPS, HEARTBEAT_MUTATION2, REQUEST_APPROVAL_MUTATION, SETTLE_APPROVAL_MUTATION, str, num, short, WorkspaceConnection;
322851
323117
  var init_connection2 = __esm({
322852
323118
  "src/commands/workspace/connection.ts"() {
322853
- import_os5 = require("os");
323119
+ import_os6 = require("os");
322854
323120
  init_tunnel();
322855
323121
  init_approvals();
322856
323122
  init_files();
@@ -322933,7 +323199,7 @@ var init_connection2 = __esm({
322933
323199
  const data = await this.operation(HEARTBEAT_MUTATION2, {
322934
323200
  info: {
322935
323201
  root: this.options.root,
322936
- hostname: (0, import_os5.hostname)(),
323202
+ hostname: (0, import_os6.hostname)(),
322937
323203
  platform: process.platform,
322938
323204
  gitBranch: await this.files.gitBranch(),
322939
323205
  clientVersion: this.options.version,
@@ -323245,12 +323511,12 @@ __export(start_exports4, {
323245
323511
  WORKSPACE_VERSION: () => WORKSPACE_VERSION,
323246
323512
  default: () => start_default2
323247
323513
  });
323248
- var import_promises9, import_path4, import_rxjs64, WORKSPACE_VERSION, csv, resolveWorkspace, start_default2;
323514
+ var import_promises12, import_path6, import_rxjs66, WORKSPACE_VERSION, csv, resolveWorkspace, start_default2;
323249
323515
  var init_start4 = __esm({
323250
323516
  "src/commands/workspace/start.ts"() {
323251
- import_promises9 = require("fs/promises");
323252
- import_path4 = require("path");
323253
- import_rxjs64 = __toESM(require_cjs());
323517
+ import_promises12 = require("fs/promises");
323518
+ import_path6 = require("path");
323519
+ import_rxjs66 = __toESM(require_cjs());
323254
323520
  init_helpers();
323255
323521
  init_gql_client();
323256
323522
  init_log();
@@ -323267,7 +323533,7 @@ var init_start4 = __esm({
323267
323533
  if (cmd.token) {
323268
323534
  return {
323269
323535
  id: "(from --token)",
323270
- name: cmd.name ?? (0, import_path4.basename)(root),
323536
+ name: cmd.name ?? (0, import_path6.basename)(root),
323271
323537
  token: cmd.token,
323272
323538
  projectId: cmd.project ?? "",
323273
323539
  root
@@ -323280,16 +323546,16 @@ var init_start4 = __esm({
323280
323546
  if (saved && (!cmd.project || cmd.project === saved.projectId)) {
323281
323547
  return saved;
323282
323548
  }
323283
- const projectId = await (0, import_rxjs64.lastValueFrom)(parseProjectId(cmd.project)).catch(
323549
+ const projectId = await (0, import_rxjs66.lastValueFrom)(parseProjectId(cmd.project)).catch(
323284
323550
  () => {
323285
323551
  throw new Error(
323286
323552
  "No project selected. Pass --project <projectId> or run `gcli project:use <projectId>` first."
323287
323553
  );
323288
323554
  }
323289
323555
  );
323290
- const name2 = cmd.name || (0, import_path4.basename)(root);
323556
+ const name2 = cmd.name || (0, import_path6.basename)(root);
323291
323557
  Logger.info(`Registering ${root} as local workspace "${name2}"...`);
323292
- const { workspace, token } = await (0, import_rxjs64.lastValueFrom)(
323558
+ const { workspace, token } = await (0, import_rxjs66.lastValueFrom)(
323293
323559
  GraphqlClienAPI.createLocalWorkspace(projectId, name2)
323294
323560
  ).catch((e2) => {
323295
323561
  throw new Error(
@@ -323307,7 +323573,7 @@ var init_start4 = __esm({
323307
323573
  return created;
323308
323574
  };
323309
323575
  start_default2 = async (cmd) => {
323310
- const root = await (0, import_promises9.realpath)(process.cwd());
323576
+ const root = await (0, import_promises12.realpath)(process.cwd());
323311
323577
  const workspace = await resolveWorkspace(root, cmd);
323312
323578
  const wsUrl = cmd.wsUrl || workspace.wsUrl || deriveSubscriptionsUrl(await readLoginApiUrl());
323313
323579
  const policy = new CommandPolicy(
@@ -323380,16 +323646,16 @@ var list_exports9 = {};
323380
323646
  __export(list_exports9, {
323381
323647
  default: () => list_default9
323382
323648
  });
323383
- var import_rxjs65, list_default9;
323649
+ var import_rxjs67, list_default9;
323384
323650
  var init_list9 = __esm({
323385
323651
  "src/commands/workspace/list.ts"() {
323386
- import_rxjs65 = __toESM(require_cjs());
323652
+ import_rxjs67 = __toESM(require_cjs());
323387
323653
  init_gql_client();
323388
323654
  init_log();
323389
323655
  init_config2();
323390
323656
  list_default9 = async (cmd) => {
323391
323657
  const [workspaces, saved] = await Promise.all([
323392
- (0, import_rxjs65.lastValueFrom)(GraphqlClienAPI.listLocalWorkspaces(cmd.project)),
323658
+ (0, import_rxjs67.lastValueFrom)(GraphqlClienAPI.listLocalWorkspaces(cmd.project)),
323393
323659
  readSavedWorkspaces()
323394
323660
  ]);
323395
323661
  const onThisMachine = new Set(Object.values(saved).map((w) => w.id));
@@ -323423,23 +323689,23 @@ var delete_exports6 = {};
323423
323689
  __export(delete_exports6, {
323424
323690
  default: () => delete_default6
323425
323691
  });
323426
- var import_promises10, import_rxjs66, delete_default6;
323692
+ var import_promises13, import_rxjs68, delete_default6;
323427
323693
  var init_delete6 = __esm({
323428
323694
  "src/commands/workspace/delete.ts"() {
323429
- import_promises10 = require("fs/promises");
323430
- import_rxjs66 = __toESM(require_cjs());
323695
+ import_promises13 = require("fs/promises");
323696
+ import_rxjs68 = __toESM(require_cjs());
323431
323697
  init_gql_client();
323432
323698
  init_log();
323433
323699
  init_config2();
323434
323700
  delete_default6 = async (cmd) => {
323435
- const root = await (0, import_promises10.realpath)(process.cwd());
323701
+ const root = await (0, import_promises13.realpath)(process.cwd());
323436
323702
  const workspaceId = cmd.id || (await readSavedWorkspace(root))?.id;
323437
323703
  if (!workspaceId) {
323438
323704
  throw new Error(
323439
323705
  "No workspace registered for this directory - pass --id (see `gcli workspace:list`)."
323440
323706
  );
323441
323707
  }
323442
- await (0, import_rxjs66.lastValueFrom)(GraphqlClienAPI.deleteLocalWorkspace(workspaceId));
323708
+ await (0, import_rxjs68.lastValueFrom)(GraphqlClienAPI.deleteLocalWorkspace(workspaceId));
323443
323709
  await forgetWorkspace({ id: workspaceId });
323444
323710
  Logger.log(
323445
323711
  `Local workspace ${workspaceId} deleted; its token no longer works.`
@@ -323542,6 +323808,22 @@ function registerClusterCommands(program2) {
323542
323808
  target(
323543
323809
  program2.command("cluster:resume").description("Let new work run on a paused machine again (uncordon)")
323544
323810
  ).option("-n, --name <name>", "Machine name (see cluster:nodes)").action(lazy(() => Promise.resolve().then(() => (init_pause(), pause_exports)).then((m2) => m2.resume)));
323811
+ target(
323812
+ program2.command("cluster:reset-machine").description(
323813
+ "Bring a detached machine back to maintenance mode to attach it again (wipes its config and data, keeps the boot loader)"
323814
+ )
323815
+ ).option("-n, --name <name>", "Machine name").option("--node-ip <nodeIp>", "The machine's address on your network").option("--yes", "Do not ask for confirmation").action(lazy(() => Promise.resolve().then(() => (init_reset_machine(), reset_machine_exports)).then((m2) => m2.default)));
323816
+ target(
323817
+ program2.command("cluster:talosconfig").description(
323818
+ "A short-lived talosconfig for one of your Talos clusters (admin of its machines with talosctl) - printed, or saved with -o"
323819
+ )
323820
+ ).option(
323821
+ "-o, --output <output>",
323822
+ "Write to this file (mode 600) instead of stdout"
323823
+ ).option(
323824
+ "--ttl <minutes>",
323825
+ "How long it works, 5 to 1440 minutes (default 60)"
323826
+ ).action(lazy(() => Promise.resolve().then(() => (init_talosconfig(), talosconfig_exports)).then((m2) => m2.default)));
323545
323827
  target(
323546
323828
  program2.command("cluster:detach").description(
323547
323829
  "Drain and remove an attached machine from a cluster (reset the machine afterwards)"