coder-config 0.51.0 → 0.51.2-beta

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/lib/apply.js CHANGED
@@ -318,12 +318,20 @@ function applyForGemini(registryPath, projectDir = null) {
318
318
 
319
319
  /**
320
320
  * Generate MCP config for Codex CLI
321
+ * Codex reads MCPs from [mcp_servers.<name>] tables in ~/.codex/config.toml
321
322
  */
322
323
  function applyForCodex(registryPath, projectDir = null) {
323
324
  const dir = projectDir || findProjectRoot() || process.cwd();
324
- const paths = TOOL_PATHS.codex;
325
325
  const homeDir = process.env.HOME || '';
326
326
 
327
+ let TOML;
328
+ try {
329
+ TOML = require('@iarna/toml');
330
+ } catch (e) {
331
+ console.error('Error: @iarna/toml not available - cannot generate Codex config');
332
+ return false;
333
+ }
334
+
327
335
  const registry = loadJson(registryPath);
328
336
  if (!registry) {
329
337
  console.error('Error: Could not load MCP registry');
@@ -355,12 +363,12 @@ function applyForCodex(registryPath, projectDir = null) {
355
363
  }
356
364
  }
357
365
 
358
- const output = { mcpServers: {} };
366
+ const mcpServers = {};
359
367
 
360
368
  if (mergedConfig.include && Array.isArray(mergedConfig.include)) {
361
369
  for (const name of mergedConfig.include) {
362
370
  if (registry.mcpServers && registry.mcpServers[name]) {
363
- output.mcpServers[name] = interpolate(registry.mcpServers[name], env);
371
+ mcpServers[name] = interpolate(registry.mcpServers[name], env);
364
372
  }
365
373
  }
366
374
  }
@@ -368,23 +376,51 @@ function applyForCodex(registryPath, projectDir = null) {
368
376
  if (mergedConfig.mcpServers) {
369
377
  for (const [name, config] of Object.entries(mergedConfig.mcpServers)) {
370
378
  if (name.startsWith('_')) continue;
371
- output.mcpServers[name] = interpolate(config, env);
379
+ mcpServers[name] = interpolate(config, env);
372
380
  }
373
381
  }
374
382
 
375
- // Generate per-project config (.codex/mcp.json)
376
- const projectOutputDir = path.join(dir, '.codex');
377
- const projectOutputPath = path.join(projectOutputDir, 'mcp.json');
383
+ // Merge MCPs into ~/.codex/config.toml under [mcp_servers]
384
+ const configPath = path.join(homeDir, '.codex', 'config.toml');
385
+ const configDir = path.dirname(configPath);
386
+ if (!fs.existsSync(configDir)) {
387
+ fs.mkdirSync(configDir, { recursive: true });
388
+ }
378
389
 
379
- if (!fs.existsSync(projectOutputDir)) {
380
- fs.mkdirSync(projectOutputDir, { recursive: true });
390
+ let existingConfig = {};
391
+ if (fs.existsSync(configPath)) {
392
+ try {
393
+ existingConfig = TOML.parse(fs.readFileSync(configPath, 'utf8'));
394
+ } catch (e) {
395
+ console.warn('Warning: Could not parse existing config.toml, preserving as-is');
396
+ existingConfig = {};
397
+ }
381
398
  }
382
399
 
383
- saveJson(projectOutputPath, output);
400
+ // Merge mcp_servers — coder-config managed servers replace, user servers preserved
401
+ const existingMcpServers = existingConfig.mcp_servers || {};
402
+ const managedTag = '_managed_by_coder_config';
384
403
 
385
- const count = Object.keys(output.mcpServers).length;
386
- console.log(`✓ Generated ${projectOutputPath} (Codex CLI)`);
387
- console.log(` └─ ${count} MCP(s): ${Object.keys(output.mcpServers).join(', ')}`);
404
+ // Remove previously managed servers
405
+ for (const [name, server] of Object.entries(existingMcpServers)) {
406
+ if (server && server[managedTag]) {
407
+ delete existingMcpServers[name];
408
+ }
409
+ }
410
+
411
+ // Add new managed servers (tag them so we can clean up on next apply)
412
+ for (const [name, config] of Object.entries(mcpServers)) {
413
+ existingMcpServers[name] = { ...config, [managedTag]: true };
414
+ }
415
+
416
+ existingConfig.mcp_servers = existingMcpServers;
417
+
418
+ const tomlContent = TOML.stringify(existingConfig);
419
+ fs.writeFileSync(configPath, tomlContent, 'utf8');
420
+
421
+ const count = Object.keys(mcpServers).length;
422
+ console.log(`✓ Updated ${configPath} (Codex CLI)`);
423
+ console.log(` └─ ${count} managed MCP(s): ${Object.keys(mcpServers).join(', ')}`);
388
424
 
389
425
  return true;
390
426
  }
package/lib/constants.js CHANGED
@@ -2,7 +2,7 @@
2
2
  * Constants and tool path configurations
3
3
  */
4
4
 
5
- const VERSION = '0.51.0';
5
+ const VERSION = '0.51.2-beta';
6
6
 
7
7
  // Tool-specific path configurations
8
8
  const TOOL_PATHS = {
@@ -17,10 +17,15 @@ const TOOL_PATHS = {
17
17
  projectFolder: '.claude',
18
18
  projectRules: '.claude/rules',
19
19
  projectCommands: '.claude/commands',
20
+ projectSkills: '.claude/skills',
21
+ projectAgents: '.claude/agents',
20
22
  projectWorkflows: '.claude/workflows',
21
23
  projectInstructions: 'CLAUDE.md',
22
24
  outputFile: '.mcp.json', // Per-project MCPs go here (shared via git)
25
+ settingsSchema: 'https://json.schemastore.org/claude-code-settings.json',
23
26
  supportsEnvInterpolation: true,
27
+ // MCP scope names (CC terminology)
28
+ mcpScopes: { local: 'Per-project in ~/.claude.json', user: 'Global in ~/.claude.json' },
24
29
  },
25
30
  gemini: {
26
31
  name: 'Gemini CLI',
@@ -56,14 +61,16 @@ const TOOL_PATHS = {
56
61
  name: 'Codex CLI',
57
62
  icon: 'terminal',
58
63
  color: 'green',
59
- globalConfig: '~/.codex/config.json',
60
- globalMcpConfig: '~/.codex/mcps.json',
64
+ globalConfig: '~/.codex/config.toml',
65
+ globalMcpConfig: '~/.codex/mcps.json', // coder-config internal registry
61
66
  projectFolder: '.codex',
62
- projectConfig: '.codex/mcps.json',
67
+ projectConfig: '.codex/mcps.json', // coder-config internal registry
63
68
  projectRules: '.codex/rules',
64
- projectInstructions: 'CODEX.md',
65
- outputFile: '.codex/mcp.json',
69
+ projectInstructions: 'AGENTS.md', // Codex uses AGENTS.md, not CODEX.md
70
+ projectInstructionsOverride: 'AGENTS.override.md',
71
+ outputFile: '~/.codex/config.toml', // MCPs go into [mcp_servers] in config.toml
66
72
  supportsEnvInterpolation: true,
73
+ configFormat: 'toml', // TOML, not JSON
67
74
  },
68
75
  };
69
76
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "coder-config",
3
- "version": "0.51.0",
3
+ "version": "0.51.2-beta",
4
4
  "description": "Configuration manager for AI coding tools - Claude Code, Gemini CLI, Codex CLI, Antigravity. Manage MCPs, rules, permissions, memory, and workstreams.",
5
5
  "author": "regression.io",
6
6
  "main": "config-loader.js",