zcf 2.9.8 → 2.9.10
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 +28 -12
- package/dist/chunks/simple-config.mjs +271 -21
- package/dist/cli.mjs +92 -14
- 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,8 @@ 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
|
-
-
|
|
30
|
+
- `L` CCometixLine - High-performance statusline tool with Git integration and real-time usage tracking (v2.9.9+ new)
|
|
31
|
+
- `+` Check updates - Check and update Claude Code, CCR and CCometixLine versions (v2.9.9+ enhanced)
|
|
31
32
|
- More features...
|
|
32
33
|
|
|
33
34
|
### Or, use direct commands:
|
|
@@ -83,14 +84,6 @@ npx zcf ccr # Open CCR management menu
|
|
|
83
84
|
npx zcf → select R
|
|
84
85
|
```
|
|
85
86
|
|
|
86
|
-
Check for updates (v2.8.1+):
|
|
87
|
-
|
|
88
|
-
```bash
|
|
89
|
-
npx zcf check-updates # Check and update Claude Code and CCR to latest versions
|
|
90
|
-
# or
|
|
91
|
-
npx zcf → select +
|
|
92
|
-
```
|
|
93
|
-
|
|
94
87
|
CCR menu options:
|
|
95
88
|
|
|
96
89
|
- Initialize CCR - Install and configure CCR with preset providers
|
|
@@ -100,7 +93,27 @@ CCR menu options:
|
|
|
100
93
|
|
|
101
94
|
After CCR setup, ZCF automatically configures Claude Code to use CCR as the API proxy.
|
|
102
95
|
|
|
103
|
-
|
|
96
|
+
**Important Notice for v2.9.9 Users**: If you previously installed CCometixLine using ZCF v2.9.9, please rerun the installation process to ensure that the CCometixLine configuration is correctly added. Run `npx zcf` -> `Select L` -> `Select 1` to add the CCometixLine configuration.
|
|
97
|
+
|
|
98
|
+
#### 📊 CCometixLine Support (Status Bar Tool) (v2.9.9+ New)
|
|
99
|
+
|
|
100
|
+
[CCometixLine](https://github.com/Haleclipse/CCometixLine) is a high-performance Rust-based statusline tool that provides:
|
|
101
|
+
|
|
102
|
+
- **Real-time Usage Tracking**: Monitor Claude Code API usage in real-time
|
|
103
|
+
- **Git Integration**: Display Git status and branch information
|
|
104
|
+
- **Status Line Display**: Native integration with your terminal statusline
|
|
105
|
+
- **Performance Optimized**: Built with Rust for minimal resource usage
|
|
106
|
+
- **Auto Updates**: Included in ZCF's update checking system
|
|
107
|
+
|
|
108
|
+
> **Important Note for v2.9.9 Users**: If you have previously used ZCF v2.9.9 to set up your environment, please re-run the initialization process to ensure CCometixLine configuration is properly added. Run `npx zcf` and select the appropriate setup option to update your configuration with CCometixLine support.
|
|
109
|
+
|
|
110
|
+
#### 🚀 Check for updates (v2.8.1+, CCometixLine support v2.9.9+):
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
npx zcf check-updates # Check and update Claude Code, CCR and CCometixLine to latest versions
|
|
114
|
+
# or
|
|
115
|
+
npx zcf → select +
|
|
116
|
+
```
|
|
104
117
|
|
|
105
118
|
### Setup Process
|
|
106
119
|
|
|
@@ -195,12 +208,14 @@ Select function:
|
|
|
195
208
|
7. Import recommended environment variables and permissions - Import privacy protection environment variables and system permissions
|
|
196
209
|
|
|
197
210
|
--------- Other Tools ----------
|
|
198
|
-
R. CCR
|
|
199
|
-
U.
|
|
211
|
+
R. CCR - Claude Code Router management
|
|
212
|
+
U. ccusage - Claude Code usage analysis
|
|
213
|
+
L. CCometixLine - High-performance statusline tool with Git integration and real-time usage tracking
|
|
200
214
|
|
|
201
215
|
------------ ZCF ------------
|
|
202
216
|
0. Select display language / 更改显示语言 - Change ZCF interface language
|
|
203
217
|
-. Clear preference cache - Clear preference language and other caches
|
|
218
|
+
+. Check updates - Check and update Claude Code, CCR and CCometixLine versions
|
|
204
219
|
Q. Exit
|
|
205
220
|
|
|
206
221
|
Enter your choice: _
|
|
@@ -499,6 +514,7 @@ This project is inspired by and incorporates the following open source projects:
|
|
|
499
514
|
|
|
500
515
|
- [LINUX DO - The New Ideal Community](https://linux.do)
|
|
501
516
|
- [CCR](https://github.com/musistudio/claude-code-router)
|
|
517
|
+
- [CCometixLine](https://github.com/Haleclipse/CCometixLine)
|
|
502
518
|
- [ccusage](https://github.com/ryoppippi/ccusage)
|
|
503
519
|
- [BMad Method](https://github.com/bmad-code-org/BMAD-METHOD)
|
|
504
520
|
|
|
@@ -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.10";
|
|
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,40 @@ 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
|
+
statusLineConfigured: "Claude Code \u72B6\u6001\u680F\u914D\u7F6E\u5DF2\u8BBE\u7F6E",
|
|
462
|
+
statusLineConfigFailed: "\u72B6\u6001\u680F\u914D\u7F6E\u5931\u8D25",
|
|
463
|
+
statusLineManualConfig: "\u8BF7\u624B\u52A8\u6DFB\u52A0\u72B6\u6001\u680F\u914D\u7F6E\u5230 Claude Code \u8BBE\u7F6E\u4E2D",
|
|
464
|
+
statusLineAlreadyConfigured: "Claude Code \u72B6\u6001\u680F\u914D\u7F6E\u5DF2\u5B58\u5728",
|
|
465
|
+
// Installation prompt in init
|
|
466
|
+
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",
|
|
467
|
+
cometixSkipped: "CCometixLine \u5B89\u88C5\u5DF2\u8DF3\u8FC7",
|
|
468
|
+
// Commands
|
|
469
|
+
installingOrUpdating: "\u6B63\u5728\u5B89\u88C5/\u66F4\u65B0 CCometixLine...",
|
|
470
|
+
installUpdateSuccess: "CCometixLine \u5B89\u88C5/\u66F4\u65B0\u5B8C\u6210",
|
|
471
|
+
installUpdateFailed: "\u5B89\u88C5/\u66F4\u65B0 CCometixLine \u5931\u8D25",
|
|
472
|
+
printingConfig: "\u6B63\u5728\u6253\u5370 CCometixLine \u914D\u7F6E...",
|
|
473
|
+
printConfigSuccess: "\u914D\u7F6E\u6253\u5370\u6210\u529F",
|
|
474
|
+
printConfigFailed: "\u6253\u5370\u914D\u7F6E\u5931\u8D25",
|
|
475
|
+
commandNotFound: "ccline \u547D\u4EE4\u672A\u627E\u5230\u3002\u8BF7\u5148\u5B89\u88C5 CCometixLine\u3002",
|
|
476
|
+
// CCometixLine Menu
|
|
477
|
+
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",
|
|
478
|
+
cometixMenuOptions: {
|
|
479
|
+
installOrUpdate: "\u5B89\u88C5\u6216\u66F4\u65B0",
|
|
480
|
+
printConfig: "\u6253\u5370\u9ED8\u8BA4\u914D\u7F6E",
|
|
481
|
+
back: "\u8FD4\u56DE\u4E3B\u83DC\u5355"
|
|
482
|
+
},
|
|
483
|
+
cometixMenuDescriptions: {
|
|
484
|
+
installOrUpdate: "\u4F7F\u7528 npm \u5B89\u88C5\u6216\u66F4\u65B0 CCometixLine",
|
|
485
|
+
printConfig: "\u663E\u793A\u5F53\u524D CCometixLine \u914D\u7F6E"
|
|
486
|
+
}
|
|
487
|
+
};
|
|
488
|
+
|
|
453
489
|
const updater$1 = {
|
|
454
490
|
checkingVersion: "\u6B63\u5728\u68C0\u67E5\u7248\u672C...",
|
|
455
491
|
checkingTools: "\u68C0\u67E5\u5DE5\u5177\u7248\u672C",
|
|
@@ -457,6 +493,8 @@ const updater$1 = {
|
|
|
457
493
|
ccrUpToDate: "CCR \u5DF2\u662F\u6700\u65B0\u7248\u672C (v{version})",
|
|
458
494
|
claudeCodeNotInstalled: "Claude Code \u672A\u5B89\u88C5",
|
|
459
495
|
claudeCodeUpToDate: "Claude Code \u5DF2\u662F\u6700\u65B0\u7248\u672C (v{version})",
|
|
496
|
+
cometixLineNotInstalled: "CCometixLine \u672A\u5B89\u88C5",
|
|
497
|
+
cometixLineUpToDate: "CCometixLine \u5DF2\u662F\u6700\u65B0\u7248\u672C (v{version})",
|
|
460
498
|
cannotCheckVersion: "\u65E0\u6CD5\u68C0\u67E5\u6700\u65B0\u7248\u672C",
|
|
461
499
|
currentVersion: "\u5F53\u524D\u7248\u672C: v{version}",
|
|
462
500
|
latestVersion: "\u6700\u65B0\u7248\u672C: v{version}",
|
|
@@ -482,6 +520,7 @@ const zhCN = {
|
|
|
482
520
|
errors: errors$1,
|
|
483
521
|
tools: tools$1,
|
|
484
522
|
ccr: ccrMessages$1,
|
|
523
|
+
cometix: cometixMessages$1,
|
|
485
524
|
updater: updater$1
|
|
486
525
|
};
|
|
487
526
|
|
|
@@ -680,6 +719,7 @@ const menu = {
|
|
|
680
719
|
configureCcr: "Configure Model Proxy (CCR)",
|
|
681
720
|
ccrManagement: "CCR",
|
|
682
721
|
ccusage: "ccusage",
|
|
722
|
+
cometixLine: "CCometixLine",
|
|
683
723
|
installBmad: "Install BMad Method",
|
|
684
724
|
clearCache: "Clear preference cache",
|
|
685
725
|
checkUpdates: "Check updates",
|
|
@@ -698,9 +738,10 @@ const menu = {
|
|
|
698
738
|
configureCcr: "Configure Claude Code Router to use multiple AI models",
|
|
699
739
|
ccrManagement: "Configure Claude Code Router to use multiple AI models",
|
|
700
740
|
ccusage: "Claude Code usage analysis",
|
|
741
|
+
cometixLine: "High-performance Claude Code statusline tool with Git integration and real-time usage tracking",
|
|
701
742
|
installBmad: "AI-driven development methodology framework",
|
|
702
743
|
clearCache: "Clear preference language and other caches",
|
|
703
|
-
checkUpdates: "Check and update Claude Code and
|
|
744
|
+
checkUpdates: "Check and update Claude Code, CCR and CCometixLine versions",
|
|
704
745
|
changeLanguage: "Change ZCF interface language"
|
|
705
746
|
}
|
|
706
747
|
};
|
|
@@ -917,6 +958,40 @@ const ccrMessages = {
|
|
|
917
958
|
ccrUiApiKeyHint: "Use this API key to login to CCR UI"
|
|
918
959
|
};
|
|
919
960
|
|
|
961
|
+
const cometixMessages = {
|
|
962
|
+
// Installation
|
|
963
|
+
installingCometix: "Installing CCometixLine...",
|
|
964
|
+
cometixInstallSuccess: "CCometixLine installed successfully",
|
|
965
|
+
cometixInstallFailed: "Failed to install CCometixLine",
|
|
966
|
+
cometixAlreadyInstalled: "CCometixLine is already installed",
|
|
967
|
+
statusLineConfigured: "Claude Code statusLine configured",
|
|
968
|
+
statusLineConfigFailed: "Failed to configure statusLine",
|
|
969
|
+
statusLineManualConfig: "Please manually add statusLine configuration to Claude Code settings",
|
|
970
|
+
statusLineAlreadyConfigured: "Claude Code statusLine already configured",
|
|
971
|
+
// Installation prompt in init
|
|
972
|
+
installCometixPrompt: "Install CCometixLine - High-performance Claude Code statusline tool with Git integration and real-time usage tracking?",
|
|
973
|
+
cometixSkipped: "CCometixLine installation skipped",
|
|
974
|
+
// Commands
|
|
975
|
+
installingOrUpdating: "Installing/updating CCometixLine...",
|
|
976
|
+
installUpdateSuccess: "CCometixLine install/update completed",
|
|
977
|
+
installUpdateFailed: "Failed to install/update CCometixLine",
|
|
978
|
+
printingConfig: "Printing CCometixLine configuration...",
|
|
979
|
+
printConfigSuccess: "Configuration printed successfully",
|
|
980
|
+
printConfigFailed: "Failed to print configuration",
|
|
981
|
+
commandNotFound: "ccline command not found. Please install CCometixLine first.",
|
|
982
|
+
// CCometixLine Menu
|
|
983
|
+
cometixMenuTitle: "CCometixLine - High-performance Claude Code statusline tool with Git integration and real-time usage tracking",
|
|
984
|
+
cometixMenuOptions: {
|
|
985
|
+
installOrUpdate: "Install or Update",
|
|
986
|
+
printConfig: "Print Default Configuration",
|
|
987
|
+
back: "Back to Main Menu"
|
|
988
|
+
},
|
|
989
|
+
cometixMenuDescriptions: {
|
|
990
|
+
installOrUpdate: "Install or update CCometixLine using npm",
|
|
991
|
+
printConfig: "Display current CCometixLine configuration"
|
|
992
|
+
}
|
|
993
|
+
};
|
|
994
|
+
|
|
920
995
|
const updater = {
|
|
921
996
|
checkingVersion: "Checking version...",
|
|
922
997
|
checkingTools: "Checking tool versions",
|
|
@@ -924,6 +999,8 @@ const updater = {
|
|
|
924
999
|
ccrUpToDate: "CCR is up to date (v{version})",
|
|
925
1000
|
claudeCodeNotInstalled: "Claude Code is not installed",
|
|
926
1001
|
claudeCodeUpToDate: "Claude Code is up to date (v{version})",
|
|
1002
|
+
cometixLineNotInstalled: "CCometixLine is not installed",
|
|
1003
|
+
cometixLineUpToDate: "CCometixLine is up to date (v{version})",
|
|
927
1004
|
cannotCheckVersion: "Cannot check latest version",
|
|
928
1005
|
currentVersion: "Current version: v{version}",
|
|
929
1006
|
latestVersion: "Latest version: v{version}",
|
|
@@ -949,6 +1026,7 @@ const en = {
|
|
|
949
1026
|
errors,
|
|
950
1027
|
tools,
|
|
951
1028
|
ccr: ccrMessages,
|
|
1029
|
+
cometix: cometixMessages,
|
|
952
1030
|
updater
|
|
953
1031
|
};
|
|
954
1032
|
|
|
@@ -2047,15 +2125,15 @@ function format(template, replacements) {
|
|
|
2047
2125
|
});
|
|
2048
2126
|
}
|
|
2049
2127
|
|
|
2050
|
-
const execAsync$
|
|
2128
|
+
const execAsync$4 = promisify(exec$1);
|
|
2051
2129
|
async function getInstalledVersion(command) {
|
|
2052
2130
|
try {
|
|
2053
2131
|
let stdout;
|
|
2054
2132
|
try {
|
|
2055
|
-
const result = await execAsync$
|
|
2133
|
+
const result = await execAsync$4(`${command} -v`);
|
|
2056
2134
|
stdout = result.stdout;
|
|
2057
2135
|
} catch {
|
|
2058
|
-
const result = await execAsync$
|
|
2136
|
+
const result = await execAsync$4(`${command} --version`);
|
|
2059
2137
|
stdout = result.stdout;
|
|
2060
2138
|
}
|
|
2061
2139
|
const versionMatch = stdout.match(/(\d+\.\d+\.\d+(?:-[\w.]+)?)/);
|
|
@@ -2066,7 +2144,7 @@ async function getInstalledVersion(command) {
|
|
|
2066
2144
|
}
|
|
2067
2145
|
async function getLatestVersion(packageName) {
|
|
2068
2146
|
try {
|
|
2069
|
-
const { stdout } = await execAsync$
|
|
2147
|
+
const { stdout } = await execAsync$4(`npm view ${packageName} version`);
|
|
2070
2148
|
return stdout.trim();
|
|
2071
2149
|
} catch {
|
|
2072
2150
|
return null;
|
|
@@ -2101,8 +2179,18 @@ async function checkClaudeCodeVersion() {
|
|
|
2101
2179
|
needsUpdate: currentVersion && latestVersion ? shouldUpdate(currentVersion, latestVersion) : false
|
|
2102
2180
|
};
|
|
2103
2181
|
}
|
|
2182
|
+
async function checkCometixLineVersion() {
|
|
2183
|
+
const currentVersion = await getInstalledVersion("ccometix");
|
|
2184
|
+
const latestVersion = await getLatestVersion("ccometix");
|
|
2185
|
+
return {
|
|
2186
|
+
installed: currentVersion !== null,
|
|
2187
|
+
currentVersion,
|
|
2188
|
+
latestVersion,
|
|
2189
|
+
needsUpdate: currentVersion && latestVersion ? shouldUpdate(currentVersion, latestVersion) : false
|
|
2190
|
+
};
|
|
2191
|
+
}
|
|
2104
2192
|
|
|
2105
|
-
const execAsync$
|
|
2193
|
+
const execAsync$3 = promisify(exec$1);
|
|
2106
2194
|
async function updateCcr(scriptLang, force = false) {
|
|
2107
2195
|
const i18n = getTranslation(scriptLang);
|
|
2108
2196
|
const spinner = ora(i18n.updater.checkingVersion).start();
|
|
@@ -2135,7 +2223,7 @@ async function updateCcr(scriptLang, force = false) {
|
|
|
2135
2223
|
}
|
|
2136
2224
|
const updateSpinner = ora(format(i18n.updater.updating, { tool: "CCR" })).start();
|
|
2137
2225
|
try {
|
|
2138
|
-
await execAsync$
|
|
2226
|
+
await execAsync$3("npm update -g @musistudio/claude-code-router");
|
|
2139
2227
|
updateSpinner.succeed(format(i18n.updater.updateSuccess, { tool: "CCR" }));
|
|
2140
2228
|
return true;
|
|
2141
2229
|
} catch (error) {
|
|
@@ -2181,7 +2269,7 @@ async function updateClaudeCode(scriptLang, force = false) {
|
|
|
2181
2269
|
}
|
|
2182
2270
|
const updateSpinner = ora(format(i18n.updater.updating, { tool: "Claude Code" })).start();
|
|
2183
2271
|
try {
|
|
2184
|
-
await execAsync$
|
|
2272
|
+
await execAsync$3("npm update -g @anthropic-ai/claude-code");
|
|
2185
2273
|
updateSpinner.succeed(format(i18n.updater.updateSuccess, { tool: "Claude Code" }));
|
|
2186
2274
|
return true;
|
|
2187
2275
|
} catch (error) {
|
|
@@ -2195,6 +2283,52 @@ async function updateClaudeCode(scriptLang, force = false) {
|
|
|
2195
2283
|
return false;
|
|
2196
2284
|
}
|
|
2197
2285
|
}
|
|
2286
|
+
async function updateCometixLine(scriptLang, force = false) {
|
|
2287
|
+
const i18n = getTranslation(scriptLang);
|
|
2288
|
+
const spinner = ora(i18n.updater.checkingVersion).start();
|
|
2289
|
+
try {
|
|
2290
|
+
const { installed, currentVersion, latestVersion, needsUpdate } = await checkCometixLineVersion();
|
|
2291
|
+
spinner.stop();
|
|
2292
|
+
if (!installed) {
|
|
2293
|
+
console.log(ansis.yellow(i18n.updater.cometixLineNotInstalled));
|
|
2294
|
+
return false;
|
|
2295
|
+
}
|
|
2296
|
+
if (!needsUpdate && !force) {
|
|
2297
|
+
console.log(ansis.green(format(i18n.updater.cometixLineUpToDate, { version: currentVersion || "" })));
|
|
2298
|
+
return true;
|
|
2299
|
+
}
|
|
2300
|
+
if (!latestVersion) {
|
|
2301
|
+
console.log(ansis.yellow(i18n.updater.cannotCheckVersion));
|
|
2302
|
+
return false;
|
|
2303
|
+
}
|
|
2304
|
+
console.log(ansis.cyan(format(i18n.updater.currentVersion, { version: currentVersion || "" })));
|
|
2305
|
+
console.log(ansis.cyan(format(i18n.updater.latestVersion, { version: latestVersion })));
|
|
2306
|
+
const { confirm } = await inquirer.prompt({
|
|
2307
|
+
type: "confirm",
|
|
2308
|
+
name: "confirm",
|
|
2309
|
+
message: format(i18n.updater.confirmUpdate, { tool: "CCometixLine" }),
|
|
2310
|
+
default: true
|
|
2311
|
+
});
|
|
2312
|
+
if (!confirm) {
|
|
2313
|
+
console.log(ansis.gray(i18n.updater.updateSkipped));
|
|
2314
|
+
return true;
|
|
2315
|
+
}
|
|
2316
|
+
const updateSpinner = ora(format(i18n.updater.updating, { tool: "CCometixLine" })).start();
|
|
2317
|
+
try {
|
|
2318
|
+
await execAsync$3("cargo install ccometix");
|
|
2319
|
+
updateSpinner.succeed(format(i18n.updater.updateSuccess, { tool: "CCometixLine" }));
|
|
2320
|
+
return true;
|
|
2321
|
+
} catch (error) {
|
|
2322
|
+
updateSpinner.fail(format(i18n.updater.updateFailed, { tool: "CCometixLine" }));
|
|
2323
|
+
console.error(ansis.red(error instanceof Error ? error.message : String(error)));
|
|
2324
|
+
return false;
|
|
2325
|
+
}
|
|
2326
|
+
} catch (error) {
|
|
2327
|
+
spinner.fail(i18n.updater.checkFailed);
|
|
2328
|
+
console.error(ansis.red(error instanceof Error ? error.message : String(error)));
|
|
2329
|
+
return false;
|
|
2330
|
+
}
|
|
2331
|
+
}
|
|
2198
2332
|
async function checkAndUpdateTools(scriptLang) {
|
|
2199
2333
|
const i18n = getTranslation(scriptLang);
|
|
2200
2334
|
console.log(ansis.bold.cyan(`
|
|
@@ -2203,6 +2337,8 @@ async function checkAndUpdateTools(scriptLang) {
|
|
|
2203
2337
|
await updateCcr(scriptLang);
|
|
2204
2338
|
console.log();
|
|
2205
2339
|
await updateClaudeCode(scriptLang);
|
|
2340
|
+
console.log();
|
|
2341
|
+
await updateCometixLine(scriptLang);
|
|
2206
2342
|
}
|
|
2207
2343
|
|
|
2208
2344
|
async function isClaudeCodeInstalled() {
|
|
@@ -2547,15 +2683,15 @@ async function cleanupOldVersionFiles(scriptLang) {
|
|
|
2547
2683
|
}
|
|
2548
2684
|
}
|
|
2549
2685
|
|
|
2550
|
-
const execAsync$
|
|
2686
|
+
const execAsync$2 = promisify$1(exec$2);
|
|
2551
2687
|
async function isCcrInstalled() {
|
|
2552
2688
|
let commandExists = false;
|
|
2553
2689
|
try {
|
|
2554
|
-
await execAsync$
|
|
2690
|
+
await execAsync$2("ccr version");
|
|
2555
2691
|
commandExists = true;
|
|
2556
2692
|
} catch {
|
|
2557
2693
|
try {
|
|
2558
|
-
await execAsync$
|
|
2694
|
+
await execAsync$2("which ccr");
|
|
2559
2695
|
commandExists = true;
|
|
2560
2696
|
} catch {
|
|
2561
2697
|
commandExists = false;
|
|
@@ -2563,7 +2699,7 @@ async function isCcrInstalled() {
|
|
|
2563
2699
|
}
|
|
2564
2700
|
let hasCorrectPackage = false;
|
|
2565
2701
|
try {
|
|
2566
|
-
await execAsync$
|
|
2702
|
+
await execAsync$2("npm list -g @musistudio/claude-code-router");
|
|
2567
2703
|
hasCorrectPackage = true;
|
|
2568
2704
|
} catch {
|
|
2569
2705
|
hasCorrectPackage = false;
|
|
@@ -2583,10 +2719,10 @@ async function installCcr(scriptLang) {
|
|
|
2583
2719
|
}
|
|
2584
2720
|
if (isInstalled && !hasCorrectPackage) {
|
|
2585
2721
|
try {
|
|
2586
|
-
await execAsync$
|
|
2722
|
+
await execAsync$2("npm list -g claude-code-router");
|
|
2587
2723
|
console.log(ansis.yellow(`\u26A0 ${i18n.ccr.detectedIncorrectPackage}`));
|
|
2588
2724
|
try {
|
|
2589
|
-
await execAsync$
|
|
2725
|
+
await execAsync$2("npm uninstall -g claude-code-router");
|
|
2590
2726
|
console.log(ansis.green(`\u2714 ${i18n.ccr.uninstalledIncorrectPackage}`));
|
|
2591
2727
|
} catch (uninstallError) {
|
|
2592
2728
|
console.log(ansis.yellow(`\u26A0 ${i18n.ccr.failedToUninstallIncorrectPackage}`));
|
|
@@ -2596,7 +2732,7 @@ async function installCcr(scriptLang) {
|
|
|
2596
2732
|
}
|
|
2597
2733
|
console.log(ansis.cyan(`\u{1F4E6} ${i18n.ccr.installingCcr}`));
|
|
2598
2734
|
try {
|
|
2599
|
-
await execAsync$
|
|
2735
|
+
await execAsync$2("npm install -g @musistudio/claude-code-router --force");
|
|
2600
2736
|
console.log(ansis.green(`\u2714 ${i18n.ccr.ccrInstallSuccess}`));
|
|
2601
2737
|
} catch (error) {
|
|
2602
2738
|
if (error.message?.includes("EEXIST")) {
|
|
@@ -2757,7 +2893,7 @@ function getFallbackPresets() {
|
|
|
2757
2893
|
];
|
|
2758
2894
|
}
|
|
2759
2895
|
|
|
2760
|
-
const execAsync = promisify$1(exec$2);
|
|
2896
|
+
const execAsync$1 = promisify$1(exec$2);
|
|
2761
2897
|
const CCR_CONFIG_DIR = join$1(homedir(), ".claude-code-router");
|
|
2762
2898
|
const CCR_CONFIG_FILE = join$1(CCR_CONFIG_DIR, "config.json");
|
|
2763
2899
|
const CCR_BACKUP_DIR = CCR_CONFIG_DIR;
|
|
@@ -2917,10 +3053,10 @@ async function restartAndCheckCcrStatus(scriptLang) {
|
|
|
2917
3053
|
const i18n = getTranslation(scriptLang);
|
|
2918
3054
|
try {
|
|
2919
3055
|
console.log(ansis.cyan(`${i18n.ccr.restartingCcr}`));
|
|
2920
|
-
await execAsync("ccr restart");
|
|
3056
|
+
await execAsync$1("ccr restart");
|
|
2921
3057
|
console.log(ansis.green(`\u2714 ${i18n.ccr.ccrRestartSuccess}`));
|
|
2922
3058
|
console.log(ansis.cyan(`${i18n.ccr.checkingCcrStatus}`));
|
|
2923
|
-
const { stdout } = await execAsync("ccr status");
|
|
3059
|
+
const { stdout } = await execAsync$1("ccr status");
|
|
2924
3060
|
console.log(ansis.gray(stdout));
|
|
2925
3061
|
} catch (error) {
|
|
2926
3062
|
console.error(ansis.red(`${i18n.ccr.ccrRestartFailed}:`), error.message || error);
|
|
@@ -3026,6 +3162,100 @@ async function configureCcrFeature(scriptLang) {
|
|
|
3026
3162
|
await setupCcrConfiguration(scriptLang);
|
|
3027
3163
|
}
|
|
3028
3164
|
|
|
3165
|
+
const COMETIX_PACKAGE_NAME = "@cometix/ccline";
|
|
3166
|
+
const COMETIX_COMMAND_NAME = "ccline";
|
|
3167
|
+
const COMETIX_COMMANDS = {
|
|
3168
|
+
CHECK_INSTALL: `npm list -g ${COMETIX_PACKAGE_NAME}`,
|
|
3169
|
+
INSTALL: `npm install -g ${COMETIX_PACKAGE_NAME}`,
|
|
3170
|
+
UPDATE: `npm update -g ${COMETIX_PACKAGE_NAME}`,
|
|
3171
|
+
PRINT_CONFIG: `${COMETIX_COMMAND_NAME} --print`
|
|
3172
|
+
};
|
|
3173
|
+
|
|
3174
|
+
function getPlatformStatusLineConfig() {
|
|
3175
|
+
return {
|
|
3176
|
+
type: "command",
|
|
3177
|
+
command: isWindows() ? "%USERPROFILE%\\.claude\\ccline\\ccline.exe" : "~/.claude/ccline/ccline",
|
|
3178
|
+
padding: 0
|
|
3179
|
+
};
|
|
3180
|
+
}
|
|
3181
|
+
|
|
3182
|
+
function addCCometixLineConfig() {
|
|
3183
|
+
try {
|
|
3184
|
+
const statusLineConfig = getPlatformStatusLineConfig();
|
|
3185
|
+
let settings = {};
|
|
3186
|
+
if (exists(SETTINGS_FILE)) {
|
|
3187
|
+
settings = readJsonConfig(SETTINGS_FILE) || {};
|
|
3188
|
+
}
|
|
3189
|
+
settings.statusLine = statusLineConfig;
|
|
3190
|
+
writeJsonConfig(SETTINGS_FILE, settings);
|
|
3191
|
+
return true;
|
|
3192
|
+
} catch (error) {
|
|
3193
|
+
console.error("Failed to add CCometixLine configuration:", error);
|
|
3194
|
+
return false;
|
|
3195
|
+
}
|
|
3196
|
+
}
|
|
3197
|
+
function hasCCometixLineConfig() {
|
|
3198
|
+
try {
|
|
3199
|
+
if (!exists(SETTINGS_FILE)) {
|
|
3200
|
+
return false;
|
|
3201
|
+
}
|
|
3202
|
+
const settings = readJsonConfig(SETTINGS_FILE);
|
|
3203
|
+
return !!settings?.statusLine?.command?.includes("ccline");
|
|
3204
|
+
} catch (error) {
|
|
3205
|
+
return false;
|
|
3206
|
+
}
|
|
3207
|
+
}
|
|
3208
|
+
|
|
3209
|
+
const execAsync = promisify$1(exec$2);
|
|
3210
|
+
async function isCometixLineInstalled() {
|
|
3211
|
+
try {
|
|
3212
|
+
await execAsync(COMETIX_COMMANDS.CHECK_INSTALL);
|
|
3213
|
+
return true;
|
|
3214
|
+
} catch {
|
|
3215
|
+
return false;
|
|
3216
|
+
}
|
|
3217
|
+
}
|
|
3218
|
+
async function installCometixLine(scriptLang) {
|
|
3219
|
+
const i18n = getTranslation(scriptLang);
|
|
3220
|
+
const isInstalled = await isCometixLineInstalled();
|
|
3221
|
+
if (isInstalled) {
|
|
3222
|
+
console.log(ansis.green(`\u2714 ${i18n.cometix.cometixAlreadyInstalled}`));
|
|
3223
|
+
try {
|
|
3224
|
+
console.log(ansis.blue(`${i18n.cometix.installingOrUpdating}`));
|
|
3225
|
+
await execAsync(COMETIX_COMMANDS.INSTALL);
|
|
3226
|
+
console.log(ansis.green(`\u2714 ${i18n.cometix.installUpdateSuccess}`));
|
|
3227
|
+
} catch (error) {
|
|
3228
|
+
console.warn(ansis.yellow(`\u26A0 ${i18n.cometix.installUpdateFailed}: ${error}`));
|
|
3229
|
+
}
|
|
3230
|
+
if (!hasCCometixLineConfig()) {
|
|
3231
|
+
try {
|
|
3232
|
+
addCCometixLineConfig();
|
|
3233
|
+
console.log(ansis.green(`\u2714 ${i18n.cometix.statusLineConfigured || "Claude Code statusLine configured"}`));
|
|
3234
|
+
} catch (error) {
|
|
3235
|
+
console.warn(ansis.yellow(`\u26A0 ${i18n.cometix.statusLineConfigFailed || "Failed to configure statusLine"}: ${error}`));
|
|
3236
|
+
}
|
|
3237
|
+
} else {
|
|
3238
|
+
console.log(ansis.blue(`\u2139 ${i18n.cometix.statusLineAlreadyConfigured || "Claude Code statusLine already configured"}`));
|
|
3239
|
+
}
|
|
3240
|
+
return;
|
|
3241
|
+
}
|
|
3242
|
+
try {
|
|
3243
|
+
console.log(ansis.blue(`${i18n.cometix.installingCometix}`));
|
|
3244
|
+
await execAsync(COMETIX_COMMANDS.INSTALL);
|
|
3245
|
+
console.log(ansis.green(`\u2714 ${i18n.cometix.cometixInstallSuccess}`));
|
|
3246
|
+
try {
|
|
3247
|
+
addCCometixLineConfig();
|
|
3248
|
+
console.log(ansis.green(`\u2714 ${i18n.cometix.statusLineConfigured || "Claude Code statusLine configured"}`));
|
|
3249
|
+
} catch (configError) {
|
|
3250
|
+
console.warn(ansis.yellow(`\u26A0 ${i18n.cometix.statusLineConfigFailed || "Failed to configure statusLine"}: ${configError}`));
|
|
3251
|
+
console.log(ansis.blue(`\u{1F4A1} ${i18n.cometix.statusLineManualConfig || "Please manually add statusLine configuration to Claude Code settings"}`));
|
|
3252
|
+
}
|
|
3253
|
+
} catch (error) {
|
|
3254
|
+
console.error(ansis.red(`\u2717 ${i18n.cometix.cometixInstallFailed}: ${error}`));
|
|
3255
|
+
throw error;
|
|
3256
|
+
}
|
|
3257
|
+
}
|
|
3258
|
+
|
|
3029
3259
|
async function init(options = {}) {
|
|
3030
3260
|
try {
|
|
3031
3261
|
if (!options.skipBanner) {
|
|
@@ -3289,6 +3519,26 @@ async function init(options = {}) {
|
|
|
3289
3519
|
}
|
|
3290
3520
|
}
|
|
3291
3521
|
}
|
|
3522
|
+
const cometixInstalled = await isCometixLineInstalled();
|
|
3523
|
+
if (!cometixInstalled) {
|
|
3524
|
+
const { shouldInstallCometix } = await inquirer.prompt({
|
|
3525
|
+
type: "confirm",
|
|
3526
|
+
name: "shouldInstallCometix",
|
|
3527
|
+
message: i18n.cometix.installCometixPrompt,
|
|
3528
|
+
default: true
|
|
3529
|
+
});
|
|
3530
|
+
if (shouldInstallCometix === void 0) {
|
|
3531
|
+
console.log(ansis.yellow(i18n.common.cancelled));
|
|
3532
|
+
process.exit(0);
|
|
3533
|
+
}
|
|
3534
|
+
if (shouldInstallCometix) {
|
|
3535
|
+
await installCometixLine(scriptLang);
|
|
3536
|
+
} else {
|
|
3537
|
+
console.log(ansis.yellow(i18n.cometix.cometixSkipped));
|
|
3538
|
+
}
|
|
3539
|
+
} else {
|
|
3540
|
+
console.log(ansis.green(`\u2714 ${i18n.cometix.cometixAlreadyInstalled}`));
|
|
3541
|
+
}
|
|
3292
3542
|
updateZcfConfig({
|
|
3293
3543
|
version,
|
|
3294
3544
|
preferredLang: scriptLang,
|
|
@@ -3381,4 +3631,4 @@ async function openSettingsJson() {
|
|
|
3381
3631
|
}
|
|
3382
3632
|
}
|
|
3383
3633
|
|
|
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,
|
|
3634
|
+
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, installCometixLine as a5, displayBanner as a6, selectScriptLanguage as a7, resolveAiOutputLanguage as a8, updatePromptOnly as a9, selectAndInstallWorkflows as aa, version as ab, checkAndUpdateTools as ac, displayBannerWithInfo as ad, prompts as ae, 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 installCometixLine, a6 as displayBanner, a7 as selectScriptLanguage, a8 as resolveAiOutputLanguage, a9 as updatePromptOnly, aa as selectAndInstallWorkflows, ab as version, ac as checkAndUpdateTools, ad 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.ae; });
|
|
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,73 @@ async function showCcrMenu(scriptLang) {
|
|
|
642
642
|
}
|
|
643
643
|
}
|
|
644
644
|
|
|
645
|
+
const execAsync = promisify$1(exec$1);
|
|
646
|
+
async function runCometixPrintConfig(scriptLang) {
|
|
647
|
+
const i18n = getTranslation(scriptLang);
|
|
648
|
+
try {
|
|
649
|
+
console.log(ansis.blue(`${i18n.cometix.printingConfig}`));
|
|
650
|
+
const { stdout } = await execAsync(COMETIX_COMMANDS.PRINT_CONFIG);
|
|
651
|
+
console.log(stdout);
|
|
652
|
+
} catch (error) {
|
|
653
|
+
if (error.message.includes(`command not found: ${COMETIX_COMMAND_NAME}`)) {
|
|
654
|
+
console.error(ansis.red(`\u2717 ${i18n.cometix.commandNotFound}`));
|
|
655
|
+
} else {
|
|
656
|
+
console.error(ansis.red(`\u2717 ${i18n.cometix.printConfigFailed}: ${error}`));
|
|
657
|
+
}
|
|
658
|
+
throw error;
|
|
659
|
+
}
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
async function showCometixMenu(scriptLang) {
|
|
663
|
+
try {
|
|
664
|
+
const i18n = getTranslation(scriptLang);
|
|
665
|
+
console.log("\n" + ansis.cyan("\u2550".repeat(50)));
|
|
666
|
+
console.log(ansis.bold.cyan(` ${i18n.cometix.cometixMenuTitle}`));
|
|
667
|
+
console.log(ansis.cyan("\u2550".repeat(50)) + "\n");
|
|
668
|
+
console.log(` ${ansis.cyan("1.")} ${i18n.cometix.cometixMenuOptions.installOrUpdate} ${ansis.gray("- " + i18n.cometix.cometixMenuDescriptions.installOrUpdate)}`);
|
|
669
|
+
console.log(` ${ansis.cyan("2.")} ${i18n.cometix.cometixMenuOptions.printConfig} ${ansis.gray("- " + i18n.cometix.cometixMenuDescriptions.printConfig)}`);
|
|
670
|
+
console.log(` ${ansis.yellow("0.")} ${i18n.cometix.cometixMenuOptions.back}`);
|
|
671
|
+
console.log("");
|
|
672
|
+
const { choice } = await inquirer.prompt({
|
|
673
|
+
type: "input",
|
|
674
|
+
name: "choice",
|
|
675
|
+
message: i18n.common.enterChoice,
|
|
676
|
+
validate: (value) => {
|
|
677
|
+
const valid = ["1", "2", "0"];
|
|
678
|
+
return valid.includes(value) || i18n.common.invalidChoice;
|
|
679
|
+
}
|
|
680
|
+
});
|
|
681
|
+
switch (choice) {
|
|
682
|
+
case "1":
|
|
683
|
+
await installCometixLine(scriptLang);
|
|
684
|
+
break;
|
|
685
|
+
case "2":
|
|
686
|
+
await runCometixPrintConfig(scriptLang);
|
|
687
|
+
break;
|
|
688
|
+
case "0":
|
|
689
|
+
return false;
|
|
690
|
+
}
|
|
691
|
+
if (choice !== "0") {
|
|
692
|
+
console.log("\n" + ansis.dim("\u2500".repeat(50)) + "\n");
|
|
693
|
+
const { continueInCometix } = await inquirer.prompt({
|
|
694
|
+
type: "confirm",
|
|
695
|
+
name: "continueInCometix",
|
|
696
|
+
message: i18n.common.returnToMenu,
|
|
697
|
+
default: true
|
|
698
|
+
});
|
|
699
|
+
if (continueInCometix) {
|
|
700
|
+
return await showCometixMenu(scriptLang);
|
|
701
|
+
}
|
|
702
|
+
}
|
|
703
|
+
return false;
|
|
704
|
+
} catch (error) {
|
|
705
|
+
if (!handleExitPromptError(error)) {
|
|
706
|
+
handleGeneralError(error, scriptLang);
|
|
707
|
+
}
|
|
708
|
+
return false;
|
|
709
|
+
}
|
|
710
|
+
}
|
|
711
|
+
|
|
645
712
|
function getValidLanguage(lang) {
|
|
646
713
|
return lang && lang in I18N ? lang : "en";
|
|
647
714
|
}
|
|
@@ -712,6 +779,10 @@ async function runCcrMenuFeature(scriptLang) {
|
|
|
712
779
|
const validLang = getValidLanguage(scriptLang);
|
|
713
780
|
await showCcrMenu(validLang);
|
|
714
781
|
}
|
|
782
|
+
async function runCometixMenuFeature(scriptLang) {
|
|
783
|
+
const validLang = getValidLanguage(scriptLang);
|
|
784
|
+
await showCometixMenu(validLang);
|
|
785
|
+
}
|
|
715
786
|
|
|
716
787
|
async function update(options = {}) {
|
|
717
788
|
try {
|
|
@@ -817,6 +888,9 @@ async function showMainMenu() {
|
|
|
817
888
|
console.log(
|
|
818
889
|
` ${ansis.cyan("U.")} ${i18n.menu.menuOptions.ccusage} ${ansis.gray("- " + i18n.menu.menuDescriptions.ccusage)}`
|
|
819
890
|
);
|
|
891
|
+
console.log(
|
|
892
|
+
` ${ansis.cyan("L.")} ${i18n.menu.menuOptions.cometixLine} ${ansis.gray("- " + i18n.menu.menuDescriptions.cometixLine)}`
|
|
893
|
+
);
|
|
820
894
|
console.log("");
|
|
821
895
|
console.log(" ------------ ZCF ------------");
|
|
822
896
|
console.log(
|
|
@@ -837,7 +911,7 @@ async function showMainMenu() {
|
|
|
837
911
|
name: "choice",
|
|
838
912
|
message: i18n.common.enterChoice,
|
|
839
913
|
validate: (value) => {
|
|
840
|
-
const valid = ["1", "2", "3", "4", "5", "6", "7", "r", "R", "u", "U", "0", "-", "+", "q", "Q"];
|
|
914
|
+
const valid = ["1", "2", "3", "4", "5", "6", "7", "r", "R", "u", "U", "l", "L", "0", "-", "+", "q", "Q"];
|
|
841
915
|
return valid.includes(value) || i18n.common.invalidChoice;
|
|
842
916
|
}
|
|
843
917
|
});
|
|
@@ -876,6 +950,10 @@ async function showMainMenu() {
|
|
|
876
950
|
case "U":
|
|
877
951
|
await runCcusageFeature(scriptLang);
|
|
878
952
|
break;
|
|
953
|
+
case "l":
|
|
954
|
+
case "L":
|
|
955
|
+
await runCometixMenuFeature(scriptLang);
|
|
956
|
+
break;
|
|
879
957
|
case "0":
|
|
880
958
|
const newLang = await changeScriptLanguageFeature(scriptLang);
|
|
881
959
|
if (newLang !== scriptLang) {
|
|
@@ -894,7 +972,7 @@ async function showMainMenu() {
|
|
|
894
972
|
break;
|
|
895
973
|
}
|
|
896
974
|
if (!exitMenu && choice.toLowerCase() !== "q") {
|
|
897
|
-
if (choice === "0" || choice === "-" || choice === "+" || choice.toLowerCase() === "u" || choice.toLowerCase() === "r") {
|
|
975
|
+
if (choice === "0" || choice === "-" || choice === "+" || choice.toLowerCase() === "u" || choice.toLowerCase() === "r" || choice.toLowerCase() === "l") {
|
|
898
976
|
console.log("\n" + ansis.dim("\u2500".repeat(50)) + "\n");
|
|
899
977
|
continue;
|
|
900
978
|
}
|
|
@@ -1035,8 +1113,8 @@ function customizeHelp(sections) {
|
|
|
1035
1113
|
` ${ansis.cyan("npx zcf ccu monthly --json")}`,
|
|
1036
1114
|
"",
|
|
1037
1115
|
ansis.gray(" # Check and update tools / \u68C0\u67E5\u5E76\u66F4\u65B0\u5DE5\u5177"),
|
|
1038
|
-
` ${ansis.cyan("npx zcf check-updates")} ${ansis.gray("# Update Claude Code and
|
|
1039
|
-
` ${ansis.cyan("npx zcf check")}
|
|
1116
|
+
` ${ansis.cyan("npx zcf check-updates")} ${ansis.gray("# Update Claude Code, CCR and CCometixLine")}`,
|
|
1117
|
+
` ${ansis.cyan("npx zcf check")}`,
|
|
1040
1118
|
"",
|
|
1041
1119
|
ansis.gray(" # Force overwrite with Chinese config / \u5F3A\u5236\u4F7F\u7528\u4E2D\u6587\u914D\u7F6E\u8986\u76D6"),
|
|
1042
1120
|
` ${ansis.cyan("npx zcf --init -c zh-CN -f")}`,
|
package/dist/index.d.mts
CHANGED
package/dist/index.d.ts
CHANGED
package/package.json
CHANGED