@scheduler-systems/gal-run 0.0.587 → 0.0.589
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 +90 -40
- 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.
|
|
3958
|
+
cliVersion = true ? "0.0.589" : "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.
|
|
11871
|
+
const version2 = true ? "0.0.589" : 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.
|
|
14552
|
+
return true ? "0.0.589" : "0.0.0-dev";
|
|
14553
14553
|
} catch {
|
|
14554
14554
|
return "0.0.0-dev";
|
|
14555
14555
|
}
|
|
@@ -17951,10 +17951,10 @@ function getFeatureFlags() {
|
|
|
17951
17951
|
let isInternalFromApi = false;
|
|
17952
17952
|
let isPartnerFromApi = false;
|
|
17953
17953
|
try {
|
|
17954
|
-
const { readFileSync: readFileSync47, existsSync:
|
|
17954
|
+
const { readFileSync: readFileSync47, existsSync: existsSync55 } = require("fs");
|
|
17955
17955
|
const { join: join62 } = require("path");
|
|
17956
17956
|
const configPath = join62(resolveGalHomeDir(process.env), "config.json");
|
|
17957
|
-
if (
|
|
17957
|
+
if (existsSync55(configPath)) {
|
|
17958
17958
|
const config2 = JSON.parse(readFileSync47(configPath, "utf-8"));
|
|
17959
17959
|
const cacheAge = Date.now() - (config2.flagsCachedAt || config2.internalOrgsCheckedAt || 0);
|
|
17960
17960
|
if (cacheAge < CACHE_MAX_AGE_MS) {
|
|
@@ -50583,7 +50583,7 @@ function createApprovedConfigCommand() {
|
|
|
50583
50583
|
const spinner = options.json ? null : ora(`Fetching approved config for "${org}"...`).start();
|
|
50584
50584
|
try {
|
|
50585
50585
|
let findMdFiles2 = function(dir) {
|
|
50586
|
-
if (!
|
|
50586
|
+
if (!existsSync55(dir)) return [];
|
|
50587
50587
|
const entries = readdirSync19(dir, { withFileTypes: true });
|
|
50588
50588
|
const files = [];
|
|
50589
50589
|
for (const entry of entries) {
|
|
@@ -50605,7 +50605,7 @@ function createApprovedConfigCommand() {
|
|
|
50605
50605
|
}
|
|
50606
50606
|
return;
|
|
50607
50607
|
}
|
|
50608
|
-
const { existsSync:
|
|
50608
|
+
const { existsSync: existsSync55, readdirSync: readdirSync19, readFileSync: readFileSync47 } = await import("fs");
|
|
50609
50609
|
const { join: join62, relative: relative10, basename: basename10 } = await import("path");
|
|
50610
50610
|
const baseDir = options.dir || process.cwd();
|
|
50611
50611
|
const commandsDir = join62(baseDir, ".claude", "commands");
|
|
@@ -60051,9 +60051,49 @@ var init_code_process = __esm({
|
|
|
60051
60051
|
}
|
|
60052
60052
|
});
|
|
60053
60053
|
|
|
60054
|
+
function resolveWorkspaceOpencodeConfigDir(workspaceRoot) {
|
|
60055
|
+
if (!workspaceRoot) {
|
|
60056
|
+
return null;
|
|
60057
|
+
}
|
|
60058
|
+
const configDir = import_node_path2.default.join(workspaceRoot, ...OPENCODE_CONFIG_PATH);
|
|
60059
|
+
return (0, import_node_fs2.existsSync)(configDir) ? configDir : null;
|
|
60060
|
+
}
|
|
60061
|
+
function buildCodeChildEnv(baseEnv, options = {}) {
|
|
60062
|
+
const childEnv = { ...baseEnv };
|
|
60063
|
+
const config2 = options.config ?? ConfigManager.load();
|
|
60064
|
+
const workspaceRoot = options.workspaceRoot ?? detectGalWorkspaceRoot();
|
|
60065
|
+
if (!childEnv.GAL_CODE_MODE && ConfigManager.getEnvironment() === "dev") {
|
|
60066
|
+
childEnv.GAL_CODE_MODE = "dev";
|
|
60067
|
+
}
|
|
60068
|
+
if (!childEnv.GAL_AUTH_TOKEN && config2.authToken) {
|
|
60069
|
+
childEnv.GAL_AUTH_TOKEN = config2.authToken;
|
|
60070
|
+
}
|
|
60071
|
+
if (!childEnv.GAL_CODE_GAL_SESSION_TOKEN && childEnv.GAL_AUTH_TOKEN) {
|
|
60072
|
+
childEnv.GAL_CODE_GAL_SESSION_TOKEN = childEnv.GAL_AUTH_TOKEN;
|
|
60073
|
+
}
|
|
60074
|
+
if (!childEnv.GAL_CODE_WORKSPACE_ROOT && workspaceRoot) {
|
|
60075
|
+
childEnv.GAL_CODE_WORKSPACE_ROOT = workspaceRoot;
|
|
60076
|
+
}
|
|
60077
|
+
const opencodeConfigDir = resolveWorkspaceOpencodeConfigDir(workspaceRoot);
|
|
60078
|
+
if (!childEnv.OPENCODE_CONFIG_DIR && opencodeConfigDir) {
|
|
60079
|
+
childEnv.OPENCODE_CONFIG_DIR = opencodeConfigDir;
|
|
60080
|
+
}
|
|
60081
|
+
return childEnv;
|
|
60082
|
+
}
|
|
60083
|
+
function resolveCodeVariantBinaryCandidates(variant, galCodeMode) {
|
|
60084
|
+
const localWrapper = import_node_path2.default.join(import_node_os3.default.homedir(), ".local", "bin", `gal-code-${variant}`);
|
|
60085
|
+
const galWrapper = `gal-code-${variant}`;
|
|
60086
|
+
const officialBinary = OFFICIAL_VARIANT_BINARIES[variant];
|
|
60087
|
+
const localFirst = galCodeMode === "dev";
|
|
60088
|
+
const candidates = localFirst ? [localWrapper, galWrapper, officialBinary] : [officialBinary, localWrapper, galWrapper];
|
|
60089
|
+
return candidates.filter((binary, index) => candidates.indexOf(binary) === index);
|
|
60090
|
+
}
|
|
60054
60091
|
function getVertexAccessToken() {
|
|
60055
60092
|
try {
|
|
60056
|
-
return (0, import_node_child_process.execSync)("gcloud auth print-access-token", {
|
|
60093
|
+
return (0, import_node_child_process.execSync)("gcloud auth print-access-token", {
|
|
60094
|
+
encoding: "utf-8",
|
|
60095
|
+
stdio: ["ignore", "pipe", "ignore"]
|
|
60096
|
+
}).trim();
|
|
60057
60097
|
} catch {
|
|
60058
60098
|
return null;
|
|
60059
60099
|
}
|
|
@@ -60074,8 +60114,12 @@ function isMissingBinaryError(error3) {
|
|
|
60074
60114
|
}
|
|
60075
60115
|
async function runCodeVariant(variant, args2) {
|
|
60076
60116
|
let lastError;
|
|
60077
|
-
const childEnv =
|
|
60078
|
-
|
|
60117
|
+
const childEnv = buildCodeChildEnv(process.env);
|
|
60118
|
+
if (variant === "opencode") {
|
|
60119
|
+
Object.assign(childEnv, buildOpencodeEnv());
|
|
60120
|
+
}
|
|
60121
|
+
const candidates = resolveCodeVariantBinaryCandidates(variant, childEnv.GAL_CODE_MODE);
|
|
60122
|
+
for (const binary of candidates) {
|
|
60079
60123
|
try {
|
|
60080
60124
|
return await runGalCode(binary, args2, childEnv);
|
|
60081
60125
|
} catch (error3) {
|
|
@@ -60089,14 +60133,14 @@ async function runCodeVariant(variant, args2) {
|
|
|
60089
60133
|
}
|
|
60090
60134
|
function addVariantCommand(command, variant, runVariant) {
|
|
60091
60135
|
command.command(`${variant} [args...]`).description(
|
|
60092
|
-
variant === "codex" ? "Run GAL Code Codex
|
|
60136
|
+
variant === "codex" ? "Run the GAL Code Codex binary" : "Run the GAL Code OpenCode binary"
|
|
60093
60137
|
).enablePositionalOptions().allowUnknownOption(true).passThroughOptions().action(async (args2 = []) => {
|
|
60094
60138
|
const code = await runVariant(variant, args2);
|
|
60095
60139
|
process.exit(code);
|
|
60096
60140
|
});
|
|
60097
60141
|
}
|
|
60098
60142
|
function createCodeCommand(runVariant = runCodeVariant) {
|
|
60099
|
-
const command = new Command("code").description(
|
|
60143
|
+
const command = new Command("code").description(GAL_CODE_DESCRIPTION).enablePositionalOptions().allowUnknownOption(true).allowExcessArguments(true).action(async (...actionArgs) => {
|
|
60100
60144
|
const maybeCommand = actionArgs[actionArgs.length - 1];
|
|
60101
60145
|
const leadingArgs = actionArgs.slice(0, maybeCommand instanceof Command ? -1 : actionArgs.length).flatMap((value) => {
|
|
60102
60146
|
if (typeof value === "string") {
|
|
@@ -60108,36 +60152,42 @@ function createCodeCommand(runVariant = runCodeVariant) {
|
|
|
60108
60152
|
return [];
|
|
60109
60153
|
});
|
|
60110
60154
|
const args2 = leadingArgs.length > 0 ? leadingArgs : maybeCommand instanceof Command ? maybeCommand.args : [];
|
|
60155
|
+
if (args2.length === 0) {
|
|
60156
|
+
command.outputHelp();
|
|
60157
|
+
process.exit(0);
|
|
60158
|
+
return;
|
|
60159
|
+
}
|
|
60111
60160
|
if (args2[0] === "codex" || args2[0] === "opencode") {
|
|
60112
|
-
const
|
|
60113
|
-
process.exit(
|
|
60161
|
+
const code = await runVariant(args2[0], args2.slice(1));
|
|
60162
|
+
process.exit(code);
|
|
60114
60163
|
return;
|
|
60115
60164
|
}
|
|
60116
|
-
|
|
60117
|
-
|
|
60165
|
+
console.error(
|
|
60166
|
+
`Unknown GAL Code variant "${args2[0]}". Use "gal code codex" or "gal code opencode".`
|
|
60167
|
+
);
|
|
60168
|
+
process.exit(1);
|
|
60118
60169
|
});
|
|
60119
60170
|
addVariantCommand(command, "codex", runVariant);
|
|
60120
60171
|
addVariantCommand(command, "opencode", runVariant);
|
|
60121
60172
|
return command;
|
|
60122
60173
|
}
|
|
60123
|
-
var import_node_child_process, import_node_os3, import_node_path2,
|
|
60174
|
+
var import_node_child_process, import_node_os3, import_node_path2, import_node_fs2, GAL_CODE_DESCRIPTION, OPENCODE_CONFIG_PATH, OFFICIAL_VARIANT_BINARIES, GLM_PROVIDER_CONFIG;
|
|
60124
60175
|
var init_code = __esm({
|
|
60125
60176
|
"module_365"() {
|
|
60126
60177
|
"use strict";
|
|
60127
60178
|
import_node_child_process = require("node:child_process");
|
|
60128
60179
|
import_node_os3 = __toESM(require("node:os"), 1);
|
|
60129
60180
|
import_node_path2 = __toESM(require("node:path"), 1);
|
|
60181
|
+
import_node_fs2 = require("node:fs");
|
|
60130
60182
|
init_esm();
|
|
60183
|
+
init_config_manager();
|
|
60131
60184
|
init_code_process();
|
|
60132
|
-
|
|
60133
|
-
|
|
60134
|
-
|
|
60135
|
-
|
|
60136
|
-
|
|
60137
|
-
opencode:
|
|
60138
|
-
import_node_path2.default.join(import_node_os3.default.homedir(), ".local", "bin", "gal-code-opencode"),
|
|
60139
|
-
"gal-code-opencode"
|
|
60140
|
-
]
|
|
60185
|
+
init_gal_home();
|
|
60186
|
+
GAL_CODE_DESCRIPTION = "Run GAL Code Codex or OpenCode via `gal code codex` or `gal code opencode`. Use `make gal-code-local` for local iteration.";
|
|
60187
|
+
OPENCODE_CONFIG_PATH = ["apps", "gal-code-opencode", ".opencode"];
|
|
60188
|
+
OFFICIAL_VARIANT_BINARIES = {
|
|
60189
|
+
codex: "codex",
|
|
60190
|
+
opencode: "opencode"
|
|
60141
60191
|
};
|
|
60142
60192
|
GLM_PROVIDER_CONFIG = {
|
|
60143
60193
|
provider: {
|
|
@@ -61356,11 +61406,11 @@ async function createSystemEnforcer(config2 = {}) {
|
|
|
61356
61406
|
const enforcer = new SystemEnforcer(defaultConfig);
|
|
61357
61407
|
return enforcer;
|
|
61358
61408
|
}
|
|
61359
|
-
var
|
|
61409
|
+
var import_node_fs3, import_promises3, import_node_path4, import_node_events, import_node_os4, ViolationBlockedError, SystemEnforcer;
|
|
61360
61410
|
var init_system_enforcer = __esm({
|
|
61361
61411
|
"module_373"() {
|
|
61362
61412
|
"use strict";
|
|
61363
|
-
|
|
61413
|
+
import_node_fs3 = require("node:fs");
|
|
61364
61414
|
import_promises3 = require("node:fs/promises");
|
|
61365
61415
|
import_node_path4 = require("node:path");
|
|
61366
61416
|
import_node_events = require("node:events");
|
|
@@ -61498,7 +61548,7 @@ var init_system_enforcer = __esm({
|
|
|
61498
61548
|
*/
|
|
61499
61549
|
startFileWatchers() {
|
|
61500
61550
|
for (const watchPath of this.config.watchPaths) {
|
|
61501
|
-
const watcher = (0,
|
|
61551
|
+
const watcher = (0, import_node_fs3.watch)(
|
|
61502
61552
|
watchPath,
|
|
61503
61553
|
{ recursive: true },
|
|
61504
61554
|
(eventType, filename) => {
|
|
@@ -64012,7 +64062,7 @@ Installing hooks for: ${platforms.join(", ")}`));
|
|
|
64012
64062
|
const support = ENFORCEMENT_HOOK_SUPPORT[platform5];
|
|
64013
64063
|
const candidatePaths = getEnforcementHookPaths(basePath, platform5);
|
|
64014
64064
|
try {
|
|
64015
|
-
const hookPath = candidatePaths.find((candidatePath) => (0,
|
|
64065
|
+
const hookPath = candidatePaths.find((candidatePath) => (0, import_node_fs4.existsSync)(candidatePath));
|
|
64016
64066
|
if (!hookPath) {
|
|
64017
64067
|
throw new Error("not-found");
|
|
64018
64068
|
}
|
|
@@ -64896,7 +64946,7 @@ Native SDLC enforcement updated to ${level} for ${orgName}.`));
|
|
|
64896
64946
|
console.log(source_default.dim(` Org: ${orgName}`));
|
|
64897
64947
|
return;
|
|
64898
64948
|
}
|
|
64899
|
-
if ((0,
|
|
64949
|
+
if ((0, import_node_fs4.existsSync)(hookPath) && !options.force) {
|
|
64900
64950
|
spinner.fail("Workflow enforcement hook already exists. Use --force to overwrite.");
|
|
64901
64951
|
return;
|
|
64902
64952
|
}
|
|
@@ -65136,7 +65186,7 @@ async function computeConfigDrifts(basePath, approvedData) {
|
|
|
65136
65186
|
for (const [relPath, approvedContent] of Object.entries(approvedFiles)) {
|
|
65137
65187
|
const localPath = (0, import_node_path5.join)(platformDir, relPath);
|
|
65138
65188
|
try {
|
|
65139
|
-
const localContent = (0,
|
|
65189
|
+
const localContent = (0, import_node_fs4.readFileSync)(localPath, "utf-8");
|
|
65140
65190
|
const approvedHash = hashContent2(approvedContent);
|
|
65141
65191
|
const localHash = hashContent2(localContent);
|
|
65142
65192
|
if (approvedHash !== localHash) {
|
|
@@ -65146,7 +65196,7 @@ async function computeConfigDrifts(basePath, approvedData) {
|
|
|
65146
65196
|
drifts.push({ platform: platform5, file: relPath, status: "missing" });
|
|
65147
65197
|
}
|
|
65148
65198
|
}
|
|
65149
|
-
if ((0,
|
|
65199
|
+
if ((0, import_node_fs4.existsSync)(platformDir)) {
|
|
65150
65200
|
try {
|
|
65151
65201
|
const localFiles = scanDirRecursive(platformDir, platformDir);
|
|
65152
65202
|
for (const localFile of localFiles) {
|
|
@@ -65163,7 +65213,7 @@ async function computeConfigDrifts(basePath, approvedData) {
|
|
|
65163
65213
|
function scanDirRecursive(dir, baseDir) {
|
|
65164
65214
|
const results = [];
|
|
65165
65215
|
try {
|
|
65166
|
-
const entries = (0,
|
|
65216
|
+
const entries = (0, import_node_fs4.readdirSync)(dir, { withFileTypes: true });
|
|
65167
65217
|
for (const entry of entries) {
|
|
65168
65218
|
const fullPath = (0, import_node_path5.join)(dir, entry.name);
|
|
65169
65219
|
if (entry.isDirectory()) {
|
|
@@ -65181,12 +65231,12 @@ function scanDirRecursive(dir, baseDir) {
|
|
|
65181
65231
|
}
|
|
65182
65232
|
async function installGitPrecommitHook(basePath, force, dryRun) {
|
|
65183
65233
|
const gitDir = (0, import_node_path5.join)(basePath, ".git");
|
|
65184
|
-
if (!(0,
|
|
65234
|
+
if (!(0, import_node_fs4.existsSync)(gitDir)) {
|
|
65185
65235
|
throw new Error("Not a git repository");
|
|
65186
65236
|
}
|
|
65187
65237
|
const hooksDir = (0, import_node_path5.join)(gitDir, "hooks");
|
|
65188
65238
|
const hookPath = (0, import_node_path5.join)(hooksDir, "pre-commit");
|
|
65189
|
-
if ((0,
|
|
65239
|
+
if ((0, import_node_fs4.existsSync)(hookPath)) {
|
|
65190
65240
|
const existing = await (0, import_promises5.readFile)(hookPath, "utf-8");
|
|
65191
65241
|
if (existing.includes(GAL_PRECOMMIT_MARKER)) {
|
|
65192
65242
|
if (!force) {
|
|
@@ -65207,7 +65257,7 @@ async function installGitPrecommitHook(basePath, force, dryRun) {
|
|
|
65207
65257
|
}
|
|
65208
65258
|
async function removeGitPrecommitHook(basePath) {
|
|
65209
65259
|
const hookPath = (0, import_node_path5.join)(basePath, ".git", "hooks", "pre-commit");
|
|
65210
|
-
if (!(0,
|
|
65260
|
+
if (!(0, import_node_fs4.existsSync)(hookPath)) {
|
|
65211
65261
|
throw new Error("No pre-commit hook found");
|
|
65212
65262
|
}
|
|
65213
65263
|
const content = await (0, import_promises5.readFile)(hookPath, "utf-8");
|
|
@@ -65240,7 +65290,7 @@ async function removeGitPrecommitHook(basePath) {
|
|
|
65240
65290
|
}
|
|
65241
65291
|
await (0, import_promises5.writeFile)(hookPath, filtered.join("\n"), "utf-8");
|
|
65242
65292
|
}
|
|
65243
|
-
var import_promises5,
|
|
65293
|
+
var import_promises5, import_node_fs4, import_node_path5, import_node_crypto, defaultApiUrl7, PLATFORM_DIRS3, SCAN_PLATFORM_DIRS, ENFORCEMENT_HOOK_SUPPORT, GAL_PRECOMMIT_MARKER, GAL_PRECOMMIT_CONTENT;
|
|
65244
65294
|
var init_enforce = __esm({
|
|
65245
65295
|
"module_382"() {
|
|
65246
65296
|
"use strict";
|
|
@@ -65248,7 +65298,7 @@ var init_enforce = __esm({
|
|
|
65248
65298
|
init_source();
|
|
65249
65299
|
init_ora();
|
|
65250
65300
|
import_promises5 = require("node:fs/promises");
|
|
65251
|
-
|
|
65301
|
+
import_node_fs4 = require("node:fs");
|
|
65252
65302
|
import_node_path5 = require("node:path");
|
|
65253
65303
|
import_node_crypto = require("node:crypto");
|
|
65254
65304
|
init_enforcement();
|
|
@@ -80438,7 +80488,7 @@ var init_index = __esm({
|
|
|
80438
80488
|
}
|
|
80439
80489
|
});
|
|
80440
80490
|
|
|
80441
|
-
var cliVersion10 = true ? "0.0.
|
|
80491
|
+
var cliVersion10 = true ? "0.0.589" : "0.0.0-dev";
|
|
80442
80492
|
var args = process.argv.slice(2);
|
|
80443
80493
|
var requestedGlobalHelp = args.length === 1 && (args[0] === "--help" || args[0] === "-h");
|
|
80444
80494
|
var requestedVersion = args.length === 1 && (args[0] === "--version" || args[0] === "-V");
|
package/package.json
CHANGED