coder-config 0.46.0-beta.8 → 0.46.1-beta.0
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/config-loader.js +7 -2
- package/lib/apply.js +28 -7
- package/lib/cli.js +19 -0
- package/lib/config.js +20 -5
- package/lib/constants.js +1 -1
- package/lib/mcps.js +123 -0
- package/package.json +2 -1
- package/scripts/preuninstall.js +77 -0
- package/shared/mcp-registry.json +20 -0
- package/ui/dist/assets/index-7pv_0wlM.css +32 -0
- package/ui/dist/assets/{index-CMz9jMdJ.js → index-CP7Pd-AB.js} +114 -108
- package/ui/dist/index.html +2 -2
- package/ui/routes/configs.js +87 -0
- package/ui/routes/file-explorer.js +18 -0
- package/ui/server.cjs +23 -0
- package/ui/dist/assets/index-CMLhBn6h.css +0 -32
package/config-loader.js
CHANGED
|
@@ -22,7 +22,7 @@ const { VERSION, TOOL_PATHS } = require('./lib/constants');
|
|
|
22
22
|
const { loadJson, saveJson, loadEnvFile, interpolate, resolveEnvVars, copyDirRecursive } = require('./lib/utils');
|
|
23
23
|
const { findProjectRoot, findAllConfigs, mergeConfigs, getConfigPath, collectFilesFromHierarchy, findAllConfigsForTool } = require('./lib/config');
|
|
24
24
|
const { apply, applyForAntigravity, applyForGemini, detectInstalledTools, applyForTools } = require('./lib/apply');
|
|
25
|
-
const { list, add, remove } = require('./lib/mcps');
|
|
25
|
+
const { list, add, remove, listGlobal, addGlobal, removeGlobal } = require('./lib/mcps');
|
|
26
26
|
const { registryList, registryAdd, registryRemove } = require('./lib/registry');
|
|
27
27
|
const { init, show } = require('./lib/init');
|
|
28
28
|
const { memoryList, memoryInit, memoryAdd, memorySearch } = require('./lib/memory');
|
|
@@ -138,11 +138,16 @@ class ClaudeConfigManager {
|
|
|
138
138
|
getToolPaths() { return TOOL_PATHS; }
|
|
139
139
|
applyForTools(projectDir, tools) { return applyForTools(this.registryPath, projectDir, tools); }
|
|
140
140
|
|
|
141
|
-
// MCPs
|
|
141
|
+
// MCPs (project)
|
|
142
142
|
list() { return list(this.registryPath); }
|
|
143
143
|
add(mcpNames) { return add(this.registryPath, this.installDir, mcpNames); }
|
|
144
144
|
remove(mcpNames) { return remove(this.installDir, mcpNames); }
|
|
145
145
|
|
|
146
|
+
// MCPs (global - ~/.claude.json)
|
|
147
|
+
globalList() { return listGlobal(); }
|
|
148
|
+
globalAdd(mcpNames) { return addGlobal(this.registryPath, mcpNames); }
|
|
149
|
+
globalRemove(mcpNames) { return removeGlobal(mcpNames); }
|
|
150
|
+
|
|
146
151
|
// Registry
|
|
147
152
|
registryList() { return registryList(this.registryPath); }
|
|
148
153
|
registryAdd(name, configJson) { return registryAdd(this.registryPath, name, configJson); }
|
package/lib/apply.js
CHANGED
|
@@ -29,16 +29,37 @@ function apply(registryPath, projectDir = null) {
|
|
|
29
29
|
return false;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
const loadedConfigs = configLocations.map(loc =>
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
32
|
+
const loadedConfigs = configLocations.map(loc => {
|
|
33
|
+
const rawConfig = loadJson(loc.configPath);
|
|
34
|
+
|
|
35
|
+
// Handle ~/.claude.json format (global MCPs under mcpServers key)
|
|
36
|
+
if (loc.isGlobalClaudeJson && rawConfig) {
|
|
37
|
+
return {
|
|
38
|
+
...loc,
|
|
39
|
+
config: {
|
|
40
|
+
include: [],
|
|
41
|
+
mcpServers: rawConfig.mcpServers || {}
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
}
|
|
36
45
|
|
|
37
|
-
|
|
46
|
+
return {
|
|
47
|
+
...loc,
|
|
48
|
+
config: rawConfig
|
|
49
|
+
};
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
// Filter out empty configs and show hierarchy
|
|
53
|
+
const activeConfigs = loadedConfigs.filter(c => c.config);
|
|
54
|
+
if (activeConfigs.length > 1) {
|
|
38
55
|
console.log('📚 Config hierarchy (merged):');
|
|
39
|
-
for (const { dir: d, configPath } of
|
|
56
|
+
for (const { dir: d, configPath, isGlobalClaudeJson } of activeConfigs) {
|
|
40
57
|
const relPath = d === process.env.HOME ? '~' : path.relative(process.cwd(), d) || '.';
|
|
41
|
-
|
|
58
|
+
if (isGlobalClaudeJson) {
|
|
59
|
+
console.log(` • ~/.claude.json (global MCPs)`);
|
|
60
|
+
} else {
|
|
61
|
+
console.log(` • ${relPath}/.claude/mcps.json`);
|
|
62
|
+
}
|
|
42
63
|
}
|
|
43
64
|
console.log('');
|
|
44
65
|
}
|
package/lib/cli.js
CHANGED
|
@@ -63,6 +63,17 @@ function runCli(manager) {
|
|
|
63
63
|
manager.remove(args.slice(1));
|
|
64
64
|
break;
|
|
65
65
|
|
|
66
|
+
// Global MCPs (~/.claude.json)
|
|
67
|
+
case 'global':
|
|
68
|
+
if (args[1] === 'add') {
|
|
69
|
+
manager.globalAdd(args.slice(2));
|
|
70
|
+
} else if (args[1] === 'remove' || args[1] === 'rm') {
|
|
71
|
+
manager.globalRemove(args.slice(2));
|
|
72
|
+
} else {
|
|
73
|
+
manager.globalList();
|
|
74
|
+
}
|
|
75
|
+
break;
|
|
76
|
+
|
|
66
77
|
// Registry management
|
|
67
78
|
case 'registry':
|
|
68
79
|
if (args[1] === 'add') {
|
|
@@ -371,6 +382,14 @@ ${chalk.dim('Configuration manager for AI coding tools (Claude Code, Gemini CLI,
|
|
|
371
382
|
]));
|
|
372
383
|
console.log();
|
|
373
384
|
|
|
385
|
+
// Global MCPs (~/.claude.json)
|
|
386
|
+
console.log(box('Global MCPs', [
|
|
387
|
+
cmd('global', 'List global MCPs (~/.claude.json)'),
|
|
388
|
+
cmd('global add <mcp> [mcp...]', 'Add MCP(s) to global config'),
|
|
389
|
+
cmd('global remove <mcp>', 'Remove MCP from global config'),
|
|
390
|
+
]));
|
|
391
|
+
console.log();
|
|
392
|
+
|
|
374
393
|
// Memory Commands
|
|
375
394
|
console.log(box('Memory', [
|
|
376
395
|
cmd('memory', 'Show memory status'),
|
package/lib/config.js
CHANGED
|
@@ -23,8 +23,11 @@ function findProjectRoot(startDir = process.cwd()) {
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
|
-
* Find ALL .claude/mcps.json configs from cwd up to root (and ~/.claude)
|
|
26
|
+
* Find ALL .claude/mcps.json configs from cwd up to root (and ~/.claude.json for global)
|
|
27
27
|
* Returns array from root to leaf (so child overrides parent when merged)
|
|
28
|
+
*
|
|
29
|
+
* Global MCPs: Read from ~/.claude.json under mcpServers key (Claude Code's native format)
|
|
30
|
+
* Project MCPs: Read from .claude/mcps.json files in hierarchy
|
|
28
31
|
*/
|
|
29
32
|
function findAllConfigs(startDir = process.cwd()) {
|
|
30
33
|
const configs = [];
|
|
@@ -32,6 +35,7 @@ function findAllConfigs(startDir = process.cwd()) {
|
|
|
32
35
|
const root = path.parse(dir).root;
|
|
33
36
|
const homeDir = process.env.HOME || '';
|
|
34
37
|
|
|
38
|
+
// Find project configs in hierarchy
|
|
35
39
|
while (dir !== root) {
|
|
36
40
|
const configPath = path.join(dir, '.claude', 'mcps.json');
|
|
37
41
|
if (fs.existsSync(configPath)) {
|
|
@@ -40,10 +44,21 @@ function findAllConfigs(startDir = process.cwd()) {
|
|
|
40
44
|
dir = path.dirname(dir);
|
|
41
45
|
}
|
|
42
46
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
+
// Read global MCPs from ~/.claude.json (Claude Code's native config)
|
|
48
|
+
const claudeJsonPath = path.join(homeDir, '.claude.json');
|
|
49
|
+
if (fs.existsSync(claudeJsonPath)) {
|
|
50
|
+
configs.unshift({
|
|
51
|
+
dir: homeDir,
|
|
52
|
+
configPath: claudeJsonPath,
|
|
53
|
+
isGlobalClaudeJson: true // Flag to handle different format
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// Legacy: Also check ~/.claude/mcps.json for backwards compatibility
|
|
58
|
+
const legacyHomeConfig = path.join(homeDir, '.claude', 'mcps.json');
|
|
59
|
+
if (fs.existsSync(legacyHomeConfig)) {
|
|
60
|
+
if (!configs.some(c => c.configPath === legacyHomeConfig)) {
|
|
61
|
+
configs.unshift({ dir: homeDir, configPath: legacyHomeConfig, isLegacy: true });
|
|
47
62
|
}
|
|
48
63
|
}
|
|
49
64
|
|
package/lib/constants.js
CHANGED
package/lib/mcps.js
CHANGED
|
@@ -2,10 +2,19 @@
|
|
|
2
2
|
* MCP add/remove commands
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
+
const fs = require('fs');
|
|
5
6
|
const path = require('path');
|
|
6
7
|
const { loadJson, saveJson } = require('./utils');
|
|
7
8
|
const { findProjectRoot } = require('./config');
|
|
8
9
|
|
|
10
|
+
/**
|
|
11
|
+
* Get path to Claude's global config (~/.claude.json)
|
|
12
|
+
*/
|
|
13
|
+
function getGlobalConfigPath() {
|
|
14
|
+
const homeDir = process.env.HOME || '';
|
|
15
|
+
return path.join(homeDir, '.claude.json');
|
|
16
|
+
}
|
|
17
|
+
|
|
9
18
|
/**
|
|
10
19
|
* List available MCPs
|
|
11
20
|
*/
|
|
@@ -132,8 +141,122 @@ function remove(installDir, mcpNames) {
|
|
|
132
141
|
return removed.length > 0;
|
|
133
142
|
}
|
|
134
143
|
|
|
144
|
+
/**
|
|
145
|
+
* List global MCPs from ~/.claude.json
|
|
146
|
+
*/
|
|
147
|
+
function listGlobal() {
|
|
148
|
+
const configPath = getGlobalConfigPath();
|
|
149
|
+
const config = loadJson(configPath);
|
|
150
|
+
|
|
151
|
+
if (!config || !config.mcpServers) {
|
|
152
|
+
console.log('\n📚 Global MCPs (~/.claude.json): None configured\n');
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
const mcps = Object.keys(config.mcpServers);
|
|
157
|
+
console.log('\n📚 Global MCPs (~/.claude.json):\n');
|
|
158
|
+
for (const name of mcps) {
|
|
159
|
+
const server = config.mcpServers[name];
|
|
160
|
+
const type = server.type || 'stdio';
|
|
161
|
+
console.log(` • ${name} (${type})`);
|
|
162
|
+
}
|
|
163
|
+
console.log(`\n Total: ${mcps.length} global MCP(s)\n`);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Add MCP(s) to global config (~/.claude.json)
|
|
168
|
+
*/
|
|
169
|
+
function addGlobal(registryPath, mcpNames) {
|
|
170
|
+
if (!mcpNames || mcpNames.length === 0) {
|
|
171
|
+
console.error('Usage: coder-config global add <mcp-name> [mcp-name...]');
|
|
172
|
+
return false;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
const configPath = getGlobalConfigPath();
|
|
176
|
+
let config = loadJson(configPath) || {};
|
|
177
|
+
|
|
178
|
+
if (!config.mcpServers) {
|
|
179
|
+
config.mcpServers = {};
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
const registry = loadJson(registryPath);
|
|
183
|
+
const added = [];
|
|
184
|
+
const notFound = [];
|
|
185
|
+
const alreadyExists = [];
|
|
186
|
+
|
|
187
|
+
for (const name of mcpNames) {
|
|
188
|
+
if (config.mcpServers[name]) {
|
|
189
|
+
alreadyExists.push(name);
|
|
190
|
+
} else if (registry?.mcpServers?.[name]) {
|
|
191
|
+
config.mcpServers[name] = registry.mcpServers[name];
|
|
192
|
+
added.push(name);
|
|
193
|
+
} else {
|
|
194
|
+
notFound.push(name);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
if (added.length) {
|
|
199
|
+
saveJson(configPath, config);
|
|
200
|
+
console.log(`✓ Added to ~/.claude.json: ${added.join(', ')}`);
|
|
201
|
+
console.log(' (Global MCPs apply to all projects)');
|
|
202
|
+
}
|
|
203
|
+
if (alreadyExists.length) {
|
|
204
|
+
console.log(`Already in global config: ${alreadyExists.join(', ')}`);
|
|
205
|
+
}
|
|
206
|
+
if (notFound.length) {
|
|
207
|
+
console.log(`Not in registry: ${notFound.join(', ')}`);
|
|
208
|
+
console.log(' (Use "coder-config list" to see available MCPs)');
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
return added.length > 0;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* Remove MCP(s) from global config (~/.claude.json)
|
|
216
|
+
*/
|
|
217
|
+
function removeGlobal(mcpNames) {
|
|
218
|
+
if (!mcpNames || mcpNames.length === 0) {
|
|
219
|
+
console.error('Usage: coder-config global remove <mcp-name> [mcp-name...]');
|
|
220
|
+
return false;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
const configPath = getGlobalConfigPath();
|
|
224
|
+
let config = loadJson(configPath);
|
|
225
|
+
|
|
226
|
+
if (!config || !config.mcpServers) {
|
|
227
|
+
console.error('No global MCPs configured in ~/.claude.json');
|
|
228
|
+
return false;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
const removed = [];
|
|
232
|
+
const notFound = [];
|
|
233
|
+
|
|
234
|
+
for (const name of mcpNames) {
|
|
235
|
+
if (config.mcpServers[name]) {
|
|
236
|
+
delete config.mcpServers[name];
|
|
237
|
+
removed.push(name);
|
|
238
|
+
} else {
|
|
239
|
+
notFound.push(name);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
if (removed.length) {
|
|
244
|
+
saveJson(configPath, config);
|
|
245
|
+
console.log(`✓ Removed from ~/.claude.json: ${removed.join(', ')}`);
|
|
246
|
+
}
|
|
247
|
+
if (notFound.length) {
|
|
248
|
+
console.log(`Not in global config: ${notFound.join(', ')}`);
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
return removed.length > 0;
|
|
252
|
+
}
|
|
253
|
+
|
|
135
254
|
module.exports = {
|
|
136
255
|
list,
|
|
137
256
|
add,
|
|
138
257
|
remove,
|
|
258
|
+
listGlobal,
|
|
259
|
+
addGlobal,
|
|
260
|
+
removeGlobal,
|
|
261
|
+
getGlobalConfigPath,
|
|
139
262
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "coder-config",
|
|
3
|
-
"version": "0.46.
|
|
3
|
+
"version": "0.46.1-beta.0",
|
|
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",
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
"build:ci": "cd ui && npm install && npm run build",
|
|
22
22
|
"prepublishOnly": "npm run build",
|
|
23
23
|
"postinstall": "node scripts/postinstall.js",
|
|
24
|
+
"preuninstall": "node scripts/preuninstall.js",
|
|
24
25
|
"test": "node --test test/*.test.js",
|
|
25
26
|
"release": "./scripts/release.sh"
|
|
26
27
|
},
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Preuninstall script - cleans up system files on npm uninstall
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
const fs = require('fs');
|
|
7
|
+
const path = require('path');
|
|
8
|
+
const os = require('os');
|
|
9
|
+
const { execSync } = require('child_process');
|
|
10
|
+
|
|
11
|
+
const home = os.homedir();
|
|
12
|
+
|
|
13
|
+
// 1. Kill any running server processes first
|
|
14
|
+
try {
|
|
15
|
+
execSync('pkill -f "node.*coder-config.*server" 2>/dev/null || true');
|
|
16
|
+
execSync('pkill -f "node.*coder-config ui" 2>/dev/null || true');
|
|
17
|
+
console.log('Stopped running servers');
|
|
18
|
+
} catch (e) {
|
|
19
|
+
// Ignore errors - process may not be running
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// 2. Stop and remove LaunchAgent
|
|
23
|
+
const launchAgentPath = path.join(home, 'Library', 'LaunchAgents', 'io.regression.coder-config.plist');
|
|
24
|
+
if (fs.existsSync(launchAgentPath)) {
|
|
25
|
+
try {
|
|
26
|
+
execSync(`launchctl unload "${launchAgentPath}" 2>/dev/null || true`);
|
|
27
|
+
fs.unlinkSync(launchAgentPath);
|
|
28
|
+
console.log('Removed LaunchAgent');
|
|
29
|
+
} catch (e) {
|
|
30
|
+
// Ignore errors
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// 3. Remove PID file
|
|
35
|
+
const pidFile = path.join(home, '.coder-config', 'ui.pid');
|
|
36
|
+
if (fs.existsSync(pidFile)) {
|
|
37
|
+
try {
|
|
38
|
+
fs.unlinkSync(pidFile);
|
|
39
|
+
console.log('Removed PID file');
|
|
40
|
+
} catch (e) {
|
|
41
|
+
// Ignore errors
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// 4. Remove shell hooks from .zshrc and .bashrc
|
|
46
|
+
const shellFiles = [
|
|
47
|
+
path.join(home, '.zshrc'),
|
|
48
|
+
path.join(home, '.bashrc'),
|
|
49
|
+
];
|
|
50
|
+
|
|
51
|
+
const hookStart = '# coder-config workstream hooks';
|
|
52
|
+
const hookEnd = '# end coder-config workstream hooks';
|
|
53
|
+
|
|
54
|
+
for (const rcFile of shellFiles) {
|
|
55
|
+
if (fs.existsSync(rcFile)) {
|
|
56
|
+
try {
|
|
57
|
+
let content = fs.readFileSync(rcFile, 'utf8');
|
|
58
|
+
const startIdx = content.indexOf(hookStart);
|
|
59
|
+
const endIdx = content.indexOf(hookEnd);
|
|
60
|
+
|
|
61
|
+
if (startIdx !== -1 && endIdx !== -1) {
|
|
62
|
+
// Remove the block including trailing newline
|
|
63
|
+
let removeStart = startIdx;
|
|
64
|
+
if (startIdx > 0 && content[startIdx - 1] === '\n') {
|
|
65
|
+
removeStart = startIdx - 1;
|
|
66
|
+
}
|
|
67
|
+
content = content.slice(0, removeStart) + content.slice(endIdx + hookEnd.length);
|
|
68
|
+
fs.writeFileSync(rcFile, content);
|
|
69
|
+
console.log(`Removed hooks from ${path.basename(rcFile)}`);
|
|
70
|
+
}
|
|
71
|
+
} catch (e) {
|
|
72
|
+
// Ignore errors
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
console.log('Cleanup complete');
|
package/shared/mcp-registry.json
CHANGED
|
@@ -76,6 +76,26 @@
|
|
|
76
76
|
"/Users/ruze/reg/tools/DesktopCommanderMCP/index.js"
|
|
77
77
|
],
|
|
78
78
|
"description": "MCP server for terminal operations and file editing"
|
|
79
|
+
},
|
|
80
|
+
"sequential-thinking": {
|
|
81
|
+
"command": "npx",
|
|
82
|
+
"args": ["-y", "@modelcontextprotocol/server-sequential-thinking"],
|
|
83
|
+
"description": "Dynamic problem-solving through thought sequences"
|
|
84
|
+
},
|
|
85
|
+
"context7": {
|
|
86
|
+
"command": "npx",
|
|
87
|
+
"args": ["-y", "@upstash/context7-mcp"],
|
|
88
|
+
"description": "Up-to-date documentation and code examples from Context7"
|
|
89
|
+
},
|
|
90
|
+
"magic": {
|
|
91
|
+
"command": "npx",
|
|
92
|
+
"args": ["-y", "@21st-dev/magic"],
|
|
93
|
+
"description": "21st.dev Magic MCP - AI-powered UI component generation"
|
|
94
|
+
},
|
|
95
|
+
"notebooklm-mcp": {
|
|
96
|
+
"command": "notebooklm-mcp",
|
|
97
|
+
"args": [],
|
|
98
|
+
"description": "Google NotebookLM integration for podcast generation and research"
|
|
79
99
|
}
|
|
80
100
|
}
|
|
81
101
|
}
|