zcf 2.5.0 → 2.5.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.
- package/README.md +4 -2
- package/dist/cli.mjs +2 -6
- package/dist/index.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.mjs +1 -1
- package/dist/shared/{zcf.DgtRGf5j.mjs → zcf.CEsHvLRM.mjs} +16 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
[](https://opensource.org/licenses/MIT)
|
|
4
4
|
[](https://claude.ai/code)
|
|
5
5
|
[](https://www.npmjs.com/package/zcf)
|
|
6
|
+
[](https://codecov.io/gh/UfoMiao/zcf)
|
|
7
|
+
[](https://deepwiki.com/UfoMiao/zcf)
|
|
6
8
|
|
|
7
9
|
[中文](README_zh.md) | **English**
|
|
8
10
|
|
|
@@ -270,7 +272,7 @@ npx zcf u -c en # Using short option
|
|
|
270
272
|
## 📁 Project Structure
|
|
271
273
|
|
|
272
274
|
```
|
|
273
|
-
|
|
275
|
+
zcf/
|
|
274
276
|
├── README.md # Documentation
|
|
275
277
|
├── package.json # npm package configuration
|
|
276
278
|
├── bin/
|
|
@@ -410,4 +412,4 @@ MIT License
|
|
|
410
412
|
|
|
411
413
|
If this project helps you, please give me a ⭐️ Star!
|
|
412
414
|
|
|
413
|
-
[](https://star-history.com/#UfoMiao/zcf&Date)
|
package/dist/cli.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import cac from 'cac';
|
|
3
3
|
import ansis from 'ansis';
|
|
4
|
-
import { h as SUPPORTED_LANGS, I as I18N, L as LANG_LABELS, G as updateZcfConfig, Z as ZCF_CONFIG_FILE, o as openSettingsJson, b as importRecommendedPermissions, a as importRecommendedEnv, H as readZcfConfig, J as resolveAiOutputLanguage, v as applyAiLanguageDirective, K as configureAiPersonality, u as updateDefaultModel, N as isWindows, x as readMcpConfig, E as fixWindowsMcpConfig, y as writeMcpConfig, O as selectMcpServices, z as backupMcpConfig, M as MCP_SERVICES, D as buildMcpServerConfig, B as mergeMcpServers, t as getExistingApiConfig, P as formatApiKeyDisplay, Q as modifyApiConfigPartially, R as validateApiKey, q as configureApi, T as displayBanner, U as selectScriptLanguage,
|
|
4
|
+
import { h as SUPPORTED_LANGS, I as I18N, L as LANG_LABELS, G as updateZcfConfig, Z as ZCF_CONFIG_FILE, o as openSettingsJson, b as importRecommendedPermissions, a as importRecommendedEnv, H as readZcfConfig, J as resolveAiOutputLanguage, v as applyAiLanguageDirective, K as configureAiPersonality, u as updateDefaultModel, N as isWindows, x as readMcpConfig, E as fixWindowsMcpConfig, y as writeMcpConfig, O as selectMcpServices, z as backupMcpConfig, M as MCP_SERVICES, D as buildMcpServerConfig, B as mergeMcpServers, t as getExistingApiConfig, P as formatApiKeyDisplay, Q as modifyApiConfigPartially, R as validateApiKey, q as configureApi, T as displayBanner, U as selectScriptLanguage, V as updatePromptOnly, W as version, X as handleExitPromptError, Y as handleGeneralError, _ as displayBannerWithInfo, i as init } from './shared/zcf.CEsHvLRM.mjs';
|
|
5
5
|
import inquirer from 'inquirer';
|
|
6
6
|
import { existsSync, unlinkSync } from 'node:fs';
|
|
7
7
|
import 'pathe';
|
|
@@ -149,7 +149,7 @@ async function configureMcpFeature(scriptLang) {
|
|
|
149
149
|
validate: (value) => !!value || i18n.keyRequired
|
|
150
150
|
});
|
|
151
151
|
if (apiKey) {
|
|
152
|
-
config = buildMcpServerConfig(service.config, apiKey, service.apiKeyPlaceholder);
|
|
152
|
+
config = buildMcpServerConfig(service.config, apiKey, service.apiKeyPlaceholder, service.apiKeyEnvVar);
|
|
153
153
|
} else {
|
|
154
154
|
continue;
|
|
155
155
|
}
|
|
@@ -302,10 +302,6 @@ async function update(options = {}) {
|
|
|
302
302
|
const scriptLang = await selectScriptLanguage();
|
|
303
303
|
const zcfConfig = readZcfConfig();
|
|
304
304
|
const i18n = I18N[scriptLang];
|
|
305
|
-
if (!existsSync(SETTINGS_FILE)) {
|
|
306
|
-
console.log(ansis.yellow(i18n.noExistingConfig));
|
|
307
|
-
process.exit(1);
|
|
308
|
-
}
|
|
309
305
|
let configLang = options.configLang;
|
|
310
306
|
if (!configLang) {
|
|
311
307
|
const { lang } = await inquirer.prompt({
|
package/dist/index.d.mts
CHANGED
|
@@ -14,6 +14,7 @@ interface McpService {
|
|
|
14
14
|
'zh-CN': string;
|
|
15
15
|
};
|
|
16
16
|
apiKeyPlaceholder?: string;
|
|
17
|
+
apiKeyEnvVar?: string;
|
|
17
18
|
config: McpServerConfig;
|
|
18
19
|
}
|
|
19
20
|
interface McpServerConfig {
|
|
@@ -446,7 +447,7 @@ declare function readMcpConfig(): ClaudeConfiguration | null;
|
|
|
446
447
|
declare function writeMcpConfig(config: ClaudeConfiguration): void;
|
|
447
448
|
declare function backupMcpConfig(): string | null;
|
|
448
449
|
declare function mergeMcpServers(existing: ClaudeConfiguration | null, newServers: Record<string, McpServerConfig>): ClaudeConfiguration;
|
|
449
|
-
declare function buildMcpServerConfig(baseConfig: McpServerConfig, apiKey?: string, placeholder?: string): McpServerConfig;
|
|
450
|
+
declare function buildMcpServerConfig(baseConfig: McpServerConfig, apiKey?: string, placeholder?: string, envVarName?: string): McpServerConfig;
|
|
450
451
|
declare function fixWindowsMcpConfig(config: ClaudeConfiguration): ClaudeConfiguration;
|
|
451
452
|
declare function addCompletedOnboarding(): void;
|
|
452
453
|
|
package/dist/index.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ interface McpService {
|
|
|
14
14
|
'zh-CN': string;
|
|
15
15
|
};
|
|
16
16
|
apiKeyPlaceholder?: string;
|
|
17
|
+
apiKeyEnvVar?: string;
|
|
17
18
|
config: McpServerConfig;
|
|
18
19
|
}
|
|
19
20
|
interface McpServerConfig {
|
|
@@ -446,7 +447,7 @@ declare function readMcpConfig(): ClaudeConfiguration | null;
|
|
|
446
447
|
declare function writeMcpConfig(config: ClaudeConfiguration): void;
|
|
447
448
|
declare function backupMcpConfig(): string | null;
|
|
448
449
|
declare function mergeMcpServers(existing: ClaudeConfiguration | null, newServers: Record<string, McpServerConfig>): ClaudeConfiguration;
|
|
449
|
-
declare function buildMcpServerConfig(baseConfig: McpServerConfig, apiKey?: string, placeholder?: string): McpServerConfig;
|
|
450
|
+
declare function buildMcpServerConfig(baseConfig: McpServerConfig, apiKey?: string, placeholder?: string, envVarName?: string): McpServerConfig;
|
|
450
451
|
declare function fixWindowsMcpConfig(config: ClaudeConfiguration): ClaudeConfiguration;
|
|
451
452
|
declare function addCompletedOnboarding(): void;
|
|
452
453
|
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as AI_OUTPUT_LANGUAGES, C as CLAUDE_DIR, e as CLAUDE_MD_FILE, f as ClAUDE_CONFIG_FILE, I as I18N, L as LANG_LABELS, M as MCP_SERVICES, S as SETTINGS_FILE, h as SUPPORTED_LANGS, Z as ZCF_CONFIG_FILE, F as addCompletedOnboarding, v as applyAiLanguageDirective, n as backupExistingConfig, z as backupMcpConfig, D as buildMcpServerConfig, d as cleanupPermissions, c as commandExists, q as configureApi, p as copyConfigFiles, l as ensureClaudeDir, E as fixWindowsMcpConfig, t as getExistingApiConfig, w as getMcpConfigPath, g as getPlatform, a as importRecommendedEnv, b as importRecommendedPermissions, i as init, k as installClaudeCode, j as isClaudeCodeInstalled, m as mergeAndCleanPermissions, r as mergeConfigs, B as mergeMcpServers, s as mergeSettingsFile, o as openSettingsJson, x as readMcpConfig, u as updateDefaultModel, y as writeMcpConfig } from './shared/zcf.
|
|
1
|
+
export { A as AI_OUTPUT_LANGUAGES, C as CLAUDE_DIR, e as CLAUDE_MD_FILE, f as ClAUDE_CONFIG_FILE, I as I18N, L as LANG_LABELS, M as MCP_SERVICES, S as SETTINGS_FILE, h as SUPPORTED_LANGS, Z as ZCF_CONFIG_FILE, F as addCompletedOnboarding, v as applyAiLanguageDirective, n as backupExistingConfig, z as backupMcpConfig, D as buildMcpServerConfig, d as cleanupPermissions, c as commandExists, q as configureApi, p as copyConfigFiles, l as ensureClaudeDir, E as fixWindowsMcpConfig, t as getExistingApiConfig, w as getMcpConfigPath, g as getPlatform, a as importRecommendedEnv, b as importRecommendedPermissions, i as init, k as installClaudeCode, j as isClaudeCodeInstalled, m as mergeAndCleanPermissions, r as mergeConfigs, B as mergeMcpServers, s as mergeSettingsFile, o as openSettingsJson, x as readMcpConfig, u as updateDefaultModel, y as writeMcpConfig } from './shared/zcf.CEsHvLRM.mjs';
|
|
2
2
|
import 'inquirer';
|
|
3
3
|
import 'ansis';
|
|
4
4
|
import 'node:fs';
|
|
@@ -7,7 +7,7 @@ import { fileURLToPath } from 'node:url';
|
|
|
7
7
|
import { exec } from 'tinyexec';
|
|
8
8
|
import { homedir, platform } from 'node:os';
|
|
9
9
|
|
|
10
|
-
const version = "2.5.
|
|
10
|
+
const version = "2.5.2";
|
|
11
11
|
const homepage = "https://github.com/UfoMiao/zcf";
|
|
12
12
|
|
|
13
13
|
const CLAUDE_DIR = join(homedir(), ".claude");
|
|
@@ -465,12 +465,14 @@ const MCP_SERVICES = [
|
|
|
465
465
|
"zh-CN": "\u8BF7\u8F93\u5165 Exa API Key",
|
|
466
466
|
en: "Enter Exa API Key"
|
|
467
467
|
},
|
|
468
|
-
|
|
468
|
+
apiKeyEnvVar: "EXA_API_KEY",
|
|
469
469
|
config: {
|
|
470
470
|
type: "stdio",
|
|
471
471
|
command: "npx",
|
|
472
|
-
args: ["-y", "mcp-
|
|
473
|
-
env: {
|
|
472
|
+
args: ["-y", "exa-mcp-server"],
|
|
473
|
+
env: {
|
|
474
|
+
EXA_API_KEY: "YOUR_EXA_API_KEY"
|
|
475
|
+
}
|
|
474
476
|
}
|
|
475
477
|
}
|
|
476
478
|
];
|
|
@@ -631,7 +633,10 @@ function readZcfConfig() {
|
|
|
631
633
|
return readJsonConfig(ZCF_CONFIG_FILE);
|
|
632
634
|
}
|
|
633
635
|
function writeZcfConfig(config) {
|
|
634
|
-
|
|
636
|
+
try {
|
|
637
|
+
writeJsonConfig(ZCF_CONFIG_FILE, config);
|
|
638
|
+
} catch (error) {
|
|
639
|
+
}
|
|
635
640
|
}
|
|
636
641
|
function updateZcfConfig(updates) {
|
|
637
642
|
const existingConfig = readZcfConfig();
|
|
@@ -1391,12 +1396,16 @@ function applyPlatformCommand(config) {
|
|
|
1391
1396
|
config.args = [...mcpCmd.slice(1), ...config.args || []];
|
|
1392
1397
|
}
|
|
1393
1398
|
}
|
|
1394
|
-
function buildMcpServerConfig(baseConfig, apiKey, placeholder = "YOUR_EXA_API_KEY") {
|
|
1399
|
+
function buildMcpServerConfig(baseConfig, apiKey, placeholder = "YOUR_EXA_API_KEY", envVarName) {
|
|
1395
1400
|
const config = deepClone(baseConfig);
|
|
1396
1401
|
applyPlatformCommand(config);
|
|
1397
1402
|
if (!apiKey) {
|
|
1398
1403
|
return config;
|
|
1399
1404
|
}
|
|
1405
|
+
if (envVarName && config.env) {
|
|
1406
|
+
config.env[envVarName] = apiKey;
|
|
1407
|
+
return config;
|
|
1408
|
+
}
|
|
1400
1409
|
if (config.args) {
|
|
1401
1410
|
config.args = config.args.map((arg) => arg.replace(placeholder, apiKey));
|
|
1402
1411
|
}
|
|
@@ -1742,7 +1751,7 @@ async function init(options = {}) {
|
|
|
1742
1751
|
continue;
|
|
1743
1752
|
}
|
|
1744
1753
|
if (apiKey) {
|
|
1745
|
-
config = buildMcpServerConfig(service.config, apiKey, service.apiKeyPlaceholder);
|
|
1754
|
+
config = buildMcpServerConfig(service.config, apiKey, service.apiKeyPlaceholder, service.apiKeyEnvVar);
|
|
1746
1755
|
} else {
|
|
1747
1756
|
continue;
|
|
1748
1757
|
}
|
package/package.json
CHANGED