zcf 2.9.3 → 2.9.5
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/chunks/simple-config.mjs +33 -20
- package/dist/cli.mjs +6 -9
- package/package.json +1 -1
|
@@ -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.5";
|
|
22
22
|
const homepage = "https://github.com/UfoMiao/zcf";
|
|
23
23
|
|
|
24
24
|
const common$1 = {
|
|
@@ -2583,38 +2583,52 @@ async function cleanupOldVersionFiles(scriptLang) {
|
|
|
2583
2583
|
|
|
2584
2584
|
const execAsync$1 = promisify$1(exec$2);
|
|
2585
2585
|
async function isCcrInstalled() {
|
|
2586
|
+
let commandExists = false;
|
|
2586
2587
|
try {
|
|
2587
2588
|
await execAsync$1("ccr version");
|
|
2588
|
-
|
|
2589
|
+
commandExists = true;
|
|
2589
2590
|
} catch {
|
|
2590
2591
|
try {
|
|
2591
2592
|
await execAsync$1("which ccr");
|
|
2592
|
-
|
|
2593
|
+
commandExists = true;
|
|
2593
2594
|
} catch {
|
|
2594
|
-
|
|
2595
|
+
commandExists = false;
|
|
2595
2596
|
}
|
|
2596
2597
|
}
|
|
2598
|
+
let hasCorrectPackage = false;
|
|
2599
|
+
try {
|
|
2600
|
+
await execAsync$1("npm list -g @musistudio/claude-code-router");
|
|
2601
|
+
hasCorrectPackage = true;
|
|
2602
|
+
} catch {
|
|
2603
|
+
hasCorrectPackage = false;
|
|
2604
|
+
}
|
|
2605
|
+
return {
|
|
2606
|
+
isInstalled: commandExists,
|
|
2607
|
+
hasCorrectPackage
|
|
2608
|
+
};
|
|
2597
2609
|
}
|
|
2598
2610
|
async function installCcr(scriptLang) {
|
|
2599
2611
|
const i18n = getTranslation(scriptLang);
|
|
2600
|
-
const
|
|
2601
|
-
if (
|
|
2612
|
+
const { isInstalled, hasCorrectPackage } = await isCcrInstalled();
|
|
2613
|
+
if (hasCorrectPackage) {
|
|
2602
2614
|
console.log(ansis.green(`\u2714 ${i18n.ccr.ccrAlreadyInstalled}`));
|
|
2603
2615
|
await updateCcr(scriptLang);
|
|
2604
2616
|
return;
|
|
2605
2617
|
}
|
|
2606
|
-
|
|
2607
|
-
try {
|
|
2608
|
-
await execAsync$1("npm list -g claude-code-router");
|
|
2609
|
-
console.log(ansis.yellow(`\u26A0 ${i18n.ccr.detectedIncorrectPackage}`));
|
|
2618
|
+
if (isInstalled && !hasCorrectPackage) {
|
|
2610
2619
|
try {
|
|
2611
|
-
await execAsync$1("npm
|
|
2612
|
-
console.log(ansis.
|
|
2613
|
-
|
|
2614
|
-
|
|
2620
|
+
await execAsync$1("npm list -g claude-code-router");
|
|
2621
|
+
console.log(ansis.yellow(`\u26A0 ${i18n.ccr.detectedIncorrectPackage}`));
|
|
2622
|
+
try {
|
|
2623
|
+
await execAsync$1("npm uninstall -g claude-code-router");
|
|
2624
|
+
console.log(ansis.green(`\u2714 ${i18n.ccr.uninstalledIncorrectPackage}`));
|
|
2625
|
+
} catch (uninstallError) {
|
|
2626
|
+
console.log(ansis.yellow(`\u26A0 ${i18n.ccr.failedToUninstallIncorrectPackage}`));
|
|
2627
|
+
}
|
|
2628
|
+
} catch {
|
|
2615
2629
|
}
|
|
2616
|
-
} catch {
|
|
2617
2630
|
}
|
|
2631
|
+
console.log(ansis.cyan(`\u{1F4E6} ${i18n.ccr.installingCcr}`));
|
|
2618
2632
|
try {
|
|
2619
2633
|
await execAsync$1("npm install -g @musistudio/claude-code-router --force");
|
|
2620
2634
|
console.log(ansis.green(`\u2714 ${i18n.ccr.ccrInstallSuccess}`));
|
|
@@ -3166,9 +3180,8 @@ async function init(options = {}) {
|
|
|
3166
3180
|
} else if (apiAction === "modify-all") {
|
|
3167
3181
|
apiConfig = await configureApiCompletely(i18n, scriptLang);
|
|
3168
3182
|
} else if (apiAction === "use-ccr") {
|
|
3169
|
-
const
|
|
3170
|
-
if (!
|
|
3171
|
-
console.log(ansis.yellow(`${i18n.ccr.installingCcr}`));
|
|
3183
|
+
const ccrStatus = await isCcrInstalled();
|
|
3184
|
+
if (!ccrStatus.hasCorrectPackage) {
|
|
3172
3185
|
await installCcr(scriptLang);
|
|
3173
3186
|
} else {
|
|
3174
3187
|
console.log(ansis.green(`\u2714 ${i18n.ccr.ccrAlreadyInstalled}`));
|
|
@@ -3211,8 +3224,8 @@ async function init(options = {}) {
|
|
|
3211
3224
|
process.exit(0);
|
|
3212
3225
|
}
|
|
3213
3226
|
if (apiChoice === "ccr_proxy") {
|
|
3214
|
-
const
|
|
3215
|
-
if (!
|
|
3227
|
+
const ccrStatus = await isCcrInstalled();
|
|
3228
|
+
if (!ccrStatus.hasCorrectPackage) {
|
|
3216
3229
|
await installCcr(scriptLang);
|
|
3217
3230
|
} else {
|
|
3218
3231
|
console.log(ansis.green(`\u2714 ${i18n.ccr.ccrAlreadyInstalled}`));
|
package/dist/cli.mjs
CHANGED
|
@@ -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}`));
|
package/package.json
CHANGED