@scheduler-systems/gal-run 0.0.598 → 0.0.602
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 +151 -48
- 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.602" : "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.602" : 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.602" : "0.0.0-dev";
|
|
14553
14553
|
} catch {
|
|
14554
14554
|
return "0.0.0-dev";
|
|
14555
14555
|
}
|
|
@@ -51012,6 +51012,98 @@ var init_CoreServiceProvider = __esm({
|
|
|
51012
51012
|
}
|
|
51013
51013
|
});
|
|
51014
51014
|
|
|
51015
|
+
function buildGalHeaders(orgName, authToken) {
|
|
51016
|
+
const headers = {};
|
|
51017
|
+
if (authToken) {
|
|
51018
|
+
headers.Authorization = `Bearer ${authToken}`;
|
|
51019
|
+
}
|
|
51020
|
+
if (orgName) {
|
|
51021
|
+
headers["X-Gal-Organization"] = orgName;
|
|
51022
|
+
}
|
|
51023
|
+
return Object.keys(headers).length > 0 ? headers : void 0;
|
|
51024
|
+
}
|
|
51025
|
+
function buildHostedGalServer(orgName, authToken) {
|
|
51026
|
+
const headers = buildGalHeaders(orgName, authToken);
|
|
51027
|
+
return {
|
|
51028
|
+
type: "http",
|
|
51029
|
+
transport: "http",
|
|
51030
|
+
url: GAL_MCP_URL,
|
|
51031
|
+
...headers ? { headers } : {}
|
|
51032
|
+
};
|
|
51033
|
+
}
|
|
51034
|
+
function buildBrowserGalServer(projectPath2, profile, profileDir) {
|
|
51035
|
+
return {
|
|
51036
|
+
command: "gal",
|
|
51037
|
+
args: [
|
|
51038
|
+
"browser",
|
|
51039
|
+
"browser-server",
|
|
51040
|
+
"--project-path",
|
|
51041
|
+
projectPath2,
|
|
51042
|
+
...profileDir ? ["--profile-dir", profileDir] : [],
|
|
51043
|
+
...profile ? ["--profile", profile] : []
|
|
51044
|
+
],
|
|
51045
|
+
env: { ...GAL_BROWSER_MCP_ENV }
|
|
51046
|
+
};
|
|
51047
|
+
}
|
|
51048
|
+
function escapeTomlString(value) {
|
|
51049
|
+
return value.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
|
|
51050
|
+
}
|
|
51051
|
+
function parseTomlSectionHeader(line) {
|
|
51052
|
+
const trimmed = line.trim();
|
|
51053
|
+
if (!trimmed.startsWith("[") || trimmed.startsWith("[[") || !trimmed.endsWith("]")) {
|
|
51054
|
+
return null;
|
|
51055
|
+
}
|
|
51056
|
+
return trimmed.slice(1, -1).trim();
|
|
51057
|
+
}
|
|
51058
|
+
function isManagedCodexMcpSection(sectionName) {
|
|
51059
|
+
return MANAGED_CODEX_MCP_SECTIONS.some(
|
|
51060
|
+
(managedSection) => sectionName === managedSection || sectionName.startsWith(`${managedSection}.`)
|
|
51061
|
+
);
|
|
51062
|
+
}
|
|
51063
|
+
function stripManagedCodexMcpSections(content) {
|
|
51064
|
+
const lines = content.split(/\r?\n/);
|
|
51065
|
+
const keptLines = [];
|
|
51066
|
+
let skippingManagedSection = false;
|
|
51067
|
+
for (const line of lines) {
|
|
51068
|
+
const sectionName = parseTomlSectionHeader(line);
|
|
51069
|
+
if (sectionName) {
|
|
51070
|
+
skippingManagedSection = isManagedCodexMcpSection(sectionName);
|
|
51071
|
+
if (skippingManagedSection) {
|
|
51072
|
+
continue;
|
|
51073
|
+
}
|
|
51074
|
+
}
|
|
51075
|
+
if (!skippingManagedSection) {
|
|
51076
|
+
keptLines.push(line);
|
|
51077
|
+
}
|
|
51078
|
+
}
|
|
51079
|
+
return keptLines.join("\n").trimEnd();
|
|
51080
|
+
}
|
|
51081
|
+
function renderCodexManagedMcpConfig(projectPath2, _orgName, _authToken) {
|
|
51082
|
+
const lines = [
|
|
51083
|
+
"# GAL-managed MCP servers",
|
|
51084
|
+
"[mcp_servers.gal]",
|
|
51085
|
+
'command = "npx"',
|
|
51086
|
+
'args = ["-y", "gal-run-mcp@latest"]',
|
|
51087
|
+
"startup_timeout_sec = 45.0"
|
|
51088
|
+
];
|
|
51089
|
+
for (const [serverName, profile] of [
|
|
51090
|
+
["browser-gal", void 0],
|
|
51091
|
+
["browser-slack", "slack"]
|
|
51092
|
+
]) {
|
|
51093
|
+
lines.push(
|
|
51094
|
+
"",
|
|
51095
|
+
`[mcp_servers.${serverName}]`,
|
|
51096
|
+
'command = "gal"',
|
|
51097
|
+
`args = ["browser", "browser-server", "--project-path", "${escapeTomlString(projectPath2)}"${profile ? `, "--profile", "${profile}"` : ""}]`,
|
|
51098
|
+
"",
|
|
51099
|
+
`[mcp_servers.${serverName}.env]`,
|
|
51100
|
+
'NO_COLOR = "1"',
|
|
51101
|
+
'GAL_SKIP_ORG_AUTO_UPGRADE = "1"'
|
|
51102
|
+
);
|
|
51103
|
+
}
|
|
51104
|
+
return `${lines.join("\n").trimEnd()}
|
|
51105
|
+
`;
|
|
51106
|
+
}
|
|
51015
51107
|
function resolveEnvVars(value) {
|
|
51016
51108
|
let resolved = value.replace(/^~(?=\/|$)/, (0, import_os15.homedir)());
|
|
51017
51109
|
resolved = resolved.replace(/\$HOME\b/g, (0, import_os15.homedir)());
|
|
@@ -51058,7 +51150,7 @@ function readMcpJsonFile(mcpPath) {
|
|
|
51058
51150
|
return { mcpServers: {} };
|
|
51059
51151
|
}
|
|
51060
51152
|
}
|
|
51061
|
-
function mergeMcpConfigs(existing, orgServers, orgName) {
|
|
51153
|
+
function mergeMcpConfigs(existing, orgServers, orgName, authToken) {
|
|
51062
51154
|
const merged = { ...existing };
|
|
51063
51155
|
const existingServers = existing.mcpServers && typeof existing.mcpServers === "object" ? { ...existing.mcpServers } : {};
|
|
51064
51156
|
const orgServerNames = new Set(Object.keys(orgServers));
|
|
@@ -51074,12 +51166,7 @@ function mergeMcpConfigs(existing, orgServers, orgName) {
|
|
|
51074
51166
|
mergedServers[name] = config2;
|
|
51075
51167
|
orgServersApplied++;
|
|
51076
51168
|
}
|
|
51077
|
-
mergedServers["gal"] =
|
|
51078
|
-
type: "http",
|
|
51079
|
-
transport: "http",
|
|
51080
|
-
url: "https://api.gal.run/mcp",
|
|
51081
|
-
...orgName ? { headers: { "X-Gal-Organization": orgName } } : {}
|
|
51082
|
-
};
|
|
51169
|
+
mergedServers["gal"] = buildHostedGalServer(orgName, authToken);
|
|
51083
51170
|
for (const [name, config2] of Object.entries(mergedServers)) {
|
|
51084
51171
|
mergedServers[name] = resolveEnvVarsDeep(config2);
|
|
51085
51172
|
}
|
|
@@ -51100,14 +51187,15 @@ function parseOrgMcpServers(mcpContent) {
|
|
|
51100
51187
|
}
|
|
51101
51188
|
return {};
|
|
51102
51189
|
}
|
|
51103
|
-
function syncMcpConfig(directory, mcpContent, orgName) {
|
|
51190
|
+
function syncMcpConfig(directory, mcpContent, orgName, authToken) {
|
|
51104
51191
|
const mcpPath = (0, import_path16.join)(directory, ".mcp.json");
|
|
51105
51192
|
const existing = readMcpJsonFile(mcpPath);
|
|
51106
51193
|
const orgServers = parseOrgMcpServers(mcpContent);
|
|
51107
51194
|
const { merged, orgServersApplied, preservedUserServers } = mergeMcpConfigs(
|
|
51108
51195
|
existing,
|
|
51109
51196
|
orgServers,
|
|
51110
|
-
orgName
|
|
51197
|
+
orgName,
|
|
51198
|
+
authToken
|
|
51111
51199
|
);
|
|
51112
51200
|
(0, import_fs18.writeFileSync)(mcpPath, JSON.stringify(merged, null, 2) + "\n", "utf-8");
|
|
51113
51201
|
return {
|
|
@@ -51117,6 +51205,21 @@ function syncMcpConfig(directory, mcpContent, orgName) {
|
|
|
51117
51205
|
galServerIncluded: true
|
|
51118
51206
|
};
|
|
51119
51207
|
}
|
|
51208
|
+
function syncCodexMcpConfig(directory, projectPath2, orgName, authToken) {
|
|
51209
|
+
const codexDir = (0, import_path16.join)(directory, ".codex");
|
|
51210
|
+
const codexConfigPath = (0, import_path16.join)(codexDir, "config.toml");
|
|
51211
|
+
if (!(0, import_fs18.existsSync)(codexDir)) {
|
|
51212
|
+
(0, import_fs18.mkdirSync)(codexDir, { recursive: true });
|
|
51213
|
+
}
|
|
51214
|
+
const existingContent = (0, import_fs18.existsSync)(codexConfigPath) ? (0, import_fs18.readFileSync)(codexConfigPath, "utf-8") : "";
|
|
51215
|
+
const preservedContent = stripManagedCodexMcpSections(existingContent);
|
|
51216
|
+
const managedContent = renderCodexManagedMcpConfig(projectPath2, orgName, authToken);
|
|
51217
|
+
const nextContent = preservedContent ? `${preservedContent}
|
|
51218
|
+
|
|
51219
|
+
${managedContent}` : managedContent;
|
|
51220
|
+
(0, import_fs18.writeFileSync)(codexConfigPath, nextContent, "utf-8");
|
|
51221
|
+
return codexConfigPath;
|
|
51222
|
+
}
|
|
51120
51223
|
function injectPlaywrightStorageState(directory, storageStatePath) {
|
|
51121
51224
|
const mcpPath = (0, import_path16.join)(directory, ".mcp.json");
|
|
51122
51225
|
const config2 = readMcpJsonFile(mcpPath);
|
|
@@ -51146,50 +51249,39 @@ function isPlaywrightMcpEntry(entry) {
|
|
|
51146
51249
|
function injectBrowserGalServer(directory, projectPath2, profileDir) {
|
|
51147
51250
|
const mcpPath = (0, import_path16.join)(directory, ".mcp.json");
|
|
51148
51251
|
const config2 = readMcpJsonFile(mcpPath);
|
|
51149
|
-
const sharedProfileArgs = profileDir ? ["--profile-dir", profileDir] : [];
|
|
51150
51252
|
const existingServers = { ...config2.mcpServers ?? {} };
|
|
51151
51253
|
delete existingServers["browser-work"];
|
|
51152
51254
|
delete existingServers["browser-work-slack"];
|
|
51153
|
-
if (!existingServers["browser-slack"]) {
|
|
51154
|
-
existingServers["browser-slack"] = {
|
|
51155
|
-
command: "gal",
|
|
51156
|
-
args: [
|
|
51157
|
-
"browser",
|
|
51158
|
-
"browser-server",
|
|
51159
|
-
"--project-path",
|
|
51160
|
-
projectPath2,
|
|
51161
|
-
...sharedProfileArgs,
|
|
51162
|
-
"--profile",
|
|
51163
|
-
"slack"
|
|
51164
|
-
]
|
|
51165
|
-
};
|
|
51166
|
-
}
|
|
51167
51255
|
const servers = {
|
|
51168
51256
|
...existingServers,
|
|
51257
|
+
"browser-slack": buildBrowserGalServer(projectPath2, "slack", profileDir),
|
|
51169
51258
|
"browser-gal": {
|
|
51170
51259
|
// gal browser-server is a hidden subcommand under `gal browser`,
|
|
51171
51260
|
// so no separate gal-browser-server binary needs to be distributed.
|
|
51172
|
-
|
|
51173
|
-
args: [
|
|
51174
|
-
"browser",
|
|
51175
|
-
"browser-server",
|
|
51176
|
-
"--project-path",
|
|
51177
|
-
projectPath2,
|
|
51178
|
-
...sharedProfileArgs
|
|
51179
|
-
]
|
|
51261
|
+
...buildBrowserGalServer(projectPath2, void 0, profileDir)
|
|
51180
51262
|
}
|
|
51181
51263
|
};
|
|
51182
51264
|
const updated = { ...config2, mcpServers: servers };
|
|
51183
51265
|
(0, import_fs18.writeFileSync)(mcpPath, JSON.stringify(updated, null, 2) + "\n", "utf-8");
|
|
51184
51266
|
return mcpPath;
|
|
51185
51267
|
}
|
|
51186
|
-
var import_fs18, import_path16, import_os15;
|
|
51268
|
+
var import_fs18, import_path16, import_os15, GAL_MCP_URL, GAL_BROWSER_MCP_ENV, MANAGED_CODEX_MCP_SECTIONS;
|
|
51187
51269
|
var init_mcp_config_writer = __esm({
|
|
51188
51270
|
"module_340"() {
|
|
51189
51271
|
"use strict";
|
|
51190
51272
|
import_fs18 = require("fs");
|
|
51191
51273
|
import_path16 = require("path");
|
|
51192
51274
|
import_os15 = require("os");
|
|
51275
|
+
GAL_MCP_URL = "https://api.gal.run/mcp";
|
|
51276
|
+
GAL_BROWSER_MCP_ENV = {
|
|
51277
|
+
NO_COLOR: "1",
|
|
51278
|
+
GAL_SKIP_ORG_AUTO_UPGRADE: "1"
|
|
51279
|
+
};
|
|
51280
|
+
MANAGED_CODEX_MCP_SECTIONS = [
|
|
51281
|
+
"mcp_servers.gal",
|
|
51282
|
+
"mcp_servers.browser-gal",
|
|
51283
|
+
"mcp_servers.browser-slack"
|
|
51284
|
+
];
|
|
51193
51285
|
}
|
|
51194
51286
|
});
|
|
51195
51287
|
|
|
@@ -58500,12 +58592,20 @@ function writeClaudeConfig(directory, configData, syncedFiles, syncedItems, orgN
|
|
|
58500
58592
|
}
|
|
58501
58593
|
}
|
|
58502
58594
|
}
|
|
58503
|
-
function writeCodexConfig(directory, configData, syncedFiles, syncedItems) {
|
|
58595
|
+
function writeCodexConfig(directory, configData, syncedFiles, syncedItems, orgName, authToken) {
|
|
58504
58596
|
const codexDir = (0, import_path27.join)(directory, ".codex");
|
|
58505
|
-
|
|
58506
|
-
|
|
58507
|
-
return;
|
|
58597
|
+
if (!(0, import_fs29.existsSync)(codexDir)) {
|
|
58598
|
+
(0, import_fs29.mkdirSync)(codexDir, { recursive: true });
|
|
58508
58599
|
}
|
|
58600
|
+
const codexConfigPath = syncCodexMcpConfig(directory, directory, orgName, authToken);
|
|
58601
|
+
const codexConfigRelativePath = codexConfigPath.replace(`${directory}/`, "");
|
|
58602
|
+
syncedFiles.push(codexConfigRelativePath);
|
|
58603
|
+
syncedItems.push({
|
|
58604
|
+
path: codexConfigRelativePath,
|
|
58605
|
+
type: "mcp",
|
|
58606
|
+
name: "config.toml",
|
|
58607
|
+
platform: "codex"
|
|
58608
|
+
});
|
|
58509
58609
|
if (configData.skills && configData.skills.length > 0) {
|
|
58510
58610
|
const skillsDir = (0, import_path27.join)(codexDir, "skills");
|
|
58511
58611
|
if (!(0, import_fs29.existsSync)(skillsDir)) {
|
|
@@ -58771,6 +58871,8 @@ async function maybeShowSyncCopilotHint(configRepo, orgName, platformFilter) {
|
|
|
58771
58871
|
async function pullApprovedConfig(configRepo, authRepo, orgName, directory, platformFilter, apiUrl, options) {
|
|
58772
58872
|
const outputMode = options?.outputMode ?? "full";
|
|
58773
58873
|
const isFullOutput = outputMode === "full";
|
|
58874
|
+
const cliConfig = ConfigManager.load();
|
|
58875
|
+
const authToken = cliConfig.authToken;
|
|
58774
58876
|
if (isFullOutput) {
|
|
58775
58877
|
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"));
|
|
58776
58878
|
console.log(source_default.green(" GAL Config Sync - Convenience Package"));
|
|
@@ -58910,7 +59012,7 @@ async function pullApprovedConfig(configRepo, authRepo, orgName, directory, plat
|
|
|
58910
59012
|
);
|
|
58911
59013
|
writeApprovedClaudeConfig(directory, configData);
|
|
58912
59014
|
} else if (platform5 === "codex") {
|
|
58913
|
-
writeCodexConfig(directory, configData, platformFiles, platformItems);
|
|
59015
|
+
writeCodexConfig(directory, configData, platformFiles, platformItems, orgName, authToken);
|
|
58914
59016
|
} else if (platform5 === "copilot") {
|
|
58915
59017
|
const copilotItems = [];
|
|
58916
59018
|
writeCopilotConfig(directory, {
|
|
@@ -59096,7 +59198,7 @@ async function pullApprovedConfig(configRepo, authRepo, orgName, directory, plat
|
|
|
59096
59198
|
const mcpContent = mcpSource?.mcp?.content;
|
|
59097
59199
|
const mcpSpinner = isFullOutput ? ora(" mcp: Syncing MCP server configs...").start() : null;
|
|
59098
59200
|
try {
|
|
59099
|
-
const mcpResult = syncMcpConfig(directory, mcpContent || void 0, orgName);
|
|
59201
|
+
const mcpResult = syncMcpConfig(directory, mcpContent || void 0, orgName, authToken);
|
|
59100
59202
|
allSyncedFiles.push(".mcp.json");
|
|
59101
59203
|
allSyncedItems.push({
|
|
59102
59204
|
path: ".mcp.json",
|
|
@@ -59183,7 +59285,7 @@ async function pullApprovedConfig(configRepo, authRepo, orgName, directory, plat
|
|
|
59183
59285
|
const codexFiles = [];
|
|
59184
59286
|
const codexItems = [];
|
|
59185
59287
|
try {
|
|
59186
|
-
writeCodexConfig(directory, claudeConfigData, codexFiles, codexItems);
|
|
59288
|
+
writeCodexConfig(directory, claudeConfigData, codexFiles, codexItems, orgName, authToken);
|
|
59187
59289
|
const codexHash = calculateConfigHash(JSON.stringify(claudeConfigData));
|
|
59188
59290
|
platformStates.set("codex", {
|
|
59189
59291
|
lastSyncHash: codexHash,
|
|
@@ -59228,9 +59330,9 @@ async function pullApprovedConfig(configRepo, authRepo, orgName, directory, plat
|
|
|
59228
59330
|
}
|
|
59229
59331
|
let dispatchRules;
|
|
59230
59332
|
try {
|
|
59231
|
-
const
|
|
59232
|
-
const effectiveApiUrl = apiUrl ||
|
|
59233
|
-
const token =
|
|
59333
|
+
const cliConfig2 = ConfigManager.load();
|
|
59334
|
+
const effectiveApiUrl = apiUrl || cliConfig2.apiUrl || defaultApiUrl4;
|
|
59335
|
+
const token = cliConfig2.authToken;
|
|
59234
59336
|
if (token) {
|
|
59235
59337
|
const resp = await fetch(`${effectiveApiUrl}/organizations/${encodeURIComponent(orgName)}/dispatch-rules`, {
|
|
59236
59338
|
headers: { "Authorization": `Bearer ${token}`, "Content-Type": "application/json" }
|
|
@@ -81799,7 +81901,8 @@ var init_command_registry = __esm({
|
|
|
81799
81901
|
});
|
|
81800
81902
|
|
|
81801
81903
|
function printBranding() {
|
|
81802
|
-
|
|
81904
|
+
const hiddenMcpEntrypoint = process.argv.includes("browser-server");
|
|
81905
|
+
if (hiddenMcpEntrypoint || process.stdin.isTTY !== true || process.stdout.isTTY !== true || process.argv.includes("--json") || process.argv.includes("-j") || process.argv.includes("--auto") || process.argv.includes("--no-color") || process.env.CI === "true" || process.env.NO_COLOR !== void 0) {
|
|
81803
81906
|
return;
|
|
81804
81907
|
}
|
|
81805
81908
|
console.log(
|
|
@@ -82424,7 +82527,7 @@ var init_index = __esm({
|
|
|
82424
82527
|
}
|
|
82425
82528
|
});
|
|
82426
82529
|
|
|
82427
|
-
var cliVersion10 = true ? "0.0.
|
|
82530
|
+
var cliVersion10 = true ? "0.0.602" : "0.0.0-dev";
|
|
82428
82531
|
var args = process.argv.slice(2);
|
|
82429
82532
|
var requestedGlobalHelp = args.length === 1 && (args[0] === "--help" || args[0] === "-h");
|
|
82430
82533
|
var requestedVersion = args.length === 1 && (args[0] === "--version" || args[0] === "-V");
|
package/package.json
CHANGED