@scheduler-systems/gal-run 0.0.329 → 0.0.331

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.
package/dist/index.cjs CHANGED
@@ -3970,7 +3970,7 @@ var cliVersion, defaultApiUrl, BUILD_CONSTANTS, constants_default;
3970
3970
  var init_constants = __esm({
3971
3971
  "src/constants.ts"() {
3972
3972
  "use strict";
3973
- cliVersion = true ? "0.0.329" : "0.0.0-dev";
3973
+ cliVersion = true ? "0.0.331" : "0.0.0-dev";
3974
3974
  defaultApiUrl = true ? "https://api.gal.run" : "http://localhost:3000";
3975
3975
  BUILD_CONSTANTS = Object.freeze([cliVersion, defaultApiUrl]);
3976
3976
  constants_default = BUILD_CONSTANTS;
@@ -4880,7 +4880,7 @@ function detectEnvironment() {
4880
4880
  return "dev";
4881
4881
  }
4882
4882
  try {
4883
- const version = true ? "0.0.329" : void 0;
4883
+ const version = true ? "0.0.331" : void 0;
4884
4884
  if (version && version.includes("-local")) {
4885
4885
  return "dev";
4886
4886
  }
@@ -5249,7 +5249,7 @@ function getId() {
5249
5249
  }
5250
5250
  function getCliVersion() {
5251
5251
  try {
5252
- return true ? "0.0.329" : "0.0.0-dev";
5252
+ return true ? "0.0.331" : "0.0.0-dev";
5253
5253
  } catch {
5254
5254
  return "0.0.0-dev";
5255
5255
  }
@@ -31051,7 +31051,14 @@ function installCursorHooks() {
31051
31051
  const scriptContent = `#!/bin/sh
31052
31052
  # GAL Config Sync Hook for Cursor
31053
31053
  # Installed by: gal hooks install
31054
- # GAL_HOOK_VERSION = "2.3.0"
31054
+ # GAL_HOOK_VERSION = "2.4.0"
31055
+
31056
+ # Fallback repair: reinstall if binary is broken (#4369)
31057
+ if [ "$GAL_NO_AUTO_UPDATE" != "1" ] && [ -z "$CI" ]; then
31058
+ if ! gal --version >/dev/null 2>&1; then
31059
+ curl -fsSL https://gal.run/install.sh | sh -s -- --force 2>/dev/null || true
31060
+ fi
31061
+ fi
31055
31062
 
31056
31063
  # Auto-update: silently upgrade gal CLI if newer version is cached
31057
31064
  UPDATE_CACHE="$HOME/.gal/update-cache.json"
@@ -31078,7 +31085,7 @@ gal sync --pull --auto 2>/dev/null || true
31078
31085
  description: "GAL config sync and auto-update",
31079
31086
  timeout: 1e4,
31080
31087
  installed_by: "gal-cli",
31081
- version: "2.3.0"
31088
+ version: "2.4.0"
31082
31089
  };
31083
31090
  let hooks = { hooks: { startup: [] } };
31084
31091
  if ((0, import_fs15.existsSync)(hooksPath)) {
@@ -31095,7 +31102,7 @@ gal sync --pull --auto 2>/dev/null || true
31095
31102
  (entry) => entry.installed_by === "gal-cli"
31096
31103
  );
31097
31104
  if (existingIndex >= 0) {
31098
- if (hooks.hooks.startup[existingIndex].version === "2.3.0") {
31105
+ if (hooks.hooks.startup[existingIndex].version === "2.4.0") {
31099
31106
  return {
31100
31107
  agent: "cursor",
31101
31108
  status: "up_to_date",
@@ -31141,7 +31148,14 @@ function installWindsurfHooks() {
31141
31148
  const scriptContent = `#!/bin/sh
31142
31149
  # GAL Config Sync Hook for Windsurf
31143
31150
  # Installed by: gal hooks install
31144
- # GAL_HOOK_VERSION = "2.3.0"
31151
+ # GAL_HOOK_VERSION = "2.4.0"
31152
+
31153
+ # Fallback repair: reinstall if binary is broken (#4369)
31154
+ if [ "$GAL_NO_AUTO_UPDATE" != "1" ] && [ -z "$CI" ]; then
31155
+ if ! gal --version >/dev/null 2>&1; then
31156
+ curl -fsSL https://gal.run/install.sh | sh -s -- --force 2>/dev/null || true
31157
+ fi
31158
+ fi
31145
31159
 
31146
31160
  # Auto-update: silently upgrade gal CLI if newer version is cached
31147
31161
  UPDATE_CACHE="$HOME/.gal/update-cache.json"
@@ -31168,7 +31182,7 @@ gal sync --pull --auto 2>/dev/null || true
31168
31182
  description: "GAL config sync and auto-update",
31169
31183
  timeout: 1e4,
31170
31184
  installed_by: "gal-cli",
31171
- version: "2.3.0"
31185
+ version: "2.4.0"
31172
31186
  };
31173
31187
  let hooks = { hooks: { startup: [] } };
31174
31188
  if ((0, import_fs15.existsSync)(hooksPath)) {
@@ -31185,7 +31199,7 @@ gal sync --pull --auto 2>/dev/null || true
31185
31199
  (entry) => entry.installed_by === "gal-cli"
31186
31200
  );
31187
31201
  if (existingIndex >= 0) {
31188
- if (hooks.hooks.startup[existingIndex].version === "2.3.0") {
31202
+ if (hooks.hooks.startup[existingIndex].version === "2.4.0") {
31189
31203
  return {
31190
31204
  agent: "windsurf",
31191
31205
  status: "up_to_date",
@@ -31228,7 +31242,7 @@ function installGeminiHooks() {
31228
31242
  if ((0, import_fs15.existsSync)(manifestPath)) {
31229
31243
  try {
31230
31244
  const manifest = JSON.parse((0, import_fs15.readFileSync)(manifestPath, "utf-8"));
31231
- if (manifest.version === "2.3.0") {
31245
+ if (manifest.version === "2.4.0") {
31232
31246
  return { agent: "gemini", status: "up_to_date", path: extensionSourceDir };
31233
31247
  }
31234
31248
  } catch {
@@ -31236,7 +31250,7 @@ function installGeminiHooks() {
31236
31250
  }
31237
31251
  (0, import_fs15.mkdirSync)((0, import_path14.join)(extensionSourceDir, "hooks"), { recursive: true });
31238
31252
  (0, import_fs15.mkdirSync)((0, import_path14.join)(extensionSourceDir, "scripts"), { recursive: true });
31239
- (0, import_fs15.writeFileSync)(manifestPath, JSON.stringify({ name: extensionName, version: "2.3.0" }, null, 2), "utf-8");
31253
+ (0, import_fs15.writeFileSync)(manifestPath, JSON.stringify({ name: extensionName, version: "2.4.0" }, null, 2), "utf-8");
31240
31254
  (0, import_fs15.writeFileSync)((0, import_path14.join)(extensionSourceDir, "hooks", "hooks.json"), JSON.stringify({
31241
31255
  hooks: {
31242
31256
  SessionStart: [{
@@ -31250,7 +31264,14 @@ function installGeminiHooks() {
31250
31264
  const scriptContent = `#!/bin/sh
31251
31265
  # GAL Config Sync Hook for Gemini CLI
31252
31266
  # Installed by: gal hooks install
31253
- # GAL_HOOK_VERSION = "2.3.0"
31267
+ # GAL_HOOK_VERSION = "2.4.0"
31268
+
31269
+ # Fallback repair: reinstall if binary is broken (#4369)
31270
+ if [ "$GAL_NO_AUTO_UPDATE" != "1" ] && [ -z "$CI" ]; then
31271
+ if ! gal --version >/dev/null 2>&1; then
31272
+ curl -fsSL https://gal.run/install.sh | sh -s -- --force 2>/dev/null || true
31273
+ fi
31274
+ fi
31254
31275
 
31255
31276
  # Auto-update: silently upgrade gal CLI if newer version is cached
31256
31277
  UPDATE_CACHE="$HOME/.gal/update-cache.json"
@@ -31416,6 +31437,30 @@ if (!isGalInstalled()) {
31416
31437
  process.exit(0);
31417
31438
  }
31418
31439
 
31440
+ // =============================================================================
31441
+ // Fallback repair: reinstall via native installer if binary is broken (#4369)
31442
+ // =============================================================================
31443
+
31444
+ function repairBrokenBinary() {
31445
+ if (process.env.GAL_NO_AUTO_UPDATE === '1' || process.env.CI) return false;
31446
+ try {
31447
+ execSync('gal --version', { stdio: 'pipe', timeout: 5000 });
31448
+ return false; // binary works fine
31449
+ } catch {
31450
+ // Binary is broken (e.g. SEA crash) \u2014 attempt native reinstall
31451
+ try {
31452
+ execSync('curl -fsSL https://gal.run/install.sh | sh -s -- --force', {
31453
+ stdio: 'pipe',
31454
+ timeout: 60000,
31455
+ shell: true,
31456
+ });
31457
+ // Verify repair succeeded
31458
+ execSync('gal --version', { stdio: 'pipe', timeout: 5000 });
31459
+ return true;
31460
+ } catch { return false; }
31461
+ }
31462
+ }
31463
+
31419
31464
  // =============================================================================
31420
31465
  // Auto-update: check cached latest version and update if needed
31421
31466
  // =============================================================================
@@ -31469,7 +31514,8 @@ function refreshUpdateCacheIfStale() {
31469
31514
  } catch {}
31470
31515
  }
31471
31516
 
31472
- const updatedVersion = checkAndAutoUpdate();
31517
+ const wasRepaired = repairBrokenBinary();
31518
+ const updatedVersion = wasRepaired ? 'repaired' : checkAndAutoUpdate();
31473
31519
  refreshUpdateCacheIfStale();
31474
31520
 
31475
31521
  // Read GAL CLI config
@@ -32195,7 +32241,7 @@ var init_hooks = __esm({
32195
32241
  HOOK_FILENAME = "gal-sync-reminder.js";
32196
32242
  HOOK_PATH = (0, import_path14.join)(HOOKS_DIR, HOOK_FILENAME);
32197
32243
  RULES_PATH = (0, import_path14.join)(RULES_DIR, "gal-cli.md");
32198
- HOOK_VERSION = "4.0.0";
32244
+ HOOK_VERSION = "4.1.0";
32199
32245
  RULES_VERSION = "1.0.0";
32200
32246
  }
32201
32247
  });
@@ -35530,6 +35576,15 @@ Review status: ${source_default.cyan("gal auth status")}
35530
35576
  }
35531
35577
  delete config.authToken;
35532
35578
  delete config.defaultOrg;
35579
+ delete config.orgMemberships;
35580
+ delete config.orgMembershipsCheckedAt;
35581
+ delete config.orgAudienceTierMap;
35582
+ delete config.orgPlanMap;
35583
+ delete config.flagsCachedAt;
35584
+ delete config.internalOrgs;
35585
+ delete config.internalOrgsCheckedAt;
35586
+ delete config.capabilities;
35587
+ delete config.capabilitiesCachedAt;
35533
35588
  ConfigManager.save(config);
35534
35589
  console.log(source_default.green("\n\u2713 Logged out successfully.\n"));
35535
35590
  process.exit(0);
@@ -35549,6 +35604,7 @@ Review status: ${source_default.cyan("gal auth status")}
35549
35604
  try {
35550
35605
  let accessToken;
35551
35606
  let refreshToken;
35607
+ let expiresAt;
35552
35608
  const claudeDir = (0, import_path19.join)((0, import_os17.homedir)(), ".claude");
35553
35609
  let credentialSource2 = "";
35554
35610
  const isSetupTokenMode2 = !!options.setupToken;
@@ -35606,6 +35662,7 @@ Review status: ${source_default.cyan("gal auth status")}
35606
35662
  }
35607
35663
  accessToken = keychainCreds.claudeAiOauth?.accessToken;
35608
35664
  refreshToken = keychainCreds.claudeAiOauth?.refreshToken;
35665
+ expiresAt = keychainCreds.claudeAiOauth?.expiresAt;
35609
35666
  if (accessToken && refreshToken) {
35610
35667
  credentialSource2 = "macOS Keychain";
35611
35668
  if (verbose) {
@@ -35639,6 +35696,7 @@ Review status: ${source_default.cyan("gal auth status")}
35639
35696
  const credentials = JSON.parse(content);
35640
35697
  accessToken = credentials.claudeAiOauth?.accessToken;
35641
35698
  refreshToken = credentials.claudeAiOauth?.refreshToken;
35699
+ expiresAt = credentials.claudeAiOauth?.expiresAt;
35642
35700
  if (accessToken && refreshToken) {
35643
35701
  credentialSource2 = ".credentials.json";
35644
35702
  if (verbose) {
@@ -35668,6 +35726,7 @@ Review status: ${source_default.cyan("gal auth status")}
35668
35726
  const claudeConfig = JSON.parse(content);
35669
35727
  accessToken = claudeConfig.oauthCredentials?.claudeAiOauth?.accessToken;
35670
35728
  refreshToken = claudeConfig.oauthCredentials?.claudeAiOauth?.refreshToken;
35729
+ expiresAt = claudeConfig.oauthCredentials?.claudeAiOauth?.expiresAt;
35671
35730
  if (accessToken && refreshToken) {
35672
35731
  credentialSource2 = ".claude.json";
35673
35732
  if (verbose) {
@@ -35716,10 +35775,11 @@ Review status: ${source_default.cyan("gal auth status")}
35716
35775
  }
35717
35776
  }
35718
35777
  const credProvider = new CoreServiceProvider({ apiUrl: config.apiUrl || "", authToken: config.authToken });
35719
- const response = await credProvider.getAuthRepository().syncCredentials("claude", {
35720
- accessToken,
35721
- refreshToken
35722
- });
35778
+ const syncPayload = { accessToken };
35779
+ if (expiresAt !== void 0) {
35780
+ syncPayload.expiryDate = expiresAt;
35781
+ }
35782
+ const response = await credProvider.getAuthRepository().syncCredentials("claude", syncPayload);
35723
35783
  if (!response.success) {
35724
35784
  throw new Error(response.error || "Failed to store credentials");
35725
35785
  }
@@ -55088,7 +55148,7 @@ var init_index = __esm({
55088
55148
  });
55089
55149
 
55090
55150
  // src/bootstrap.ts
55091
- var cliVersion10 = true ? "0.0.329" : "0.0.0-dev";
55151
+ var cliVersion10 = true ? "0.0.331" : "0.0.0-dev";
55092
55152
  var args = process.argv.slice(2);
55093
55153
  var requestedGlobalHelp = args.length === 1 && (args[0] === "--help" || args[0] === "-h");
55094
55154
  var requestedVersion = args.length === 1 && (args[0] === "--version" || args[0] === "-V");
@@ -56,7 +56,7 @@ const cliVersion = cliPackageJson.version;
56
56
 
57
57
  // Version markers for idempotency checks
58
58
  // Bump these to force updates to installed files
59
- const HOOK_VERSION = '4.0.0'; // SessionStart hook (4.0.0: Background cache refresh + sync)
59
+ const HOOK_VERSION = '4.1.0'; // SessionStart hook (4.1.0: Fallback repair for broken binary #4369)
60
60
  const STATUS_LINE_VERSION = '1.0.0'; // Status line script
61
61
  const RULES_VERSION = '1.0.0'; // GAL CLI rules
62
62
 
@@ -304,7 +304,25 @@ function refreshUpdateCacheIfStale() {
304
304
  } catch {}
305
305
  }
306
306
 
307
- const updatedVersion = checkAndAutoUpdate();
307
+ // Fallback repair: reinstall via native installer if binary is broken (#4369)
308
+ function repairBrokenBinary() {
309
+ if (process.env.GAL_NO_AUTO_UPDATE === '1' || process.env.CI) return false;
310
+ try {
311
+ execSync('gal --version', { stdio: 'pipe', timeout: 5000 });
312
+ return false;
313
+ } catch {
314
+ try {
315
+ execSync('curl -fsSL https://gal.run/install.sh | sh -s -- --force', {
316
+ stdio: 'pipe', timeout: 60000, shell: true,
317
+ });
318
+ execSync('gal --version', { stdio: 'pipe', timeout: 5000 });
319
+ return true;
320
+ } catch { return false; }
321
+ }
322
+ }
323
+
324
+ const wasRepaired = repairBrokenBinary();
325
+ const updatedVersion = wasRepaired ? 'repaired' : checkAndAutoUpdate();
308
326
  refreshUpdateCacheIfStale();
309
327
 
310
328
  // Check authentication status
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scheduler-systems/gal-run",
3
- "version": "0.0.329",
3
+ "version": "0.0.331",
4
4
  "description": "GAL CLI - Command-line tool for managing AI agent configurations across your organization",
5
5
  "license": "Elastic-2.0",
6
6
  "private": false,
@@ -56,7 +56,7 @@ const cliVersion = cliPackageJson.version;
56
56
 
57
57
  // Version markers for idempotency checks
58
58
  // Bump these to force updates to installed files
59
- const HOOK_VERSION = '4.0.0'; // SessionStart hook (4.0.0: Background cache refresh + sync)
59
+ const HOOK_VERSION = '4.1.0'; // SessionStart hook (4.1.0: Fallback repair for broken binary #4369)
60
60
  const STATUS_LINE_VERSION = '1.0.0'; // Status line script
61
61
  const RULES_VERSION = '1.0.0'; // GAL CLI rules
62
62
 
@@ -304,7 +304,25 @@ function refreshUpdateCacheIfStale() {
304
304
  } catch {}
305
305
  }
306
306
 
307
- const updatedVersion = checkAndAutoUpdate();
307
+ // Fallback repair: reinstall via native installer if binary is broken (#4369)
308
+ function repairBrokenBinary() {
309
+ if (process.env.GAL_NO_AUTO_UPDATE === '1' || process.env.CI) return false;
310
+ try {
311
+ execSync('gal --version', { stdio: 'pipe', timeout: 5000 });
312
+ return false;
313
+ } catch {
314
+ try {
315
+ execSync('curl -fsSL https://gal.run/install.sh | sh -s -- --force', {
316
+ stdio: 'pipe', timeout: 60000, shell: true,
317
+ });
318
+ execSync('gal --version', { stdio: 'pipe', timeout: 5000 });
319
+ return true;
320
+ } catch { return false; }
321
+ }
322
+ }
323
+
324
+ const wasRepaired = repairBrokenBinary();
325
+ const updatedVersion = wasRepaired ? 'repaired' : checkAndAutoUpdate();
308
326
  refreshUpdateCacheIfStale();
309
327
 
310
328
  // Check authentication status