@cubis/foundry 0.3.59 → 0.3.60
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/CHANGELOG.md +9 -0
- package/dist/cli/core.js +86 -0
- package/dist/cli/core.js.map +1 -1
- package/package.json +4 -2
- package/src/cli/core.ts +110 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project are documented in this file.
|
|
4
4
|
|
|
5
|
+
## [0.3.60] - 2026-03-05
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
|
|
9
|
+
- Fixed `cbx mcp serve` runtime failure from global npm installs by including required MCP runtime dependencies in the main package (`@modelcontextprotocol/sdk`, `zod`).
|
|
10
|
+
- Improved Codex global Postman MCP startup reliability:
|
|
11
|
+
- after registration, CBX now patches Codex MCP config to use static Authorization headers when a managed Postman key is available
|
|
12
|
+
- avoids startup failures caused by missing shell-exported `POSTMAN_API_KEY_DEFAULT`.
|
|
13
|
+
|
|
5
14
|
## [0.3.59] - 2026-03-05
|
|
6
15
|
|
|
7
16
|
### Added
|
package/dist/cli/core.js
CHANGED
|
@@ -1028,6 +1028,79 @@ function parseTomlSections(content) {
|
|
|
1028
1028
|
}
|
|
1029
1029
|
return sections;
|
|
1030
1030
|
}
|
|
1031
|
+
function escapeTomlBasicString(value) {
|
|
1032
|
+
return String(value ?? "")
|
|
1033
|
+
.replace(/\\/g, "\\\\")
|
|
1034
|
+
.replace(/"/g, '\\"');
|
|
1035
|
+
}
|
|
1036
|
+
async function patchCodexPostmanHttpHeaders({ configPath, mcpUrl, bearerToken, dryRun = false, }) {
|
|
1037
|
+
const warnings = [];
|
|
1038
|
+
const normalizedToken = normalizePostmanApiKey(bearerToken);
|
|
1039
|
+
if (!normalizedToken) {
|
|
1040
|
+
return {
|
|
1041
|
+
action: "skipped",
|
|
1042
|
+
warnings: [
|
|
1043
|
+
"Postman API key is unavailable in current environment. Kept bearer_token_env_var wiring in Codex config.",
|
|
1044
|
+
],
|
|
1045
|
+
};
|
|
1046
|
+
}
|
|
1047
|
+
const configExists = await pathExists(configPath);
|
|
1048
|
+
const original = configExists ? await readFile(configPath, "utf8") : "";
|
|
1049
|
+
const lines = original.split(/\r?\n/);
|
|
1050
|
+
const nextLines = [];
|
|
1051
|
+
const headerLine = `http_headers = { Authorization = "Bearer ${escapeTomlBasicString(normalizedToken)}" }`;
|
|
1052
|
+
const serverHeader = "[mcp_servers.postman]";
|
|
1053
|
+
let inPostmanSection = false;
|
|
1054
|
+
let postmanSectionFound = false;
|
|
1055
|
+
let insertedHeaders = false;
|
|
1056
|
+
const flushPostmanHeaderIfNeeded = () => {
|
|
1057
|
+
if (inPostmanSection && !insertedHeaders) {
|
|
1058
|
+
nextLines.push(headerLine);
|
|
1059
|
+
insertedHeaders = true;
|
|
1060
|
+
}
|
|
1061
|
+
};
|
|
1062
|
+
for (const line of lines) {
|
|
1063
|
+
const sectionMatch = line.match(/^\s*\[([^\]]+)\]\s*$/);
|
|
1064
|
+
if (sectionMatch) {
|
|
1065
|
+
flushPostmanHeaderIfNeeded();
|
|
1066
|
+
const sectionName = sectionMatch[1].trim();
|
|
1067
|
+
inPostmanSection = sectionName === "mcp_servers.postman";
|
|
1068
|
+
if (inPostmanSection) {
|
|
1069
|
+
postmanSectionFound = true;
|
|
1070
|
+
insertedHeaders = false;
|
|
1071
|
+
}
|
|
1072
|
+
nextLines.push(line);
|
|
1073
|
+
continue;
|
|
1074
|
+
}
|
|
1075
|
+
if (inPostmanSection) {
|
|
1076
|
+
if (/^\s*(bearer_token_env_var|http_headers|env_http_headers)\s*=/.test(line)) {
|
|
1077
|
+
continue;
|
|
1078
|
+
}
|
|
1079
|
+
}
|
|
1080
|
+
nextLines.push(line);
|
|
1081
|
+
}
|
|
1082
|
+
flushPostmanHeaderIfNeeded();
|
|
1083
|
+
if (!postmanSectionFound) {
|
|
1084
|
+
if (nextLines.length > 0 && nextLines[nextLines.length - 1].trim() !== "") {
|
|
1085
|
+
nextLines.push("");
|
|
1086
|
+
}
|
|
1087
|
+
nextLines.push(serverHeader);
|
|
1088
|
+
nextLines.push(`url = "${escapeTomlBasicString(mcpUrl || POSTMAN_MCP_URL)}"`);
|
|
1089
|
+
nextLines.push(headerLine);
|
|
1090
|
+
}
|
|
1091
|
+
const next = `${nextLines.join("\n").replace(/\n+$/g, "")}\n`;
|
|
1092
|
+
if (next === original) {
|
|
1093
|
+
return { action: "unchanged", warnings };
|
|
1094
|
+
}
|
|
1095
|
+
if (!dryRun) {
|
|
1096
|
+
await mkdir(path.dirname(configPath), { recursive: true });
|
|
1097
|
+
await writeFile(configPath, next, "utf8");
|
|
1098
|
+
}
|
|
1099
|
+
return {
|
|
1100
|
+
action: dryRun ? "would-patch" : "patched",
|
|
1101
|
+
warnings,
|
|
1102
|
+
};
|
|
1103
|
+
}
|
|
1031
1104
|
function parsePubspecDependencyNames(content) {
|
|
1032
1105
|
const packages = new Set();
|
|
1033
1106
|
let currentSection = null;
|
|
@@ -4223,6 +4296,19 @@ async function applyPostmanMcpForPlatform({ platform, mcpScope, apiKeyEnvVar, mc
|
|
|
4223
4296
|
"--bearer-token-env-var",
|
|
4224
4297
|
apiKeyEnvVar || POSTMAN_API_KEY_ENV_VAR,
|
|
4225
4298
|
], { cwd });
|
|
4299
|
+
const postmanToken = normalizePostmanApiKey(process.env[apiKeyEnvVar || POSTMAN_API_KEY_ENV_VAR]);
|
|
4300
|
+
const postmanPatch = await patchCodexPostmanHttpHeaders({
|
|
4301
|
+
configPath: codexConfigPath,
|
|
4302
|
+
mcpUrl,
|
|
4303
|
+
bearerToken: postmanToken,
|
|
4304
|
+
dryRun: false,
|
|
4305
|
+
});
|
|
4306
|
+
if (postmanPatch.action === "patched") {
|
|
4307
|
+
warnings.push("Codex Postman MCP config patched to static Authorization header for startup reliability.");
|
|
4308
|
+
}
|
|
4309
|
+
if (postmanPatch.warnings?.length) {
|
|
4310
|
+
warnings.push(...postmanPatch.warnings);
|
|
4311
|
+
}
|
|
4226
4312
|
}
|
|
4227
4313
|
catch (error) {
|
|
4228
4314
|
warnings.push(`Failed to register Postman MCP via Codex CLI. Ensure 'codex' is installed and rerun. (${error.message})`);
|