@scheduler-systems/gal-run 0.0.578 → 0.0.587

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 +63 -31
  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.578" : "0.0.0-dev";
3958
+ cliVersion = true ? "0.0.587" : "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;
@@ -11868,7 +11868,7 @@ function detectEnvironment() {
11868
11868
  return "dev";
11869
11869
  }
11870
11870
  try {
11871
- const version2 = true ? "0.0.578" : void 0;
11871
+ const version2 = true ? "0.0.587" : void 0;
11872
11872
  if (version2 && version2.includes("-local")) {
11873
11873
  return "dev";
11874
11874
  }
@@ -14549,7 +14549,7 @@ function getId() {
14549
14549
  }
14550
14550
  function getCliVersion() {
14551
14551
  try {
14552
- return true ? "0.0.578" : "0.0.0-dev";
14552
+ return true ? "0.0.587" : "0.0.0-dev";
14553
14553
  } catch {
14554
14554
  return "0.0.0-dev";
14555
14555
  }
@@ -55639,8 +55639,8 @@ async function pushLearnings(directory, orgName, apiUrl, headers, options) {
55639
55639
  let repoSlug;
55640
55640
  let sessionId = process.env.CLAUDE_SESSION_ID || `cli-${Date.now()}`;
55641
55641
  try {
55642
- const { execSync: execSync16 } = await import("child_process");
55643
- const remoteUrl = execSync16("git remote get-url origin", { cwd: directory, encoding: "utf-8" }).trim();
55642
+ const { execSync: execSync17 } = await import("child_process");
55643
+ const remoteUrl = execSync17("git remote get-url origin", { cwd: directory, encoding: "utf-8" }).trim();
55644
55644
  const match = remoteUrl.match(/github\.com[:/]([^/]+\/[^/]+?)(\.git)?$/);
55645
55645
  if (match) {
55646
55646
  repoSlug = match[1];
@@ -60051,6 +60051,22 @@ var init_code_process = __esm({
60051
60051
  }
60052
60052
  });
60053
60053
 
60054
+ function getVertexAccessToken() {
60055
+ try {
60056
+ return (0, import_node_child_process.execSync)("gcloud auth print-access-token", { encoding: "utf-8", stdio: ["ignore", "pipe", "ignore"] }).trim();
60057
+ } catch {
60058
+ return null;
60059
+ }
60060
+ }
60061
+ function buildOpencodeEnv() {
60062
+ const token = getVertexAccessToken();
60063
+ const configContent = JSON.stringify(GLM_PROVIDER_CONFIG);
60064
+ return {
60065
+ ...process.env,
60066
+ ...token ? { VERTEX_ACCESS_TOKEN: token } : {},
60067
+ OPENCODE_CONFIG_CONTENT: configContent
60068
+ };
60069
+ }
60054
60070
  function isMissingBinaryError(error3) {
60055
60071
  return Boolean(
60056
60072
  error3 && typeof error3 === "object" && "code" in error3 && error3.code === "ENOENT"
@@ -60058,9 +60074,10 @@ function isMissingBinaryError(error3) {
60058
60074
  }
60059
60075
  async function runCodeVariant(variant, args2) {
60060
60076
  let lastError;
60077
+ const childEnv = variant === "opencode" ? buildOpencodeEnv() : process.env;
60061
60078
  for (const binary of VARIANT_BINARIES[variant]) {
60062
60079
  try {
60063
- return await runGalCode(binary, args2, process.env);
60080
+ return await runGalCode(binary, args2, childEnv);
60064
60081
  } catch (error3) {
60065
60082
  if (!isMissingBinaryError(error3)) {
60066
60083
  throw error3;
@@ -60079,7 +60096,7 @@ function addVariantCommand(command, variant, runVariant) {
60079
60096
  });
60080
60097
  }
60081
60098
  function createCodeCommand(runVariant = runCodeVariant) {
60082
- const command = new Command("code").description(GAL_CODE_REBUILD_MESSAGE).helpOption(false).enablePositionalOptions().allowUnknownOption(true).allowExcessArguments(true).action(async (...actionArgs) => {
60099
+ const command = new Command("code").description("Run GAL Code (powered by opencode)").helpOption(false).enablePositionalOptions().allowUnknownOption(true).allowExcessArguments(true).action(async (...actionArgs) => {
60083
60100
  const maybeCommand = actionArgs[actionArgs.length - 1];
60084
60101
  const leadingArgs = actionArgs.slice(0, maybeCommand instanceof Command ? -1 : actionArgs.length).flatMap((value) => {
60085
60102
  if (typeof value === "string") {
@@ -60092,26 +60109,26 @@ function createCodeCommand(runVariant = runCodeVariant) {
60092
60109
  });
60093
60110
  const args2 = leadingArgs.length > 0 ? leadingArgs : maybeCommand instanceof Command ? maybeCommand.args : [];
60094
60111
  if (args2[0] === "codex" || args2[0] === "opencode") {
60095
- const code = await runVariant(args2[0], args2.slice(1));
60096
- process.exit(code);
60112
+ const code2 = await runVariant(args2[0], args2.slice(1));
60113
+ process.exit(code2);
60097
60114
  return;
60098
60115
  }
60099
- console.error(GAL_CODE_REBUILD_MESSAGE);
60100
- process.exit(1);
60116
+ const code = await runVariant("opencode", args2);
60117
+ process.exit(code);
60101
60118
  });
60102
60119
  addVariantCommand(command, "codex", runVariant);
60103
60120
  addVariantCommand(command, "opencode", runVariant);
60104
60121
  return command;
60105
60122
  }
60106
- var import_node_os3, import_node_path2, GAL_CODE_REBUILD_MESSAGE, VARIANT_BINARIES;
60123
+ var import_node_child_process, import_node_os3, import_node_path2, VARIANT_BINARIES, GLM_PROVIDER_CONFIG;
60107
60124
  var init_code = __esm({
60108
60125
  "module_365"() {
60109
60126
  "use strict";
60127
+ import_node_child_process = require("node:child_process");
60110
60128
  import_node_os3 = __toESM(require("node:os"), 1);
60111
60129
  import_node_path2 = __toESM(require("node:path"), 1);
60112
60130
  init_esm();
60113
60131
  init_code_process();
60114
- GAL_CODE_REBUILD_MESSAGE = "GAL Code is being rebuilt \u2014 coming soon.";
60115
60132
  VARIANT_BINARIES = {
60116
60133
  codex: [
60117
60134
  import_node_path2.default.join(import_node_os3.default.homedir(), ".local", "bin", "gal-code-codex"),
@@ -60122,6 +60139,21 @@ var init_code = __esm({
60122
60139
  "gal-code-opencode"
60123
60140
  ]
60124
60141
  };
60142
+ GLM_PROVIDER_CONFIG = {
60143
+ provider: {
60144
+ glm: {
60145
+ npm: "@ai-sdk/openai-compatible",
60146
+ name: "GLM-5 (Vertex AI)",
60147
+ options: {
60148
+ baseURL: "https://us-central1-aiplatform.googleapis.com/v1/projects/scheduler-systems-infra/locations/us-central1/endpoints/openapi/"
60149
+ },
60150
+ models: {
60151
+ "zai-org/glm-5-maas": { name: "GLM-5" }
60152
+ }
60153
+ }
60154
+ },
60155
+ model: "glm/zai-org/glm-5-maas"
60156
+ };
60125
60157
  }
60126
60158
  });
60127
60159
 
@@ -65081,8 +65113,8 @@ async function fetchWithAuth(url, authToken) {
65081
65113
  }
65082
65114
  async function resolveOrgFromGit(basePath) {
65083
65115
  try {
65084
- const { execSync: execSync16 } = await import("node:child_process");
65085
- const remote = execSync16("git remote get-url origin", { cwd: basePath, encoding: "utf-8" }).trim();
65116
+ const { execSync: execSync17 } = await import("node:child_process");
65117
+ const remote = execSync17("git remote get-url origin", { cwd: basePath, encoding: "utf-8" }).trim();
65086
65118
  const sshMatch = remote.match(/:([^/]+)\//);
65087
65119
  const httpsMatch = remote.match(/github\.com\/([^/]+)\//);
65088
65120
  return sshMatch?.[1] || httpsMatch?.[1] || null;
@@ -65850,7 +65882,7 @@ function getMachineId() {
65850
65882
  }
65851
65883
  function getGitEmail() {
65852
65884
  try {
65853
- return (0, import_node_child_process.execSync)("git config user.email", { encoding: "utf-8" }).trim();
65885
+ return (0, import_node_child_process2.execSync)("git config user.email", { encoding: "utf-8" }).trim();
65854
65886
  } catch {
65855
65887
  return null;
65856
65888
  }
@@ -66229,7 +66261,7 @@ Fleet Status: ${orgName}
66229
66261
  });
66230
66262
  return fleet;
66231
66263
  }
66232
- var import_node_os5, import_node_child_process, import_node_crypto2, import_promises6, import_meta2, defaultApiUrl8;
66264
+ var import_node_os5, import_node_child_process2, import_node_crypto2, import_promises6, import_meta2, defaultApiUrl8;
66233
66265
  var init_fleet = __esm({
66234
66266
  "module_387"() {
66235
66267
  "use strict";
@@ -66238,7 +66270,7 @@ var init_fleet = __esm({
66238
66270
  init_ora();
66239
66271
  init_constants();
66240
66272
  import_node_os5 = require("node:os");
66241
- import_node_child_process = require("node:child_process");
66273
+ import_node_child_process2 = require("node:child_process");
66242
66274
  import_node_crypto2 = require("node:crypto");
66243
66275
  import_promises6 = require("node:fs/promises");
66244
66276
  init_CoreServiceProvider();
@@ -67034,7 +67066,7 @@ function getMachineId2() {
67034
67066
  }
67035
67067
  function getGitEmail2() {
67036
67068
  try {
67037
- return (0, import_node_child_process2.execSync)("git config user.email", { encoding: "utf-8" }).trim();
67069
+ return (0, import_node_child_process3.execSync)("git config user.email", { encoding: "utf-8" }).trim();
67038
67070
  } catch {
67039
67071
  return null;
67040
67072
  }
@@ -67301,7 +67333,7 @@ Error: ${useResult.error || "Unknown error"}`));
67301
67333
  });
67302
67334
  return join62;
67303
67335
  }
67304
- var import_node_os6, import_node_child_process2, import_node_crypto3, import_promises7, import_node_path6, defaultApiUrl9;
67336
+ var import_node_os6, import_node_child_process3, import_node_crypto3, import_promises7, import_node_path6, defaultApiUrl9;
67305
67337
  var init_join = __esm({
67306
67338
  "module_391"() {
67307
67339
  "use strict";
@@ -67310,7 +67342,7 @@ var init_join = __esm({
67310
67342
  init_ora();
67311
67343
  init_constants();
67312
67344
  import_node_os6 = require("node:os");
67313
- import_node_child_process2 = require("node:child_process");
67345
+ import_node_child_process3 = require("node:child_process");
67314
67346
  import_node_crypto3 = require("node:crypto");
67315
67347
  import_promises7 = require("node:fs/promises");
67316
67348
  import_node_path6 = require("node:path");
@@ -69000,16 +69032,16 @@ async function createIssues(drafts, context, onProgress) {
69000
69032
  }
69001
69033
  return results;
69002
69034
  }
69003
- var import_node_child_process3, import_promises9, import_node_os8, import_node_path8, import_node_util2, execFile;
69035
+ var import_node_child_process4, import_promises9, import_node_os8, import_node_path8, import_node_util2, execFile;
69004
69036
  var init_issue_creator = __esm({
69005
69037
  "module_400"() {
69006
69038
  "use strict";
69007
- import_node_child_process3 = require("node:child_process");
69039
+ import_node_child_process4 = require("node:child_process");
69008
69040
  import_promises9 = require("node:fs/promises");
69009
69041
  import_node_os8 = require("node:os");
69010
69042
  import_node_path8 = require("node:path");
69011
69043
  import_node_util2 = require("node:util");
69012
- execFile = (0, import_node_util2.promisify)(import_node_child_process3.execFile);
69044
+ execFile = (0, import_node_util2.promisify)(import_node_child_process4.execFile);
69013
69045
  }
69014
69046
  });
69015
69047
 
@@ -69041,7 +69073,7 @@ async function maybeEditDraftsWithEditor(drafts, editor) {
69041
69073
  await (0, import_promises10.writeFile)(tempPath, `${JSON.stringify(drafts, null, 2)}
69042
69074
  `, "utf-8");
69043
69075
  try {
69044
- const result = (0, import_node_child_process4.spawnSync)(editor, [tempPath], { stdio: "inherit" });
69076
+ const result = (0, import_node_child_process5.spawnSync)(editor, [tempPath], { stdio: "inherit" });
69045
69077
  if (result.status !== 0) {
69046
69078
  throw new Error(`${editor} exited with status ${result.status ?? "unknown"}.`);
69047
69079
  }
@@ -69094,12 +69126,12 @@ async function reviewDraftIssues(transcript, drafts, options = {}) {
69094
69126
  const approvedIndexes = parseApprovalSelection(selection, workingDrafts.length);
69095
69127
  return approvedIndexes.map((index) => workingDrafts[index]).filter(Boolean);
69096
69128
  }
69097
- var import_node_readline, import_node_child_process4, import_promises10, import_node_os9, import_node_path9;
69129
+ var import_node_readline, import_node_child_process5, import_promises10, import_node_os9, import_node_path9;
69098
69130
  var init_transcript_review = __esm({
69099
69131
  "module_401"() {
69100
69132
  "use strict";
69101
69133
  import_node_readline = require("node:readline");
69102
- import_node_child_process4 = require("node:child_process");
69134
+ import_node_child_process5 = require("node:child_process");
69103
69135
  import_promises10 = require("node:fs/promises");
69104
69136
  import_node_os9 = require("node:os");
69105
69137
  import_node_path9 = require("node:path");
@@ -69127,7 +69159,7 @@ function parseGithubRepoFromRemote(remote) {
69127
69159
  }
69128
69160
  function detectCurrentRepo() {
69129
69161
  try {
69130
- const remote = (0, import_node_child_process5.execFileSync)("git", ["config", "--get", "remote.origin.url"], {
69162
+ const remote = (0, import_node_child_process6.execFileSync)("git", ["config", "--get", "remote.origin.url"], {
69131
69163
  encoding: "utf-8",
69132
69164
  stdio: ["ignore", "pipe", "ignore"]
69133
69165
  }).trim();
@@ -69320,11 +69352,11 @@ function createOpsCommand() {
69320
69352
  });
69321
69353
  return command;
69322
69354
  }
69323
- var import_node_child_process5, import_promises11, DEFAULT_TRANSCRIPT_REPO;
69355
+ var import_node_child_process6, import_promises11, DEFAULT_TRANSCRIPT_REPO;
69324
69356
  var init_ops = __esm({
69325
69357
  "module_402"() {
69326
69358
  "use strict";
69327
- import_node_child_process5 = require("node:child_process");
69359
+ import_node_child_process6 = require("node:child_process");
69328
69360
  import_promises11 = require("node:fs/promises");
69329
69361
  init_esm();
69330
69362
  init_source();
@@ -80406,7 +80438,7 @@ var init_index = __esm({
80406
80438
  }
80407
80439
  });
80408
80440
 
80409
- var cliVersion10 = true ? "0.0.578" : "0.0.0-dev";
80441
+ var cliVersion10 = true ? "0.0.587" : "0.0.0-dev";
80410
80442
  var args = process.argv.slice(2);
80411
80443
  var requestedGlobalHelp = args.length === 1 && (args[0] === "--help" || args[0] === "-h");
80412
80444
  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.578",
3
+ "version": "0.0.587",
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,