@scheduler-systems/gal-run 0.0.553 → 0.0.554

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.cjs +168 -181
  2. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -3955,160 +3955,15 @@ var cliVersion, defaultApiUrl, BUILD_CONSTANTS, constants_default;
3955
3955
  var init_constants = __esm({
3956
3956
  "module_6"() {
3957
3957
  "use strict";
3958
- cliVersion = true ? "0.0.553" : "0.0.0-dev";
3958
+ cliVersion = true ? "0.0.554" : "0.0.0-dev";
3959
3959
  defaultApiUrl = true ? "https://api.gal.run" : "http://localhost:3000";
3960
3960
  BUILD_CONSTANTS = Object.freeze([cliVersion, defaultApiUrl]);
3961
3961
  constants_default = BUILD_CONSTANTS;
3962
3962
  }
3963
3963
  });
3964
3964
 
3965
- function detectEnvironment() {
3966
- const envOverride = process.env.GAL_ENV?.toLowerCase();
3967
- if (envOverride === "test") {
3968
- return "test";
3969
- }
3970
- if (envOverride === "dev" || envOverride === "development" || envOverride === "local") {
3971
- return "dev";
3972
- }
3973
- if (envOverride === "prod" || envOverride === "production") {
3974
- return "prod";
3975
- }
3976
- if ("https://api.gal.run") {
3977
- if ("https://api.gal.run" === API_URLS.prod) {
3978
- return "prod";
3979
- }
3980
- if ("https://api.gal.run".includes("localhost")) {
3981
- return "dev";
3982
- }
3983
- }
3984
- const isRunningFromSource = process.argv[1]?.includes("tsx") || process.argv[1]?.includes("ts-node") || process.argv[1]?.endsWith(".ts") || process.env.npm_lifecycle_event === "dev" || process.env.NODE_ENV === "development";
3985
- if (isRunningFromSource) {
3986
- return "dev";
3987
- }
3988
- try {
3989
- const version2 = true ? "0.0.553" : void 0;
3990
- if (version2 && version2.includes("-local")) {
3991
- return "dev";
3992
- }
3993
- } catch {
3994
- }
3995
- return "prod";
3996
- }
3997
- var import_fs, import_os, import_path, CONFIG_DIR, CONFIG_FILE, API_URLS, ConfigManager;
3998
- var init_config_manager = __esm({
3999
- "module_7"() {
4000
- "use strict";
4001
- import_fs = require("fs");
4002
- import_os = require("os");
4003
- import_path = require("path");
4004
- CONFIG_DIR = (0, import_path.join)((0, import_os.homedir)(), ".gal");
4005
- CONFIG_FILE = (0, import_path.join)(CONFIG_DIR, "config.json");
4006
- API_URLS = {
4007
- dev: "http://localhost:3000",
4008
- prod: "https://api.gal.run",
4009
- test: "http://localhost:3333"
4010
- // Default for tests
4011
- };
4012
- ConfigManager = class {
4013
- /**
4014
- * @description Returns the detected deployment environment.
4015
- * @returns {Environment} The current environment (development, production, or test)
4016
- */
4017
- static getEnvironment() {
4018
- return detectEnvironment();
4019
- }
4020
- /**
4021
- * @description Loads CLI configuration from disk (~/.gal/config.json).
4022
- * Applies environment-aware defaults and enforces correct API URLs
4023
- * for production environment. Priority: env var > file config > default.
4024
- * @returns {CliConfig} The resolved CLI configuration
4025
- */
4026
- static load() {
4027
- const env2 = detectEnvironment();
4028
- const defaultApiUrl21 = API_URLS[env2];
4029
- const envApiUrl = process.env.GAL_API_URL;
4030
- if (!(0, import_fs.existsSync)(CONFIG_FILE)) {
4031
- return {
4032
- apiUrl: envApiUrl || defaultApiUrl21
4033
- };
4034
- }
4035
- try {
4036
- const content = (0, import_fs.readFileSync)(CONFIG_FILE, "utf-8");
4037
- const config2 = JSON.parse(content);
4038
- if (envApiUrl) {
4039
- config2.apiUrl = envApiUrl;
4040
- return config2;
4041
- }
4042
- if (!config2.apiUrl) {
4043
- config2.apiUrl = defaultApiUrl21;
4044
- }
4045
- if (env2 === "test") {
4046
- return config2;
4047
- }
4048
- if (env2 === "prod") {
4049
- const isValidUrl = config2.apiUrl === API_URLS.prod;
4050
- if (!isValidUrl) {
4051
- config2.apiUrl = defaultApiUrl21;
4052
- }
4053
- }
4054
- if (env2 === "dev") {
4055
- config2.apiUrl = defaultApiUrl21;
4056
- }
4057
- if (env2 === "dev" && config2.apiUrl.includes("localhost")) {
4058
- config2.apiUrl = defaultApiUrl21;
4059
- }
4060
- return config2;
4061
- } catch (error3) {
4062
- console.error("Error loading config:", error3);
4063
- return {
4064
- apiUrl: envApiUrl || defaultApiUrl21
4065
- };
4066
- }
4067
- }
4068
- /**
4069
- * @description Saves the given CLI configuration to disk at ~/.gal/config.json.
4070
- * Creates the configuration directory if it does not exist.
4071
- * @param {CliConfig} config - The configuration object to persist
4072
- */
4073
- static save(config2) {
4074
- if (!(0, import_fs.existsSync)(CONFIG_DIR)) {
4075
- (0, import_fs.mkdirSync)(CONFIG_DIR, { recursive: true });
4076
- }
4077
- (0, import_fs.writeFileSync)(CONFIG_FILE, JSON.stringify(config2, null, 2), "utf-8");
4078
- }
4079
- /**
4080
- * @description Updates a single configuration value and persists it to disk.
4081
- * Loads the current configuration, sets the specified key, and saves.
4082
- * @param {keyof CliConfig} key - The configuration key to update
4083
- * @param {string | boolean | number} value - The new value to set
4084
- */
4085
- static set(key, value) {
4086
- const config2 = this.load();
4087
- config2[key] = value;
4088
- this.save(config2);
4089
- }
4090
- /**
4091
- * @description Retrieves a single configuration value by key.
4092
- * @param {keyof CliConfig} key - The configuration key to retrieve
4093
- * @returns {string | boolean | number | undefined} The value for the given key, or undefined if not set
4094
- */
4095
- static get(key) {
4096
- const config2 = this.load();
4097
- return config2[key];
4098
- }
4099
- /**
4100
- * @description Returns the absolute file path to the CLI configuration file.
4101
- * @returns {string} The path to ~/.gal/config.json
4102
- */
4103
- static getConfigPath() {
4104
- return CONFIG_FILE;
4105
- }
4106
- };
4107
- }
4108
- });
4109
-
4110
3965
  var init_constants2 = __esm({
4111
- "module_8"() {
3966
+ "module_7"() {
4112
3967
  "use strict";
4113
3968
  }
4114
3969
  });
@@ -4122,7 +3977,7 @@ function scrubPII(value) {
4122
3977
  }
4123
3978
  var PII_PATTERNS, SENSITIVE_HEADERS;
4124
3979
  var init_privacy = __esm({
4125
- "module_9"() {
3980
+ "module_8"() {
4126
3981
  "use strict";
4127
3982
  PII_PATTERNS = [
4128
3983
  /[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/g,
@@ -4170,7 +4025,7 @@ var init_privacy = __esm({
4170
4025
  });
4171
4026
 
4172
4027
  var init_logger = __esm({
4173
- "module_10"() {
4028
+ "module_9"() {
4174
4029
  "use strict";
4175
4030
  init_constants2();
4176
4031
  }
@@ -4230,7 +4085,7 @@ function isGcpPermissionEvent(event) {
4230
4085
  }
4231
4086
  var GCP_PERMISSION_ERROR_PATTERNS;
4232
4087
  var init_sentry = __esm({
4233
- "module_11"() {
4088
+ "module_10"() {
4234
4089
  "use strict";
4235
4090
  init_constants2();
4236
4091
  init_privacy();
@@ -4244,7 +4099,7 @@ var init_sentry = __esm({
4244
4099
  });
4245
4100
 
4246
4101
  var init_dist = __esm({
4247
- "module_12"() {
4102
+ "module_11"() {
4248
4103
  "use strict";
4249
4104
  init_constants2();
4250
4105
  init_privacy();
@@ -4293,7 +4148,7 @@ async function flushSentry() {
4293
4148
  }
4294
4149
  var import_node_module, import_meta, initialized, sentryModule;
4295
4150
  var init_sentry2 = __esm({
4296
- "module_13"() {
4151
+ "module_12"() {
4297
4152
  "use strict";
4298
4153
  import_node_module = require("node:module");
4299
4154
  init_dist();
@@ -4317,10 +4172,10 @@ function commandExists(command) {
4317
4172
  }
4318
4173
  function readInstallMetadata() {
4319
4174
  try {
4320
- if (!(0, import_fs2.existsSync)(INSTALL_METADATA_PATH)) {
4175
+ if (!(0, import_fs.existsSync)(INSTALL_METADATA_PATH)) {
4321
4176
  return null;
4322
4177
  }
4323
- return JSON.parse((0, import_fs2.readFileSync)(INSTALL_METADATA_PATH, "utf-8"));
4178
+ return JSON.parse((0, import_fs.readFileSync)(INSTALL_METADATA_PATH, "utf-8"));
4324
4179
  } catch {
4325
4180
  return null;
4326
4181
  }
@@ -4333,7 +4188,7 @@ function normalizePath(filePath) {
4333
4188
  return filePath;
4334
4189
  }
4335
4190
  try {
4336
- return (0, import_path2.resolve)(filePath);
4191
+ return (0, import_path.resolve)(filePath);
4337
4192
  } catch {
4338
4193
  return filePath;
4339
4194
  }
@@ -4370,7 +4225,7 @@ function normalizeInstallVersion(version2) {
4370
4225
  function detectInstallMethodFromPath(execPath) {
4371
4226
  const normalized = normalizePath(execPath).replace(/\\/g, "/");
4372
4227
  const lower = normalized.toLowerCase();
4373
- const name = (0, import_path2.basename)(lower);
4228
+ const name = (0, import_path.basename)(lower);
4374
4229
  if (!normalized) {
4375
4230
  return "unknown";
4376
4231
  }
@@ -4494,15 +4349,15 @@ function describeInstallMethod(method) {
4494
4349
  return "auto-detected installer";
4495
4350
  }
4496
4351
  }
4497
- var import_child_process, import_fs2, import_os2, import_path2, INSTALL_METADATA_PATH, DEFAULT_REGISTRY_URL, WEBSITE_INSTALL_SH_URL, WEBSITE_INSTALL_PS1_URL, WINGET_PACKAGE_ID, GAL_PACKAGE_NAME, SAFE_INSTALL_VERSION_PATTERN;
4352
+ var import_child_process, import_fs, import_os, import_path, INSTALL_METADATA_PATH, DEFAULT_REGISTRY_URL, WEBSITE_INSTALL_SH_URL, WEBSITE_INSTALL_PS1_URL, WINGET_PACKAGE_ID, GAL_PACKAGE_NAME, SAFE_INSTALL_VERSION_PATTERN;
4498
4353
  var init_install = __esm({
4499
- "module_14"() {
4354
+ "module_13"() {
4500
4355
  "use strict";
4501
4356
  import_child_process = require("child_process");
4502
- import_fs2 = require("fs");
4503
- import_os2 = require("os");
4504
- import_path2 = require("path");
4505
- INSTALL_METADATA_PATH = (0, import_path2.join)((0, import_os2.homedir)(), ".gal", "install-metadata.json");
4357
+ import_fs = require("fs");
4358
+ import_os = require("os");
4359
+ import_path = require("path");
4360
+ INSTALL_METADATA_PATH = (0, import_path.join)((0, import_os.homedir)(), ".gal", "install-metadata.json");
4506
4361
  DEFAULT_REGISTRY_URL = "https://registry.npmjs.org";
4507
4362
  WEBSITE_INSTALL_SH_URL = "https://gal.run/install.sh";
4508
4363
  WEBSITE_INSTALL_PS1_URL = "https://gal.run/install.ps1";
@@ -4551,7 +4406,7 @@ function detectPathConflict(currentVersion) {
4551
4406
  }
4552
4407
  var import_child_process2;
4553
4408
  var init_path_conflict = __esm({
4554
- "module_15"() {
4409
+ "module_14"() {
4555
4410
  "use strict";
4556
4411
  import_child_process2 = require("child_process");
4557
4412
  init_source();
@@ -4604,7 +4459,7 @@ function shouldShowInteractivePrompt({
4604
4459
  }
4605
4460
  var UPDATE_NOTIFICATION_WINDOW_MS;
4606
4461
  var init_update_notification = __esm({
4607
- "module_16"() {
4462
+ "module_15"() {
4608
4463
  "use strict";
4609
4464
  UPDATE_NOTIFICATION_WINDOW_MS = 60 * 60 * 1e3;
4610
4465
  }
@@ -11827,6 +11682,151 @@ var require_dist = __commonJS({
11827
11682
  }
11828
11683
  });
11829
11684
 
11685
+ function detectEnvironment() {
11686
+ const envOverride = process.env.GAL_ENV?.toLowerCase();
11687
+ if (envOverride === "test") {
11688
+ return "test";
11689
+ }
11690
+ if (envOverride === "dev" || envOverride === "development" || envOverride === "local") {
11691
+ return "dev";
11692
+ }
11693
+ if (envOverride === "prod" || envOverride === "production") {
11694
+ return "prod";
11695
+ }
11696
+ if ("https://api.gal.run") {
11697
+ if ("https://api.gal.run" === API_URLS.prod) {
11698
+ return "prod";
11699
+ }
11700
+ if ("https://api.gal.run".includes("localhost")) {
11701
+ return "dev";
11702
+ }
11703
+ }
11704
+ const isRunningFromSource = process.argv[1]?.includes("tsx") || process.argv[1]?.includes("ts-node") || process.argv[1]?.endsWith(".ts") || process.env.npm_lifecycle_event === "dev" || process.env.NODE_ENV === "development";
11705
+ if (isRunningFromSource) {
11706
+ return "dev";
11707
+ }
11708
+ try {
11709
+ const version2 = true ? "0.0.554" : void 0;
11710
+ if (version2 && version2.includes("-local")) {
11711
+ return "dev";
11712
+ }
11713
+ } catch {
11714
+ }
11715
+ return "prod";
11716
+ }
11717
+ var import_fs2, import_os2, import_path2, CONFIG_DIR, CONFIG_FILE, API_URLS, ConfigManager;
11718
+ var init_config_manager = __esm({
11719
+ "module_16"() {
11720
+ "use strict";
11721
+ import_fs2 = require("fs");
11722
+ import_os2 = require("os");
11723
+ import_path2 = require("path");
11724
+ CONFIG_DIR = (0, import_path2.join)((0, import_os2.homedir)(), ".gal");
11725
+ CONFIG_FILE = (0, import_path2.join)(CONFIG_DIR, "config.json");
11726
+ API_URLS = {
11727
+ dev: "http://localhost:3000",
11728
+ prod: "https://api.gal.run",
11729
+ test: "http://localhost:3333"
11730
+ // Default for tests
11731
+ };
11732
+ ConfigManager = class {
11733
+ /**
11734
+ * @description Returns the detected deployment environment.
11735
+ * @returns {Environment} The current environment (development, production, or test)
11736
+ */
11737
+ static getEnvironment() {
11738
+ return detectEnvironment();
11739
+ }
11740
+ /**
11741
+ * @description Loads CLI configuration from disk (~/.gal/config.json).
11742
+ * Applies environment-aware defaults and enforces correct API URLs
11743
+ * for production environment. Priority: env var > file config > default.
11744
+ * @returns {CliConfig} The resolved CLI configuration
11745
+ */
11746
+ static load() {
11747
+ const env2 = detectEnvironment();
11748
+ const defaultApiUrl21 = API_URLS[env2];
11749
+ const envApiUrl = process.env.GAL_API_URL;
11750
+ if (!(0, import_fs2.existsSync)(CONFIG_FILE)) {
11751
+ return {
11752
+ apiUrl: envApiUrl || defaultApiUrl21
11753
+ };
11754
+ }
11755
+ try {
11756
+ const content = (0, import_fs2.readFileSync)(CONFIG_FILE, "utf-8");
11757
+ const config2 = JSON.parse(content);
11758
+ if (envApiUrl) {
11759
+ config2.apiUrl = envApiUrl;
11760
+ return config2;
11761
+ }
11762
+ if (!config2.apiUrl) {
11763
+ config2.apiUrl = defaultApiUrl21;
11764
+ }
11765
+ if (env2 === "test") {
11766
+ return config2;
11767
+ }
11768
+ if (env2 === "prod") {
11769
+ const isValidUrl = config2.apiUrl === API_URLS.prod;
11770
+ if (!isValidUrl) {
11771
+ config2.apiUrl = defaultApiUrl21;
11772
+ }
11773
+ }
11774
+ if (env2 === "dev") {
11775
+ config2.apiUrl = defaultApiUrl21;
11776
+ }
11777
+ if (env2 === "dev" && config2.apiUrl.includes("localhost")) {
11778
+ config2.apiUrl = defaultApiUrl21;
11779
+ }
11780
+ return config2;
11781
+ } catch (error3) {
11782
+ console.error("Error loading config:", error3);
11783
+ return {
11784
+ apiUrl: envApiUrl || defaultApiUrl21
11785
+ };
11786
+ }
11787
+ }
11788
+ /**
11789
+ * @description Saves the given CLI configuration to disk at ~/.gal/config.json.
11790
+ * Creates the configuration directory if it does not exist.
11791
+ * @param {CliConfig} config - The configuration object to persist
11792
+ */
11793
+ static save(config2) {
11794
+ if (!(0, import_fs2.existsSync)(CONFIG_DIR)) {
11795
+ (0, import_fs2.mkdirSync)(CONFIG_DIR, { recursive: true });
11796
+ }
11797
+ (0, import_fs2.writeFileSync)(CONFIG_FILE, JSON.stringify(config2, null, 2), "utf-8");
11798
+ }
11799
+ /**
11800
+ * @description Updates a single configuration value and persists it to disk.
11801
+ * Loads the current configuration, sets the specified key, and saves.
11802
+ * @param {keyof CliConfig} key - The configuration key to update
11803
+ * @param {string | boolean | number} value - The new value to set
11804
+ */
11805
+ static set(key, value) {
11806
+ const config2 = this.load();
11807
+ config2[key] = value;
11808
+ this.save(config2);
11809
+ }
11810
+ /**
11811
+ * @description Retrieves a single configuration value by key.
11812
+ * @param {keyof CliConfig} key - The configuration key to retrieve
11813
+ * @returns {string | boolean | number | undefined} The value for the given key, or undefined if not set
11814
+ */
11815
+ static get(key) {
11816
+ const config2 = this.load();
11817
+ return config2[key];
11818
+ }
11819
+ /**
11820
+ * @description Returns the absolute file path to the CLI configuration file.
11821
+ * @returns {string} The path to ~/.gal/config.json
11822
+ */
11823
+ static getConfigPath() {
11824
+ return CONFIG_FILE;
11825
+ }
11826
+ };
11827
+ }
11828
+ });
11829
+
11830
11830
  function isAgentInstalled(agent) {
11831
11831
  try {
11832
11832
  switch (agent) {
@@ -14386,7 +14386,7 @@ function getId() {
14386
14386
  }
14387
14387
  function getCliVersion() {
14388
14388
  try {
14389
- return true ? "0.0.553" : "0.0.0-dev";
14389
+ return true ? "0.0.554" : "0.0.0-dev";
14390
14390
  } catch {
14391
14391
  return "0.0.0-dev";
14392
14392
  }
@@ -80232,16 +80232,6 @@ function getRequestedCommand(argv) {
80232
80232
  }
80233
80233
  return null;
80234
80234
  }
80235
- function shouldAllowAuthenticatedCodeLaunch(argv) {
80236
- if (getRequestedCommand(argv) !== "code") {
80237
- return false;
80238
- }
80239
- try {
80240
- return Boolean(ConfigManager.load().authToken);
80241
- } catch {
80242
- return false;
80243
- }
80244
- }
80245
80235
  var import_dotenv, import_https2, import_readline6, import_child_process17, import_fs50, import_path50, import_os32, originalEmit, GLOBAL_TIMEOUT_MS, globalTimeout, cliVersion10, UPDATE_CACHE_DIR, UPDATE_CACHE_FILE, ONE_DAY, REGISTRY_URL2, REGISTRY_HOST, sessionStartTime, isReadOnlyStatusCommand, isMachineMode, exitHooksRan, featureFlags, knownCommands, isKnownCommand, program2, allInternalFlags;
80246
80236
  var init_index = __esm({
80247
80237
  "module_434"() {
@@ -80256,7 +80246,6 @@ var init_index = __esm({
80256
80246
  import_os32 = require("os");
80257
80247
  init_source();
80258
80248
  init_constants();
80259
- init_config_manager();
80260
80249
  init_sentry2();
80261
80250
  init_path_conflict();
80262
80251
  init_install();
@@ -80347,8 +80336,7 @@ var init_index = __esm({
80347
80336
  });
80348
80337
  COMMAND_FACTORIES.forEach(({ name: commandName, create: commandFactory }) => {
80349
80338
  const cmd = commandFactory();
80350
- const allowAuthenticatedCodeLaunch = commandName === "code" && shouldAllowAuthenticatedCodeLaunch(process.argv);
80351
- if (!isCommandVisible(commandName, featureFlags) && !allowAuthenticatedCodeLaunch) {
80339
+ if (!isCommandVisible(commandName, featureFlags)) {
80352
80340
  cmd.configureHelp({
80353
80341
  visibleCommands: () => []
80354
80342
  });
@@ -80427,8 +80415,7 @@ var init_index = __esm({
80427
80415
  await checkForUpdates();
80428
80416
  await checkAndAutoUpgradeOrgConfig();
80429
80417
  const requestedCommand = getRequestedCommand(process.argv);
80430
- const allowAuthenticatedCodeLaunch = shouldAllowAuthenticatedCodeLaunch(process.argv);
80431
- if (requestedCommand && isKnownCommand(requestedCommand) && !isCommandVisible(requestedCommand, featureFlags) && !(requestedCommand === "code" && allowAuthenticatedCodeLaunch)) {
80418
+ if (requestedCommand && isKnownCommand(requestedCommand) && !isCommandVisible(requestedCommand, featureFlags)) {
80432
80419
  console.error(
80433
80420
  source_default.red(
80434
80421
  "\n" + getHiddenCommandError(requestedCommand, featureFlags)
@@ -80445,7 +80432,7 @@ var init_index = __esm({
80445
80432
  }
80446
80433
  });
80447
80434
 
80448
- var cliVersion11 = true ? "0.0.553" : "0.0.0-dev";
80435
+ var cliVersion11 = true ? "0.0.554" : "0.0.0-dev";
80449
80436
  var args = process.argv.slice(2);
80450
80437
  var requestedGlobalHelp = args.length === 1 && (args[0] === "--help" || args[0] === "-h");
80451
80438
  var requestedVersion = args.length === 1 && (args[0] === "--version" || args[0] === "-V");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scheduler-systems/gal-run",
3
- "version": "0.0.553",
3
+ "version": "0.0.554",
4
4
  "description": "GAL CLI - Command-line tool for managing AI agent configurations across your organization",
5
5
  "license": "Elastic-2.0",
6
6
  "private": false,