@scheduler-systems/gal-run 0.0.560 → 0.0.562

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 +370 -311
  2. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -3955,7 +3955,7 @@ 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.560" : "0.0.0-dev";
3958
+ cliVersion = true ? "0.0.562" : "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;
@@ -4510,12 +4510,20 @@ function isWorkspaceLocalGalHomeActive() {
4510
4510
  }
4511
4511
  return (0, import_fs2.existsSync)((0, import_path2.join)(workspaceRoot, LOCAL_DEV_ACTIVE_MARKER)) && (0, import_fs2.existsSync)((0, import_path2.join)(workspaceRoot, LOCAL_DEV_CONFIG_FILE));
4512
4512
  }
4513
+ function shouldUseWorkspaceLocalGalHome(env2 = process.env) {
4514
+ const explicitOptIn = env2.GAL_USE_WORKSPACE_LOCAL_HOME?.toLowerCase();
4515
+ if (explicitOptIn === "1" || explicitOptIn === "true" || explicitOptIn === "yes") {
4516
+ return true;
4517
+ }
4518
+ const galEnv = env2.GAL_ENV?.toLowerCase();
4519
+ return galEnv === "dev" || galEnv === "development" || galEnv === "local";
4520
+ }
4513
4521
  function resolveGalHomeDir(env2 = process.env) {
4514
4522
  if (env2.GAL_HOME) {
4515
4523
  return (0, import_path2.resolve)(env2.GAL_HOME);
4516
4524
  }
4517
4525
  const workspaceRoot = detectGalWorkspaceRoot();
4518
- if (workspaceRoot && isWorkspaceLocalGalHomeActive()) {
4526
+ if (workspaceRoot && shouldUseWorkspaceLocalGalHome(env2) && isWorkspaceLocalGalHomeActive()) {
4519
4527
  return getWorkspaceLocalGalHomeDir(workspaceRoot);
4520
4528
  }
4521
4529
  return (0, import_path2.join)((0, import_os2.homedir)(), ".gal");
@@ -11849,7 +11857,7 @@ function detectEnvironment() {
11849
11857
  return "dev";
11850
11858
  }
11851
11859
  try {
11852
- const version2 = true ? "0.0.560" : void 0;
11860
+ const version2 = true ? "0.0.562" : void 0;
11853
11861
  if (version2 && version2.includes("-local")) {
11854
11862
  return "dev";
11855
11863
  }
@@ -14530,7 +14538,7 @@ function getId() {
14530
14538
  }
14531
14539
  function getCliVersion() {
14532
14540
  try {
14533
- return true ? "0.0.560" : "0.0.0-dev";
14541
+ return true ? "0.0.562" : "0.0.0-dev";
14534
14542
  } catch {
14535
14543
  return "0.0.0-dev";
14536
14544
  }
@@ -17918,10 +17926,10 @@ function getFeatureFlags() {
17918
17926
  let isInternalFromApi = false;
17919
17927
  let isPartnerFromApi = false;
17920
17928
  try {
17921
- const { readFileSync: readFileSync46, existsSync: existsSync54 } = require("fs");
17929
+ const { readFileSync: readFileSync46, existsSync: existsSync55 } = require("fs");
17922
17930
  const { join: join63 } = require("path");
17923
17931
  const configPath = join63(resolveGalHomeDir(process.env), "config.json");
17924
- if (existsSync54(configPath)) {
17932
+ if (existsSync55(configPath)) {
17925
17933
  const config2 = JSON.parse(readFileSync46(configPath, "utf-8"));
17926
17934
  const cacheAge = Date.now() - (config2.flagsCachedAt || config2.internalOrgsCheckedAt || 0);
17927
17935
  if (cacheAge < CACHE_MAX_AGE_MS) {
@@ -50549,7 +50557,7 @@ function createApprovedConfigCommand() {
50549
50557
  const spinner = options.json ? null : ora(`Fetching approved config for "${org}"...`).start();
50550
50558
  try {
50551
50559
  let findMdFiles2 = function(dir) {
50552
- if (!existsSync54(dir)) return [];
50560
+ if (!existsSync55(dir)) return [];
50553
50561
  const entries = readdirSync19(dir, { withFileTypes: true });
50554
50562
  const files = [];
50555
50563
  for (const entry of entries) {
@@ -50571,7 +50579,7 @@ function createApprovedConfigCommand() {
50571
50579
  }
50572
50580
  return;
50573
50581
  }
50574
- const { existsSync: existsSync54, readdirSync: readdirSync19, readFileSync: readFileSync46 } = await import("fs");
50582
+ const { existsSync: existsSync55, readdirSync: readdirSync19, readFileSync: readFileSync46 } = await import("fs");
50575
50583
  const { join: join63, relative: relative10, basename: basename10 } = await import("path");
50576
50584
  const baseDir = options.dir || process.cwd();
50577
50585
  const commandsDir = join63(baseDir, ".claude", "commands");
@@ -60021,6 +60029,54 @@ function getForwardedArgs(argv = process.argv) {
60021
60029
  const codeIndex = argv.findIndex((arg, index) => index > 1 && arg === "code");
60022
60030
  return codeIndex >= 0 ? argv.slice(codeIndex + 1) : [];
60023
60031
  }
60032
+ function resolveHostGhConfigDir(env2, pathExists) {
60033
+ if (env2.GH_CONFIG_DIR) {
60034
+ return env2.GH_CONFIG_DIR;
60035
+ }
60036
+ const candidates = [
60037
+ env2.XDG_CONFIG_HOME ? (0, import_path30.join)(env2.XDG_CONFIG_HOME, "gh") : void 0,
60038
+ env2.HOME ? (0, import_path30.join)(env2.HOME, ".config", "gh") : void 0,
60039
+ env2.HOME ? (0, import_path30.join)(env2.HOME, "Library", "Application Support", "gh") : void 0,
60040
+ env2.HOME ? (0, import_path30.join)(env2.HOME, "Library", "Application Support", "GitHub CLI") : void 0
60041
+ ];
60042
+ for (const candidate of candidates) {
60043
+ if (candidate && pathExists(candidate)) {
60044
+ return candidate;
60045
+ }
60046
+ }
60047
+ return null;
60048
+ }
60049
+ function resolveGitHubCliBridgeEnv(env2 = process.env, execFile2 = import_child_process11.execFileSync, pathExists = import_fs31.existsSync) {
60050
+ const bridged = {};
60051
+ const existingToken = env2.GH_TOKEN || env2.GITHUB_TOKEN;
60052
+ if (existingToken) {
60053
+ bridged.GH_TOKEN = existingToken;
60054
+ bridged.GITHUB_TOKEN = env2.GITHUB_TOKEN || existingToken;
60055
+ } else {
60056
+ try {
60057
+ const resolved = execFile2(
60058
+ "gh",
60059
+ ["auth", "token", "--hostname", "github.com"],
60060
+ {
60061
+ encoding: "utf-8",
60062
+ env: env2,
60063
+ stdio: ["ignore", "pipe", "ignore"]
60064
+ }
60065
+ );
60066
+ const token = String(resolved).trim();
60067
+ if (token) {
60068
+ bridged.GH_TOKEN = token;
60069
+ bridged.GITHUB_TOKEN = token;
60070
+ }
60071
+ } catch {
60072
+ }
60073
+ }
60074
+ const ghConfigDir = resolveHostGhConfigDir(env2, pathExists);
60075
+ if (ghConfigDir) {
60076
+ bridged.GH_CONFIG_DIR = ghConfigDir;
60077
+ }
60078
+ return bridged;
60079
+ }
60024
60080
  function printMissingBinaryGuidance(resolution, cliVersion12, write = console.error, exit = process.exit, platformInput = process.platform, archInput = process.arch) {
60025
60081
  write(source_default.red("\nGAL Code is internal-only right now and the native binary is not available.\n"));
60026
60082
  if (resolution.source === "env") {
@@ -60062,11 +60118,13 @@ function printGalCodeBinaryResolutionFailure(error3, cliVersion12, write = conso
60062
60118
  }
60063
60119
  return exit(1);
60064
60120
  }
60065
- var import_path30, DEFAULT_RELEASE_BASE_URL;
60121
+ var import_child_process11, import_fs31, import_path30, DEFAULT_RELEASE_BASE_URL;
60066
60122
  var init_code_launch_helpers = __esm({
60067
60123
  "module_364"() {
60068
60124
  "use strict";
60125
+ import_child_process11 = require("child_process");
60069
60126
  init_source();
60127
+ import_fs31 = require("fs");
60070
60128
  import_path30 = require("path");
60071
60129
  init_gal_home();
60072
60130
  DEFAULT_RELEASE_BASE_URL = "https://github.com/Scheduler-Systems/gal-run/releases/download";
@@ -60116,7 +60174,7 @@ var init_code_observability = __esm({
60116
60174
  }
60117
60175
  });
60118
60176
 
60119
- function runGalCode(binaryPath, args2, childEnv, spawnImpl = import_child_process11.spawn) {
60177
+ function runGalCode(binaryPath, args2, childEnv, spawnImpl = import_child_process12.spawn) {
60120
60178
  return new Promise((resolvePromise, rejectPromise) => {
60121
60179
  const child = spawnImpl(binaryPath, args2, {
60122
60180
  stdio: "inherit",
@@ -60153,18 +60211,18 @@ function runGalCode(binaryPath, args2, childEnv, spawnImpl = import_child_proces
60153
60211
  });
60154
60212
  });
60155
60213
  }
60156
- var import_child_process11;
60214
+ var import_child_process12;
60157
60215
  var init_code_process = __esm({
60158
60216
  "module_366"() {
60159
60217
  "use strict";
60160
- import_child_process11 = require("child_process");
60218
+ import_child_process12 = require("child_process");
60161
60219
  }
60162
60220
  });
60163
60221
 
60164
60222
  function findWorkspaceRoot2(startPath) {
60165
60223
  let current = (0, import_path31.resolve)(startPath);
60166
60224
  while (true) {
60167
- if ((0, import_fs31.existsSync)((0, import_path31.join)(current, WORKSPACE_MARKER2)) && (0, import_fs31.existsSync)((0, import_path31.join)(current, GAL_CODE_PACKAGE_JSON))) {
60225
+ if ((0, import_fs32.existsSync)((0, import_path31.join)(current, WORKSPACE_MARKER2)) && (0, import_fs32.existsSync)((0, import_path31.join)(current, GAL_CODE_PACKAGE_JSON))) {
60168
60226
  return current;
60169
60227
  }
60170
60228
  const parent = (0, import_path31.dirname)(current);
@@ -60196,7 +60254,7 @@ function resolveGalCodeBinaryFromEnv() {
60196
60254
  if (envBinaryPath) {
60197
60255
  const resolvedEnvBinaryPath = (0, import_path31.resolve)(envBinaryPath);
60198
60256
  return {
60199
- binaryPath: (0, import_fs31.existsSync)(resolvedEnvBinaryPath) ? resolvedEnvBinaryPath : null,
60257
+ binaryPath: (0, import_fs32.existsSync)(resolvedEnvBinaryPath) ? resolvedEnvBinaryPath : null,
60200
60258
  workspaceRoot: null,
60201
60259
  searchedRoots: [resolvedEnvBinaryPath],
60202
60260
  source: "env"
@@ -60207,7 +60265,7 @@ function resolveGalCodeBinaryFromEnv() {
60207
60265
  function resolveGalCodeBinaryFromCache(version2, target) {
60208
60266
  const cachedBinaryPath = getCachedBinaryPath(version2, target);
60209
60267
  return {
60210
- binaryPath: (0, import_fs31.existsSync)(cachedBinaryPath) ? cachedBinaryPath : null,
60268
+ binaryPath: (0, import_fs32.existsSync)(cachedBinaryPath) ? cachedBinaryPath : null,
60211
60269
  workspaceRoot: null,
60212
60270
  searchedRoots: [cachedBinaryPath],
60213
60271
  source: "cache"
@@ -60224,7 +60282,7 @@ function resolveGalCodeBinaryFromWorkspace() {
60224
60282
  for (const relativeBinaryPath of GAL_CODE_BINARY_PATHS) {
60225
60283
  const binaryPath = (0, import_path31.join)(workspaceRoot, relativeBinaryPath);
60226
60284
  searchedRoots.push(binaryPath);
60227
- if ((0, import_fs31.existsSync)(binaryPath)) {
60285
+ if ((0, import_fs32.existsSync)(binaryPath)) {
60228
60286
  return {
60229
60287
  binaryPath,
60230
60288
  workspaceRoot,
@@ -60254,8 +60312,8 @@ async function downloadGalCodeBinary(version2, target) {
60254
60312
  const tempDir = (0, import_path31.join)((0, import_os21.tmpdir)(), `gal-code-download-${Date.now()}`);
60255
60313
  const tempAssetPath = (0, import_path31.join)(tempDir, getAssetFileName(version2, target));
60256
60314
  const extractDir = (0, import_path31.join)(tempDir, "extract");
60257
- (0, import_fs31.mkdirSync)(cacheDir, { recursive: true });
60258
- (0, import_fs31.mkdirSync)(tempDir, { recursive: true });
60315
+ (0, import_fs32.mkdirSync)(cacheDir, { recursive: true });
60316
+ (0, import_fs32.mkdirSync)(tempDir, { recursive: true });
60259
60317
  try {
60260
60318
  const headers = {};
60261
60319
  if (process.env.GAL_CODE_DOWNLOAD_TOKEN) {
@@ -60270,21 +60328,21 @@ async function downloadGalCodeBinary(version2, target) {
60270
60328
  throw new Error(`download failed (${response.status} ${response.statusText})`);
60271
60329
  }
60272
60330
  const assetBuffer = Buffer.from(await response.arrayBuffer());
60273
- (0, import_fs31.writeFileSync)(tempAssetPath, assetBuffer);
60331
+ (0, import_fs32.writeFileSync)(tempAssetPath, assetBuffer);
60274
60332
  if (target.archiveExtension === "exe") {
60275
- (0, import_fs31.copyFileSync)(tempAssetPath, cachePath);
60333
+ (0, import_fs32.copyFileSync)(tempAssetPath, cachePath);
60276
60334
  } else {
60277
- (0, import_fs31.mkdirSync)(extractDir, { recursive: true });
60278
- (0, import_child_process12.execFileSync)("tar", ["-xzf", tempAssetPath, "-C", extractDir], { stdio: "pipe" });
60335
+ (0, import_fs32.mkdirSync)(extractDir, { recursive: true });
60336
+ (0, import_child_process13.execFileSync)("tar", ["-xzf", tempAssetPath, "-C", extractDir], { stdio: "pipe" });
60279
60337
  const extractedBinaryPath = (0, import_path31.join)(extractDir, target.binaryName);
60280
- if (!(0, import_fs31.existsSync)(extractedBinaryPath)) {
60338
+ if (!(0, import_fs32.existsSync)(extractedBinaryPath)) {
60281
60339
  throw new Error(`downloaded archive did not contain ${target.binaryName}`);
60282
60340
  }
60283
- (0, import_fs31.copyFileSync)(extractedBinaryPath, cachePath);
60284
- (0, import_fs31.chmodSync)(cachePath, 493);
60341
+ (0, import_fs32.copyFileSync)(extractedBinaryPath, cachePath);
60342
+ (0, import_fs32.chmodSync)(cachePath, 493);
60285
60343
  }
60286
60344
  if (target.archiveExtension === "exe") {
60287
- (0, import_fs31.chmodSync)(cachePath, 493);
60345
+ (0, import_fs32.chmodSync)(cachePath, 493);
60288
60346
  }
60289
60347
  return cachePath;
60290
60348
  } catch (error3) {
@@ -60293,7 +60351,7 @@ async function downloadGalCodeBinary(version2, target) {
60293
60351
  }
60294
60352
  throw error3;
60295
60353
  } finally {
60296
- (0, import_fs31.rmSync)(tempDir, { recursive: true, force: true });
60354
+ (0, import_fs32.rmSync)(tempDir, { recursive: true, force: true });
60297
60355
  }
60298
60356
  }
60299
60357
  async function ensureGalCodeBinary() {
@@ -60303,7 +60361,7 @@ async function ensureGalCodeBinary() {
60303
60361
  }
60304
60362
  const workspaceResolution = resolveGalCodeBinaryFromWorkspace();
60305
60363
  const galEnv = process.env.GAL_ENV?.toLowerCase();
60306
- const prefersWorkspaceBinary = galEnv === "dev" || galEnv === "development" || galEnv === "local" || process.env.NODE_ENV === "development" || cliVersion6.includes("-local") || isWorkspaceLocalGalHomeActive();
60364
+ const prefersWorkspaceBinary = galEnv === "dev" || galEnv === "development" || galEnv === "local" || process.env.NODE_ENV === "development" || cliVersion6.includes("-local") || shouldUseWorkspaceLocalGalHome(process.env);
60307
60365
  if (prefersWorkspaceBinary && workspaceResolution.binaryPath) {
60308
60366
  return workspaceResolution;
60309
60367
  }
@@ -60387,6 +60445,7 @@ async function resolveGalCodeLaunchContext() {
60387
60445
  endpointConfig,
60388
60446
  childEnv: {
60389
60447
  ...process.env,
60448
+ ...resolveGitHubCliBridgeEnv(process.env),
60390
60449
  GAL_CODE_WRAPPED_BY_GAL: "true",
60391
60450
  GAL_CODE_INTERNAL_USER: user.login || "",
60392
60451
  GAL_CODE_INTERNAL_MODEL: endpointConfig.model,
@@ -60488,13 +60547,13 @@ function createCodeCommand() {
60488
60547
  }
60489
60548
  });
60490
60549
  }
60491
- var import_child_process12, import_fs31, import_os21, import_path31, WORKSPACE_MARKER2, GAL_CODE_PACKAGE_PATH, GAL_CODE_PACKAGE_JSON, DEFAULT_GAL_CODE_PROJECT_ID, DEFAULT_GAL_CODE_REGION, DEFAULT_GAL_CODE_ENDPOINT_ID, DEFAULT_GAL_CODE_MODEL, DEFAULT_GAL_CODE_MODEL_ALIAS, DEFAULT_GAL_CODE_GATEWAY_PATH, GAL_CODE_DOWNLOAD_TIMEOUT_MS, GAL_CODE_BINARY_PATHS, cliVersion6, defaultApiUrl6;
60550
+ var import_child_process13, import_fs32, import_os21, import_path31, WORKSPACE_MARKER2, GAL_CODE_PACKAGE_PATH, GAL_CODE_PACKAGE_JSON, DEFAULT_GAL_CODE_PROJECT_ID, DEFAULT_GAL_CODE_REGION, DEFAULT_GAL_CODE_ENDPOINT_ID, DEFAULT_GAL_CODE_MODEL, DEFAULT_GAL_CODE_MODEL_ALIAS, DEFAULT_GAL_CODE_GATEWAY_PATH, GAL_CODE_DOWNLOAD_TIMEOUT_MS, GAL_CODE_BINARY_PATHS, cliVersion6, defaultApiUrl6;
60492
60551
  var init_code = __esm({
60493
60552
  "module_367"() {
60494
60553
  "use strict";
60495
- import_child_process12 = require("child_process");
60554
+ import_child_process13 = require("child_process");
60496
60555
  init_esm();
60497
- import_fs31 = require("fs");
60556
+ import_fs32 = require("fs");
60498
60557
  init_source();
60499
60558
  import_os21 = require("os");
60500
60559
  import_path31 = require("path");
@@ -65916,10 +65975,10 @@ Writing configs to ${outputDir}:
65916
65975
  continue;
65917
65976
  }
65918
65977
  const dir = (0, import_path32.dirname)(fullPath);
65919
- if (!(0, import_fs32.existsSync)(dir)) {
65920
- (0, import_fs32.mkdirSync)(dir, { recursive: true });
65978
+ if (!(0, import_fs33.existsSync)(dir)) {
65979
+ (0, import_fs33.mkdirSync)(dir, { recursive: true });
65921
65980
  }
65922
- (0, import_fs32.writeFileSync)(fullPath, file.content, "utf-8");
65981
+ (0, import_fs33.writeFileSync)(fullPath, file.content, "utf-8");
65923
65982
  writtenFiles.push(relativePath);
65924
65983
  console.log(source_default.green(" \u2713"), relativePath);
65925
65984
  }
@@ -65980,7 +66039,7 @@ Files written to ${outputDir}`));
65980
66039
  });
65981
66040
  return command;
65982
66041
  }
65983
- var import_fs32, import_path32, PLATFORM_DIRS4, CATEGORY_DIRS, FILE_EXTENSIONS;
66042
+ var import_fs33, import_path32, PLATFORM_DIRS4, CATEGORY_DIRS, FILE_EXTENSIONS;
65984
66043
  var init_fetch = __esm({
65985
66044
  "module_386"() {
65986
66045
  "use strict";
@@ -65989,7 +66048,7 @@ var init_fetch = __esm({
65989
66048
  init_ora();
65990
66049
  init_config_manager();
65991
66050
  init_CoreServiceProvider();
65992
- import_fs32 = require("fs");
66051
+ import_fs33 = require("fs");
65993
66052
  import_path32 = require("path");
65994
66053
  init_capability_checker();
65995
66054
  init_dist2();
@@ -66723,14 +66782,14 @@ Task not running: ${taskId}
66723
66782
  });
66724
66783
  return command;
66725
66784
  }
66726
- var import_child_process13, import_fs33, import_path33, DEFAULT_CONFIG, TASK_TEMPLATES, HeadlessRunner;
66785
+ var import_child_process14, import_fs34, import_path33, DEFAULT_CONFIG, TASK_TEMPLATES, HeadlessRunner;
66727
66786
  var init_headless = __esm({
66728
66787
  "module_390"() {
66729
66788
  "use strict";
66730
66789
  init_esm();
66731
66790
  init_source();
66732
- import_child_process13 = require("child_process");
66733
- import_fs33 = require("fs");
66791
+ import_child_process14 = require("child_process");
66792
+ import_fs34 = require("fs");
66734
66793
  import_path33 = require("path");
66735
66794
  DEFAULT_CONFIG = {
66736
66795
  dataDir: ".gal/headless",
@@ -66787,11 +66846,11 @@ var init_headless = __esm({
66787
66846
  ensureDirectories() {
66788
66847
  const dataDir = (0, import_path33.join)(this.projectPath, this.config.dataDir);
66789
66848
  const logDir = (0, import_path33.join)(this.projectPath, this.config.logDir);
66790
- if (!(0, import_fs33.existsSync)(dataDir)) {
66791
- (0, import_fs33.mkdirSync)(dataDir, { recursive: true });
66849
+ if (!(0, import_fs34.existsSync)(dataDir)) {
66850
+ (0, import_fs34.mkdirSync)(dataDir, { recursive: true });
66792
66851
  }
66793
- if (!(0, import_fs33.existsSync)(logDir)) {
66794
- (0, import_fs33.mkdirSync)(logDir, { recursive: true });
66852
+ if (!(0, import_fs34.existsSync)(logDir)) {
66853
+ (0, import_fs34.mkdirSync)(logDir, { recursive: true });
66795
66854
  }
66796
66855
  }
66797
66856
  /**
@@ -66799,9 +66858,9 @@ var init_headless = __esm({
66799
66858
  */
66800
66859
  loadTasks() {
66801
66860
  const tasksFile = (0, import_path33.join)(this.projectPath, this.config.dataDir, "tasks.json");
66802
- if ((0, import_fs33.existsSync)(tasksFile)) {
66861
+ if ((0, import_fs34.existsSync)(tasksFile)) {
66803
66862
  try {
66804
- const data = JSON.parse((0, import_fs33.readFileSync)(tasksFile, "utf-8"));
66863
+ const data = JSON.parse((0, import_fs34.readFileSync)(tasksFile, "utf-8"));
66805
66864
  for (const task of data.tasks || []) {
66806
66865
  this.tasks.set(task.id, {
66807
66866
  ...task,
@@ -66823,7 +66882,7 @@ var init_headless = __esm({
66823
66882
  tasks: Array.from(this.tasks.values()),
66824
66883
  updatedAt: (/* @__PURE__ */ new Date()).toISOString()
66825
66884
  };
66826
- (0, import_fs33.writeFileSync)(tasksFile, JSON.stringify(data, null, 2));
66885
+ (0, import_fs34.writeFileSync)(tasksFile, JSON.stringify(data, null, 2));
66827
66886
  }
66828
66887
  /**
66829
66888
  * Create a new task
@@ -66887,7 +66946,7 @@ var init_headless = __esm({
66887
66946
  console.log(source_default.gray(` Log file: ${logFile}
66888
66947
  `));
66889
66948
  return new Promise((resolve16) => {
66890
- const child = (0, import_child_process13.spawn)("sh", ["-c", task.command], {
66949
+ const child = (0, import_child_process14.spawn)("sh", ["-c", task.command], {
66891
66950
  cwd: this.projectPath,
66892
66951
  env: {
66893
66952
  ...process.env,
@@ -66900,7 +66959,7 @@ var init_headless = __esm({
66900
66959
  const logStream = (data, isError = false) => {
66901
66960
  const text = data.toString();
66902
66961
  const prefix = isError ? "[ERROR] " : "";
66903
- (0, import_fs33.appendFileSync)(logFile, `${(/* @__PURE__ */ new Date()).toISOString()} ${prefix}${text}`);
66962
+ (0, import_fs34.appendFileSync)(logFile, `${(/* @__PURE__ */ new Date()).toISOString()} ${prefix}${text}`);
66904
66963
  if (!task.output) task.output = "";
66905
66964
  task.output += text;
66906
66965
  };
@@ -67143,18 +67202,18 @@ var init_init = __esm({
67143
67202
 
67144
67203
  function readClaudeSettings() {
67145
67204
  try {
67146
- if ((0, import_fs34.existsSync)(SETTINGS_PATH2)) {
67147
- return JSON.parse((0, import_fs34.readFileSync)(SETTINGS_PATH2, "utf-8"));
67205
+ if ((0, import_fs35.existsSync)(SETTINGS_PATH2)) {
67206
+ return JSON.parse((0, import_fs35.readFileSync)(SETTINGS_PATH2, "utf-8"));
67148
67207
  }
67149
67208
  } catch {
67150
67209
  }
67151
67210
  return {};
67152
67211
  }
67153
67212
  function writeClaudeSettings(settings) {
67154
- if (!(0, import_fs34.existsSync)(CLAUDE_DIR2)) {
67155
- (0, import_fs34.mkdirSync)(CLAUDE_DIR2, { recursive: true });
67213
+ if (!(0, import_fs35.existsSync)(CLAUDE_DIR2)) {
67214
+ (0, import_fs35.mkdirSync)(CLAUDE_DIR2, { recursive: true });
67156
67215
  }
67157
- (0, import_fs34.writeFileSync)(SETTINGS_PATH2, JSON.stringify(settings, null, 2), "utf-8");
67216
+ (0, import_fs35.writeFileSync)(SETTINGS_PATH2, JSON.stringify(settings, null, 2), "utf-8");
67158
67217
  }
67159
67218
  function hasMemorySyncHooks(settings) {
67160
67219
  const preToolUse = settings.hooks?.PreToolUse || [];
@@ -67221,8 +67280,8 @@ function installMemorySyncHooks(upgrade) {
67221
67280
  function injectClaudeMdTemplate(projectDir, upgrade) {
67222
67281
  const claudeMdPath = (0, import_path35.join)(projectDir, "CLAUDE.md");
67223
67282
  const result = { injected: false, upgraded: false, path: claudeMdPath };
67224
- if ((0, import_fs34.existsSync)(claudeMdPath)) {
67225
- const content = (0, import_fs34.readFileSync)(claudeMdPath, "utf-8");
67283
+ if ((0, import_fs35.existsSync)(claudeMdPath)) {
67284
+ const content = (0, import_fs35.readFileSync)(claudeMdPath, "utf-8");
67226
67285
  if (content.includes(CLAUDE_MD_MARKER_START)) {
67227
67286
  if (!upgrade) {
67228
67287
  return result;
@@ -67231,16 +67290,16 @@ function injectClaudeMdTemplate(projectDir, upgrade) {
67231
67290
  `${escapeRegex2(CLAUDE_MD_MARKER_START)}[\\s\\S]*?${escapeRegex2(CLAUDE_MD_MARKER_END)}`
67232
67291
  );
67233
67292
  const newContent2 = content.replace(regex2, CLAUDE_MD_TEMPLATE);
67234
- (0, import_fs34.writeFileSync)(claudeMdPath, newContent2, "utf-8");
67293
+ (0, import_fs35.writeFileSync)(claudeMdPath, newContent2, "utf-8");
67235
67294
  result.upgraded = true;
67236
67295
  return result;
67237
67296
  }
67238
67297
  const newContent = content.trimEnd() + "\n\n" + CLAUDE_MD_TEMPLATE + "\n";
67239
- (0, import_fs34.writeFileSync)(claudeMdPath, newContent, "utf-8");
67298
+ (0, import_fs35.writeFileSync)(claudeMdPath, newContent, "utf-8");
67240
67299
  result.injected = true;
67241
67300
  return result;
67242
67301
  }
67243
- (0, import_fs34.writeFileSync)(claudeMdPath, CLAUDE_MD_TEMPLATE + "\n", "utf-8");
67302
+ (0, import_fs35.writeFileSync)(claudeMdPath, CLAUDE_MD_TEMPLATE + "\n", "utf-8");
67244
67303
  result.injected = true;
67245
67304
  return result;
67246
67305
  }
@@ -67372,14 +67431,14 @@ function createInstallCommand() {
67372
67431
  }
67373
67432
  });
67374
67433
  }
67375
- var import_fs34, import_path35, import_os22, INSTALL_METHODS, CLAUDE_DIR2, SETTINGS_PATH2, MEMORY_HOOK_VERSION, MEMORY_HOOK_MARKER, CLAUDE_MD_MARKER_START, CLAUDE_MD_MARKER_END, CLAUDE_MD_TEMPLATE;
67434
+ var import_fs35, import_path35, import_os22, INSTALL_METHODS, CLAUDE_DIR2, SETTINGS_PATH2, MEMORY_HOOK_VERSION, MEMORY_HOOK_MARKER, CLAUDE_MD_MARKER_START, CLAUDE_MD_MARKER_END, CLAUDE_MD_TEMPLATE;
67376
67435
  var init_install2 = __esm({
67377
67436
  "module_392"() {
67378
67437
  "use strict";
67379
67438
  init_esm();
67380
67439
  init_source();
67381
67440
  init_ora();
67382
- import_fs34 = require("fs");
67441
+ import_fs35 = require("fs");
67383
67442
  import_path35 = require("path");
67384
67443
  import_os22 = require("os");
67385
67444
  init_install();
@@ -67980,8 +68039,8 @@ var init_maintain = __esm({
67980
68039
 
67981
68040
  function readSyncState2() {
67982
68041
  try {
67983
- if ((0, import_fs35.existsSync)(SYNC_STATE_FILE)) {
67984
- return JSON.parse((0, import_fs35.readFileSync)(SYNC_STATE_FILE, "utf-8"));
68042
+ if ((0, import_fs36.existsSync)(SYNC_STATE_FILE)) {
68043
+ return JSON.parse((0, import_fs36.readFileSync)(SYNC_STATE_FILE, "utf-8"));
67985
68044
  }
67986
68045
  } catch {
67987
68046
  }
@@ -67989,10 +68048,10 @@ function readSyncState2() {
67989
68048
  }
67990
68049
  function writeSyncState2(state) {
67991
68050
  try {
67992
- if (!(0, import_fs35.existsSync)(SYNC_STATE_DIR)) {
67993
- (0, import_fs35.mkdirSync)(SYNC_STATE_DIR, { recursive: true });
68051
+ if (!(0, import_fs36.existsSync)(SYNC_STATE_DIR)) {
68052
+ (0, import_fs36.mkdirSync)(SYNC_STATE_DIR, { recursive: true });
67994
68053
  }
67995
- (0, import_fs35.writeFileSync)(SYNC_STATE_FILE, JSON.stringify(state, null, 2), "utf-8");
68054
+ (0, import_fs36.writeFileSync)(SYNC_STATE_FILE, JSON.stringify(state, null, 2), "utf-8");
67996
68055
  } catch {
67997
68056
  }
67998
68057
  }
@@ -68027,9 +68086,9 @@ function getLocalMemoryPath() {
68027
68086
  return (0, import_path36.join)(claudeMemoryDir, "MEMORY.md");
68028
68087
  }
68029
68088
  function readMemoryEntries(filePath) {
68030
- if (!(0, import_fs35.existsSync)(filePath)) return [];
68089
+ if (!(0, import_fs36.existsSync)(filePath)) return [];
68031
68090
  try {
68032
- const content = (0, import_fs35.readFileSync)(filePath, "utf-8");
68091
+ const content = (0, import_fs36.readFileSync)(filePath, "utf-8");
68033
68092
  return content.split(/\n\n+/).map((e) => e.trim()).filter((e) => e.length > 0);
68034
68093
  } catch {
68035
68094
  return [];
@@ -68084,10 +68143,10 @@ async function pullMemory(org, repo) {
68084
68143
  return;
68085
68144
  }
68086
68145
  const memoryDir = (0, import_path36.join)(process.cwd(), ".claude", "memory");
68087
- if (!(0, import_fs35.existsSync)(memoryDir)) {
68088
- (0, import_fs35.mkdirSync)(memoryDir, { recursive: true });
68146
+ if (!(0, import_fs36.existsSync)(memoryDir)) {
68147
+ (0, import_fs36.mkdirSync)(memoryDir, { recursive: true });
68089
68148
  }
68090
- const existingContent = (0, import_fs35.existsSync)(memoryPath) ? (0, import_fs35.readFileSync)(memoryPath, "utf-8").trimEnd() : "";
68149
+ const existingContent = (0, import_fs36.existsSync)(memoryPath) ? (0, import_fs36.readFileSync)(memoryPath, "utf-8").trimEnd() : "";
68091
68150
  const newContent = newEntries.map((entry) => {
68092
68151
  const source = entry.source ? ` (from ${entry.source})` : "";
68093
68152
  return `${entry.content}${source} ${GAL_SYNC_MARKER}`;
@@ -68097,7 +68156,7 @@ async function pullMemory(org, repo) {
68097
68156
  ${newContent}
68098
68157
  ` : `${newContent}
68099
68158
  `;
68100
- (0, import_fs35.writeFileSync)(memoryPath, finalContent, "utf-8");
68159
+ (0, import_fs36.writeFileSync)(memoryPath, finalContent, "utf-8");
68101
68160
  state.lastPullTimestamp = (/* @__PURE__ */ new Date()).toISOString();
68102
68161
  writeSyncState2(state);
68103
68162
  } catch {
@@ -68127,8 +68186,8 @@ async function pushMemory(org, repo, files) {
68127
68186
  if (files && files.length > 0) {
68128
68187
  for (const file of files) {
68129
68188
  try {
68130
- if (!(0, import_fs35.existsSync)(file)) continue;
68131
- const stat6 = (0, import_fs35.statSync)(file);
68189
+ if (!(0, import_fs36.existsSync)(file)) continue;
68190
+ const stat6 = (0, import_fs36.statSync)(file);
68132
68191
  const fiveMinAgo = Date.now() - 5 * 60 * 1e3;
68133
68192
  if (stat6.mtimeMs < fiveMinAgo) continue;
68134
68193
  if (stat6.size > 5e4) continue;
@@ -68204,12 +68263,12 @@ function createSyncMemoryCommand() {
68204
68263
  process.exit(0);
68205
68264
  });
68206
68265
  }
68207
- var import_fs35, import_path36, import_os23, SYNC_TIMEOUT_MS, GAL_SYNC_MARKER, SYNC_STATE_DIR, SYNC_STATE_FILE, defaultApiUrl11;
68266
+ var import_fs36, import_path36, import_os23, SYNC_TIMEOUT_MS, GAL_SYNC_MARKER, SYNC_STATE_DIR, SYNC_STATE_FILE, defaultApiUrl11;
68208
68267
  var init_sync_memory = __esm({
68209
68268
  "module_395"() {
68210
68269
  "use strict";
68211
68270
  init_esm();
68212
- import_fs35 = require("fs");
68271
+ import_fs36 = require("fs");
68213
68272
  import_path36 = require("path");
68214
68273
  import_os23 = require("os");
68215
68274
  init_config_manager();
@@ -68256,10 +68315,10 @@ function parseMcpJsonRpcBody(body) {
68256
68315
  return null;
68257
68316
  }
68258
68317
  function readMcpConfig(mcpPath) {
68259
- if (!(0, import_fs36.existsSync)(mcpPath)) {
68318
+ if (!(0, import_fs37.existsSync)(mcpPath)) {
68260
68319
  return { mcpServers: {} };
68261
68320
  }
68262
- const raw = (0, import_fs36.readFileSync)(mcpPath, "utf-8");
68321
+ const raw = (0, import_fs37.readFileSync)(mcpPath, "utf-8");
68263
68322
  const parsed = JSON.parse(raw);
68264
68323
  if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
68265
68324
  throw new Error(`${mcpPath} must be a JSON object`);
@@ -68483,8 +68542,8 @@ function createSetupCommand() {
68483
68542
  process.exit(1);
68484
68543
  }
68485
68544
  const next = upsertHostedGalServer(existing, serverName, apiUrl);
68486
- (0, import_fs36.mkdirSync)(directory, { recursive: true });
68487
- (0, import_fs36.writeFileSync)(mcpPath, JSON.stringify(next, null, 2) + "\n", "utf-8");
68545
+ (0, import_fs37.mkdirSync)(directory, { recursive: true });
68546
+ (0, import_fs37.writeFileSync)(mcpPath, JSON.stringify(next, null, 2) + "\n", "utf-8");
68488
68547
  console.log(source_default.green(`\u2713 Updated ${mcpPath}`));
68489
68548
  console.log(source_default.dim(` mcpServers.${serverName}.url = ${buildMcpUrl(apiUrl)}
68490
68549
  `));
@@ -68533,14 +68592,14 @@ function createDoctorCommand() {
68533
68592
  function createMcpCommand() {
68534
68593
  return new Command("mcp").description("Set up and validate GAL hosted MCP connectivity").addCommand(createSetupCommand()).addCommand(createDoctorCommand()).addCommand(createSyncMemoryCommand());
68535
68594
  }
68536
- var import_fs36, import_path37, DEFAULT_SERVER_NAME, defaultApiUrl12;
68595
+ var import_fs37, import_path37, DEFAULT_SERVER_NAME, defaultApiUrl12;
68537
68596
  var init_mcp = __esm({
68538
68597
  "module_396"() {
68539
68598
  "use strict";
68540
68599
  init_esm();
68541
68600
  init_source();
68542
68601
  init_ora();
68543
- import_fs36 = require("fs");
68602
+ import_fs37 = require("fs");
68544
68603
  import_path37 = require("path");
68545
68604
  init_config_manager();
68546
68605
  init_constants();
@@ -68552,7 +68611,7 @@ var init_mcp = __esm({
68552
68611
 
68553
68612
  function parseClaudeMemoryFile(filePath) {
68554
68613
  try {
68555
- const raw = (0, import_fs37.readFileSync)(filePath, "utf-8");
68614
+ const raw = (0, import_fs38.readFileSync)(filePath, "utf-8");
68556
68615
  const frontmatterMatch = raw.match(/^---\n([\s\S]*?)\n---\n([\s\S]*)$/);
68557
68616
  if (!frontmatterMatch) {
68558
68617
  return {
@@ -68587,7 +68646,7 @@ function discoverMemoryFiles(projectRoot, platform5, includeGlobal) {
68587
68646
  const pattern = PLATFORM_PATTERNS[platform5];
68588
68647
  if (pattern.memoryDir) {
68589
68648
  const memDir = (0, import_path38.join)(projectRoot, pattern.directory, pattern.memoryDir);
68590
- if ((0, import_fs37.existsSync)(memDir) && (0, import_fs37.statSync)(memDir).isDirectory()) {
68649
+ if ((0, import_fs38.existsSync)(memDir) && (0, import_fs38.statSync)(memDir).isDirectory()) {
68591
68650
  scanMemoryDir(memDir, projectRoot, files, false);
68592
68651
  }
68593
68652
  }
@@ -68595,13 +68654,13 @@ function discoverMemoryFiles(projectRoot, platform5, includeGlobal) {
68595
68654
  const home = (0, import_os24.homedir)();
68596
68655
  if (platform5 === "claude") {
68597
68656
  const projectsDir = (0, import_path38.join)(home, ".claude", "projects");
68598
- if ((0, import_fs37.existsSync)(projectsDir)) {
68657
+ if ((0, import_fs38.existsSync)(projectsDir)) {
68599
68658
  try {
68600
- const projectDirs = (0, import_fs37.readdirSync)(projectsDir, { withFileTypes: true });
68659
+ const projectDirs = (0, import_fs38.readdirSync)(projectsDir, { withFileTypes: true });
68601
68660
  for (const projDir of projectDirs) {
68602
68661
  if (!projDir.isDirectory()) continue;
68603
68662
  const memDir = (0, import_path38.join)(projectsDir, projDir.name, "memory");
68604
- if ((0, import_fs37.existsSync)(memDir) && (0, import_fs37.statSync)(memDir).isDirectory()) {
68663
+ if ((0, import_fs38.existsSync)(memDir) && (0, import_fs38.statSync)(memDir).isDirectory()) {
68605
68664
  scanMemoryDir(memDir, home, files, true);
68606
68665
  }
68607
68666
  }
@@ -68610,7 +68669,7 @@ function discoverMemoryFiles(projectRoot, platform5, includeGlobal) {
68610
68669
  }
68611
68670
  } else if (platform5 === "windsurf") {
68612
68671
  const memoriesDir = (0, import_path38.join)(home, ".codeium", "windsurf", "memories");
68613
- if ((0, import_fs37.existsSync)(memoriesDir)) {
68672
+ if ((0, import_fs38.existsSync)(memoriesDir)) {
68614
68673
  scanMemoryDir(memoriesDir, home, files, true);
68615
68674
  }
68616
68675
  }
@@ -68619,7 +68678,7 @@ function discoverMemoryFiles(projectRoot, platform5, includeGlobal) {
68619
68678
  }
68620
68679
  function scanMemoryDir(dir, rootDir, files, isGlobal) {
68621
68680
  try {
68622
- const entries = (0, import_fs37.readdirSync)(dir, { withFileTypes: true });
68681
+ const entries = (0, import_fs38.readdirSync)(dir, { withFileTypes: true });
68623
68682
  for (const entry of entries) {
68624
68683
  const fullPath = (0, import_path38.join)(dir, entry.name);
68625
68684
  if (entry.isDirectory()) {
@@ -68713,7 +68772,7 @@ Notes:
68713
68772
  mem = parseClaudeMemoryFile(file.path);
68714
68773
  } else {
68715
68774
  try {
68716
- const content = (0, import_fs37.readFileSync)(file.path, "utf-8");
68775
+ const content = (0, import_fs38.readFileSync)(file.path, "utf-8");
68717
68776
  mem = {
68718
68777
  name: (0, import_path38.basename)(file.path, ".md").replace(/[-_]/g, "-"),
68719
68778
  description: `Imported from ${source}: ${file.relativePath}`,
@@ -68832,13 +68891,13 @@ Notes:
68832
68891
  });
68833
68892
  return command;
68834
68893
  }
68835
- var import_fs37, import_path38, import_os24;
68894
+ var import_fs38, import_path38, import_os24;
68836
68895
  var init_memory2 = __esm({
68837
68896
  "module_397"() {
68838
68897
  "use strict";
68839
68898
  init_esm();
68840
68899
  init_source();
68841
- import_fs37 = require("fs");
68900
+ import_fs38 = require("fs");
68842
68901
  import_path38 = require("path");
68843
68902
  import_os24 = require("os");
68844
68903
  init_dist2();
@@ -70217,9 +70276,9 @@ async function readLocalConfig() {
70217
70276
  { path: (0, import_path39.join)((0, import_os25.homedir)(), ".gal", "config.yaml"), label: "~/.gal/config.yaml" }
70218
70277
  ];
70219
70278
  for (const source of canonicalSources) {
70220
- if (!(0, import_fs38.existsSync)(source.path)) continue;
70279
+ if (!(0, import_fs39.existsSync)(source.path)) continue;
70221
70280
  try {
70222
- const content = (0, import_fs38.readFileSync)(source.path, "utf-8");
70281
+ const content = (0, import_fs39.readFileSync)(source.path, "utf-8");
70223
70282
  const config2 = (0, import_yaml3.parse)(content);
70224
70283
  return config2;
70225
70284
  } catch (error3) {
@@ -70227,7 +70286,7 @@ async function readLocalConfig() {
70227
70286
  }
70228
70287
  }
70229
70288
  const claudeDir = (0, import_path39.join)(projectRoot, ".claude");
70230
- if (!(0, import_fs38.existsSync)(claudeDir)) {
70289
+ if (!(0, import_fs39.existsSync)(claudeDir)) {
70231
70290
  return null;
70232
70291
  }
70233
70292
  return constructConfigFromClaudeDir(claudeDir);
@@ -70241,9 +70300,9 @@ function constructConfigFromClaudeDir(claudeDir) {
70241
70300
  syncedAt: (/* @__PURE__ */ new Date()).toISOString()
70242
70301
  };
70243
70302
  const settingsPath = (0, import_path39.join)(claudeDir, "settings.json");
70244
- if ((0, import_fs38.existsSync)(settingsPath)) {
70303
+ if ((0, import_fs39.existsSync)(settingsPath)) {
70245
70304
  try {
70246
- const settingsContent = (0, import_fs38.readFileSync)(settingsPath, "utf-8");
70305
+ const settingsContent = (0, import_fs39.readFileSync)(settingsPath, "utf-8");
70247
70306
  let claudeSettings;
70248
70307
  try {
70249
70308
  claudeSettings = JSON.parse(settingsContent);
@@ -70260,23 +70319,23 @@ function constructConfigFromClaudeDir(claudeDir) {
70260
70319
  }
70261
70320
  }
70262
70321
  const claudeMdPath = (0, import_path39.join)(claudeDir, "..", "CLAUDE.md");
70263
- if ((0, import_fs38.existsSync)(claudeMdPath)) {
70322
+ if ((0, import_fs39.existsSync)(claudeMdPath)) {
70264
70323
  try {
70265
- const claudeMdContent = (0, import_fs38.readFileSync)(claudeMdPath, "utf-8");
70324
+ const claudeMdContent = (0, import_fs39.readFileSync)(claudeMdPath, "utf-8");
70266
70325
  config2.instructions = { content: claudeMdContent };
70267
70326
  } catch (error3) {
70268
70327
  console.warn("Failed to read CLAUDE.md:", error3);
70269
70328
  }
70270
70329
  }
70271
70330
  const commandsDir = (0, import_path39.join)(claudeDir, "commands");
70272
- if ((0, import_fs38.existsSync)(commandsDir)) {
70331
+ if ((0, import_fs39.existsSync)(commandsDir)) {
70273
70332
  config2.commands = [];
70274
70333
  try {
70275
70334
  const commandFiles = readDirRecursive(commandsDir, ".md");
70276
70335
  for (const file of commandFiles) {
70277
70336
  const relativePath = file.replace(commandsDir + "/", "");
70278
70337
  const commandName = relativePath.replace(/\.md$/, "").replace(/\//g, ":");
70279
- const content = (0, import_fs38.readFileSync)(file, "utf-8");
70338
+ const content = (0, import_fs39.readFileSync)(file, "utf-8");
70280
70339
  config2.commands.push({
70281
70340
  name: commandName,
70282
70341
  content
@@ -70287,13 +70346,13 @@ function constructConfigFromClaudeDir(claudeDir) {
70287
70346
  }
70288
70347
  }
70289
70348
  const rulesDir = (0, import_path39.join)(claudeDir, "rules");
70290
- if ((0, import_fs38.existsSync)(rulesDir)) {
70349
+ if ((0, import_fs39.existsSync)(rulesDir)) {
70291
70350
  config2.rules = [];
70292
70351
  try {
70293
- const ruleFiles = (0, import_fs38.readdirSync)(rulesDir).filter((f) => f.endsWith(".md"));
70352
+ const ruleFiles = (0, import_fs39.readdirSync)(rulesDir).filter((f) => f.endsWith(".md"));
70294
70353
  for (const file of ruleFiles) {
70295
70354
  const ruleName = file.replace(/\.md$/, "");
70296
- const content = (0, import_fs38.readFileSync)((0, import_path39.join)(rulesDir, file), "utf-8");
70355
+ const content = (0, import_fs39.readFileSync)((0, import_path39.join)(rulesDir, file), "utf-8");
70297
70356
  config2.rules.push({
70298
70357
  name: ruleName,
70299
70358
  content
@@ -70304,12 +70363,12 @@ function constructConfigFromClaudeDir(claudeDir) {
70304
70363
  }
70305
70364
  }
70306
70365
  const hooksDir = (0, import_path39.join)(claudeDir, "hooks");
70307
- if ((0, import_fs38.existsSync)(hooksDir)) {
70366
+ if ((0, import_fs39.existsSync)(hooksDir)) {
70308
70367
  config2.hooks = [];
70309
70368
  try {
70310
- const hookFiles = (0, import_fs38.readdirSync)(hooksDir).filter((f) => f.endsWith(".js") || f.endsWith(".py") || f.endsWith(".sh"));
70369
+ const hookFiles = (0, import_fs39.readdirSync)(hooksDir).filter((f) => f.endsWith(".js") || f.endsWith(".py") || f.endsWith(".sh"));
70311
70370
  for (const file of hookFiles) {
70312
- const content = (0, import_fs38.readFileSync)((0, import_path39.join)(hooksDir, file), "utf-8");
70371
+ const content = (0, import_fs39.readFileSync)((0, import_path39.join)(hooksDir, file), "utf-8");
70313
70372
  config2.hooks.push({
70314
70373
  name: file,
70315
70374
  event: "PreToolUse",
@@ -70322,14 +70381,14 @@ function constructConfigFromClaudeDir(claudeDir) {
70322
70381
  }
70323
70382
  }
70324
70383
  const agentsDir = (0, import_path39.join)(claudeDir, "agents");
70325
- if ((0, import_fs38.existsSync)(agentsDir)) {
70384
+ if ((0, import_fs39.existsSync)(agentsDir)) {
70326
70385
  config2.agents = [];
70327
70386
  try {
70328
70387
  const agentFiles = readDirRecursive(agentsDir, ".md");
70329
70388
  for (const file of agentFiles) {
70330
70389
  const relativePath = file.replace(agentsDir + "/", "");
70331
70390
  const agentName = relativePath.replace(/\.md$/, "").replace(/\//g, ":");
70332
- const content = (0, import_fs38.readFileSync)(file, "utf-8");
70391
+ const content = (0, import_fs39.readFileSync)(file, "utf-8");
70333
70392
  config2.agents.push({
70334
70393
  name: agentName,
70335
70394
  content
@@ -70348,10 +70407,10 @@ function constructConfigFromClaudeDir(claudeDir) {
70348
70407
  function readDirRecursive(dir, extension) {
70349
70408
  const results = [];
70350
70409
  try {
70351
- const files = (0, import_fs38.readdirSync)(dir);
70410
+ const files = (0, import_fs39.readdirSync)(dir);
70352
70411
  for (const file of files) {
70353
70412
  const filePath = (0, import_path39.join)(dir, file);
70354
- const stat6 = (0, import_fs38.statSync)(filePath);
70413
+ const stat6 = (0, import_fs39.statSync)(filePath);
70355
70414
  if (stat6.isDirectory()) {
70356
70415
  results.push(...readDirRecursive(filePath, extension));
70357
70416
  } else if (file.endsWith(extension)) {
@@ -70362,11 +70421,11 @@ function readDirRecursive(dir, extension) {
70362
70421
  }
70363
70422
  return results;
70364
70423
  }
70365
- var import_fs38, import_path39, import_os25, import_yaml3;
70424
+ var import_fs39, import_path39, import_os25, import_yaml3;
70366
70425
  var init_config_reader = __esm({
70367
70426
  "module_406"() {
70368
70427
  "use strict";
70369
- import_fs38 = require("fs");
70428
+ import_fs39 = require("fs");
70370
70429
  import_path39 = require("path");
70371
70430
  import_os25 = require("os");
70372
70431
  init_project_detection();
@@ -70378,10 +70437,10 @@ function getGitRepoInfo() {
70378
70437
  try {
70379
70438
  const projectRoot = findProjectRoot();
70380
70439
  const gitDir = (0, import_path40.join)(projectRoot, ".git");
70381
- if (!(0, import_fs39.existsSync)(gitDir)) {
70440
+ if (!(0, import_fs40.existsSync)(gitDir)) {
70382
70441
  return { isRepo: false };
70383
70442
  }
70384
- const remoteUrl = (0, import_child_process14.execSync)("git remote get-url origin", {
70443
+ const remoteUrl = (0, import_child_process15.execSync)("git remote get-url origin", {
70385
70444
  cwd: projectRoot,
70386
70445
  encoding: "utf-8"
70387
70446
  }).trim();
@@ -70511,7 +70570,7 @@ function createProposeCommand() {
70511
70570
  });
70512
70571
  return command;
70513
70572
  }
70514
- var import_fs39, import_path40, import_child_process14;
70573
+ var import_fs40, import_path40, import_child_process15;
70515
70574
  var init_propose = __esm({
70516
70575
  "module_407"() {
70517
70576
  "use strict";
@@ -70522,9 +70581,9 @@ var init_propose = __esm({
70522
70581
  init_CoreServiceProvider();
70523
70582
  init_config_reader();
70524
70583
  init_project_detection();
70525
- import_fs39 = require("fs");
70584
+ import_fs40 = require("fs");
70526
70585
  import_path40 = require("path");
70527
- import_child_process14 = require("child_process");
70586
+ import_child_process15 = require("child_process");
70528
70587
  }
70529
70588
  });
70530
70589
 
@@ -71205,7 +71264,7 @@ function createAddCommand() {
71205
71264
  let prompt3 = promptArg;
71206
71265
  if (options.promptFile) {
71207
71266
  try {
71208
- prompt3 = (0, import_fs40.readFileSync)(options.promptFile, "utf-8").trim();
71267
+ prompt3 = (0, import_fs41.readFileSync)(options.promptFile, "utf-8").trim();
71209
71268
  } catch (err) {
71210
71269
  console.error(source_default.red(`Error reading prompt file: ${err instanceof Error ? err.message : String(err)}`));
71211
71270
  process.exit(1);
@@ -71452,14 +71511,14 @@ function createCancelCommand() {
71452
71511
  }
71453
71512
  });
71454
71513
  }
71455
- var import_fs40, defaultApiUrl14, PRIORITY_LABELS, PRIORITY_COLORS, STATUS_COLORS;
71514
+ var import_fs41, defaultApiUrl14, PRIORITY_LABELS, PRIORITY_COLORS, STATUS_COLORS;
71456
71515
  var init_queue_mgmt = __esm({
71457
71516
  "module_410"() {
71458
71517
  "use strict";
71459
71518
  init_esm();
71460
71519
  init_source();
71461
71520
  init_ora();
71462
- import_fs40 = require("fs");
71521
+ import_fs41 = require("fs");
71463
71522
  init_constants();
71464
71523
  init_config_manager();
71465
71524
  init_client();
@@ -71702,11 +71761,11 @@ function createSeedCommand() {
71702
71761
  }
71703
71762
  let template = options.template;
71704
71763
  if (options.templateFile) {
71705
- if (!(0, import_fs41.existsSync)(options.templateFile)) {
71764
+ if (!(0, import_fs42.existsSync)(options.templateFile)) {
71706
71765
  console.error(source_default.red(`Error: Template file not found: ${options.templateFile}`));
71707
71766
  process.exit(1);
71708
71767
  }
71709
- template = (0, import_fs41.readFileSync)(options.templateFile, "utf-8").trim();
71768
+ template = (0, import_fs42.readFileSync)(options.templateFile, "utf-8").trim();
71710
71769
  }
71711
71770
  const config2 = ConfigManager.load();
71712
71771
  const apiUrl = config2.apiUrl ?? process.env.GAL_API_URL ?? defaultApiUrl15;
@@ -71722,13 +71781,13 @@ function createSeedCommand() {
71722
71781
  });
71723
71782
  if (options.file) {
71724
71783
  const filePath = options.file;
71725
- if (!(0, import_fs41.existsSync)(filePath)) {
71784
+ if (!(0, import_fs42.existsSync)(filePath)) {
71726
71785
  console.error(source_default.red(`Error: File not found: ${filePath}`));
71727
71786
  process.exit(1);
71728
71787
  }
71729
71788
  let items = [];
71730
71789
  try {
71731
- const raw = (0, import_fs41.readFileSync)(filePath, "utf-8");
71790
+ const raw = (0, import_fs42.readFileSync)(filePath, "utf-8");
71732
71791
  const parsed = JSON.parse(raw);
71733
71792
  if (!Array.isArray(parsed)) {
71734
71793
  console.error(source_default.red("Error: JSON file must contain an array of work items."));
@@ -71893,14 +71952,14 @@ function createQueueCommand() {
71893
71952
  cmd.addCommand(createSeedCommand());
71894
71953
  return cmd;
71895
71954
  }
71896
- var import_fs41, defaultApiUrl15, GH_API_BASE, DEFAULT_TEMPLATE_BY_LABEL, DEFAULT_TEMPLATE;
71955
+ var import_fs42, defaultApiUrl15, GH_API_BASE, DEFAULT_TEMPLATE_BY_LABEL, DEFAULT_TEMPLATE;
71897
71956
  var init_queue_seed = __esm({
71898
71957
  "module_411"() {
71899
71958
  "use strict";
71900
71959
  init_esm();
71901
71960
  init_source();
71902
71961
  init_ora();
71903
- import_fs41 = require("fs");
71962
+ import_fs42 = require("fs");
71904
71963
  init_config_manager();
71905
71964
  init_constants();
71906
71965
  init_client();
@@ -72089,7 +72148,7 @@ function parseFrontmatter(content) {
72089
72148
  };
72090
72149
  }
72091
72150
  function parseCommandFile(filePath) {
72092
- const content = (0, import_fs42.readFileSync)(filePath, "utf-8");
72151
+ const content = (0, import_fs43.readFileSync)(filePath, "utf-8");
72093
72152
  const { metadata, body } = parseFrontmatter(content);
72094
72153
  const fileName = (0, import_path41.basename)(filePath);
72095
72154
  const name = (0, import_path41.basename)(filePath, (0, import_path41.extname)(filePath));
@@ -72105,10 +72164,10 @@ function parseCommandFile(filePath) {
72105
72164
  function findCommandFiles(dir, recursive = true) {
72106
72165
  const files = [];
72107
72166
  try {
72108
- const entries = (0, import_fs42.readdirSync)(dir);
72167
+ const entries = (0, import_fs43.readdirSync)(dir);
72109
72168
  for (const entry of entries) {
72110
72169
  const fullPath = (0, import_path41.join)(dir, entry);
72111
- const stats = (0, import_fs42.statSync)(fullPath);
72170
+ const stats = (0, import_fs43.statSync)(fullPath);
72112
72171
  if (stats.isDirectory()) {
72113
72172
  if (entry.startsWith(".") || entry === "node_modules" || entry === ".templates") {
72114
72173
  continue;
@@ -72183,11 +72242,11 @@ function substituteArguments(commandBody, args2) {
72183
72242
  }
72184
72243
  return result;
72185
72244
  }
72186
- var import_fs42, import_path41;
72245
+ var import_fs43, import_path41;
72187
72246
  var init_command_parser = __esm({
72188
72247
  "module_413"() {
72189
72248
  "use strict";
72190
- import_fs42 = require("fs");
72249
+ import_fs43 = require("fs");
72191
72250
  import_path41 = require("path");
72192
72251
  }
72193
72252
  });
@@ -72428,11 +72487,11 @@ var init_headless_executor = __esm({
72428
72487
 
72429
72488
  function findCommandsDirectory() {
72430
72489
  const localCommandsDir = (0, import_path42.join)(process.cwd(), ".claude", "commands");
72431
- if ((0, import_fs43.existsSync)(localCommandsDir)) {
72490
+ if ((0, import_fs44.existsSync)(localCommandsDir)) {
72432
72491
  return localCommandsDir;
72433
72492
  }
72434
72493
  const homeCommandsDir = (0, import_path42.join)((0, import_os26.homedir)(), ".claude", "commands");
72435
- if ((0, import_fs43.existsSync)(homeCommandsDir)) {
72494
+ if ((0, import_fs44.existsSync)(homeCommandsDir)) {
72436
72495
  return homeCommandsDir;
72437
72496
  }
72438
72497
  return null;
@@ -72520,7 +72579,7 @@ async function handleRunCommand(commandName, args2, options) {
72520
72579
  let commandsDir = options.dir || findCommandsDirectory();
72521
72580
  let command;
72522
72581
  if (options.file) {
72523
- if (!(0, import_fs43.existsSync)(options.file)) {
72582
+ if (!(0, import_fs44.existsSync)(options.file)) {
72524
72583
  console.error(source_default.red(`Error: Command file not found: ${options.file}`));
72525
72584
  process.exit(1);
72526
72585
  }
@@ -72602,7 +72661,7 @@ Executing command: ${command.name}`));
72602
72661
  throw error3;
72603
72662
  }
72604
72663
  }
72605
- var import_os26, import_path42, import_fs43;
72664
+ var import_os26, import_path42, import_fs44;
72606
72665
  var init_run = __esm({
72607
72666
  "module_415"() {
72608
72667
  "use strict";
@@ -72611,15 +72670,15 @@ var init_run = __esm({
72611
72670
  init_ora();
72612
72671
  import_os26 = require("os");
72613
72672
  import_path42 = require("path");
72614
- import_fs43 = require("fs");
72673
+ import_fs44 = require("fs");
72615
72674
  init_command_parser();
72616
72675
  init_headless_executor();
72617
72676
  }
72618
72677
  });
72619
72678
 
72620
72679
  function ensureDir() {
72621
- if (!(0, import_fs44.existsSync)(DESIGN_PROJECTS_DIR)) {
72622
- (0, import_fs44.mkdirSync)(DESIGN_PROJECTS_DIR, { recursive: true });
72680
+ if (!(0, import_fs45.existsSync)(DESIGN_PROJECTS_DIR)) {
72681
+ (0, import_fs45.mkdirSync)(DESIGN_PROJECTS_DIR, { recursive: true });
72623
72682
  }
72624
72683
  }
72625
72684
  function projectPath(id) {
@@ -72627,21 +72686,21 @@ function projectPath(id) {
72627
72686
  }
72628
72687
  function saveProject(project) {
72629
72688
  ensureDir();
72630
- (0, import_fs44.writeFileSync)(projectPath(project.id), JSON.stringify(project, null, 2));
72689
+ (0, import_fs45.writeFileSync)(projectPath(project.id), JSON.stringify(project, null, 2));
72631
72690
  }
72632
72691
  function loadProject(id) {
72633
72692
  const p = projectPath(id);
72634
- if (!(0, import_fs44.existsSync)(p)) return null;
72693
+ if (!(0, import_fs45.existsSync)(p)) return null;
72635
72694
  try {
72636
- return JSON.parse((0, import_fs44.readFileSync)(p, "utf-8"));
72695
+ return JSON.parse((0, import_fs45.readFileSync)(p, "utf-8"));
72637
72696
  } catch {
72638
72697
  return null;
72639
72698
  }
72640
72699
  }
72641
72700
  function getActiveId() {
72642
- if (!(0, import_fs44.existsSync)(ACTIVE_FILE)) return null;
72701
+ if (!(0, import_fs45.existsSync)(ACTIVE_FILE)) return null;
72643
72702
  try {
72644
- const data = JSON.parse((0, import_fs44.readFileSync)(ACTIVE_FILE, "utf-8"));
72703
+ const data = JSON.parse((0, import_fs45.readFileSync)(ACTIVE_FILE, "utf-8"));
72645
72704
  return data.id ?? null;
72646
72705
  } catch {
72647
72706
  return null;
@@ -72649,7 +72708,7 @@ function getActiveId() {
72649
72708
  }
72650
72709
  function setActiveId(id) {
72651
72710
  ensureDir();
72652
- (0, import_fs44.writeFileSync)(ACTIVE_FILE, JSON.stringify({ id }, null, 2));
72711
+ (0, import_fs45.writeFileSync)(ACTIVE_FILE, JSON.stringify({ id }, null, 2));
72653
72712
  }
72654
72713
  function getActiveProject() {
72655
72714
  const id = getActiveId();
@@ -72770,7 +72829,7 @@ function handleStatus(options) {
72770
72829
  project = getActiveProject();
72771
72830
  if (!project) {
72772
72831
  ensureDir();
72773
- const files = (0, import_fs44.readdirSync)(DESIGN_PROJECTS_DIR).filter(
72832
+ const files = (0, import_fs45.readdirSync)(DESIGN_PROJECTS_DIR).filter(
72774
72833
  (f) => f.endsWith(".json") && f !== "active.json"
72775
72834
  );
72776
72835
  if (files.length === 0) {
@@ -72885,7 +72944,7 @@ function handleSync() {
72885
72944
  const project = getActiveProject();
72886
72945
  if (!project) {
72887
72946
  ensureDir();
72888
- (0, import_fs44.writeFileSync)(
72947
+ (0, import_fs45.writeFileSync)(
72889
72948
  (0, import_path43.join)(DESIGN_PROJECTS_DIR, "extension-sync.json"),
72890
72949
  JSON.stringify(null, null, 2)
72891
72950
  );
@@ -72903,7 +72962,7 @@ function handleSync() {
72903
72962
  completedScenes: done
72904
72963
  };
72905
72964
  ensureDir();
72906
- (0, import_fs44.writeFileSync)(
72965
+ (0, import_fs45.writeFileSync)(
72907
72966
  (0, import_path43.join)(DESIGN_PROJECTS_DIR, "extension-sync.json"),
72908
72967
  JSON.stringify(summary, null, 2)
72909
72968
  );
@@ -72948,7 +73007,7 @@ function createRunDesignCommand() {
72948
73007
  runDesign.addCommand(syncCmd);
72949
73008
  return runDesign;
72950
73009
  }
72951
- var import_os27, import_path43, import_fs44, DESIGN_PROJECTS_DIR, ACTIVE_FILE, IMAGE_STATUS_ICON, VIDEO_STATUS_ICON;
73010
+ var import_os27, import_path43, import_fs45, DESIGN_PROJECTS_DIR, ACTIVE_FILE, IMAGE_STATUS_ICON, VIDEO_STATUS_ICON;
72952
73011
  var init_run_design = __esm({
72953
73012
  "module_416"() {
72954
73013
  "use strict";
@@ -72956,7 +73015,7 @@ var init_run_design = __esm({
72956
73015
  init_source();
72957
73016
  import_os27 = require("os");
72958
73017
  import_path43 = require("path");
72959
- import_fs44 = require("fs");
73018
+ import_fs45 = require("fs");
72960
73019
  DESIGN_PROJECTS_DIR = (0, import_path43.join)((0, import_os27.homedir)(), ".gal", "design-projects");
72961
73020
  ACTIVE_FILE = (0, import_path43.join)(DESIGN_PROJECTS_DIR, "active.json");
72962
73021
  IMAGE_STATUS_ICON = {
@@ -72981,101 +73040,101 @@ function scanPlatform(rootDir, pattern) {
72981
73040
  const platformDir = (0, import_path44.join)(rootDir, pattern.directory);
72982
73041
  if (pattern.settingsFile) {
72983
73042
  const settingsPath = (0, import_path44.join)(platformDir, pattern.settingsFile);
72984
- if ((0, import_fs45.existsSync)(settingsPath)) {
73043
+ if ((0, import_fs46.existsSync)(settingsPath)) {
72985
73044
  configs.push({
72986
73045
  platform: platform5,
72987
73046
  type: "settings",
72988
73047
  name: pattern.settingsFile,
72989
73048
  path: settingsPath,
72990
73049
  relativePath: (0, import_path44.relative)(rootDir, settingsPath),
72991
- sizeBytes: (0, import_fs45.statSync)(settingsPath).size
73050
+ sizeBytes: (0, import_fs46.statSync)(settingsPath).size
72992
73051
  });
72993
73052
  }
72994
73053
  }
72995
73054
  if (pattern.configFile) {
72996
73055
  const configPath = (0, import_path44.join)(platformDir, pattern.configFile);
72997
- if ((0, import_fs45.existsSync)(configPath)) {
73056
+ if ((0, import_fs46.existsSync)(configPath)) {
72998
73057
  configs.push({
72999
73058
  platform: platform5,
73000
73059
  type: "settings",
73001
73060
  name: pattern.configFile,
73002
73061
  path: configPath,
73003
73062
  relativePath: (0, import_path44.relative)(rootDir, configPath),
73004
- sizeBytes: (0, import_fs45.statSync)(configPath).size
73063
+ sizeBytes: (0, import_fs46.statSync)(configPath).size
73005
73064
  });
73006
73065
  }
73007
73066
  }
73008
73067
  if (pattern.rulesDir) {
73009
73068
  const rulesDir = (0, import_path44.join)(platformDir, pattern.rulesDir);
73010
- if ((0, import_fs45.existsSync)(rulesDir) && (0, import_fs45.statSync)(rulesDir).isDirectory()) {
73069
+ if ((0, import_fs46.existsSync)(rulesDir) && (0, import_fs46.statSync)(rulesDir).isDirectory()) {
73011
73070
  scanDir(rulesDir, rootDir, platform5, "rules", pattern.ruleExtensions, configs);
73012
73071
  }
73013
73072
  }
73014
73073
  if (pattern.rulesFile) {
73015
73074
  const rulesPath = (0, import_path44.join)(platformDir, pattern.rulesFile);
73016
- if ((0, import_fs45.existsSync)(rulesPath)) {
73075
+ if ((0, import_fs46.existsSync)(rulesPath)) {
73017
73076
  configs.push({
73018
73077
  platform: platform5,
73019
73078
  type: "rules",
73020
73079
  name: pattern.rulesFile,
73021
73080
  path: rulesPath,
73022
73081
  relativePath: (0, import_path44.relative)(rootDir, rulesPath),
73023
- sizeBytes: (0, import_fs45.statSync)(rulesPath).size
73082
+ sizeBytes: (0, import_fs46.statSync)(rulesPath).size
73024
73083
  });
73025
73084
  }
73026
73085
  }
73027
73086
  if (pattern.commandsDir) {
73028
73087
  const commandsDir = (0, import_path44.join)(platformDir, pattern.commandsDir);
73029
- if ((0, import_fs45.existsSync)(commandsDir) && (0, import_fs45.statSync)(commandsDir).isDirectory()) {
73088
+ if ((0, import_fs46.existsSync)(commandsDir) && (0, import_fs46.statSync)(commandsDir).isDirectory()) {
73030
73089
  scanDir(commandsDir, rootDir, platform5, "commands", [".md", ".toml"], configs);
73031
73090
  }
73032
73091
  }
73033
73092
  if (pattern.hooksDir) {
73034
73093
  const hooksDir = (0, import_path44.join)(platformDir, pattern.hooksDir);
73035
- if ((0, import_fs45.existsSync)(hooksDir) && (0, import_fs45.statSync)(hooksDir).isDirectory()) {
73094
+ if ((0, import_fs46.existsSync)(hooksDir) && (0, import_fs46.statSync)(hooksDir).isDirectory()) {
73036
73095
  scanDir(hooksDir, rootDir, platform5, "hooks", [".md", ".json", ".sh", ".ts", ".js"], configs);
73037
73096
  }
73038
73097
  }
73039
73098
  if (pattern.hooksConfigFile) {
73040
73099
  const hooksConfigPath = (0, import_path44.join)(platformDir, pattern.hooksConfigFile);
73041
- if ((0, import_fs45.existsSync)(hooksConfigPath)) {
73100
+ if ((0, import_fs46.existsSync)(hooksConfigPath)) {
73042
73101
  configs.push({
73043
73102
  platform: platform5,
73044
73103
  type: "hooks",
73045
73104
  name: pattern.hooksConfigFile,
73046
73105
  path: hooksConfigPath,
73047
73106
  relativePath: (0, import_path44.relative)(rootDir, hooksConfigPath),
73048
- sizeBytes: (0, import_fs45.statSync)(hooksConfigPath).size
73107
+ sizeBytes: (0, import_fs46.statSync)(hooksConfigPath).size
73049
73108
  });
73050
73109
  }
73051
73110
  }
73052
73111
  if (pattern.agentsDir) {
73053
73112
  const agentsDir = (0, import_path44.join)(platformDir, pattern.agentsDir);
73054
- if ((0, import_fs45.existsSync)(agentsDir) && (0, import_fs45.statSync)(agentsDir).isDirectory()) {
73113
+ if ((0, import_fs46.existsSync)(agentsDir) && (0, import_fs46.statSync)(agentsDir).isDirectory()) {
73055
73114
  scanDir(agentsDir, rootDir, platform5, "agents", [".md", ".toml", ".agent.md"], configs);
73056
73115
  }
73057
73116
  }
73058
73117
  if (pattern.skillsDir) {
73059
73118
  const skillsDir = (0, import_path44.join)(platformDir, pattern.skillsDir);
73060
- if ((0, import_fs45.existsSync)(skillsDir) && (0, import_fs45.statSync)(skillsDir).isDirectory()) {
73119
+ if ((0, import_fs46.existsSync)(skillsDir) && (0, import_fs46.statSync)(skillsDir).isDirectory()) {
73061
73120
  scanDir(skillsDir, rootDir, platform5, "skills", [".md"], configs);
73062
73121
  }
73063
73122
  }
73064
73123
  if (pattern.policiesDir) {
73065
73124
  const policiesDir = (0, import_path44.join)(platformDir, pattern.policiesDir);
73066
- if ((0, import_fs45.existsSync)(policiesDir) && (0, import_fs45.statSync)(policiesDir).isDirectory()) {
73125
+ if ((0, import_fs46.existsSync)(policiesDir) && (0, import_fs46.statSync)(policiesDir).isDirectory()) {
73067
73126
  scanDir(policiesDir, rootDir, platform5, "policies", [".toml", ".md"], configs);
73068
73127
  }
73069
73128
  }
73070
73129
  if (pattern.workflowsDir) {
73071
73130
  const workflowsDir = (0, import_path44.join)(platformDir, pattern.workflowsDir);
73072
- if ((0, import_fs45.existsSync)(workflowsDir) && (0, import_fs45.statSync)(workflowsDir).isDirectory()) {
73131
+ if ((0, import_fs46.existsSync)(workflowsDir) && (0, import_fs46.statSync)(workflowsDir).isDirectory()) {
73073
73132
  scanDir(workflowsDir, rootDir, platform5, "workflows", [".md"], configs);
73074
73133
  }
73075
73134
  }
73076
73135
  if (pattern.promptsDir) {
73077
73136
  const promptsDir = (0, import_path44.join)(platformDir, pattern.promptsDir);
73078
- if ((0, import_fs45.existsSync)(promptsDir) && (0, import_fs45.statSync)(promptsDir).isDirectory()) {
73137
+ if ((0, import_fs46.existsSync)(promptsDir) && (0, import_fs46.statSync)(promptsDir).isDirectory()) {
73079
73138
  scanDir(promptsDir, rootDir, platform5, "prompts", [".prompt.md", ".md"], configs);
73080
73139
  }
73081
73140
  }
@@ -73096,57 +73155,57 @@ function scanPlatform(rootDir, pattern) {
73096
73155
  if (fileName) {
73097
73156
  const rootPath = (0, import_path44.join)(rootDir, fileName);
73098
73157
  const platformPath = (0, import_path44.join)(platformDir, fileName);
73099
- if ((0, import_fs45.existsSync)(rootPath)) {
73158
+ if ((0, import_fs46.existsSync)(rootPath)) {
73100
73159
  configs.push({
73101
73160
  platform: platform5,
73102
73161
  type,
73103
73162
  name: fileName,
73104
73163
  path: rootPath,
73105
73164
  relativePath: (0, import_path44.relative)(rootDir, rootPath),
73106
- sizeBytes: (0, import_fs45.statSync)(rootPath).size
73165
+ sizeBytes: (0, import_fs46.statSync)(rootPath).size
73107
73166
  });
73108
- } else if ((0, import_fs45.existsSync)(platformPath) && platformPath !== rootPath) {
73167
+ } else if ((0, import_fs46.existsSync)(platformPath) && platformPath !== rootPath) {
73109
73168
  configs.push({
73110
73169
  platform: platform5,
73111
73170
  type,
73112
73171
  name: fileName,
73113
73172
  path: platformPath,
73114
73173
  relativePath: (0, import_path44.relative)(rootDir, platformPath),
73115
- sizeBytes: (0, import_fs45.statSync)(platformPath).size
73174
+ sizeBytes: (0, import_fs46.statSync)(platformPath).size
73116
73175
  });
73117
73176
  }
73118
73177
  }
73119
73178
  }
73120
73179
  if (pattern.mcpFile) {
73121
73180
  const mcpPath = (0, import_path44.join)(rootDir, pattern.mcpFile);
73122
- if ((0, import_fs45.existsSync)(mcpPath)) {
73181
+ if ((0, import_fs46.existsSync)(mcpPath)) {
73123
73182
  configs.push({
73124
73183
  platform: platform5,
73125
73184
  type: "mcp",
73126
73185
  name: pattern.mcpFile,
73127
73186
  path: mcpPath,
73128
73187
  relativePath: (0, import_path44.relative)(rootDir, mcpPath),
73129
- sizeBytes: (0, import_fs45.statSync)(mcpPath).size
73188
+ sizeBytes: (0, import_fs46.statSync)(mcpPath).size
73130
73189
  });
73131
73190
  }
73132
73191
  }
73133
73192
  if (pattern.memoryDir) {
73134
73193
  const memDir = (0, import_path44.join)(platformDir, pattern.memoryDir);
73135
- if ((0, import_fs45.existsSync)(memDir) && (0, import_fs45.statSync)(memDir).isDirectory()) {
73194
+ if ((0, import_fs46.existsSync)(memDir) && (0, import_fs46.statSync)(memDir).isDirectory()) {
73136
73195
  const exts = pattern.memoryExtensions || [".md"];
73137
73196
  scanDir(memDir, rootDir, platform5, "memory", exts, configs);
73138
73197
  }
73139
73198
  }
73140
73199
  if (pattern.cliConfigFile) {
73141
73200
  const cliPath = (0, import_path44.join)(platformDir, pattern.cliConfigFile);
73142
- if ((0, import_fs45.existsSync)(cliPath)) {
73201
+ if ((0, import_fs46.existsSync)(cliPath)) {
73143
73202
  configs.push({
73144
73203
  platform: platform5,
73145
73204
  type: "settings",
73146
73205
  name: pattern.cliConfigFile,
73147
73206
  path: cliPath,
73148
73207
  relativePath: (0, import_path44.relative)(rootDir, cliPath),
73149
- sizeBytes: (0, import_fs45.statSync)(cliPath).size
73208
+ sizeBytes: (0, import_fs46.statSync)(cliPath).size
73150
73209
  });
73151
73210
  }
73152
73211
  }
@@ -73154,7 +73213,7 @@ function scanPlatform(rootDir, pattern) {
73154
73213
  }
73155
73214
  function scanDir(dir, rootDir, platform5, type, extensions, configs) {
73156
73215
  try {
73157
- const entries = (0, import_fs45.readdirSync)(dir, { withFileTypes: true });
73216
+ const entries = (0, import_fs46.readdirSync)(dir, { withFileTypes: true });
73158
73217
  for (const entry of entries) {
73159
73218
  const fullPath = (0, import_path44.join)(dir, entry.name);
73160
73219
  if (entry.isDirectory()) {
@@ -73168,7 +73227,7 @@ function scanDir(dir, rootDir, platform5, type, extensions, configs) {
73168
73227
  name: entry.name,
73169
73228
  path: fullPath,
73170
73229
  relativePath: (0, import_path44.relative)(rootDir, fullPath),
73171
- sizeBytes: (0, import_fs45.statSync)(fullPath).size
73230
+ sizeBytes: (0, import_fs46.statSync)(fullPath).size
73172
73231
  });
73173
73232
  }
73174
73233
  }
@@ -73185,7 +73244,7 @@ function createScanCommand() {
73185
73244
  const command = new Command("scan");
73186
73245
  command.description("Scan local directory for AI agent configurations (no auth required)").option("--path <path>", "Directory to scan (default: current directory or project root)").option("-p, --platform <platform>", `Filter by platform (${ALL_PLATFORM_IDS.join(", ")})`).option("--format <format>", "Output format: table (default) or json", "table").option("-r, --recursive", "Scan subdirectories for additional projects").option("--include-global", "Include global/home-directory memory locations").action(async (options) => {
73187
73246
  const targetDir = options.path ? options.path : findProjectRoot(process.cwd());
73188
- if (!(0, import_fs45.existsSync)(targetDir)) {
73247
+ if (!(0, import_fs46.existsSync)(targetDir)) {
73189
73248
  console.error(source_default.red(`Directory not found: ${targetDir}`));
73190
73249
  process.exit(1);
73191
73250
  }
@@ -73221,7 +73280,7 @@ function createScanCommand() {
73221
73280
  if (platformFilter && loc.platform !== platformFilter) continue;
73222
73281
  for (const relPath of loc.paths) {
73223
73282
  const globalDir = (0, import_path44.join)(home, relPath);
73224
- if (!(0, import_fs45.existsSync)(globalDir) || !(0, import_fs45.statSync)(globalDir).isDirectory()) continue;
73283
+ if (!(0, import_fs46.existsSync)(globalDir) || !(0, import_fs46.statSync)(globalDir).isDirectory()) continue;
73225
73284
  const globalConfigs = [];
73226
73285
  scanDir(globalDir, home, loc.platform, "memory", loc.extensions, globalConfigs);
73227
73286
  if (globalConfigs.length > 0) {
@@ -73297,13 +73356,13 @@ function createScanCommand() {
73297
73356
  });
73298
73357
  return command;
73299
73358
  }
73300
- var import_fs45, import_path44, import_os28, GLOBAL_MEMORY_LOCATIONS, PLATFORM_LABELS, PLATFORM_COLORS;
73359
+ var import_fs46, import_path44, import_os28, GLOBAL_MEMORY_LOCATIONS, PLATFORM_LABELS, PLATFORM_COLORS;
73301
73360
  var init_scan = __esm({
73302
73361
  "module_417"() {
73303
73362
  "use strict";
73304
73363
  init_esm();
73305
73364
  init_source();
73306
- import_fs45 = require("fs");
73365
+ import_fs46 = require("fs");
73307
73366
  import_path44 = require("path");
73308
73367
  import_os28 = require("os");
73309
73368
  init_dist2();
@@ -74295,7 +74354,7 @@ function scanDirectory(dir, maxDepth = 6) {
74295
74354
  if (depth > maxDepth) return;
74296
74355
  let entries;
74297
74356
  try {
74298
- entries = (0, import_fs46.readdirSync)(currentDir);
74357
+ entries = (0, import_fs47.readdirSync)(currentDir);
74299
74358
  } catch {
74300
74359
  return;
74301
74360
  }
@@ -74304,7 +74363,7 @@ function scanDirectory(dir, maxDepth = 6) {
74304
74363
  const fullPath = (0, import_path46.join)(currentDir, entry);
74305
74364
  let stat6;
74306
74365
  try {
74307
- stat6 = (0, import_fs46.statSync)(fullPath);
74366
+ stat6 = (0, import_fs47.statSync)(fullPath);
74308
74367
  } catch {
74309
74368
  continue;
74310
74369
  }
@@ -74334,7 +74393,7 @@ function findSpecFiles(dir) {
74334
74393
  if (depth > 4) return;
74335
74394
  let entries;
74336
74395
  try {
74337
- entries = (0, import_fs46.readdirSync)(currentDir);
74396
+ entries = (0, import_fs47.readdirSync)(currentDir);
74338
74397
  } catch {
74339
74398
  return;
74340
74399
  }
@@ -74342,7 +74401,7 @@ function findSpecFiles(dir) {
74342
74401
  const fullPath = (0, import_path46.join)(currentDir, entry);
74343
74402
  let stat6;
74344
74403
  try {
74345
- stat6 = (0, import_fs46.statSync)(fullPath);
74404
+ stat6 = (0, import_fs47.statSync)(fullPath);
74346
74405
  } catch {
74347
74406
  continue;
74348
74407
  }
@@ -74391,8 +74450,8 @@ function runChecks(basePath) {
74391
74450
  const weight2 = 25;
74392
74451
  maxScore += weight2;
74393
74452
  const hasSpecs = specFiles.length > 0;
74394
- const hasClaudeDir = (0, import_fs46.existsSync)((0, import_path46.join)(basePath, ".claude"));
74395
- const hasSpecsDir = (0, import_fs46.existsSync)((0, import_path46.join)(basePath, "specs"));
74453
+ const hasClaudeDir = (0, import_fs47.existsSync)((0, import_path46.join)(basePath, ".claude"));
74454
+ const hasSpecsDir = (0, import_fs47.existsSync)((0, import_path46.join)(basePath, "specs"));
74396
74455
  let specScore = 0;
74397
74456
  if (hasSpecs) specScore += 15;
74398
74457
  if (hasClaudeDir) specScore += 5;
@@ -74411,8 +74470,8 @@ function runChecks(basePath) {
74411
74470
  }
74412
74471
  const weight3 = 15;
74413
74472
  maxScore += weight3;
74414
- const hasClaudeMd = (0, import_fs46.existsSync)((0, import_path46.join)(basePath, "CLAUDE.md"));
74415
- const hasClaudeSettings = (0, import_fs46.existsSync)((0, import_path46.join)(basePath, ".claude", "settings.json"));
74473
+ const hasClaudeMd = (0, import_fs47.existsSync)((0, import_path46.join)(basePath, "CLAUDE.md"));
74474
+ const hasClaudeSettings = (0, import_fs47.existsSync)((0, import_path46.join)(basePath, ".claude", "settings.json"));
74416
74475
  let claudeScore = 0;
74417
74476
  if (hasClaudeMd) claudeScore += 10;
74418
74477
  if (hasClaudeSettings) claudeScore += 5;
@@ -74430,9 +74489,9 @@ function runChecks(basePath) {
74430
74489
  }
74431
74490
  const weight4 = 15;
74432
74491
  maxScore += weight4;
74433
- const hasPackageJson = (0, import_fs46.existsSync)((0, import_path46.join)(basePath, "package.json"));
74434
- const hasReadme = (0, import_fs46.existsSync)((0, import_path46.join)(basePath, "README.md"));
74435
- const hasTsConfig = (0, import_fs46.existsSync)((0, import_path46.join)(basePath, "tsconfig.json"));
74492
+ const hasPackageJson = (0, import_fs47.existsSync)((0, import_path46.join)(basePath, "package.json"));
74493
+ const hasReadme = (0, import_fs47.existsSync)((0, import_path46.join)(basePath, "README.md"));
74494
+ const hasTsConfig = (0, import_fs47.existsSync)((0, import_path46.join)(basePath, "tsconfig.json"));
74436
74495
  let structureScore = 0;
74437
74496
  if (hasPackageJson) structureScore += 5;
74438
74497
  if (hasReadme) structureScore += 5;
@@ -74452,9 +74511,9 @@ function runChecks(basePath) {
74452
74511
  });
74453
74512
  const weight5 = 15;
74454
74513
  maxScore += weight5;
74455
- const hasGitDir = (0, import_fs46.existsSync)((0, import_path46.join)(basePath, ".git"));
74456
- const hasGithubDir = (0, import_fs46.existsSync)((0, import_path46.join)(basePath, ".github"));
74457
- const hasWorkflows = (0, import_fs46.existsSync)((0, import_path46.join)(basePath, ".github", "workflows"));
74514
+ const hasGitDir = (0, import_fs47.existsSync)((0, import_path46.join)(basePath, ".git"));
74515
+ const hasGithubDir = (0, import_fs47.existsSync)((0, import_path46.join)(basePath, ".github"));
74516
+ const hasWorkflows = (0, import_fs47.existsSync)((0, import_path46.join)(basePath, ".github", "workflows"));
74458
74517
  let gitScore = 0;
74459
74518
  if (hasGitDir) gitScore += 5;
74460
74519
  if (hasGithubDir) gitScore += 5;
@@ -74587,7 +74646,7 @@ function createSdlcCommand() {
74587
74646
  }
74588
74647
  let branchName;
74589
74648
  try {
74590
- branchName = (0, import_child_process15.execSync)("git branch --show-current", { encoding: "utf-8" }).trim();
74649
+ branchName = (0, import_child_process16.execSync)("git branch --show-current", { encoding: "utf-8" }).trim();
74591
74650
  } catch {
74592
74651
  console.error(source_default.red("\n Not inside a git repository.\n"));
74593
74652
  process.exit(1);
@@ -74690,7 +74749,7 @@ function createSdlcCommand() {
74690
74749
  }
74691
74750
  let branchName;
74692
74751
  try {
74693
- branchName = (0, import_child_process15.execSync)("git branch --show-current", { encoding: "utf-8" }).trim();
74752
+ branchName = (0, import_child_process16.execSync)("git branch --show-current", { encoding: "utf-8" }).trim();
74694
74753
  } catch {
74695
74754
  console.error(source_default.red("\n Not inside a git repository.\n"));
74696
74755
  process.exit(1);
@@ -74781,7 +74840,7 @@ function createSdlcCommand() {
74781
74840
  try {
74782
74841
  let branchName;
74783
74842
  try {
74784
- branchName = (0, import_child_process15.execSync)("git branch --show-current", { encoding: "utf-8" }).trim();
74843
+ branchName = (0, import_child_process16.execSync)("git branch --show-current", { encoding: "utf-8" }).trim();
74785
74844
  } catch {
74786
74845
  console.error(source_default.red("\n Not inside a git repository.\n"));
74787
74846
  process.exit(1);
@@ -74793,8 +74852,8 @@ function createSdlcCommand() {
74793
74852
  spinner.start("Scanning git history and local artifacts...");
74794
74853
  const basePath = process.cwd();
74795
74854
  const SDLC_PHASES_ORDERED = ["specify", "design", "test", "implement", "deploy-verify", "review", "merge"];
74796
- const hasSpec = (0, import_fs46.existsSync)((0, import_path46.join)(basePath, "spec.md")) || (0, import_fs46.existsSync)((0, import_path46.join)(basePath, "specs")) || (0, import_fs46.existsSync)((0, import_path46.join)(basePath, ".claude", "spec.md"));
74797
- const hasPlan = (0, import_fs46.existsSync)((0, import_path46.join)(basePath, "plan.md")) || (0, import_fs46.existsSync)((0, import_path46.join)(basePath, ".claude", "plan.md")) || (0, import_fs46.existsSync)((0, import_path46.join)(basePath, "tasks.md"));
74855
+ const hasSpec = (0, import_fs47.existsSync)((0, import_path46.join)(basePath, "spec.md")) || (0, import_fs47.existsSync)((0, import_path46.join)(basePath, "specs")) || (0, import_fs47.existsSync)((0, import_path46.join)(basePath, ".claude", "spec.md"));
74856
+ const hasPlan = (0, import_fs47.existsSync)((0, import_path46.join)(basePath, "plan.md")) || (0, import_fs47.existsSync)((0, import_path46.join)(basePath, ".claude", "plan.md")) || (0, import_fs47.existsSync)((0, import_path46.join)(basePath, "tasks.md"));
74798
74857
  const scanResult = scanDirectory(basePath);
74799
74858
  const hasTests = scanResult.testFiles.length > 0;
74800
74859
  const hasImpl = scanResult.implFiles.length > 0;
@@ -74805,7 +74864,7 @@ function createSdlcCommand() {
74805
74864
  const now = (/* @__PURE__ */ new Date()).toISOString();
74806
74865
  let firstCommitDate = now;
74807
74866
  try {
74808
- firstCommitDate = (0, import_child_process15.execSync)(
74867
+ firstCommitDate = (0, import_child_process16.execSync)(
74809
74868
  `git log --reverse --format=%aI origin/main..HEAD 2>/dev/null | head -1`,
74810
74869
  { encoding: "utf-8" }
74811
74870
  ).trim() || now;
@@ -74937,16 +74996,16 @@ function createSdlcCommand() {
74937
74996
  });
74938
74997
  return cmd;
74939
74998
  }
74940
- var import_fs46, import_path46, import_child_process15, IMPL_EXTENSIONS, IGNORE_DIRS, IGNORE_FILES;
74999
+ var import_fs47, import_path46, import_child_process16, IMPL_EXTENSIONS, IGNORE_DIRS, IGNORE_FILES;
74941
75000
  var init_sdlc = __esm({
74942
75001
  "module_422"() {
74943
75002
  "use strict";
74944
75003
  init_esm();
74945
75004
  init_source();
74946
75005
  init_ora();
74947
- import_fs46 = require("fs");
75006
+ import_fs47 = require("fs");
74948
75007
  import_path46 = require("path");
74949
- import_child_process15 = require("child_process");
75008
+ import_child_process16 = require("child_process");
74950
75009
  init_config_manager();
74951
75010
  IMPL_EXTENSIONS = /* @__PURE__ */ new Set([".ts", ".tsx", ".js", ".jsx"]);
74952
75011
  IGNORE_DIRS = /* @__PURE__ */ new Set([
@@ -75064,8 +75123,8 @@ var init_security = __esm({
75064
75123
  function readTermsAcceptance() {
75065
75124
  const configFile = (0, import_path47.join)((0, import_os29.homedir)(), ".gal", "config.json");
75066
75125
  try {
75067
- if ((0, import_fs47.existsSync)(configFile)) {
75068
- const raw = JSON.parse((0, import_fs47.readFileSync)(configFile, "utf-8"));
75126
+ if ((0, import_fs48.existsSync)(configFile)) {
75127
+ const raw = JSON.parse((0, import_fs48.readFileSync)(configFile, "utf-8"));
75069
75128
  if (typeof raw.termsAcceptedAt === "string" && raw.termsAcceptedAt.length > 0) {
75070
75129
  return { accepted: true, acceptedAt: raw.termsAcceptedAt };
75071
75130
  }
@@ -75268,7 +75327,7 @@ function displayStatusJson(result, health) {
75268
75327
  }
75269
75328
  function isRateLimited(projectId) {
75270
75329
  try {
75271
- const raw = (0, import_fs47.readFileSync)(DRIFT_REPORT_CACHE_PATH, "utf-8");
75330
+ const raw = (0, import_fs48.readFileSync)(DRIFT_REPORT_CACHE_PATH, "utf-8");
75272
75331
  const cache = JSON.parse(raw);
75273
75332
  const lastReport = cache[projectId];
75274
75333
  if (lastReport && Date.now() - lastReport < RATE_LIMIT_MS) {
@@ -75282,13 +75341,13 @@ function recordReport(projectId) {
75282
75341
  try {
75283
75342
  let cache = {};
75284
75343
  try {
75285
- const raw = (0, import_fs47.readFileSync)(DRIFT_REPORT_CACHE_PATH, "utf-8");
75344
+ const raw = (0, import_fs48.readFileSync)(DRIFT_REPORT_CACHE_PATH, "utf-8");
75286
75345
  cache = JSON.parse(raw);
75287
75346
  } catch {
75288
75347
  }
75289
75348
  cache[projectId] = Date.now();
75290
- (0, import_fs47.mkdirSync)((0, import_path47.join)((0, import_os29.homedir)(), ".gal"), { recursive: true });
75291
- (0, import_fs47.writeFileSync)(DRIFT_REPORT_CACHE_PATH, JSON.stringify(cache));
75349
+ (0, import_fs48.mkdirSync)((0, import_path47.join)((0, import_os29.homedir)(), ".gal"), { recursive: true });
75350
+ (0, import_fs48.writeFileSync)(DRIFT_REPORT_CACHE_PATH, JSON.stringify(cache));
75292
75351
  } catch {
75293
75352
  }
75294
75353
  }
@@ -75434,7 +75493,7 @@ function createStatusCommand3() {
75434
75493
  });
75435
75494
  return command;
75436
75495
  }
75437
- var import_path47, import_os29, import_fs47, cliVersion7, defaultApiUrl18, PLATFORM_LABELS2, RATE_LIMIT_MS, DRIFT_REPORT_CACHE_PATH;
75496
+ var import_path47, import_os29, import_fs48, cliVersion7, defaultApiUrl18, PLATFORM_LABELS2, RATE_LIMIT_MS, DRIFT_REPORT_CACHE_PATH;
75438
75497
  var init_status = __esm({
75439
75498
  "module_424"() {
75440
75499
  "use strict";
@@ -75443,7 +75502,7 @@ var init_status = __esm({
75443
75502
  init_ora();
75444
75503
  import_path47 = require("path");
75445
75504
  import_os29 = require("os");
75446
- import_fs47 = require("fs");
75505
+ import_fs48 = require("fs");
75447
75506
  init_gal_config_service();
75448
75507
  init_config_manager();
75449
75508
  init_CoreServiceProvider();
@@ -76782,12 +76841,12 @@ function getGitHookManager() {
76782
76841
  }
76783
76842
  return defaultManager;
76784
76843
  }
76785
- var import_child_process16, import_fs48, import_path48, DEFAULT_GIT_HOOK_CONFIG, GitHookManager, defaultManager;
76844
+ var import_child_process17, import_fs49, import_path48, DEFAULT_GIT_HOOK_CONFIG, GitHookManager, defaultManager;
76786
76845
  var init_git_hooks = __esm({
76787
76846
  "module_430"() {
76788
76847
  "use strict";
76789
- import_child_process16 = require("child_process");
76790
- import_fs48 = require("fs");
76848
+ import_child_process17 = require("child_process");
76849
+ import_fs49 = require("fs");
76791
76850
  import_path48 = require("path");
76792
76851
  init_source();
76793
76852
  init_triggers();
@@ -76832,7 +76891,7 @@ var init_git_hooks = __esm({
76832
76891
  let currentPath = startPath;
76833
76892
  while (currentPath !== "/") {
76834
76893
  const gitPath = (0, import_path48.join)(currentPath, ".git");
76835
- if ((0, import_fs48.existsSync)(gitPath)) {
76894
+ if ((0, import_fs49.existsSync)(gitPath)) {
76836
76895
  this.gitDir = gitPath;
76837
76896
  return gitPath;
76838
76897
  }
@@ -76859,8 +76918,8 @@ var init_git_hooks = __esm({
76859
76918
  };
76860
76919
  }
76861
76920
  const hooksDir = (0, import_path48.join)(gitDir, "hooks");
76862
- if (!(0, import_fs48.existsSync)(hooksDir)) {
76863
- (0, import_fs48.mkdirSync)(hooksDir, { recursive: true });
76921
+ if (!(0, import_fs49.existsSync)(hooksDir)) {
76922
+ (0, import_fs49.mkdirSync)(hooksDir, { recursive: true });
76864
76923
  }
76865
76924
  const installed = [];
76866
76925
  const skipped = [];
@@ -76868,19 +76927,19 @@ var init_git_hooks = __esm({
76868
76927
  for (const hookType of this.config.hooks) {
76869
76928
  const hookPath = (0, import_path48.join)(hooksDir, hookType);
76870
76929
  const hookScript = this.generateHookScript(hookType);
76871
- if ((0, import_fs48.existsSync)(hookPath)) {
76872
- const existing = (0, import_fs48.readFileSync)(hookPath, "utf-8");
76930
+ if ((0, import_fs49.existsSync)(hookPath)) {
76931
+ const existing = (0, import_fs49.readFileSync)(hookPath, "utf-8");
76873
76932
  if (existing.includes("GAL_HOOK_MARKER")) {
76874
- (0, import_fs48.writeFileSync)(hookPath, hookScript);
76875
- (0, import_fs48.chmodSync)(hookPath, "755");
76933
+ (0, import_fs49.writeFileSync)(hookPath, hookScript);
76934
+ (0, import_fs49.chmodSync)(hookPath, "755");
76876
76935
  installed.push(hookType);
76877
76936
  } else {
76878
76937
  console.log(source_default.yellow(`Skipping ${hookType}: existing hook found`));
76879
76938
  skipped.push(hookType);
76880
76939
  }
76881
76940
  } else {
76882
- (0, import_fs48.writeFileSync)(hookPath, hookScript);
76883
- (0, import_fs48.chmodSync)(hookPath, "755");
76941
+ (0, import_fs49.writeFileSync)(hookPath, hookScript);
76942
+ (0, import_fs49.chmodSync)(hookPath, "755");
76884
76943
  installed.push(hookType);
76885
76944
  }
76886
76945
  }
@@ -76901,8 +76960,8 @@ var init_git_hooks = __esm({
76901
76960
  const removed = [];
76902
76961
  for (const hookType of this.config.hooks) {
76903
76962
  const hookPath = (0, import_path48.join)(hooksDir, hookType);
76904
- if ((0, import_fs48.existsSync)(hookPath)) {
76905
- const content = (0, import_fs48.readFileSync)(hookPath, "utf-8");
76963
+ if ((0, import_fs49.existsSync)(hookPath)) {
76964
+ const content = (0, import_fs49.readFileSync)(hookPath, "utf-8");
76906
76965
  if (content.includes("GAL_HOOK_MARKER")) {
76907
76966
  const { unlinkSync: unlinkSync9 } = require("fs");
76908
76967
  unlinkSync9(hookPath);
@@ -76972,15 +77031,15 @@ exit 0
76972
77031
  hookType
76973
77032
  };
76974
77033
  try {
76975
- payload.branch = (0, import_child_process16.execSync)("git rev-parse --abbrev-ref HEAD", { encoding: "utf-8" }).trim();
77034
+ payload.branch = (0, import_child_process17.execSync)("git rev-parse --abbrev-ref HEAD", { encoding: "utf-8" }).trim();
76976
77035
  if (hookType === "pre-commit" && this.config.scanStagedOnly) {
76977
- const stagedFiles = (0, import_child_process16.execSync)("git diff --cached --name-only", { encoding: "utf-8" });
77036
+ const stagedFiles = (0, import_child_process17.execSync)("git diff --cached --name-only", { encoding: "utf-8" });
76978
77037
  payload.files = stagedFiles.split("\n").filter((f) => f.trim());
76979
77038
  }
76980
77039
  if (hookType === "post-commit" || hookType === "commit-msg") {
76981
- payload.commit = (0, import_child_process16.execSync)("git rev-parse HEAD", { encoding: "utf-8" }).trim();
76982
- payload.message = (0, import_child_process16.execSync)("git log -1 --pretty=%B", { encoding: "utf-8" }).trim();
76983
- payload.author = (0, import_child_process16.execSync)("git log -1 --pretty=%an", { encoding: "utf-8" }).trim();
77040
+ payload.commit = (0, import_child_process17.execSync)("git rev-parse HEAD", { encoding: "utf-8" }).trim();
77041
+ payload.message = (0, import_child_process17.execSync)("git log -1 --pretty=%B", { encoding: "utf-8" }).trim();
77042
+ payload.author = (0, import_child_process17.execSync)("git log -1 --pretty=%an", { encoding: "utf-8" }).trim();
76984
77043
  }
76985
77044
  } catch {
76986
77045
  }
@@ -77052,7 +77111,7 @@ exit 0
77052
77111
  const findings = [];
77053
77112
  for (const file of files) {
77054
77113
  try {
77055
- const content = (0, import_child_process16.execSync)(`git show :${file}`, { encoding: "utf-8" });
77114
+ const content = (0, import_child_process17.execSync)(`git show :${file}`, { encoding: "utf-8" });
77056
77115
  for (const { pattern, severity } of securityPatterns) {
77057
77116
  if (pattern.test(content)) {
77058
77117
  findings.push({ file, pattern: pattern.source, severity });
@@ -77130,8 +77189,8 @@ exit 0
77130
77189
  const missing = [];
77131
77190
  for (const hookType of this.config.hooks) {
77132
77191
  const hookPath = (0, import_path48.join)(hooksDir, hookType);
77133
- if ((0, import_fs48.existsSync)(hookPath)) {
77134
- const content = (0, import_fs48.readFileSync)(hookPath, "utf-8");
77192
+ if ((0, import_fs49.existsSync)(hookPath)) {
77193
+ const content = (0, import_fs49.readFileSync)(hookPath, "utf-8");
77135
77194
  if (content.includes("GAL_HOOK_MARKER")) {
77136
77195
  installed.push(hookType);
77137
77196
  } else {
@@ -77154,11 +77213,11 @@ function getFileWatcher() {
77154
77213
  }
77155
77214
  return defaultWatcher;
77156
77215
  }
77157
- var import_fs49, import_path49, DEFAULT_FILE_WATCHER_CONFIG, AGENT_CONFIG_PATTERNS, FileWatcher, defaultWatcher;
77216
+ var import_fs50, import_path49, DEFAULT_FILE_WATCHER_CONFIG, AGENT_CONFIG_PATTERNS, FileWatcher, defaultWatcher;
77158
77217
  var init_file_watcher = __esm({
77159
77218
  "module_431"() {
77160
77219
  "use strict";
77161
- import_fs49 = require("fs");
77220
+ import_fs50 = require("fs");
77162
77221
  import_path49 = require("path");
77163
77222
  init_source();
77164
77223
  init_triggers();
@@ -77216,12 +77275,12 @@ var init_file_watcher = __esm({
77216
77275
  const notFound = [];
77217
77276
  for (const watchPath of this.config.watchPaths) {
77218
77277
  const fullPath = (0, import_path49.join)(basePath, watchPath);
77219
- if (!(0, import_fs49.existsSync)(fullPath)) {
77278
+ if (!(0, import_fs50.existsSync)(fullPath)) {
77220
77279
  notFound.push(watchPath);
77221
77280
  continue;
77222
77281
  }
77223
77282
  try {
77224
- const watcher = (0, import_fs49.watch)(
77283
+ const watcher = (0, import_fs50.watch)(
77225
77284
  fullPath,
77226
77285
  { recursive: this.config.recursive },
77227
77286
  (eventType, filename) => {
@@ -77319,8 +77378,8 @@ var init_file_watcher = __esm({
77319
77378
  let isDirectory = false;
77320
77379
  let size;
77321
77380
  try {
77322
- if ((0, import_fs49.existsSync)(fullPath)) {
77323
- const stats = (0, import_fs49.statSync)(fullPath);
77381
+ if ((0, import_fs50.existsSync)(fullPath)) {
77382
+ const stats = (0, import_fs50.statSync)(fullPath);
77324
77383
  isDirectory = stats.isDirectory();
77325
77384
  size = stats.size;
77326
77385
  fsEventType = eventType === "rename" ? "create" : "modify";
@@ -77466,11 +77525,11 @@ var init_file_watcher = __esm({
77466
77525
  return true;
77467
77526
  }
77468
77527
  const fullPath = (0, import_path49.join)(basePath, path8);
77469
- if (!(0, import_fs49.existsSync)(fullPath)) {
77528
+ if (!(0, import_fs50.existsSync)(fullPath)) {
77470
77529
  return false;
77471
77530
  }
77472
77531
  try {
77473
- const watcher = (0, import_fs49.watch)(
77532
+ const watcher = (0, import_fs50.watch)(
77474
77533
  fullPath,
77475
77534
  { recursive: this.config.recursive },
77476
77535
  (eventType, filename) => {
@@ -77781,9 +77840,9 @@ async function confirm(message) {
77781
77840
  });
77782
77841
  }
77783
77842
  function isGalCreatedFile(filePath) {
77784
- if (!(0, import_fs50.existsSync)(filePath)) return false;
77843
+ if (!(0, import_fs51.existsSync)(filePath)) return false;
77785
77844
  try {
77786
- const content = (0, import_fs50.readFileSync)(filePath, "utf-8");
77845
+ const content = (0, import_fs51.readFileSync)(filePath, "utf-8");
77787
77846
  const galMarkers = [
77788
77847
  "GAL Config",
77789
77848
  "GAL CLI",
@@ -77803,9 +77862,9 @@ function isGalCreatedFile(filePath) {
77803
77862
  }
77804
77863
  }
77805
77864
  function isNpmInstalledFile(filePath) {
77806
- if (!(0, import_fs50.existsSync)(filePath)) return false;
77865
+ if (!(0, import_fs51.existsSync)(filePath)) return false;
77807
77866
  try {
77808
- const content = (0, import_fs50.readFileSync)(filePath, "utf-8");
77867
+ const content = (0, import_fs51.readFileSync)(filePath, "utf-8");
77809
77868
  return content.includes("CURRENT_VERSION =") || content.includes("const CURRENT_VERSION");
77810
77869
  } catch {
77811
77870
  return false;
@@ -77826,8 +77885,8 @@ function detectUserLevelItems(options) {
77826
77885
  const claudeHooksDir = (0, import_path50.join)(claudeDir, "hooks");
77827
77886
  const statusLinesDir = (0, import_path50.join)(claudeDir, "status_lines");
77828
77887
  const includeNpm = options?.includeNpmInstalled ?? true;
77829
- if ((0, import_fs50.existsSync)(claudeHooksDir)) {
77830
- const files = (0, import_fs50.readdirSync)(claudeHooksDir);
77888
+ if ((0, import_fs51.existsSync)(claudeHooksDir)) {
77889
+ const files = (0, import_fs51.readdirSync)(claudeHooksDir);
77831
77890
  for (const file of files) {
77832
77891
  if (file.startsWith("gal-")) {
77833
77892
  const filePath = (0, import_path50.join)(claudeHooksDir, file);
@@ -77845,8 +77904,8 @@ function detectUserLevelItems(options) {
77845
77904
  }
77846
77905
  }
77847
77906
  }
77848
- if ((0, import_fs50.existsSync)(statusLinesDir)) {
77849
- const files = (0, import_fs50.readdirSync)(statusLinesDir);
77907
+ if ((0, import_fs51.existsSync)(statusLinesDir)) {
77908
+ const files = (0, import_fs51.readdirSync)(statusLinesDir);
77850
77909
  for (const file of files) {
77851
77910
  if (file.startsWith("gal-")) {
77852
77911
  const filePath = (0, import_path50.join)(statusLinesDir, file);
@@ -77865,9 +77924,9 @@ function detectUserLevelItems(options) {
77865
77924
  }
77866
77925
  }
77867
77926
  const claudeSettingsPath = (0, import_path50.join)(claudeDir, "settings.json");
77868
- if ((0, import_fs50.existsSync)(claudeSettingsPath)) {
77927
+ if ((0, import_fs51.existsSync)(claudeSettingsPath)) {
77869
77928
  try {
77870
- const settings = JSON.parse((0, import_fs50.readFileSync)(claudeSettingsPath, "utf-8"));
77929
+ const settings = JSON.parse((0, import_fs51.readFileSync)(claudeSettingsPath, "utf-8"));
77871
77930
  if (settings.hooks?.SessionStart) {
77872
77931
  const hasGalHooks = settings.hooks.SessionStart.some(
77873
77932
  (entry) => entry.hooks?.some(
@@ -77916,8 +77975,8 @@ function detectUserLevelItems(options) {
77916
77975
  }
77917
77976
  const cursorDir = (0, import_path50.join)((0, import_os30.homedir)(), ".cursor");
77918
77977
  const cursorHooksDir = (0, import_path50.join)(cursorDir, "hooks");
77919
- if ((0, import_fs50.existsSync)(cursorHooksDir)) {
77920
- const files = (0, import_fs50.readdirSync)(cursorHooksDir);
77978
+ if ((0, import_fs51.existsSync)(cursorHooksDir)) {
77979
+ const files = (0, import_fs51.readdirSync)(cursorHooksDir);
77921
77980
  for (const file of files) {
77922
77981
  if (file.startsWith("gal-")) {
77923
77982
  items.push({
@@ -77930,9 +77989,9 @@ function detectUserLevelItems(options) {
77930
77989
  }
77931
77990
  }
77932
77991
  const cursorHooksJsonPath = (0, import_path50.join)(cursorDir, "hooks.json");
77933
- if ((0, import_fs50.existsSync)(cursorHooksJsonPath)) {
77992
+ if ((0, import_fs51.existsSync)(cursorHooksJsonPath)) {
77934
77993
  try {
77935
- const hooksConfig = JSON.parse((0, import_fs50.readFileSync)(cursorHooksJsonPath, "utf-8"));
77994
+ const hooksConfig = JSON.parse((0, import_fs51.readFileSync)(cursorHooksJsonPath, "utf-8"));
77936
77995
  const hookTypes = ["beforeShellExecution", "beforeSubmitPrompt"];
77937
77996
  for (const hookType of hookTypes) {
77938
77997
  if (hooksConfig.hooks?.[hookType]) {
@@ -77959,7 +78018,7 @@ function detectUserLevelItems(options) {
77959
78018
  function detectProjectLevelItems(directory) {
77960
78019
  const items = [];
77961
78020
  const galDir = (0, import_path50.join)(directory, ".gal");
77962
- if ((0, import_fs50.existsSync)(galDir)) {
78021
+ if ((0, import_fs51.existsSync)(galDir)) {
77963
78022
  items.push({
77964
78023
  path: galDir,
77965
78024
  type: "directory",
@@ -77968,7 +78027,7 @@ function detectProjectLevelItems(directory) {
77968
78027
  });
77969
78028
  }
77970
78029
  const galConfig = (0, import_path50.join)(directory, "gal.config.json");
77971
- if ((0, import_fs50.existsSync)(galConfig)) {
78030
+ if ((0, import_fs51.existsSync)(galConfig)) {
77972
78031
  items.push({
77973
78032
  path: galConfig,
77974
78033
  type: "file",
@@ -77981,7 +78040,7 @@ function detectProjectLevelItems(directory) {
77981
78040
  (0, import_path50.join)(directory, ".husky", "pre-commit")
77982
78041
  ];
77983
78042
  for (const hookPath of gitHookPaths) {
77984
- if ((0, import_fs50.existsSync)(hookPath) && isGalCreatedFile(hookPath)) {
78043
+ if ((0, import_fs51.existsSync)(hookPath) && isGalCreatedFile(hookPath)) {
77985
78044
  items.push({
77986
78045
  path: hookPath,
77987
78046
  type: "file",
@@ -78002,7 +78061,7 @@ function detectProjectLevelItems(directory) {
78002
78061
  { path: (0, import_path50.join)(directory, ".env.example"), reason: "GAL-generated env template" }
78003
78062
  ];
78004
78063
  for (const { path: path8, reason } of setupFiles) {
78005
- if ((0, import_fs50.existsSync)(path8) && isGalCreatedFile(path8)) {
78064
+ if ((0, import_fs51.existsSync)(path8) && isGalCreatedFile(path8)) {
78006
78065
  items.push({
78007
78066
  path: path8,
78008
78067
  type: "file",
@@ -78015,12 +78074,12 @@ function detectProjectLevelItems(directory) {
78015
78074
  }
78016
78075
  function removeGalStatusLineEntry(settingsPath) {
78017
78076
  try {
78018
- const settings = JSON.parse((0, import_fs50.readFileSync)(settingsPath, "utf-8"));
78077
+ const settings = JSON.parse((0, import_fs51.readFileSync)(settingsPath, "utf-8"));
78019
78078
  if (!settings.statusLine?.command?.includes("gal-")) {
78020
78079
  return false;
78021
78080
  }
78022
78081
  delete settings.statusLine;
78023
- (0, import_fs50.writeFileSync)(settingsPath, JSON.stringify(settings, null, 2));
78082
+ (0, import_fs51.writeFileSync)(settingsPath, JSON.stringify(settings, null, 2));
78024
78083
  return true;
78025
78084
  } catch {
78026
78085
  return false;
@@ -78028,7 +78087,7 @@ function removeGalStatusLineEntry(settingsPath) {
78028
78087
  }
78029
78088
  function removeGalHookEntries(settingsPath) {
78030
78089
  try {
78031
- const settings = JSON.parse((0, import_fs50.readFileSync)(settingsPath, "utf-8"));
78090
+ const settings = JSON.parse((0, import_fs51.readFileSync)(settingsPath, "utf-8"));
78032
78091
  let modified = false;
78033
78092
  for (const hookEvent of ["SessionStart", "UserPromptSubmit"]) {
78034
78093
  if (!settings.hooks?.[hookEvent]) continue;
@@ -78051,7 +78110,7 @@ function removeGalHookEntries(settingsPath) {
78051
78110
  delete settings.hooks;
78052
78111
  }
78053
78112
  if (modified) {
78054
- (0, import_fs50.writeFileSync)(settingsPath, JSON.stringify(settings, null, 2));
78113
+ (0, import_fs51.writeFileSync)(settingsPath, JSON.stringify(settings, null, 2));
78055
78114
  return true;
78056
78115
  }
78057
78116
  return false;
@@ -78061,7 +78120,7 @@ function removeGalHookEntries(settingsPath) {
78061
78120
  }
78062
78121
  function removeGalCursorHookEntries(hooksJsonPath) {
78063
78122
  try {
78064
- const hooksConfig = JSON.parse((0, import_fs50.readFileSync)(hooksJsonPath, "utf-8"));
78123
+ const hooksConfig = JSON.parse((0, import_fs51.readFileSync)(hooksJsonPath, "utf-8"));
78065
78124
  if (!hooksConfig.hooks) {
78066
78125
  return false;
78067
78126
  }
@@ -78085,7 +78144,7 @@ function removeGalCursorHookEntries(hooksJsonPath) {
78085
78144
  delete hooksConfig.hooks;
78086
78145
  }
78087
78146
  if (modified) {
78088
- (0, import_fs50.writeFileSync)(hooksJsonPath, JSON.stringify(hooksConfig, null, 2));
78147
+ (0, import_fs51.writeFileSync)(hooksJsonPath, JSON.stringify(hooksConfig, null, 2));
78089
78148
  return true;
78090
78149
  }
78091
78150
  return false;
@@ -78120,10 +78179,10 @@ function performUninstall(items, dryRun) {
78120
78179
  result.skipped.push(`${item.path} (no GAL statusLine found)`);
78121
78180
  }
78122
78181
  } else if (item.type === "directory") {
78123
- (0, import_fs50.rmSync)(item.path, { recursive: true, force: true });
78182
+ (0, import_fs51.rmSync)(item.path, { recursive: true, force: true });
78124
78183
  result.removed.push(item.path);
78125
78184
  } else {
78126
- (0, import_fs50.unlinkSync)(item.path);
78185
+ (0, import_fs51.unlinkSync)(item.path);
78127
78186
  result.removed.push(item.path);
78128
78187
  }
78129
78188
  } catch (error3) {
@@ -78219,13 +78278,13 @@ function createUninstallCommand() {
78219
78278
  });
78220
78279
  return command;
78221
78280
  }
78222
- var import_fs50, import_path50, import_os30, import_readline5;
78281
+ var import_fs51, import_path50, import_os30, import_readline5;
78223
78282
  var init_uninstall = __esm({
78224
78283
  "module_433"() {
78225
78284
  "use strict";
78226
78285
  init_esm();
78227
78286
  init_source();
78228
- import_fs50 = require("fs");
78287
+ import_fs51 = require("fs");
78229
78288
  import_path50 = require("path");
78230
78289
  import_os30 = require("os");
78231
78290
  import_readline5 = require("readline");
@@ -78644,26 +78703,26 @@ function compareVersions2(v1, v2) {
78644
78703
  function acquireLock() {
78645
78704
  try {
78646
78705
  const galDir = (0, import_path51.join)((0, import_os31.homedir)(), ".gal");
78647
- if (!(0, import_fs51.existsSync)(galDir)) {
78648
- (0, import_fs51.mkdirSync)(galDir, { recursive: true });
78706
+ if (!(0, import_fs52.existsSync)(galDir)) {
78707
+ (0, import_fs52.mkdirSync)(galDir, { recursive: true });
78649
78708
  }
78650
- if ((0, import_fs51.existsSync)(UPDATE_LOCK_FILE)) {
78709
+ if ((0, import_fs52.existsSync)(UPDATE_LOCK_FILE)) {
78651
78710
  try {
78652
- const lockContent = (0, import_fs51.readFileSync)(UPDATE_LOCK_FILE, "utf-8");
78711
+ const lockContent = (0, import_fs52.readFileSync)(UPDATE_LOCK_FILE, "utf-8");
78653
78712
  const lockTime = parseInt(lockContent, 10);
78654
78713
  if (Number.isNaN(lockTime) || Date.now() - lockTime > 5 * 60 * 1e3) {
78655
- (0, import_fs51.unlinkSync)(UPDATE_LOCK_FILE);
78714
+ (0, import_fs52.unlinkSync)(UPDATE_LOCK_FILE);
78656
78715
  } else {
78657
78716
  return false;
78658
78717
  }
78659
78718
  } catch {
78660
78719
  try {
78661
- (0, import_fs51.unlinkSync)(UPDATE_LOCK_FILE);
78720
+ (0, import_fs52.unlinkSync)(UPDATE_LOCK_FILE);
78662
78721
  } catch {
78663
78722
  }
78664
78723
  }
78665
78724
  }
78666
- (0, import_fs51.writeFileSync)(UPDATE_LOCK_FILE, String(Date.now()), { flag: "wx" });
78725
+ (0, import_fs52.writeFileSync)(UPDATE_LOCK_FILE, String(Date.now()), { flag: "wx" });
78667
78726
  return true;
78668
78727
  } catch {
78669
78728
  return false;
@@ -78671,15 +78730,15 @@ function acquireLock() {
78671
78730
  }
78672
78731
  function releaseLock() {
78673
78732
  try {
78674
- if ((0, import_fs51.existsSync)(UPDATE_LOCK_FILE)) {
78675
- (0, import_fs51.unlinkSync)(UPDATE_LOCK_FILE);
78733
+ if ((0, import_fs52.existsSync)(UPDATE_LOCK_FILE)) {
78734
+ (0, import_fs52.unlinkSync)(UPDATE_LOCK_FILE);
78676
78735
  }
78677
78736
  } catch {
78678
78737
  }
78679
78738
  }
78680
78739
  async function runPostUpdateInstallUpgrade() {
78681
78740
  await new Promise((resolve16) => {
78682
- const child = (0, import_child_process17.spawn)("gal", ["install", "--upgrade", "--quiet"], {
78741
+ const child = (0, import_child_process18.spawn)("gal", ["install", "--upgrade", "--quiet"], {
78683
78742
  stdio: "ignore",
78684
78743
  env: {
78685
78744
  ...process.env,
@@ -78756,7 +78815,7 @@ function createUpdateCommand() {
78756
78815
  releaseLock();
78757
78816
  try {
78758
78817
  const cacheFile = (0, import_path51.join)((0, import_os31.homedir)(), ".gal", "update-cache.json");
78759
- if ((0, import_fs51.existsSync)(cacheFile)) (0, import_fs51.unlinkSync)(cacheFile);
78818
+ if ((0, import_fs52.existsSync)(cacheFile)) (0, import_fs52.unlinkSync)(cacheFile);
78760
78819
  } catch {
78761
78820
  }
78762
78821
  updateSpinner.succeed(source_default.green(`Updated to v${latestVersion}`));
@@ -78782,7 +78841,7 @@ function createUpdateCommand() {
78782
78841
  console.log(source_default.dim("\nRestarting with new version...\n"));
78783
78842
  const args2 = process.argv.slice(2).filter((a) => a !== "update" && a !== "upgrade");
78784
78843
  if (args2.length > 0) {
78785
- const child = (0, import_child_process17.spawn)("gal", args2, { stdio: "inherit" });
78844
+ const child = (0, import_child_process18.spawn)("gal", args2, { stdio: "inherit" });
78786
78845
  child.on("exit", (code) => process.exit(code || 0));
78787
78846
  } else {
78788
78847
  process.exit(0);
@@ -78815,7 +78874,7 @@ Retry manually with: ${source_default.cyan(installCommand)}`);
78815
78874
  });
78816
78875
  return command;
78817
78876
  }
78818
- var import_https, import_child_process17, import_fs51, import_path51, import_os31, UPDATE_LOCK_FILE, cliVersion8, REGISTRY_URL;
78877
+ var import_https, import_child_process18, import_fs52, import_path51, import_os31, UPDATE_LOCK_FILE, cliVersion8, REGISTRY_URL;
78819
78878
  var init_update = __esm({
78820
78879
  "module_435"() {
78821
78880
  "use strict";
@@ -78823,8 +78882,8 @@ var init_update = __esm({
78823
78882
  init_source();
78824
78883
  init_ora();
78825
78884
  import_https = __toESM(require("https"), 1);
78826
- import_child_process17 = require("child_process");
78827
- import_fs51 = require("fs");
78885
+ import_child_process18 = require("child_process");
78886
+ import_fs52 = require("fs");
78828
78887
  import_path51 = require("path");
78829
78888
  import_os31 = require("os");
78830
78889
  init_constants();
@@ -79873,10 +79932,10 @@ function getRegistryAuthToken2() {
79873
79932
  }
79874
79933
  try {
79875
79934
  const npmrcPath = (0, import_path53.join)((0, import_os32.homedir)(), ".npmrc");
79876
- if (!(0, import_fs52.existsSync)(npmrcPath)) {
79935
+ if (!(0, import_fs53.existsSync)(npmrcPath)) {
79877
79936
  return void 0;
79878
79937
  }
79879
- const npmrc = (0, import_fs52.readFileSync)(npmrcPath, "utf-8");
79938
+ const npmrc = (0, import_fs53.readFileSync)(npmrcPath, "utf-8");
79880
79939
  const escapedHost = REGISTRY_HOST.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
79881
79940
  const match = npmrc.match(
79882
79941
  new RegExp(`^//${escapedHost}/:_authToken=(.+)$`, "m")
@@ -79896,8 +79955,8 @@ function getRegistryAuthToken2() {
79896
79955
  }
79897
79956
  function readUpdateCache() {
79898
79957
  try {
79899
- if ((0, import_fs52.existsSync)(UPDATE_CACHE_FILE)) {
79900
- return JSON.parse((0, import_fs52.readFileSync)(UPDATE_CACHE_FILE, "utf-8"));
79958
+ if ((0, import_fs53.existsSync)(UPDATE_CACHE_FILE)) {
79959
+ return JSON.parse((0, import_fs53.readFileSync)(UPDATE_CACHE_FILE, "utf-8"));
79901
79960
  }
79902
79961
  } catch {
79903
79962
  }
@@ -79905,10 +79964,10 @@ function readUpdateCache() {
79905
79964
  }
79906
79965
  function writeUpdateCache(cache) {
79907
79966
  try {
79908
- if (!(0, import_fs52.existsSync)(UPDATE_CACHE_DIR)) {
79909
- (0, import_fs52.mkdirSync)(UPDATE_CACHE_DIR, { recursive: true });
79967
+ if (!(0, import_fs53.existsSync)(UPDATE_CACHE_DIR)) {
79968
+ (0, import_fs53.mkdirSync)(UPDATE_CACHE_DIR, { recursive: true });
79910
79969
  }
79911
- (0, import_fs52.writeFileSync)(UPDATE_CACHE_FILE, JSON.stringify(cache));
79970
+ (0, import_fs53.writeFileSync)(UPDATE_CACHE_FILE, JSON.stringify(cache));
79912
79971
  } catch {
79913
79972
  }
79914
79973
  }
@@ -79958,7 +80017,7 @@ async function promptUpdateInteractive(currentVersion, latestVersion) {
79958
80017
  }
79959
80018
  async function runInlineUpdate() {
79960
80019
  return new Promise((resolve16, reject) => {
79961
- const child = (0, import_child_process18.spawn)("gal", ["update"], {
80020
+ const child = (0, import_child_process19.spawn)("gal", ["update"], {
79962
80021
  stdio: "inherit",
79963
80022
  env: { ...process.env, GAL_AUTO_UPDATE: "0" }
79964
80023
  });
@@ -80017,7 +80076,7 @@ async function checkForUpdates() {
80017
80076
  const args2 = process.argv.slice(2).filter((a) => a !== "update");
80018
80077
  console.log(source_default.dim("\nRestarting with new version...\n"));
80019
80078
  if (args2.length > 0) {
80020
- const child = (0, import_child_process18.spawn)("gal", args2, { stdio: "inherit" });
80079
+ const child = (0, import_child_process19.spawn)("gal", args2, { stdio: "inherit" });
80021
80080
  child.on("exit", (code) => process.exit(code || 0));
80022
80081
  } else {
80023
80082
  process.exit(0);
@@ -80049,8 +80108,8 @@ async function checkForUpdates() {
80049
80108
  if (!isUpdateCommand && !isCI && !isAutoUpdateDisabled) {
80050
80109
  try {
80051
80110
  const lockFile = (0, import_path53.join)((0, import_os32.homedir)(), ".gal", "update.lock");
80052
- if (!(0, import_fs52.existsSync)(lockFile)) {
80053
- const child = (0, import_child_process18.spawn)("gal", ["update"], {
80111
+ if (!(0, import_fs53.existsSync)(lockFile)) {
80112
+ const child = (0, import_child_process19.spawn)("gal", ["update"], {
80054
80113
  detached: true,
80055
80114
  stdio: "ignore",
80056
80115
  env: { ...process.env, GAL_AUTO_UPDATE: "1" }
@@ -80099,8 +80158,8 @@ function checkPathConflicts() {
80099
80158
  try {
80100
80159
  if (process.env.CI === "true" || process.argv.includes("--json")) return;
80101
80160
  const CONFLICT_CACHE = (0, import_path53.join)(UPDATE_CACHE_DIR, "path-conflict-cache.json");
80102
- if ((0, import_fs52.existsSync)(CONFLICT_CACHE)) {
80103
- const cached2 = JSON.parse((0, import_fs52.readFileSync)(CONFLICT_CACHE, "utf-8"));
80161
+ if ((0, import_fs53.existsSync)(CONFLICT_CACHE)) {
80162
+ const cached2 = JSON.parse((0, import_fs53.readFileSync)(CONFLICT_CACHE, "utf-8"));
80104
80163
  if (Date.now() - (cached2.lastCheck || 0) < ONE_DAY) {
80105
80164
  if (cached2.hasConflict) {
80106
80165
  process.on("exit", () => {
@@ -80114,10 +80173,10 @@ function checkPathConflicts() {
80114
80173
  const conflict = detectPathConflict(cliVersion10);
80115
80174
  const cacheData = { lastCheck: Date.now(), hasConflict: !!conflict };
80116
80175
  try {
80117
- if (!(0, import_fs52.existsSync)(UPDATE_CACHE_DIR)) {
80118
- (0, import_fs52.mkdirSync)(UPDATE_CACHE_DIR, { recursive: true });
80176
+ if (!(0, import_fs53.existsSync)(UPDATE_CACHE_DIR)) {
80177
+ (0, import_fs53.mkdirSync)(UPDATE_CACHE_DIR, { recursive: true });
80119
80178
  }
80120
- (0, import_fs52.writeFileSync)(CONFLICT_CACHE, JSON.stringify(cacheData));
80179
+ (0, import_fs53.writeFileSync)(CONFLICT_CACHE, JSON.stringify(cacheData));
80121
80180
  } catch {
80122
80181
  }
80123
80182
  if (conflict) {
@@ -80131,8 +80190,8 @@ function checkPathConflicts() {
80131
80190
  function refreshOrgMemberships() {
80132
80191
  try {
80133
80192
  const configPath = (0, import_path53.join)((0, import_os32.homedir)(), ".gal", "config.json");
80134
- if (!(0, import_fs52.existsSync)(configPath)) return;
80135
- const config2 = JSON.parse((0, import_fs52.readFileSync)(configPath, "utf-8"));
80193
+ if (!(0, import_fs53.existsSync)(configPath)) return;
80194
+ const config2 = JSON.parse((0, import_fs53.readFileSync)(configPath, "utf-8"));
80136
80195
  if (!config2.authToken) return;
80137
80196
  const checkedAt = config2.orgMembershipsCheckedAt || 0;
80138
80197
  if (Date.now() - checkedAt < ONE_DAY) return;
@@ -80164,10 +80223,10 @@ function refreshOrgMemberships() {
80164
80223
  config2.capabilities = user.capabilities;
80165
80224
  config2.capabilitiesCachedAt = Date.now();
80166
80225
  }
80167
- if (!(0, import_fs52.existsSync)(UPDATE_CACHE_DIR)) {
80168
- (0, import_fs52.mkdirSync)(UPDATE_CACHE_DIR, { recursive: true });
80226
+ if (!(0, import_fs53.existsSync)(UPDATE_CACHE_DIR)) {
80227
+ (0, import_fs53.mkdirSync)(UPDATE_CACHE_DIR, { recursive: true });
80169
80228
  }
80170
- (0, import_fs52.writeFileSync)(configPath, JSON.stringify(config2, null, 2));
80229
+ (0, import_fs53.writeFileSync)(configPath, JSON.stringify(config2, null, 2));
80171
80230
  }
80172
80231
  } catch {
80173
80232
  }
@@ -80194,11 +80253,11 @@ function refreshOrgMemberships() {
80194
80253
  if (res.statusCode !== 200) return;
80195
80254
  const flags = JSON.parse(data);
80196
80255
  if (flags.orgAudienceTierMap) {
80197
- const freshConfig = JSON.parse((0, import_fs52.readFileSync)(configPath, "utf-8"));
80256
+ const freshConfig = JSON.parse((0, import_fs53.readFileSync)(configPath, "utf-8"));
80198
80257
  freshConfig.orgAudienceTierMap = flags.orgAudienceTierMap;
80199
80258
  freshConfig.orgPlanMap = flags.orgPlanMap || freshConfig.orgPlanMap || {};
80200
80259
  freshConfig.flagsCachedAt = Date.now();
80201
- (0, import_fs52.writeFileSync)(configPath, JSON.stringify(freshConfig, null, 2));
80260
+ (0, import_fs53.writeFileSync)(configPath, JSON.stringify(freshConfig, null, 2));
80202
80261
  }
80203
80262
  } catch {
80204
80263
  }
@@ -80228,7 +80287,7 @@ function getRequestedCommand(argv) {
80228
80287
  }
80229
80288
  return null;
80230
80289
  }
80231
- var import_dotenv, import_https2, import_readline6, import_child_process18, import_fs52, import_path53, import_os32, originalEmit, cliVersion10, fatalErrorHandled, UPDATE_CACHE_DIR, UPDATE_CACHE_FILE, ONE_DAY, REGISTRY_URL2, REGISTRY_HOST, sessionStartTime, isReadOnlyStatusCommand, isMachineMode, exitHooksRan, featureFlags, knownCommands, isKnownCommand, program2, allInternalFlags;
80290
+ var import_dotenv, import_https2, import_readline6, import_child_process19, import_fs53, import_path53, import_os32, originalEmit, cliVersion10, fatalErrorHandled, UPDATE_CACHE_DIR, UPDATE_CACHE_FILE, ONE_DAY, REGISTRY_URL2, REGISTRY_HOST, sessionStartTime, isReadOnlyStatusCommand, isMachineMode, exitHooksRan, featureFlags, knownCommands, isKnownCommand, program2, allInternalFlags;
80232
80291
  var init_index = __esm({
80233
80292
  "module_441"() {
80234
80293
  "use strict";
@@ -80236,8 +80295,8 @@ var init_index = __esm({
80236
80295
  import_dotenv = __toESM(require_main(), 1);
80237
80296
  import_https2 = __toESM(require("https"), 1);
80238
80297
  import_readline6 = __toESM(require("readline"), 1);
80239
- import_child_process18 = require("child_process");
80240
- import_fs52 = require("fs");
80298
+ import_child_process19 = require("child_process");
80299
+ import_fs53 = require("fs");
80241
80300
  import_path53 = require("path");
80242
80301
  import_os32 = require("os");
80243
80302
  init_source();
@@ -80445,7 +80504,7 @@ var init_index = __esm({
80445
80504
  }
80446
80505
  });
80447
80506
 
80448
- var cliVersion11 = true ? "0.0.560" : "0.0.0-dev";
80507
+ var cliVersion11 = true ? "0.0.562" : "0.0.0-dev";
80449
80508
  var args = process.argv.slice(2);
80450
80509
  var requestedGlobalHelp = args.length === 1 && (args[0] === "--help" || args[0] === "-h");
80451
80510
  var requestedVersion = args.length === 1 && (args[0] === "--version" || args[0] === "-V");