@gapi/gcli 1.8.253 → 1.8.254

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.
@@ -0,0 +1,29 @@
1
+ ## 2026-11-02 - lambforge-agent-skill: gcli build reads lambforge.yaml and works without tsconfig; environment flags sent as numbers without --spec; unset lambda scale values left to the plan
2
+
3
+ **Feature:** lambforge-agent-skill · **Type:** fix
4
+
5
+ From the static-hosting handover (an agent needed 9 attempts; graphql-server
6
+ plan 16 C5-C8):
7
+
8
+ - `commands/build/index.ts`: no commander defaults for files / bundle /
9
+ minify / target / outfile, so `build.ts`'s fallback runs: flag ->
10
+ `lambforge.yaml` (`function.file`, `options.bundler.*`) -> index.ts /
11
+ bundle / `node24` / index.js. The `-t node14.4` default used to win over the
12
+ yaml every time. `build.ts`: the decorators plugin only when a
13
+ `tsconfig.json` exists (`[plugin: tsc] failed to open 'undefined'`).
14
+ - `commands/environment/environment-payload.ts`: create/update send numeric
15
+ flags as numbers (`--poolSize 0` was `"0"` -> `Expected type Int`), drop
16
+ the CLI-only `spec` / `project` / `clusterName` (`Field "spec" is not
17
+ defined`), and refuse a non-number with the flag name.
18
+ - `commands/lambda/helpers/index.ts`: unset `concurrency`,
19
+ `functionTimeout`, `specializationTimeout` are sent as 0 - the server fills
20
+ them in within the plan. The fixed 500 / 60 / 120 were refused on plans
21
+ with lower maxima.
22
+ - **Test:** `npx jest --coverage=false test/environment-payload.spec.ts`;
23
+ manual: a project with only `src/main.ts` + `lambforge.yaml`
24
+ (`file: ./src/main.ts`, `outfile: out.js`) -> `gcli build` writes `out.js`.
25
+ - **Debug:** `gcli build` bundling the wrong file = a flag or yaml field
26
+ overrides it (`--files` wins); `Expected type Int` from environment
27
+ commands = an old gcli.
28
+ - **Verification:** 133/133 tests, `tsc --noEmit` + eslint clean; the manual
29
+ build above ran on the rebuilt `release/index.js`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gapi/gcli",
3
- "version": "1.8.253",
3
+ "version": "1.8.254",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/Stradivario/gapi.git"
package/release/index.js CHANGED
@@ -29867,7 +29867,7 @@ var require_buffer_list = __commonJS({
29867
29867
  }
29868
29868
  }, {
29869
29869
  key: "join",
29870
- value: function join6(s2) {
29870
+ value: function join7(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 join6(s2) {
32888
+ value: function join7(s2) {
32889
32889
  if (this.length === 0) return "";
32890
32890
  var p = this.head;
32891
32891
  var ret = "" + p.data;
@@ -38710,7 +38710,7 @@ var require_util = __commonJS({
38710
38710
  return path2;
38711
38711
  }
38712
38712
  exports2.normalize = normalize2;
38713
- function join6(aRoot, aPath) {
38713
+ function join7(aRoot, aPath) {
38714
38714
  if (aRoot === "") {
38715
38715
  aRoot = ".";
38716
38716
  }
@@ -38742,7 +38742,7 @@ var require_util = __commonJS({
38742
38742
  }
38743
38743
  return joined;
38744
38744
  }
38745
- exports2.join = join6;
38745
+ exports2.join = join7;
38746
38746
  exports2.isAbsolute = function(aPath) {
38747
38747
  return aPath.charAt(0) === "/" || urlRegexp.test(aPath);
38748
38748
  };
@@ -38915,7 +38915,7 @@ var require_util = __commonJS({
38915
38915
  parsed.path = parsed.path.substring(0, index + 1);
38916
38916
  }
38917
38917
  }
38918
- sourceURL = join6(urlGenerate(parsed), sourceURL);
38918
+ sourceURL = join7(urlGenerate(parsed), sourceURL);
38919
38919
  }
38920
38920
  return normalize2(sourceURL);
38921
38921
  }
@@ -254783,11 +254783,13 @@ var build_exports = {};
254783
254783
  __export(build_exports, {
254784
254784
  default: () => build_default
254785
254785
  });
254786
- var import_esbuild_decorators, import_esbuild, import_rxjs6, import_operators5, build_default;
254786
+ var import_esbuild_decorators, import_esbuild, import_fs3, import_path, import_rxjs6, import_operators5, build_default;
254787
254787
  var init_build = __esm({
254788
254788
  "src/commands/build/build.ts"() {
254789
254789
  import_esbuild_decorators = __toESM(require_src());
254790
254790
  import_esbuild = __toESM(require("esbuild"));
254791
+ import_fs3 = require("fs");
254792
+ import_path = require("path");
254791
254793
  import_rxjs6 = __toESM(require_cjs());
254792
254794
  import_operators5 = __toESM(require_operators());
254793
254795
  init_log();
@@ -254818,12 +254820,15 @@ var init_build = __esm({
254818
254820
  (0, import_operators5.switchMap)(
254819
254821
  ({ esbuild: esbuild2, options }) => esbuild2.build({
254820
254822
  ...options,
254821
- plugins: [
254823
+ // Decorator metadata needs the project's tsconfig; without one
254824
+ // the plugin failed with "[plugin: tsc] failed to open
254825
+ // 'undefined'" - plain esbuild handles a project without it.
254826
+ plugins: (0, import_fs3.existsSync)((0, import_path.join)(process.cwd(), "tsconfig.json")) ? [
254822
254827
  (0, import_esbuild_decorators.esbuildDecorators)({
254823
254828
  tsconfig: "./tsconfig.json",
254824
254829
  cwd: process.cwd()
254825
254830
  })
254826
- ]
254831
+ ] : []
254827
254832
  })
254828
254833
  ),
254829
254834
  (0, import_operators5.tap)((data) => {
@@ -255726,12 +255731,12 @@ async function ensureTalosctl(version2) {
255726
255731
  return "talosctl";
255727
255732
  }
255728
255733
  const asset = talosctlAssetName();
255729
- const dir = (0, import_path.join)(mainDirectory, "bin");
255730
- const binary = (0, import_path.join)(
255734
+ const dir = (0, import_path2.join)(mainDirectory, "bin");
255735
+ const binary = (0, import_path2.join)(
255731
255736
  dir,
255732
255737
  `talosctl-${version2}${asset.endsWith(".exe") ? ".exe" : ""}`
255733
255738
  );
255734
- if ((0, import_fs3.existsSync)(binary)) {
255739
+ if ((0, import_fs4.existsSync)(binary)) {
255735
255740
  return binary;
255736
255741
  }
255737
255742
  Logger.info(
@@ -255757,14 +255762,14 @@ async function ensureTalosctl(version2) {
255757
255762
  Logger.info(`talosctl ${version2} saved to ${binary}`);
255758
255763
  return binary;
255759
255764
  }
255760
- var import_child_process, import_crypto, import_fs3, import_promises, import_path, RELEASES, VERSION_RE, clientVersionOf, runBinary;
255765
+ var import_child_process, import_crypto, import_fs4, import_promises, import_path2, RELEASES, VERSION_RE, clientVersionOf, runBinary;
255761
255766
  var init_talosctl = __esm({
255762
255767
  "src/commands/cluster/helpers/talosctl.ts"() {
255763
255768
  import_child_process = require("child_process");
255764
255769
  import_crypto = require("crypto");
255765
- import_fs3 = require("fs");
255770
+ import_fs4 = require("fs");
255766
255771
  import_promises = require("fs/promises");
255767
- import_path = require("path");
255772
+ import_path2 = require("path");
255768
255773
  init_log();
255769
255774
  init_types();
255770
255775
  RELEASES = "https://github.com/siderolabs/talos/releases/download";
@@ -255790,12 +255795,12 @@ var attach_exports = {};
255790
255795
  __export(attach_exports, {
255791
255796
  default: () => attach_default
255792
255797
  });
255793
- var import_promises2, import_os2, import_path2, import_readline, import_rxjs17, sleep, ask, attach_default;
255798
+ var import_promises2, import_os2, import_path3, import_readline, import_rxjs17, sleep, ask, attach_default;
255794
255799
  var init_attach2 = __esm({
255795
255800
  "src/commands/cluster/attach.ts"() {
255796
255801
  import_promises2 = require("fs/promises");
255797
255802
  import_os2 = require("os");
255798
- import_path2 = require("path");
255803
+ import_path3 = require("path");
255799
255804
  import_readline = require("readline");
255800
255805
  import_rxjs17 = __toESM(require_cjs());
255801
255806
  init_gql_client();
@@ -255889,8 +255894,8 @@ var init_attach2 = __esm({
255889
255894
  `The cluster runs Talos ${join_.talosVersion}, the machine booted ${version2}. It installs ${join_.talosVersion} anyway; if the join fails, boot ${join_.isoUrl}.`
255890
255895
  );
255891
255896
  }
255892
- const dir = await (0, import_promises2.mkdtemp)((0, import_path2.join)((0, import_os2.tmpdir)(), "gcli-attach-"));
255893
- const file2 = (0, import_path2.join)(dir, "machine.yaml");
255897
+ const dir = await (0, import_promises2.mkdtemp)((0, import_path3.join)((0, import_os2.tmpdir)(), "gcli-attach-"));
255898
+ const file2 = (0, import_path3.join)(dir, "machine.yaml");
255894
255899
  try {
255895
255900
  await (0, import_promises2.writeFile)(file2, join_.config, { mode: 384 });
255896
255901
  const applied = await talosctl(
@@ -256002,12 +256007,12 @@ __export(reset_machine_exports, {
256002
256007
  default: () => reset_machine_default,
256003
256008
  hostnameOf: () => hostnameOf
256004
256009
  });
256005
- var import_promises3, import_os3, import_path3, import_readline2, import_rxjs20, hostnameOf, reset_machine_default;
256010
+ var import_promises3, import_os3, import_path4, import_readline2, import_rxjs20, hostnameOf, reset_machine_default;
256006
256011
  var init_reset_machine = __esm({
256007
256012
  "src/commands/cluster/reset-machine.ts"() {
256008
256013
  import_promises3 = require("fs/promises");
256009
256014
  import_os3 = require("os");
256010
- import_path3 = require("path");
256015
+ import_path4 = require("path");
256011
256016
  import_readline2 = require("readline");
256012
256017
  import_rxjs20 = __toESM(require_cjs());
256013
256018
  init_gql_client();
@@ -256045,8 +256050,8 @@ var init_reset_machine = __esm({
256045
256050
  GraphqlClienAPI.clusterTalosconfig(clusterId, 15)
256046
256051
  );
256047
256052
  const binary = access.talosVersion ? await ensureTalosctl(access.talosVersion) : "talosctl";
256048
- const dir = await (0, import_promises3.mkdtemp)((0, import_path3.join)((0, import_os3.tmpdir)(), "gcli-reset-"));
256049
- const config2 = (0, import_path3.join)(dir, "talosconfig");
256053
+ const dir = await (0, import_promises3.mkdtemp)((0, import_path4.join)((0, import_os3.tmpdir)(), "gcli-reset-"));
256054
+ const config2 = (0, import_path4.join)(dir, "talosconfig");
256050
256055
  try {
256051
256056
  await (0, import_promises3.writeFile)(config2, access.talosconfig, { mode: 384 });
256052
256057
  const talos = (args, timeoutMs = 3e4) => runBinary(
@@ -256588,6 +256593,45 @@ var init_list_environments = __esm({
256588
256593
  }
256589
256594
  });
256590
256595
 
256596
+ // src/commands/environment/environment-payload.ts
256597
+ var NUMERIC_FIELDS, CLI_ONLY, environmentPayload;
256598
+ var init_environment_payload = __esm({
256599
+ "src/commands/environment/environment-payload.ts"() {
256600
+ NUMERIC_FIELDS = [
256601
+ "minCpu",
256602
+ "maxCpu",
256603
+ "minMemory",
256604
+ "maxMemory",
256605
+ "poolSize",
256606
+ "maxPods",
256607
+ "builderPoolSize",
256608
+ "builderMaxParallelBuilds",
256609
+ "builderIdleTimeout",
256610
+ "terminationGracePeriod"
256611
+ ];
256612
+ CLI_ONLY = ["spec", "project", "clusterName"];
256613
+ environmentPayload = (spec, flags) => {
256614
+ const merged = { ...spec };
256615
+ for (const [key, value] of Object.entries(flags)) {
256616
+ if (value !== void 0) merged[key] = value;
256617
+ }
256618
+ for (const key of CLI_ONLY) delete merged[key];
256619
+ for (const key of NUMERIC_FIELDS) {
256620
+ const value = merged[key];
256621
+ if (value === void 0 || value === null || typeof value === "number") {
256622
+ continue;
256623
+ }
256624
+ const n = Number(value);
256625
+ if (!Number.isInteger(n)) {
256626
+ throw new Error(`--${key} must be a whole number, got "${value}"`);
256627
+ }
256628
+ merged[key] = n;
256629
+ }
256630
+ return merged;
256631
+ };
256632
+ }
256633
+ });
256634
+
256591
256635
  // src/commands/environment/create-environment.ts
256592
256636
  var create_environment_exports = {};
256593
256637
  __export(create_environment_exports, {
@@ -256602,6 +256646,7 @@ var init_create_environment = __esm({
256602
256646
  init_gql_client();
256603
256647
  init_log();
256604
256648
  init_load_spec();
256649
+ init_environment_payload();
256605
256650
  create_environment_default = (cmd) => {
256606
256651
  const { clusterName: cmdClusterName, ...cmdRest } = cmd;
256607
256652
  return (0, import_rxjs28.lastValueFrom)(
@@ -256621,8 +256666,7 @@ var init_create_environment = __esm({
256621
256666
  }).pipe(
256622
256667
  (0, import_operators13.switchMap)(
256623
256668
  (clusterId) => GraphqlClienAPI.createEnvironment(projectId, {
256624
- ...data,
256625
- ...cmdRest,
256669
+ ...environmentPayload(data, cmdRest),
256626
256670
  clusterId
256627
256671
  })
256628
256672
  )
@@ -256668,6 +256712,7 @@ var init_update_environment = __esm({
256668
256712
  init_gql_client();
256669
256713
  init_log();
256670
256714
  init_load_spec();
256715
+ init_environment_payload();
256671
256716
  update_environment_default = (cmd) => {
256672
256717
  const { clusterName: cmdClusterName, ...cmdRest } = cmd;
256673
256718
  return (0, import_rxjs29.lastValueFrom)(
@@ -256688,8 +256733,7 @@ var init_update_environment = __esm({
256688
256733
  }).pipe(
256689
256734
  (0, import_operators14.switchMap)(
256690
256735
  (clusterId) => GraphqlClienAPI.updateEnvironment(projectId, {
256691
- ...data,
256692
- ...cmdRest,
256736
+ ...environmentPayload(data, cmdRest),
256693
256737
  clusterId
256694
256738
  })
256695
256739
  )
@@ -270956,7 +271000,7 @@ var require_BufferList2 = __commonJS({
270956
271000
  this.head = this.tail = null;
270957
271001
  this.length = 0;
270958
271002
  };
270959
- BufferList.prototype.join = function join6(s2) {
271003
+ BufferList.prototype.join = function join7(s2) {
270960
271004
  if (this.length === 0) return "";
270961
271005
  var p = this.head;
270962
271006
  var ret = "" + p.data;
@@ -275756,7 +275800,7 @@ var require_buffer_list3 = __commonJS({
275756
275800
  }
275757
275801
  }, {
275758
275802
  key: "join",
275759
- value: function join6(s2) {
275803
+ value: function join7(s2) {
275760
275804
  if (this.length === 0) return "";
275761
275805
  var p = this.head;
275762
275806
  var ret = "" + p.data;
@@ -279098,7 +279142,7 @@ var require_buffer_list4 = __commonJS({
279098
279142
  }
279099
279143
  }, {
279100
279144
  key: "join",
279101
- value: function join6(s2) {
279145
+ value: function join7(s2) {
279102
279146
  if (this.length === 0) return "";
279103
279147
  var p = this.head;
279104
279148
  var ret = "" + p.data;
@@ -281870,7 +281914,7 @@ var require_buffer_list5 = __commonJS({
281870
281914
  }
281871
281915
  }, {
281872
281916
  key: "join",
281873
- value: function join6(s2) {
281917
+ value: function join7(s2) {
281874
281918
  if (this.length === 0) return "";
281875
281919
  var p = this.head;
281876
281920
  var ret = "" + p.data;
@@ -285107,7 +285151,7 @@ var require_buffer_list6 = __commonJS({
285107
285151
  }
285108
285152
  }, {
285109
285153
  key: "join",
285110
- value: function join6(s2) {
285154
+ value: function join7(s2) {
285111
285155
  if (this.length === 0) return "";
285112
285156
  var p = this.head;
285113
285157
  var ret = "" + p.data;
@@ -288055,12 +288099,12 @@ var package_exports = {};
288055
288099
  __export(package_exports, {
288056
288100
  default: () => package_default
288057
288101
  });
288058
- var import_archiver, import_child_process2, import_fs4, import_rxjs32, import_operators17, import_util3, ReadFile, package_default;
288102
+ var import_archiver, import_child_process2, import_fs5, import_rxjs32, import_operators17, import_util3, ReadFile, package_default;
288059
288103
  var init_package = __esm({
288060
288104
  "src/commands/lambda/package.ts"() {
288061
288105
  import_archiver = __toESM(require_archiver());
288062
288106
  import_child_process2 = require("child_process");
288063
- import_fs4 = require("fs");
288107
+ import_fs5 = require("fs");
288064
288108
  import_rxjs32 = __toESM(require_cjs());
288065
288109
  import_operators17 = __toESM(require_operators());
288066
288110
  import_util3 = require("util");
@@ -288091,10 +288135,10 @@ var init_package = __esm({
288091
288135
  return (0, import_rxjs32.lastValueFrom)(
288092
288136
  (0, import_rxjs32.from)(streamToBufferPromise(archive)).pipe(
288093
288137
  (0, import_operators17.switchMap)(
288094
- (buffer) => (0, import_rxjs32.from)((0, import_util3.promisify)(import_fs4.mkdir)(".gcache")).pipe(
288138
+ (buffer) => (0, import_rxjs32.from)((0, import_util3.promisify)(import_fs5.mkdir)(".gcache")).pipe(
288095
288139
  (0, import_operators17.catchError)(() => (0, import_rxjs32.of)(true)),
288096
288140
  (0, import_operators17.switchMap)(
288097
- () => (0, import_util3.promisify)(import_fs4.writeFile)(`.gcache/${data.name}.zip`, buffer)
288141
+ () => (0, import_util3.promisify)(import_fs5.writeFile)(`.gcache/${data.name}.zip`, buffer)
288098
288142
  )
288099
288143
  )
288100
288144
  )
@@ -288118,11 +288162,11 @@ function streamToBufferPromise(file2) {
288118
288162
  });
288119
288163
  });
288120
288164
  }
288121
- var import_form_data, import_fs5, import_rxjs33, import_operators18, import_stream_to_buffer, ReadFile2, createOrUpdateLambda, createCommand;
288165
+ var import_form_data, import_fs6, import_rxjs33, import_operators18, import_stream_to_buffer, ReadFile2, createOrUpdateLambda, createCommand;
288122
288166
  var init_helpers2 = __esm({
288123
288167
  "src/commands/lambda/helpers/index.ts"() {
288124
288168
  import_form_data = __toESM(require_form_data());
288125
- import_fs5 = require("fs");
288169
+ import_fs6 = require("fs");
288126
288170
  init_src();
288127
288171
  import_rxjs33 = __toESM(require_cjs());
288128
288172
  import_operators18 = __toESM(require_operators());
@@ -288154,7 +288198,7 @@ var init_helpers2 = __esm({
288154
288198
  }
288155
288199
  await package_default(cmd);
288156
288200
  const body = new import_form_data.default();
288157
- body.append("file[]", (0, import_fs5.createReadStream)(`.gcache/${data.name}.zip`));
288201
+ body.append("file[]", (0, import_fs6.createReadStream)(`.gcache/${data.name}.zip`));
288158
288202
  const config2 = await (0, import_rxjs33.lastValueFrom)(GraphqlClienAPI.getConfig());
288159
288203
  return (0, import_rxjs33.lastValueFrom)(
288160
288204
  (0, import_rxjs33.from)(
@@ -288223,9 +288267,12 @@ var init_helpers2 = __esm({
288223
288267
  minScale: cmd.minScale || payload.scaleOptions?.minScale || 0,
288224
288268
  targetCpu: cmd.targetCpu || payload.scaleOptions?.targetCpu || 0,
288225
288269
  idleTimeout: cmd.idleTimeout || payload.scaleOptions?.idleTimeout || 120,
288226
- concurrency: cmd.concurrency || payload.scaleOptions?.concurrency || 500,
288227
- functionTimeout: cmd.functionTimeout || payload.scaleOptions?.functionTimeout || 60,
288228
- specializationTimeout: cmd.specializationTimeout || payload.scaleOptions?.specializationTimeout || 120
288270
+ // 0 = not set: the server fills these in within the project's
288271
+ // plan (concurrency <= 3, timeouts 60/120 s capped). A fixed
288272
+ // 500 / 60 / 120 here was refused on plans with lower maxima.
288273
+ concurrency: cmd.concurrency || payload.scaleOptions?.concurrency || 0,
288274
+ functionTimeout: cmd.functionTimeout || payload.scaleOptions?.functionTimeout || 0,
288275
+ specializationTimeout: cmd.specializationTimeout || payload.scaleOptions?.specializationTimeout || 0
288229
288276
  }
288230
288277
  })
288231
288278
  );
@@ -288821,10 +288868,10 @@ var use_exports = {};
288821
288868
  __export(use_exports, {
288822
288869
  default: () => use_default
288823
288870
  });
288824
- var import_fs6, import_rxjs45, import_operators30, import_util4, use_default;
288871
+ var import_fs7, import_rxjs45, import_operators30, import_util4, use_default;
288825
288872
  var init_use = __esm({
288826
288873
  "src/commands/project/use.ts"() {
288827
- import_fs6 = require("fs");
288874
+ import_fs7 = require("fs");
288828
288875
  import_rxjs45 = __toESM(require_cjs());
288829
288876
  import_operators30 = __toESM(require_operators());
288830
288877
  import_util4 = require("util");
@@ -288839,7 +288886,7 @@ var init_use = __esm({
288839
288886
  ),
288840
288887
  (0, import_operators30.switchMap)(
288841
288888
  (projectId) => (0, import_rxjs45.from)(
288842
- (0, import_util4.promisify)(import_fs6.writeFile)(projectDirectory, projectId, {
288889
+ (0, import_util4.promisify)(import_fs7.writeFile)(projectDirectory, projectId, {
288843
288890
  encoding: "utf-8"
288844
288891
  })
288845
288892
  )
@@ -288855,13 +288902,13 @@ var clear_exports = {};
288855
288902
  __export(clear_exports, {
288856
288903
  default: () => clear_default
288857
288904
  });
288858
- var import_fs7, import_util5, clear_default;
288905
+ var import_fs8, import_util5, clear_default;
288859
288906
  var init_clear = __esm({
288860
288907
  "src/commands/project/clear.ts"() {
288861
- import_fs7 = require("fs");
288908
+ import_fs8 = require("fs");
288862
288909
  import_util5 = require("util");
288863
288910
  init_types();
288864
- clear_default = async () => (0, import_util5.promisify)(import_fs7.unlink)(projectDirectory);
288911
+ clear_default = async () => (0, import_util5.promisify)(import_fs8.unlink)(projectDirectory);
288865
288912
  }
288866
288913
  });
288867
288914
 
@@ -320537,19 +320584,19 @@ var init_connection = __esm({
320537
320584
  });
320538
320585
 
320539
320586
  // src/commands/runner/daemon.ts
320540
- 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;
320587
+ var import_child_process3, import_fs9, import_promises6, import_os4, import_path5, import_util11, DEFAULT_SERVICE_NAME, RUNNER_AUTH_EXIT_CODE, systemdQuote, unitPath, buildUnit, resolveGcliCommand, defaultExec, SystemdUserService, assertSystemdAvailable;
320541
320588
  var init_daemon = __esm({
320542
320589
  "src/commands/runner/daemon.ts"() {
320543
320590
  import_child_process3 = require("child_process");
320544
- import_fs8 = require("fs");
320591
+ import_fs9 = require("fs");
320545
320592
  import_promises6 = require("fs/promises");
320546
320593
  import_os4 = require("os");
320547
- import_path4 = require("path");
320594
+ import_path5 = require("path");
320548
320595
  import_util11 = require("util");
320549
320596
  DEFAULT_SERVICE_NAME = "lambforge-runner";
320550
320597
  RUNNER_AUTH_EXIT_CODE = 78;
320551
320598
  systemdQuote = (word) => /^[A-Za-z0-9_@%+=:,./-]+$/.test(word) ? word : `"${word.replace(/\\/g, "\\\\").replace(/"/g, '\\"')}"`;
320552
- unitPath = (serviceName, home = (0, import_os4.homedir)()) => (0, import_path4.join)(home, ".config", "systemd", "user", `${serviceName}.service`);
320599
+ unitPath = (serviceName, home = (0, import_os4.homedir)()) => (0, import_path5.join)(home, ".config", "systemd", "user", `${serviceName}.service`);
320553
320600
  buildUnit = ({
320554
320601
  serviceName,
320555
320602
  execStart,
@@ -320588,7 +320635,7 @@ var init_daemon = __esm({
320588
320635
  }
320589
320636
  let script = argv[1];
320590
320637
  try {
320591
- script = (0, import_fs8.realpathSync)(script);
320638
+ script = (0, import_fs9.realpathSync)(script);
320592
320639
  } catch {
320593
320640
  }
320594
320641
  const ephemeral = /[/\\]_npx[/\\]|[/\\]\.npm[/\\]_cacache/.test(script);
@@ -320610,7 +320657,7 @@ var init_daemon = __esm({
320610
320657
  /** install -> daemon-reload -> enable -> restart (picks up a changed unit). */
320611
320658
  async install(unitContent) {
320612
320659
  const path2 = unitPath(this.serviceName, this.home);
320613
- await (0, import_promises6.mkdir)((0, import_path4.join)(path2, ".."), { recursive: true });
320660
+ await (0, import_promises6.mkdir)((0, import_path5.join)(path2, ".."), { recursive: true });
320614
320661
  await (0, import_promises6.writeFile)(path2, unitContent, "utf-8");
320615
320662
  await this.systemctl("daemon-reload");
320616
320663
  await this.systemctl("enable", this.unit);
@@ -320626,7 +320673,7 @@ var init_daemon = __esm({
320626
320673
  }
320627
320674
  /** Whether `runner:daemon:install` wrote the unit. */
320628
320675
  installed() {
320629
- return (0, import_fs8.existsSync)(unitPath(this.serviceName, this.home));
320676
+ return (0, import_fs9.existsSync)(unitPath(this.serviceName, this.home));
320630
320677
  }
320631
320678
  start() {
320632
320679
  return this.systemctl("start", this.unit);
@@ -322412,13 +322459,13 @@ var init_config2 = __esm({
322412
322459
  });
322413
322460
 
322414
322461
  // src/commands/workspace/files.ts
322415
- 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;
322462
+ var import_child_process5, import_crypto2, import_fs10, import_path6, 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;
322416
322463
  var init_files = __esm({
322417
322464
  "src/commands/workspace/files.ts"() {
322418
322465
  import_child_process5 = require("child_process");
322419
322466
  import_crypto2 = require("crypto");
322420
- import_fs9 = require("fs");
322421
- import_path5 = require("path");
322467
+ import_fs10 = require("fs");
322468
+ import_path6 = require("path");
322422
322469
  import_util12 = require("util");
322423
322470
  run = (0, import_util12.promisify)(import_child_process5.execFile);
322424
322471
  WorkspaceError = class extends Error {
@@ -322438,11 +322485,11 @@ var init_files = __esm({
322438
322485
  SECRET_FILE = /^(\.env(\..+)?|.*\.(pem|key|p12|pfx|keystore|jks)|id_(rsa|dsa|ecdsa|ed25519)(\.pub)?|\.npmrc|\.pypirc|\.netrc|credentials(\.json)?)$/i;
322439
322486
  SECRET_TEMPLATE = /\.(example|sample|template|dist|defaults)$/i;
322440
322487
  isSecretFile = (path2) => {
322441
- const name2 = (0, import_path5.basename)(path2);
322488
+ const name2 = (0, import_path6.basename)(path2);
322442
322489
  return SECRET_FILE.test(name2) && !SECRET_TEMPLATE.test(name2);
322443
322490
  };
322444
322491
  contentHash = (content) => (0, import_crypto2.createHash)("sha256").update(content).digest("hex").slice(0, 16);
322445
- toPosix = (p) => p.split(import_path5.sep).join("/");
322492
+ toPosix = (p) => p.split(import_path6.sep).join("/");
322446
322493
  WorkspaceFiles = class {
322447
322494
  constructor(root, options = {}) {
322448
322495
  this.root = root;
@@ -322451,9 +322498,9 @@ var init_files = __esm({
322451
322498
  /** Absolute path for a workspace-relative one, or a WorkspaceError. */
322452
322499
  async resolvePath(input, { forWrite = false } = {}) {
322453
322500
  const rel = (input ?? ".").trim() || ".";
322454
- const abs = (0, import_path5.resolve)(this.root, rel);
322455
- const fromRoot = (0, import_path5.relative)(this.root, abs);
322456
- if (fromRoot.startsWith("..") || (0, import_path5.isAbsolute)(fromRoot)) {
322501
+ const abs = (0, import_path6.resolve)(this.root, rel);
322502
+ const fromRoot = (0, import_path6.relative)(this.root, abs);
322503
+ if (fromRoot.startsWith("..") || (0, import_path6.isAbsolute)(fromRoot)) {
322457
322504
  throw new WorkspaceError(
322458
322505
  `${input} is outside the workspace root - paths are relative to ${this.root}`,
322459
322506
  403
@@ -322462,9 +322509,9 @@ var init_files = __esm({
322462
322509
  let existing = abs;
322463
322510
  for (; ; ) {
322464
322511
  try {
322465
- const real = await import_fs9.promises.realpath(existing);
322466
- const realFromRoot = (0, import_path5.relative)(this.root, real);
322467
- if (realFromRoot.startsWith("..") || (0, import_path5.isAbsolute)(realFromRoot)) {
322512
+ const real = await import_fs10.promises.realpath(existing);
322513
+ const realFromRoot = (0, import_path6.relative)(this.root, real);
322514
+ if (realFromRoot.startsWith("..") || (0, import_path6.isAbsolute)(realFromRoot)) {
322468
322515
  throw new WorkspaceError(
322469
322516
  `${input} resolves outside the workspace root (symlink)`,
322470
322517
  403
@@ -322473,7 +322520,7 @@ var init_files = __esm({
322473
322520
  break;
322474
322521
  } catch (e2) {
322475
322522
  if (e2 instanceof WorkspaceError) throw e2;
322476
- const parent = (0, import_path5.dirname)(existing);
322523
+ const parent = (0, import_path6.dirname)(existing);
322477
322524
  if (parent === existing) break;
322478
322525
  existing = parent;
322479
322526
  }
@@ -322521,7 +322568,7 @@ var init_files = __esm({
322521
322568
  const out = [];
322522
322569
  const walk = async (relDir) => {
322523
322570
  if (out.length > limit) return;
322524
- const entries = await import_fs9.promises.readdir((0, import_path5.join)(this.root, relDir), { withFileTypes: true }).catch(() => []);
322571
+ const entries = await import_fs10.promises.readdir((0, import_path6.join)(this.root, relDir), { withFileTypes: true }).catch(() => []);
322525
322572
  for (const entry of entries) {
322526
322573
  if (SKIP_DIRS.has(entry.name)) continue;
322527
322574
  const rel = relDir === "." ? entry.name : `${relDir}/${entry.name}`;
@@ -322564,7 +322611,7 @@ var init_files = __esm({
322564
322611
  entries = entries.slice(0, limit);
322565
322612
  await Promise.all(
322566
322613
  entries.filter((e2) => e2.type === "file").map(async (e2) => {
322567
- e2.size = await import_fs9.promises.stat((0, import_path5.join)(this.root, e2.path)).then((s2) => s2.size).catch(() => void 0);
322614
+ e2.size = await import_fs10.promises.stat((0, import_path6.join)(this.root, e2.path)).then((s2) => s2.size).catch(() => void 0);
322568
322615
  })
322569
322616
  );
322570
322617
  return {
@@ -322575,12 +322622,12 @@ var init_files = __esm({
322575
322622
  async read(args) {
322576
322623
  if (!args.path) throw new WorkspaceError("path is required");
322577
322624
  const { abs, rel } = await this.resolvePath(args.path);
322578
- const stat2 = await import_fs9.promises.stat(abs).catch(() => null);
322625
+ const stat2 = await import_fs10.promises.stat(abs).catch(() => null);
322579
322626
  if (!stat2) throw new WorkspaceError(`${rel} does not exist`, 404);
322580
322627
  if (stat2.isDirectory()) {
322581
322628
  throw new WorkspaceError(`${rel} is a directory - use LocalListFiles`);
322582
322629
  }
322583
- const buffer = await import_fs9.promises.readFile(abs);
322630
+ const buffer = await import_fs10.promises.readFile(abs);
322584
322631
  if (buffer.subarray(0, 8e3).includes(0)) {
322585
322632
  return { path: rel, size: stat2.size, binary: true, content: "" };
322586
322633
  }
@@ -322609,7 +322656,7 @@ var init_files = __esm({
322609
322656
  };
322610
322657
  }
322611
322658
  async currentText(abs) {
322612
- return import_fs9.promises.readFile(abs, "utf-8").catch((e2) => {
322659
+ return import_fs10.promises.readFile(abs, "utf-8").catch((e2) => {
322613
322660
  if (e2?.code === "ENOENT") return null;
322614
322661
  throw e2;
322615
322662
  });
@@ -322630,8 +322677,8 @@ var init_files = __esm({
322630
322677
  );
322631
322678
  }
322632
322679
  }
322633
- await import_fs9.promises.mkdir((0, import_path5.dirname)(abs), { recursive: true });
322634
- await import_fs9.promises.writeFile(abs, content, "utf-8");
322680
+ await import_fs10.promises.mkdir((0, import_path6.dirname)(abs), { recursive: true });
322681
+ await import_fs10.promises.writeFile(abs, content, "utf-8");
322635
322682
  return {
322636
322683
  path: rel,
322637
322684
  size: Buffer.byteLength(content),
@@ -322663,7 +322710,7 @@ var init_files = __esm({
322663
322710
  );
322664
322711
  }
322665
322712
  const after = args.replaceAll ? before.split(args.oldText).join(args.newText ?? "") : before.replace(args.oldText, () => args.newText ?? "");
322666
- await import_fs9.promises.writeFile(abs, after, "utf-8");
322713
+ await import_fs10.promises.writeFile(abs, after, "utf-8");
322667
322714
  return {
322668
322715
  path: rel,
322669
322716
  replacements: args.replaceAll ? count : 1,
@@ -322674,14 +322721,14 @@ var init_files = __esm({
322674
322721
  async delete(args) {
322675
322722
  if (!args.path) throw new WorkspaceError("path is required");
322676
322723
  const { abs, rel } = await this.resolvePath(args.path, { forWrite: true });
322677
- const stat2 = await import_fs9.promises.lstat(abs).catch(() => null);
322724
+ const stat2 = await import_fs10.promises.lstat(abs).catch(() => null);
322678
322725
  if (!stat2) return { path: rel, deleted: false };
322679
322726
  if (stat2.isDirectory()) {
322680
322727
  throw new WorkspaceError(
322681
322728
  `${rel} is a directory - only files can be deleted (use RunCommand for more)`
322682
322729
  );
322683
322730
  }
322684
- await import_fs9.promises.unlink(abs);
322731
+ await import_fs10.promises.unlink(abs);
322685
322732
  return { path: rel, deleted: true };
322686
322733
  }
322687
322734
  async search(args) {
@@ -322733,7 +322780,7 @@ var init_files = __esm({
322733
322780
  raw = [];
322734
322781
  for (const file2 of await this.allFiles(rel, 2e4)) {
322735
322782
  if (globRe && !globRe.test(file2)) continue;
322736
- const text = await import_fs9.promises.readFile((0, import_path5.join)(this.root, file2)).catch(() => null);
322783
+ const text = await import_fs10.promises.readFile((0, import_path6.join)(this.root, file2)).catch(() => null);
322737
322784
  if (!text || text.subarray(0, 8e3).includes(0)) continue;
322738
322785
  text.toString("utf-8").split("\n").forEach((line, i2) => {
322739
322786
  if (raw.length <= max && re.test(line)) {
@@ -323526,11 +323573,11 @@ __export(start_exports4, {
323526
323573
  WORKSPACE_VERSION: () => WORKSPACE_VERSION,
323527
323574
  default: () => start_default2
323528
323575
  });
323529
- var import_promises12, import_path6, import_rxjs66, WORKSPACE_VERSION, csv, resolveWorkspace, start_default2;
323576
+ var import_promises12, import_path7, import_rxjs66, WORKSPACE_VERSION, csv, resolveWorkspace, start_default2;
323530
323577
  var init_start4 = __esm({
323531
323578
  "src/commands/workspace/start.ts"() {
323532
323579
  import_promises12 = require("fs/promises");
323533
- import_path6 = require("path");
323580
+ import_path7 = require("path");
323534
323581
  import_rxjs66 = __toESM(require_cjs());
323535
323582
  init_helpers();
323536
323583
  init_gql_client();
@@ -323548,7 +323595,7 @@ var init_start4 = __esm({
323548
323595
  if (cmd.token) {
323549
323596
  return {
323550
323597
  id: "(from --token)",
323551
- name: cmd.name ?? (0, import_path6.basename)(root),
323598
+ name: cmd.name ?? (0, import_path7.basename)(root),
323552
323599
  token: cmd.token,
323553
323600
  projectId: cmd.project ?? "",
323554
323601
  root
@@ -323568,7 +323615,7 @@ var init_start4 = __esm({
323568
323615
  );
323569
323616
  }
323570
323617
  );
323571
- const name2 = cmd.name || (0, import_path6.basename)(root);
323618
+ const name2 = cmd.name || (0, import_path7.basename)(root);
323572
323619
  Logger.info(`Registering ${root} as local workspace "${name2}"...`);
323573
323620
  const { workspace, token } = await (0, import_rxjs66.lastValueFrom)(
323574
323621
  GraphqlClienAPI.createLocalWorkspace(projectId, name2)
@@ -323756,8 +323803,20 @@ init_helpers();
323756
323803
  function buildCommands(program2) {
323757
323804
  program2.command("build").description("Build bundle using esbuild https://esbuild.github.io ").option(
323758
323805
  "-f, --files <files...>",
323759
- "File or files to bundle defaults to index.ts"
323760
- ).option("-b, --bundle", "Bundle code", true).option("-m, --minify", "Minify code", false).option("-p, --platform <char>", "Platform ", "node").option("-t, --target <char>", "Target ", "node14.4").option("-o, --outfile <char>", "Outfile name").option("-e, --external <external...>", "External libraries").action(lazy(() => Promise.resolve().then(() => (init_build(), build_exports)).then((m2) => m2.default)));
323806
+ "File or files to bundle (default: function.file from lambforge.yaml, else index.ts)"
323807
+ ).option(
323808
+ "-b, --bundle",
323809
+ "Bundle code (default: options.bundler.bundle, else true)"
323810
+ ).option(
323811
+ "-m, --minify",
323812
+ "Minify code (default: options.bundler.minify, else false)"
323813
+ ).option("-p, --platform <char>", "Platform ", "node").option(
323814
+ "-t, --target <char>",
323815
+ "Target (default: options.bundler.target, else node24)"
323816
+ ).option(
323817
+ "-o, --outfile <char>",
323818
+ "Outfile name (default: options.bundler.outfile, else index.js)"
323819
+ ).option("-e, --external <external...>", "External libraries").action(lazy(() => Promise.resolve().then(() => (init_build(), build_exports)).then((m2) => m2.default)));
323761
323820
  }
323762
323821
 
323763
323822
  // src/commands/cluster/index.ts