zcf 2.9.4 → 2.9.6
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 +3 -0
- package/dist/chunks/simple-config.mjs +40 -25
- package/dist/cli.mjs +25 -22
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -27,6 +27,7 @@ Menu options include:
|
|
|
27
27
|
- `3-7` Configuration management (API/CCR, MCP, Model settings, AI personality, etc.)
|
|
28
28
|
- `R` Claude Code Router management (enhanced in v2.8.1)
|
|
29
29
|
- `U` ccusage - Claude Code usage analysis
|
|
30
|
+
- `+` Check updates - Check and update Claude Code and CCR versions
|
|
30
31
|
- More features...
|
|
31
32
|
|
|
32
33
|
### Or, use direct commands:
|
|
@@ -86,6 +87,8 @@ Check for updates (v2.8.1+):
|
|
|
86
87
|
|
|
87
88
|
```bash
|
|
88
89
|
npx zcf check-updates # Check and update Claude Code and CCR to latest versions
|
|
90
|
+
# or
|
|
91
|
+
npx zcf → select +
|
|
89
92
|
```
|
|
90
93
|
|
|
91
94
|
CCR menu options:
|
|
@@ -18,7 +18,7 @@ import { promisify as promisify$1 } from 'node:util';
|
|
|
18
18
|
import { homedir, platform } from 'node:os';
|
|
19
19
|
import { join as join$2 } from 'node:path';
|
|
20
20
|
|
|
21
|
-
const version = "2.9.
|
|
21
|
+
const version = "2.9.6";
|
|
22
22
|
const homepage = "https://github.com/UfoMiao/zcf";
|
|
23
23
|
|
|
24
24
|
const common$1 = {
|
|
@@ -218,6 +218,7 @@ const menu$1 = {
|
|
|
218
218
|
ccusage: "ccusage",
|
|
219
219
|
installBmad: "\u5B89\u88C5 BMad Method",
|
|
220
220
|
clearCache: "\u6E05\u9664\u504F\u597D\u7F13\u5B58",
|
|
221
|
+
checkUpdates: "\u68C0\u67E5\u66F4\u65B0",
|
|
221
222
|
changeLanguage: "\u66F4\u6539\u663E\u793A\u8BED\u8A00 / Select display language",
|
|
222
223
|
exit: "\u9000\u51FA"
|
|
223
224
|
},
|
|
@@ -235,6 +236,7 @@ const menu$1 = {
|
|
|
235
236
|
ccusage: "Claude Code \u7528\u91CF\u5206\u6790",
|
|
236
237
|
installBmad: "AI \u9A71\u52A8\u7684\u5F00\u53D1\u65B9\u6CD5\u8BBA\u6846\u67B6",
|
|
237
238
|
clearCache: "\u6E05\u9664\u504F\u597D\u8BED\u8A00\u7B49\u7F13\u5B58",
|
|
239
|
+
checkUpdates: "\u68C0\u67E5\u5E76\u66F4\u65B0 Claude Code \u548C CCR \u7684\u7248\u672C",
|
|
238
240
|
changeLanguage: "\u66F4\u6539 ZCF \u754C\u9762\u8BED\u8A00"
|
|
239
241
|
}
|
|
240
242
|
};
|
|
@@ -683,6 +685,7 @@ const menu = {
|
|
|
683
685
|
ccusage: "ccusage",
|
|
684
686
|
installBmad: "Install BMad Method",
|
|
685
687
|
clearCache: "Clear preference cache",
|
|
688
|
+
checkUpdates: "Check updates",
|
|
686
689
|
changeLanguage: "Select display language / \u66F4\u6539\u663E\u793A\u8BED\u8A00",
|
|
687
690
|
exit: "Exit"
|
|
688
691
|
},
|
|
@@ -700,6 +703,7 @@ const menu = {
|
|
|
700
703
|
ccusage: "Claude Code usage analysis",
|
|
701
704
|
installBmad: "AI-driven development methodology framework",
|
|
702
705
|
clearCache: "Clear preference language and other caches",
|
|
706
|
+
checkUpdates: "Check and update Claude Code and CCR versions",
|
|
703
707
|
changeLanguage: "Change ZCF interface language"
|
|
704
708
|
}
|
|
705
709
|
};
|
|
@@ -2583,39 +2587,51 @@ async function cleanupOldVersionFiles(scriptLang) {
|
|
|
2583
2587
|
|
|
2584
2588
|
const execAsync$1 = promisify$1(exec$2);
|
|
2585
2589
|
async function isCcrInstalled() {
|
|
2590
|
+
let commandExists = false;
|
|
2586
2591
|
try {
|
|
2587
2592
|
await execAsync$1("ccr version");
|
|
2588
|
-
|
|
2593
|
+
commandExists = true;
|
|
2589
2594
|
} catch {
|
|
2590
2595
|
try {
|
|
2591
2596
|
await execAsync$1("which ccr");
|
|
2592
|
-
|
|
2597
|
+
commandExists = true;
|
|
2593
2598
|
} catch {
|
|
2594
|
-
|
|
2599
|
+
commandExists = false;
|
|
2595
2600
|
}
|
|
2596
2601
|
}
|
|
2597
|
-
|
|
2598
|
-
async function installCcr(scriptLang) {
|
|
2599
|
-
const i18n = getTranslation(scriptLang);
|
|
2600
|
-
let hasIncorrectPackage = false;
|
|
2602
|
+
let hasCorrectPackage = false;
|
|
2601
2603
|
try {
|
|
2602
|
-
await execAsync$1("npm list -g claude-code-router");
|
|
2603
|
-
|
|
2604
|
-
console.log(ansis.yellow(`\u26A0 ${i18n.ccr.detectedIncorrectPackage}`));
|
|
2605
|
-
try {
|
|
2606
|
-
await execAsync$1("npm uninstall -g claude-code-router");
|
|
2607
|
-
console.log(ansis.green(`\u2714 ${i18n.ccr.uninstalledIncorrectPackage}`));
|
|
2608
|
-
} catch (uninstallError) {
|
|
2609
|
-
console.log(ansis.yellow(`\u26A0 ${i18n.ccr.failedToUninstallIncorrectPackage}`));
|
|
2610
|
-
}
|
|
2604
|
+
await execAsync$1("npm list -g @musistudio/claude-code-router");
|
|
2605
|
+
hasCorrectPackage = true;
|
|
2611
2606
|
} catch {
|
|
2607
|
+
hasCorrectPackage = false;
|
|
2612
2608
|
}
|
|
2613
|
-
|
|
2614
|
-
|
|
2609
|
+
return {
|
|
2610
|
+
isInstalled: commandExists,
|
|
2611
|
+
hasCorrectPackage
|
|
2612
|
+
};
|
|
2613
|
+
}
|
|
2614
|
+
async function installCcr(scriptLang) {
|
|
2615
|
+
const i18n = getTranslation(scriptLang);
|
|
2616
|
+
const { isInstalled, hasCorrectPackage } = await isCcrInstalled();
|
|
2617
|
+
if (hasCorrectPackage) {
|
|
2615
2618
|
console.log(ansis.green(`\u2714 ${i18n.ccr.ccrAlreadyInstalled}`));
|
|
2616
2619
|
await updateCcr(scriptLang);
|
|
2617
2620
|
return;
|
|
2618
2621
|
}
|
|
2622
|
+
if (isInstalled && !hasCorrectPackage) {
|
|
2623
|
+
try {
|
|
2624
|
+
await execAsync$1("npm list -g claude-code-router");
|
|
2625
|
+
console.log(ansis.yellow(`\u26A0 ${i18n.ccr.detectedIncorrectPackage}`));
|
|
2626
|
+
try {
|
|
2627
|
+
await execAsync$1("npm uninstall -g claude-code-router");
|
|
2628
|
+
console.log(ansis.green(`\u2714 ${i18n.ccr.uninstalledIncorrectPackage}`));
|
|
2629
|
+
} catch (uninstallError) {
|
|
2630
|
+
console.log(ansis.yellow(`\u26A0 ${i18n.ccr.failedToUninstallIncorrectPackage}`));
|
|
2631
|
+
}
|
|
2632
|
+
} catch {
|
|
2633
|
+
}
|
|
2634
|
+
}
|
|
2619
2635
|
console.log(ansis.cyan(`\u{1F4E6} ${i18n.ccr.installingCcr}`));
|
|
2620
2636
|
try {
|
|
2621
2637
|
await execAsync$1("npm install -g @musistudio/claude-code-router --force");
|
|
@@ -3168,9 +3184,8 @@ async function init(options = {}) {
|
|
|
3168
3184
|
} else if (apiAction === "modify-all") {
|
|
3169
3185
|
apiConfig = await configureApiCompletely(i18n, scriptLang);
|
|
3170
3186
|
} else if (apiAction === "use-ccr") {
|
|
3171
|
-
const
|
|
3172
|
-
if (!
|
|
3173
|
-
console.log(ansis.yellow(`${i18n.ccr.installingCcr}`));
|
|
3187
|
+
const ccrStatus = await isCcrInstalled();
|
|
3188
|
+
if (!ccrStatus.hasCorrectPackage) {
|
|
3174
3189
|
await installCcr(scriptLang);
|
|
3175
3190
|
} else {
|
|
3176
3191
|
console.log(ansis.green(`\u2714 ${i18n.ccr.ccrAlreadyInstalled}`));
|
|
@@ -3213,8 +3228,8 @@ async function init(options = {}) {
|
|
|
3213
3228
|
process.exit(0);
|
|
3214
3229
|
}
|
|
3215
3230
|
if (apiChoice === "ccr_proxy") {
|
|
3216
|
-
const
|
|
3217
|
-
if (!
|
|
3231
|
+
const ccrStatus = await isCcrInstalled();
|
|
3232
|
+
if (!ccrStatus.hasCorrectPackage) {
|
|
3218
3233
|
await installCcr(scriptLang);
|
|
3219
3234
|
} else {
|
|
3220
3235
|
console.log(ansis.green(`\u2714 ${i18n.ccr.ccrAlreadyInstalled}`));
|
|
@@ -3404,4 +3419,4 @@ async function openSettingsJson() {
|
|
|
3404
3419
|
}
|
|
3405
3420
|
}
|
|
3406
3421
|
|
|
3407
|
-
export { readCcrConfig as $, AI_OUTPUT_LANGUAGES as A, writeMcpConfig as B, CLAUDE_DIR as C, backupMcpConfig as D, mergeMcpServers as E, buildMcpServerConfig as F, fixWindowsMcpConfig as G, addCompletedOnboarding as H, I18N as I, getTranslation as J, addNumbersToChoices as K, LEGACY_ZCF_CONFIG_FILE as L, MCP_SERVICES as M, updateZcfConfig as N, readZcfConfig as O, configureAiPersonality as P, isWindows as Q, selectMcpServices as R, SETTINGS_FILE as S, formatApiKeyDisplay as T, modifyApiConfigPartially as U, isCcrInstalled as V, installCcr as W, setupCcrConfiguration as X, validateApiKey as Y, ZCF_CONFIG_FILE as Z, readZcfConfigAsync as _, importRecommendedEnv as a, configureCcrFeature as a0, handleExitPromptError as a1, handleGeneralError as a2, displayBanner as a3, selectScriptLanguage as a4, resolveAiOutputLanguage as a5, updatePromptOnly as a6, selectAndInstallWorkflows as a7, version as a8,
|
|
3422
|
+
export { readCcrConfig as $, AI_OUTPUT_LANGUAGES as A, writeMcpConfig as B, CLAUDE_DIR as C, backupMcpConfig as D, mergeMcpServers as E, buildMcpServerConfig as F, fixWindowsMcpConfig as G, addCompletedOnboarding as H, I18N as I, getTranslation as J, addNumbersToChoices as K, LEGACY_ZCF_CONFIG_FILE as L, MCP_SERVICES as M, updateZcfConfig as N, readZcfConfig as O, configureAiPersonality as P, isWindows as Q, selectMcpServices as R, SETTINGS_FILE as S, formatApiKeyDisplay as T, modifyApiConfigPartially as U, isCcrInstalled as V, installCcr as W, setupCcrConfiguration as X, validateApiKey as Y, ZCF_CONFIG_FILE as Z, readZcfConfigAsync as _, importRecommendedEnv as a, configureCcrFeature as a0, handleExitPromptError as a1, handleGeneralError as a2, displayBanner as a3, selectScriptLanguage as a4, resolveAiOutputLanguage as a5, updatePromptOnly as a6, selectAndInstallWorkflows as a7, version as a8, checkAndUpdateTools as a9, displayBannerWithInfo as aa, prompts as ab, importRecommendedPermissions as b, commandExists as c, cleanupPermissions as d, CLAUDE_MD_FILE as e, ClAUDE_CONFIG_FILE as f, getPlatform as g, SUPPORTED_LANGS as h, init as i, LANG_LABELS as j, isClaudeCodeInstalled as k, installClaudeCode as l, mergeAndCleanPermissions as m, ensureClaudeDir as n, openSettingsJson as o, backupExistingConfig as p, copyConfigFiles as q, configureApi as r, mergeConfigs as s, mergeSettingsFile as t, updateDefaultModel as u, getExistingModelConfig as v, getExistingApiConfig as w, applyAiLanguageDirective as x, getMcpConfigPath as y, readMcpConfig as z };
|
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 { J as getTranslation, Z as ZCF_CONFIG_FILE, h as SUPPORTED_LANGS, K as addNumbersToChoices, j as LANG_LABELS, N as updateZcfConfig, o as openSettingsJson, b as importRecommendedPermissions, a as importRecommendedEnv, O as readZcfConfig, x as applyAiLanguageDirective, P as configureAiPersonality, v as getExistingModelConfig, u as updateDefaultModel, Q as isWindows, z as readMcpConfig, G as fixWindowsMcpConfig, B as writeMcpConfig, R as selectMcpServices, D as backupMcpConfig, M as MCP_SERVICES, F as buildMcpServerConfig, E as mergeMcpServers, w as getExistingApiConfig, T as formatApiKeyDisplay, H as addCompletedOnboarding, U as modifyApiConfigPartially, V as isCcrInstalled, W as installCcr, X as setupCcrConfiguration, Y as validateApiKey, r as configureApi, _ as readZcfConfigAsync, I as I18N, $ as readCcrConfig, a0 as configureCcrFeature, a1 as handleExitPromptError, a2 as handleGeneralError, a3 as displayBanner, a4 as selectScriptLanguage, a5 as resolveAiOutputLanguage, a6 as updatePromptOnly, a7 as selectAndInstallWorkflows, a8 as version, a9 as
|
|
4
|
+
import { J as getTranslation, Z as ZCF_CONFIG_FILE, h as SUPPORTED_LANGS, K as addNumbersToChoices, j as LANG_LABELS, N as updateZcfConfig, o as openSettingsJson, b as importRecommendedPermissions, a as importRecommendedEnv, O as readZcfConfig, x as applyAiLanguageDirective, P as configureAiPersonality, v as getExistingModelConfig, u as updateDefaultModel, Q as isWindows, z as readMcpConfig, G as fixWindowsMcpConfig, B as writeMcpConfig, R as selectMcpServices, D as backupMcpConfig, M as MCP_SERVICES, F as buildMcpServerConfig, E as mergeMcpServers, w as getExistingApiConfig, T as formatApiKeyDisplay, H as addCompletedOnboarding, U as modifyApiConfigPartially, V as isCcrInstalled, W as installCcr, X as setupCcrConfiguration, Y as validateApiKey, r as configureApi, _ as readZcfConfigAsync, I as I18N, $ as readCcrConfig, a0 as configureCcrFeature, a1 as handleExitPromptError, a2 as handleGeneralError, a3 as displayBanner, a4 as selectScriptLanguage, a5 as resolveAiOutputLanguage, a6 as updatePromptOnly, a7 as selectAndInstallWorkflows, a8 as version, a9 as checkAndUpdateTools, aa as displayBannerWithInfo, i as init } from './chunks/simple-config.mjs';
|
|
5
5
|
import inquirer from 'inquirer';
|
|
6
6
|
import { existsSync, unlinkSync } from 'node:fs';
|
|
7
7
|
import { x } from 'tinyexec';
|
|
@@ -67,9 +67,8 @@ async function configureApiFeature(scriptLang) {
|
|
|
67
67
|
await modifyApiConfigPartially(existingApiConfig, i18n, scriptLang);
|
|
68
68
|
return;
|
|
69
69
|
} else if (action === "use-ccr") {
|
|
70
|
-
const
|
|
71
|
-
if (!
|
|
72
|
-
console.log(ansis.yellow(`${i18n.ccr.installingCcr}`));
|
|
70
|
+
const ccrStatus = await isCcrInstalled();
|
|
71
|
+
if (!ccrStatus.hasCorrectPackage) {
|
|
73
72
|
await installCcr(scriptLang);
|
|
74
73
|
} else {
|
|
75
74
|
console.log(ansis.green(`\u2714 ${i18n.ccr.ccrAlreadyInstalled}`));
|
|
@@ -108,9 +107,8 @@ async function configureApiFeature(scriptLang) {
|
|
|
108
107
|
return;
|
|
109
108
|
}
|
|
110
109
|
if (apiChoice === "ccr_proxy") {
|
|
111
|
-
const
|
|
112
|
-
if (!
|
|
113
|
-
console.log(ansis.yellow(`${i18n.ccr.installingCcr}`));
|
|
110
|
+
const ccrStatus = await isCcrInstalled();
|
|
111
|
+
if (!ccrStatus.hasCorrectPackage) {
|
|
114
112
|
await installCcr(scriptLang);
|
|
115
113
|
} else {
|
|
116
114
|
console.log(ansis.green(`\u2714 ${i18n.ccr.ccrAlreadyInstalled}`));
|
|
@@ -562,9 +560,8 @@ async function showCcrMenu(scriptLang) {
|
|
|
562
560
|
});
|
|
563
561
|
switch (choice) {
|
|
564
562
|
case "1":
|
|
565
|
-
const
|
|
566
|
-
if (!
|
|
567
|
-
console.log(ansis.yellow(`${i18n.ccr.installingCcr}`));
|
|
563
|
+
const ccrStatus = await isCcrInstalled();
|
|
564
|
+
if (!ccrStatus.hasCorrectPackage) {
|
|
568
565
|
await installCcr(scriptLang);
|
|
569
566
|
} else {
|
|
570
567
|
console.log(ansis.green(`\u2714 ${i18n.ccr.ccrAlreadyInstalled}`));
|
|
@@ -762,6 +759,16 @@ ${i18n.configuration.updatingPrompts}
|
|
|
762
759
|
}
|
|
763
760
|
}
|
|
764
761
|
|
|
762
|
+
async function checkUpdates(options = {}) {
|
|
763
|
+
const scriptLang = options.lang || await selectScriptLanguage();
|
|
764
|
+
try {
|
|
765
|
+
await checkAndUpdateTools(scriptLang);
|
|
766
|
+
} catch (error) {
|
|
767
|
+
console.error(ansis.red("Error checking updates:"), error);
|
|
768
|
+
process.exit(1);
|
|
769
|
+
}
|
|
770
|
+
}
|
|
771
|
+
|
|
765
772
|
async function showMainMenu() {
|
|
766
773
|
try {
|
|
767
774
|
displayBannerWithInfo();
|
|
@@ -823,6 +830,9 @@ async function showMainMenu() {
|
|
|
823
830
|
console.log(
|
|
824
831
|
` ${ansis.cyan("-.")} ${i18n.menu.menuOptions.clearCache} ${ansis.gray("- " + i18n.menu.menuDescriptions.clearCache)}`
|
|
825
832
|
);
|
|
833
|
+
console.log(
|
|
834
|
+
` ${ansis.cyan("+.")} ${i18n.menu.menuOptions.checkUpdates} ${ansis.gray("- " + i18n.menu.menuDescriptions.checkUpdates)}`
|
|
835
|
+
);
|
|
826
836
|
console.log(` ${ansis.red("Q.")} ${ansis.red(i18n.menu.menuOptions.exit)}`);
|
|
827
837
|
console.log("");
|
|
828
838
|
const { choice } = await inquirer.prompt({
|
|
@@ -830,7 +840,7 @@ async function showMainMenu() {
|
|
|
830
840
|
name: "choice",
|
|
831
841
|
message: i18n.common.enterChoice,
|
|
832
842
|
validate: (value) => {
|
|
833
|
-
const valid = ["1", "2", "3", "4", "5", "6", "7", "r", "R", "u", "U", "0", "-", "q", "Q"];
|
|
843
|
+
const valid = ["1", "2", "3", "4", "5", "6", "7", "r", "R", "u", "U", "0", "-", "+", "q", "Q"];
|
|
834
844
|
return valid.includes(value) || i18n.common.invalidChoice;
|
|
835
845
|
}
|
|
836
846
|
});
|
|
@@ -878,13 +888,16 @@ async function showMainMenu() {
|
|
|
878
888
|
case "-":
|
|
879
889
|
await clearZcfCacheFeature(scriptLang);
|
|
880
890
|
break;
|
|
891
|
+
case "+":
|
|
892
|
+
await checkUpdates({ lang: scriptLang });
|
|
893
|
+
break;
|
|
881
894
|
case "q":
|
|
882
895
|
exitMenu = true;
|
|
883
896
|
console.log(ansis.cyan(i18n.common.goodbye));
|
|
884
897
|
break;
|
|
885
898
|
}
|
|
886
899
|
if (!exitMenu && choice.toLowerCase() !== "q") {
|
|
887
|
-
if (choice === "0" || choice === "-" || choice.toLowerCase() === "u" || choice.toLowerCase() === "r") {
|
|
900
|
+
if (choice === "0" || choice === "-" || choice === "+" || choice.toLowerCase() === "u" || choice.toLowerCase() === "r") {
|
|
888
901
|
console.log("\n" + ansis.dim("\u2500".repeat(50)) + "\n");
|
|
889
902
|
continue;
|
|
890
903
|
}
|
|
@@ -926,16 +939,6 @@ async function ccr(options = {}) {
|
|
|
926
939
|
}
|
|
927
940
|
}
|
|
928
941
|
|
|
929
|
-
async function checkUpdates(options = {}) {
|
|
930
|
-
const scriptLang = options.lang || await selectScriptLanguage();
|
|
931
|
-
try {
|
|
932
|
-
await checkAndUpdateTools(scriptLang);
|
|
933
|
-
} catch (error) {
|
|
934
|
-
console.error(ansis.red("Error checking updates:"), error);
|
|
935
|
-
process.exit(1);
|
|
936
|
-
}
|
|
937
|
-
}
|
|
938
|
-
|
|
939
942
|
function setupCommands(cli) {
|
|
940
943
|
cli.command("[lang]", "Show interactive menu (default)").option("--init", "Run full initialization directly").option("--config-lang, -c <lang>", "Configuration language (zh-CN, en)").option("--force, -f", "Force overwrite existing configuration").action(async (lang, options) => {
|
|
941
944
|
await handleDefaultCommand(lang, options);
|
package/package.json
CHANGED