@eve-horizon/cli 0.2.27 → 0.2.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/assets/local-k8s/base/agent-runtime-deployment.yaml +82 -0
  2. package/assets/local-k8s/base/agent-runtime-pvc.yaml +13 -0
  3. package/assets/local-k8s/base/agent-runtime-service.yaml +15 -0
  4. package/assets/local-k8s/base/api-deployment.yaml +63 -0
  5. package/assets/local-k8s/base/api-ingress.yaml +19 -0
  6. package/assets/local-k8s/base/api-rbac.yaml +43 -0
  7. package/assets/local-k8s/base/api-service.yaml +14 -0
  8. package/assets/local-k8s/base/app-secret.yaml +27 -0
  9. package/assets/local-k8s/base/auth-bootstrap-configmap.yaml +73 -0
  10. package/assets/local-k8s/base/auth-bootstrap-job.yaml +48 -0
  11. package/assets/local-k8s/base/buildkitd-deployment.yaml +38 -0
  12. package/assets/local-k8s/base/buildkitd-network-policy.yaml +19 -0
  13. package/assets/local-k8s/base/buildkitd-pvc.yaml +11 -0
  14. package/assets/local-k8s/base/buildkitd-service.yaml +14 -0
  15. package/assets/local-k8s/base/db-migrate-job.yaml +23 -0
  16. package/assets/local-k8s/base/gateway-deployment.yaml +51 -0
  17. package/assets/local-k8s/base/gateway-ingress.yaml +26 -0
  18. package/assets/local-k8s/base/gateway-service.yaml +14 -0
  19. package/assets/local-k8s/base/kustomization.yaml +42 -0
  20. package/assets/local-k8s/base/mailpit-deployment.yaml +44 -0
  21. package/assets/local-k8s/base/mailpit-ingress.yaml +19 -0
  22. package/assets/local-k8s/base/mailpit-service.yaml +17 -0
  23. package/assets/local-k8s/base/namespace.yaml +6 -0
  24. package/assets/local-k8s/base/orchestrator-deployment.yaml +81 -0
  25. package/assets/local-k8s/base/orchestrator-service.yaml +14 -0
  26. package/assets/local-k8s/base/postgres-secret.yaml +10 -0
  27. package/assets/local-k8s/base/postgres-statefulset.yaml +53 -0
  28. package/assets/local-k8s/base/registry-configmap.yaml +34 -0
  29. package/assets/local-k8s/base/registry-deployment.yaml +53 -0
  30. package/assets/local-k8s/base/registry-pvc.yaml +11 -0
  31. package/assets/local-k8s/base/registry-service.yaml +15 -0
  32. package/assets/local-k8s/base/sso-deployment.yaml +66 -0
  33. package/assets/local-k8s/base/sso-ingress.yaml +19 -0
  34. package/assets/local-k8s/base/sso-service.yaml +14 -0
  35. package/assets/local-k8s/base/supabase-auth-cors-middleware.yaml +22 -0
  36. package/assets/local-k8s/base/supabase-auth-deployment.yaml +100 -0
  37. package/assets/local-k8s/base/supabase-auth-ingress.yaml +21 -0
  38. package/assets/local-k8s/base/supabase-auth-service.yaml +14 -0
  39. package/assets/local-k8s/base/worker-deployment.yaml +69 -0
  40. package/assets/local-k8s/base/worker-rbac.yaml +124 -0
  41. package/assets/local-k8s/base/worker-service.yaml +14 -0
  42. package/assets/local-k8s/overlays/local/agent-runtime-org-id.patch.yaml +22 -0
  43. package/assets/local-k8s/overlays/local/agent-runtime-pvc.patch.yaml +8 -0
  44. package/assets/local-k8s/overlays/local/app-secret-ollama.patch.yaml +7 -0
  45. package/assets/local-k8s/overlays/local/kustomization.yaml +10 -0
  46. package/assets/local-k8s/overlays/local/managed-db.patch.yaml +21 -0
  47. package/dist/index.js +1417 -141
  48. package/package.json +2 -1
package/dist/index.js CHANGED
@@ -5182,8 +5182,8 @@ var require_promise = __commonJS({
5182
5182
  exports2.Deferred = void 0;
5183
5183
  var Deferred = class {
5184
5184
  constructor() {
5185
- this._promise = new Promise((resolve7, reject) => {
5186
- this._resolve = resolve7;
5185
+ this._promise = new Promise((resolve8, reject) => {
5186
+ this._resolve = resolve8;
5187
5187
  this._reject = reject;
5188
5188
  });
5189
5189
  }
@@ -5246,10 +5246,10 @@ var require_exporter = __commonJS({
5246
5246
  var api_1 = (init_esm(), __toCommonJS(esm_exports));
5247
5247
  var suppress_tracing_1 = require_suppress_tracing();
5248
5248
  function _export(exporter, arg) {
5249
- return new Promise((resolve7) => {
5249
+ return new Promise((resolve8) => {
5250
5250
  api_1.context.with((0, suppress_tracing_1.suppressTracing)(api_1.context.active()), () => {
5251
5251
  exporter.export(arg, (result) => {
5252
- resolve7(result);
5252
+ resolve8(result);
5253
5253
  });
5254
5254
  });
5255
5255
  });
@@ -8791,7 +8791,7 @@ var require_homedir = __commonJS({
8791
8791
  "../../node_modules/.pnpm/resolve@1.22.11/node_modules/resolve/lib/homedir.js"(exports2, module2) {
8792
8792
  "use strict";
8793
8793
  var os4 = require("os");
8794
- module2.exports = os4.homedir || function homedir5() {
8794
+ module2.exports = os4.homedir || function homedir6() {
8795
8795
  var home = process.env.HOME;
8796
8796
  var user = process.env.LOGNAME || process.env.USER || process.env.LNAME || process.env.USERNAME;
8797
8797
  if (process.platform === "win32") {
@@ -9277,11 +9277,11 @@ var require_async = __commonJS({
9277
9277
  var relativePathRegex = /^(?:\.\.?(?:\/|$)|\/|([A-Za-z]:)?[/\\])/;
9278
9278
  var windowsDriveRegex = /^\w:[/\\]*$/;
9279
9279
  var nodeModulesRegex = /[/\\]node_modules[/\\]*$/;
9280
- var homedir5 = getHomedir();
9280
+ var homedir6 = getHomedir();
9281
9281
  var defaultPaths = function() {
9282
9282
  return [
9283
- path6.join(homedir5, ".node_modules"),
9284
- path6.join(homedir5, ".node_libraries")
9283
+ path6.join(homedir6, ".node_modules"),
9284
+ path6.join(homedir6, ".node_libraries")
9285
9285
  ];
9286
9286
  };
9287
9287
  var defaultIsFile = function isFile(file, cb) {
@@ -9335,7 +9335,7 @@ var require_async = __commonJS({
9335
9335
  }
9336
9336
  return dirs;
9337
9337
  };
9338
- module2.exports = function resolve7(x, options, callback) {
9338
+ module2.exports = function resolve8(x, options, callback) {
9339
9339
  var cb = callback;
9340
9340
  var opts = options;
9341
9341
  if (typeof options === "function") {
@@ -9770,11 +9770,11 @@ var require_sync = __commonJS({
9770
9770
  var relativePathRegex = /^(?:\.\.?(?:\/|$)|\/|([A-Za-z]:)?[/\\])/;
9771
9771
  var windowsDriveRegex = /^\w:[/\\]*$/;
9772
9772
  var nodeModulesRegex = /[/\\]node_modules[/\\]*$/;
9773
- var homedir5 = getHomedir();
9773
+ var homedir6 = getHomedir();
9774
9774
  var defaultPaths = function() {
9775
9775
  return [
9776
- path6.join(homedir5, ".node_modules"),
9777
- path6.join(homedir5, ".node_libraries")
9776
+ path6.join(homedir6, ".node_modules"),
9777
+ path6.join(homedir6, ".node_libraries")
9778
9778
  ];
9779
9779
  };
9780
9780
  var defaultIsFile = function isFile(file) {
@@ -10068,16 +10068,16 @@ var require_require_in_the_middle = __commonJS({
10068
10068
  }
10069
10069
  }
10070
10070
  var _resolve;
10071
- function resolve7(moduleName, basedir) {
10071
+ function resolve8(moduleName, basedir) {
10072
10072
  if (!_resolve) {
10073
10073
  if (require.resolve && require.resolve.paths) {
10074
10074
  _resolve = function(moduleName2, basedir2) {
10075
10075
  return require.resolve(moduleName2, { paths: [basedir2] });
10076
10076
  };
10077
10077
  } else {
10078
- const resolve8 = require_resolve();
10078
+ const resolve9 = require_resolve();
10079
10079
  _resolve = function(moduleName2, basedir2) {
10080
- return resolve8.sync(moduleName2, { basedir: basedir2 });
10080
+ return resolve9.sync(moduleName2, { basedir: basedir2 });
10081
10081
  };
10082
10082
  }
10083
10083
  }
@@ -10235,7 +10235,7 @@ var require_require_in_the_middle = __commonJS({
10235
10235
  if (!matchFound) {
10236
10236
  let res;
10237
10237
  try {
10238
- res = resolve7(moduleName, basedir);
10238
+ res = resolve8(moduleName, basedir);
10239
10239
  } catch (e) {
10240
10240
  debug("could not resolve module: %s", moduleName);
10241
10241
  self2._cache.set(filename, exports3, core);
@@ -10537,8 +10537,8 @@ var require_import_in_the_middle = __commonJS({
10537
10537
  function waitForAllMessagesAcknowledged() {
10538
10538
  const timer2 = setInterval(() => {
10539
10539
  }, 1e3);
10540
- const promise = new Promise((resolve7) => {
10541
- resolveFn = resolve7;
10540
+ const promise = new Promise((resolve8) => {
10541
+ resolveFn = resolve8;
10542
10542
  }).then(() => {
10543
10543
  clearInterval(timer2);
10544
10544
  });
@@ -18249,10 +18249,10 @@ var require_instrumentation3 = __commonJS({
18249
18249
  if (typeof (maybePromise === null || maybePromise === void 0 ? void 0 : maybePromise.then) === "function") {
18250
18250
  return maybePromise.then((value) => {
18251
18251
  plugin._applyResponseHook(span, null, value);
18252
- return new Promise((resolve7) => plugin._endSpan(span, void 0, () => resolve7(value)));
18252
+ return new Promise((resolve8) => plugin._endSpan(span, void 0, () => resolve8(value)));
18253
18253
  }, (err) => {
18254
18254
  plugin._applyResponseHook(span, err);
18255
- return new Promise((resolve7, reject) => plugin._endSpan(span, err, () => reject(err)));
18255
+ return new Promise((resolve8, reject) => plugin._endSpan(span, err, () => reject(err)));
18256
18256
  });
18257
18257
  }
18258
18258
  return maybePromise;
@@ -19484,7 +19484,7 @@ var require_aws_sdk = __commonJS({
19484
19484
  const requestMetadata = self2.servicesExtensions.requestPreSpanHook(normalizedRequest, self2.getConfig(), self2._diag);
19485
19485
  const span = self2._startAwsV3Span(normalizedRequest, requestMetadata);
19486
19486
  const activeContextWithSpan = api_1.trace.setSpan(api_1.context.active(), span);
19487
- const handlerPromise = new Promise((resolve7, reject) => {
19487
+ const handlerPromise = new Promise((resolve8, reject) => {
19488
19488
  Promise.resolve(regionPromise).then((resolvedRegion) => {
19489
19489
  normalizedRequest.region = resolvedRegion;
19490
19490
  span.setAttribute(enums_1.AttributeNames.AWS_REGION, resolvedRegion);
@@ -19542,7 +19542,7 @@ var require_aws_sdk = __commonJS({
19542
19542
  span.end();
19543
19543
  });
19544
19544
  promiseWithResponseLogic.then((res) => {
19545
- resolve7(res);
19545
+ resolve8(res);
19546
19546
  }).catch((err) => reject(err));
19547
19547
  });
19548
19548
  });
@@ -20194,12 +20194,12 @@ var require_instrumentation5 = __commonJS({
20194
20194
  }
20195
20195
  function wrapPromise(span, promise, successCallback) {
20196
20196
  return promise.then((result) => {
20197
- return new Promise((resolve7) => {
20197
+ return new Promise((resolve8) => {
20198
20198
  if (successCallback) {
20199
20199
  successCallback(span, result);
20200
20200
  }
20201
20201
  span.end();
20202
- resolve7(result);
20202
+ resolve8(result);
20203
20203
  });
20204
20204
  }).catch((error) => {
20205
20205
  return new Promise((_, reject) => {
@@ -22394,7 +22394,7 @@ var require_instrumentation12 = __commonJS({
22394
22394
  };
22395
22395
  const functionWithOriginalProperties = patchedFunctionWithOriginalProperties(patchedFunction, original);
22396
22396
  const promisified = function(path6) {
22397
- return new Promise((resolve7) => functionWithOriginalProperties(path6, resolve7));
22397
+ return new Promise((resolve8) => functionWithOriginalProperties(path6, resolve8));
22398
22398
  };
22399
22399
  Object.defineProperty(promisified, "name", { value: functionName });
22400
22400
  Object.defineProperty(functionWithOriginalProperties, util_1.promisify.custom, {
@@ -27944,8 +27944,8 @@ var require_promise2 = __commonJS({
27944
27944
  exports2.Deferred = void 0;
27945
27945
  var Deferred = class {
27946
27946
  constructor() {
27947
- this._promise = new Promise((resolve7, reject) => {
27948
- this._resolve = resolve7;
27947
+ this._promise = new Promise((resolve8, reject) => {
27948
+ this._resolve = resolve8;
27949
27949
  this._reject = reject;
27950
27950
  });
27951
27951
  }
@@ -28008,10 +28008,10 @@ var require_exporter2 = __commonJS({
28008
28008
  var api_1 = (init_esm(), __toCommonJS(esm_exports));
28009
28009
  var suppress_tracing_1 = require_suppress_tracing2();
28010
28010
  function _export(exporter, arg) {
28011
- return new Promise((resolve7) => {
28011
+ return new Promise((resolve8) => {
28012
28012
  api_1.context.with((0, suppress_tracing_1.suppressTracing)(api_1.context.active()), () => {
28013
28013
  exporter.export(arg, (result) => {
28014
- resolve7(result);
28014
+ resolve8(result);
28015
28015
  });
28016
28016
  });
28017
28017
  });
@@ -29941,7 +29941,7 @@ var require_instrumentation18 = __commonJS({
29941
29941
  _getConsumerRunPatch() {
29942
29942
  const instrumentation = this;
29943
29943
  return (original) => {
29944
- return function run(...args) {
29944
+ return function run2(...args) {
29945
29945
  const config = args[0];
29946
29946
  if (config === null || config === void 0 ? void 0 : config.eachMessage) {
29947
29947
  if ((0, instrumentation_1.isWrapped)(config.eachMessage)) {
@@ -35758,11 +35758,11 @@ var require_instrumentation28 = __commonJS({
35758
35758
  }
35759
35759
  if (result instanceof Promise) {
35760
35760
  return result.then((result2) => {
35761
- return new Promise((resolve7) => {
35761
+ return new Promise((resolve8) => {
35762
35762
  utils.handleExecutionResult(plugin.getConfig(), span, result2);
35763
35763
  recordDuration();
35764
35764
  span.end();
35765
- resolve7(result2);
35765
+ resolve8(result2);
35766
35766
  });
35767
35767
  }).catch((error) => {
35768
35768
  return new Promise((_, reject) => {
@@ -37077,10 +37077,10 @@ var require_utils27 = __commonJS({
37077
37077
  };
37078
37078
  exports2.renameHttpSpan = renameHttpSpan;
37079
37079
  var once = (fn) => {
37080
- let run = true;
37080
+ let run2 = true;
37081
37081
  return () => {
37082
- if (run) {
37083
- run = false;
37082
+ if (run2) {
37083
+ run2 = false;
37084
37084
  fn();
37085
37085
  }
37086
37086
  };
@@ -38786,7 +38786,7 @@ var require_utils30 = __commonJS({
38786
38786
  "use strict";
38787
38787
  Object.defineProperty(exports2, "__esModule", { value: true });
38788
38788
  exports2.normalizeType = exports2.normalizeArch = void 0;
38789
- var normalizeArch = (nodeArchString) => {
38789
+ var normalizeArch2 = (nodeArchString) => {
38790
38790
  switch (nodeArchString) {
38791
38791
  case "arm":
38792
38792
  return "arm32";
@@ -38798,7 +38798,7 @@ var require_utils30 = __commonJS({
38798
38798
  return nodeArchString;
38799
38799
  }
38800
38800
  };
38801
- exports2.normalizeArch = normalizeArch;
38801
+ exports2.normalizeArch = normalizeArch2;
38802
38802
  var normalizeType = (nodePlatform) => {
38803
38803
  switch (nodePlatform) {
38804
38804
  case "sunos":
@@ -39672,7 +39672,7 @@ var require_AlibabaCloudEcsDetector = __commonJS({
39672
39672
  return await this._fetchString(options);
39673
39673
  }
39674
39674
  async _fetchString(options) {
39675
- return new Promise((resolve7, reject) => {
39675
+ return new Promise((resolve8, reject) => {
39676
39676
  const timeoutId = setTimeout(() => {
39677
39677
  req.destroy(new Error("ECS metadata api request timed out."));
39678
39678
  }, this.MILLISECONDS_TIME_OUT);
@@ -39690,7 +39690,7 @@ var require_AlibabaCloudEcsDetector = __commonJS({
39690
39690
  reject(err);
39691
39691
  });
39692
39692
  res.on("end", () => {
39693
- resolve7(rawData);
39693
+ resolve8(rawData);
39694
39694
  });
39695
39695
  });
39696
39696
  req.on("error", (err) => {
@@ -39947,7 +39947,7 @@ var require_AwsEc2DetectorSync = __commonJS({
39947
39947
  * the identity properties in a local map.
39948
39948
  */
39949
39949
  async _fetchString(options) {
39950
- return new Promise((resolve7, reject) => {
39950
+ return new Promise((resolve8, reject) => {
39951
39951
  const timeoutId = setTimeout(() => {
39952
39952
  req.abort();
39953
39953
  reject(new Error("EC2 metadata api request timed out."));
@@ -39961,7 +39961,7 @@ var require_AwsEc2DetectorSync = __commonJS({
39961
39961
  res.on("end", () => {
39962
39962
  if (statusCode && statusCode >= 200 && statusCode < 300) {
39963
39963
  try {
39964
- resolve7(rawData);
39964
+ resolve8(rawData);
39965
39965
  } catch (e) {
39966
39966
  reject(e);
39967
39967
  }
@@ -40127,14 +40127,14 @@ var require_AwsEcsDetectorSync = __commonJS({
40127
40127
  return match[1];
40128
40128
  }
40129
40129
  static _getUrlAsJson(url) {
40130
- return new Promise((resolve7, reject) => {
40130
+ return new Promise((resolve8, reject) => {
40131
40131
  const request = http.get(url, (response) => {
40132
40132
  if (response.statusCode && response.statusCode >= 400) {
40133
40133
  reject(new Error(`Request to '${url}' failed with status ${response.statusCode}`));
40134
40134
  }
40135
40135
  let responseBody = "";
40136
40136
  response.on("data", (chunk) => responseBody += chunk.toString());
40137
- response.on("end", () => resolve7(responseBody));
40137
+ response.on("end", () => resolve8(responseBody));
40138
40138
  request.on("error", reject);
40139
40139
  });
40140
40140
  request.setTimeout(HTTP_TIMEOUT_IN_MS, () => {
@@ -40319,7 +40319,7 @@ var require_AwsEksDetectorSync = __commonJS({
40319
40319
  * the identity properties in a local map.
40320
40320
  */
40321
40321
  async _fetchString(options) {
40322
- return await new Promise((resolve7, reject) => {
40322
+ return await new Promise((resolve8, reject) => {
40323
40323
  const timeoutId = setTimeout(() => {
40324
40324
  req.abort();
40325
40325
  reject(new Error("EKS metadata api request timed out."));
@@ -40333,7 +40333,7 @@ var require_AwsEksDetectorSync = __commonJS({
40333
40333
  res.on("end", () => {
40334
40334
  if (statusCode && statusCode >= 200 && statusCode < 300) {
40335
40335
  try {
40336
- resolve7(rawData);
40336
+ resolve8(rawData);
40337
40337
  } catch (e) {
40338
40338
  reject(e);
40339
40339
  }
@@ -42880,7 +42880,7 @@ var require_lib2 = __commonJS({
42880
42880
  let accum = [];
42881
42881
  let accumBytes = 0;
42882
42882
  let abort = false;
42883
- return new Body.Promise(function(resolve7, reject) {
42883
+ return new Body.Promise(function(resolve8, reject) {
42884
42884
  let resTimeout;
42885
42885
  if (_this4.timeout) {
42886
42886
  resTimeout = setTimeout(function() {
@@ -42914,7 +42914,7 @@ var require_lib2 = __commonJS({
42914
42914
  }
42915
42915
  clearTimeout(resTimeout);
42916
42916
  try {
42917
- resolve7(Buffer.concat(accum, accumBytes));
42917
+ resolve8(Buffer.concat(accum, accumBytes));
42918
42918
  } catch (err) {
42919
42919
  reject(new FetchError(`Could not create Buffer from response body for ${_this4.url}: ${err.message}`, "system", err));
42920
42920
  }
@@ -43589,7 +43589,7 @@ var require_lib2 = __commonJS({
43589
43589
  throw new Error("native promise missing, set fetch.Promise to your favorite alternative");
43590
43590
  }
43591
43591
  Body.Promise = fetch2.Promise;
43592
- return new fetch2.Promise(function(resolve7, reject) {
43592
+ return new fetch2.Promise(function(resolve8, reject) {
43593
43593
  const request = new Request(url, opts);
43594
43594
  const options = getNodeRequestOptions(request);
43595
43595
  const send = (options.protocol === "https:" ? https : http).request;
@@ -43722,7 +43722,7 @@ var require_lib2 = __commonJS({
43722
43722
  requestOpts.body = void 0;
43723
43723
  requestOpts.headers.delete("content-length");
43724
43724
  }
43725
- resolve7(fetch2(new Request(locationURL, requestOpts)));
43725
+ resolve8(fetch2(new Request(locationURL, requestOpts)));
43726
43726
  finalize();
43727
43727
  return;
43728
43728
  }
@@ -43743,7 +43743,7 @@ var require_lib2 = __commonJS({
43743
43743
  const codings = headers.get("Content-Encoding");
43744
43744
  if (!request.compress || request.method === "HEAD" || codings === null || res.statusCode === 204 || res.statusCode === 304) {
43745
43745
  response = new Response(body, response_options);
43746
- resolve7(response);
43746
+ resolve8(response);
43747
43747
  return;
43748
43748
  }
43749
43749
  const zlibOptions = {
@@ -43753,7 +43753,7 @@ var require_lib2 = __commonJS({
43753
43753
  if (codings == "gzip" || codings == "x-gzip") {
43754
43754
  body = body.pipe(zlib.createGunzip(zlibOptions));
43755
43755
  response = new Response(body, response_options);
43756
- resolve7(response);
43756
+ resolve8(response);
43757
43757
  return;
43758
43758
  }
43759
43759
  if (codings == "deflate" || codings == "x-deflate") {
@@ -43765,12 +43765,12 @@ var require_lib2 = __commonJS({
43765
43765
  body = body.pipe(zlib.createInflateRaw());
43766
43766
  }
43767
43767
  response = new Response(body, response_options);
43768
- resolve7(response);
43768
+ resolve8(response);
43769
43769
  });
43770
43770
  raw.on("end", function() {
43771
43771
  if (!response) {
43772
43772
  response = new Response(body, response_options);
43773
- resolve7(response);
43773
+ resolve8(response);
43774
43774
  }
43775
43775
  });
43776
43776
  return;
@@ -43778,11 +43778,11 @@ var require_lib2 = __commonJS({
43778
43778
  if (codings == "br" && typeof zlib.createBrotliDecompress === "function") {
43779
43779
  body = body.pipe(zlib.createBrotliDecompress());
43780
43780
  response = new Response(body, response_options);
43781
- resolve7(response);
43781
+ resolve8(response);
43782
43782
  return;
43783
43783
  }
43784
43784
  response = new Response(body, response_options);
43785
- resolve7(response);
43785
+ resolve8(response);
43786
43786
  });
43787
43787
  writeToStream(req, request);
43788
43788
  });
@@ -44141,8 +44141,8 @@ var require_retry = __commonJS({
44141
44141
  }
44142
44142
  const delay = getNextRetryDelay(config);
44143
44143
  err.config.retryConfig.currentRetryAttempt += 1;
44144
- const backoff2 = config.retryBackoff ? config.retryBackoff(err, delay) : new Promise((resolve7) => {
44145
- setTimeout(resolve7, delay);
44144
+ const backoff2 = config.retryBackoff ? config.retryBackoff(err, delay) : new Promise((resolve8) => {
44145
+ setTimeout(resolve8, delay);
44146
44146
  });
44147
44147
  if (config.onRetryAttempt) {
44148
44148
  config.onRetryAttempt(err);
@@ -44624,8 +44624,8 @@ var require_helpers = __commonJS({
44624
44624
  function req(url, opts = {}) {
44625
44625
  const href = typeof url === "string" ? url : url.href;
44626
44626
  const req2 = (href.startsWith("https:") ? https : http).request(url, opts);
44627
- const promise = new Promise((resolve7, reject) => {
44628
- req2.once("response", resolve7).once("error", reject).end();
44627
+ const promise = new Promise((resolve8, reject) => {
44628
+ req2.once("response", resolve8).once("error", reject).end();
44629
44629
  });
44630
44630
  req2.then = promise.then.bind(promise);
44631
44631
  return req2;
@@ -44802,7 +44802,7 @@ var require_parse_proxy_response = __commonJS({
44802
44802
  var debug_1 = __importDefault(require_src3());
44803
44803
  var debug = (0, debug_1.default)("https-proxy-agent:parse-proxy-response");
44804
44804
  function parseProxyResponse(socket) {
44805
- return new Promise((resolve7, reject) => {
44805
+ return new Promise((resolve8, reject) => {
44806
44806
  let buffersLength = 0;
44807
44807
  const buffers = [];
44808
44808
  function read() {
@@ -44868,7 +44868,7 @@ var require_parse_proxy_response = __commonJS({
44868
44868
  }
44869
44869
  debug("got proxy server response: %o %o", firstLine, headers);
44870
44870
  cleanup();
44871
- resolve7({
44871
+ resolve8({
44872
44872
  connect: {
44873
44873
  statusCode,
44874
44874
  statusText,
@@ -45169,11 +45169,11 @@ var require_gaxios = __commonJS({
45169
45169
  if (!opts.validateStatus(translatedResponse.status)) {
45170
45170
  if (opts.responseType === "stream") {
45171
45171
  let response = "";
45172
- await new Promise((resolve7) => {
45172
+ await new Promise((resolve8) => {
45173
45173
  (translatedResponse === null || translatedResponse === void 0 ? void 0 : translatedResponse.data).on("data", (chunk) => {
45174
45174
  response += chunk;
45175
45175
  });
45176
- (translatedResponse === null || translatedResponse === void 0 ? void 0 : translatedResponse.data).on("end", resolve7);
45176
+ (translatedResponse === null || translatedResponse === void 0 ? void 0 : translatedResponse.data).on("end", resolve8);
45177
45177
  });
45178
45178
  translatedResponse.data = response;
45179
45179
  }
@@ -48246,7 +48246,7 @@ var require_AzureVmDetector = __commonJS({
48246
48246
  Metadata: "True"
48247
48247
  }
48248
48248
  };
48249
- const metadata = await new Promise((resolve7, reject) => {
48249
+ const metadata = await new Promise((resolve8, reject) => {
48250
48250
  const timeoutId = setTimeout(() => {
48251
48251
  req.destroy();
48252
48252
  reject(new Error("Azure metadata service request timed out."));
@@ -48260,7 +48260,7 @@ var require_AzureVmDetector = __commonJS({
48260
48260
  res.on("end", () => {
48261
48261
  if (statusCode && statusCode >= 200 && statusCode < 300) {
48262
48262
  try {
48263
- resolve7(JSON.parse(rawData));
48263
+ resolve8(JSON.parse(rawData));
48264
48264
  } catch (error) {
48265
48265
  reject(error);
48266
48266
  }
@@ -50288,7 +50288,7 @@ for cloud deployments. Credentials are stored globally per API URL.`,
50288
50288
  ]
50289
50289
  },
50290
50290
  admin: {
50291
- description: "Administrative commands for user and identity management.",
50291
+ description: "Administrative commands for user, identity, and platform operations.",
50292
50292
  usage: "eve admin <subcommand> [options]",
50293
50293
  subcommands: {
50294
50294
  invite: {
@@ -50304,11 +50304,24 @@ for cloud deployments. Credentials are stored globally per API URL.`,
50304
50304
  "eve admin invite --email user@example.com --github octocat",
50305
50305
  "eve admin invite --email user@example.com --github octocat --role admin --org org_xxx"
50306
50306
  ]
50307
+ },
50308
+ "ingress-aliases": {
50309
+ description: "Inspect and reclaim ingress alias claims (system admin)",
50310
+ usage: "eve admin ingress-aliases <list|reclaim> [options]",
50311
+ options: [
50312
+ "list options: --alias <name> --project <id> --environment <id|null> --limit <n> --offset <n>",
50313
+ 'reclaim usage: eve admin ingress-aliases reclaim <alias> --reason "<text>"'
50314
+ ],
50315
+ examples: [
50316
+ "eve admin ingress-aliases list --project proj_xxx",
50317
+ 'eve admin ingress-aliases reclaim eve-pm --reason "Reserved org rename"'
50318
+ ]
50307
50319
  }
50308
50320
  },
50309
50321
  examples: [
50310
50322
  "eve admin invite --email user@example.com --github octocat",
50311
- "eve admin invite --email user@example.com --github octocat --org org_xxx"
50323
+ "eve admin invite --email user@example.com --github octocat --org org_xxx",
50324
+ "eve admin ingress-aliases list"
50312
50325
  ]
50313
50326
  },
50314
50327
  release: {
@@ -50468,6 +50481,95 @@ eve-new-project-setup skill to complete configuration.`,
50468
50481
  "eve init my-app --template https://github.com/myorg/custom-starter"
50469
50482
  ]
50470
50483
  },
50484
+ local: {
50485
+ description: `Local development environment management.
50486
+
50487
+ Manages a local k3d Kubernetes cluster running the Eve platform.
50488
+ Requires Docker Desktop; k3d and kubectl are auto-managed by the CLI.`,
50489
+ usage: "eve local <up|down|status|reset|logs|health> [options]",
50490
+ subcommands: {
50491
+ up: {
50492
+ description: "Create/prepare local cluster and deploy Eve services",
50493
+ usage: "eve local up [--skip-deploy] [--skip-health] [--timeout <seconds>] [--version <tag>] [--verbose]",
50494
+ options: [
50495
+ "--skip-deploy Create cluster only, skip deploy step",
50496
+ "--skip-health Skip waiting for API health",
50497
+ "--timeout <sec> Health wait timeout in seconds (default: 300)",
50498
+ "--version <tag> Platform image version (default: latest)",
50499
+ "--verbose Print detailed command output"
50500
+ ],
50501
+ examples: [
50502
+ "eve local up",
50503
+ "eve local up --version 0.1.70",
50504
+ "eve local up --skip-deploy",
50505
+ "eve local up --timeout 600"
50506
+ ]
50507
+ },
50508
+ down: {
50509
+ description: "Stop local stack resources, or destroy cluster entirely",
50510
+ usage: "eve local down [--destroy] [--force]",
50511
+ options: [
50512
+ "--destroy Delete k3d cluster and persistent data",
50513
+ "--force Skip confirmation prompts"
50514
+ ],
50515
+ examples: [
50516
+ "eve local down",
50517
+ "eve local down --destroy --force"
50518
+ ]
50519
+ },
50520
+ status: {
50521
+ description: "Show cluster state, service readiness, and URLs",
50522
+ usage: "eve local status [--watch] [--json]",
50523
+ options: [
50524
+ "--watch Refresh every 5 seconds",
50525
+ "--json Machine-readable JSON output"
50526
+ ],
50527
+ examples: [
50528
+ "eve local status",
50529
+ "eve local status --watch",
50530
+ "eve local status --json"
50531
+ ]
50532
+ },
50533
+ reset: {
50534
+ description: "Destroy and recreate local stack",
50535
+ usage: "eve local reset [--force]",
50536
+ options: [
50537
+ "--force Skip confirmation prompts"
50538
+ ],
50539
+ examples: [
50540
+ "eve local reset --force"
50541
+ ]
50542
+ },
50543
+ logs: {
50544
+ description: "Stream or dump logs from local stack services",
50545
+ usage: "eve local logs [service] [--follow] [--tail <n>] [--since <duration>]",
50546
+ options: [
50547
+ "[service] api|orchestrator|worker|gateway|agent-runtime|auth|postgres|mailpit|sso",
50548
+ "--follow Follow logs in real time",
50549
+ "--tail <n> Show last n lines (default: 50)",
50550
+ "--since <duration> Show logs since duration (for example: 5m, 1h)"
50551
+ ],
50552
+ examples: [
50553
+ "eve local logs",
50554
+ "eve local logs api --follow",
50555
+ "eve local logs worker --tail 200"
50556
+ ]
50557
+ },
50558
+ health: {
50559
+ description: "Quick health check (exit code 0 when healthy)",
50560
+ usage: "eve local health [--json]",
50561
+ examples: [
50562
+ "eve local health",
50563
+ "eve local health --json"
50564
+ ]
50565
+ }
50566
+ },
50567
+ examples: [
50568
+ "eve local up",
50569
+ "eve local status --json",
50570
+ "eve local down --destroy --force"
50571
+ ]
50572
+ },
50471
50573
  system: {
50472
50574
  description: "System administration and health checks (admin scope required for most commands).",
50473
50575
  usage: "eve system <subcommand> [options]",
@@ -51205,6 +51307,7 @@ function showMainHelp() {
51205
51307
  console.log(" org Manage organizations");
51206
51308
  console.log(" project Manage projects");
51207
51309
  console.log(" manifest Validate manifests (schema, secrets)");
51310
+ console.log(" local Manage local k3d stack lifecycle and diagnostics");
51208
51311
  console.log(" job Manage jobs (create, list, show, update, claim, etc.)");
51209
51312
  console.log(" env Manage environments (list, show, deploy)");
51210
51313
  console.log(" build Manage builds (create, run, logs, artifacts)");
@@ -51231,7 +51334,7 @@ function showMainHelp() {
51231
51334
  console.log(" analytics Org analytics (jobs, pipelines, env health)");
51232
51335
  console.log(" ollama Manage inference targets, aliases, and model routes");
51233
51336
  console.log(" access Access control: permissions, roles, bindings, policy-as-code sync");
51234
- console.log(" admin User and identity management (invite)");
51337
+ console.log(" admin User and platform admin operations");
51235
51338
  console.log(" skills Install skills from skills.txt (skills CLI)");
51236
51339
  console.log(" migrate Migration helpers for upgrading config formats");
51237
51340
  console.log(" system System health and status checks");
@@ -52026,7 +52129,12 @@ async function fetchProfileStatus(ctx, envFilter) {
52026
52129
  let services = [];
52027
52130
  try {
52028
52131
  const diagnose = await requestJson(ctx, `/projects/${ctx.projectId}/envs/${env.name}/diagnose`);
52029
- services = buildStatusServices(diagnose.pods, diagnose.namespace ?? env.namespace, domain);
52132
+ services = buildStatusServices(
52133
+ diagnose.pods,
52134
+ diagnose.namespace ?? env.namespace,
52135
+ domain,
52136
+ env.ingress_aliases ?? []
52137
+ );
52030
52138
  } catch {
52031
52139
  }
52032
52140
  environments.push({
@@ -52045,7 +52153,7 @@ async function fetchProfileStatus(ctx, envFilter) {
52045
52153
  environments
52046
52154
  };
52047
52155
  }
52048
- function buildStatusServices(pods, namespace, domain) {
52156
+ function buildStatusServices(pods, namespace, domain, ingressAliases) {
52049
52157
  const services = /* @__PURE__ */ new Map();
52050
52158
  for (const pod of pods) {
52051
52159
  const component = pod.labels["eve.component"] || pod.labels["app.kubernetes.io/name"] || pod.labels["app"] || pod.labels["component"] || "unknown";
@@ -52059,12 +52167,14 @@ function buildStatusServices(pods, namespace, domain) {
52059
52167
  const allDone = info.phases.size > 0 && [...info.phases].every((p) => p === "Succeeded" || p === "Failed");
52060
52168
  const status = allDone ? "completed" : info.ready === info.total ? "ready" : "not-ready";
52061
52169
  const url = !allDone && namespace && domain ? buildServiceUrl(name, namespace, domain) : null;
52170
+ const aliasUrls = !allDone && domain ? ingressAliases.filter((entry) => entry.service_name === name).map((entry) => buildAliasUrl(entry.alias, domain)).sort((a, b2) => a.localeCompare(b2)) : [];
52062
52171
  return {
52063
52172
  name,
52064
52173
  pods_ready: info.ready,
52065
52174
  pods_total: info.total,
52066
52175
  status,
52067
- url
52176
+ url,
52177
+ alias_urls: aliasUrls
52068
52178
  };
52069
52179
  });
52070
52180
  }
@@ -52083,6 +52193,10 @@ function buildServiceUrl(component, namespace, domain) {
52083
52193
  const secure = !domain.includes("lvh.me") && !domain.includes("localhost");
52084
52194
  return `${secure ? "https" : "http"}://${component}.${slug}.${domain}`;
52085
52195
  }
52196
+ function buildAliasUrl(alias, domain) {
52197
+ const secure = !domain.includes("lvh.me") && !domain.includes("localhost");
52198
+ return `${secure ? "https" : "http"}://${alias}.${domain}`;
52199
+ }
52086
52200
  function formatStatusOutput(results) {
52087
52201
  for (let i = 0; i < results.length; i++) {
52088
52202
  const r = results[i];
@@ -52121,10 +52235,25 @@ function formatStatusOutput(results) {
52121
52235
  const podsW = Math.max(...env.services.map((s) => `${s.pods_ready}/${s.pods_total}`.length));
52122
52236
  for (const svc of env.services) {
52123
52237
  const pods = `${svc.pods_ready}/${svc.pods_total}`;
52124
- const urlPart = svc.url ? ` ${svc.url}` : "";
52238
+ const urls = [];
52239
+ if (svc.url) {
52240
+ urls.push(svc.url);
52241
+ }
52242
+ for (const aliasUrl of svc.alias_urls ?? []) {
52243
+ if (!urls.includes(aliasUrl)) {
52244
+ urls.push(aliasUrl);
52245
+ }
52246
+ }
52247
+ const urlPart = urls.length > 0 ? ` ${urls[0]}` : "";
52125
52248
  console.log(
52126
52249
  ` ${padRight(svc.name, nameW)} ${padRight(pods, podsW)} ${padRight(svc.status, 9)}${urlPart}`
52127
52250
  );
52251
+ if (urls.length > 1) {
52252
+ const prefix = ` ${padRight("", nameW)} ${padRight("", podsW)} ${padRight("", 9)}`;
52253
+ for (const aliasUrl of urls.slice(1)) {
52254
+ console.log(`${prefix} ${aliasUrl}`);
52255
+ }
52256
+ }
52128
52257
  }
52129
52258
  }
52130
52259
  }
@@ -56641,6 +56770,10 @@ var EnvironmentResponseSchema = external_exports.object({
56641
56770
  labels: EnvironmentLabelsSchema.nullable(),
56642
56771
  current_release_id: external_exports.string().nullable(),
56643
56772
  last_failed_release_id: external_exports.string().nullable(),
56773
+ ingress_aliases: external_exports.array(external_exports.object({
56774
+ alias: external_exports.string(),
56775
+ service_name: external_exports.string()
56776
+ })).optional(),
56644
56777
  status: EnvironmentStatusSchema,
56645
56778
  suspended_at: external_exports.string().nullable(),
56646
56779
  suspension_reason: external_exports.string().nullable(),
@@ -58019,9 +58152,15 @@ var ManagedDbConfigSchema = external_exports.object({
58019
58152
  engine_version: external_exports.string().optional()
58020
58153
  // e.g., '16'
58021
58154
  });
58155
+ var IngressAliasPattern = /^[a-z][a-z0-9-]*[a-z0-9]$/;
58156
+ var IngressConfigSchema = external_exports.object({
58157
+ public: external_exports.boolean().optional(),
58158
+ port: external_exports.number().optional(),
58159
+ alias: external_exports.string().min(3).max(63).regex(IngressAliasPattern).optional()
58160
+ }).passthrough();
58022
58161
  var ServiceXeveSchema = external_exports.object({
58023
58162
  role: external_exports.string().optional(),
58024
- ingress: external_exports.record(external_exports.unknown()).optional(),
58163
+ ingress: IngressConfigSchema.optional(),
58025
58164
  api_spec: ApiSpecSchema.optional(),
58026
58165
  api_specs: external_exports.array(ApiSpecSchema).optional(),
58027
58166
  external: external_exports.boolean().optional(),
@@ -63767,7 +63906,7 @@ async function handleWatch(positionals, flags, context2) {
63767
63906
  let jobCompleted = false;
63768
63907
  const statusPollingPromise = (async () => {
63769
63908
  while (!jobCompleted && !streamEnded) {
63770
- await new Promise((resolve7) => setTimeout(resolve7, 3e3));
63909
+ await new Promise((resolve8) => setTimeout(resolve8, 3e3));
63771
63910
  if (jobCompleted || streamEnded) break;
63772
63911
  const elapsed = Math.round((Date.now() - startTime) / 1e3);
63773
63912
  if (elapsed >= maxTimeout) {
@@ -64242,15 +64381,15 @@ async function handleRunnerLogs(positionals, flags, context2) {
64242
64381
  const kubectl = (0, import_child_process.spawn)("kubectl", kubectlArgs, {
64243
64382
  stdio: "inherit"
64244
64383
  });
64245
- return new Promise((resolve7, reject) => {
64384
+ return new Promise((resolve8, reject) => {
64246
64385
  kubectl.on("error", (error) => {
64247
64386
  reject(new Error(`Failed to execute kubectl: ${error.message}`));
64248
64387
  });
64249
64388
  kubectl.on("exit", (code) => {
64250
64389
  if (code === 0) {
64251
- resolve7();
64390
+ resolve8();
64252
64391
  } else {
64253
- resolve7();
64392
+ resolve8();
64254
64393
  }
64255
64394
  });
64256
64395
  });
@@ -65309,7 +65448,7 @@ Poll with: eve auth request-access --status ${requestData.id}`);
65309
65448
  const POLL_INTERVAL_MS = 5e3;
65310
65449
  let current = requestData;
65311
65450
  while (current.status === "pending") {
65312
- await new Promise((resolve7) => setTimeout(resolve7, POLL_INTERVAL_MS));
65451
+ await new Promise((resolve8) => setTimeout(resolve8, POLL_INTERVAL_MS));
65313
65452
  const pollResponse = await requestRaw(context2, `/auth/request-access/${current.id}`, {
65314
65453
  allowError: true,
65315
65454
  tokenOverride: ""
@@ -65547,8 +65686,8 @@ async function offerGitHubKeyRegistration(context2, email) {
65547
65686
  }
65548
65687
  console.log(`
65549
65688
  Found ${keys.length} SSH key(s) for github.com/${username.trim()}`);
65550
- const confirm = await rl.question("Register them? [Y/n]: ");
65551
- if (confirm.toLowerCase() === "n" || confirm.toLowerCase() === "no") {
65689
+ const confirm2 = await rl.question("Register them? [Y/n]: ");
65690
+ if (confirm2.toLowerCase() === "n" || confirm2.toLowerCase() === "no") {
65552
65691
  return false;
65553
65692
  }
65554
65693
  let registered = 0;
@@ -67389,6 +67528,12 @@ function formatEnvironmentDetails(env, health) {
67389
67528
  console.log(` Database Ref: ${env.db_ref || "(none)"}`);
67390
67529
  console.log(` Current Release: ${env.current_release_id || "(none)"}`);
67391
67530
  console.log(` Last Failed: ${env.last_failed_release_id || "(none)"}`);
67531
+ if (env.ingress_aliases && env.ingress_aliases.length > 0) {
67532
+ console.log(" Ingress Aliases:");
67533
+ for (const entry of env.ingress_aliases) {
67534
+ console.log(` ${entry.alias} -> ${entry.service_name}`);
67535
+ }
67536
+ }
67392
67537
  if (health) {
67393
67538
  console.log("");
67394
67539
  console.log(` Deployment Status: ${health.status}`);
@@ -67628,7 +67773,7 @@ async function watchPipelineRun(context2, projectId, pipelineName, runId, timeou
67628
67773
  }
67629
67774
  return detail.run.status;
67630
67775
  }
67631
- await new Promise((resolve7) => setTimeout(resolve7, pollIntervalMs));
67776
+ await new Promise((resolve8) => setTimeout(resolve8, pollIntervalMs));
67632
67777
  }
67633
67778
  console.log(` Pipeline run did not complete within ${timeoutSeconds}s.`);
67634
67779
  console.log(` Run "eve pipeline show-run ${pipelineName} ${runId}" to check status.`);
@@ -67651,7 +67796,7 @@ async function watchDeploymentStatus(context2, projectId, envName, timeoutSecond
67651
67796
  console.log(" Deployment is ready.");
67652
67797
  return;
67653
67798
  }
67654
- await new Promise((resolve7) => setTimeout(resolve7, pollIntervalMs));
67799
+ await new Promise((resolve8) => setTimeout(resolve8, pollIntervalMs));
67655
67800
  }
67656
67801
  console.log(` Timeout after ${timeoutSeconds}s. Run "eve env diagnose ${projectId} ${envName}" for details.`);
67657
67802
  }
@@ -67747,41 +67892,41 @@ function formatPipelineRunList(runs) {
67747
67892
  console.log("");
67748
67893
  console.log("Run ID".padEnd(30) + "Pipeline".padEnd(20) + "Status".padEnd(20) + "Created");
67749
67894
  console.log("-".repeat(100));
67750
- for (const run of runs) {
67751
- const runId = run.id.padEnd(30);
67752
- const pipeline = run.pipeline_name.padEnd(20);
67753
- const status = run.status.padEnd(20);
67754
- const created = new Date(run.created_at).toLocaleString();
67895
+ for (const run2 of runs) {
67896
+ const runId = run2.id.padEnd(30);
67897
+ const pipeline = run2.pipeline_name.padEnd(20);
67898
+ const status = run2.status.padEnd(20);
67899
+ const created = new Date(run2.created_at).toLocaleString();
67755
67900
  console.log(`${runId}${pipeline}${status}${created}`);
67756
67901
  }
67757
67902
  console.log("");
67758
67903
  console.log(`Total: ${runs.length} runs`);
67759
67904
  }
67760
67905
  function formatPipelineRunDetail(detail) {
67761
- const { run, steps } = detail;
67762
- console.log(`Run ID: ${run.id}`);
67763
- console.log(`Pipeline: ${run.pipeline_name}`);
67764
- console.log(`Status: ${run.status}`);
67765
- if (run.env_name) {
67766
- console.log(`Environment: ${run.env_name}`);
67767
- }
67768
- if (run.git_sha) {
67769
- console.log(`Git SHA: ${run.git_sha}`);
67770
- }
67771
- if ("step_outputs" in run && run.step_outputs) {
67772
- const deployOutput = run.step_outputs.deploy;
67906
+ const { run: run2, steps } = detail;
67907
+ console.log(`Run ID: ${run2.id}`);
67908
+ console.log(`Pipeline: ${run2.pipeline_name}`);
67909
+ console.log(`Status: ${run2.status}`);
67910
+ if (run2.env_name) {
67911
+ console.log(`Environment: ${run2.env_name}`);
67912
+ }
67913
+ if (run2.git_sha) {
67914
+ console.log(`Git SHA: ${run2.git_sha}`);
67915
+ }
67916
+ if ("step_outputs" in run2 && run2.step_outputs) {
67917
+ const deployOutput = run2.step_outputs.deploy;
67773
67918
  if (deployOutput?.preview_url) {
67774
67919
  console.log(`Preview: ${deployOutput.preview_url}`);
67775
67920
  }
67776
67921
  }
67777
- if (run.started_at) {
67778
- console.log(`Started: ${run.started_at}`);
67922
+ if (run2.started_at) {
67923
+ console.log(`Started: ${run2.started_at}`);
67779
67924
  }
67780
- if (run.completed_at) {
67781
- console.log(`Completed: ${run.completed_at}`);
67925
+ if (run2.completed_at) {
67926
+ console.log(`Completed: ${run2.completed_at}`);
67782
67927
  }
67783
- if (run.error_message) {
67784
- console.log(`Error: ${run.error_message}`);
67928
+ if (run2.error_message) {
67929
+ console.log(`Error: ${run2.error_message}`);
67785
67930
  }
67786
67931
  console.log("");
67787
67932
  console.log("Steps:");
@@ -69108,9 +69253,9 @@ var originError = /* @__PURE__ */ Symbol("OriginError");
69108
69253
  var CLOSE = {};
69109
69254
  var Query = class extends Promise {
69110
69255
  constructor(strings, args, handler, canceller, options = {}) {
69111
- let resolve7, reject;
69256
+ let resolve8, reject;
69112
69257
  super((a, b2) => {
69113
- resolve7 = a;
69258
+ resolve8 = a;
69114
69259
  reject = b2;
69115
69260
  });
69116
69261
  this.tagged = Array.isArray(strings.raw);
@@ -69121,7 +69266,7 @@ var Query = class extends Promise {
69121
69266
  this.options = options;
69122
69267
  this.state = null;
69123
69268
  this.statement = null;
69124
- this.resolve = (x) => (this.active = false, resolve7(x));
69269
+ this.resolve = (x) => (this.active = false, resolve8(x));
69125
69270
  this.reject = (x) => (this.active = false, reject(x));
69126
69271
  this.active = false;
69127
69272
  this.cancelled = null;
@@ -69169,12 +69314,12 @@ var Query = class extends Promise {
69169
69314
  if (this.executed && !this.active)
69170
69315
  return { done: true };
69171
69316
  prev && prev();
69172
- const promise = new Promise((resolve7, reject) => {
69317
+ const promise = new Promise((resolve8, reject) => {
69173
69318
  this.cursorFn = (value) => {
69174
- resolve7({ value, done: false });
69319
+ resolve8({ value, done: false });
69175
69320
  return new Promise((r) => prev = r);
69176
69321
  };
69177
- this.resolve = () => (this.active = false, resolve7({ done: true }));
69322
+ this.resolve = () => (this.active = false, resolve8({ done: true }));
69178
69323
  this.reject = (x) => (this.active = false, reject(x));
69179
69324
  });
69180
69325
  this.execute();
@@ -69801,12 +69946,12 @@ function Connection(options, queues = {}, { onopen = noop, onend = noop, onclose
69801
69946
  x.on("drain", drain);
69802
69947
  return x;
69803
69948
  }
69804
- async function cancel({ pid, secret }, resolve7, reject) {
69949
+ async function cancel({ pid, secret }, resolve8, reject) {
69805
69950
  try {
69806
69951
  cancelMessage = bytes_default().i32(16).i32(80877102).i32(pid).i32(secret).end(16);
69807
69952
  await connect();
69808
69953
  socket.once("error", reject);
69809
- socket.once("close", resolve7);
69954
+ socket.once("close", resolve8);
69810
69955
  } catch (error2) {
69811
69956
  reject(error2);
69812
69957
  }
@@ -70753,7 +70898,7 @@ function parseEvent(x) {
70753
70898
  // ../../node_modules/.pnpm/postgres@3.4.8/node_modules/postgres/src/large.js
70754
70899
  var import_stream2 = __toESM(require("stream"), 1);
70755
70900
  function largeObject(sql, oid, mode = 131072 | 262144) {
70756
- return new Promise(async (resolve7, reject) => {
70901
+ return new Promise(async (resolve8, reject) => {
70757
70902
  await sql.begin(async (sql2) => {
70758
70903
  let finish;
70759
70904
  !oid && ([{ oid }] = await sql2`select lo_creat(-1) as oid`);
@@ -70779,7 +70924,7 @@ function largeObject(sql, oid, mode = 131072 | 262144) {
70779
70924
  ) seek
70780
70925
  `
70781
70926
  };
70782
- resolve7(lo);
70927
+ resolve8(lo);
70783
70928
  return new Promise(async (r) => finish = r);
70784
70929
  async function readable({
70785
70930
  highWaterMark = 2048 * 8,
@@ -70953,8 +71098,8 @@ function Postgres(a, b2) {
70953
71098
  }
70954
71099
  async function reserve() {
70955
71100
  const queue = queue_default();
70956
- const c = open.length ? open.shift() : await new Promise((resolve7, reject) => {
70957
- const query = { reserve: resolve7, reject };
71101
+ const c = open.length ? open.shift() : await new Promise((resolve8, reject) => {
71102
+ const query = { reserve: resolve8, reject };
70958
71103
  queries.push(query);
70959
71104
  closed.length && connect(closed.shift(), query);
70960
71105
  });
@@ -70991,9 +71136,9 @@ function Postgres(a, b2) {
70991
71136
  let uncaughtError, result;
70992
71137
  name && await sql2`savepoint ${sql2(name)}`;
70993
71138
  try {
70994
- result = await new Promise((resolve7, reject) => {
71139
+ result = await new Promise((resolve8, reject) => {
70995
71140
  const x = fn2(sql2);
70996
- Promise.resolve(Array.isArray(x) ? Promise.all(x) : x).then(resolve7, reject);
71141
+ Promise.resolve(Array.isArray(x) ? Promise.all(x) : x).then(resolve8, reject);
70997
71142
  });
70998
71143
  if (uncaughtError)
70999
71144
  throw uncaughtError;
@@ -71050,8 +71195,8 @@ function Postgres(a, b2) {
71050
71195
  return c.execute(query) ? move(c, busy) : move(c, full);
71051
71196
  }
71052
71197
  function cancel(query) {
71053
- return new Promise((resolve7, reject) => {
71054
- query.state ? query.active ? connection_default(options).cancel(query.state, resolve7, reject) : query.cancelled = { resolve: resolve7, reject } : (queries.remove(query), query.cancelled = true, query.reject(Errors.generic("57014", "canceling statement due to user request")), resolve7());
71198
+ return new Promise((resolve8, reject) => {
71199
+ query.state ? query.active ? connection_default(options).cancel(query.state, resolve8, reject) : query.cancelled = { resolve: resolve8, reject } : (queries.remove(query), query.cancelled = true, query.reject(Errors.generic("57014", "canceling statement due to user request")), resolve8());
71055
71200
  });
71056
71201
  }
71057
71202
  async function end({ timeout = null } = {}) {
@@ -71070,11 +71215,11 @@ function Postgres(a, b2) {
71070
71215
  async function close() {
71071
71216
  await Promise.all(connections.map((c) => c.end()));
71072
71217
  }
71073
- async function destroy(resolve7) {
71218
+ async function destroy(resolve8) {
71074
71219
  await Promise.all(connections.map((c) => c.terminate()));
71075
71220
  while (queries.length)
71076
71221
  queries.shift().reject(Errors.connection("CONNECTION_DESTROYED", options));
71077
- resolve7();
71222
+ resolve8();
71078
71223
  }
71079
71224
  function connect(c, query) {
71080
71225
  move(c, connecting);
@@ -72945,6 +73090,61 @@ ${response.length} record(s)`);
72945
73090
  throw new Error("Usage: eve admin usage <list|summary> --org <orgId> [--since] [--until] [--limit] [--json]");
72946
73091
  }
72947
73092
  }
73093
+ case "ingress-aliases": {
73094
+ const action = positionals[0] ?? "list";
73095
+ switch (action) {
73096
+ case "list": {
73097
+ const params = new URLSearchParams();
73098
+ const alias = getStringFlag(flags, ["alias"]);
73099
+ const projectId = getStringFlag(flags, ["project", "project_id"]);
73100
+ const environmentId = getStringFlag(flags, ["environment", "env", "environment_id"]);
73101
+ const limit = getStringFlag(flags, ["limit"]);
73102
+ const offset = getStringFlag(flags, ["offset"]);
73103
+ if (alias) params.set("alias", alias);
73104
+ if (projectId) params.set("project_id", projectId);
73105
+ if (environmentId) params.set("environment_id", environmentId);
73106
+ if (limit) params.set("limit", limit);
73107
+ if (offset) params.set("offset", offset);
73108
+ const query = params.toString();
73109
+ const path6 = `/admin/ingress-aliases${query ? `?${query}` : ""}`;
73110
+ const response = await requestJson(context2, path6);
73111
+ if (json) {
73112
+ outputJson(response, true);
73113
+ return;
73114
+ }
73115
+ const rows = Array.isArray(response.data) ? response.data : [];
73116
+ if (rows.length === 0) {
73117
+ console.log("No ingress aliases found.");
73118
+ return;
73119
+ }
73120
+ for (const row of rows) {
73121
+ console.log(`${row.alias} project=${row.project_id} env=${row.environment_id ?? "(reserved)"} service=${row.service_name}`);
73122
+ }
73123
+ console.log(`
73124
+ ${rows.length} alias(es)`);
73125
+ return;
73126
+ }
73127
+ case "reclaim": {
73128
+ const alias = positionals[1] ?? getStringFlag(flags, ["alias"]);
73129
+ const reason = getStringFlag(flags, ["reason"]);
73130
+ if (!alias || !reason) {
73131
+ throw new Error('Usage: eve admin ingress-aliases reclaim <alias> --reason "<text>"');
73132
+ }
73133
+ const response = await requestJson(context2, `/admin/ingress-aliases/${encodeURIComponent(alias)}/reclaim`, {
73134
+ method: "POST",
73135
+ body: { reason }
73136
+ });
73137
+ outputJson(
73138
+ response,
73139
+ json,
73140
+ `+ Reclaimed ${response.alias} (project=${response.project_id}, env=${response.environment_id ?? "(reserved)"})`
73141
+ );
73142
+ return;
73143
+ }
73144
+ default:
73145
+ throw new Error("Usage: eve admin ingress-aliases <list|reclaim> [options]");
73146
+ }
73147
+ }
72948
73148
  case "access-requests": {
72949
73149
  const action = positionals[0];
72950
73150
  switch (action) {
@@ -73007,7 +73207,7 @@ ${response.length} record(s)`);
73007
73207
  }
73008
73208
  }
73009
73209
  default:
73010
- throw new Error("Usage: eve admin <invite|pricing|receipts|balance|usage|access-requests>");
73210
+ throw new Error("Usage: eve admin <invite|pricing|receipts|balance|usage|ingress-aliases|access-requests>");
73011
73211
  }
73012
73212
  }
73013
73213
  function formatBalanceSummary(data) {
@@ -74147,20 +74347,20 @@ async function handleRun3(positionals, flags, context2, json) {
74147
74347
  if (!buildId) {
74148
74348
  throw new Error("Usage: eve build run <build_id>");
74149
74349
  }
74150
- const run = await requestJson(
74350
+ const run2 = await requestJson(
74151
74351
  context2,
74152
74352
  `/builds/${buildId}/runs`,
74153
74353
  { method: "POST" }
74154
74354
  );
74155
74355
  if (json) {
74156
- outputJson(run, json);
74356
+ outputJson(run2, json);
74157
74357
  return;
74158
74358
  }
74159
- console.log(`Build run started: ${run.id}`);
74160
- console.log(` Build: ${run.build_id}`);
74161
- console.log(` Status: ${run.status}`);
74162
- if (run.backend) {
74163
- console.log(` Backend: ${run.backend}`);
74359
+ console.log(`Build run started: ${run2.id}`);
74360
+ console.log(` Build: ${run2.build_id}`);
74361
+ console.log(` Status: ${run2.status}`);
74362
+ if (run2.backend) {
74363
+ console.log(` Backend: ${run2.backend}`);
74164
74364
  }
74165
74365
  }
74166
74366
  async function handleRuns2(positionals, flags, context2, json) {
@@ -74373,17 +74573,17 @@ function formatBuildDetail(build) {
74373
74573
  function formatRunList(runs) {
74374
74574
  console.log("Run ID".padEnd(30) + "Status".padEnd(15) + "Backend".padEnd(15) + "Started");
74375
74575
  console.log("-".repeat(80));
74376
- for (const run of runs) {
74377
- const id = run.id.padEnd(30);
74378
- const status = run.status.padEnd(15);
74379
- const backend = (run.backend ?? "-").padEnd(15);
74380
- const started = run.started_at ? new Date(run.started_at).toLocaleString() : "-";
74576
+ for (const run2 of runs) {
74577
+ const id = run2.id.padEnd(30);
74578
+ const status = run2.status.padEnd(15);
74579
+ const backend = (run2.backend ?? "-").padEnd(15);
74580
+ const started = run2.started_at ? new Date(run2.started_at).toLocaleString() : "-";
74381
74581
  console.log(`${id}${status}${backend}${started}`);
74382
- if (run.error_message) {
74383
- console.log(` Error: ${run.error_message}`);
74582
+ if (run2.error_message) {
74583
+ console.log(` Error: ${run2.error_message}`);
74384
74584
  }
74385
- if (run.error_code) {
74386
- const info = getErrorCodeInfo2(run.error_code);
74585
+ if (run2.error_code) {
74586
+ const info = getErrorCodeInfo2(run2.error_code);
74387
74587
  console.log(` Error Type: ${info.label}`);
74388
74588
  console.log(` Hint: ${info.hint}`);
74389
74589
  }
@@ -74779,7 +74979,7 @@ async function handleThread(subcommand, positionals, flags, context2) {
74779
74979
  const message = err instanceof Error ? err.message : String(err);
74780
74980
  console.error(`Poll error: ${message}`);
74781
74981
  }
74782
- await new Promise((resolve7) => setTimeout(resolve7, pollInterval));
74982
+ await new Promise((resolve8) => setTimeout(resolve8, pollInterval));
74783
74983
  }
74784
74984
  }
74785
74985
  case "distill": {
@@ -78445,6 +78645,1079 @@ async function handleFs(subcommand, positionals, flags, context2) {
78445
78645
  }
78446
78646
  }
78447
78647
 
78648
+ // src/commands/local.ts
78649
+ var import_node_fs19 = require("node:fs");
78650
+ var import_node_crypto = require("node:crypto");
78651
+ var import_node_child_process10 = require("node:child_process");
78652
+ var import_node_os6 = require("node:os");
78653
+ var import_node_path18 = require("node:path");
78654
+ var import_promises2 = require("node:readline/promises");
78655
+ var DEFAULT_CLUSTER_NAME = "eve-local";
78656
+ var DEFAULT_KUBE_CONTEXT = "k3d-eve-local";
78657
+ var MANAGED_BIN_DIR = (0, import_node_path18.join)((0, import_node_os6.homedir)(), ".eve", "bin");
78658
+ var LOCAL_API_URL = "http://api.eve.lvh.me";
78659
+ var WATCH_INTERVAL_MS = 5e3;
78660
+ var K3D_VERSION = "v5.7.5";
78661
+ var KUBECTL_STABLE_URL = "https://dl.k8s.io/release/stable.txt";
78662
+ var LOCAL_STACK_ROOT = (0, import_node_path18.resolve)(__dirname, "..", "assets", "local-k8s");
78663
+ var LOCAL_STACK_OVERLAY = (0, import_node_path18.join)(LOCAL_STACK_ROOT, "overlays", "local");
78664
+ var LOCAL_STACK_BASE = (0, import_node_path18.join)(LOCAL_STACK_ROOT, "base");
78665
+ var SERVICE_DEFINITIONS = [
78666
+ { id: "api", workload: "eve-api", kind: "deployment" },
78667
+ { id: "orchestrator", workload: "eve-orchestrator", kind: "deployment" },
78668
+ { id: "worker", workload: "eve-worker", kind: "deployment" },
78669
+ { id: "gateway", workload: "eve-gateway", kind: "deployment" },
78670
+ { id: "agent-runtime", workload: "eve-agent-runtime", kind: "statefulset" },
78671
+ { id: "auth", workload: "supabase-auth", kind: "deployment" },
78672
+ { id: "mailpit", workload: "mailpit", kind: "deployment" },
78673
+ { id: "sso", workload: "eve-sso", kind: "deployment" }
78674
+ ];
78675
+ var PLATFORM_IMAGES = [
78676
+ { component: "api", remote: "ghcr.io/eve-horizon/api", local: "eve-horizon/api:local" },
78677
+ { component: "orchestrator", remote: "ghcr.io/eve-horizon/orchestrator", local: "eve-horizon/orchestrator:local" },
78678
+ { component: "worker", remote: "ghcr.io/eve-horizon/worker", local: "eve-horizon/worker:local" },
78679
+ { component: "gateway", remote: "ghcr.io/eve-horizon/gateway", local: "eve-horizon/gateway:local" },
78680
+ { component: "agent-runtime", remote: "ghcr.io/eve-horizon/agent-runtime", local: "eve-horizon/agent-runtime:local" },
78681
+ { component: "sso", remote: "ghcr.io/eve-horizon/sso", local: "eve-horizon/sso:local" }
78682
+ ];
78683
+ var LOG_TARGETS = {
78684
+ api: { resource: "eve-api", kind: "deployment" },
78685
+ orchestrator: { resource: "eve-orchestrator", kind: "deployment" },
78686
+ worker: { resource: "eve-worker", kind: "deployment" },
78687
+ gateway: { resource: "eve-gateway", kind: "deployment" },
78688
+ "agent-runtime": { resource: "eve-agent-runtime", kind: "statefulset" },
78689
+ auth: { resource: "supabase-auth", kind: "deployment" },
78690
+ postgres: { resource: "postgres", kind: "statefulset" },
78691
+ mailpit: { resource: "mailpit", kind: "deployment" },
78692
+ sso: { resource: "eve-sso", kind: "deployment" }
78693
+ };
78694
+ async function handleLocal(subcommand, positionals, flags, _context) {
78695
+ const json = Boolean(flags.json);
78696
+ switch (subcommand) {
78697
+ case "up":
78698
+ await handleUp(flags, json);
78699
+ return;
78700
+ case "down":
78701
+ await handleDown(flags, json);
78702
+ return;
78703
+ case "status":
78704
+ await handleStatus4(flags, json);
78705
+ return;
78706
+ case "reset":
78707
+ await handleReset3(flags, json);
78708
+ return;
78709
+ case "logs":
78710
+ handleLogs7(positionals, flags);
78711
+ return;
78712
+ case "health":
78713
+ await handleHealth2(flags, json);
78714
+ return;
78715
+ default:
78716
+ throw new Error("Usage: eve local <up|down|status|reset|logs|health> [options]");
78717
+ }
78718
+ }
78719
+ async function handleUp(flags, json) {
78720
+ const skipDeploy = getBooleanFlag(flags, ["skip-deploy"]) ?? false;
78721
+ const skipHealth = getBooleanFlag(flags, ["skip-health"]) ?? false;
78722
+ const verbose = getBooleanFlag(flags, ["verbose"]) ?? false;
78723
+ const timeoutSeconds = parseTimeoutSeconds(flags, 300);
78724
+ const requestedVersion = getStringFlag(flags, ["version"]) ?? "latest";
78725
+ const runtimeOptions = {
78726
+ quiet: json,
78727
+ verbose
78728
+ };
78729
+ ensureTool("docker", "Install Docker Desktop.");
78730
+ assertDockerRunning();
78731
+ await ensureManagedTool("k3d", runtimeOptions);
78732
+ await ensureManagedTool("kubectl", runtimeOptions);
78733
+ assertLocalAssetsPresent();
78734
+ await ensureClusterReady(runtimeOptions);
78735
+ let deployedVersion = null;
78736
+ if (!skipDeploy) {
78737
+ deployedVersion = await resolveRequestedVersion(requestedVersion, runtimeOptions);
78738
+ await importPlatformImages(deployedVersion, runtimeOptions);
78739
+ applyLocalManifests(runtimeOptions);
78740
+ waitForStatefulSetRollout("postgres", Math.max(timeoutSeconds, 180), runtimeOptions);
78741
+ runDbMigration(Math.max(timeoutSeconds, 180), runtimeOptions);
78742
+ generateAuthSecrets(runtimeOptions);
78743
+ runAuthBootstrap(Math.max(timeoutSeconds, 120), runtimeOptions);
78744
+ restartAndWaitRollouts(Math.max(timeoutSeconds, 180), runtimeOptions);
78745
+ }
78746
+ let api = await probeApiHealth(LOCAL_API_URL);
78747
+ if (!skipHealth) {
78748
+ api = await waitForApiHealth(LOCAL_API_URL, timeoutSeconds);
78749
+ }
78750
+ const result = {
78751
+ cluster: DEFAULT_CLUSTER_NAME,
78752
+ context: DEFAULT_KUBE_CONTEXT,
78753
+ version: deployedVersion,
78754
+ skip_deploy: skipDeploy,
78755
+ skip_health: skipHealth,
78756
+ api,
78757
+ urls: {
78758
+ api: LOCAL_API_URL,
78759
+ auth: "http://auth.eve.lvh.me",
78760
+ mail: "http://mail.eve.lvh.me",
78761
+ sso: "http://sso.eve.lvh.me"
78762
+ }
78763
+ };
78764
+ if (json) {
78765
+ outputJson(result, true);
78766
+ return;
78767
+ }
78768
+ console.log("");
78769
+ console.log("Local Eve stack is ready:");
78770
+ console.log(` API: ${result.urls.api}`);
78771
+ console.log(` Auth: ${result.urls.auth}`);
78772
+ console.log(` Mail: ${result.urls.mail}`);
78773
+ console.log(` SSO: ${result.urls.sso}`);
78774
+ console.log("");
78775
+ console.log("Next steps:");
78776
+ console.log(` export EVE_API_URL=${LOCAL_API_URL}`);
78777
+ console.log(' eve org ensure "my-org" --slug my-org');
78778
+ }
78779
+ async function handleDown(flags, json) {
78780
+ const destroy = getBooleanFlag(flags, ["destroy"]) ?? false;
78781
+ const force = getBooleanFlag(flags, ["force"]) ?? false;
78782
+ if (destroy && !force) {
78783
+ const confirmed = await confirm("Destroy local cluster and all persisted data? [y/N] ");
78784
+ if (!confirmed) {
78785
+ throw new Error("Aborted.");
78786
+ }
78787
+ }
78788
+ const k3d = findExecutable("k3d");
78789
+ if (!k3d) {
78790
+ outputJson(
78791
+ { stopped: false, reason: "k3d_missing", cluster: DEFAULT_CLUSTER_NAME },
78792
+ json,
78793
+ "k3d is not installed. Run 'eve local up' first."
78794
+ );
78795
+ return;
78796
+ }
78797
+ if (destroy) {
78798
+ const cluster2 = getClusterSnapshot();
78799
+ if (!cluster2.exists) {
78800
+ outputJson({ destroyed: false, reason: "cluster_not_found", cluster: DEFAULT_CLUSTER_NAME }, json, "Cluster not found. Nothing to destroy.");
78801
+ return;
78802
+ }
78803
+ run(k3d, ["cluster", "delete", DEFAULT_CLUSTER_NAME]);
78804
+ outputJson({ destroyed: true, cluster: DEFAULT_CLUSTER_NAME }, json, `Destroyed cluster '${DEFAULT_CLUSTER_NAME}'.`);
78805
+ return;
78806
+ }
78807
+ const cluster = getClusterSnapshot();
78808
+ if (!cluster.exists) {
78809
+ outputJson({ stopped: false, reason: "cluster_not_found", cluster: DEFAULT_CLUSTER_NAME }, json, "Cluster not found. Nothing to stop.");
78810
+ return;
78811
+ }
78812
+ if (!cluster.running) {
78813
+ outputJson({ stopped: true, already_stopped: true, cluster: DEFAULT_CLUSTER_NAME }, json, `Cluster '${DEFAULT_CLUSTER_NAME}' is already stopped.`);
78814
+ return;
78815
+ }
78816
+ run(k3d, ["cluster", "stop", DEFAULT_CLUSTER_NAME]);
78817
+ outputJson(
78818
+ { stopped: true, cluster: DEFAULT_CLUSTER_NAME, context: DEFAULT_KUBE_CONTEXT },
78819
+ json,
78820
+ `Stopped cluster '${DEFAULT_CLUSTER_NAME}' (state preserved).`
78821
+ );
78822
+ }
78823
+ async function handleReset3(flags, json) {
78824
+ const force = getBooleanFlag(flags, ["force"]) ?? false;
78825
+ if (!force) {
78826
+ const confirmed = await confirm("Reset local stack (destroy + recreate)? [y/N] ");
78827
+ if (!confirmed) {
78828
+ throw new Error("Aborted.");
78829
+ }
78830
+ }
78831
+ await handleDown({ ...flags, destroy: true, force: true }, false);
78832
+ await handleUp({ ...flags, "skip-deploy": false }, false);
78833
+ if (json) {
78834
+ outputJson({ reset: true, cluster: DEFAULT_CLUSTER_NAME }, true);
78835
+ }
78836
+ }
78837
+ async function handleStatus4(flags, json) {
78838
+ const watch = getBooleanFlag(flags, ["watch"]) ?? false;
78839
+ do {
78840
+ const report = await collectStatus();
78841
+ if (json) {
78842
+ outputJson(report, true);
78843
+ } else {
78844
+ if (watch) {
78845
+ process.stdout.write("\x1Bc");
78846
+ }
78847
+ renderStatus(report);
78848
+ }
78849
+ if (!watch) return;
78850
+ await sleep(WATCH_INTERVAL_MS);
78851
+ } while (true);
78852
+ }
78853
+ async function handleHealth2(_flags, json) {
78854
+ const report = await collectStatus();
78855
+ const unhealthyServices = report.services.filter((service) => !service.healthy);
78856
+ const healthy = report.cluster.running && report.api.ok && unhealthyServices.length === 0;
78857
+ const payload = {
78858
+ healthy,
78859
+ cluster: report.cluster,
78860
+ api: report.api,
78861
+ unhealthy_services: unhealthyServices.map((service) => service.id)
78862
+ };
78863
+ if (json) {
78864
+ outputJson(payload, true);
78865
+ } else {
78866
+ const icon = healthy ? "OK" : "FAIL";
78867
+ console.log(`${icon} Local stack health: ${healthy ? "healthy" : "unhealthy"}`);
78868
+ console.log(` Cluster: ${report.cluster.exists ? report.cluster.running ? "running" : "stopped" : "missing"}`);
78869
+ console.log(` API: ${report.api.ok ? `ok (${report.api.status ?? "ok"})` : `unreachable (${report.api.error ?? "unknown"})`}`);
78870
+ if (unhealthyServices.length > 0) {
78871
+ console.log(` Services: unhealthy -> ${unhealthyServices.map((service) => service.id).join(", ")}`);
78872
+ }
78873
+ }
78874
+ if (!healthy) {
78875
+ process.exitCode = 1;
78876
+ }
78877
+ }
78878
+ function handleLogs7(positionals, flags) {
78879
+ const kubectl = findExecutable("kubectl");
78880
+ if (!kubectl) {
78881
+ throw new Error("kubectl is not installed. Run 'eve local up' first.");
78882
+ }
78883
+ const cluster = getClusterSnapshot();
78884
+ if (!cluster.running) {
78885
+ throw new Error(`Cluster '${DEFAULT_CLUSTER_NAME}' is not running. Start it with: eve local up`);
78886
+ }
78887
+ const service = positionals[0];
78888
+ const follow = getBooleanFlag(flags, ["follow", "f"]) ?? false;
78889
+ const tail = getStringFlag(flags, ["tail"]) ?? "50";
78890
+ const since = getStringFlag(flags, ["since"]);
78891
+ const args = ["--context", DEFAULT_KUBE_CONTEXT, "-n", "eve", "logs"];
78892
+ if (service) {
78893
+ const target = LOG_TARGETS[service];
78894
+ if (!target) {
78895
+ const names = Object.keys(LOG_TARGETS).join(", ");
78896
+ throw new Error(`Unknown service '${service}'. Supported services: ${names}`);
78897
+ }
78898
+ args.push(`${target.kind}/${target.resource}`);
78899
+ } else {
78900
+ args.push("-l", "app.kubernetes.io/name in (eve-api,eve-orchestrator,eve-worker,eve-gateway,eve-agent-runtime,supabase-auth,eve-sso,mailpit,postgres)");
78901
+ args.push("--all-containers=true");
78902
+ }
78903
+ args.push("--tail", tail);
78904
+ if (since) {
78905
+ args.push("--since", since);
78906
+ }
78907
+ if (follow) {
78908
+ args.push("-f");
78909
+ }
78910
+ run(kubectl, args, { stdio: "inherit" });
78911
+ }
78912
+ async function collectStatus() {
78913
+ const cluster = getClusterSnapshot();
78914
+ const services = getServiceStatuses(cluster.running);
78915
+ const api = await probeApiHealth(LOCAL_API_URL);
78916
+ return {
78917
+ cluster: {
78918
+ name: DEFAULT_CLUSTER_NAME,
78919
+ context: DEFAULT_KUBE_CONTEXT,
78920
+ exists: cluster.exists,
78921
+ running: cluster.running
78922
+ },
78923
+ services,
78924
+ api,
78925
+ urls: {
78926
+ api: LOCAL_API_URL,
78927
+ auth: "http://auth.eve.lvh.me",
78928
+ mail: "http://mail.eve.lvh.me",
78929
+ sso: "http://sso.eve.lvh.me"
78930
+ }
78931
+ };
78932
+ }
78933
+ function renderStatus(report) {
78934
+ const healthyServices = report.services.filter((service) => service.healthy).length;
78935
+ const totalServices = report.services.length;
78936
+ const clusterStatus = report.cluster.exists ? report.cluster.running ? "running" : "stopped" : "missing";
78937
+ console.log("Local Eve Environment");
78938
+ console.log("\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500");
78939
+ console.log(`Cluster: ${report.cluster.name} (${clusterStatus})`);
78940
+ console.log(`Context: ${report.cluster.context}`);
78941
+ console.log(`API Health: ${report.api.ok ? `ok (${report.api.status ?? "ok"})` : `unreachable (${report.api.error ?? "unknown"})`}`);
78942
+ console.log("");
78943
+ console.log(`Services (${healthyServices}/${totalServices} healthy):`);
78944
+ for (const service of report.services) {
78945
+ const icon = service.healthy ? "OK" : "FAIL";
78946
+ const ready2 = `${service.ready}/${service.desired}`;
78947
+ const name = service.id.padEnd(13);
78948
+ const workload = `${service.kind}/${service.workload}`;
78949
+ console.log(` ${icon} ${name} ${ready2.padEnd(5)} ${workload}`);
78950
+ }
78951
+ console.log("");
78952
+ console.log("URLs:");
78953
+ console.log(` API: ${report.urls.api}`);
78954
+ console.log(` Auth: ${report.urls.auth}`);
78955
+ console.log(` Mail: ${report.urls.mail}`);
78956
+ console.log(` SSO: ${report.urls.sso}`);
78957
+ }
78958
+ function getServiceStatuses(clusterRunning) {
78959
+ if (!clusterRunning) {
78960
+ return SERVICE_DEFINITIONS.map((service) => ({
78961
+ id: service.id,
78962
+ workload: service.workload,
78963
+ kind: service.kind,
78964
+ exists: false,
78965
+ desired: 0,
78966
+ ready: 0,
78967
+ healthy: false
78968
+ }));
78969
+ }
78970
+ const kubectl = findExecutable("kubectl");
78971
+ if (!kubectl) {
78972
+ return SERVICE_DEFINITIONS.map((service) => ({
78973
+ id: service.id,
78974
+ workload: service.workload,
78975
+ kind: service.kind,
78976
+ exists: false,
78977
+ desired: 0,
78978
+ ready: 0,
78979
+ healthy: false
78980
+ }));
78981
+ }
78982
+ const raw = run(
78983
+ kubectl,
78984
+ ["--context", DEFAULT_KUBE_CONTEXT, "-n", "eve", "get", "deployments,statefulsets", "-o", "json"],
78985
+ { stdio: "pipe", allowFailure: true }
78986
+ );
78987
+ if (raw.status !== 0) {
78988
+ return SERVICE_DEFINITIONS.map((service) => ({
78989
+ id: service.id,
78990
+ workload: service.workload,
78991
+ kind: service.kind,
78992
+ exists: false,
78993
+ desired: 0,
78994
+ ready: 0,
78995
+ healthy: false
78996
+ }));
78997
+ }
78998
+ let parsed = {};
78999
+ try {
79000
+ parsed = JSON.parse(raw.stdout);
79001
+ } catch {
79002
+ return SERVICE_DEFINITIONS.map((service) => ({
79003
+ id: service.id,
79004
+ workload: service.workload,
79005
+ kind: service.kind,
79006
+ exists: false,
79007
+ desired: 0,
79008
+ ready: 0,
79009
+ healthy: false
79010
+ }));
79011
+ }
79012
+ const deployments = /* @__PURE__ */ new Map();
79013
+ const statefulsets = /* @__PURE__ */ new Map();
79014
+ for (const item of parsed.items ?? []) {
79015
+ const kind = String(item.kind ?? "").toLowerCase();
79016
+ const metadata = item.metadata ?? {};
79017
+ const name = String(metadata.name ?? "");
79018
+ if (!name) continue;
79019
+ if (kind === "deployment") {
79020
+ deployments.set(name, item);
79021
+ } else if (kind === "statefulset") {
79022
+ statefulsets.set(name, item);
79023
+ }
79024
+ }
79025
+ return SERVICE_DEFINITIONS.map((service) => {
79026
+ const source = service.kind === "deployment" ? deployments.get(service.workload) : statefulsets.get(service.workload);
79027
+ if (!source) {
79028
+ return {
79029
+ id: service.id,
79030
+ workload: service.workload,
79031
+ kind: service.kind,
79032
+ exists: false,
79033
+ desired: 0,
79034
+ ready: 0,
79035
+ healthy: false
79036
+ };
79037
+ }
79038
+ const spec = source.spec ?? {};
79039
+ const status = source.status ?? {};
79040
+ const desired = Number(spec.replicas ?? status.replicas ?? 1);
79041
+ const ready2 = Number(status.readyReplicas ?? 0);
79042
+ const healthy = desired > 0 && ready2 >= desired;
79043
+ return {
79044
+ id: service.id,
79045
+ workload: service.workload,
79046
+ kind: service.kind,
79047
+ exists: true,
79048
+ desired: Number.isFinite(desired) ? desired : 0,
79049
+ ready: Number.isFinite(ready2) ? ready2 : 0,
79050
+ healthy
79051
+ };
79052
+ });
79053
+ }
79054
+ async function ensureManagedTool(tool, runtimeOptions) {
79055
+ if (findExecutable(tool)) {
79056
+ return;
79057
+ }
79058
+ (0, import_node_fs19.mkdirSync)(MANAGED_BIN_DIR, { recursive: true });
79059
+ if (tool === "k3d") {
79060
+ printProgress(runtimeOptions, `Installing k3d ${K3D_VERSION} into ${MANAGED_BIN_DIR}...`);
79061
+ await installK3dBinary();
79062
+ } else {
79063
+ printProgress(runtimeOptions, `Installing kubectl into ${MANAGED_BIN_DIR}...`);
79064
+ await installKubectlBinary();
79065
+ }
79066
+ if (!findExecutable(tool)) {
79067
+ throw new Error(`Failed to install ${tool} into ${MANAGED_BIN_DIR}.`);
79068
+ }
79069
+ }
79070
+ async function installK3dBinary() {
79071
+ const platform2 = normalizePlatform(process.platform);
79072
+ const arch = normalizeArch(process.arch);
79073
+ const url = `https://github.com/k3d-io/k3d/releases/download/${K3D_VERSION}/k3d-${platform2}-${arch}`;
79074
+ await downloadBinary(url, (0, import_node_path18.join)(MANAGED_BIN_DIR, "k3d"));
79075
+ }
79076
+ async function installKubectlBinary() {
79077
+ const platform2 = normalizePlatform(process.platform);
79078
+ const arch = normalizeArch(process.arch);
79079
+ const stable = (await fetchText(KUBECTL_STABLE_URL)).trim();
79080
+ if (!/^v\d+\.\d+\.\d+$/.test(stable)) {
79081
+ throw new Error(`Unexpected kubectl stable release format: '${stable}'`);
79082
+ }
79083
+ const binaryUrl = `https://dl.k8s.io/release/${stable}/bin/${platform2}/${arch}/kubectl`;
79084
+ const checksumUrl = `${binaryUrl}.sha256`;
79085
+ const [binary, checksumText] = await Promise.all([
79086
+ downloadBytes(binaryUrl),
79087
+ fetchText(checksumUrl)
79088
+ ]);
79089
+ const expectedChecksum = checksumText.trim();
79090
+ const actualChecksum = (0, import_node_crypto.createHash)("sha256").update(binary).digest("hex");
79091
+ if (expectedChecksum !== actualChecksum) {
79092
+ throw new Error(`kubectl checksum verification failed (expected ${expectedChecksum}, got ${actualChecksum}).`);
79093
+ }
79094
+ writeExecutable((0, import_node_path18.join)(MANAGED_BIN_DIR, "kubectl"), binary);
79095
+ }
79096
+ function normalizePlatform(platform2) {
79097
+ if (platform2 === "darwin" || platform2 === "linux") {
79098
+ return platform2;
79099
+ }
79100
+ throw new Error(`Unsupported platform '${platform2}'. 'eve local up' currently supports macOS and Linux.`);
79101
+ }
79102
+ function normalizeArch(arch) {
79103
+ if (arch === "x64") return "amd64";
79104
+ if (arch === "arm64") return "arm64";
79105
+ throw new Error(`Unsupported CPU architecture '${arch}'.`);
79106
+ }
79107
+ async function downloadBinary(url, destination) {
79108
+ const bytes = await downloadBytes(url);
79109
+ writeExecutable(destination, bytes);
79110
+ }
79111
+ async function downloadBytes(url) {
79112
+ const response = await fetch(url, {
79113
+ headers: {
79114
+ "User-Agent": "eve-cli-local-stack",
79115
+ Accept: "*/*"
79116
+ }
79117
+ });
79118
+ if (!response.ok) {
79119
+ throw new Error(`Download failed (${response.status}) for ${url}`);
79120
+ }
79121
+ const arrayBuffer = await response.arrayBuffer();
79122
+ return Buffer.from(arrayBuffer);
79123
+ }
79124
+ async function fetchText(url, headers) {
79125
+ const response = await fetch(url, {
79126
+ headers: {
79127
+ "User-Agent": "eve-cli-local-stack",
79128
+ Accept: "application/json,text/plain,*/*",
79129
+ ...headers ?? {}
79130
+ }
79131
+ });
79132
+ if (!response.ok) {
79133
+ throw new Error(`Request failed (${response.status}) for ${url}`);
79134
+ }
79135
+ return response.text();
79136
+ }
79137
+ function writeExecutable(destination, bytes) {
79138
+ const tempPath = `${destination}.tmp-${Date.now()}-${process.pid}`;
79139
+ (0, import_node_fs19.writeFileSync)(tempPath, bytes);
79140
+ (0, import_node_fs19.chmodSync)(tempPath, 493);
79141
+ (0, import_node_fs19.renameSync)(tempPath, destination);
79142
+ }
79143
+ async function ensureClusterReady(runtimeOptions) {
79144
+ const k3d = requireToolPath("k3d", "Run 'eve local up' again to auto-install managed tools.");
79145
+ const cluster = getClusterSnapshot();
79146
+ if (!cluster.exists) {
79147
+ printProgress(runtimeOptions, `Creating cluster '${DEFAULT_CLUSTER_NAME}'...`);
79148
+ run(
79149
+ k3d,
79150
+ [
79151
+ "cluster",
79152
+ "create",
79153
+ DEFAULT_CLUSTER_NAME,
79154
+ "--api-port",
79155
+ "127.0.0.1:6443",
79156
+ "-p",
79157
+ "80:80@loadbalancer",
79158
+ "-p",
79159
+ "443:443@loadbalancer"
79160
+ ],
79161
+ { stdio: runtimeOptions.verbose && !runtimeOptions.quiet ? "inherit" : "pipe" }
79162
+ );
79163
+ } else if (!cluster.running) {
79164
+ printProgress(runtimeOptions, `Starting cluster '${DEFAULT_CLUSTER_NAME}'...`);
79165
+ run(k3d, ["cluster", "start", DEFAULT_CLUSTER_NAME], {
79166
+ stdio: runtimeOptions.verbose && !runtimeOptions.quiet ? "inherit" : "pipe"
79167
+ });
79168
+ } else {
79169
+ printProgress(runtimeOptions, `Cluster '${DEFAULT_CLUSTER_NAME}' is already running.`);
79170
+ }
79171
+ trySelectLocalContext();
79172
+ await ensureClusterConnectivity(runtimeOptions);
79173
+ }
79174
+ async function ensureClusterConnectivity(runtimeOptions) {
79175
+ const kubectl = requireToolPath("kubectl", "Run 'eve local up' again to auto-install managed tools.");
79176
+ const maxAttempts = 3;
79177
+ for (let attempt = 1; attempt <= maxAttempts; attempt += 1) {
79178
+ const probe = run(kubectl, ["--context", DEFAULT_KUBE_CONTEXT, "get", "nodes"], {
79179
+ stdio: "pipe",
79180
+ allowFailure: true
79181
+ });
79182
+ if (probe.status === 0) {
79183
+ return;
79184
+ }
79185
+ const errorText = `${probe.stderr}
79186
+ ${probe.stdout}`;
79187
+ if (!errorText.includes("EOF")) {
79188
+ throw new Error(`Cannot connect to local cluster: ${probe.stderr.trim() || probe.stdout.trim()}`);
79189
+ }
79190
+ printProgress(runtimeOptions, `Cluster API returned EOF (attempt ${attempt}/${maxAttempts}); restarting load balancer...`);
79191
+ run("docker", [`restart`, `k3d-${DEFAULT_CLUSTER_NAME}-serverlb`], { allowFailure: true, stdio: "pipe" });
79192
+ await sleep(2e3);
79193
+ }
79194
+ throw new Error(`Failed to connect to cluster '${DEFAULT_CLUSTER_NAME}' after retrying load balancer restart.`);
79195
+ }
79196
+ async function resolveRequestedVersion(requestedVersion, runtimeOptions) {
79197
+ if (requestedVersion === "latest") {
79198
+ const version2 = await resolveLatestPlatformVersion();
79199
+ printProgress(runtimeOptions, `Resolved platform version: ${version2}`);
79200
+ return version2;
79201
+ }
79202
+ const normalized = normalizeVersion(requestedVersion);
79203
+ if (!normalized) {
79204
+ throw new Error(`Invalid --version value '${requestedVersion}'. Use a semantic version like '0.1.50' or 'latest'.`);
79205
+ }
79206
+ return normalized;
79207
+ }
79208
+ async function resolveLatestPlatformVersion() {
79209
+ const semverSets = await Promise.all(
79210
+ PLATFORM_IMAGES.map(async (image) => {
79211
+ const tags = await fetchRegistryTags(image.remote);
79212
+ return new Set(
79213
+ tags.map((tag) => normalizeVersion(tag)).filter((value) => Boolean(value))
79214
+ );
79215
+ })
79216
+ );
79217
+ if (semverSets.length === 0) {
79218
+ throw new Error("No platform images configured for local stack deployment.");
79219
+ }
79220
+ let intersection = new Set(semverSets[0]);
79221
+ for (const set of semverSets.slice(1)) {
79222
+ intersection = new Set(Array.from(intersection).filter((version2) => set.has(version2)));
79223
+ }
79224
+ const candidates = Array.from(intersection);
79225
+ if (candidates.length === 0) {
79226
+ throw new Error(
79227
+ "Unable to resolve a common platform version from GHCR tags. Re-run with --version <x.y.z>."
79228
+ );
79229
+ }
79230
+ candidates.sort(compareSemverDesc);
79231
+ return candidates[0];
79232
+ }
79233
+ async function fetchRegistryTags(imageRef) {
79234
+ const repository = imageRef.replace(/^ghcr\.io\//, "");
79235
+ const tokenPayload = await fetchText(`https://ghcr.io/token?scope=repository:${repository}:pull`);
79236
+ const token = JSON.parse(tokenPayload).token;
79237
+ if (!token) {
79238
+ throw new Error(`Unable to fetch GHCR token for ${imageRef}.`);
79239
+ }
79240
+ const tagsPayload = await fetchText(
79241
+ `https://ghcr.io/v2/${repository}/tags/list?n=200`,
79242
+ { Authorization: `Bearer ${token}` }
79243
+ );
79244
+ return JSON.parse(tagsPayload).tags ?? [];
79245
+ }
79246
+ function normalizeVersion(value) {
79247
+ const trimmed = value.trim();
79248
+ if (!trimmed) return null;
79249
+ let candidate = trimmed;
79250
+ if (candidate.startsWith("release-v")) {
79251
+ candidate = candidate.slice("release-v".length);
79252
+ } else if (candidate.startsWith("v")) {
79253
+ candidate = candidate.slice(1);
79254
+ }
79255
+ return /^\d+\.\d+\.\d+$/.test(candidate) ? candidate : null;
79256
+ }
79257
+ function compareSemverDesc(a, b2) {
79258
+ const pa = a.split(".").map((part) => Number.parseInt(part, 10));
79259
+ const pb = b2.split(".").map((part) => Number.parseInt(part, 10));
79260
+ for (let i = 0; i < 3; i += 1) {
79261
+ const diff = (pb[i] ?? 0) - (pa[i] ?? 0);
79262
+ if (diff !== 0) {
79263
+ return diff;
79264
+ }
79265
+ }
79266
+ return 0;
79267
+ }
79268
+ async function importPlatformImages(version2, runtimeOptions) {
79269
+ const docker = requireToolPath("docker", "Install Docker Desktop.");
79270
+ const k3d = requireToolPath("k3d", "Run 'eve local up' again to auto-install managed tools.");
79271
+ const stdio = runtimeOptions.verbose && !runtimeOptions.quiet ? "inherit" : "pipe";
79272
+ for (const image of PLATFORM_IMAGES) {
79273
+ const remoteTag = `${image.remote}:${version2}`;
79274
+ printProgress(runtimeOptions, `Pulling image ${remoteTag}...`);
79275
+ const pull = pullImageWithRetry(docker, remoteTag, stdio, runtimeOptions);
79276
+ if (pull.status !== 0) {
79277
+ throw new Error(
79278
+ `Failed to pull ${remoteTag}. Ensure GHCR image visibility is public and the version exists. Try: eve local up --version <x.y.z>`
79279
+ );
79280
+ }
79281
+ run(docker, ["tag", remoteTag, image.local], { stdio });
79282
+ printProgress(runtimeOptions, `Importing image ${image.component} into k3d...`);
79283
+ importImageViaTar(docker, k3d, image.local, image.component, stdio);
79284
+ }
79285
+ }
79286
+ function importImageViaTar(docker, k3d, imageTag, component, stdio) {
79287
+ const tarPath = (0, import_node_path18.join)((0, import_node_os6.tmpdir)(), `eve-local-${component}-${Date.now()}-${process.pid}.tar`);
79288
+ try {
79289
+ run(docker, ["image", "save", "--platform", "linux/amd64", imageTag, "-o", tarPath], { stdio });
79290
+ run(k3d, ["image", "import", "--mode", "direct", tarPath, "-c", DEFAULT_CLUSTER_NAME], { stdio });
79291
+ } finally {
79292
+ if ((0, import_node_fs19.existsSync)(tarPath)) {
79293
+ (0, import_node_fs19.unlinkSync)(tarPath);
79294
+ }
79295
+ }
79296
+ }
79297
+ function pullImageWithRetry(docker, remoteTag, stdio, runtimeOptions) {
79298
+ const maxAttempts = 3;
79299
+ for (let attempt = 1; attempt <= maxAttempts; attempt += 1) {
79300
+ const pull = run(docker, ["pull", "--platform", "linux/amd64", remoteTag], {
79301
+ stdio,
79302
+ allowFailure: true,
79303
+ timeoutMs: 7 * 60 * 1e3
79304
+ });
79305
+ if (pull.status === 0) {
79306
+ return pull;
79307
+ }
79308
+ const combined = `${pull.stderr}
79309
+ ${pull.stdout}`.toLowerCase();
79310
+ const retryable = combined.includes("unexpected eof") || combined.includes("short read") || combined.includes("i/o timeout") || combined.includes("timed out");
79311
+ if (!retryable || attempt === maxAttempts) {
79312
+ return pull;
79313
+ }
79314
+ printProgress(runtimeOptions, `Pull failed for ${remoteTag} (attempt ${attempt}/${maxAttempts}). Retrying...`);
79315
+ }
79316
+ return { status: 1, stdout: "", stderr: "pull retry exhausted" };
79317
+ }
79318
+ function applyLocalManifests(runtimeOptions) {
79319
+ const kubectl = requireToolPath("kubectl", "Run 'eve local up' again to auto-install managed tools.");
79320
+ printProgress(runtimeOptions, "Applying local Kubernetes manifests...");
79321
+ run(
79322
+ kubectl,
79323
+ ["--context", DEFAULT_KUBE_CONTEXT, "apply", "-k", LOCAL_STACK_OVERLAY],
79324
+ { stdio: runtimeOptions.verbose && !runtimeOptions.quiet ? "inherit" : "pipe" }
79325
+ );
79326
+ }
79327
+ function runDbMigration(timeoutSeconds, runtimeOptions) {
79328
+ const kubectl = requireToolPath("kubectl", "Run 'eve local up' again to auto-install managed tools.");
79329
+ const migrateJobPath = (0, import_node_path18.join)(LOCAL_STACK_BASE, "db-migrate-job.yaml");
79330
+ printProgress(runtimeOptions, "Running database migrations...");
79331
+ run(kubectl, ["--context", DEFAULT_KUBE_CONTEXT, "-n", "eve", "delete", "job/eve-db-migrate", "--ignore-not-found"], {
79332
+ stdio: "pipe",
79333
+ allowFailure: true
79334
+ });
79335
+ run(kubectl, ["--context", DEFAULT_KUBE_CONTEXT, "apply", "-f", migrateJobPath], {
79336
+ stdio: runtimeOptions.verbose && !runtimeOptions.quiet ? "inherit" : "pipe"
79337
+ });
79338
+ const wait = run(
79339
+ kubectl,
79340
+ ["--context", DEFAULT_KUBE_CONTEXT, "-n", "eve", "wait", "--for=condition=complete", "job/eve-db-migrate", timeoutArg(timeoutSeconds)],
79341
+ {
79342
+ stdio: runtimeOptions.verbose && !runtimeOptions.quiet ? "inherit" : "pipe",
79343
+ allowFailure: true
79344
+ }
79345
+ );
79346
+ if (wait.status !== 0) {
79347
+ run(kubectl, ["--context", DEFAULT_KUBE_CONTEXT, "-n", "eve", "logs", "job/eve-db-migrate"], { stdio: "inherit", allowFailure: true });
79348
+ throw new Error("Database migration failed. Inspect job logs above.");
79349
+ }
79350
+ }
79351
+ function generateAuthSecrets(runtimeOptions) {
79352
+ const kubectl = requireToolPath("kubectl", "Run 'eve local up' again to auto-install managed tools.");
79353
+ printProgress(runtimeOptions, "Generating auth secrets...");
79354
+ const existingJwtSecret = readSecretValue(kubectl, "SUPABASE_JWT_SECRET");
79355
+ const existingAdminPassword = readSecretValue(kubectl, "EVE_AUTH_ADMIN_PASSWORD");
79356
+ const existingAuthPrivateKey = readSecretValue(kubectl, "EVE_AUTH_PRIVATE_KEY");
79357
+ const existingAuthPublicKey = readSecretValue(kubectl, "EVE_AUTH_PUBLIC_KEY");
79358
+ const existingInternalApiKey = readSecretValue(kubectl, "EVE_INTERNAL_API_KEY");
79359
+ const existingSecretsMasterKey = readSecretValue(kubectl, "EVE_SECRETS_MASTER_KEY");
79360
+ const existingBootstrapToken = readSecretValue(kubectl, "EVE_BOOTSTRAP_TOKEN");
79361
+ const jwtSecret = existingJwtSecret || (0, import_node_crypto.randomBytes)(32).toString("hex");
79362
+ const adminPassword = existingAdminPassword || (0, import_node_crypto.randomBytes)(24).toString("base64url").slice(0, 32);
79363
+ const dbUrl = `postgres://eve_auth_admin:${adminPassword}@postgres.eve.svc.cluster.local:5432/eve?sslmode=disable`;
79364
+ let authPrivateKey = existingAuthPrivateKey;
79365
+ let authPublicKey = existingAuthPublicKey;
79366
+ if (!authPrivateKey || !authPublicKey) {
79367
+ const keyPair = (0, import_node_crypto.generateKeyPairSync)("rsa", {
79368
+ modulusLength: 2048,
79369
+ publicKeyEncoding: { type: "spki", format: "pem" },
79370
+ privateKeyEncoding: { type: "pkcs8", format: "pem" }
79371
+ });
79372
+ authPrivateKey = keyPair.privateKey;
79373
+ authPublicKey = keyPair.publicKey;
79374
+ }
79375
+ const iat = Math.floor(Date.now() / 1e3);
79376
+ const exp = iat + 10 * 365 * 24 * 60 * 60;
79377
+ const serviceKey = generateHs256Jwt({ role: "service_role", iss: "supabase", iat, exp }, jwtSecret);
79378
+ const anonKey = generateHs256Jwt({ role: "anon", iss: "supabase", iat, exp }, jwtSecret);
79379
+ const stringData = {
79380
+ EVE_INTERNAL_API_KEY: existingInternalApiKey || (0, import_node_crypto.randomBytes)(24).toString("hex"),
79381
+ EVE_SECRETS_MASTER_KEY: existingSecretsMasterKey || (0, import_node_crypto.randomBytes)(32).toString("hex"),
79382
+ EVE_BOOTSTRAP_TOKEN: existingBootstrapToken || (0, import_node_crypto.randomBytes)(24).toString("hex"),
79383
+ SUPABASE_JWT_SECRET: jwtSecret,
79384
+ EVE_AUTH_ADMIN_PASSWORD: adminPassword,
79385
+ SUPABASE_AUTH_DATABASE_URL: dbUrl,
79386
+ SUPABASE_AUTH_SERVICE_KEY: serviceKey,
79387
+ SUPABASE_ANON_KEY: anonKey,
79388
+ EVE_AUTH_PRIVATE_KEY: authPrivateKey,
79389
+ EVE_AUTH_PUBLIC_KEY: authPublicKey
79390
+ };
79391
+ const optionalKeys = [
79392
+ "EVE_GITHUB_WEBHOOK_SECRET",
79393
+ "EVE_SLACK_SIGNING_SECRET",
79394
+ "EVE_GATEWAY_PROJECT_ID"
79395
+ ];
79396
+ for (const key of optionalKeys) {
79397
+ const value = process.env[key];
79398
+ if (typeof value === "string" && value.length > 0) {
79399
+ stringData[key] = value;
79400
+ }
79401
+ }
79402
+ const patchPayload = JSON.stringify({ stringData });
79403
+ run(
79404
+ kubectl,
79405
+ ["--context", DEFAULT_KUBE_CONTEXT, "-n", "eve", "patch", "secret", "eve-app", "--type", "merge", "-p", patchPayload],
79406
+ { stdio: runtimeOptions.verbose && !runtimeOptions.quiet ? "inherit" : "pipe" }
79407
+ );
79408
+ }
79409
+ function readSecretValue(kubectl, key) {
79410
+ const result = run(
79411
+ kubectl,
79412
+ ["--context", DEFAULT_KUBE_CONTEXT, "-n", "eve", "get", "secret", "eve-app", "-o", `jsonpath={.data.${key}}`],
79413
+ { stdio: "pipe", allowFailure: true }
79414
+ );
79415
+ if (result.status !== 0) {
79416
+ return "";
79417
+ }
79418
+ const encoded = result.stdout.trim();
79419
+ if (!encoded) {
79420
+ return "";
79421
+ }
79422
+ try {
79423
+ return Buffer.from(encoded, "base64").toString("utf8");
79424
+ } catch {
79425
+ return "";
79426
+ }
79427
+ }
79428
+ function runAuthBootstrap(timeoutSeconds, runtimeOptions) {
79429
+ const kubectl = requireToolPath("kubectl", "Run 'eve local up' again to auto-install managed tools.");
79430
+ const bootstrapJobPath = (0, import_node_path18.join)(LOCAL_STACK_BASE, "auth-bootstrap-job.yaml");
79431
+ printProgress(runtimeOptions, "Bootstrapping auth database role...");
79432
+ run(kubectl, ["--context", DEFAULT_KUBE_CONTEXT, "-n", "eve", "delete", "job/auth-db-bootstrap", "--ignore-not-found"], {
79433
+ stdio: "pipe",
79434
+ allowFailure: true
79435
+ });
79436
+ run(kubectl, ["--context", DEFAULT_KUBE_CONTEXT, "apply", "-f", bootstrapJobPath], {
79437
+ stdio: runtimeOptions.verbose && !runtimeOptions.quiet ? "inherit" : "pipe"
79438
+ });
79439
+ const wait = run(
79440
+ kubectl,
79441
+ ["--context", DEFAULT_KUBE_CONTEXT, "-n", "eve", "wait", "--for=condition=complete", "job/auth-db-bootstrap", timeoutArg(timeoutSeconds)],
79442
+ {
79443
+ stdio: runtimeOptions.verbose && !runtimeOptions.quiet ? "inherit" : "pipe",
79444
+ allowFailure: true
79445
+ }
79446
+ );
79447
+ if (wait.status !== 0) {
79448
+ run(kubectl, ["--context", DEFAULT_KUBE_CONTEXT, "-n", "eve", "logs", "job/auth-db-bootstrap"], { stdio: "inherit", allowFailure: true });
79449
+ throw new Error("Auth bootstrap failed. Inspect job logs above.");
79450
+ }
79451
+ }
79452
+ function restartAndWaitRollouts(timeoutSeconds, runtimeOptions) {
79453
+ const kubectl = requireToolPath("kubectl", "Run 'eve local up' again to auto-install managed tools.");
79454
+ printProgress(runtimeOptions, "Restarting and waiting for service rollouts...");
79455
+ run(
79456
+ kubectl,
79457
+ [
79458
+ "--context",
79459
+ DEFAULT_KUBE_CONTEXT,
79460
+ "-n",
79461
+ "eve",
79462
+ "rollout",
79463
+ "restart",
79464
+ "deployment/eve-api",
79465
+ "deployment/eve-orchestrator",
79466
+ "deployment/eve-worker",
79467
+ "deployment/eve-gateway",
79468
+ "deployment/supabase-auth",
79469
+ "deployment/mailpit",
79470
+ "deployment/eve-sso"
79471
+ ],
79472
+ { stdio: runtimeOptions.verbose && !runtimeOptions.quiet ? "inherit" : "pipe" }
79473
+ );
79474
+ run(
79475
+ kubectl,
79476
+ ["--context", DEFAULT_KUBE_CONTEXT, "-n", "eve", "rollout", "restart", "statefulset/eve-agent-runtime"],
79477
+ { stdio: runtimeOptions.verbose && !runtimeOptions.quiet ? "inherit" : "pipe" }
79478
+ );
79479
+ const workloads = [
79480
+ { kind: "deployment", name: "eve-api" },
79481
+ { kind: "deployment", name: "eve-orchestrator" },
79482
+ { kind: "deployment", name: "eve-worker" },
79483
+ { kind: "deployment", name: "eve-gateway" },
79484
+ { kind: "deployment", name: "supabase-auth" },
79485
+ { kind: "deployment", name: "mailpit" },
79486
+ { kind: "deployment", name: "eve-sso" },
79487
+ { kind: "statefulset", name: "eve-agent-runtime" }
79488
+ ];
79489
+ for (const workload of workloads) {
79490
+ const status = run(
79491
+ kubectl,
79492
+ ["--context", DEFAULT_KUBE_CONTEXT, "-n", "eve", "rollout", "status", `${workload.kind}/${workload.name}`, timeoutArg(timeoutSeconds)],
79493
+ {
79494
+ stdio: runtimeOptions.verbose && !runtimeOptions.quiet ? "inherit" : "pipe",
79495
+ allowFailure: true
79496
+ }
79497
+ );
79498
+ if (status.status !== 0) {
79499
+ throw new Error(`Rollout failed for ${workload.kind}/${workload.name}. Run 'eve local status' and inspect service logs with 'eve local logs <service>'.`);
79500
+ }
79501
+ }
79502
+ }
79503
+ function waitForStatefulSetRollout(name, timeoutSeconds, runtimeOptions) {
79504
+ const kubectl = requireToolPath("kubectl", "Run 'eve local up' again to auto-install managed tools.");
79505
+ const status = run(
79506
+ kubectl,
79507
+ ["--context", DEFAULT_KUBE_CONTEXT, "-n", "eve", "rollout", "status", `statefulset/${name}`, timeoutArg(timeoutSeconds)],
79508
+ {
79509
+ stdio: runtimeOptions.verbose && !runtimeOptions.quiet ? "inherit" : "pipe",
79510
+ allowFailure: true
79511
+ }
79512
+ );
79513
+ if (status.status !== 0) {
79514
+ throw new Error(`StatefulSet '${name}' did not become ready in ${timeoutSeconds}s.`);
79515
+ }
79516
+ }
79517
+ function timeoutArg(timeoutSeconds) {
79518
+ return `--timeout=${Math.max(timeoutSeconds, 1)}s`;
79519
+ }
79520
+ function generateHs256Jwt(payload, secret) {
79521
+ const headerBase64 = Buffer.from(JSON.stringify({ alg: "HS256", typ: "JWT" })).toString("base64url");
79522
+ const payloadBase64 = Buffer.from(JSON.stringify(payload)).toString("base64url");
79523
+ const signature = (0, import_node_crypto.createHmac)("sha256", secret).update(`${headerBase64}.${payloadBase64}`).digest("base64url");
79524
+ return `${headerBase64}.${payloadBase64}.${signature}`;
79525
+ }
79526
+ function assertLocalAssetsPresent() {
79527
+ const files = [
79528
+ LOCAL_STACK_OVERLAY,
79529
+ LOCAL_STACK_BASE,
79530
+ (0, import_node_path18.join)(LOCAL_STACK_OVERLAY, "kustomization.yaml"),
79531
+ (0, import_node_path18.join)(LOCAL_STACK_BASE, "db-migrate-job.yaml"),
79532
+ (0, import_node_path18.join)(LOCAL_STACK_BASE, "auth-bootstrap-job.yaml")
79533
+ ];
79534
+ for (const file of files) {
79535
+ if (!(0, import_node_fs19.existsSync)(file)) {
79536
+ throw new Error(
79537
+ `Missing local stack assets at ${file}. Reinstall the CLI or ensure package assets were published.`
79538
+ );
79539
+ }
79540
+ }
79541
+ }
79542
+ async function waitForApiHealth(url, timeoutSeconds) {
79543
+ const deadline = Date.now() + Math.max(timeoutSeconds, 1) * 1e3;
79544
+ let latest = await probeApiHealth(url);
79545
+ while (!latest.ok && Date.now() < deadline) {
79546
+ await sleep(2e3);
79547
+ latest = await probeApiHealth(url);
79548
+ }
79549
+ if (!latest.ok) {
79550
+ throw new Error(`Local API did not become healthy within ${timeoutSeconds}s (${latest.error ?? "unknown error"}).`);
79551
+ }
79552
+ return latest;
79553
+ }
79554
+ async function probeApiHealth(url) {
79555
+ const controller = new AbortController();
79556
+ const timeout = setTimeout(() => controller.abort(), 3e3);
79557
+ try {
79558
+ const response = await fetch(`${url}/health`, { signal: controller.signal });
79559
+ if (!response.ok) {
79560
+ return {
79561
+ url,
79562
+ ok: false,
79563
+ error: `HTTP ${response.status}`
79564
+ };
79565
+ }
79566
+ const payload = await response.json();
79567
+ return {
79568
+ url,
79569
+ ok: payload.status === "ok" || payload.status === "healthy",
79570
+ status: payload.status,
79571
+ timestamp: payload.timestamp
79572
+ };
79573
+ } catch (error) {
79574
+ const message = error instanceof Error ? error.message : String(error);
79575
+ return {
79576
+ url,
79577
+ ok: false,
79578
+ error: message
79579
+ };
79580
+ } finally {
79581
+ clearTimeout(timeout);
79582
+ }
79583
+ }
79584
+ function getClusterSnapshot() {
79585
+ const k3d = findExecutable("k3d");
79586
+ if (!k3d) {
79587
+ return { exists: false, running: false };
79588
+ }
79589
+ const result = run(k3d, ["cluster", "list", "-o", "json"], {
79590
+ stdio: "pipe",
79591
+ allowFailure: true
79592
+ });
79593
+ if (result.status !== 0) {
79594
+ return { exists: false, running: false };
79595
+ }
79596
+ try {
79597
+ const payload = JSON.parse(result.stdout);
79598
+ const cluster = payload.find((item) => item.name === DEFAULT_CLUSTER_NAME);
79599
+ if (!cluster) {
79600
+ return { exists: false, running: false };
79601
+ }
79602
+ const serversRunning = Number(cluster.serversRunning ?? 0);
79603
+ const serversCount = Number(cluster.serversCount ?? 0);
79604
+ return {
79605
+ exists: true,
79606
+ running: serversCount > 0 && serversRunning >= serversCount
79607
+ };
79608
+ } catch {
79609
+ return { exists: false, running: false };
79610
+ }
79611
+ }
79612
+ function parseTimeoutSeconds(flags, defaultValue) {
79613
+ const raw = getStringFlag(flags, ["timeout"]);
79614
+ if (!raw) return defaultValue;
79615
+ const value = Number.parseInt(raw, 10);
79616
+ if (!Number.isFinite(value) || value <= 0) {
79617
+ throw new Error(`Invalid --timeout value: ${raw}`);
79618
+ }
79619
+ return value;
79620
+ }
79621
+ function run(command, args, options = {}) {
79622
+ const env = { ...process.env };
79623
+ if ((0, import_node_fs19.existsSync)(MANAGED_BIN_DIR)) {
79624
+ env.PATH = `${MANAGED_BIN_DIR}:${env.PATH ?? ""}`;
79625
+ }
79626
+ const result = (0, import_node_child_process10.spawnSync)(command, args, {
79627
+ cwd: options.cwd,
79628
+ encoding: "utf8",
79629
+ stdio: options.stdio ?? "pipe",
79630
+ env,
79631
+ timeout: options.timeoutMs
79632
+ });
79633
+ const status = result.status ?? 1;
79634
+ const stdout = result.stdout ?? "";
79635
+ const stderr = result.stderr ?? "";
79636
+ if (status !== 0 && !options.allowFailure) {
79637
+ const message = stderr.trim() || stdout.trim() || `${command} exited with status ${status}`;
79638
+ throw new Error(message);
79639
+ }
79640
+ return { status, stdout, stderr };
79641
+ }
79642
+ function findExecutable(name) {
79643
+ const managed = (0, import_node_path18.join)(MANAGED_BIN_DIR, name);
79644
+ if ((0, import_node_fs19.existsSync)(managed)) {
79645
+ return managed;
79646
+ }
79647
+ const found = (0, import_node_child_process10.spawnSync)("which", [name], {
79648
+ encoding: "utf8",
79649
+ stdio: "pipe"
79650
+ });
79651
+ if (found.status === 0 && found.stdout.trim()) {
79652
+ return found.stdout.trim();
79653
+ }
79654
+ return void 0;
79655
+ }
79656
+ function ensureTool(name, installHint) {
79657
+ if (!findExecutable(name)) {
79658
+ throw new Error(`Missing required tool '${name}'. ${installHint}`);
79659
+ }
79660
+ }
79661
+ function requireToolPath(name, hint) {
79662
+ const path6 = findExecutable(name);
79663
+ if (!path6) {
79664
+ throw new Error(`Missing required tool '${name}'. ${hint}`);
79665
+ }
79666
+ return path6;
79667
+ }
79668
+ function assertDockerRunning() {
79669
+ const docker = findExecutable("docker");
79670
+ if (!docker) {
79671
+ throw new Error("Missing required tool 'docker'. Install Docker Desktop.");
79672
+ }
79673
+ const result = run(docker, ["info"], { stdio: "pipe", allowFailure: true });
79674
+ if (result.status !== 0) {
79675
+ throw new Error("Docker daemon is not reachable. Start Docker Desktop and retry.");
79676
+ }
79677
+ }
79678
+ function trySelectLocalContext() {
79679
+ const kubectl = findExecutable("kubectl");
79680
+ if (!kubectl) {
79681
+ return;
79682
+ }
79683
+ const exists = run(
79684
+ kubectl,
79685
+ ["config", "get-contexts", DEFAULT_KUBE_CONTEXT],
79686
+ { stdio: "pipe", allowFailure: true }
79687
+ );
79688
+ if (exists.status !== 0) {
79689
+ return;
79690
+ }
79691
+ run(
79692
+ kubectl,
79693
+ ["config", "use-context", DEFAULT_KUBE_CONTEXT],
79694
+ { stdio: "pipe", allowFailure: true }
79695
+ );
79696
+ }
79697
+ function printProgress(runtimeOptions, message) {
79698
+ if (!runtimeOptions.quiet) {
79699
+ console.log(message);
79700
+ }
79701
+ }
79702
+ async function confirm(promptText) {
79703
+ if (!process.stdin.isTTY) {
79704
+ return false;
79705
+ }
79706
+ const rl = (0, import_promises2.createInterface)({ input: process.stdin, output: process.stdout });
79707
+ try {
79708
+ const answer = await rl.question(promptText);
79709
+ const normalized = answer.trim().toLowerCase();
79710
+ return normalized === "y" || normalized === "yes";
79711
+ } finally {
79712
+ rl.close();
79713
+ }
79714
+ }
79715
+ function sleep(ms) {
79716
+ return new Promise((resolvePromise) => {
79717
+ setTimeout(resolvePromise, ms);
79718
+ });
79719
+ }
79720
+
78448
79721
  // src/index.ts
78449
79722
  async function main2() {
78450
79723
  const { flags, positionals } = parseArgs(process.argv.slice(2));
@@ -78585,6 +79858,9 @@ async function main2() {
78585
79858
  case "fs":
78586
79859
  await handleFs(subcommand, rest, flags, context2);
78587
79860
  return;
79861
+ case "local":
79862
+ await handleLocal(subcommand, rest, flags, context2);
79863
+ return;
78588
79864
  default:
78589
79865
  showMainHelp();
78590
79866
  }