@semiont/cli 0.2.33-build.78 → 0.2.33-build.80

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/cli.mjs +180 -101
  2. package/package.json +4 -4
package/dist/cli.mjs CHANGED
@@ -341,10 +341,10 @@ function mergeDefs(...defs) {
341
341
  function cloneDef(schema2) {
342
342
  return mergeDefs(schema2._zod.def);
343
343
  }
344
- function getElementAtPath(obj, path36) {
345
- if (!path36)
344
+ function getElementAtPath(obj, path37) {
345
+ if (!path37)
346
346
  return obj;
347
- return path36.reduce((acc, key) => acc?.[key], obj);
347
+ return path37.reduce((acc, key) => acc?.[key], obj);
348
348
  }
349
349
  function promiseAllObject(promisesObj) {
350
350
  const keys = Object.keys(promisesObj);
@@ -634,11 +634,11 @@ function aborted(x, startIndex = 0) {
634
634
  }
635
635
  return false;
636
636
  }
637
- function prefixIssues(path36, issues) {
637
+ function prefixIssues(path37, issues) {
638
638
  return issues.map((iss) => {
639
639
  var _a4;
640
640
  (_a4 = iss).path ?? (_a4.path = []);
641
- iss.path.unshift(path36);
641
+ iss.path.unshift(path37);
642
642
  return iss;
643
643
  });
644
644
  }
@@ -859,7 +859,7 @@ function formatError(error46, mapper = (issue2) => issue2.message) {
859
859
  }
860
860
  function treeifyError(error46, mapper = (issue2) => issue2.message) {
861
861
  const result = { errors: [] };
862
- const processError = (error47, path36 = []) => {
862
+ const processError = (error47, path37 = []) => {
863
863
  var _a4, _b;
864
864
  for (const issue2 of error47.issues) {
865
865
  if (issue2.code === "invalid_union" && issue2.errors.length) {
@@ -869,7 +869,7 @@ function treeifyError(error46, mapper = (issue2) => issue2.message) {
869
869
  } else if (issue2.code === "invalid_element") {
870
870
  processError({ issues: issue2.issues }, issue2.path);
871
871
  } else {
872
- const fullpath = [...path36, ...issue2.path];
872
+ const fullpath = [...path37, ...issue2.path];
873
873
  if (fullpath.length === 0) {
874
874
  result.errors.push(mapper(issue2));
875
875
  continue;
@@ -901,8 +901,8 @@ function treeifyError(error46, mapper = (issue2) => issue2.message) {
901
901
  }
902
902
  function toDotPath(_path) {
903
903
  const segs = [];
904
- const path36 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
905
- for (const seg of path36) {
904
+ const path37 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
905
+ for (const seg of path37) {
906
906
  if (typeof seg === "number")
907
907
  segs.push(`[${seg}]`);
908
908
  else if (typeof seg === "symbol")
@@ -14359,8 +14359,8 @@ var init_filesystem_service = __esm({
14359
14359
  async checkHealth() {
14360
14360
  const dataPath = this.getDataPath();
14361
14361
  try {
14362
- const fs37 = await import("fs");
14363
- await fs37.promises.access(dataPath, fs37.constants.R_OK | fs37.constants.W_OK);
14362
+ const fs38 = await import("fs");
14363
+ await fs38.promises.access(dataPath, fs38.constants.R_OK | fs38.constants.W_OK);
14364
14364
  return {
14365
14365
  healthy: true,
14366
14366
  details: {
@@ -16637,9 +16637,9 @@ async function startJanusGraph(context) {
16637
16637
  }
16638
16638
  };
16639
16639
  }
16640
- async function fileExists(path36) {
16640
+ async function fileExists(path37) {
16641
16641
  try {
16642
- await fs13.access(path36);
16642
+ await fs13.access(path37);
16643
16643
  return true;
16644
16644
  } catch {
16645
16645
  return false;
@@ -17361,9 +17361,9 @@ Files placed here will persist across service restarts.
17361
17361
  // src/platforms/posix/handlers/graph-provision.ts
17362
17362
  import * as fs18 from "fs/promises";
17363
17363
  import { execSync as execSync8 } from "child_process";
17364
- async function fileExists2(path36) {
17364
+ async function fileExists2(path37) {
17365
17365
  try {
17366
- await fs18.access(path36);
17366
+ await fs18.access(path37);
17367
17367
  return true;
17368
17368
  } catch {
17369
17369
  return false;
@@ -18443,9 +18443,9 @@ async function stopJanusGraph(context) {
18443
18443
  };
18444
18444
  }
18445
18445
  }
18446
- async function fileExists3(path36) {
18446
+ async function fileExists3(path37) {
18447
18447
  try {
18448
- await fs21.access(path36);
18448
+ await fs21.access(path37);
18449
18449
  return true;
18450
18450
  } catch {
18451
18451
  return false;
@@ -20341,9 +20341,9 @@ async function startJanusGraph2(context) {
20341
20341
  };
20342
20342
  }
20343
20343
  }
20344
- async function fileExists4(path36) {
20344
+ async function fileExists4(path37) {
20345
20345
  try {
20346
- await fs26.access(path36);
20346
+ await fs26.access(path37);
20347
20347
  return true;
20348
20348
  } catch {
20349
20349
  return false;
@@ -23473,9 +23473,9 @@ async function stopJanusGraph2(context) {
23473
23473
  };
23474
23474
  }
23475
23475
  }
23476
- async function fileExists5(path36) {
23476
+ async function fileExists5(path37) {
23477
23477
  try {
23478
- await fs29.access(path36);
23478
+ await fs29.access(path37);
23479
23479
  return true;
23480
23480
  } catch {
23481
23481
  return false;
@@ -28751,12 +28751,12 @@ var init_path = __esm({
28751
28751
  "../../node_modules/@anthropic-ai/sdk/internal/utils/path.mjs"() {
28752
28752
  init_error();
28753
28753
  EMPTY = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.create(null));
28754
- createPathTagFunction = (pathEncoder = encodeURIPath) => function path36(statics, ...params) {
28754
+ createPathTagFunction = (pathEncoder = encodeURIPath) => function path37(statics, ...params) {
28755
28755
  if (statics.length === 1)
28756
28756
  return statics[0];
28757
28757
  let postPath = false;
28758
28758
  const invalidSegments = [];
28759
- const path37 = statics.reduce((previousValue, currentValue, index) => {
28759
+ const path38 = statics.reduce((previousValue, currentValue, index) => {
28760
28760
  if (/[?#]/.test(currentValue)) {
28761
28761
  postPath = true;
28762
28762
  }
@@ -28773,7 +28773,7 @@ var init_path = __esm({
28773
28773
  }
28774
28774
  return previousValue + currentValue + (index === params.length ? "" : encoded);
28775
28775
  }, "");
28776
- const pathOnly = path37.split(/[?#]/, 1)[0];
28776
+ const pathOnly = path38.split(/[?#]/, 1)[0];
28777
28777
  const invalidSegmentPattern = /(?<=^|\/)(?:\.|%2e){1,2}(?=\/|$)/gi;
28778
28778
  let match;
28779
28779
  while ((match = invalidSegmentPattern.exec(pathOnly)) !== null) {
@@ -28794,10 +28794,10 @@ var init_path = __esm({
28794
28794
  }, "");
28795
28795
  throw new AnthropicError(`Path parameters result in path with invalid segments:
28796
28796
  ${invalidSegments.map((e) => e.error).join("\n")}
28797
- ${path37}
28797
+ ${path38}
28798
28798
  ${underline}`);
28799
28799
  }
28800
- return path37;
28800
+ return path38;
28801
28801
  };
28802
28802
  path31 = /* @__PURE__ */ createPathTagFunction(encodeURIPath);
28803
28803
  }
@@ -31480,9 +31480,9 @@ var init_client = __esm({
31480
31480
  makeStatusError(status, error46, message, headers) {
31481
31481
  return APIError.generate(status, error46, message, headers);
31482
31482
  }
31483
- buildURL(path36, query, defaultBaseURL) {
31483
+ buildURL(path37, query, defaultBaseURL) {
31484
31484
  const baseURL = !__classPrivateFieldGet(this, _BaseAnthropic_instances, "m", _BaseAnthropic_baseURLOverridden).call(this) && defaultBaseURL || this.baseURL;
31485
- const url2 = isAbsoluteURL(path36) ? new URL(path36) : new URL(baseURL + (baseURL.endsWith("/") && path36.startsWith("/") ? path36.slice(1) : path36));
31485
+ const url2 = isAbsoluteURL(path37) ? new URL(path37) : new URL(baseURL + (baseURL.endsWith("/") && path37.startsWith("/") ? path37.slice(1) : path37));
31486
31486
  const defaultQuery = this.defaultQuery();
31487
31487
  if (!isEmptyObj(defaultQuery)) {
31488
31488
  query = { ...defaultQuery, ...query };
@@ -31513,24 +31513,24 @@ var init_client = __esm({
31513
31513
  */
31514
31514
  async prepareRequest(request, { url: url2, options }) {
31515
31515
  }
31516
- get(path36, opts) {
31517
- return this.methodRequest("get", path36, opts);
31516
+ get(path37, opts) {
31517
+ return this.methodRequest("get", path37, opts);
31518
31518
  }
31519
- post(path36, opts) {
31520
- return this.methodRequest("post", path36, opts);
31519
+ post(path37, opts) {
31520
+ return this.methodRequest("post", path37, opts);
31521
31521
  }
31522
- patch(path36, opts) {
31523
- return this.methodRequest("patch", path36, opts);
31522
+ patch(path37, opts) {
31523
+ return this.methodRequest("patch", path37, opts);
31524
31524
  }
31525
- put(path36, opts) {
31526
- return this.methodRequest("put", path36, opts);
31525
+ put(path37, opts) {
31526
+ return this.methodRequest("put", path37, opts);
31527
31527
  }
31528
- delete(path36, opts) {
31529
- return this.methodRequest("delete", path36, opts);
31528
+ delete(path37, opts) {
31529
+ return this.methodRequest("delete", path37, opts);
31530
31530
  }
31531
- methodRequest(method, path36, opts) {
31531
+ methodRequest(method, path37, opts) {
31532
31532
  return this.request(Promise.resolve(opts).then((opts2) => {
31533
- return { method, path: path36, ...opts2 };
31533
+ return { method, path: path37, ...opts2 };
31534
31534
  }));
31535
31535
  }
31536
31536
  request(options, remainingRetries = null) {
@@ -31634,8 +31634,8 @@ var init_client = __esm({
31634
31634
  }));
31635
31635
  return { response, options, controller, requestLogID, retryOfRequestLogID, startTime };
31636
31636
  }
31637
- getAPIList(path36, Page3, opts) {
31638
- return this.requestAPIList(Page3, { method: "get", path: path36, ...opts });
31637
+ getAPIList(path37, Page3, opts) {
31638
+ return this.requestAPIList(Page3, { method: "get", path: path37, ...opts });
31639
31639
  }
31640
31640
  requestAPIList(Page3, options) {
31641
31641
  const request = this.makeRequest(options, null, void 0);
@@ -31722,8 +31722,8 @@ var init_client = __esm({
31722
31722
  }
31723
31723
  async buildRequest(inputOptions, { retryCount = 0 } = {}) {
31724
31724
  const options = { ...inputOptions };
31725
- const { method, path: path36, query, defaultBaseURL } = options;
31726
- const url2 = this.buildURL(path36, query, defaultBaseURL);
31725
+ const { method, path: path37, query, defaultBaseURL } = options;
31726
+ const url2 = this.buildURL(path37, query, defaultBaseURL);
31727
31727
  if ("timeout" in options)
31728
31728
  validatePositiveInteger("timeout", options.timeout);
31729
31729
  options.timeout = options.timeout ?? this.timeout;
@@ -33601,12 +33601,12 @@ var init_path2 = __esm({
33601
33601
  "../../node_modules/openai/internal/utils/path.mjs"() {
33602
33602
  init_error3();
33603
33603
  EMPTY2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.create(null));
33604
- createPathTagFunction2 = (pathEncoder = encodeURIPath2) => function path36(statics, ...params) {
33604
+ createPathTagFunction2 = (pathEncoder = encodeURIPath2) => function path37(statics, ...params) {
33605
33605
  if (statics.length === 1)
33606
33606
  return statics[0];
33607
33607
  let postPath = false;
33608
33608
  const invalidSegments = [];
33609
- const path37 = statics.reduce((previousValue, currentValue, index) => {
33609
+ const path38 = statics.reduce((previousValue, currentValue, index) => {
33610
33610
  if (/[?#]/.test(currentValue)) {
33611
33611
  postPath = true;
33612
33612
  }
@@ -33623,7 +33623,7 @@ var init_path2 = __esm({
33623
33623
  }
33624
33624
  return previousValue + currentValue + (index === params.length ? "" : encoded);
33625
33625
  }, "");
33626
- const pathOnly = path37.split(/[?#]/, 1)[0];
33626
+ const pathOnly = path38.split(/[?#]/, 1)[0];
33627
33627
  const invalidSegmentPattern = /(?<=^|\/)(?:\.|%2e){1,2}(?=\/|$)/gi;
33628
33628
  let match;
33629
33629
  while ((match = invalidSegmentPattern.exec(pathOnly)) !== null) {
@@ -33644,10 +33644,10 @@ var init_path2 = __esm({
33644
33644
  }, "");
33645
33645
  throw new OpenAIError(`Path parameters result in path with invalid segments:
33646
33646
  ${invalidSegments.map((e) => e.error).join("\n")}
33647
- ${path37}
33647
+ ${path38}
33648
33648
  ${underline}`);
33649
33649
  }
33650
- return path37;
33650
+ return path38;
33651
33651
  };
33652
33652
  path32 = /* @__PURE__ */ createPathTagFunction2(encodeURIPath2);
33653
33653
  }
@@ -38800,9 +38800,9 @@ var init_client2 = __esm({
38800
38800
  this.apiKey = token;
38801
38801
  return true;
38802
38802
  }
38803
- buildURL(path36, query, defaultBaseURL) {
38803
+ buildURL(path37, query, defaultBaseURL) {
38804
38804
  const baseURL = !__classPrivateFieldGet2(this, _OpenAI_instances, "m", _OpenAI_baseURLOverridden).call(this) && defaultBaseURL || this.baseURL;
38805
- const url2 = isAbsoluteURL2(path36) ? new URL(path36) : new URL(baseURL + (baseURL.endsWith("/") && path36.startsWith("/") ? path36.slice(1) : path36));
38805
+ const url2 = isAbsoluteURL2(path37) ? new URL(path37) : new URL(baseURL + (baseURL.endsWith("/") && path37.startsWith("/") ? path37.slice(1) : path37));
38806
38806
  const defaultQuery = this.defaultQuery();
38807
38807
  if (!isEmptyObj2(defaultQuery)) {
38808
38808
  query = { ...defaultQuery, ...query };
@@ -38826,24 +38826,24 @@ var init_client2 = __esm({
38826
38826
  */
38827
38827
  async prepareRequest(request, { url: url2, options }) {
38828
38828
  }
38829
- get(path36, opts) {
38830
- return this.methodRequest("get", path36, opts);
38829
+ get(path37, opts) {
38830
+ return this.methodRequest("get", path37, opts);
38831
38831
  }
38832
- post(path36, opts) {
38833
- return this.methodRequest("post", path36, opts);
38832
+ post(path37, opts) {
38833
+ return this.methodRequest("post", path37, opts);
38834
38834
  }
38835
- patch(path36, opts) {
38836
- return this.methodRequest("patch", path36, opts);
38835
+ patch(path37, opts) {
38836
+ return this.methodRequest("patch", path37, opts);
38837
38837
  }
38838
- put(path36, opts) {
38839
- return this.methodRequest("put", path36, opts);
38838
+ put(path37, opts) {
38839
+ return this.methodRequest("put", path37, opts);
38840
38840
  }
38841
- delete(path36, opts) {
38842
- return this.methodRequest("delete", path36, opts);
38841
+ delete(path37, opts) {
38842
+ return this.methodRequest("delete", path37, opts);
38843
38843
  }
38844
- methodRequest(method, path36, opts) {
38844
+ methodRequest(method, path37, opts) {
38845
38845
  return this.request(Promise.resolve(opts).then((opts2) => {
38846
- return { method, path: path36, ...opts2 };
38846
+ return { method, path: path37, ...opts2 };
38847
38847
  }));
38848
38848
  }
38849
38849
  request(options, remainingRetries = null) {
@@ -38947,8 +38947,8 @@ var init_client2 = __esm({
38947
38947
  }));
38948
38948
  return { response, options, controller, requestLogID, retryOfRequestLogID, startTime };
38949
38949
  }
38950
- getAPIList(path36, Page3, opts) {
38951
- return this.requestAPIList(Page3, { method: "get", path: path36, ...opts });
38950
+ getAPIList(path37, Page3, opts) {
38951
+ return this.requestAPIList(Page3, { method: "get", path: path37, ...opts });
38952
38952
  }
38953
38953
  requestAPIList(Page3, options) {
38954
38954
  const request = this.makeRequest(options, null, void 0);
@@ -39026,8 +39026,8 @@ var init_client2 = __esm({
39026
39026
  }
39027
39027
  async buildRequest(inputOptions, { retryCount = 0 } = {}) {
39028
39028
  const options = { ...inputOptions };
39029
- const { method, path: path36, query, defaultBaseURL } = options;
39030
- const url2 = this.buildURL(path36, query, defaultBaseURL);
39029
+ const { method, path: path37, query, defaultBaseURL } = options;
39030
+ const url2 = this.buildURL(path37, query, defaultBaseURL);
39031
39031
  if ("timeout" in options)
39032
39032
  validatePositiveInteger2("timeout", options.timeout);
39033
39033
  options.timeout = options.timeout ?? this.timeout;
@@ -39805,6 +39805,80 @@ var init_platforms = __esm({
39805
39805
  }
39806
39806
  });
39807
39807
 
39808
+ // src/core/config-loader.ts
39809
+ var config_loader_exports = {};
39810
+ __export(config_loader_exports, {
39811
+ findProjectRoot: () => findProjectRoot,
39812
+ getAvailableEnvironments: () => getAvailableEnvironments,
39813
+ isValidEnvironment: () => isValidEnvironment,
39814
+ loadEnvironmentConfig: () => loadEnvironmentConfig
39815
+ });
39816
+ import * as fs35 from "fs";
39817
+ import * as path33 from "path";
39818
+ import { parseAndMergeConfigs, listEnvironmentNames, ConfigurationError } from "@semiont/core";
39819
+ function findProjectRoot() {
39820
+ const root = process.env.SEMIONT_ROOT;
39821
+ if (!root) {
39822
+ throw new ConfigurationError(
39823
+ "SEMIONT_ROOT environment variable is not set",
39824
+ void 0,
39825
+ "Set SEMIONT_ROOT to your project directory, or use the semiont CLI which sets it automatically"
39826
+ );
39827
+ }
39828
+ if (!fs35.existsSync(root)) {
39829
+ throw new ConfigurationError(
39830
+ `SEMIONT_ROOT points to non-existent directory: ${root}`,
39831
+ void 0,
39832
+ "Check that SEMIONT_ROOT environment variable is set correctly"
39833
+ );
39834
+ }
39835
+ const hasSemiontJson = fs35.existsSync(path33.join(root, "semiont.json"));
39836
+ const hasEnvironments = fs35.existsSync(path33.join(root, "environments"));
39837
+ if (!hasSemiontJson && !hasEnvironments) {
39838
+ throw new ConfigurationError(
39839
+ `SEMIONT_ROOT does not point to a valid Semiont project: ${root}`,
39840
+ void 0,
39841
+ "Ensure SEMIONT_ROOT points to a directory containing semiont.json or environments/"
39842
+ );
39843
+ }
39844
+ return root;
39845
+ }
39846
+ function loadEnvironmentConfig(projectRoot, environment) {
39847
+ const baseConfigPath = path33.join(projectRoot, "semiont.json");
39848
+ const baseContent = fs35.existsSync(baseConfigPath) ? fs35.readFileSync(baseConfigPath, "utf-8") : null;
39849
+ const envPath = path33.join(projectRoot, "environments", `${environment}.json`);
39850
+ if (!fs35.existsSync(envPath)) {
39851
+ throw new ConfigurationError(
39852
+ `Environment configuration missing: ${envPath}`,
39853
+ environment,
39854
+ `Create the configuration file or use: semiont init`
39855
+ );
39856
+ }
39857
+ const envContent = fs35.readFileSync(envPath, "utf-8");
39858
+ return parseAndMergeConfigs(baseContent, envContent, process.env, environment, projectRoot);
39859
+ }
39860
+ function getAvailableEnvironments() {
39861
+ try {
39862
+ const projectRoot = findProjectRoot();
39863
+ const configDir = path33.join(projectRoot, "environments");
39864
+ if (!fs35.existsSync(configDir)) {
39865
+ return [];
39866
+ }
39867
+ const files = fs35.readdirSync(configDir);
39868
+ return listEnvironmentNames(files);
39869
+ } catch (error46) {
39870
+ return [];
39871
+ }
39872
+ }
39873
+ function isValidEnvironment(environment) {
39874
+ return getAvailableEnvironments().includes(environment);
39875
+ }
39876
+ var init_config_loader = __esm({
39877
+ "src/core/config-loader.ts"() {
39878
+ "use strict";
39879
+ }
39880
+ });
39881
+
39808
39882
  // src/core/multi-service-executor.ts
39809
39883
  import { parseEnvironment } from "@semiont/core";
39810
39884
  var MultiServiceExecutor;
@@ -39915,9 +39989,11 @@ var init_multi_service_executor = __esm({
39915
39989
  if (!projectRoot) {
39916
39990
  throw new Error("Project root is required in envConfig._metadata");
39917
39991
  }
39992
+ const { getAvailableEnvironments: getAvailableEnvironments2 } = await Promise.resolve().then(() => (init_config_loader(), config_loader_exports));
39993
+ const availableEnvironments = getAvailableEnvironments2();
39918
39994
  const config2 = {
39919
39995
  projectRoot,
39920
- environment: parseEnvironment(environment),
39996
+ environment: parseEnvironment(environment, availableEnvironments),
39921
39997
  verbose: options.verbose || false,
39922
39998
  quiet: options.quiet || false,
39923
39999
  dryRun: options.dryRun || false
@@ -40701,8 +40777,8 @@ import express from "express";
40701
40777
  import { createServer as createServer3 } from "http";
40702
40778
  import { Server as SocketIOServer } from "socket.io";
40703
40779
  import { fileURLToPath as fileURLToPath3 } from "url";
40704
- import { dirname as dirname8, join as join31 } from "path";
40705
- import fs35 from "fs";
40780
+ import { dirname as dirname8, join as join32 } from "path";
40781
+ import fs36 from "fs";
40706
40782
  var __filename, __dirname, embeddedJS, embeddedCSS, WebDashboardServer;
40707
40783
  var init_web_dashboard_server = __esm({
40708
40784
  "src/core/dashboard/web-dashboard-server.ts"() {
@@ -40752,15 +40828,15 @@ var init_web_dashboard_server = __esm({
40752
40828
  });
40753
40829
  } else {
40754
40830
  const possibleDirs = [
40755
- join31(__dirname, "..", "..", "..", "dist", "dashboard"),
40756
- join31(__dirname, "dashboard"),
40757
- join31(__dirname, "..", "dashboard"),
40758
- join31(process.cwd(), "dist", "dashboard"),
40759
- join31(process.cwd(), "apps", "cli", "dist", "dashboard")
40831
+ join32(__dirname, "..", "..", "..", "dist", "dashboard"),
40832
+ join32(__dirname, "dashboard"),
40833
+ join32(__dirname, "..", "dashboard"),
40834
+ join32(process.cwd(), "dist", "dashboard"),
40835
+ join32(process.cwd(), "apps", "cli", "dist", "dashboard")
40760
40836
  ];
40761
40837
  let distDir = null;
40762
40838
  for (const dir of possibleDirs) {
40763
- if (fs35.existsSync(join31(dir, "dashboard.js"))) {
40839
+ if (fs36.existsSync(join32(dir, "dashboard.js"))) {
40764
40840
  distDir = dir;
40765
40841
  bundleExists = true;
40766
40842
  console.log(`Found dashboard bundle at: ${dir}`);
@@ -41248,7 +41324,7 @@ var require_package = __commonJS({
41248
41324
  "@types/express": "^4.17.17",
41249
41325
  "@types/ink": "^0.5.2",
41250
41326
  "@types/js-yaml": "^4.0.9",
41251
- "@types/react": "^19.0.0",
41327
+ "@types/react": "^18.3.0",
41252
41328
  "@types/yargs": "^17.0.0",
41253
41329
  "@vitest/coverage-v8": "^3.2.4",
41254
41330
  chalk: "^5.3.0",
@@ -42560,9 +42636,9 @@ function isCommandDefinition(obj) {
42560
42636
  }
42561
42637
 
42562
42638
  // src/core/service-discovery.ts
42563
- import * as path33 from "path";
42564
- import * as fs36 from "fs";
42565
- import { findProjectRoot } from "@semiont/core";
42639
+ init_config_loader();
42640
+ import * as path34 from "path";
42641
+ import * as fs37 from "fs";
42566
42642
  var BUILT_IN_SERVICES = ["frontend", "backend", "database", "filesystem"];
42567
42643
  var environmentServicesCache = /* @__PURE__ */ new Map();
42568
42644
  async function loadEnvironmentServices(environment) {
@@ -42571,11 +42647,11 @@ async function loadEnvironmentServices(environment) {
42571
42647
  }
42572
42648
  try {
42573
42649
  const PROJECT_ROOT = findProjectRoot();
42574
- const configPath = path33.join(PROJECT_ROOT, "environments", `${environment}.json`);
42575
- if (!fs36.existsSync(configPath)) {
42650
+ const configPath = path34.join(PROJECT_ROOT, "environments", `${environment}.json`);
42651
+ if (!fs37.existsSync(configPath)) {
42576
42652
  return [...BUILT_IN_SERVICES];
42577
42653
  }
42578
- const jsonContent = fs36.readFileSync(configPath, "utf-8");
42654
+ const jsonContent = fs37.readFileSync(configPath, "utf-8");
42579
42655
  const config2 = JSON.parse(jsonContent);
42580
42656
  const services = config2.services ? Object.keys(config2.services) : [];
42581
42657
  environmentServicesCache.set(environment, services);
@@ -42606,8 +42682,8 @@ async function isValidService(service, environment) {
42606
42682
  import { parseEnvironment as parseEnvironment2 } from "@semiont/core";
42607
42683
 
42608
42684
  // src/core/service-resolver.ts
42609
- import * as path34 from "path";
42610
- import { ConfigurationError } from "@semiont/core";
42685
+ import * as path35 from "path";
42686
+ import { ConfigurationError as ConfigurationError2 } from "@semiont/core";
42611
42687
  function getServicePlatform(serviceName, config2) {
42612
42688
  const environment = config2._metadata?.environment;
42613
42689
  if (!environment) {
@@ -42615,7 +42691,7 @@ function getServicePlatform(serviceName, config2) {
42615
42691
  }
42616
42692
  const serviceConfig = config2.services?.[serviceName];
42617
42693
  if (!serviceConfig) {
42618
- throw new ConfigurationError(
42694
+ throw new ConfigurationError2(
42619
42695
  `Service '${serviceName}' not found in environment '${environment}'`,
42620
42696
  environment,
42621
42697
  `Add '${serviceName}' to environments/${environment}.json`
@@ -42627,7 +42703,7 @@ function getServicePlatform(serviceName, config2) {
42627
42703
  if (config2.platform?.default) {
42628
42704
  return config2.platform.default;
42629
42705
  }
42630
- throw new ConfigurationError(
42706
+ throw new ConfigurationError2(
42631
42707
  `Platform not specified for service '${serviceName}'`,
42632
42708
  environment,
42633
42709
  `Add platform configuration to the service or set a default platform in environments/${environment}.json:
@@ -42654,7 +42730,7 @@ function resolveServiceDeployments(serviceNames, config2) {
42654
42730
  const serviceConfig = config2.services?.[serviceName];
42655
42731
  if (!serviceConfig) {
42656
42732
  const availableServices = Object.keys(config2.services || {});
42657
- const configPath = path34.join(projectRoot, "environments", `${environment}.json`);
42733
+ const configPath = path35.join(projectRoot, "environments", `${environment}.json`);
42658
42734
  console.warn(`\u274C Service '${serviceName}' not found in environment '${environment}'`);
42659
42735
  if (availableServices.length > 0) {
42660
42736
  console.warn(` Available services: ${availableServices.join(", ")}`);
@@ -42674,7 +42750,7 @@ function resolveServiceDeployments(serviceNames, config2) {
42674
42750
  try {
42675
42751
  platform = getServicePlatform(serviceName, config2);
42676
42752
  } catch (error46) {
42677
- if (error46 instanceof ConfigurationError) {
42753
+ if (error46 instanceof ConfigurationError2) {
42678
42754
  console.error(error46.toString());
42679
42755
  } else {
42680
42756
  console.error(`\u274C Failed to determine platform for service '${serviceName}': ${error46}`);
@@ -42693,7 +42769,7 @@ function resolveServiceDeployments(serviceNames, config2) {
42693
42769
  // src/core/command-service-matcher.ts
42694
42770
  init_service_factory();
42695
42771
  init_service_command_capabilities();
42696
- import * as path35 from "path";
42772
+ import * as path36 from "path";
42697
42773
  async function checkServiceSupportsCommand(serviceName, command, envConfig) {
42698
42774
  try {
42699
42775
  const projectRoot = envConfig._metadata?.projectRoot;
@@ -42711,13 +42787,15 @@ async function checkServiceSupportsCommand(serviceName, command, envConfig) {
42711
42787
  if (deployments.length === 0) {
42712
42788
  return false;
42713
42789
  }
42790
+ const { getAvailableEnvironments: getAvailableEnvironments2 } = await Promise.resolve().then(() => (init_config_loader(), config_loader_exports));
42791
+ const availableEnvironments = getAvailableEnvironments2();
42714
42792
  const deployment = deployments[0];
42715
42793
  const service = ServiceFactory.create(
42716
42794
  serviceName,
42717
42795
  deployment.platform,
42718
42796
  {
42719
42797
  projectRoot,
42720
- environment: parseEnvironment2(environment),
42798
+ environment: parseEnvironment2(environment, availableEnvironments),
42721
42799
  verbose: false,
42722
42800
  quiet: true,
42723
42801
  dryRun: false
@@ -42775,7 +42853,7 @@ async function resolveServiceSelector(selector, capability, envConfig) {
42775
42853
  if (!projectRoot) {
42776
42854
  throw new Error("Project root is required in envConfig._metadata");
42777
42855
  }
42778
- const configPath = path35.join(projectRoot, "environments", `${environment}.json`);
42856
+ const configPath = path36.join(projectRoot, "environments", `${environment}.json`);
42779
42857
  const errorMessage = [
42780
42858
  `Unknown service '${selector}' in environment '${environment}'`,
42781
42859
  `Available services: ${availableServices.join(", ")}`,
@@ -42901,7 +42979,7 @@ function findAliases(key, aliases) {
42901
42979
  }
42902
42980
 
42903
42981
  // src/core/command-executor.ts
42904
- import { getAvailableEnvironments, isValidEnvironment, loadEnvironmentConfig, findProjectRoot as findProjectRoot2 } from "@semiont/core";
42982
+ init_config_loader();
42905
42983
 
42906
42984
  // src/core/io/string-utils.ts
42907
42985
  function getDisplayWidth(str3) {
@@ -43271,14 +43349,14 @@ var OutputFormatter = class {
43271
43349
  /**
43272
43350
  * Get nested value from object using dot notation
43273
43351
  */
43274
- static getNestedValue(obj, path36) {
43275
- return path36.split(".").reduce((current, key) => current?.[key], obj);
43352
+ static getNestedValue(obj, path37) {
43353
+ return path37.split(".").reduce((current, key) => current?.[key], obj);
43276
43354
  }
43277
43355
  /**
43278
43356
  * Set nested value in object using dot notation
43279
43357
  */
43280
- static setNestedValue(obj, path36, value) {
43281
- const keys = path36.split(".");
43358
+ static setNestedValue(obj, path37, value) {
43359
+ const keys = path37.split(".");
43282
43360
  const lastKey = keys.pop();
43283
43361
  const target = keys.reduce((current, key) => {
43284
43362
  if (!(key in current)) {
@@ -43450,8 +43528,9 @@ async function executeCommand(commandName, argv) {
43450
43528
  if (options.environment || process.env.SEMIONT_ENV) {
43451
43529
  try {
43452
43530
  const env = options.environment || process.env.SEMIONT_ENV;
43453
- const projectRoot = process.env.SEMIONT_ROOT || findProjectRoot2();
43531
+ const projectRoot = process.env.SEMIONT_ROOT || findProjectRoot();
43454
43532
  const envConfig = loadEnvironmentConfig(projectRoot, env);
43533
+ const availableEnvironments = getAvailableEnvironments();
43455
43534
  const resolvedServices = await resolveServiceSelector(
43456
43535
  options.service,
43457
43536
  commandName,
@@ -43465,7 +43544,7 @@ async function executeCommand(commandName, argv) {
43465
43544
  deployment.platform,
43466
43545
  {
43467
43546
  projectRoot,
43468
- environment: parseEnvironment3(env),
43547
+ environment: parseEnvironment3(env, availableEnvironments),
43469
43548
  verbose: false,
43470
43549
  quiet: true,
43471
43550
  dryRun: false
@@ -43510,7 +43589,7 @@ async function executeCommand(commandName, argv) {
43510
43589
  if (command.requiresServices) {
43511
43590
  const service = "service" in options && typeof options.service === "string" ? options.service : "all";
43512
43591
  const environment = options.environment;
43513
- const projectRoot = process.env.SEMIONT_ROOT || findProjectRoot2();
43592
+ const projectRoot = process.env.SEMIONT_ROOT || findProjectRoot();
43514
43593
  const envConfig = loadEnvironmentConfig(projectRoot, environment);
43515
43594
  await validateServiceSelector(service, commandName, envConfig);
43516
43595
  const resolvedServices = await resolveServiceSelector(service, commandName, envConfig);
@@ -43519,7 +43598,7 @@ async function executeCommand(commandName, argv) {
43519
43598
  let results;
43520
43599
  if (command.requiresServices) {
43521
43600
  const environment = options.environment;
43522
- const projectRoot = process.env.SEMIONT_ROOT || findProjectRoot2();
43601
+ const projectRoot = process.env.SEMIONT_ROOT || findProjectRoot();
43523
43602
  const envConfig = loadEnvironmentConfig(projectRoot, environment);
43524
43603
  results = await command.handler(services, options, envConfig);
43525
43604
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@semiont/cli",
3
- "version": "0.2.33-build.78",
3
+ "version": "0.2.33-build.80",
4
4
  "description": "Semiont CLI - Unified environment management tool",
5
5
  "_comment": "AWS SDK dependencies (@aws-sdk/*) are only used by platforms/aws",
6
6
  "type": "module",
@@ -65,8 +65,8 @@
65
65
  "@aws-sdk/client-sts": "^3.859.0",
66
66
  "@aws-sdk/client-wafv2": "^3.859.0",
67
67
  "@prisma/client": "^6.13.0",
68
- "@semiont/api-client": "0.2.33-build.78",
69
- "@semiont/core": "0.2.33-build.78",
68
+ "@semiont/api-client": "0.2.33-build.80",
69
+ "@semiont/core": "0.2.33-build.80",
70
70
  "@testcontainers/postgresql": "^11.5.1",
71
71
  "arg": "^5.0.2",
72
72
  "bcrypt": "^5.1.1",
@@ -87,7 +87,7 @@
87
87
  "@types/express": "^4.17.17",
88
88
  "@types/ink": "^0.5.2",
89
89
  "@types/js-yaml": "^4.0.9",
90
- "@types/react": "^19.0.0",
90
+ "@types/react": "^18.3.0",
91
91
  "@types/yargs": "^17.0.0",
92
92
  "@vitest/coverage-v8": "^3.2.4",
93
93
  "chalk": "^5.3.0",