@scheduler-systems/gal-run 0.0.347 → 0.0.349

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 +112 -4
  2. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -3970,7 +3970,7 @@ var cliVersion, defaultApiUrl, BUILD_CONSTANTS, constants_default;
3970
3970
  var init_constants = __esm({
3971
3971
  "src/constants.ts"() {
3972
3972
  "use strict";
3973
- cliVersion = true ? "0.0.347" : "0.0.0-dev";
3973
+ cliVersion = true ? "0.0.349" : "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.347" : void 0;
4883
+ const version = true ? "0.0.349" : 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.347" : "0.0.0-dev";
5252
+ return true ? "0.0.349" : "0.0.0-dev";
5253
5253
  } catch {
5254
5254
  return "0.0.0-dev";
5255
5255
  }
@@ -5802,6 +5802,14 @@ var init_credentials = __esm({
5802
5802
  refreshTokenRequired: true,
5803
5803
  // Google OAuth access tokens start with ya29.
5804
5804
  accessTokenPattern: /^ya29\./
5805
+ },
5806
+ {
5807
+ id: "cursor",
5808
+ displayName: "Cursor",
5809
+ icon: "\u{1F3AF}",
5810
+ instructions: "Run `gal auth cursor` after authenticating with Cursor CLI",
5811
+ tokenHint: "Cursor access token",
5812
+ refreshTokenRequired: false
5805
5813
  }
5806
5814
  ];
5807
5815
  }
@@ -36171,6 +36179,106 @@ Source: ${credentialSource2}`));
36171
36179
  process.exit(1);
36172
36180
  }
36173
36181
  });
36182
+ auth.command("cursor").description("Sync Cursor credentials to GAL for background agent sessions").option("-v, --verbose", "Show detailed credential discovery information").option("--access-token <token>", "Use provided access token instead of reading from Cursor auth file").action(async (options) => {
36183
+ const verbose = options.verbose || false;
36184
+ console.log(source_default.cyan("\n\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550"));
36185
+ console.log(source_default.cyan(" GAL CLI - Cursor Credentials Sync"));
36186
+ console.log(source_default.cyan("\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\n"));
36187
+ const config = ConfigManager.load();
36188
+ if (!config.authToken) {
36189
+ console.log(source_default.red("Not authenticated with GAL."));
36190
+ console.log(source_default.dim("Run: gal auth login\n"));
36191
+ process.exit(1);
36192
+ }
36193
+ const spinner = ora("Reading Cursor credentials...").start();
36194
+ let credentialSource2 = "";
36195
+ try {
36196
+ let accessToken;
36197
+ if (options.accessToken) {
36198
+ accessToken = options.accessToken;
36199
+ credentialSource2 = "command line --access-token";
36200
+ if (verbose) {
36201
+ spinner.info(source_default.dim(" Using access token from command line"));
36202
+ }
36203
+ } else {
36204
+ const cursorAuthPath = (0, import_path20.join)((0, import_os18.homedir)(), ".cursor", "auth.json");
36205
+ if (verbose) {
36206
+ spinner.info(source_default.dim(` Trying ${cursorAuthPath}...`));
36207
+ }
36208
+ if ((0, import_fs21.existsSync)(cursorAuthPath)) {
36209
+ try {
36210
+ const content = (0, import_fs21.readFileSync)(cursorAuthPath, "utf-8");
36211
+ const authData = JSON.parse(content);
36212
+ if (verbose) {
36213
+ spinner.info(source_default.dim(` Found auth.json, checking tokens...`));
36214
+ }
36215
+ if (authData.accessToken) {
36216
+ accessToken = authData.accessToken;
36217
+ credentialSource2 = "~/.cursor/auth.json";
36218
+ if (verbose) {
36219
+ spinner.succeed(source_default.dim(` Found access token in Cursor auth.json`));
36220
+ }
36221
+ }
36222
+ } catch (parseError) {
36223
+ if (verbose) {
36224
+ const err = parseError instanceof Error ? parseError : new Error(String(parseError));
36225
+ spinner.warn(source_default.dim(` Failed to parse auth.json: ${err.message}`));
36226
+ }
36227
+ }
36228
+ } else if (verbose) {
36229
+ spinner.warn(source_default.dim(` ${cursorAuthPath} not found`));
36230
+ }
36231
+ }
36232
+ if (!accessToken) {
36233
+ spinner.fail(source_default.red("No Cursor credentials found"));
36234
+ console.log(source_default.dim("\nTo authenticate with Cursor:"));
36235
+ console.log(source_default.dim(" 1. Open Cursor and sign in"));
36236
+ console.log(source_default.dim(" 2. Then run: gal auth cursor\n"));
36237
+ console.log(source_default.dim("Or provide an access token directly:"));
36238
+ console.log(source_default.dim(" gal auth cursor --access-token <your-cursor-token>\n"));
36239
+ process.exit(1);
36240
+ }
36241
+ spinner.text = "Syncing to GAL...";
36242
+ const credProvider = new CoreServiceProvider({ apiUrl: config.apiUrl || "", authToken: config.authToken });
36243
+ const response = await credProvider.getAuthRepository().syncCredentials("cursor", {
36244
+ accessToken
36245
+ });
36246
+ if (!response.success) {
36247
+ throw new Error(response.error || "Failed to store credentials");
36248
+ }
36249
+ spinner.succeed(source_default.green("Cursor credentials synced to GAL!"));
36250
+ trackAuthProvider({
36251
+ provider: "cursor",
36252
+ success: true,
36253
+ tokenType: options.accessToken ? "setup-token" : "oauth-session",
36254
+ credentialSource: credentialSource2
36255
+ });
36256
+ if (credentialSource2) {
36257
+ console.log(source_default.dim(`
36258
+ Source: ${credentialSource2}`));
36259
+ }
36260
+ await validateAfterSync(config, "cursor");
36261
+ console.log(source_default.green("\n\u2713 Background agent sessions can now use Cursor.\n"));
36262
+ process.exit(0);
36263
+ } catch (error2) {
36264
+ const err = error2 instanceof Error ? error2 : new Error(String(error2));
36265
+ trackAuthProvider({
36266
+ provider: "cursor",
36267
+ success: false,
36268
+ tokenType: options.accessToken ? "setup-token" : "oauth-session",
36269
+ credentialSource: credentialSource2 || "unknown",
36270
+ error: err.message
36271
+ });
36272
+ if (err.message.includes("401") || err.message.includes("unauthorized")) {
36273
+ spinner.fail(source_default.red("GAL authentication expired"));
36274
+ console.log(source_default.dim("Run: gal auth login\n"));
36275
+ } else {
36276
+ spinner.fail(source_default.red("Failed to sync credentials"));
36277
+ console.log(source_default.red(err.message));
36278
+ }
36279
+ process.exit(1);
36280
+ }
36281
+ });
36174
36282
  auth.command("onboard").description("Interactive wizard to set up AI provider credentials").action(async () => {
36175
36283
  console.log(source_default.green("\n\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550"));
36176
36284
  console.log(source_default.green(" GAL CLI - Provider Onboarding Wizard"));
@@ -55267,7 +55375,7 @@ var init_index = __esm({
55267
55375
  });
55268
55376
 
55269
55377
  // src/bootstrap.ts
55270
- var cliVersion10 = true ? "0.0.347" : "0.0.0-dev";
55378
+ var cliVersion10 = true ? "0.0.349" : "0.0.0-dev";
55271
55379
  var args = process.argv.slice(2);
55272
55380
  var requestedGlobalHelp = args.length === 1 && (args[0] === "--help" || args[0] === "-h");
55273
55381
  var requestedVersion = args.length === 1 && (args[0] === "--version" || args[0] === "-V");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scheduler-systems/gal-run",
3
- "version": "0.0.347",
3
+ "version": "0.0.349",
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,