coder-config 0.41.25 → 0.41.27

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/constants.js CHANGED
@@ -2,7 +2,7 @@
2
2
  * Constants and tool path configurations
3
3
  */
4
4
 
5
- const VERSION = '0.41.25';
5
+ const VERSION = '0.41.27';
6
6
 
7
7
  // Tool-specific path configurations
8
8
  const TOOL_PATHS = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "coder-config",
3
- "version": "0.41.25",
3
+ "version": "0.41.27",
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",
@@ -92,11 +92,55 @@ function getInheritedMcps(manager, projectDir, configDir) {
92
92
  const mcpJsonPath = path.join(configDir, '.mcp.json');
93
93
  const mcpJsonExists = fs.existsSync(mcpJsonPath);
94
94
 
95
- // needsApply is true if there are inherited MCPs (or local MCPs) but no .mcp.json
96
- const hasAnyMcps = inherited.length > 0 ||
97
- (currentConfig.include && currentConfig.include.length > 0) ||
98
- (currentConfig.mcpServers && Object.keys(currentConfig.mcpServers).length > 0);
99
- const needsApply = hasAnyMcps && !mcpJsonExists;
95
+ // Compute what the merged config would produce
96
+ const expectedMcpNames = new Set();
97
+
98
+ // Add inherited MCPs (not excluded)
99
+ for (const mcp of inherited) {
100
+ if (!mcp.isExcluded) {
101
+ expectedMcpNames.add(mcp.name);
102
+ }
103
+ }
104
+
105
+ // Add local includes
106
+ for (const name of (currentConfig.include || [])) {
107
+ expectedMcpNames.add(name);
108
+ }
109
+
110
+ // Add local inline mcpServers
111
+ for (const name of Object.keys(currentConfig.mcpServers || {})) {
112
+ if (!name.startsWith('_')) {
113
+ expectedMcpNames.add(name);
114
+ }
115
+ }
116
+
117
+ // Check if .mcp.json matches expected
118
+ let needsApply = false;
119
+ if (!mcpJsonExists) {
120
+ // No .mcp.json but we have MCPs configured
121
+ needsApply = expectedMcpNames.size > 0;
122
+ } else {
123
+ // Compare existing .mcp.json with expected
124
+ try {
125
+ const existingMcpJson = JSON.parse(fs.readFileSync(mcpJsonPath, 'utf8'));
126
+ const existingMcpNames = new Set(Object.keys(existingMcpJson.mcpServers || {}));
127
+
128
+ // Check if sets are different
129
+ if (expectedMcpNames.size !== existingMcpNames.size) {
130
+ needsApply = true;
131
+ } else {
132
+ for (const name of expectedMcpNames) {
133
+ if (!existingMcpNames.has(name)) {
134
+ needsApply = true;
135
+ break;
136
+ }
137
+ }
138
+ }
139
+ } catch (e) {
140
+ // Can't read .mcp.json, assume needs apply
141
+ needsApply = expectedMcpNames.size > 0;
142
+ }
143
+ }
100
144
 
101
145
  return { inherited, sources, mcpJsonExists, needsApply };
102
146
  }