zcf 3.1.1 → 3.1.2
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.
|
@@ -16,7 +16,7 @@ import { rm, mkdir, copyFile as copyFile$1 } from 'node:fs/promises';
|
|
|
16
16
|
import i18next from 'i18next';
|
|
17
17
|
import Backend from 'i18next-fs-backend';
|
|
18
18
|
|
|
19
|
-
const version = "3.1.
|
|
19
|
+
const version = "3.1.2";
|
|
20
20
|
const homepage = "https://github.com/UfoMiao/zcf";
|
|
21
21
|
|
|
22
22
|
const i18n = i18next.createInstance();
|
|
@@ -542,6 +542,13 @@ function getMcpCommand() {
|
|
|
542
542
|
}
|
|
543
543
|
return ["npx"];
|
|
544
544
|
}
|
|
545
|
+
function getSystemRoot() {
|
|
546
|
+
if (isWindows()) {
|
|
547
|
+
const systemRoot = process.env.SYSTEMROOT || process.env.SystemRoot || "C:Windows";
|
|
548
|
+
return systemRoot.replace(/\\/g, "\\\\");
|
|
549
|
+
}
|
|
550
|
+
return null;
|
|
551
|
+
}
|
|
545
552
|
async function commandExists(command) {
|
|
546
553
|
try {
|
|
547
554
|
const cmd = getPlatform() === "windows" ? "where" : "which";
|
|
@@ -2661,6 +2668,13 @@ function detectConfigManagementMode() {
|
|
|
2661
2668
|
}
|
|
2662
2669
|
}
|
|
2663
2670
|
|
|
2671
|
+
function applyCodexPlatformCommand(config) {
|
|
2672
|
+
if (config.command === "npx" && isWindows()) {
|
|
2673
|
+
const mcpCmd = getMcpCommand();
|
|
2674
|
+
config.command = mcpCmd[0];
|
|
2675
|
+
config.args = [...mcpCmd.slice(1), ...config.args || []];
|
|
2676
|
+
}
|
|
2677
|
+
}
|
|
2664
2678
|
const CODEX_DIR = join(homedir(), ".codex");
|
|
2665
2679
|
const CODEX_CONFIG_FILE = join(CODEX_DIR, "config.toml");
|
|
2666
2680
|
const CODEX_AUTH_FILE = join(CODEX_DIR, "auth.json");
|
|
@@ -3457,10 +3471,18 @@ async function configureCodexMcp() {
|
|
|
3457
3471
|
continue;
|
|
3458
3472
|
const serviceMeta = servicesMeta.find((service) => service.id === id);
|
|
3459
3473
|
let command = configInfo.config.command || id;
|
|
3460
|
-
|
|
3461
|
-
|
|
3462
|
-
|
|
3474
|
+
let args = (configInfo.config.args || []).map((arg) => String(arg));
|
|
3475
|
+
const serviceConfig = { id: id.toLowerCase(), command, args };
|
|
3476
|
+
applyCodexPlatformCommand(serviceConfig);
|
|
3477
|
+
command = serviceConfig.command;
|
|
3478
|
+
args = serviceConfig.args || [];
|
|
3463
3479
|
const env = { ...configInfo.config.env || {} };
|
|
3480
|
+
if (isWindows()) {
|
|
3481
|
+
const systemRoot = getSystemRoot();
|
|
3482
|
+
if (systemRoot) {
|
|
3483
|
+
env.SYSTEMROOT = systemRoot;
|
|
3484
|
+
}
|
|
3485
|
+
}
|
|
3464
3486
|
if (configInfo.requiresApiKey && configInfo.apiKeyEnvVar) {
|
|
3465
3487
|
const promptMessage = serviceMeta?.apiKeyPrompt || i18n.t("mcp:apiKeyPrompt");
|
|
3466
3488
|
const { apiKey } = await inquirer.prompt([{
|
|
@@ -3476,8 +3498,8 @@ async function configureCodexMcp() {
|
|
|
3476
3498
|
selection.push({
|
|
3477
3499
|
id: id.toLowerCase(),
|
|
3478
3500
|
// Convert to lowercase for Codex compatibility
|
|
3479
|
-
command,
|
|
3480
|
-
args,
|
|
3501
|
+
command: serviceConfig.command,
|
|
3502
|
+
args: serviceConfig.args,
|
|
3481
3503
|
env: Object.keys(env).length > 0 ? env : void 0,
|
|
3482
3504
|
startup_timeout_ms: configInfo.config.startup_timeout_ms
|
|
3483
3505
|
});
|