@cubis/foundry 0.3.60 → 0.3.61

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cubis/foundry",
3
- "version": "0.3.60",
3
+ "version": "0.3.61",
4
4
  "description": "Cubis Foundry CLI for workflow-first AI agent environments",
5
5
  "type": "module",
6
6
  "bin": {
package/src/cli/core.ts CHANGED
@@ -173,7 +173,7 @@ const CODEX_WORKFLOW_SKILL_PREFIX = "workflow-";
173
173
  const CODEX_AGENT_SKILL_PREFIX = "agent-";
174
174
  const TERMINAL_VERIFIER_PROVIDERS = ["codex", "gemini"];
175
175
  const DEFAULT_TERMINAL_VERIFIER = "codex";
176
- const POSTMAN_API_KEY_ENV_VAR = "POSTMAN_API_KEY";
176
+ const POSTMAN_API_KEY_ENV_VAR = "POSTMAN_API_KEY_DEFAULT";
177
177
  const POSTMAN_MODE_TO_URL = Object.freeze({
178
178
  minimal: "https://mcp.postman.com/minimal",
179
179
  code: "https://mcp.postman.com/code",
@@ -190,7 +190,7 @@ const FOUNDRY_MCP_SERVER_ID = "cubis-foundry";
190
190
  const FOUNDRY_MCP_COMMAND = "cbx";
191
191
  const STITCH_SKILL_ID = "stitch";
192
192
  const STITCH_MCP_SERVER_ID = "StitchMCP";
193
- const STITCH_API_KEY_ENV_VAR = "STITCH_API_KEY";
193
+ const STITCH_API_KEY_ENV_VAR = "STITCH_API_KEY_DEFAULT";
194
194
  const STITCH_MCP_URL = "https://stitch.googleapis.com/mcp";
195
195
  const POSTMAN_WORKSPACE_MANUAL_CHOICE = "__postman_workspace_manual__";
196
196
  const CBX_CONFIG_FILENAME = "cbx_config.json";
@@ -4301,16 +4301,31 @@ function resolveStitchMcpDefinitionPath({ scope, cwd = process.cwd() }) {
4301
4301
  );
4302
4302
  }
4303
4303
 
4304
- function buildPostmanAuthHeader({ apiKeyEnvVar = POSTMAN_API_KEY_ENV_VAR }) {
4304
+ function buildPostmanAuthHeader({
4305
+ apiKeyEnvVar = POSTMAN_API_KEY_ENV_VAR,
4306
+ apiKey = null,
4307
+ }) {
4308
+ const normalizedApiKey = normalizePostmanApiKey(apiKey);
4309
+ if (normalizedApiKey) {
4310
+ return `Bearer ${normalizedApiKey}`;
4311
+ }
4305
4312
  return `Bearer \${${apiKeyEnvVar}}`;
4306
4313
  }
4307
4314
 
4308
- function buildStitchApiHeader({ apiKeyEnvVar = STITCH_API_KEY_ENV_VAR }) {
4315
+ function buildStitchApiHeader({
4316
+ apiKeyEnvVar = STITCH_API_KEY_ENV_VAR,
4317
+ apiKey = null,
4318
+ }) {
4319
+ const normalizedApiKey = normalizePostmanApiKey(apiKey);
4320
+ if (normalizedApiKey) {
4321
+ return `X-Goog-Api-Key: ${normalizedApiKey}`;
4322
+ }
4309
4323
  return `X-Goog-Api-Key: \${${apiKeyEnvVar}}`;
4310
4324
  }
4311
4325
 
4312
4326
  function buildPostmanMcpDefinition({
4313
4327
  apiKeyEnvVar = POSTMAN_API_KEY_ENV_VAR,
4328
+ apiKey = null,
4314
4329
  mcpUrl = POSTMAN_MCP_URL,
4315
4330
  }) {
4316
4331
  return {
@@ -4319,13 +4334,14 @@ function buildPostmanMcpDefinition({
4319
4334
  transport: "http",
4320
4335
  url: mcpUrl,
4321
4336
  headers: {
4322
- Authorization: buildPostmanAuthHeader({ apiKeyEnvVar }),
4337
+ Authorization: buildPostmanAuthHeader({ apiKeyEnvVar, apiKey }),
4323
4338
  },
4324
4339
  };
4325
4340
  }
4326
4341
 
4327
4342
  function buildStitchMcpDefinition({
4328
4343
  apiKeyEnvVar = STITCH_API_KEY_ENV_VAR,
4344
+ apiKey = null,
4329
4345
  mcpUrl = STITCH_MCP_URL,
4330
4346
  }) {
4331
4347
  return {
@@ -4338,7 +4354,7 @@ function buildStitchMcpDefinition({
4338
4354
  "mcp-remote",
4339
4355
  mcpUrl,
4340
4356
  "--header",
4341
- buildStitchApiHeader({ apiKeyEnvVar }),
4357
+ buildStitchApiHeader({ apiKeyEnvVar, apiKey }),
4342
4358
  ],
4343
4359
  env: {},
4344
4360
  };
@@ -4346,13 +4362,14 @@ function buildStitchMcpDefinition({
4346
4362
 
4347
4363
  function buildVsCodePostmanServer({
4348
4364
  apiKeyEnvVar = POSTMAN_API_KEY_ENV_VAR,
4365
+ apiKey = null,
4349
4366
  mcpUrl = POSTMAN_MCP_URL,
4350
4367
  }) {
4351
4368
  return {
4352
4369
  type: "sse",
4353
4370
  url: mcpUrl,
4354
4371
  headers: {
4355
- Authorization: buildPostmanAuthHeader({ apiKeyEnvVar }),
4372
+ Authorization: buildPostmanAuthHeader({ apiKeyEnvVar, apiKey }),
4356
4373
  },
4357
4374
  };
4358
4375
  }
@@ -4376,13 +4393,14 @@ function buildVsCodeFoundryServer({ scope = "auto" } = {}) {
4376
4393
 
4377
4394
  function buildCopilotCliPostmanServer({
4378
4395
  apiKeyEnvVar = POSTMAN_API_KEY_ENV_VAR,
4396
+ apiKey = null,
4379
4397
  mcpUrl = POSTMAN_MCP_URL,
4380
4398
  }) {
4381
4399
  return {
4382
4400
  type: "http",
4383
4401
  url: mcpUrl,
4384
4402
  headers: {
4385
- Authorization: buildPostmanAuthHeader({ apiKeyEnvVar }),
4403
+ Authorization: buildPostmanAuthHeader({ apiKeyEnvVar, apiKey }),
4386
4404
  },
4387
4405
  tools: ["*"],
4388
4406
  };
@@ -4400,12 +4418,13 @@ function buildCopilotCliFoundryServer({ scope = "auto" } = {}) {
4400
4418
 
4401
4419
  function buildGeminiPostmanServer({
4402
4420
  apiKeyEnvVar = POSTMAN_API_KEY_ENV_VAR,
4421
+ apiKey = null,
4403
4422
  mcpUrl = POSTMAN_MCP_URL,
4404
4423
  }) {
4405
4424
  return {
4406
4425
  httpUrl: mcpUrl,
4407
4426
  headers: {
4408
- Authorization: buildPostmanAuthHeader({ apiKeyEnvVar }),
4427
+ Authorization: buildPostmanAuthHeader({ apiKeyEnvVar, apiKey }),
4409
4428
  },
4410
4429
  };
4411
4430
  }
@@ -4420,6 +4439,7 @@ function buildGeminiFoundryServer({ scope = "auto" } = {}) {
4420
4439
 
4421
4440
  function buildGeminiStitchServer({
4422
4441
  apiKeyEnvVar = STITCH_API_KEY_ENV_VAR,
4442
+ apiKey = null,
4423
4443
  mcpUrl = STITCH_MCP_URL,
4424
4444
  }) {
4425
4445
  return {
@@ -4429,7 +4449,7 @@ function buildGeminiStitchServer({
4429
4449
  "mcp-remote",
4430
4450
  mcpUrl,
4431
4451
  "--header",
4432
- buildStitchApiHeader({ apiKeyEnvVar }),
4452
+ buildStitchApiHeader({ apiKeyEnvVar, apiKey }),
4433
4453
  ],
4434
4454
  env: {},
4435
4455
  };
@@ -4933,6 +4953,12 @@ async function applyPostmanMcpForPlatform({
4933
4953
  const workspaceRoot = findWorkspaceRoot(cwd);
4934
4954
  const warnings = [];
4935
4955
  const foundryScope = mcpScope === "global" ? "global" : "project";
4956
+ const resolvedPostmanApiKey = normalizePostmanApiKey(
4957
+ process.env[apiKeyEnvVar || POSTMAN_API_KEY_ENV_VAR],
4958
+ );
4959
+ const resolvedStitchApiKey = normalizePostmanApiKey(
4960
+ process.env[stitchApiKeyEnvVar || STITCH_API_KEY_ENV_VAR],
4961
+ );
4936
4962
 
4937
4963
  if (platform === "antigravity") {
4938
4964
  const settingsPath =
@@ -4952,6 +4978,7 @@ async function applyPostmanMcpForPlatform({
4952
4978
  if (includePostmanMcp) {
4953
4979
  mcpServers[POSTMAN_SKILL_ID] = buildGeminiPostmanServer({
4954
4980
  apiKeyEnvVar,
4981
+ apiKey: resolvedPostmanApiKey,
4955
4982
  mcpUrl,
4956
4983
  });
4957
4984
  }
@@ -4965,6 +4992,7 @@ async function applyPostmanMcpForPlatform({
4965
4992
  if (includeStitchMcp) {
4966
4993
  mcpServers[STITCH_MCP_SERVER_ID] = buildGeminiStitchServer({
4967
4994
  apiKeyEnvVar: stitchApiKeyEnvVar,
4995
+ apiKey: resolvedStitchApiKey,
4968
4996
  mcpUrl: stitchMcpUrl,
4969
4997
  });
4970
4998
  }
@@ -5001,6 +5029,7 @@ async function applyPostmanMcpForPlatform({
5001
5029
  if (includePostmanMcp) {
5002
5030
  mcpServers[POSTMAN_SKILL_ID] = buildCopilotCliPostmanServer({
5003
5031
  apiKeyEnvVar,
5032
+ apiKey: resolvedPostmanApiKey,
5004
5033
  mcpUrl,
5005
5034
  });
5006
5035
  }
@@ -5024,6 +5053,7 @@ async function applyPostmanMcpForPlatform({
5024
5053
  if (includePostmanMcp) {
5025
5054
  servers[POSTMAN_SKILL_ID] = buildVsCodePostmanServer({
5026
5055
  apiKeyEnvVar,
5056
+ apiKey: resolvedPostmanApiKey,
5027
5057
  mcpUrl,
5028
5058
  });
5029
5059
  }
@@ -5064,6 +5094,7 @@ async function applyPostmanMcpForPlatform({
5064
5094
  if (includePostmanMcp) {
5065
5095
  servers[POSTMAN_SKILL_ID] = buildVsCodePostmanServer({
5066
5096
  apiKeyEnvVar,
5097
+ apiKey: resolvedPostmanApiKey,
5067
5098
  mcpUrl,
5068
5099
  });
5069
5100
  }
@@ -5672,6 +5703,7 @@ async function configurePostmanInstallArtifacts({
5672
5703
  const mcpDefinitionContent = `${JSON.stringify(
5673
5704
  buildPostmanMcpDefinition({
5674
5705
  apiKeyEnvVar: effectiveApiKeyEnvVar,
5706
+ apiKey: envApiKey,
5675
5707
  mcpUrl: effectiveMcpUrl,
5676
5708
  }),
5677
5709
  null,
@@ -5693,6 +5725,7 @@ async function configurePostmanInstallArtifacts({
5693
5725
  const stitchMcpDefinitionContent = `${JSON.stringify(
5694
5726
  buildStitchMcpDefinition({
5695
5727
  apiKeyEnvVar: effectiveStitchApiKeyEnvVar,
5728
+ apiKey: envStitchApiKey,
5696
5729
  mcpUrl: effectiveStitchMcpUrl,
5697
5730
  }),
5698
5731
  null,
@@ -5831,6 +5864,12 @@ async function applyPostmanConfigArtifacts({
5831
5864
  const stitchApiKeyEnvVar =
5832
5865
  normalizePostmanApiKey(stitchState?.apiKeyEnvVar) || STITCH_API_KEY_ENV_VAR;
5833
5866
  const stitchMcpUrl = stitchState?.mcpUrl || STITCH_MCP_URL;
5867
+ const resolvedPostmanApiKey = normalizePostmanApiKey(
5868
+ process.env[postmanApiKeyEnvVar],
5869
+ );
5870
+ const resolvedStitchApiKey = normalizePostmanApiKey(
5871
+ process.env[stitchApiKeyEnvVar],
5872
+ );
5834
5873
 
5835
5874
  const mcpDefinitionPath = resolvePostmanMcpDefinitionPath({
5836
5875
  platform,
@@ -5840,6 +5879,7 @@ async function applyPostmanConfigArtifacts({
5840
5879
  const mcpDefinitionContent = `${JSON.stringify(
5841
5880
  buildPostmanMcpDefinition({
5842
5881
  apiKeyEnvVar: postmanApiKeyEnvVar,
5882
+ apiKey: resolvedPostmanApiKey,
5843
5883
  mcpUrl: postmanMcpUrl,
5844
5884
  }),
5845
5885
  null,
@@ -5861,6 +5901,7 @@ async function applyPostmanConfigArtifacts({
5861
5901
  const stitchMcpDefinitionContent = `${JSON.stringify(
5862
5902
  buildStitchMcpDefinition({
5863
5903
  apiKeyEnvVar: stitchApiKeyEnvVar,
5904
+ apiKey: resolvedStitchApiKey,
5864
5905
  mcpUrl: stitchMcpUrl,
5865
5906
  }),
5866
5907
  null,