@insforge/install 0.0.24 → 0.0.26
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/dist/index.js +20 -17
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -56,10 +56,8 @@ import {
|
|
|
56
56
|
}
|
|
57
57
|
const name = "insforge";
|
|
58
58
|
const mcpVersion = argv.dev ? "@insforge/mcp@dev" : "@insforge/mcp@latest";
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
try {
|
|
62
|
-
const config = readConfig(argv.client);
|
|
59
|
+
try {
|
|
60
|
+
const config = readConfig(argv.client);
|
|
63
61
|
|
|
64
62
|
// Handle different config structures for different clients
|
|
65
63
|
if (argv.client === "claude-code") {
|
|
@@ -100,18 +98,22 @@ import {
|
|
|
100
98
|
}
|
|
101
99
|
} else if (argv.client === "codex") {
|
|
102
100
|
// Use Codex CLI for Codex
|
|
101
|
+
const homeDir = os.homedir();
|
|
102
|
+
const isWindows = process.platform === 'win32';
|
|
103
|
+
const codexPath = isWindows
|
|
104
|
+
? path.join(homeDir, 'AppData', 'Roaming', 'npm', 'codex.cmd')
|
|
105
|
+
: 'codex';
|
|
106
|
+
|
|
103
107
|
const envArgs = Object.entries(envVars)
|
|
104
|
-
.
|
|
105
|
-
|
|
106
|
-
const quotedValue = value.includes(' ') ? `"${value}"` : value;
|
|
107
|
-
return `--env ${key}=${quotedValue}`;
|
|
108
|
-
})
|
|
108
|
+
.filter(([key]) => key !== 'CLIENT_NAME')
|
|
109
|
+
.map(([key, value]) => `--env ${key}=${value}`)
|
|
109
110
|
.join(' ');
|
|
110
|
-
|
|
111
|
+
|
|
111
112
|
try {
|
|
112
113
|
// First try to remove existing insforge MCP if it exists
|
|
113
114
|
try {
|
|
114
|
-
|
|
115
|
+
const removeCmd = isWindows ? `"${codexPath}" mcp remove ${name}` : `codex mcp remove ${name}`;
|
|
116
|
+
execSync(removeCmd, {
|
|
115
117
|
stdio: 'pipe',
|
|
116
118
|
shell: true
|
|
117
119
|
});
|
|
@@ -120,9 +122,11 @@ import {
|
|
|
120
122
|
// It's okay if remove fails - the MCP might not exist
|
|
121
123
|
logger.info("No existing insforge MCP found");
|
|
122
124
|
}
|
|
123
|
-
|
|
125
|
+
|
|
124
126
|
// Now add the MCP server using codex CLI with --env flags
|
|
125
|
-
const command =
|
|
127
|
+
const command = isWindows
|
|
128
|
+
? `"${codexPath}" mcp add ${name} ${envArgs} -- npx -y ${mcpVersion}`
|
|
129
|
+
: `codex mcp add ${name} ${envArgs} -- npx -y ${mcpVersion}`;
|
|
126
130
|
logger.info(`Adding insforge MCP server (${mcpVersion})...`);
|
|
127
131
|
execSync(command, {
|
|
128
132
|
stdio: 'inherit',
|
|
@@ -165,11 +169,10 @@ import {
|
|
|
165
169
|
}
|
|
166
170
|
};
|
|
167
171
|
writeConfig(config, argv.client);
|
|
168
|
-
}
|
|
169
|
-
logger.box(green(`Successfully installed Insforge MCP server in ${argv.client}.`));
|
|
170
|
-
} catch (e) {
|
|
171
|
-
logger.error(red(e.message));
|
|
172
172
|
}
|
|
173
|
+
logger.box(green(`Successfully installed Insforge MCP server in ${argv.client}.`));
|
|
174
|
+
} catch (e) {
|
|
175
|
+
logger.error(red(e.message));
|
|
173
176
|
}
|
|
174
177
|
}
|
|
175
178
|
|