@scheduler-systems/gal-run 0.0.569 → 0.0.570

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 +46 -14
  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.569" : "0.0.0-dev";
3958
+ cliVersion = true ? "0.0.570" : "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;
@@ -11858,7 +11858,7 @@ function detectEnvironment() {
11858
11858
  return "dev";
11859
11859
  }
11860
11860
  try {
11861
- const version2 = true ? "0.0.569" : void 0;
11861
+ const version2 = true ? "0.0.570" : void 0;
11862
11862
  if (version2 && version2.includes("-local")) {
11863
11863
  return "dev";
11864
11864
  }
@@ -14539,7 +14539,7 @@ function getId() {
14539
14539
  }
14540
14540
  function getCliVersion() {
14541
14541
  try {
14542
- return true ? "0.0.569" : "0.0.0-dev";
14542
+ return true ? "0.0.570" : "0.0.0-dev";
14543
14543
  } catch {
14544
14544
  return "0.0.0-dev";
14545
14545
  }
@@ -68494,15 +68494,26 @@ function readMcpConfig(mcpPath) {
68494
68494
  }
68495
68495
  return parsed;
68496
68496
  }
68497
- function upsertHostedGalServer(mcpConfig, serverName, apiUrl) {
68497
+ function upsertHostedGalServer(mcpConfig, serverName, apiUrl, authToken) {
68498
68498
  const next = { ...mcpConfig };
68499
68499
  const existingServers = next.mcpServers && typeof next.mcpServers === "object" && !Array.isArray(next.mcpServers) ? next.mcpServers : {};
68500
68500
  next.mcpServers = { ...existingServers };
68501
- next.mcpServers[serverName] = {
68502
- type: "http",
68503
- transport: "http",
68504
- url: buildMcpUrl(apiUrl)
68505
- };
68501
+ if (authToken) {
68502
+ next.mcpServers[serverName] = {
68503
+ type: "http",
68504
+ transport: "http",
68505
+ url: buildMcpUrl(apiUrl),
68506
+ headers: {
68507
+ Authorization: `Bearer ${authToken}`
68508
+ }
68509
+ };
68510
+ } else {
68511
+ next.mcpServers[serverName] = {
68512
+ type: "http",
68513
+ transport: "http",
68514
+ url: buildMcpUrl(apiUrl)
68515
+ };
68516
+ }
68506
68517
  return next;
68507
68518
  }
68508
68519
  async function postMcpJsonRpc(endpoint, authToken, method, params, timeoutMs) {
@@ -68548,7 +68559,8 @@ async function runMcpDoctor(options = {}) {
68548
68559
  const fallbackApiUrl = resolveApiUrl2(options.apiUrl || config2.apiUrl || defaultApiUrl12);
68549
68560
  let endpoint = buildMcpUrl(fallbackApiUrl);
68550
68561
  const mcpPath = (0, import_path38.join)(directory, ".mcp.json");
68551
- const authToken = options.authToken ?? config2.authToken;
68562
+ const configAuthToken = options.authToken ?? config2.authToken;
68563
+ let authToken = configAuthToken;
68552
68564
  const timeoutMs = options.timeoutMs ?? 1e4;
68553
68565
  const result = {
68554
68566
  success: false,
@@ -68601,13 +68613,24 @@ async function runMcpDoctor(options = {}) {
68601
68613
  result.warnings.push(`Using configured MCP endpoint ${configuredEndpoint} instead of default ${fallbackEndpoint}`);
68602
68614
  }
68603
68615
  }
68616
+ const headers = serverEntry.headers;
68617
+ if (headers && typeof headers === "object" && !Array.isArray(headers)) {
68618
+ const authHeader = headers.Authorization;
68619
+ if (typeof authHeader === "string" && authHeader.startsWith("Bearer ")) {
68620
+ const tokenFromConfig = authHeader.slice("Bearer ".length).trim();
68621
+ if (tokenFromConfig) {
68622
+ authToken = tokenFromConfig;
68623
+ }
68624
+ }
68625
+ }
68604
68626
  } else {
68605
68627
  result.checks.serverConfig = { ok: false, message: `mcpServers.${serverName} missing` };
68606
68628
  result.errors.push(result.checks.serverConfig.message);
68607
68629
  }
68608
68630
  }
68609
68631
  if (authToken) {
68610
- result.checks.authToken = { ok: true, message: "GAL auth token is available" };
68632
+ const source = authToken !== configAuthToken ? "from .mcp.json headers" : "from ~/.gal/config.json";
68633
+ result.checks.authToken = { ok: true, message: `GAL auth token is available (${source})` };
68611
68634
  } else {
68612
68635
  result.checks.authToken = { ok: false, message: "No GAL auth token. Run: gal auth login" };
68613
68636
  result.errors.push(result.checks.authToken.message);
@@ -68710,12 +68733,21 @@ function createSetupCommand() {
68710
68733
  console.error(source_default.red(`Failed to read ${mcpPath}: ${error3 instanceof Error ? error3.message : String(error3)}`));
68711
68734
  process.exit(1);
68712
68735
  }
68713
- const next = upsertHostedGalServer(existing, serverName, apiUrl);
68736
+ if (!config2.authToken) {
68737
+ console.log(source_default.yellow("Warning: No GAL auth token found. The MCP server entry will be written without an Authorization header."));
68738
+ console.log(source_default.dim("Run `gal auth login` to authenticate, then re-run `gal mcp setup` to inject the token.\n"));
68739
+ }
68740
+ const next = upsertHostedGalServer(existing, serverName, apiUrl, config2.authToken);
68714
68741
  (0, import_fs38.mkdirSync)(directory, { recursive: true });
68715
68742
  (0, import_fs38.writeFileSync)(mcpPath, JSON.stringify(next, null, 2) + "\n", "utf-8");
68716
68743
  console.log(source_default.green(`\u2713 Updated ${mcpPath}`));
68717
- console.log(source_default.dim(` mcpServers.${serverName}.url = ${buildMcpUrl(apiUrl)}
68744
+ console.log(source_default.dim(` mcpServers.${serverName}.url = ${buildMcpUrl(apiUrl)}`));
68745
+ if (config2.authToken) {
68746
+ console.log(source_default.dim(` mcpServers.${serverName}.headers.Authorization = Bearer <token>
68718
68747
  `));
68748
+ } else {
68749
+ console.log();
68750
+ }
68719
68751
  if (options.skipDoctor) {
68720
68752
  return;
68721
68753
  }
@@ -80952,7 +80984,7 @@ var init_index = __esm({
80952
80984
  }
80953
80985
  });
80954
80986
 
80955
- var cliVersion11 = true ? "0.0.569" : "0.0.0-dev";
80987
+ var cliVersion11 = true ? "0.0.570" : "0.0.0-dev";
80956
80988
  var args = process.argv.slice(2);
80957
80989
  var requestedGlobalHelp = args.length === 1 && (args[0] === "--help" || args[0] === "-h");
80958
80990
  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.569",
3
+ "version": "0.0.570",
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,