@regression-io/claude-config 0.21.2 → 0.21.4
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 +94 -23
- package/package.json +1 -1
package/config-loader.js
CHANGED
|
@@ -19,7 +19,7 @@ const fs = require('fs');
|
|
|
19
19
|
const path = require('path');
|
|
20
20
|
const { execSync } = require('child_process');
|
|
21
21
|
|
|
22
|
-
const VERSION = '0.21.
|
|
22
|
+
const VERSION = '0.21.4';
|
|
23
23
|
|
|
24
24
|
// Tool-specific path configurations
|
|
25
25
|
const TOOL_PATHS = {
|
|
@@ -43,11 +43,13 @@ const TOOL_PATHS = {
|
|
|
43
43
|
color: 'blue',
|
|
44
44
|
globalConfig: '~/.gemini/settings.json', // MCP config is merged into settings.json under mcpServers key
|
|
45
45
|
globalSettings: '~/.gemini/settings.json',
|
|
46
|
+
globalMcpConfig: '~/.gemini/mcps.json', // Source config for MCPs (like Claude's)
|
|
46
47
|
projectFolder: '.gemini',
|
|
48
|
+
projectConfig: '.gemini/mcps.json', // Project-level MCP config
|
|
47
49
|
projectRules: '.gemini',
|
|
48
50
|
projectCommands: '.gemini/commands', // Uses TOML format
|
|
49
51
|
projectInstructions: 'GEMINI.md',
|
|
50
|
-
outputFile: '
|
|
52
|
+
outputFile: '~/.gemini/settings.json', // Output merged into global settings
|
|
51
53
|
supportsEnvInterpolation: true, // Gemini CLI likely supports ${VAR}
|
|
52
54
|
mergeIntoSettings: true, // MCP config is merged into settings.json, not standalone
|
|
53
55
|
},
|
|
@@ -56,11 +58,13 @@ const TOOL_PATHS = {
|
|
|
56
58
|
icon: 'rocket',
|
|
57
59
|
color: 'purple',
|
|
58
60
|
globalConfig: '~/.gemini/antigravity/mcp_config.json',
|
|
61
|
+
globalMcpConfig: '~/.gemini/antigravity/mcps.json', // Source config for MCPs
|
|
59
62
|
globalRules: '~/.gemini/GEMINI.md',
|
|
60
63
|
projectFolder: '.agent',
|
|
64
|
+
projectConfig: '.agent/mcps.json', // Project-level MCP config
|
|
61
65
|
projectRules: '.agent/rules',
|
|
62
66
|
projectInstructions: 'GEMINI.md',
|
|
63
|
-
outputFile:
|
|
67
|
+
outputFile: '~/.gemini/antigravity/mcp_config.json', // Output to global config
|
|
64
68
|
supportsEnvInterpolation: false, // Must resolve to actual values
|
|
65
69
|
},
|
|
66
70
|
};
|
|
@@ -553,9 +557,14 @@ class ClaudeConfigManager {
|
|
|
553
557
|
/**
|
|
554
558
|
* Generate MCP config for Antigravity
|
|
555
559
|
*/
|
|
560
|
+
/**
|
|
561
|
+
* Generate MCP config for Antigravity
|
|
562
|
+
* Reads from .agent/mcps.json (NOT .claude/mcps.json)
|
|
563
|
+
*/
|
|
556
564
|
applyForAntigravity(projectDir = null) {
|
|
557
565
|
const dir = projectDir || this.findProjectRoot() || process.cwd();
|
|
558
566
|
const paths = TOOL_PATHS.antigravity;
|
|
567
|
+
const homeDir = process.env.HOME || '';
|
|
559
568
|
|
|
560
569
|
const registry = this.loadJson(this.registryPath);
|
|
561
570
|
if (!registry) {
|
|
@@ -563,12 +572,14 @@ class ClaudeConfigManager {
|
|
|
563
572
|
return false;
|
|
564
573
|
}
|
|
565
574
|
|
|
566
|
-
// Find and load all configs in hierarchy (from .
|
|
567
|
-
const configLocations = this.
|
|
575
|
+
// Find and load all configs in hierarchy (from .agent folders)
|
|
576
|
+
const configLocations = this.findAllConfigsForTool('antigravity', dir);
|
|
568
577
|
|
|
569
578
|
if (configLocations.length === 0) {
|
|
570
|
-
|
|
571
|
-
|
|
579
|
+
// No Antigravity-specific config found - skip silently
|
|
580
|
+
console.log(` ℹ No .agent/mcps.json found - skipping Antigravity`);
|
|
581
|
+
console.log(` Create one with: mkdir -p .agent && echo '{"include":["filesystem"]}' > .agent/mcps.json`);
|
|
582
|
+
return true; // Not an error, just no config
|
|
572
583
|
}
|
|
573
584
|
|
|
574
585
|
// Load all configs and merge
|
|
@@ -578,13 +589,19 @@ class ClaudeConfigManager {
|
|
|
578
589
|
}));
|
|
579
590
|
const mergedConfig = this.mergeConfigs(loadedConfigs);
|
|
580
591
|
|
|
581
|
-
// Collect env vars from
|
|
582
|
-
|
|
583
|
-
|
|
592
|
+
// Collect env vars from Antigravity-specific .env files
|
|
593
|
+
let env = {};
|
|
594
|
+
|
|
595
|
+
// Global env from ~/.gemini/antigravity/.env
|
|
596
|
+
const globalEnvPath = path.join(homeDir, '.gemini', 'antigravity', '.env');
|
|
597
|
+
env = { ...env, ...this.loadEnvFile(globalEnvPath) };
|
|
584
598
|
|
|
599
|
+
// Project-level env files
|
|
585
600
|
for (const { dir: d } of configLocations) {
|
|
586
|
-
|
|
587
|
-
|
|
601
|
+
if (d !== homeDir) {
|
|
602
|
+
const envPath = path.join(d, '.agent', '.env');
|
|
603
|
+
env = { ...env, ...this.loadEnvFile(envPath) };
|
|
604
|
+
}
|
|
588
605
|
}
|
|
589
606
|
|
|
590
607
|
const output = { mcpServers: {} };
|
|
@@ -608,7 +625,7 @@ class ClaudeConfigManager {
|
|
|
608
625
|
}
|
|
609
626
|
|
|
610
627
|
// Expand ~ in output path
|
|
611
|
-
const outputPath = paths.
|
|
628
|
+
const outputPath = paths.outputFile.replace(/^~/, homeDir);
|
|
612
629
|
|
|
613
630
|
// Ensure directory exists
|
|
614
631
|
const outputDir = path.dirname(outputPath);
|
|
@@ -625,13 +642,59 @@ class ClaudeConfigManager {
|
|
|
625
642
|
return true;
|
|
626
643
|
}
|
|
627
644
|
|
|
645
|
+
/**
|
|
646
|
+
* Find all MCP configs for a specific tool in hierarchy
|
|
647
|
+
* Similar to findAllConfigs but uses tool-specific folder paths
|
|
648
|
+
*/
|
|
649
|
+
findAllConfigsForTool(toolId, startDir = null) {
|
|
650
|
+
const tool = TOOL_PATHS[toolId];
|
|
651
|
+
if (!tool) return [];
|
|
652
|
+
|
|
653
|
+
const dir = startDir || this.findProjectRoot() || process.cwd();
|
|
654
|
+
const homeDir = process.env.HOME || '';
|
|
655
|
+
const configs = [];
|
|
656
|
+
|
|
657
|
+
// Walk up from project to find project-level configs
|
|
658
|
+
let currentDir = dir;
|
|
659
|
+
const root = path.parse(currentDir).root;
|
|
660
|
+
|
|
661
|
+
while (currentDir && currentDir !== root && currentDir !== homeDir) {
|
|
662
|
+
const configPath = path.join(currentDir, tool.projectConfig || `${tool.projectFolder}/mcps.json`);
|
|
663
|
+
if (fs.existsSync(configPath)) {
|
|
664
|
+
configs.push({
|
|
665
|
+
dir: currentDir,
|
|
666
|
+
configPath,
|
|
667
|
+
type: 'project'
|
|
668
|
+
});
|
|
669
|
+
}
|
|
670
|
+
currentDir = path.dirname(currentDir);
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
// Check for global config
|
|
674
|
+
if (tool.globalMcpConfig) {
|
|
675
|
+
const globalPath = tool.globalMcpConfig.replace(/^~/, homeDir);
|
|
676
|
+
if (fs.existsSync(globalPath)) {
|
|
677
|
+
configs.push({
|
|
678
|
+
dir: homeDir,
|
|
679
|
+
configPath: globalPath,
|
|
680
|
+
type: 'global'
|
|
681
|
+
});
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
// Reverse so global is first, then parent dirs, then project dir
|
|
686
|
+
return configs.reverse();
|
|
687
|
+
}
|
|
688
|
+
|
|
628
689
|
/**
|
|
629
690
|
* Generate MCP config for Gemini CLI
|
|
630
691
|
* Gemini CLI stores MCP config inside ~/.gemini/settings.json under mcpServers key
|
|
692
|
+
* Reads from .gemini/mcps.json (NOT .claude/mcps.json)
|
|
631
693
|
*/
|
|
632
694
|
applyForGemini(projectDir = null) {
|
|
633
695
|
const dir = projectDir || this.findProjectRoot() || process.cwd();
|
|
634
696
|
const paths = TOOL_PATHS.gemini;
|
|
697
|
+
const homeDir = process.env.HOME || '';
|
|
635
698
|
|
|
636
699
|
const registry = this.loadJson(this.registryPath);
|
|
637
700
|
if (!registry) {
|
|
@@ -639,12 +702,14 @@ class ClaudeConfigManager {
|
|
|
639
702
|
return false;
|
|
640
703
|
}
|
|
641
704
|
|
|
642
|
-
// Find and load all configs in hierarchy (from .
|
|
643
|
-
const configLocations = this.
|
|
705
|
+
// Find and load all configs in hierarchy (from .gemini folders)
|
|
706
|
+
const configLocations = this.findAllConfigsForTool('gemini', dir);
|
|
644
707
|
|
|
645
708
|
if (configLocations.length === 0) {
|
|
646
|
-
|
|
647
|
-
|
|
709
|
+
// No Gemini-specific config found - skip silently or create empty
|
|
710
|
+
console.log(` ℹ No .gemini/mcps.json found - skipping Gemini CLI`);
|
|
711
|
+
console.log(` Create one with: mkdir -p .gemini && echo '{"include":["filesystem"]}' > .gemini/mcps.json`);
|
|
712
|
+
return true; // Not an error, just no config
|
|
648
713
|
}
|
|
649
714
|
|
|
650
715
|
// Load all configs and merge
|
|
@@ -654,13 +719,19 @@ class ClaudeConfigManager {
|
|
|
654
719
|
}));
|
|
655
720
|
const mergedConfig = this.mergeConfigs(loadedConfigs);
|
|
656
721
|
|
|
657
|
-
// Collect env vars from
|
|
658
|
-
|
|
659
|
-
let env = this.loadEnvFile(globalEnvPath);
|
|
722
|
+
// Collect env vars from Gemini-specific .env files
|
|
723
|
+
let env = {};
|
|
660
724
|
|
|
725
|
+
// Global env from ~/.gemini/.env
|
|
726
|
+
const globalEnvPath = path.join(homeDir, '.gemini', '.env');
|
|
727
|
+
env = { ...env, ...this.loadEnvFile(globalEnvPath) };
|
|
728
|
+
|
|
729
|
+
// Project-level env files
|
|
661
730
|
for (const { dir: d } of configLocations) {
|
|
662
|
-
|
|
663
|
-
|
|
731
|
+
if (d !== homeDir) {
|
|
732
|
+
const envPath = path.join(d, '.gemini', '.env');
|
|
733
|
+
env = { ...env, ...this.loadEnvFile(envPath) };
|
|
734
|
+
}
|
|
664
735
|
}
|
|
665
736
|
|
|
666
737
|
const mcpServers = {};
|
|
@@ -684,7 +755,7 @@ class ClaudeConfigManager {
|
|
|
684
755
|
}
|
|
685
756
|
|
|
686
757
|
// Expand ~ in output path
|
|
687
|
-
const outputPath = paths.
|
|
758
|
+
const outputPath = paths.outputFile.replace(/^~/, homeDir);
|
|
688
759
|
|
|
689
760
|
// Ensure directory exists
|
|
690
761
|
const outputDir = path.dirname(outputPath);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@regression-io/claude-config",
|
|
3
|
-
"version": "0.21.
|
|
3
|
+
"version": "0.21.4",
|
|
4
4
|
"description": "Configuration management UI for Claude Code and Antigravity - manage MCPs, rules, commands, memory, and project folders",
|
|
5
5
|
"author": "regression.io",
|
|
6
6
|
"main": "config-loader.js",
|