@scheduler-systems/gal-run 0.0.287 → 0.0.288

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 +206 -119
  2. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -3970,7 +3970,7 @@ var cliVersion, defaultApiUrl, BUILD_CONSTANTS, constants_default;
3970
3970
  var init_constants = __esm({
3971
3971
  "src/constants.ts"() {
3972
3972
  "use strict";
3973
- cliVersion = true ? "0.0.287" : "0.0.0-dev";
3973
+ cliVersion = true ? "0.0.288" : "0.0.0-dev";
3974
3974
  defaultApiUrl = true ? "https://api.gal.run" : "http://localhost:3000";
3975
3975
  BUILD_CONSTANTS = Object.freeze([cliVersion, defaultApiUrl]);
3976
3976
  constants_default = BUILD_CONSTANTS;
@@ -4129,12 +4129,27 @@ var init_dist = __esm({
4129
4129
  });
4130
4130
 
4131
4131
  // src/telemetry/sentry.ts
4132
+ function loadSentry() {
4133
+ if (sentryModule !== void 0) {
4134
+ return sentryModule;
4135
+ }
4136
+ try {
4137
+ const runtimeRequire = (0, import_node_module.createRequire)(import_meta.url);
4138
+ sentryModule = runtimeRequire("@sentry/node");
4139
+ } catch {
4140
+ sentryModule = null;
4141
+ }
4142
+ return sentryModule;
4143
+ }
4132
4144
  function initSentry(version) {
4133
4145
  if (initialized) return;
4134
- if (process.env.GAL_TELEMETRY_DISABLED === "1" || process.env.DO_NOT_TRACK === "1")
4146
+ if (process.env.GAL_TELEMETRY_DISABLED === "1" || process.env.DO_NOT_TRACK === "1") {
4135
4147
  return;
4148
+ }
4136
4149
  const dsn = process.env.SENTRY_DSN || "";
4137
4150
  if (!dsn) return;
4151
+ const Sentry = loadSentry();
4152
+ if (!Sentry) return;
4138
4153
  Sentry.init({
4139
4154
  dsn,
4140
4155
  environment: "cli",
@@ -4144,20 +4159,21 @@ function initSentry(version) {
4144
4159
  });
4145
4160
  initialized = true;
4146
4161
  }
4147
- function captureException2(error2) {
4162
+ function captureException(error2) {
4148
4163
  if (!initialized) return;
4149
- Sentry.captureException(error2);
4164
+ loadSentry()?.captureException(error2);
4150
4165
  }
4151
4166
  async function flushSentry() {
4152
4167
  if (!initialized) return;
4153
- await Sentry.flush(2e3);
4168
+ await loadSentry()?.flush(2e3);
4154
4169
  }
4155
- var Sentry, initialized;
4170
+ var import_node_module, import_meta, initialized, sentryModule;
4156
4171
  var init_sentry2 = __esm({
4157
4172
  "src/telemetry/sentry.ts"() {
4158
4173
  "use strict";
4159
- Sentry = __toESM(require("@sentry/node"), 1);
4174
+ import_node_module = require("node:module");
4160
4175
  init_dist();
4176
+ import_meta = {};
4161
4177
  initialized = false;
4162
4178
  }
4163
4179
  });
@@ -4812,7 +4828,7 @@ function detectEnvironment() {
4812
4828
  return "dev";
4813
4829
  }
4814
4830
  try {
4815
- const version = true ? "0.0.287" : void 0;
4831
+ const version = true ? "0.0.288" : void 0;
4816
4832
  if (version && version.includes("-local")) {
4817
4833
  return "dev";
4818
4834
  }
@@ -5181,7 +5197,7 @@ function getId() {
5181
5197
  }
5182
5198
  function getCliVersion() {
5183
5199
  try {
5184
- return true ? "0.0.287" : "0.0.0-dev";
5200
+ return true ? "0.0.288" : "0.0.0-dev";
5185
5201
  } catch {
5186
5202
  return "0.0.0-dev";
5187
5203
  }
@@ -6377,7 +6393,7 @@ function showFirstRunNotice() {
6377
6393
  console.log(` ${dim2("Get started locally \u2014 no account required:")}`);
6378
6394
  console.log("");
6379
6395
  console.log(` ${cyan2("gal scan")} ${dim2("Discover AI agent configs on this machine")}`);
6380
- console.log(` ${cyan2("gal approve")} ${dim2("Standardize into a single .gal/config.yaml")}`);
6396
+ console.log(` ${cyan2("gal approve")} ${dim2("Standardize into a single ~/.gal/config.yaml")}`);
6381
6397
  console.log(` ${cyan2("gal sync")} ${dim2("Distribute to all your coding agents at once")}`);
6382
6398
  console.log("");
6383
6399
  console.log(` ${dim2("Connect your org for team governance:")}`);
@@ -7593,8 +7609,8 @@ function getFeatureFlags() {
7593
7609
  try {
7594
7610
  const { readFileSync: readFileSync38, existsSync: existsSync42 } = require("fs");
7595
7611
  const { join: join46 } = require("path");
7596
- const { homedir: homedir23 } = require("os");
7597
- const configPath = join46(homedir23(), ".gal", "config.json");
7612
+ const { homedir: homedir25 } = require("os");
7613
+ const configPath = join46(homedir25(), ".gal", "config.json");
7598
7614
  if (existsSync42(configPath)) {
7599
7615
  const config = JSON.parse(readFileSync38(configPath, "utf-8"));
7600
7616
  const cacheAge = Date.now() - (config.flagsCachedAt || config.internalOrgsCheckedAt || 0);
@@ -16342,7 +16358,7 @@ var require_sonic_boom = __commonJS({
16342
16358
  } else if (contentMode === void 0 || contentMode === kContentModeUtf8) {
16343
16359
  this._writingBuf = "";
16344
16360
  this.write = write;
16345
- this.flush = flush2;
16361
+ this.flush = flush;
16346
16362
  this.flushSync = flushSync;
16347
16363
  this._actualWrite = actualWrite;
16348
16364
  fsWriteSync = () => fs8.writeSync(this.fd, this._writingBuf, "utf8");
@@ -16535,7 +16551,7 @@ var require_sonic_boom = __commonJS({
16535
16551
  this.once("drain", onDrain);
16536
16552
  this.once("error", onError);
16537
16553
  }
16538
- function flush2(cb) {
16554
+ function flush(cb) {
16539
16555
  if (cb != null && typeof cb !== "function") {
16540
16556
  throw new Error("flush cb must be a function");
16541
16557
  }
@@ -17452,7 +17468,7 @@ var require_thread_stream = __commonJS({
17452
17468
  var require_transport = __commonJS({
17453
17469
  "../../node_modules/.pnpm/pino@9.14.0/node_modules/pino/lib/transport.js"(exports2, module2) {
17454
17470
  "use strict";
17455
- var { createRequire } = require("module");
17471
+ var { createRequire: createRequire3 } = require("module");
17456
17472
  var getCallers = require_caller();
17457
17473
  var { join: join46, isAbsolute, sep } = require("node:path");
17458
17474
  var sleep2 = require_atomic_sleep();
@@ -17460,7 +17476,7 @@ var require_transport = __commonJS({
17460
17476
  var ThreadStream = require_thread_stream();
17461
17477
  function setupOnExit(stream) {
17462
17478
  onExit2.register(stream, autoEnd);
17463
- onExit2.registerBeforeExit(stream, flush2);
17479
+ onExit2.registerBeforeExit(stream, flush);
17464
17480
  stream.on("close", function() {
17465
17481
  onExit2.unregister(stream);
17466
17482
  });
@@ -17502,7 +17518,7 @@ var require_transport = __commonJS({
17502
17518
  stream.unref();
17503
17519
  });
17504
17520
  }
17505
- function flush2(stream) {
17521
+ function flush(stream) {
17506
17522
  stream.flushSync();
17507
17523
  }
17508
17524
  function transport(fullOptions) {
@@ -17563,7 +17579,7 @@ var require_transport = __commonJS({
17563
17579
  for (const filePath of callers) {
17564
17580
  try {
17565
17581
  const context = filePath === "node:repl" ? process.cwd() + sep : filePath;
17566
- fixTarget2 = createRequire(context).resolve(origin);
17582
+ fixTarget2 = createRequire3(context).resolve(origin);
17567
17583
  break;
17568
17584
  } catch (err) {
17569
17585
  continue;
@@ -18198,7 +18214,7 @@ var require_proto = __commonJS({
18198
18214
  child,
18199
18215
  bindings,
18200
18216
  setBindings,
18201
- flush: flush2,
18217
+ flush,
18202
18218
  isLevelEnabled,
18203
18219
  version,
18204
18220
  get level() {
@@ -18358,7 +18374,7 @@ var require_proto = __commonJS({
18358
18374
  }
18359
18375
  stream.write(streamWriteHook ? streamWriteHook(s) : s);
18360
18376
  }
18361
- function flush2(cb) {
18377
+ function flush(cb) {
18362
18378
  if (cb != null && typeof cb !== "function") {
18363
18379
  throw Error("callback must be a function");
18364
18380
  }
@@ -28743,13 +28759,14 @@ var require_dist = __commonJS({
28743
28759
  });
28744
28760
 
28745
28761
  // src/services/gal-config-service.ts
28746
- var import_fs12, import_path11, import_crypto3, import_yaml, PLATFORM_DIRS, PLATFORM_INSTRUCTION_FILES, GalConfigService;
28762
+ var import_fs12, import_path11, import_crypto3, import_os13, import_yaml, PLATFORM_DIRS, PLATFORM_INSTRUCTION_FILES, GalConfigService;
28747
28763
  var init_gal_config_service = __esm({
28748
28764
  "src/services/gal-config-service.ts"() {
28749
28765
  "use strict";
28750
28766
  import_fs12 = require("fs");
28751
28767
  import_path11 = require("path");
28752
28768
  import_crypto3 = require("crypto");
28769
+ import_os13 = require("os");
28753
28770
  import_yaml = __toESM(require_dist(), 1);
28754
28771
  init_dist2();
28755
28772
  PLATFORM_DIRS = { ...PLATFORM_DIRECTORY_MAP };
@@ -28763,12 +28780,43 @@ var init_gal_config_service = __esm({
28763
28780
  antigravity: "GEMINI.md",
28764
28781
  amp: "AGENTS.md"
28765
28782
  };
28766
- GalConfigService = class {
28783
+ GalConfigService = class _GalConfigService {
28767
28784
  projectRoot;
28768
28785
  galDir;
28769
- constructor(projectRoot) {
28786
+ scope;
28787
+ constructor(projectRoot, options) {
28770
28788
  this.projectRoot = projectRoot;
28771
- this.galDir = (0, import_path11.join)(projectRoot, ".gal");
28789
+ this.scope = options?.scope ?? "project";
28790
+ this.galDir = options?.galDir ?? (this.scope === "workspace" ? (0, import_path11.join)((0, import_os13.homedir)(), ".gal") : (0, import_path11.join)(projectRoot, ".gal"));
28791
+ }
28792
+ /**
28793
+ * Create a project-scoped service rooted at <project>/.gal
28794
+ */
28795
+ static forProject(projectRoot) {
28796
+ return new _GalConfigService(projectRoot);
28797
+ }
28798
+ /**
28799
+ * Create a workspace-scoped service rooted at ~/.gal
28800
+ */
28801
+ static forWorkspace(projectRoot) {
28802
+ return new _GalConfigService(projectRoot, { scope: "workspace" });
28803
+ }
28804
+ /**
28805
+ * Resolve the active local config source with project overrides taking precedence
28806
+ * over workspace defaults.
28807
+ */
28808
+ static resolveLocalConfig(projectRoot) {
28809
+ const projectService = _GalConfigService.forProject(projectRoot);
28810
+ const projectConfig = projectService.readConfig();
28811
+ if (projectConfig) {
28812
+ return { service: projectService, config: projectConfig, scope: "project" };
28813
+ }
28814
+ const workspaceService = _GalConfigService.forWorkspace(projectRoot);
28815
+ const workspaceConfig = workspaceService.readConfig();
28816
+ if (workspaceConfig) {
28817
+ return { service: workspaceService, config: workspaceConfig, scope: "workspace" };
28818
+ }
28819
+ return { service: null, config: null, scope: null };
28772
28820
  }
28773
28821
  /**
28774
28822
  * Get path to .gal directory
@@ -28782,6 +28830,12 @@ var init_gal_config_service = __esm({
28782
28830
  getConfigPath() {
28783
28831
  return (0, import_path11.join)(this.galDir, "config.yaml");
28784
28832
  }
28833
+ /**
28834
+ * Human-friendly path label for logs/help text
28835
+ */
28836
+ getConfigDisplayPath() {
28837
+ return this.scope === "workspace" ? "~/.gal/config.yaml" : ".gal/config.yaml";
28838
+ }
28785
28839
  /**
28786
28840
  * Get path to sync-state.json
28787
28841
  */
@@ -29726,7 +29780,7 @@ function incrementVersion(version) {
29726
29780
  return version;
29727
29781
  }
29728
29782
  function createApproveCommand() {
29729
- const approve = new Command("approve").description("Upload local configs to org approved config").option("-o, --org <name>", "Organization name (default: from config)").option("-p, --platform <platform>", "Platform to approve for", "claude").option("-d, --dir <path>", "Directory to read configs from", process.cwd()).option("--dry-run", "Preview what would be uploaded without making changes").option("--commands-only", "Only approve commands (no agents, instructions, settings)").option("--agents-only", "Only approve agents (no commands, instructions, settings)").option("--clear", "Clear entire approved config for the platform").option("--remove <names...>", "Remove specific commands/agents by name (comma-separated)").option("--local", "Save to .gal/config.yaml locally (no auth required, no API upload)").option("--from-discovered", "Approve configs sourced from the discovered repositories pool").option("--type <type>", "Filter discovered configs by type: command, agent, skill, rule").option("--repo <repo>", "Filter discovered configs to a specific repository").option("--diff", "Show a unified diff before approving").action(async (options) => {
29783
+ const approve = new Command("approve").description("Upload local configs to org approved config").option("-o, --org <name>", "Organization name (default: from config)").option("-p, --platform <platform>", "Platform to approve for", "claude").option("-d, --dir <path>", "Directory to read configs from", process.cwd()).option("--dry-run", "Preview what would be uploaded without making changes").option("--commands-only", "Only approve commands (no agents, instructions, settings)").option("--agents-only", "Only approve agents (no commands, instructions, settings)").option("--clear", "Clear entire approved config for the platform").option("--remove <names...>", "Remove specific commands/agents by name (comma-separated)").option("--local", "Save to ~/.gal/config.yaml locally (no auth required, no API upload)").option("--from-discovered", "Approve configs sourced from the discovered repositories pool").option("--type <type>", "Filter discovered configs by type: command, agent, skill, rule").option("--repo <repo>", "Filter discovered configs to a specific repository").option("--diff", "Show a unified diff before approving").action(async (options) => {
29730
29784
  if (options.commandsOnly && options.agentsOnly) {
29731
29785
  console.error(source_default.red("\nError: --commands-only and --agents-only are mutually exclusive."));
29732
29786
  console.log(source_default.dim("Use one or the other, or neither to approve all configs.\n"));
@@ -29833,7 +29887,7 @@ Discovered configs to approve (${orgName2}):
29833
29887
  console.log();
29834
29888
  return;
29835
29889
  }
29836
- const service = new GalConfigService(baseDir2);
29890
+ const service = GalConfigService.forWorkspace(baseDir2);
29837
29891
  const existing = service.readConfig();
29838
29892
  const galConfig = {
29839
29893
  version: 1,
@@ -29862,10 +29916,10 @@ Discovered configs to approve (${orgName2}):
29862
29916
  // Preserve existing memories
29863
29917
  };
29864
29918
  service.writeConfig(galConfig);
29865
- console.log(source_default.green(` Saved to .gal/config.yaml (v${galConfig.configVersion})`));
29919
+ console.log(source_default.green(` Saved to ${service.getConfigDisplayPath()} (v${galConfig.configVersion})`));
29866
29920
  console.log();
29867
29921
  console.log(source_default.dim(" Next steps:"));
29868
- console.log(source_default.dim(" gal sync --check Validate configs before distributing"));
29922
+ console.log(source_default.dim(" gal sync --check Validate local config before distributing"));
29869
29923
  console.log(source_default.dim(" gal sync Distribute to all coding agents"));
29870
29924
  console.log();
29871
29925
  return;
@@ -30850,7 +30904,7 @@ function isAgentInstalled(agent) {
30850
30904
  (0, import_child_process5.execSync)("which antigravity", { stdio: "ignore" });
30851
30905
  return true;
30852
30906
  } catch {
30853
- return (0, import_fs15.existsSync)((0, import_path14.join)((0, import_os13.homedir)(), ".antigravity"));
30907
+ return (0, import_fs15.existsSync)((0, import_path14.join)((0, import_os14.homedir)(), ".antigravity"));
30854
30908
  }
30855
30909
  case "codex":
30856
30910
  (0, import_child_process5.execSync)("which codex", { stdio: "ignore" });
@@ -30866,7 +30920,7 @@ function isAgentInstalled(agent) {
30866
30920
  }
30867
30921
  }
30868
30922
  function installCursorHooks() {
30869
- const cursorDir = (0, import_path14.join)((0, import_os13.homedir)(), ".cursor");
30923
+ const cursorDir = (0, import_path14.join)((0, import_os14.homedir)(), ".cursor");
30870
30924
  const hooksPath = (0, import_path14.join)(cursorDir, "hooks.json");
30871
30925
  try {
30872
30926
  if (!(0, import_fs15.existsSync)(cursorDir)) {
@@ -30919,7 +30973,7 @@ function installCursorHooks() {
30919
30973
  }
30920
30974
  }
30921
30975
  function installWindsurfHooks() {
30922
- const windsurfDir = (0, import_path14.join)((0, import_os13.homedir)(), ".windsurf");
30976
+ const windsurfDir = (0, import_path14.join)((0, import_os14.homedir)(), ".windsurf");
30923
30977
  const hooksPath = (0, import_path14.join)(windsurfDir, "hooks.json");
30924
30978
  try {
30925
30979
  if (!(0, import_fs15.existsSync)(windsurfDir)) {
@@ -30972,7 +31026,7 @@ function installWindsurfHooks() {
30972
31026
  }
30973
31027
  }
30974
31028
  function installGeminiHooks() {
30975
- const geminiHooksDir = (0, import_path14.join)((0, import_os13.homedir)(), ".gemini", "hooks");
31029
+ const geminiHooksDir = (0, import_path14.join)((0, import_os14.homedir)(), ".gemini", "hooks");
30976
31030
  const hookPath = (0, import_path14.join)(geminiHooksDir, "gal-sync.sh");
30977
31031
  try {
30978
31032
  if (!(0, import_fs15.existsSync)(geminiHooksDir)) {
@@ -31509,7 +31563,7 @@ function uninstallHooks() {
31509
31563
  errors.push(`Failed to remove rules file: ${error2 instanceof Error ? error2.message : String(error2)}`);
31510
31564
  }
31511
31565
  try {
31512
- const cursorHooksPath = (0, import_path14.join)((0, import_os13.homedir)(), ".cursor", "hooks.json");
31566
+ const cursorHooksPath = (0, import_path14.join)((0, import_os14.homedir)(), ".cursor", "hooks.json");
31513
31567
  if ((0, import_fs15.existsSync)(cursorHooksPath)) {
31514
31568
  const content = (0, import_fs15.readFileSync)(cursorHooksPath, "utf-8");
31515
31569
  const hooks = JSON.parse(content);
@@ -31528,7 +31582,7 @@ function uninstallHooks() {
31528
31582
  errors.push(`Failed to remove Cursor hooks: ${error2 instanceof Error ? error2.message : String(error2)}`);
31529
31583
  }
31530
31584
  try {
31531
- const windsurfHooksPath = (0, import_path14.join)((0, import_os13.homedir)(), ".windsurf", "hooks.json");
31585
+ const windsurfHooksPath = (0, import_path14.join)((0, import_os14.homedir)(), ".windsurf", "hooks.json");
31532
31586
  if ((0, import_fs15.existsSync)(windsurfHooksPath)) {
31533
31587
  const content = (0, import_fs15.readFileSync)(windsurfHooksPath, "utf-8");
31534
31588
  const hooks = JSON.parse(content);
@@ -31547,7 +31601,7 @@ function uninstallHooks() {
31547
31601
  errors.push(`Failed to remove Windsurf hooks: ${error2 instanceof Error ? error2.message : String(error2)}`);
31548
31602
  }
31549
31603
  try {
31550
- const geminiHookPath = (0, import_path14.join)((0, import_os13.homedir)(), ".gemini", "hooks", "gal-sync.sh");
31604
+ const geminiHookPath = (0, import_path14.join)((0, import_os14.homedir)(), ".gemini", "hooks", "gal-sync.sh");
31551
31605
  if ((0, import_fs15.existsSync)(geminiHookPath)) {
31552
31606
  (0, import_fs15.unlinkSync)(geminiHookPath);
31553
31607
  hookRemoved = true;
@@ -31646,7 +31700,7 @@ function createHooksCommand() {
31646
31700
  const rulesFile = getRulesFileStatus();
31647
31701
  const multiPlatformStatus = [];
31648
31702
  const cursorDetected = isAgentInstalled("cursor");
31649
- const cursorHooksPath = (0, import_path14.join)((0, import_os13.homedir)(), ".cursor", "hooks.json");
31703
+ const cursorHooksPath = (0, import_path14.join)((0, import_os14.homedir)(), ".cursor", "hooks.json");
31650
31704
  let cursorInstalled = false;
31651
31705
  if (cursorDetected && (0, import_fs15.existsSync)(cursorHooksPath)) {
31652
31706
  try {
@@ -31660,7 +31714,7 @@ function createHooksCommand() {
31660
31714
  multiPlatformStatus.push({ agent: "Cursor", detected: true, installed: cursorInstalled, pending: false, path: cursorHooksPath });
31661
31715
  }
31662
31716
  const windsurfDetected = isAgentInstalled("windsurf");
31663
- const windsurfHooksPath = (0, import_path14.join)((0, import_os13.homedir)(), ".windsurf", "hooks.json");
31717
+ const windsurfHooksPath = (0, import_path14.join)((0, import_os14.homedir)(), ".windsurf", "hooks.json");
31664
31718
  let windsurfInstalled = false;
31665
31719
  if (windsurfDetected && (0, import_fs15.existsSync)(windsurfHooksPath)) {
31666
31720
  try {
@@ -31674,7 +31728,7 @@ function createHooksCommand() {
31674
31728
  multiPlatformStatus.push({ agent: "Windsurf", detected: true, installed: windsurfInstalled, pending: false, path: windsurfHooksPath });
31675
31729
  }
31676
31730
  const geminiDetected = isAgentInstalled("gemini");
31677
- const geminiHookPath = (0, import_path14.join)((0, import_os13.homedir)(), ".gemini", "hooks", "gal-sync.sh");
31731
+ const geminiHookPath = (0, import_path14.join)((0, import_os14.homedir)(), ".gemini", "hooks", "gal-sync.sh");
31678
31732
  const geminiInstalled = geminiDetected && (0, import_fs15.existsSync)(geminiHookPath);
31679
31733
  if (geminiDetected) {
31680
31734
  multiPlatformStatus.push({ agent: "Gemini", detected: true, installed: geminiInstalled, pending: false, path: geminiHookPath });
@@ -31862,7 +31916,7 @@ fi
31862
31916
  });
31863
31917
  return command;
31864
31918
  }
31865
- var import_fs15, import_path14, import_os13, import_child_process5, CLAUDE_DIR, HOOKS_DIR, SETTINGS_PATH, RULES_DIR, cliVersion3, HOOK_FILENAME, HOOK_PATH, RULES_PATH, HOOK_VERSION, RULES_VERSION;
31919
+ var import_fs15, import_path14, import_os14, import_child_process5, CLAUDE_DIR, HOOKS_DIR, SETTINGS_PATH, RULES_DIR, cliVersion3, HOOK_FILENAME, HOOK_PATH, RULES_PATH, HOOK_VERSION, RULES_VERSION;
31866
31920
  var init_hooks = __esm({
31867
31921
  "src/commands/hooks.ts"() {
31868
31922
  "use strict";
@@ -31870,10 +31924,10 @@ var init_hooks = __esm({
31870
31924
  init_source();
31871
31925
  import_fs15 = require("fs");
31872
31926
  import_path14 = require("path");
31873
- import_os13 = require("os");
31927
+ import_os14 = require("os");
31874
31928
  import_child_process5 = require("child_process");
31875
31929
  init_constants();
31876
- CLAUDE_DIR = (0, import_path14.join)((0, import_os13.homedir)(), ".claude");
31930
+ CLAUDE_DIR = (0, import_path14.join)((0, import_os14.homedir)(), ".claude");
31877
31931
  HOOKS_DIR = (0, import_path14.join)(CLAUDE_DIR, "hooks");
31878
31932
  SETTINGS_PATH = (0, import_path14.join)(CLAUDE_DIR, "settings.json");
31879
31933
  RULES_DIR = (0, import_path14.join)(CLAUDE_DIR, "rules");
@@ -32270,7 +32324,7 @@ function hashContent(content) {
32270
32324
  return (0, import_crypto5.createHash)("sha256").update(content).digest("hex").substring(0, 16);
32271
32325
  }
32272
32326
  function getUserSettingsPath() {
32273
- return (0, import_path17.join)((0, import_os14.homedir)(), ".claude", "settings.json");
32327
+ return (0, import_path17.join)((0, import_os15.homedir)(), ".claude", "settings.json");
32274
32328
  }
32275
32329
  function readLocalSettings(settingsPath) {
32276
32330
  if (!(0, import_fs18.existsSync)(settingsPath)) return null;
@@ -32368,13 +32422,13 @@ async function runSessionDriftCheck(projectRoot) {
32368
32422
  return null;
32369
32423
  }
32370
32424
  }
32371
- var import_fs18, import_path17, import_os14, import_crypto5;
32425
+ var import_fs18, import_path17, import_os15, import_crypto5;
32372
32426
  var init_drift_check = __esm({
32373
32427
  "src/utils/drift-check.ts"() {
32374
32428
  "use strict";
32375
32429
  import_fs18 = require("fs");
32376
32430
  import_path17 = require("path");
32377
- import_os14 = require("os");
32431
+ import_os15 = require("os");
32378
32432
  import_crypto5 = require("crypto");
32379
32433
  init_source();
32380
32434
  init_config_manager();
@@ -32848,17 +32902,19 @@ function createSyncCommand() {
32848
32902
  }
32849
32903
  const config = ConfigManager.load();
32850
32904
  if (!config.authToken && !config.apiKey && options.check) {
32851
- const galConfigService = new GalConfigService(directory);
32852
- const galConfig = galConfigService.readConfig();
32905
+ const resolvedLocalConfig = GalConfigService.resolveLocalConfig(directory);
32906
+ const galConfigService = resolvedLocalConfig.service;
32907
+ const galConfig = resolvedLocalConfig.config;
32908
+ const configPathLabel = galConfigService?.getConfigDisplayPath() ?? ".gal/config.yaml or ~/.gal/config.yaml";
32853
32909
  console.log();
32854
- console.log(source_default.bold(" Validating .gal/config.yaml"));
32910
+ console.log(source_default.bold(` Validating ${configPathLabel}`));
32855
32911
  console.log();
32856
- if (!galConfig) {
32857
- console.log(source_default.red(" \u2717 No .gal/config.yaml found"));
32912
+ if (!galConfig || !galConfigService) {
32913
+ console.log(source_default.red(" \u2717 No local GAL config found"));
32858
32914
  console.log();
32859
32915
  console.log(source_default.dim(" Run the local setup flow first:"));
32860
32916
  console.log(source_default.dim(" gal scan Discover your AI agent configs"));
32861
- console.log(source_default.dim(" gal approve --local Standardize into .gal/config.yaml"));
32917
+ console.log(source_default.dim(" gal approve --local Standardize into ~/.gal/config.yaml"));
32862
32918
  console.log();
32863
32919
  process.exit(1);
32864
32920
  }
@@ -32898,15 +32954,17 @@ function createSyncCommand() {
32898
32954
  process.exit(0);
32899
32955
  }
32900
32956
  if (!config.authToken && !config.apiKey && !options.pull && !options.check) {
32901
- const galConfigService = new GalConfigService(directory);
32902
- const galConfig = galConfigService.readConfig();
32903
- if (!galConfig) {
32957
+ const resolvedLocalConfig = GalConfigService.resolveLocalConfig(directory);
32958
+ const galConfigService = resolvedLocalConfig.service;
32959
+ const galConfig = resolvedLocalConfig.config;
32960
+ const configPathLabel = galConfigService?.getConfigDisplayPath() ?? ".gal/config.yaml or ~/.gal/config.yaml";
32961
+ if (!galConfig || !galConfigService) {
32904
32962
  console.log();
32905
- console.log(source_default.dim(" No .gal/config.yaml found."));
32963
+ console.log(source_default.dim(" No local GAL config found."));
32906
32964
  console.log();
32907
32965
  console.log(source_default.dim(" Run the local setup flow first:"));
32908
32966
  console.log(source_default.dim(" gal scan Discover your AI agent configs"));
32909
- console.log(source_default.dim(" gal approve --local Standardize into .gal/config.yaml"));
32967
+ console.log(source_default.dim(" gal approve --local Standardize into ~/.gal/config.yaml"));
32910
32968
  console.log(source_default.dim(" gal sync Distribute to all agents"));
32911
32969
  console.log();
32912
32970
  console.log(source_default.dim(" Or connect to an org:"));
@@ -32917,7 +32975,7 @@ function createSyncCommand() {
32917
32975
  }
32918
32976
  const platformsToSync = options.platform ? [options.platform] : ["claude", "cursor", "copilot", "gemini", "codex", "windsurf", "antigravity", "amp"];
32919
32977
  console.log();
32920
- console.log(source_default.bold(" Syncing from .gal/config.yaml"));
32978
+ console.log(source_default.bold(` Syncing from ${configPathLabel}`));
32921
32979
  console.log(source_default.dim(` Version: ${galConfig.configVersion}`));
32922
32980
  console.log(source_default.dim(` Hash: ${galConfig.hash}`));
32923
32981
  console.log();
@@ -33530,7 +33588,7 @@ function writeClaudeConfig(directory, configData, syncedFiles, syncedItems) {
33530
33588
  console.log();
33531
33589
  }
33532
33590
  }
33533
- const userSettingsPath = (0, import_path18.join)((0, import_os15.homedir)(), ".claude", "settings.json");
33591
+ const userSettingsPath = (0, import_path18.join)((0, import_os16.homedir)(), ".claude", "settings.json");
33534
33592
  if ((0, import_fs19.existsSync)(userSettingsPath)) {
33535
33593
  const userContent = (0, import_fs19.readFileSync)(userSettingsPath, "utf-8");
33536
33594
  const userHash = calculateConfigHash(userContent);
@@ -33701,7 +33759,7 @@ function codexPromptFileNameFromCommand(commandName) {
33701
33759
  }
33702
33760
  function writeCodexPrompts(commands) {
33703
33761
  if (!commands || commands.length === 0) return 0;
33704
- const promptsDir = (0, import_path18.join)((0, import_os15.homedir)(), ".codex", "prompts");
33762
+ const promptsDir = (0, import_path18.join)((0, import_os16.homedir)(), ".codex", "prompts");
33705
33763
  if (!(0, import_fs19.existsSync)(promptsDir)) {
33706
33764
  (0, import_fs19.mkdirSync)(promptsDir, { recursive: true });
33707
33765
  }
@@ -34654,7 +34712,7 @@ async function checkApprovedConfig(configRepo, orgName, directory, platformFilte
34654
34712
  }
34655
34713
  console.log(JSON.stringify(result));
34656
34714
  }
34657
- var import_fs19, import_path18, import_os15, import_crypto6, cliVersion4, defaultApiUrl4, GAL_CLI_CURSOR_RULES_VERSION, GAL_CLI_CURSOR_RULES, CODEX_PROMPT_PREFIX, GEMINI_COMMANDS_DIR, GEMINI_SKILLS_DIR;
34715
+ var import_fs19, import_path18, import_os16, import_crypto6, cliVersion4, defaultApiUrl4, GAL_CLI_CURSOR_RULES_VERSION, GAL_CLI_CURSOR_RULES, CODEX_PROMPT_PREFIX, GEMINI_COMMANDS_DIR, GEMINI_SKILLS_DIR;
34658
34716
  var init_sync = __esm({
34659
34717
  "src/commands/sync.ts"() {
34660
34718
  "use strict";
@@ -34666,7 +34724,7 @@ var init_sync = __esm({
34666
34724
  init_telemetry();
34667
34725
  import_fs19 = require("fs");
34668
34726
  import_path18 = require("path");
34669
- import_os15 = require("os");
34727
+ import_os16 = require("os");
34670
34728
  init_project_detection();
34671
34729
  import_crypto6 = require("crypto");
34672
34730
  init_dist2();
@@ -35226,7 +35284,7 @@ Review status: ${source_default.cyan("gal auth status")}
35226
35284
  try {
35227
35285
  let accessToken;
35228
35286
  let refreshToken;
35229
- const claudeDir = (0, import_path19.join)((0, import_os16.homedir)(), ".claude");
35287
+ const claudeDir = (0, import_path19.join)((0, import_os17.homedir)(), ".claude");
35230
35288
  let credentialSource2 = "";
35231
35289
  const isSetupTokenMode2 = !!options.setupToken;
35232
35290
  if (options.setupToken) {
@@ -35462,7 +35520,7 @@ Review status: ${source_default.cyan("gal auth status")}
35462
35520
  spinner.info(source_default.dim(" Using API key from command line"));
35463
35521
  }
35464
35522
  } else {
35465
- const codexAuthPath = (0, import_path19.join)((0, import_os16.homedir)(), ".codex", "auth.json");
35523
+ const codexAuthPath = (0, import_path19.join)((0, import_os17.homedir)(), ".codex", "auth.json");
35466
35524
  if (verbose) {
35467
35525
  spinner.info(source_default.dim(` Trying ${codexAuthPath}...`));
35468
35526
  }
@@ -35580,7 +35638,7 @@ Source: ${credentialSource2}`));
35580
35638
  spinner.info(source_default.dim(" Using API key from command line"));
35581
35639
  }
35582
35640
  } else {
35583
- const geminiAuthPath = (0, import_path19.join)((0, import_os16.homedir)(), ".gemini", "oauth_creds.json");
35641
+ const geminiAuthPath = (0, import_path19.join)((0, import_os17.homedir)(), ".gemini", "oauth_creds.json");
35584
35642
  if (verbose) {
35585
35643
  spinner.info(source_default.dim(` Trying ${geminiAuthPath}...`));
35586
35644
  }
@@ -35907,7 +35965,7 @@ Source: ${credentialSource2}`));
35907
35965
  });
35908
35966
  return auth;
35909
35967
  }
35910
- var import_http, import_child_process6, import_os16, import_fs20, import_path19, import_readline2, CLI_CALLBACK_PORT, CLI_CALLBACK_PATH, cliVersion5, defaultApiUrl5;
35968
+ var import_http, import_child_process6, import_os17, import_fs20, import_path19, import_readline2, CLI_CALLBACK_PORT, CLI_CALLBACK_PATH, cliVersion5, defaultApiUrl5;
35911
35969
  var init_auth2 = __esm({
35912
35970
  "src/commands/auth.ts"() {
35913
35971
  "use strict";
@@ -35920,7 +35978,7 @@ var init_auth2 = __esm({
35920
35978
  init_constants();
35921
35979
  init_CoreServiceProvider();
35922
35980
  init_telemetry();
35923
- import_os16 = require("os");
35981
+ import_os17 = require("os");
35924
35982
  import_fs20 = require("fs");
35925
35983
  import_path19 = require("path");
35926
35984
  init_hooks();
@@ -42256,7 +42314,7 @@ async function getLocalEnforcementStatus() {
42256
42314
  }
42257
42315
  }
42258
42316
  try {
42259
- const pkgPath = join46(import_meta.url.replace("file://", ""), "..", "..", "..", "package.json");
42317
+ const pkgPath = join46(import_meta2.url.replace("file://", ""), "..", "..", "..", "package.json");
42260
42318
  const pkg = JSON.parse(await readFile4(pkgPath, "utf-8"));
42261
42319
  version = pkg.version || "0.1.0";
42262
42320
  } catch {
@@ -42609,7 +42667,7 @@ Fleet Status: ${orgName}
42609
42667
  });
42610
42668
  return fleet;
42611
42669
  }
42612
- var import_node_os4, import_node_child_process, import_node_crypto2, import_promises5, import_meta, defaultApiUrl8;
42670
+ var import_node_os4, import_node_child_process, import_node_crypto2, import_promises5, import_meta2, defaultApiUrl8;
42613
42671
  var init_fleet = __esm({
42614
42672
  "src/commands/fleet.ts"() {
42615
42673
  "use strict";
@@ -42623,7 +42681,7 @@ var init_fleet = __esm({
42623
42681
  import_promises5 = require("node:fs/promises");
42624
42682
  init_CoreServiceProvider();
42625
42683
  init_config_manager();
42626
- import_meta = {};
42684
+ import_meta2 = {};
42627
42685
  defaultApiUrl8 = constants_default[1];
42628
42686
  }
42629
42687
  });
@@ -44116,7 +44174,7 @@ function discoverMemoryFiles(projectRoot, platform5, includeGlobal) {
44116
44174
  }
44117
44175
  }
44118
44176
  if (includeGlobal) {
44119
- const home = (0, import_os17.homedir)();
44177
+ const home = (0, import_os18.homedir)();
44120
44178
  if (platform5 === "claude") {
44121
44179
  const projectsDir = (0, import_path24.join)(home, ".claude", "projects");
44122
44180
  if ((0, import_fs25.existsSync)(projectsDir)) {
@@ -44170,9 +44228,9 @@ Examples:
44170
44228
  gal memory add --type feedback "Don't mock the DB" Add a manual memory
44171
44229
  gal memory push Push memories to all platforms
44172
44230
  `);
44173
- command.command("list").description("List memories stored in .gal/config.yaml").option("--format <format>", "Output format: table (default) or json", "table").action(async (options) => {
44231
+ command.command("list").description("List memories stored in ~/.gal/config.yaml").option("--format <format>", "Output format: table (default) or json", "table").action(async (options) => {
44174
44232
  const projectRoot = findProjectRoot(process.cwd());
44175
- const service = new GalConfigService(projectRoot);
44233
+ const service = GalConfigService.forWorkspace(projectRoot);
44176
44234
  const config = service.readConfig();
44177
44235
  if (!config?.memory || config.memory.length === 0) {
44178
44236
  console.log();
@@ -44205,7 +44263,7 @@ Examples:
44205
44263
  console.log();
44206
44264
  }
44207
44265
  });
44208
- command.command("import").description("Import memories from a provider into .gal/config.yaml").requiredOption("--source <platform>", `Source platform (${ALL_PLATFORM_IDS.join(", ")})`).option("--global", "Include global/home-directory memory files").option("--dry-run", "Show what would be imported without writing").action(async (options) => {
44266
+ command.command("import").description("Import memories from a provider into ~/.gal/config.yaml").requiredOption("--source <platform>", `Source platform (${ALL_PLATFORM_IDS.join(", ")})`).option("--global", "Include global/home-directory memory files").option("--dry-run", "Show what would be imported without writing").action(async (options) => {
44209
44267
  const source = options.source;
44210
44268
  if (!ALL_PLATFORM_IDS.includes(source)) {
44211
44269
  console.error(source_default.red(`Invalid platform "${source}".`));
@@ -44263,7 +44321,7 @@ Examples:
44263
44321
  console.log();
44264
44322
  return;
44265
44323
  }
44266
- const service = new GalConfigService(projectRoot);
44324
+ const service = GalConfigService.forWorkspace(projectRoot);
44267
44325
  const config = service.readConfig() || {
44268
44326
  version: 1,
44269
44327
  organization: "",
@@ -44278,7 +44336,7 @@ Examples:
44278
44336
  config.memory = [...config.memory || [], ...newMemories];
44279
44337
  service.writeConfig(config);
44280
44338
  console.log();
44281
- console.log(source_default.green(` Imported ${newMemories.length} memories into .gal/config.yaml`));
44339
+ console.log(source_default.green(` Imported ${newMemories.length} memories into ~/.gal/config.yaml`));
44282
44340
  if (duplicates > 0) {
44283
44341
  console.log(source_default.dim(` Skipped ${duplicates} duplicates (same name)`));
44284
44342
  }
@@ -44292,7 +44350,7 @@ Examples:
44292
44350
  process.exit(1);
44293
44351
  }
44294
44352
  const projectRoot = findProjectRoot(process.cwd());
44295
- const service = new GalConfigService(projectRoot);
44353
+ const service = GalConfigService.forWorkspace(projectRoot);
44296
44354
  const config = service.readConfig() || {
44297
44355
  version: 1,
44298
44356
  organization: "",
@@ -44316,9 +44374,9 @@ Examples:
44316
44374
  console.log(source_default.dim(" Run gal memory push to sync to all platforms"));
44317
44375
  console.log();
44318
44376
  });
44319
- command.command("push").description("Push memories from .gal/config.yaml to all platform-native formats").option("-p, --platform <platform>", "Push to specific platform only").action(async (options) => {
44377
+ command.command("push").description("Push memories from ~/.gal/config.yaml to all platform-native formats").option("-p, --platform <platform>", "Push to specific platform only").action(async (options) => {
44320
44378
  const projectRoot = findProjectRoot(process.cwd());
44321
- const service = new GalConfigService(projectRoot);
44379
+ const service = GalConfigService.forWorkspace(projectRoot);
44322
44380
  const config = service.readConfig();
44323
44381
  if (!config?.memory || config.memory.length === 0) {
44324
44382
  console.log();
@@ -44352,7 +44410,7 @@ Examples:
44352
44410
  });
44353
44411
  return command;
44354
44412
  }
44355
- var import_fs25, import_path24, import_os17;
44413
+ var import_fs25, import_path24, import_os18;
44356
44414
  var init_memory = __esm({
44357
44415
  "src/commands/memory.ts"() {
44358
44416
  "use strict";
@@ -44360,7 +44418,7 @@ var init_memory = __esm({
44360
44418
  init_source();
44361
44419
  import_fs25 = require("fs");
44362
44420
  import_path24 = require("path");
44363
- import_os17 = require("os");
44421
+ import_os18 = require("os");
44364
44422
  init_dist2();
44365
44423
  init_project_detection();
44366
44424
  init_gal_config_service();
@@ -44885,14 +44943,18 @@ var init_policy = __esm({
44885
44943
  // src/utils/config-reader.ts
44886
44944
  async function readLocalConfig() {
44887
44945
  const projectRoot = findProjectRoot();
44888
- const galConfigPath = (0, import_path25.join)(projectRoot, ".gal", "config.yaml");
44889
- if ((0, import_fs26.existsSync)(galConfigPath)) {
44946
+ const canonicalSources = [
44947
+ { path: (0, import_path25.join)(projectRoot, ".gal", "config.yaml"), label: ".gal/config.yaml" },
44948
+ { path: (0, import_path25.join)((0, import_os19.homedir)(), ".gal", "config.yaml"), label: "~/.gal/config.yaml" }
44949
+ ];
44950
+ for (const source of canonicalSources) {
44951
+ if (!(0, import_fs26.existsSync)(source.path)) continue;
44890
44952
  try {
44891
- const content = (0, import_fs26.readFileSync)(galConfigPath, "utf-8");
44953
+ const content = (0, import_fs26.readFileSync)(source.path, "utf-8");
44892
44954
  const config = (0, import_yaml2.parse)(content);
44893
44955
  return config;
44894
44956
  } catch (error2) {
44895
- console.warn("Failed to parse .gal/config.yaml:", error2);
44957
+ console.warn(`Failed to parse ${source.label}:`, error2);
44896
44958
  }
44897
44959
  }
44898
44960
  const claudeDir = (0, import_path25.join)(projectRoot, ".claude");
@@ -45031,12 +45093,13 @@ function readDirRecursive(dir, extension) {
45031
45093
  }
45032
45094
  return results;
45033
45095
  }
45034
- var import_fs26, import_path25, import_yaml2;
45096
+ var import_fs26, import_path25, import_os19, import_yaml2;
45035
45097
  var init_config_reader = __esm({
45036
45098
  "src/utils/config-reader.ts"() {
45037
45099
  "use strict";
45038
45100
  import_fs26 = require("fs");
45039
45101
  import_path25 = require("path");
45102
+ import_os19 = require("os");
45040
45103
  init_project_detection();
45041
45104
  import_yaml2 = __toESM(require_dist(), 1);
45042
45105
  }
@@ -46973,7 +47036,7 @@ function findCommandsDirectory() {
46973
47036
  if ((0, import_fs31.existsSync)(localCommandsDir)) {
46974
47037
  return localCommandsDir;
46975
47038
  }
46976
- const homeCommandsDir = (0, import_path28.join)((0, import_os18.homedir)(), ".claude", "commands");
47039
+ const homeCommandsDir = (0, import_path28.join)((0, import_os20.homedir)(), ".claude", "commands");
46977
47040
  if ((0, import_fs31.existsSync)(homeCommandsDir)) {
46978
47041
  return homeCommandsDir;
46979
47042
  }
@@ -47144,14 +47207,14 @@ Executing command: ${command.name}`));
47144
47207
  throw error2;
47145
47208
  }
47146
47209
  }
47147
- var import_os18, import_path28, import_fs31;
47210
+ var import_os20, import_path28, import_fs31;
47148
47211
  var init_run = __esm({
47149
47212
  "src/commands/run.ts"() {
47150
47213
  "use strict";
47151
47214
  init_esm();
47152
47215
  init_source();
47153
47216
  init_ora();
47154
- import_os18 = require("os");
47217
+ import_os20 = require("os");
47155
47218
  import_path28 = require("path");
47156
47219
  import_fs31 = require("fs");
47157
47220
  init_command_parser();
@@ -47491,16 +47554,16 @@ function createRunDesignCommand() {
47491
47554
  runDesign.addCommand(syncCmd);
47492
47555
  return runDesign;
47493
47556
  }
47494
- var import_os19, import_path29, import_fs32, DESIGN_PROJECTS_DIR, ACTIVE_FILE, IMAGE_STATUS_ICON, VIDEO_STATUS_ICON;
47557
+ var import_os21, import_path29, import_fs32, DESIGN_PROJECTS_DIR, ACTIVE_FILE, IMAGE_STATUS_ICON, VIDEO_STATUS_ICON;
47495
47558
  var init_run_design = __esm({
47496
47559
  "src/commands/run-design.ts"() {
47497
47560
  "use strict";
47498
47561
  init_esm();
47499
47562
  init_source();
47500
- import_os19 = require("os");
47563
+ import_os21 = require("os");
47501
47564
  import_path29 = require("path");
47502
47565
  import_fs32 = require("fs");
47503
- DESIGN_PROJECTS_DIR = (0, import_path29.join)((0, import_os19.homedir)(), ".gal", "design-projects");
47566
+ DESIGN_PROJECTS_DIR = (0, import_path29.join)((0, import_os21.homedir)(), ".gal", "design-projects");
47504
47567
  ACTIVE_FILE = (0, import_path29.join)(DESIGN_PROJECTS_DIR, "active.json");
47505
47568
  IMAGE_STATUS_ICON = {
47506
47569
  pending: " ",
@@ -47760,7 +47823,7 @@ function createScanCommand() {
47760
47823
  }
47761
47824
  }
47762
47825
  if (options.includeGlobal) {
47763
- const home = (0, import_os20.homedir)();
47826
+ const home = (0, import_os22.homedir)();
47764
47827
  for (const loc of GLOBAL_MEMORY_LOCATIONS) {
47765
47828
  if (platformFilter && loc.platform !== platformFilter) continue;
47766
47829
  for (const relPath of loc.paths) {
@@ -47835,13 +47898,13 @@ function createScanCommand() {
47835
47898
  console.log();
47836
47899
  console.log(source_default.dim(" Next steps:"));
47837
47900
  console.log(source_default.dim(" gal scan --format json > .gal/scan-results.json Save scan results"));
47838
- console.log(source_default.dim(" gal approve --local Standardize into ~/.gal/"));
47901
+ console.log(source_default.dim(" gal approve --local Standardize into ~/.gal/config.yaml"));
47839
47902
  console.log(source_default.dim(" gal sync --pull Sync org-approved configs"));
47840
47903
  console.log();
47841
47904
  });
47842
47905
  return command;
47843
47906
  }
47844
- var import_fs33, import_path30, import_os20, GLOBAL_MEMORY_LOCATIONS, PLATFORM_LABELS, PLATFORM_COLORS;
47907
+ var import_fs33, import_path30, import_os22, GLOBAL_MEMORY_LOCATIONS, PLATFORM_LABELS, PLATFORM_COLORS;
47845
47908
  var init_scan = __esm({
47846
47909
  "src/commands/scan.ts"() {
47847
47910
  "use strict";
@@ -47849,7 +47912,7 @@ var init_scan = __esm({
47849
47912
  init_source();
47850
47913
  import_fs33 = require("fs");
47851
47914
  import_path30 = require("path");
47852
- import_os20 = require("os");
47915
+ import_os22 = require("os");
47853
47916
  init_dist2();
47854
47917
  init_project_detection();
47855
47918
  GLOBAL_MEMORY_LOCATIONS = [
@@ -47993,15 +48056,28 @@ var init_sandbox_profiles = __esm({
47993
48056
  });
47994
48057
 
47995
48058
  // src/sandbox/e2b-sandbox.ts
48059
+ function loadSandboxClass() {
48060
+ if (sandboxClass !== void 0) {
48061
+ return sandboxClass;
48062
+ }
48063
+ try {
48064
+ const runtimeRequire = (0, import_node_module2.createRequire)(import_meta3.url);
48065
+ sandboxClass = runtimeRequire("@e2b/code-interpreter").Sandbox;
48066
+ } catch {
48067
+ sandboxClass = null;
48068
+ }
48069
+ return sandboxClass;
48070
+ }
47996
48071
  function createSandboxService(config) {
47997
48072
  return new E2BSandboxService(config);
47998
48073
  }
47999
- var import_code_interpreter, E2BSandboxService;
48074
+ var import_node_module2, import_meta3, sandboxClass, E2BSandboxService;
48000
48075
  var init_e2b_sandbox = __esm({
48001
48076
  "src/sandbox/e2b-sandbox.ts"() {
48002
48077
  "use strict";
48003
- import_code_interpreter = require("@e2b/code-interpreter");
48078
+ import_node_module2 = require("node:module");
48004
48079
  init_source();
48080
+ import_meta3 = {};
48005
48081
  E2BSandboxService = class {
48006
48082
  /** @description Configuration for the sandbox session */
48007
48083
  config;
@@ -48028,6 +48104,12 @@ var init_e2b_sandbox = __esm({
48028
48104
  if (this.sandbox) {
48029
48105
  throw new Error("Sandbox session already active. Close the current session first.");
48030
48106
  }
48107
+ const Sandbox = loadSandboxClass();
48108
+ if (!Sandbox) {
48109
+ throw new Error(
48110
+ "E2B sandbox support is unavailable in this installation. Reinstall GAL with npm or pnpm to use sandbox commands."
48111
+ );
48112
+ }
48031
48113
  console.log(source_default.green("Starting E2B sandbox session..."));
48032
48114
  const options = {
48033
48115
  apiKey: this.config.apiKey,
@@ -48039,7 +48121,7 @@ var init_e2b_sandbox = __esm({
48039
48121
  if (this.config.metadata) {
48040
48122
  options.metadata = this.config.metadata;
48041
48123
  }
48042
- this.sandbox = await import_code_interpreter.Sandbox.create({ apiKey: this.config.apiKey, timeoutMs: this.config.timeoutMs });
48124
+ this.sandbox = await Sandbox.create({ apiKey: this.config.apiKey, timeoutMs: this.config.timeoutMs });
48043
48125
  console.log(source_default.green(`Sandbox session started successfully (ID: ${this.sandbox.sandboxId})`));
48044
48126
  }
48045
48127
  /**
@@ -49420,7 +49502,7 @@ var init_security = __esm({
49420
49502
 
49421
49503
  // src/commands/status.ts
49422
49504
  function readTermsAcceptance() {
49423
- const configFile = (0, import_path33.join)((0, import_os21.homedir)(), ".gal", "config.json");
49505
+ const configFile = (0, import_path33.join)((0, import_os23.homedir)(), ".gal", "config.json");
49424
49506
  try {
49425
49507
  if ((0, import_fs35.existsSync)(configFile)) {
49426
49508
  const raw = JSON.parse((0, import_fs35.readFileSync)(configFile, "utf-8"));
@@ -49614,7 +49696,7 @@ function recordReport(projectId) {
49614
49696
  } catch {
49615
49697
  }
49616
49698
  cache[projectId] = Date.now();
49617
- (0, import_fs35.mkdirSync)((0, import_path33.join)((0, import_os21.homedir)(), ".gal"), { recursive: true });
49699
+ (0, import_fs35.mkdirSync)((0, import_path33.join)((0, import_os23.homedir)(), ".gal"), { recursive: true });
49618
49700
  (0, import_fs35.writeFileSync)(DRIFT_REPORT_CACHE_PATH, JSON.stringify(cache));
49619
49701
  } catch {
49620
49702
  }
@@ -49720,7 +49802,7 @@ function createStatusCommand2() {
49720
49802
  });
49721
49803
  return command;
49722
49804
  }
49723
- var import_path33, import_os21, import_fs35, cliVersion6, defaultApiUrl15, PLATFORM_LABELS2, RATE_LIMIT_MS, DRIFT_REPORT_CACHE_PATH;
49805
+ var import_path33, import_os23, import_fs35, cliVersion6, defaultApiUrl15, PLATFORM_LABELS2, RATE_LIMIT_MS, DRIFT_REPORT_CACHE_PATH;
49724
49806
  var init_status = __esm({
49725
49807
  "src/commands/status.ts"() {
49726
49808
  "use strict";
@@ -49728,7 +49810,7 @@ var init_status = __esm({
49728
49810
  init_source();
49729
49811
  init_ora();
49730
49812
  import_path33 = require("path");
49731
- import_os21 = require("os");
49813
+ import_os23 = require("os");
49732
49814
  import_fs35 = require("fs");
49733
49815
  init_gal_config_service();
49734
49816
  init_config_manager();
@@ -49745,7 +49827,7 @@ var init_status = __esm({
49745
49827
  ])
49746
49828
  );
49747
49829
  RATE_LIMIT_MS = 5 * 60 * 1e3;
49748
- DRIFT_REPORT_CACHE_PATH = (0, import_path33.join)((0, import_os21.homedir)(), ".gal", "drift-report-cache.json");
49830
+ DRIFT_REPORT_CACHE_PATH = (0, import_path33.join)((0, import_os23.homedir)(), ".gal", "drift-report-cache.json");
49749
49831
  }
49750
49832
  });
49751
49833
 
@@ -52116,7 +52198,7 @@ function detectFileSource(filePath) {
52116
52198
  }
52117
52199
  function detectUserLevelItems(options) {
52118
52200
  const items = [];
52119
- const claudeDir = (0, import_path36.join)((0, import_os22.homedir)(), ".claude");
52201
+ const claudeDir = (0, import_path36.join)((0, import_os24.homedir)(), ".claude");
52120
52202
  const claudeHooksDir = (0, import_path36.join)(claudeDir, "hooks");
52121
52203
  const statusLinesDir = (0, import_path36.join)(claudeDir, "status_lines");
52122
52204
  const includeNpm = options?.includeNpmInstalled ?? true;
@@ -52208,7 +52290,7 @@ function detectUserLevelItems(options) {
52208
52290
  } catch {
52209
52291
  }
52210
52292
  }
52211
- const cursorDir = (0, import_path36.join)((0, import_os22.homedir)(), ".cursor");
52293
+ const cursorDir = (0, import_path36.join)((0, import_os24.homedir)(), ".cursor");
52212
52294
  const cursorHooksDir = (0, import_path36.join)(cursorDir, "hooks");
52213
52295
  if ((0, import_fs38.existsSync)(cursorHooksDir)) {
52214
52296
  const files = (0, import_fs38.readdirSync)(cursorHooksDir);
@@ -52513,7 +52595,7 @@ function createUninstallCommand() {
52513
52595
  });
52514
52596
  return command;
52515
52597
  }
52516
- var import_fs38, import_path36, import_os22, import_readline4;
52598
+ var import_fs38, import_path36, import_os24, import_readline4;
52517
52599
  var init_uninstall = __esm({
52518
52600
  "src/commands/uninstall.ts"() {
52519
52601
  "use strict";
@@ -52521,7 +52603,7 @@ var init_uninstall = __esm({
52521
52603
  init_source();
52522
52604
  import_fs38 = require("fs");
52523
52605
  import_path36 = require("path");
52524
- import_os22 = require("os");
52606
+ import_os24 = require("os");
52525
52607
  import_readline4 = require("readline");
52526
52608
  }
52527
52609
  });
@@ -52939,7 +53021,7 @@ function compareVersions(v1, v2) {
52939
53021
  }
52940
53022
  function acquireLock() {
52941
53023
  try {
52942
- const galDir = (0, import_path37.join)((0, import_os23.homedir)(), ".gal");
53024
+ const galDir = (0, import_path37.join)((0, import_os25.homedir)(), ".gal");
52943
53025
  if (!(0, import_fs39.existsSync)(galDir)) {
52944
53026
  (0, import_fs39.mkdirSync)(galDir, { recursive: true });
52945
53027
  }
@@ -53079,7 +53161,7 @@ Retry manually with: ${source_default.cyan(installCommand)}`);
53079
53161
  });
53080
53162
  return command;
53081
53163
  }
53082
- var import_https, import_child_process12, import_fs39, import_path37, import_os23, UPDATE_LOCK_FILE, cliVersion7, REGISTRY_URL;
53164
+ var import_https, import_child_process12, import_fs39, import_path37, import_os25, UPDATE_LOCK_FILE, cliVersion7, REGISTRY_URL;
53083
53165
  var init_update = __esm({
53084
53166
  "src/commands/update.ts"() {
53085
53167
  "use strict";
@@ -53090,12 +53172,12 @@ var init_update = __esm({
53090
53172
  import_child_process12 = require("child_process");
53091
53173
  import_fs39 = require("fs");
53092
53174
  import_path37 = require("path");
53093
- import_os23 = require("os");
53175
+ import_os25 = require("os");
53094
53176
  init_constants();
53095
53177
  init_path_conflict();
53096
53178
  init_install();
53097
53179
  init_telemetry();
53098
- UPDATE_LOCK_FILE = (0, import_path37.join)((0, import_os23.homedir)(), ".gal", "update.lock");
53180
+ UPDATE_LOCK_FILE = (0, import_path37.join)((0, import_os25.homedir)(), ".gal", "update.lock");
53099
53181
  cliVersion7 = constants_default[0];
53100
53182
  REGISTRY_URL = getRegistryUrl();
53101
53183
  }
@@ -54105,7 +54187,7 @@ function getRegistryAuthToken2() {
54105
54187
  return void 0;
54106
54188
  }
54107
54189
  try {
54108
- const npmrcPath = (0, import_path39.join)((0, import_os24.homedir)(), ".npmrc");
54190
+ const npmrcPath = (0, import_path39.join)((0, import_os26.homedir)(), ".npmrc");
54109
54191
  if (!(0, import_fs40.existsSync)(npmrcPath)) {
54110
54192
  return void 0;
54111
54193
  }
@@ -54200,7 +54282,7 @@ function checkForUpdates() {
54200
54282
  const autoUpdateDisabled = process.env.GAL_NO_AUTO_UPDATE === "1" || process.env.CI === "true";
54201
54283
  if (!isUpdateCommand && !autoUpdateDisabled) {
54202
54284
  try {
54203
- const lockFile = (0, import_path39.join)((0, import_os24.homedir)(), ".gal", "update.lock");
54285
+ const lockFile = (0, import_path39.join)((0, import_os26.homedir)(), ".gal", "update.lock");
54204
54286
  if (!(0, import_fs40.existsSync)(lockFile)) {
54205
54287
  const child = (0, import_child_process13.spawn)("gal", ["update"], {
54206
54288
  detached: true,
@@ -54282,7 +54364,7 @@ function checkPathConflicts() {
54282
54364
  }
54283
54365
  function refreshOrgMemberships() {
54284
54366
  try {
54285
- const configPath = (0, import_path39.join)((0, import_os24.homedir)(), ".gal", "config.json");
54367
+ const configPath = (0, import_path39.join)((0, import_os26.homedir)(), ".gal", "config.json");
54286
54368
  if (!(0, import_fs40.existsSync)(configPath)) return;
54287
54369
  const config = JSON.parse((0, import_fs40.readFileSync)(configPath, "utf-8"));
54288
54370
  if (!config.authToken) return;
@@ -54365,7 +54447,7 @@ function refreshOrgMemberships() {
54365
54447
  } catch {
54366
54448
  }
54367
54449
  }
54368
- var import_dotenv, import_https2, import_child_process13, import_fs40, import_path39, import_os24, originalEmit, GLOBAL_TIMEOUT_MS, globalTimeout, cliVersion9, UPDATE_CACHE_DIR, UPDATE_CACHE_FILE, ONE_DAY, ONE_HOUR, REGISTRY_URL2, REGISTRY_HOST, sessionStartTime, isReadOnlyStatusCommand, isMachineMode, featureFlags, knownCommands, isKnownCommand, program2, allInternalFlags;
54450
+ var import_dotenv, import_https2, import_child_process13, import_fs40, import_path39, import_os26, originalEmit, GLOBAL_TIMEOUT_MS, globalTimeout, cliVersion9, UPDATE_CACHE_DIR, UPDATE_CACHE_FILE, ONE_DAY, ONE_HOUR, REGISTRY_URL2, REGISTRY_HOST, sessionStartTime, isReadOnlyStatusCommand, isMachineMode, exitHooksRan, featureFlags, knownCommands, isKnownCommand, program2, allInternalFlags;
54369
54451
  var init_index = __esm({
54370
54452
  "src/index.ts"() {
54371
54453
  "use strict";
@@ -54375,7 +54457,7 @@ var init_index = __esm({
54375
54457
  import_child_process13 = require("child_process");
54376
54458
  import_fs40 = require("fs");
54377
54459
  import_path39 = require("path");
54378
- import_os24 = require("os");
54460
+ import_os26 = require("os");
54379
54461
  init_source();
54380
54462
  init_constants();
54381
54463
  init_sentry2();
@@ -54404,7 +54486,7 @@ var init_index = __esm({
54404
54486
  }, GLOBAL_TIMEOUT_MS);
54405
54487
  globalTimeout.unref();
54406
54488
  cliVersion9 = constants_default[0];
54407
- UPDATE_CACHE_DIR = (0, import_path39.join)((0, import_os24.homedir)(), ".gal");
54489
+ UPDATE_CACHE_DIR = (0, import_path39.join)((0, import_os26.homedir)(), ".gal");
54408
54490
  UPDATE_CACHE_FILE = (0, import_path39.join)(UPDATE_CACHE_DIR, "update-cache.json");
54409
54491
  ONE_DAY = 24 * 60 * 60 * 1e3;
54410
54492
  ONE_HOUR = 60 * 60 * 1e3;
@@ -54437,7 +54519,12 @@ var init_index = __esm({
54437
54519
  trackSessionStart();
54438
54520
  isReadOnlyStatusCommand = process.argv[2] === "status" || process.argv[2] === "auth" && process.argv[3] === "status";
54439
54521
  isMachineMode = process.argv.includes("--json") || process.argv.includes("-j") || process.env.GAL_MACHINE === "1" || isReadOnlyStatusCommand;
54440
- process.on("beforeExit", async () => {
54522
+ exitHooksRan = false;
54523
+ process.once("beforeExit", async () => {
54524
+ if (exitHooksRan) {
54525
+ return;
54526
+ }
54527
+ exitHooksRan = true;
54441
54528
  trackSessionEnd(Date.now() - sessionStartTime);
54442
54529
  if (!isMachineMode) {
54443
54530
  await flushTelemetry();
@@ -54540,7 +54627,7 @@ var init_index = __esm({
54540
54627
  process.argv = process.argv.filter((a) => a !== "--accept-terms");
54541
54628
  program2.parse();
54542
54629
  } catch (error2) {
54543
- captureException2(error2 instanceof Error ? error2 : new Error(String(error2)));
54630
+ captureException(error2 instanceof Error ? error2 : new Error(String(error2)));
54544
54631
  void flushSentry().finally(() => process.exit(1));
54545
54632
  }
54546
54633
  })();
@@ -54548,7 +54635,7 @@ var init_index = __esm({
54548
54635
  });
54549
54636
 
54550
54637
  // src/bootstrap.ts
54551
- var cliVersion10 = true ? "0.0.287" : "0.0.0-dev";
54638
+ var cliVersion10 = true ? "0.0.288" : "0.0.0-dev";
54552
54639
  var args = process.argv.slice(2);
54553
54640
  var requestedGlobalHelp = args.length === 1 && (args[0] === "--help" || args[0] === "-h");
54554
54641
  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.287",
3
+ "version": "0.0.288",
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,