zcf 2.9.8 β 2.9.9
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 +15 -3
- package/dist/chunks/simple-config.mjs +204 -21
- package/dist/cli.mjs +101 -12
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -27,7 +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
|
|
30
|
+
- `+` Check updates - Check and update Claude Code, CCR and CCometixLine versions (v2.10.0+ enhanced)
|
|
31
31
|
- More features...
|
|
32
32
|
|
|
33
33
|
### Or, use direct commands:
|
|
@@ -75,6 +75,16 @@ After installation, use `/bmad-init` to initialize the BMad workflow in your pro
|
|
|
75
75
|
- **Easy Management**: Interactive menu for CCR configuration and service control
|
|
76
76
|
- **Auto Updates**: Automatic version checking and updates for CCR and Claude Code (v2.8.1+)
|
|
77
77
|
|
|
78
|
+
#### π CCometixLine Support (Status Bar Tool) (v2.10.0+ New)
|
|
79
|
+
|
|
80
|
+
[CCometixLine](https://github.com/Haleclipse/CCometixLine) is a high-performance Rust-based statusline tool that provides:
|
|
81
|
+
|
|
82
|
+
- **Real-time Usage Tracking**: Monitor Claude Code API usage in real-time
|
|
83
|
+
- **Git Integration**: Display Git status and branch information
|
|
84
|
+
- **Status Line Display**: Native integration with your terminal statusline
|
|
85
|
+
- **Performance Optimized**: Built with Rust for minimal resource usage
|
|
86
|
+
- **Auto Updates**: Included in ZCF's update checking system
|
|
87
|
+
|
|
78
88
|
To access CCR features:
|
|
79
89
|
|
|
80
90
|
```bash
|
|
@@ -83,10 +93,10 @@ npx zcf ccr # Open CCR management menu
|
|
|
83
93
|
npx zcf β select R
|
|
84
94
|
```
|
|
85
95
|
|
|
86
|
-
Check for updates (v2.8.1+):
|
|
96
|
+
Check for updates (v2.8.1+, CCometixLine support v2.10.0+):
|
|
87
97
|
|
|
88
98
|
```bash
|
|
89
|
-
npx zcf check-updates # Check and update Claude Code and
|
|
99
|
+
npx zcf check-updates # Check and update Claude Code, CCR and CCometixLine to latest versions
|
|
90
100
|
# or
|
|
91
101
|
npx zcf β select +
|
|
92
102
|
```
|
|
@@ -197,6 +207,7 @@ Select function:
|
|
|
197
207
|
--------- Other Tools ----------
|
|
198
208
|
R. CCR Management - Claude Code Router management
|
|
199
209
|
U. CCUsage - Claude Code usage analysis tool
|
|
210
|
+
L. CCometixLine - High-performance statusline tool with Git integration and real-time usage tracking (v2.10.0+ new)
|
|
200
211
|
|
|
201
212
|
------------ ZCF ------------
|
|
202
213
|
0. Select display language / ζ΄ζΉζΎη€Ίθ―θ¨ - Change ZCF interface language
|
|
@@ -499,6 +510,7 @@ This project is inspired by and incorporates the following open source projects:
|
|
|
499
510
|
|
|
500
511
|
- [LINUX DO - The New Ideal Community](https://linux.do)
|
|
501
512
|
- [CCR](https://github.com/musistudio/claude-code-router)
|
|
513
|
+
- [CCometixLine](https://github.com/Haleclipse/CCometixLine)
|
|
502
514
|
- [ccusage](https://github.com/ryoppippi/ccusage)
|
|
503
515
|
- [BMad Method](https://github.com/bmad-code-org/BMAD-METHOD)
|
|
504
516
|
|
|
@@ -15,7 +15,7 @@ import { promisify as promisify$1 } from 'node:util';
|
|
|
15
15
|
import { homedir, platform } from 'node:os';
|
|
16
16
|
import { join as join$1 } from 'node:path';
|
|
17
17
|
|
|
18
|
-
const version = "2.9.
|
|
18
|
+
const version = "2.9.9";
|
|
19
19
|
const homepage = "https://github.com/UfoMiao/zcf";
|
|
20
20
|
|
|
21
21
|
const common$1 = {
|
|
@@ -213,6 +213,7 @@ const menu$1 = {
|
|
|
213
213
|
configureCcr: "\u914D\u7F6E\u6A21\u578B\u4EE3\u7406 (CCR)",
|
|
214
214
|
ccrManagement: "CCR",
|
|
215
215
|
ccusage: "ccusage",
|
|
216
|
+
cometixLine: "CCometixLine",
|
|
216
217
|
installBmad: "\u5B89\u88C5 BMad Method",
|
|
217
218
|
clearCache: "\u6E05\u9664\u504F\u597D\u7F13\u5B58",
|
|
218
219
|
checkUpdates: "\u68C0\u67E5\u66F4\u65B0",
|
|
@@ -231,9 +232,10 @@ const menu$1 = {
|
|
|
231
232
|
configureCcr: "\u914D\u7F6E Claude Code Router \u4EE5\u4F7F\u7528\u591A\u4E2A AI \u6A21\u578B",
|
|
232
233
|
ccrManagement: "\u914D\u7F6E Claude Code Router \u4EE5\u4F7F\u7528\u591A\u4E2A AI \u6A21\u578B",
|
|
233
234
|
ccusage: "Claude Code \u7528\u91CF\u5206\u6790",
|
|
235
|
+
cometixLine: "\u57FA\u4E8E Rust \u7684\u9AD8\u6027\u80FD Claude Code \u72B6\u6001\u680F\u5DE5\u5177\uFF0C\u96C6\u6210 Git \u4FE1\u606F\u548C\u5B9E\u65F6\u4F7F\u7528\u91CF\u8DDF\u8E2A",
|
|
234
236
|
installBmad: "AI \u9A71\u52A8\u7684\u5F00\u53D1\u65B9\u6CD5\u8BBA\u6846\u67B6",
|
|
235
237
|
clearCache: "\u6E05\u9664\u504F\u597D\u8BED\u8A00\u7B49\u7F13\u5B58",
|
|
236
|
-
checkUpdates: "\u68C0\u67E5\u5E76\u66F4\u65B0 Claude Code \u548C
|
|
238
|
+
checkUpdates: "\u68C0\u67E5\u5E76\u66F4\u65B0 Claude Code\u3001CCR \u548C CCometixLine \u7684\u7248\u672C",
|
|
237
239
|
changeLanguage: "\u66F4\u6539 ZCF \u754C\u9762\u8BED\u8A00"
|
|
238
240
|
}
|
|
239
241
|
};
|
|
@@ -450,6 +452,36 @@ const ccrMessages$1 = {
|
|
|
450
452
|
ccrUiApiKeyHint: "\u4F7F\u7528\u6B64\u5BC6\u94A5\u767B\u5F55 CCR UI \u754C\u9762"
|
|
451
453
|
};
|
|
452
454
|
|
|
455
|
+
const cometixMessages$1 = {
|
|
456
|
+
// Installation
|
|
457
|
+
installingCometix: "\u6B63\u5728\u5B89\u88C5 CCometixLine...",
|
|
458
|
+
cometixInstallSuccess: "CCometixLine \u5B89\u88C5\u6210\u529F",
|
|
459
|
+
cometixInstallFailed: "\u5B89\u88C5 CCometixLine \u5931\u8D25",
|
|
460
|
+
cometixAlreadyInstalled: "CCometixLine \u5DF2\u5B89\u88C5",
|
|
461
|
+
// Installation prompt in init
|
|
462
|
+
installCometixPrompt: "\u662F\u5426\u5B89\u88C5 CCometixLine - \u57FA\u4E8E Rust \u7684\u9AD8\u6027\u80FD Claude Code \u72B6\u6001\u680F\u5DE5\u5177\uFF0C\u96C6\u6210 Git \u4FE1\u606F\u548C\u5B9E\u65F6\u4F7F\u7528\u91CF\u8DDF\u8E2A\uFF1F",
|
|
463
|
+
cometixSkipped: "CCometixLine \u5B89\u88C5\u5DF2\u8DF3\u8FC7",
|
|
464
|
+
// Commands
|
|
465
|
+
installingOrUpdating: "\u6B63\u5728\u5B89\u88C5/\u66F4\u65B0 CCometixLine...",
|
|
466
|
+
installUpdateSuccess: "CCometixLine \u5B89\u88C5/\u66F4\u65B0\u5B8C\u6210",
|
|
467
|
+
installUpdateFailed: "\u5B89\u88C5/\u66F4\u65B0 CCometixLine \u5931\u8D25",
|
|
468
|
+
printingConfig: "\u6B63\u5728\u6253\u5370 CCometixLine \u914D\u7F6E...",
|
|
469
|
+
printConfigSuccess: "\u914D\u7F6E\u6253\u5370\u6210\u529F",
|
|
470
|
+
printConfigFailed: "\u6253\u5370\u914D\u7F6E\u5931\u8D25",
|
|
471
|
+
commandNotFound: "ccline \u547D\u4EE4\u672A\u627E\u5230\u3002\u8BF7\u5148\u5B89\u88C5 CCometixLine\u3002",
|
|
472
|
+
// CCometixLine Menu
|
|
473
|
+
cometixMenuTitle: "CCometixLine - \u57FA\u4E8E Rust \u7684\u9AD8\u6027\u80FD Claude Code \u72B6\u6001\u680F\u5DE5\u5177\uFF0C\u96C6\u6210 Git \u4FE1\u606F\u548C\u5B9E\u65F6\u4F7F\u7528\u91CF\u8DDF\u8E2A",
|
|
474
|
+
cometixMenuOptions: {
|
|
475
|
+
installOrUpdate: "\u5B89\u88C5\u6216\u66F4\u65B0",
|
|
476
|
+
printConfig: "\u6253\u5370\u9ED8\u8BA4\u914D\u7F6E",
|
|
477
|
+
back: "\u8FD4\u56DE\u4E3B\u83DC\u5355"
|
|
478
|
+
},
|
|
479
|
+
cometixMenuDescriptions: {
|
|
480
|
+
installOrUpdate: "\u4F7F\u7528 npm \u5B89\u88C5\u6216\u66F4\u65B0 CCometixLine",
|
|
481
|
+
printConfig: "\u663E\u793A\u5F53\u524D CCometixLine \u914D\u7F6E"
|
|
482
|
+
}
|
|
483
|
+
};
|
|
484
|
+
|
|
453
485
|
const updater$1 = {
|
|
454
486
|
checkingVersion: "\u6B63\u5728\u68C0\u67E5\u7248\u672C...",
|
|
455
487
|
checkingTools: "\u68C0\u67E5\u5DE5\u5177\u7248\u672C",
|
|
@@ -457,6 +489,8 @@ const updater$1 = {
|
|
|
457
489
|
ccrUpToDate: "CCR \u5DF2\u662F\u6700\u65B0\u7248\u672C (v{version})",
|
|
458
490
|
claudeCodeNotInstalled: "Claude Code \u672A\u5B89\u88C5",
|
|
459
491
|
claudeCodeUpToDate: "Claude Code \u5DF2\u662F\u6700\u65B0\u7248\u672C (v{version})",
|
|
492
|
+
cometixLineNotInstalled: "CCometixLine \u672A\u5B89\u88C5",
|
|
493
|
+
cometixLineUpToDate: "CCometixLine \u5DF2\u662F\u6700\u65B0\u7248\u672C (v{version})",
|
|
460
494
|
cannotCheckVersion: "\u65E0\u6CD5\u68C0\u67E5\u6700\u65B0\u7248\u672C",
|
|
461
495
|
currentVersion: "\u5F53\u524D\u7248\u672C: v{version}",
|
|
462
496
|
latestVersion: "\u6700\u65B0\u7248\u672C: v{version}",
|
|
@@ -482,6 +516,7 @@ const zhCN = {
|
|
|
482
516
|
errors: errors$1,
|
|
483
517
|
tools: tools$1,
|
|
484
518
|
ccr: ccrMessages$1,
|
|
519
|
+
cometix: cometixMessages$1,
|
|
485
520
|
updater: updater$1
|
|
486
521
|
};
|
|
487
522
|
|
|
@@ -680,6 +715,7 @@ const menu = {
|
|
|
680
715
|
configureCcr: "Configure Model Proxy (CCR)",
|
|
681
716
|
ccrManagement: "CCR",
|
|
682
717
|
ccusage: "ccusage",
|
|
718
|
+
cometixLine: "CCometixLine",
|
|
683
719
|
installBmad: "Install BMad Method",
|
|
684
720
|
clearCache: "Clear preference cache",
|
|
685
721
|
checkUpdates: "Check updates",
|
|
@@ -698,9 +734,10 @@ const menu = {
|
|
|
698
734
|
configureCcr: "Configure Claude Code Router to use multiple AI models",
|
|
699
735
|
ccrManagement: "Configure Claude Code Router to use multiple AI models",
|
|
700
736
|
ccusage: "Claude Code usage analysis",
|
|
737
|
+
cometixLine: "High-performance Claude Code statusline tool with Git integration and real-time usage tracking",
|
|
701
738
|
installBmad: "AI-driven development methodology framework",
|
|
702
739
|
clearCache: "Clear preference language and other caches",
|
|
703
|
-
checkUpdates: "Check and update Claude Code and
|
|
740
|
+
checkUpdates: "Check and update Claude Code, CCR and CCometixLine versions",
|
|
704
741
|
changeLanguage: "Change ZCF interface language"
|
|
705
742
|
}
|
|
706
743
|
};
|
|
@@ -917,6 +954,36 @@ const ccrMessages = {
|
|
|
917
954
|
ccrUiApiKeyHint: "Use this API key to login to CCR UI"
|
|
918
955
|
};
|
|
919
956
|
|
|
957
|
+
const cometixMessages = {
|
|
958
|
+
// Installation
|
|
959
|
+
installingCometix: "Installing CCometixLine...",
|
|
960
|
+
cometixInstallSuccess: "CCometixLine installed successfully",
|
|
961
|
+
cometixInstallFailed: "Failed to install CCometixLine",
|
|
962
|
+
cometixAlreadyInstalled: "CCometixLine is already installed",
|
|
963
|
+
// Installation prompt in init
|
|
964
|
+
installCometixPrompt: "Install CCometixLine - High-performance Claude Code statusline tool with Git integration and real-time usage tracking?",
|
|
965
|
+
cometixSkipped: "CCometixLine installation skipped",
|
|
966
|
+
// Commands
|
|
967
|
+
installingOrUpdating: "Installing/updating CCometixLine...",
|
|
968
|
+
installUpdateSuccess: "CCometixLine install/update completed",
|
|
969
|
+
installUpdateFailed: "Failed to install/update CCometixLine",
|
|
970
|
+
printingConfig: "Printing CCometixLine configuration...",
|
|
971
|
+
printConfigSuccess: "Configuration printed successfully",
|
|
972
|
+
printConfigFailed: "Failed to print configuration",
|
|
973
|
+
commandNotFound: "ccline command not found. Please install CCometixLine first.",
|
|
974
|
+
// CCometixLine Menu
|
|
975
|
+
cometixMenuTitle: "CCometixLine - High-performance Claude Code statusline tool with Git integration and real-time usage tracking",
|
|
976
|
+
cometixMenuOptions: {
|
|
977
|
+
installOrUpdate: "Install or Update",
|
|
978
|
+
printConfig: "Print Default Configuration",
|
|
979
|
+
back: "Back to Main Menu"
|
|
980
|
+
},
|
|
981
|
+
cometixMenuDescriptions: {
|
|
982
|
+
installOrUpdate: "Install or update CCometixLine using npm",
|
|
983
|
+
printConfig: "Display current CCometixLine configuration"
|
|
984
|
+
}
|
|
985
|
+
};
|
|
986
|
+
|
|
920
987
|
const updater = {
|
|
921
988
|
checkingVersion: "Checking version...",
|
|
922
989
|
checkingTools: "Checking tool versions",
|
|
@@ -924,6 +991,8 @@ const updater = {
|
|
|
924
991
|
ccrUpToDate: "CCR is up to date (v{version})",
|
|
925
992
|
claudeCodeNotInstalled: "Claude Code is not installed",
|
|
926
993
|
claudeCodeUpToDate: "Claude Code is up to date (v{version})",
|
|
994
|
+
cometixLineNotInstalled: "CCometixLine is not installed",
|
|
995
|
+
cometixLineUpToDate: "CCometixLine is up to date (v{version})",
|
|
927
996
|
cannotCheckVersion: "Cannot check latest version",
|
|
928
997
|
currentVersion: "Current version: v{version}",
|
|
929
998
|
latestVersion: "Latest version: v{version}",
|
|
@@ -949,6 +1018,7 @@ const en = {
|
|
|
949
1018
|
errors,
|
|
950
1019
|
tools,
|
|
951
1020
|
ccr: ccrMessages,
|
|
1021
|
+
cometix: cometixMessages,
|
|
952
1022
|
updater
|
|
953
1023
|
};
|
|
954
1024
|
|
|
@@ -2047,15 +2117,15 @@ function format(template, replacements) {
|
|
|
2047
2117
|
});
|
|
2048
2118
|
}
|
|
2049
2119
|
|
|
2050
|
-
const execAsync$
|
|
2120
|
+
const execAsync$4 = promisify(exec$1);
|
|
2051
2121
|
async function getInstalledVersion(command) {
|
|
2052
2122
|
try {
|
|
2053
2123
|
let stdout;
|
|
2054
2124
|
try {
|
|
2055
|
-
const result = await execAsync$
|
|
2125
|
+
const result = await execAsync$4(`${command} -v`);
|
|
2056
2126
|
stdout = result.stdout;
|
|
2057
2127
|
} catch {
|
|
2058
|
-
const result = await execAsync$
|
|
2128
|
+
const result = await execAsync$4(`${command} --version`);
|
|
2059
2129
|
stdout = result.stdout;
|
|
2060
2130
|
}
|
|
2061
2131
|
const versionMatch = stdout.match(/(\d+\.\d+\.\d+(?:-[\w.]+)?)/);
|
|
@@ -2066,7 +2136,7 @@ async function getInstalledVersion(command) {
|
|
|
2066
2136
|
}
|
|
2067
2137
|
async function getLatestVersion(packageName) {
|
|
2068
2138
|
try {
|
|
2069
|
-
const { stdout } = await execAsync$
|
|
2139
|
+
const { stdout } = await execAsync$4(`npm view ${packageName} version`);
|
|
2070
2140
|
return stdout.trim();
|
|
2071
2141
|
} catch {
|
|
2072
2142
|
return null;
|
|
@@ -2101,8 +2171,18 @@ async function checkClaudeCodeVersion() {
|
|
|
2101
2171
|
needsUpdate: currentVersion && latestVersion ? shouldUpdate(currentVersion, latestVersion) : false
|
|
2102
2172
|
};
|
|
2103
2173
|
}
|
|
2174
|
+
async function checkCometixLineVersion() {
|
|
2175
|
+
const currentVersion = await getInstalledVersion("ccometix");
|
|
2176
|
+
const latestVersion = await getLatestVersion("ccometix");
|
|
2177
|
+
return {
|
|
2178
|
+
installed: currentVersion !== null,
|
|
2179
|
+
currentVersion,
|
|
2180
|
+
latestVersion,
|
|
2181
|
+
needsUpdate: currentVersion && latestVersion ? shouldUpdate(currentVersion, latestVersion) : false
|
|
2182
|
+
};
|
|
2183
|
+
}
|
|
2104
2184
|
|
|
2105
|
-
const execAsync$
|
|
2185
|
+
const execAsync$3 = promisify(exec$1);
|
|
2106
2186
|
async function updateCcr(scriptLang, force = false) {
|
|
2107
2187
|
const i18n = getTranslation(scriptLang);
|
|
2108
2188
|
const spinner = ora(i18n.updater.checkingVersion).start();
|
|
@@ -2135,7 +2215,7 @@ async function updateCcr(scriptLang, force = false) {
|
|
|
2135
2215
|
}
|
|
2136
2216
|
const updateSpinner = ora(format(i18n.updater.updating, { tool: "CCR" })).start();
|
|
2137
2217
|
try {
|
|
2138
|
-
await execAsync$
|
|
2218
|
+
await execAsync$3("npm update -g @musistudio/claude-code-router");
|
|
2139
2219
|
updateSpinner.succeed(format(i18n.updater.updateSuccess, { tool: "CCR" }));
|
|
2140
2220
|
return true;
|
|
2141
2221
|
} catch (error) {
|
|
@@ -2181,7 +2261,7 @@ async function updateClaudeCode(scriptLang, force = false) {
|
|
|
2181
2261
|
}
|
|
2182
2262
|
const updateSpinner = ora(format(i18n.updater.updating, { tool: "Claude Code" })).start();
|
|
2183
2263
|
try {
|
|
2184
|
-
await execAsync$
|
|
2264
|
+
await execAsync$3("npm update -g @anthropic-ai/claude-code");
|
|
2185
2265
|
updateSpinner.succeed(format(i18n.updater.updateSuccess, { tool: "Claude Code" }));
|
|
2186
2266
|
return true;
|
|
2187
2267
|
} catch (error) {
|
|
@@ -2195,6 +2275,52 @@ async function updateClaudeCode(scriptLang, force = false) {
|
|
|
2195
2275
|
return false;
|
|
2196
2276
|
}
|
|
2197
2277
|
}
|
|
2278
|
+
async function updateCometixLine(scriptLang, force = false) {
|
|
2279
|
+
const i18n = getTranslation(scriptLang);
|
|
2280
|
+
const spinner = ora(i18n.updater.checkingVersion).start();
|
|
2281
|
+
try {
|
|
2282
|
+
const { installed, currentVersion, latestVersion, needsUpdate } = await checkCometixLineVersion();
|
|
2283
|
+
spinner.stop();
|
|
2284
|
+
if (!installed) {
|
|
2285
|
+
console.log(ansis.yellow(i18n.updater.cometixLineNotInstalled));
|
|
2286
|
+
return false;
|
|
2287
|
+
}
|
|
2288
|
+
if (!needsUpdate && !force) {
|
|
2289
|
+
console.log(ansis.green(format(i18n.updater.cometixLineUpToDate, { version: currentVersion || "" })));
|
|
2290
|
+
return true;
|
|
2291
|
+
}
|
|
2292
|
+
if (!latestVersion) {
|
|
2293
|
+
console.log(ansis.yellow(i18n.updater.cannotCheckVersion));
|
|
2294
|
+
return false;
|
|
2295
|
+
}
|
|
2296
|
+
console.log(ansis.cyan(format(i18n.updater.currentVersion, { version: currentVersion || "" })));
|
|
2297
|
+
console.log(ansis.cyan(format(i18n.updater.latestVersion, { version: latestVersion })));
|
|
2298
|
+
const { confirm } = await inquirer.prompt({
|
|
2299
|
+
type: "confirm",
|
|
2300
|
+
name: "confirm",
|
|
2301
|
+
message: format(i18n.updater.confirmUpdate, { tool: "CCometixLine" }),
|
|
2302
|
+
default: true
|
|
2303
|
+
});
|
|
2304
|
+
if (!confirm) {
|
|
2305
|
+
console.log(ansis.gray(i18n.updater.updateSkipped));
|
|
2306
|
+
return true;
|
|
2307
|
+
}
|
|
2308
|
+
const updateSpinner = ora(format(i18n.updater.updating, { tool: "CCometixLine" })).start();
|
|
2309
|
+
try {
|
|
2310
|
+
await execAsync$3("cargo install ccometix");
|
|
2311
|
+
updateSpinner.succeed(format(i18n.updater.updateSuccess, { tool: "CCometixLine" }));
|
|
2312
|
+
return true;
|
|
2313
|
+
} catch (error) {
|
|
2314
|
+
updateSpinner.fail(format(i18n.updater.updateFailed, { tool: "CCometixLine" }));
|
|
2315
|
+
console.error(ansis.red(error instanceof Error ? error.message : String(error)));
|
|
2316
|
+
return false;
|
|
2317
|
+
}
|
|
2318
|
+
} catch (error) {
|
|
2319
|
+
spinner.fail(i18n.updater.checkFailed);
|
|
2320
|
+
console.error(ansis.red(error instanceof Error ? error.message : String(error)));
|
|
2321
|
+
return false;
|
|
2322
|
+
}
|
|
2323
|
+
}
|
|
2198
2324
|
async function checkAndUpdateTools(scriptLang) {
|
|
2199
2325
|
const i18n = getTranslation(scriptLang);
|
|
2200
2326
|
console.log(ansis.bold.cyan(`
|
|
@@ -2203,6 +2329,8 @@ async function checkAndUpdateTools(scriptLang) {
|
|
|
2203
2329
|
await updateCcr(scriptLang);
|
|
2204
2330
|
console.log();
|
|
2205
2331
|
await updateClaudeCode(scriptLang);
|
|
2332
|
+
console.log();
|
|
2333
|
+
await updateCometixLine(scriptLang);
|
|
2206
2334
|
}
|
|
2207
2335
|
|
|
2208
2336
|
async function isClaudeCodeInstalled() {
|
|
@@ -2547,15 +2675,15 @@ async function cleanupOldVersionFiles(scriptLang) {
|
|
|
2547
2675
|
}
|
|
2548
2676
|
}
|
|
2549
2677
|
|
|
2550
|
-
const execAsync$
|
|
2678
|
+
const execAsync$2 = promisify$1(exec$2);
|
|
2551
2679
|
async function isCcrInstalled() {
|
|
2552
2680
|
let commandExists = false;
|
|
2553
2681
|
try {
|
|
2554
|
-
await execAsync$
|
|
2682
|
+
await execAsync$2("ccr version");
|
|
2555
2683
|
commandExists = true;
|
|
2556
2684
|
} catch {
|
|
2557
2685
|
try {
|
|
2558
|
-
await execAsync$
|
|
2686
|
+
await execAsync$2("which ccr");
|
|
2559
2687
|
commandExists = true;
|
|
2560
2688
|
} catch {
|
|
2561
2689
|
commandExists = false;
|
|
@@ -2563,7 +2691,7 @@ async function isCcrInstalled() {
|
|
|
2563
2691
|
}
|
|
2564
2692
|
let hasCorrectPackage = false;
|
|
2565
2693
|
try {
|
|
2566
|
-
await execAsync$
|
|
2694
|
+
await execAsync$2("npm list -g @musistudio/claude-code-router");
|
|
2567
2695
|
hasCorrectPackage = true;
|
|
2568
2696
|
} catch {
|
|
2569
2697
|
hasCorrectPackage = false;
|
|
@@ -2583,10 +2711,10 @@ async function installCcr(scriptLang) {
|
|
|
2583
2711
|
}
|
|
2584
2712
|
if (isInstalled && !hasCorrectPackage) {
|
|
2585
2713
|
try {
|
|
2586
|
-
await execAsync$
|
|
2714
|
+
await execAsync$2("npm list -g claude-code-router");
|
|
2587
2715
|
console.log(ansis.yellow(`\u26A0 ${i18n.ccr.detectedIncorrectPackage}`));
|
|
2588
2716
|
try {
|
|
2589
|
-
await execAsync$
|
|
2717
|
+
await execAsync$2("npm uninstall -g claude-code-router");
|
|
2590
2718
|
console.log(ansis.green(`\u2714 ${i18n.ccr.uninstalledIncorrectPackage}`));
|
|
2591
2719
|
} catch (uninstallError) {
|
|
2592
2720
|
console.log(ansis.yellow(`\u26A0 ${i18n.ccr.failedToUninstallIncorrectPackage}`));
|
|
@@ -2596,7 +2724,7 @@ async function installCcr(scriptLang) {
|
|
|
2596
2724
|
}
|
|
2597
2725
|
console.log(ansis.cyan(`\u{1F4E6} ${i18n.ccr.installingCcr}`));
|
|
2598
2726
|
try {
|
|
2599
|
-
await execAsync$
|
|
2727
|
+
await execAsync$2("npm install -g @musistudio/claude-code-router --force");
|
|
2600
2728
|
console.log(ansis.green(`\u2714 ${i18n.ccr.ccrInstallSuccess}`));
|
|
2601
2729
|
} catch (error) {
|
|
2602
2730
|
if (error.message?.includes("EEXIST")) {
|
|
@@ -2757,7 +2885,7 @@ function getFallbackPresets() {
|
|
|
2757
2885
|
];
|
|
2758
2886
|
}
|
|
2759
2887
|
|
|
2760
|
-
const execAsync = promisify$1(exec$2);
|
|
2888
|
+
const execAsync$1 = promisify$1(exec$2);
|
|
2761
2889
|
const CCR_CONFIG_DIR = join$1(homedir(), ".claude-code-router");
|
|
2762
2890
|
const CCR_CONFIG_FILE = join$1(CCR_CONFIG_DIR, "config.json");
|
|
2763
2891
|
const CCR_BACKUP_DIR = CCR_CONFIG_DIR;
|
|
@@ -2917,10 +3045,10 @@ async function restartAndCheckCcrStatus(scriptLang) {
|
|
|
2917
3045
|
const i18n = getTranslation(scriptLang);
|
|
2918
3046
|
try {
|
|
2919
3047
|
console.log(ansis.cyan(`${i18n.ccr.restartingCcr}`));
|
|
2920
|
-
await execAsync("ccr restart");
|
|
3048
|
+
await execAsync$1("ccr restart");
|
|
2921
3049
|
console.log(ansis.green(`\u2714 ${i18n.ccr.ccrRestartSuccess}`));
|
|
2922
3050
|
console.log(ansis.cyan(`${i18n.ccr.checkingCcrStatus}`));
|
|
2923
|
-
const { stdout } = await execAsync("ccr status");
|
|
3051
|
+
const { stdout } = await execAsync$1("ccr status");
|
|
2924
3052
|
console.log(ansis.gray(stdout));
|
|
2925
3053
|
} catch (error) {
|
|
2926
3054
|
console.error(ansis.red(`${i18n.ccr.ccrRestartFailed}:`), error.message || error);
|
|
@@ -3026,6 +3154,41 @@ async function configureCcrFeature(scriptLang) {
|
|
|
3026
3154
|
await setupCcrConfiguration(scriptLang);
|
|
3027
3155
|
}
|
|
3028
3156
|
|
|
3157
|
+
const COMETIX_PACKAGE_NAME = "@cometix/ccline";
|
|
3158
|
+
const COMETIX_COMMAND_NAME = "ccline";
|
|
3159
|
+
const COMETIX_COMMANDS = {
|
|
3160
|
+
CHECK_INSTALL: `npm list -g ${COMETIX_PACKAGE_NAME}`,
|
|
3161
|
+
INSTALL: `npm install -g ${COMETIX_PACKAGE_NAME}`,
|
|
3162
|
+
UPDATE: `npm update -g ${COMETIX_PACKAGE_NAME}`,
|
|
3163
|
+
PRINT_CONFIG: `${COMETIX_COMMAND_NAME} --print`
|
|
3164
|
+
};
|
|
3165
|
+
|
|
3166
|
+
const execAsync = promisify$1(exec$2);
|
|
3167
|
+
async function isCometixLineInstalled() {
|
|
3168
|
+
try {
|
|
3169
|
+
await execAsync(COMETIX_COMMANDS.CHECK_INSTALL);
|
|
3170
|
+
return true;
|
|
3171
|
+
} catch {
|
|
3172
|
+
return false;
|
|
3173
|
+
}
|
|
3174
|
+
}
|
|
3175
|
+
async function installCometixLine(scriptLang) {
|
|
3176
|
+
const i18n = getTranslation(scriptLang);
|
|
3177
|
+
const isInstalled = await isCometixLineInstalled();
|
|
3178
|
+
if (isInstalled) {
|
|
3179
|
+
console.log(ansis.green(`\u2714 ${i18n.cometix.cometixAlreadyInstalled}`));
|
|
3180
|
+
return;
|
|
3181
|
+
}
|
|
3182
|
+
try {
|
|
3183
|
+
console.log(ansis.blue(`${i18n.cometix.installingCometix}`));
|
|
3184
|
+
await execAsync(COMETIX_COMMANDS.INSTALL);
|
|
3185
|
+
console.log(ansis.green(`\u2714 ${i18n.cometix.cometixInstallSuccess}`));
|
|
3186
|
+
} catch (error) {
|
|
3187
|
+
console.error(ansis.red(`\u2717 ${i18n.cometix.cometixInstallFailed}: ${error}`));
|
|
3188
|
+
throw error;
|
|
3189
|
+
}
|
|
3190
|
+
}
|
|
3191
|
+
|
|
3029
3192
|
async function init(options = {}) {
|
|
3030
3193
|
try {
|
|
3031
3194
|
if (!options.skipBanner) {
|
|
@@ -3289,6 +3452,26 @@ async function init(options = {}) {
|
|
|
3289
3452
|
}
|
|
3290
3453
|
}
|
|
3291
3454
|
}
|
|
3455
|
+
const cometixInstalled = await isCometixLineInstalled();
|
|
3456
|
+
if (!cometixInstalled) {
|
|
3457
|
+
const { shouldInstallCometix } = await inquirer.prompt({
|
|
3458
|
+
type: "confirm",
|
|
3459
|
+
name: "shouldInstallCometix",
|
|
3460
|
+
message: i18n.cometix.installCometixPrompt,
|
|
3461
|
+
default: true
|
|
3462
|
+
});
|
|
3463
|
+
if (shouldInstallCometix === void 0) {
|
|
3464
|
+
console.log(ansis.yellow(i18n.common.cancelled));
|
|
3465
|
+
process.exit(0);
|
|
3466
|
+
}
|
|
3467
|
+
if (shouldInstallCometix) {
|
|
3468
|
+
await installCometixLine(scriptLang);
|
|
3469
|
+
} else {
|
|
3470
|
+
console.log(ansis.yellow(i18n.cometix.cometixSkipped));
|
|
3471
|
+
}
|
|
3472
|
+
} else {
|
|
3473
|
+
console.log(ansis.green(`\u2714 ${i18n.cometix.cometixAlreadyInstalled}`));
|
|
3474
|
+
}
|
|
3292
3475
|
updateZcfConfig({
|
|
3293
3476
|
version,
|
|
3294
3477
|
preferredLang: scriptLang,
|
|
@@ -3381,4 +3564,4 @@ async function openSettingsJson() {
|
|
|
3381
3564
|
}
|
|
3382
3565
|
}
|
|
3383
3566
|
|
|
3384
|
-
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,
|
|
3567
|
+
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, COMETIX_COMMANDS as a3, COMETIX_COMMAND_NAME as a4, displayBanner as a5, selectScriptLanguage as a6, resolveAiOutputLanguage as a7, updatePromptOnly as a8, selectAndInstallWorkflows as a9, version as aa, checkAndUpdateTools as ab, displayBannerWithInfo as ac, prompts as ad, 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
|
|
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 COMETIX_COMMANDS, a4 as COMETIX_COMMAND_NAME, a5 as displayBanner, a6 as selectScriptLanguage, a7 as resolveAiOutputLanguage, a8 as updatePromptOnly, a9 as selectAndInstallWorkflows, aa as version, ab as checkAndUpdateTools, ac 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';
|
|
@@ -9,14 +9,14 @@ import { homedir } from 'node:os';
|
|
|
9
9
|
import { join } from 'node:path';
|
|
10
10
|
import { exec } from 'child_process';
|
|
11
11
|
import { promisify } from 'util';
|
|
12
|
+
import { exec as exec$1 } from 'node:child_process';
|
|
13
|
+
import { promisify as promisify$1 } from 'node:util';
|
|
12
14
|
import 'pathe';
|
|
13
15
|
import 'dayjs';
|
|
14
16
|
import 'node:url';
|
|
15
17
|
import 'ora';
|
|
16
18
|
import 'semver';
|
|
17
19
|
import 'node:fs/promises';
|
|
18
|
-
import 'node:child_process';
|
|
19
|
-
import 'node:util';
|
|
20
20
|
|
|
21
21
|
function handleCancellation(scriptLang) {
|
|
22
22
|
const i18n = getTranslation(scriptLang);
|
|
@@ -294,7 +294,7 @@ async function configureAiMemoryFeature(scriptLang) {
|
|
|
294
294
|
return;
|
|
295
295
|
}
|
|
296
296
|
}
|
|
297
|
-
const { selectAiOutputLanguage } = await import('./chunks/simple-config.mjs').then(function (n) { return n.
|
|
297
|
+
const { selectAiOutputLanguage } = await import('./chunks/simple-config.mjs').then(function (n) { return n.ad; });
|
|
298
298
|
const aiOutputLang = await selectAiOutputLanguage(scriptLang, scriptLang);
|
|
299
299
|
applyAiLanguageDirective(aiOutputLang);
|
|
300
300
|
updateZcfConfig({ aiOutputLang });
|
|
@@ -438,7 +438,7 @@ async function executeCcusage(args = []) {
|
|
|
438
438
|
}
|
|
439
439
|
}
|
|
440
440
|
|
|
441
|
-
const execAsync = promisify(exec);
|
|
441
|
+
const execAsync$1 = promisify(exec);
|
|
442
442
|
async function runCcrUi(scriptLang, apiKey) {
|
|
443
443
|
const i18n = I18N[scriptLang];
|
|
444
444
|
console.log(ansis.cyan(`
|
|
@@ -450,7 +450,7 @@ async function runCcrUi(scriptLang, apiKey) {
|
|
|
450
450
|
`));
|
|
451
451
|
}
|
|
452
452
|
try {
|
|
453
|
-
const { stdout, stderr } = await execAsync("ccr ui");
|
|
453
|
+
const { stdout, stderr } = await execAsync$1("ccr ui");
|
|
454
454
|
if (stdout) console.log(stdout);
|
|
455
455
|
if (stderr) console.error(ansis.yellow(stderr));
|
|
456
456
|
console.log(ansis.green(`\u2714 ${i18n.ccr.ccrUiStarted}`));
|
|
@@ -464,7 +464,7 @@ async function runCcrStatus(scriptLang) {
|
|
|
464
464
|
console.log(ansis.cyan(`
|
|
465
465
|
\u{1F4CA} ${i18n.ccr.checkingCcrStatus}`));
|
|
466
466
|
try {
|
|
467
|
-
const { stdout, stderr } = await execAsync("ccr status");
|
|
467
|
+
const { stdout, stderr } = await execAsync$1("ccr status");
|
|
468
468
|
if (stdout) {
|
|
469
469
|
console.log("\n" + ansis.bold(i18n.ccr.ccrStatusTitle));
|
|
470
470
|
console.log(stdout);
|
|
@@ -480,7 +480,7 @@ async function runCcrRestart(scriptLang) {
|
|
|
480
480
|
console.log(ansis.cyan(`
|
|
481
481
|
\u{1F504} ${i18n.ccr.restartingCcr}`));
|
|
482
482
|
try {
|
|
483
|
-
const { stdout, stderr } = await execAsync("ccr restart");
|
|
483
|
+
const { stdout, stderr } = await execAsync$1("ccr restart");
|
|
484
484
|
if (stdout) console.log(stdout);
|
|
485
485
|
if (stderr) console.error(ansis.yellow(stderr));
|
|
486
486
|
console.log(ansis.green(`\u2714 ${i18n.ccr.ccrRestarted}`));
|
|
@@ -494,7 +494,7 @@ async function runCcrStart(scriptLang) {
|
|
|
494
494
|
console.log(ansis.cyan(`
|
|
495
495
|
\u25B6\uFE0F ${i18n.ccr.startingCcr}`));
|
|
496
496
|
try {
|
|
497
|
-
const { stdout, stderr } = await execAsync("ccr start");
|
|
497
|
+
const { stdout, stderr } = await execAsync$1("ccr start");
|
|
498
498
|
if (stdout) console.log(stdout);
|
|
499
499
|
if (stderr) console.error(ansis.yellow(stderr));
|
|
500
500
|
console.log(ansis.green(`\u2714 ${i18n.ccr.ccrStarted}`));
|
|
@@ -514,7 +514,7 @@ async function runCcrStop(scriptLang) {
|
|
|
514
514
|
console.log(ansis.cyan(`
|
|
515
515
|
\u23F9\uFE0F ${i18n.ccr.stoppingCcr}`));
|
|
516
516
|
try {
|
|
517
|
-
const { stdout, stderr } = await execAsync("ccr stop");
|
|
517
|
+
const { stdout, stderr } = await execAsync$1("ccr stop");
|
|
518
518
|
if (stdout) console.log(stdout);
|
|
519
519
|
if (stderr) console.error(ansis.yellow(stderr));
|
|
520
520
|
console.log(ansis.green(`\u2714 ${i18n.ccr.ccrStopped}`));
|
|
@@ -642,6 +642,84 @@ async function showCcrMenu(scriptLang) {
|
|
|
642
642
|
}
|
|
643
643
|
}
|
|
644
644
|
|
|
645
|
+
const execAsync = promisify$1(exec$1);
|
|
646
|
+
async function runCometixInstallOrUpdate(scriptLang) {
|
|
647
|
+
const i18n = getTranslation(scriptLang);
|
|
648
|
+
try {
|
|
649
|
+
console.log(ansis.blue(`${i18n.cometix.installingOrUpdating}`));
|
|
650
|
+
await execAsync(COMETIX_COMMANDS.INSTALL);
|
|
651
|
+
console.log(ansis.green(`\u2714 ${i18n.cometix.installUpdateSuccess}`));
|
|
652
|
+
} catch (error) {
|
|
653
|
+
console.error(ansis.red(`\u2717 ${i18n.cometix.installUpdateFailed}: ${error}`));
|
|
654
|
+
throw error;
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
async function runCometixPrintConfig(scriptLang) {
|
|
658
|
+
const i18n = getTranslation(scriptLang);
|
|
659
|
+
try {
|
|
660
|
+
console.log(ansis.blue(`${i18n.cometix.printingConfig}`));
|
|
661
|
+
const { stdout } = await execAsync(COMETIX_COMMANDS.PRINT_CONFIG);
|
|
662
|
+
console.log(stdout);
|
|
663
|
+
} catch (error) {
|
|
664
|
+
if (error.message.includes(`command not found: ${COMETIX_COMMAND_NAME}`)) {
|
|
665
|
+
console.error(ansis.red(`\u2717 ${i18n.cometix.commandNotFound}`));
|
|
666
|
+
} else {
|
|
667
|
+
console.error(ansis.red(`\u2717 ${i18n.cometix.printConfigFailed}: ${error}`));
|
|
668
|
+
}
|
|
669
|
+
throw error;
|
|
670
|
+
}
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
async function showCometixMenu(scriptLang) {
|
|
674
|
+
try {
|
|
675
|
+
const i18n = getTranslation(scriptLang);
|
|
676
|
+
console.log("\n" + ansis.cyan("\u2550".repeat(50)));
|
|
677
|
+
console.log(ansis.bold.cyan(` ${i18n.cometix.cometixMenuTitle}`));
|
|
678
|
+
console.log(ansis.cyan("\u2550".repeat(50)) + "\n");
|
|
679
|
+
console.log(` ${ansis.cyan("1.")} ${i18n.cometix.cometixMenuOptions.installOrUpdate} ${ansis.gray("- " + i18n.cometix.cometixMenuDescriptions.installOrUpdate)}`);
|
|
680
|
+
console.log(` ${ansis.cyan("2.")} ${i18n.cometix.cometixMenuOptions.printConfig} ${ansis.gray("- " + i18n.cometix.cometixMenuDescriptions.printConfig)}`);
|
|
681
|
+
console.log(` ${ansis.yellow("0.")} ${i18n.cometix.cometixMenuOptions.back}`);
|
|
682
|
+
console.log("");
|
|
683
|
+
const { choice } = await inquirer.prompt({
|
|
684
|
+
type: "input",
|
|
685
|
+
name: "choice",
|
|
686
|
+
message: i18n.common.enterChoice,
|
|
687
|
+
validate: (value) => {
|
|
688
|
+
const valid = ["1", "2", "0"];
|
|
689
|
+
return valid.includes(value) || i18n.common.invalidChoice;
|
|
690
|
+
}
|
|
691
|
+
});
|
|
692
|
+
switch (choice) {
|
|
693
|
+
case "1":
|
|
694
|
+
await runCometixInstallOrUpdate(scriptLang);
|
|
695
|
+
break;
|
|
696
|
+
case "2":
|
|
697
|
+
await runCometixPrintConfig(scriptLang);
|
|
698
|
+
break;
|
|
699
|
+
case "0":
|
|
700
|
+
return false;
|
|
701
|
+
}
|
|
702
|
+
if (choice !== "0") {
|
|
703
|
+
console.log("\n" + ansis.dim("\u2500".repeat(50)) + "\n");
|
|
704
|
+
const { continueInCometix } = await inquirer.prompt({
|
|
705
|
+
type: "confirm",
|
|
706
|
+
name: "continueInCometix",
|
|
707
|
+
message: i18n.common.returnToMenu,
|
|
708
|
+
default: true
|
|
709
|
+
});
|
|
710
|
+
if (continueInCometix) {
|
|
711
|
+
return await showCometixMenu(scriptLang);
|
|
712
|
+
}
|
|
713
|
+
}
|
|
714
|
+
return false;
|
|
715
|
+
} catch (error) {
|
|
716
|
+
if (!handleExitPromptError(error)) {
|
|
717
|
+
handleGeneralError(error, scriptLang);
|
|
718
|
+
}
|
|
719
|
+
return false;
|
|
720
|
+
}
|
|
721
|
+
}
|
|
722
|
+
|
|
645
723
|
function getValidLanguage(lang) {
|
|
646
724
|
return lang && lang in I18N ? lang : "en";
|
|
647
725
|
}
|
|
@@ -712,6 +790,10 @@ async function runCcrMenuFeature(scriptLang) {
|
|
|
712
790
|
const validLang = getValidLanguage(scriptLang);
|
|
713
791
|
await showCcrMenu(validLang);
|
|
714
792
|
}
|
|
793
|
+
async function runCometixMenuFeature(scriptLang) {
|
|
794
|
+
const validLang = getValidLanguage(scriptLang);
|
|
795
|
+
await showCometixMenu(validLang);
|
|
796
|
+
}
|
|
715
797
|
|
|
716
798
|
async function update(options = {}) {
|
|
717
799
|
try {
|
|
@@ -817,6 +899,9 @@ async function showMainMenu() {
|
|
|
817
899
|
console.log(
|
|
818
900
|
` ${ansis.cyan("U.")} ${i18n.menu.menuOptions.ccusage} ${ansis.gray("- " + i18n.menu.menuDescriptions.ccusage)}`
|
|
819
901
|
);
|
|
902
|
+
console.log(
|
|
903
|
+
` ${ansis.cyan("L.")} ${i18n.menu.menuOptions.cometixLine} ${ansis.gray("- " + i18n.menu.menuDescriptions.cometixLine)}`
|
|
904
|
+
);
|
|
820
905
|
console.log("");
|
|
821
906
|
console.log(" ------------ ZCF ------------");
|
|
822
907
|
console.log(
|
|
@@ -837,7 +922,7 @@ async function showMainMenu() {
|
|
|
837
922
|
name: "choice",
|
|
838
923
|
message: i18n.common.enterChoice,
|
|
839
924
|
validate: (value) => {
|
|
840
|
-
const valid = ["1", "2", "3", "4", "5", "6", "7", "r", "R", "u", "U", "0", "-", "+", "q", "Q"];
|
|
925
|
+
const valid = ["1", "2", "3", "4", "5", "6", "7", "r", "R", "u", "U", "l", "L", "0", "-", "+", "q", "Q"];
|
|
841
926
|
return valid.includes(value) || i18n.common.invalidChoice;
|
|
842
927
|
}
|
|
843
928
|
});
|
|
@@ -876,6 +961,10 @@ async function showMainMenu() {
|
|
|
876
961
|
case "U":
|
|
877
962
|
await runCcusageFeature(scriptLang);
|
|
878
963
|
break;
|
|
964
|
+
case "l":
|
|
965
|
+
case "L":
|
|
966
|
+
await runCometixMenuFeature(scriptLang);
|
|
967
|
+
break;
|
|
879
968
|
case "0":
|
|
880
969
|
const newLang = await changeScriptLanguageFeature(scriptLang);
|
|
881
970
|
if (newLang !== scriptLang) {
|
|
@@ -894,7 +983,7 @@ async function showMainMenu() {
|
|
|
894
983
|
break;
|
|
895
984
|
}
|
|
896
985
|
if (!exitMenu && choice.toLowerCase() !== "q") {
|
|
897
|
-
if (choice === "0" || choice === "-" || choice === "+" || choice.toLowerCase() === "u" || choice.toLowerCase() === "r") {
|
|
986
|
+
if (choice === "0" || choice === "-" || choice === "+" || choice.toLowerCase() === "u" || choice.toLowerCase() === "r" || choice.toLowerCase() === "l") {
|
|
898
987
|
console.log("\n" + ansis.dim("\u2500".repeat(50)) + "\n");
|
|
899
988
|
continue;
|
|
900
989
|
}
|
package/dist/index.d.mts
CHANGED
package/dist/index.d.ts
CHANGED
package/package.json
CHANGED