zcf 1.0.2 → 1.0.3
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/cli.mjs +2 -2
- package/dist/index.d.mts +0 -2
- package/dist/index.d.ts +0 -2
- package/dist/index.mjs +1 -1
- package/dist/shared/{zcf.C2Q2uOcq.mjs → zcf.BuHXwv0P.mjs} +3 -22
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import cac from 'cac';
|
|
3
|
-
import { i as init } from './shared/zcf.
|
|
3
|
+
import { i as init } from './shared/zcf.BuHXwv0P.mjs';
|
|
4
4
|
import '@posva/prompts';
|
|
5
5
|
import 'ansis';
|
|
6
6
|
import 'node:fs';
|
|
@@ -9,7 +9,7 @@ import 'pathe';
|
|
|
9
9
|
import 'dayjs';
|
|
10
10
|
import 'tinyexec';
|
|
11
11
|
|
|
12
|
-
const version = "1.0.
|
|
12
|
+
const version = "1.0.3";
|
|
13
13
|
|
|
14
14
|
const cli = cac("zcf");
|
|
15
15
|
cli.command("[lang]", "Initialize Claude Code configuration").option("--config-lang <lang>", "Configuration language (zh-CN, en)").option("--force", "Force overwrite existing configuration").option("--skip-install", "Skip Claude Code installation check").action(async (lang, options) => {
|
package/dist/index.d.mts
CHANGED
|
@@ -50,7 +50,6 @@ declare const I18N: {
|
|
|
50
50
|
installSuccess: string;
|
|
51
51
|
installFailed: string;
|
|
52
52
|
npmNotFound: string;
|
|
53
|
-
windowsRestartHint: string;
|
|
54
53
|
configureApi: string;
|
|
55
54
|
customApi: string;
|
|
56
55
|
skipApi: string;
|
|
@@ -90,7 +89,6 @@ declare const I18N: {
|
|
|
90
89
|
installSuccess: string;
|
|
91
90
|
installFailed: string;
|
|
92
91
|
npmNotFound: string;
|
|
93
|
-
windowsRestartHint: string;
|
|
94
92
|
configureApi: string;
|
|
95
93
|
customApi: string;
|
|
96
94
|
skipApi: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -50,7 +50,6 @@ declare const I18N: {
|
|
|
50
50
|
installSuccess: string;
|
|
51
51
|
installFailed: string;
|
|
52
52
|
npmNotFound: string;
|
|
53
|
-
windowsRestartHint: string;
|
|
54
53
|
configureApi: string;
|
|
55
54
|
customApi: string;
|
|
56
55
|
skipApi: string;
|
|
@@ -90,7 +89,6 @@ declare const I18N: {
|
|
|
90
89
|
installSuccess: string;
|
|
91
90
|
installFailed: string;
|
|
92
91
|
npmNotFound: string;
|
|
93
|
-
windowsRestartHint: string;
|
|
94
92
|
configureApi: string;
|
|
95
93
|
customApi: string;
|
|
96
94
|
skipApi: string;
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { C as CLAUDE_DIR, a as CLAUDE_MD_FILE, I as I18N, L as LANG_LABELS, M as MCP_CONFIG_FILE, d as MCP_SERVICES, S as SETTINGS_FILE, b as SUPPORTED_LANGS, j as backupExistingConfig, o as backupMcpConfig, q as buildMcpServerConfig, c as commandExists, l as configureApi, k as copyConfigFiles, h as ensureClaudeDir, n as getMcpConfigPath, g as getPlatform, i as init, f as installClaudeCode, e as isClaudeCodeInstalled, m as mergeConfigs, p as mergeMcpServers, r as readMcpConfig, w as writeMcpConfig } from './shared/zcf.
|
|
1
|
+
export { C as CLAUDE_DIR, a as CLAUDE_MD_FILE, I as I18N, L as LANG_LABELS, M as MCP_CONFIG_FILE, d as MCP_SERVICES, S as SETTINGS_FILE, b as SUPPORTED_LANGS, j as backupExistingConfig, o as backupMcpConfig, q as buildMcpServerConfig, c as commandExists, l as configureApi, k as copyConfigFiles, h as ensureClaudeDir, n as getMcpConfigPath, g as getPlatform, i as init, f as installClaudeCode, e as isClaudeCodeInstalled, m as mergeConfigs, p as mergeMcpServers, r as readMcpConfig, w as writeMcpConfig } from './shared/zcf.BuHXwv0P.mjs';
|
|
2
2
|
import '@posva/prompts';
|
|
3
3
|
import 'ansis';
|
|
4
4
|
import 'node:fs';
|
|
@@ -28,7 +28,6 @@ const I18N = {
|
|
|
28
28
|
installSuccess: "Claude Code \u5B89\u88C5\u6210\u529F",
|
|
29
29
|
installFailed: "Claude Code \u5B89\u88C5\u5931\u8D25",
|
|
30
30
|
npmNotFound: "npm \u672A\u5B89\u88C5\u3002\u8BF7\u5148\u5B89\u88C5 Node.js \u548C npm\u3002",
|
|
31
|
-
windowsRestartHint: "\u26A0 Windows \u7CFB\u7EDF\u8BF7\u91CD\u65B0\u6253\u5F00\u4E00\u4E2A\u65B0\u7684\u7EC8\u7AEF\u7A97\u53E3\uFF08cmd/PowerShell\uFF09\uFF0C\u7136\u540E\u8FD0\u884C claude \u547D\u4EE4",
|
|
32
31
|
configureApi: "\u662F\u5426\u914D\u7F6E API\uFF1F",
|
|
33
32
|
customApi: "\u914D\u7F6E API",
|
|
34
33
|
skipApi: "\u8DF3\u8FC7\uFF08\u7A0D\u540E\u5728 claude \u547D\u4EE4\u4E2D\u81EA\u884C\u914D\u7F6E\uFF0C\u5982 OAuth\uFF09",
|
|
@@ -68,7 +67,6 @@ const I18N = {
|
|
|
68
67
|
installSuccess: "Claude Code installed successfully",
|
|
69
68
|
installFailed: "Failed to install Claude Code",
|
|
70
69
|
npmNotFound: "npm is not installed. Please install Node.js and npm first.",
|
|
71
|
-
windowsRestartHint: "\u26A0 On Windows, please open a new terminal window (cmd/PowerShell) and run the claude command",
|
|
72
70
|
configureApi: "Configure API?",
|
|
73
71
|
customApi: "Configure API",
|
|
74
72
|
skipApi: "Skip (configure later in claude command, e.g., OAuth)",
|
|
@@ -318,8 +316,8 @@ function getPlatform() {
|
|
|
318
316
|
async function commandExists(command) {
|
|
319
317
|
try {
|
|
320
318
|
const cmd = getPlatform() === "windows" ? "where" : "which";
|
|
321
|
-
await exec(cmd, [command]);
|
|
322
|
-
return
|
|
319
|
+
const res = await exec(cmd, [command]);
|
|
320
|
+
return res.exitCode === 0;
|
|
323
321
|
} catch {
|
|
324
322
|
return false;
|
|
325
323
|
}
|
|
@@ -336,18 +334,7 @@ async function installClaudeCode(lang) {
|
|
|
336
334
|
throw new Error(i18n.npmNotFound);
|
|
337
335
|
}
|
|
338
336
|
await exec("npm", ["install", "-g", "@anthropic-ai/claude-code"]);
|
|
339
|
-
|
|
340
|
-
if (await isClaudeCodeInstalled()) {
|
|
341
|
-
console.log(`\u2714 ${i18n.installSuccess}`);
|
|
342
|
-
} else {
|
|
343
|
-
if (getPlatform() === "windows") {
|
|
344
|
-
console.log(`\u2714 ${i18n.installSuccess}`);
|
|
345
|
-
console.log(`
|
|
346
|
-
\u26A0 ${i18n.windowsRestartHint}`);
|
|
347
|
-
} else {
|
|
348
|
-
console.log(`\u2714 ${i18n.installSuccess}`);
|
|
349
|
-
}
|
|
350
|
-
}
|
|
337
|
+
console.log(`\u2714 ${i18n.installSuccess}`);
|
|
351
338
|
} catch (error) {
|
|
352
339
|
console.error(`\u2716 ${i18n.installFailed}`);
|
|
353
340
|
throw error;
|
|
@@ -450,10 +437,8 @@ async function init(options = {}) {
|
|
|
450
437
|
});
|
|
451
438
|
configLang = response.lang;
|
|
452
439
|
}
|
|
453
|
-
let wasAlreadyInstalled = true;
|
|
454
440
|
if (!options.skipInstall) {
|
|
455
441
|
const installed = await isClaudeCodeInstalled();
|
|
456
|
-
wasAlreadyInstalled = installed;
|
|
457
442
|
if (!installed) {
|
|
458
443
|
const response = await prompts({
|
|
459
444
|
type: "confirm",
|
|
@@ -628,10 +613,6 @@ async function init(options = {}) {
|
|
|
628
613
|
}
|
|
629
614
|
console.log(ansis.green(`\u2714 ${i18n.configSuccess} ${CLAUDE_DIR}`));
|
|
630
615
|
console.log("\n" + ansis.cyan(i18n.complete));
|
|
631
|
-
if (getPlatform() === "windows" && !wasAlreadyInstalled) {
|
|
632
|
-
console.log(ansis.yellow(`
|
|
633
|
-
${i18n.windowsRestartHint}`));
|
|
634
|
-
}
|
|
635
616
|
} catch (error) {
|
|
636
617
|
console.error(ansis.red(`${I18N[options.lang || "en"].error}:`), error);
|
|
637
618
|
process.exit(1);
|
package/package.json
CHANGED