ccman 3.3.23 → 3.3.25
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 +12 -8
- package/dist/index.js +151 -240
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -226,32 +226,36 @@ ccman mcp remove # 删除 MCP 服务器
|
|
|
226
226
|
|
|
227
227
|
添加服务商时可以选择"使用预设模板",只需填写 API Key:
|
|
228
228
|
|
|
229
|
-
### Claude Code 预设(
|
|
229
|
+
### Claude Code 预设(3 个)
|
|
230
230
|
|
|
231
|
-
| 预设名称 | Base URL
|
|
232
|
-
| ------------------ |
|
|
233
|
-
| Anthropic Official | `https://api.anthropic.com`
|
|
234
|
-
| GMN | `https://gmn.chuangzuoli.com
|
|
231
|
+
| 预设名称 | Base URL |
|
|
232
|
+
| ------------------ | --------------------------- |
|
|
233
|
+
| Anthropic Official | `https://api.anthropic.com` |
|
|
234
|
+
| GMN | `https://gmn.chuangzuoli.com` |
|
|
235
|
+
| GMN1 | `https://gmncode.cn` |
|
|
235
236
|
|
|
236
|
-
### Gemini CLI 预设(
|
|
237
|
+
### Gemini CLI 预设(3 个)
|
|
237
238
|
|
|
238
239
|
| 预设名称 | Base URL |
|
|
239
240
|
| ----------------------- | ----------------------------- |
|
|
240
241
|
| Google Gemini (API Key) | 官方默认 |
|
|
241
242
|
| GMN | `https://gmn.chuangzuoli.com` |
|
|
243
|
+
| GMN1 | `https://gmncode.cn` |
|
|
242
244
|
|
|
243
|
-
### Codex 预设(
|
|
245
|
+
### Codex 预设(3 个)
|
|
244
246
|
|
|
245
247
|
| 预设名称 | Base URL |
|
|
246
248
|
| --------------- | ----------------------------- |
|
|
247
249
|
| OpenAI Official | `https://api.openai.com/v1` |
|
|
248
250
|
| GMN | `https://gmn.chuangzuoli.com` |
|
|
251
|
+
| GMN1 | `https://gmncode.cn` |
|
|
249
252
|
|
|
250
|
-
### OpenCode 预设(
|
|
253
|
+
### OpenCode 预设(2 个)
|
|
251
254
|
|
|
252
255
|
| 预设名称 | Base URL |
|
|
253
256
|
| -------- | ----------------------------- |
|
|
254
257
|
| GMN | `https://gmn.chuangzuoli.com` |
|
|
258
|
+
| GMN1 | `https://gmncode.cn` |
|
|
255
259
|
|
|
256
260
|
### MCP 预设(多个)
|
|
257
261
|
|
package/dist/index.js
CHANGED
|
@@ -698,22 +698,43 @@ var init_mcp = __esm({
|
|
|
698
698
|
}
|
|
699
699
|
});
|
|
700
700
|
|
|
701
|
+
// ../core/dist/presets/gmn.js
|
|
702
|
+
function createDualGmnPresets(transformBaseUrl = (baseUrl) => baseUrl) {
|
|
703
|
+
return [
|
|
704
|
+
{
|
|
705
|
+
name: "GMN",
|
|
706
|
+
baseUrl: transformBaseUrl(GMN_ROOT_URL),
|
|
707
|
+
description: "GMN \u4E3B\u57DF\u540D\u7EBF\u8DEF (gmn.chuangzuoli.com)"
|
|
708
|
+
},
|
|
709
|
+
{
|
|
710
|
+
name: "GMN1",
|
|
711
|
+
baseUrl: transformBaseUrl(GMN1_ROOT_URL),
|
|
712
|
+
description: "GMN1 \u5907\u7528\u57DF\u540D\u7EBF\u8DEF (gmncode.cn)"
|
|
713
|
+
}
|
|
714
|
+
];
|
|
715
|
+
}
|
|
716
|
+
var GMN_ROOT_URL, GMN1_ROOT_URL;
|
|
717
|
+
var init_gmn = __esm({
|
|
718
|
+
"../core/dist/presets/gmn.js"() {
|
|
719
|
+
"use strict";
|
|
720
|
+
GMN_ROOT_URL = "https://gmn.chuangzuoli.com";
|
|
721
|
+
GMN1_ROOT_URL = "https://gmncode.cn";
|
|
722
|
+
}
|
|
723
|
+
});
|
|
724
|
+
|
|
701
725
|
// ../core/dist/presets/codex.js
|
|
702
726
|
var CODEX_PRESETS;
|
|
703
727
|
var init_codex2 = __esm({
|
|
704
728
|
"../core/dist/presets/codex.js"() {
|
|
705
729
|
"use strict";
|
|
730
|
+
init_gmn();
|
|
706
731
|
CODEX_PRESETS = [
|
|
707
732
|
{
|
|
708
733
|
name: "OpenAI Official",
|
|
709
734
|
baseUrl: "https://api.openai.com/v1",
|
|
710
735
|
description: "OpenAI \u5B98\u65B9 API"
|
|
711
736
|
},
|
|
712
|
-
|
|
713
|
-
name: "GMN",
|
|
714
|
-
baseUrl: "https://gmn.chuangzuoli.com",
|
|
715
|
-
description: "GMN \u670D\u52A1 (OpenAI/Codex \u517C\u5BB9)"
|
|
716
|
-
}
|
|
737
|
+
...createDualGmnPresets()
|
|
717
738
|
];
|
|
718
739
|
}
|
|
719
740
|
});
|
|
@@ -723,17 +744,14 @@ var CC_PRESETS;
|
|
|
723
744
|
var init_claude2 = __esm({
|
|
724
745
|
"../core/dist/presets/claude.js"() {
|
|
725
746
|
"use strict";
|
|
747
|
+
init_gmn();
|
|
726
748
|
CC_PRESETS = [
|
|
727
749
|
{
|
|
728
750
|
name: "Anthropic Official",
|
|
729
751
|
baseUrl: "https://api.anthropic.com",
|
|
730
752
|
description: "Anthropic \u5B98\u65B9 API"
|
|
731
753
|
},
|
|
732
|
-
|
|
733
|
-
name: "GMN",
|
|
734
|
-
baseUrl: "https://gmn.chuangzuoli.com/api",
|
|
735
|
-
description: "GMN \u670D\u52A1 (Claude \u517C\u5BB9)"
|
|
736
|
-
}
|
|
754
|
+
...createDualGmnPresets()
|
|
737
755
|
];
|
|
738
756
|
}
|
|
739
757
|
});
|
|
@@ -813,17 +831,14 @@ var GEMINI_PRESETS;
|
|
|
813
831
|
var init_gemini = __esm({
|
|
814
832
|
"../core/dist/presets/gemini.js"() {
|
|
815
833
|
"use strict";
|
|
834
|
+
init_gmn();
|
|
816
835
|
GEMINI_PRESETS = [
|
|
817
836
|
{
|
|
818
837
|
name: "Google Gemini (API Key)",
|
|
819
838
|
baseUrl: "",
|
|
820
839
|
description: "\u4F7F\u7528\u5B98\u65B9 Gemini API\uFF08\u901A\u8FC7 GEMINI_API_KEY \u6216 GOOGLE_API_KEY \u8BA4\u8BC1\uFF09"
|
|
821
840
|
},
|
|
822
|
-
|
|
823
|
-
name: "GMN",
|
|
824
|
-
baseUrl: "https://gmn.chuangzuoli.com",
|
|
825
|
-
description: "GMN \u670D\u52A1 (Gemini \u517C\u5BB9)"
|
|
826
|
-
}
|
|
841
|
+
...createDualGmnPresets()
|
|
827
842
|
];
|
|
828
843
|
}
|
|
829
844
|
});
|
|
@@ -833,13 +848,8 @@ var OPENCODE_PRESETS;
|
|
|
833
848
|
var init_opencode = __esm({
|
|
834
849
|
"../core/dist/presets/opencode.js"() {
|
|
835
850
|
"use strict";
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
name: "GMN",
|
|
839
|
-
baseUrl: "https://gmn.chuangzuoli.com",
|
|
840
|
-
description: "GMN \u670D\u52A1 (OpenCode \u517C\u5BB9)"
|
|
841
|
-
}
|
|
842
|
-
];
|
|
851
|
+
init_gmn();
|
|
852
|
+
OPENCODE_PRESETS = [...createDualGmnPresets()];
|
|
843
853
|
}
|
|
844
854
|
});
|
|
845
855
|
|
|
@@ -848,12 +858,9 @@ var OPENCLAW_PRESETS;
|
|
|
848
858
|
var init_openclaw = __esm({
|
|
849
859
|
"../core/dist/presets/openclaw.js"() {
|
|
850
860
|
"use strict";
|
|
861
|
+
init_gmn();
|
|
851
862
|
OPENCLAW_PRESETS = [
|
|
852
|
-
{
|
|
853
|
-
name: "GMN",
|
|
854
|
-
baseUrl: "https://gmn.chuangzuoli.com/v1",
|
|
855
|
-
description: "GMN \u670D\u52A1 (OpenClaw \u517C\u5BB9)"
|
|
856
|
-
}
|
|
863
|
+
...createDualGmnPresets((baseUrl) => `${baseUrl}/v1`)
|
|
857
864
|
];
|
|
858
865
|
}
|
|
859
866
|
});
|
|
@@ -2926,6 +2933,47 @@ var init_dist2 = __esm({
|
|
|
2926
2933
|
}
|
|
2927
2934
|
});
|
|
2928
2935
|
|
|
2936
|
+
// src/utils/confirm.ts
|
|
2937
|
+
import inquirer from "inquirer";
|
|
2938
|
+
function parseConfirmAnswer(value, defaultValue) {
|
|
2939
|
+
const normalized = value.trim().toLowerCase();
|
|
2940
|
+
if (normalized === "") {
|
|
2941
|
+
return defaultValue;
|
|
2942
|
+
}
|
|
2943
|
+
if (normalized === "y") {
|
|
2944
|
+
return true;
|
|
2945
|
+
}
|
|
2946
|
+
if (normalized === "n") {
|
|
2947
|
+
return false;
|
|
2948
|
+
}
|
|
2949
|
+
throw new Error(`\u65E0\u6548\u7684\u786E\u8BA4\u8F93\u5165: ${value}`);
|
|
2950
|
+
}
|
|
2951
|
+
async function promptConfirm(message, defaultValue = false) {
|
|
2952
|
+
const { answer } = await inquirer.prompt([
|
|
2953
|
+
{
|
|
2954
|
+
type: "input",
|
|
2955
|
+
name: "answer",
|
|
2956
|
+
message: `${message} (Y(y) / N(n))`,
|
|
2957
|
+
filter: (value) => value.trim(),
|
|
2958
|
+
validate: (value) => {
|
|
2959
|
+
if (value === "") {
|
|
2960
|
+
return true;
|
|
2961
|
+
}
|
|
2962
|
+
if (/^(y|n)$/i.test(value)) {
|
|
2963
|
+
return true;
|
|
2964
|
+
}
|
|
2965
|
+
return "\u8BF7\u8F93\u5165 Y \u6216 N";
|
|
2966
|
+
}
|
|
2967
|
+
}
|
|
2968
|
+
]);
|
|
2969
|
+
return parseConfirmAnswer(answer, defaultValue);
|
|
2970
|
+
}
|
|
2971
|
+
var init_confirm = __esm({
|
|
2972
|
+
"src/utils/confirm.ts"() {
|
|
2973
|
+
"use strict";
|
|
2974
|
+
}
|
|
2975
|
+
});
|
|
2976
|
+
|
|
2929
2977
|
// src/utils/sync-config.ts
|
|
2930
2978
|
function loadSyncConfig() {
|
|
2931
2979
|
try {
|
|
@@ -2965,7 +3013,7 @@ __export(config_exports, {
|
|
|
2965
3013
|
configCommand: () => configCommand
|
|
2966
3014
|
});
|
|
2967
3015
|
import chalk3 from "chalk";
|
|
2968
|
-
import
|
|
3016
|
+
import inquirer2 from "inquirer";
|
|
2969
3017
|
function configCommand(program2) {
|
|
2970
3018
|
program2.command("config").description("\u914D\u7F6E WebDAV \u8FDE\u63A5").action(async () => {
|
|
2971
3019
|
try {
|
|
@@ -2975,7 +3023,7 @@ function configCommand(program2) {
|
|
|
2975
3023
|
console.log(chalk3.blue("\u2139\uFE0F \u68C0\u6D4B\u5230\u5DF2\u6709\u914D\u7F6E\uFF0C\u53EF\u4EE5\u66F4\u65B0 WebDAV \u5B57\u6BB5"));
|
|
2976
3024
|
console.log(chalk3.gray(" \u7559\u7A7A\u8868\u793A\u4E0D\u66F4\u65B0\u8BE5\u5B57\u6BB5\n"));
|
|
2977
3025
|
}
|
|
2978
|
-
const answers = await
|
|
3026
|
+
const answers = await inquirer2.prompt([
|
|
2979
3027
|
{
|
|
2980
3028
|
type: "input",
|
|
2981
3029
|
name: "webdavUrl",
|
|
@@ -3026,14 +3074,12 @@ function configCommand(program2) {
|
|
|
3026
3074
|
name: "syncPassword",
|
|
3027
3075
|
message: existingConfig ? "\u540C\u6B65\u5BC6\u7801\uFF08\u7528\u4E8E\u52A0\u5BC6 API Key\uFF0C\u7559\u7A7A\u4E0D\u66F4\u65B0\uFF09:" : "\u540C\u6B65\u5BC6\u7801\uFF08\u7528\u4E8E\u52A0\u5BC6 API Key\uFF09:",
|
|
3028
3076
|
mask: "*"
|
|
3029
|
-
},
|
|
3030
|
-
{
|
|
3031
|
-
type: "confirm",
|
|
3032
|
-
name: "rememberSyncPassword",
|
|
3033
|
-
message: "\u8BB0\u4F4F\u540C\u6B65\u5BC6\u7801?",
|
|
3034
|
-
default: existingConfig?.rememberSyncPassword ?? true
|
|
3035
3077
|
}
|
|
3036
3078
|
]);
|
|
3079
|
+
const rememberSyncPassword = await promptConfirm(
|
|
3080
|
+
"\u8BB0\u4F4F\u540C\u6B65\u5BC6\u7801?",
|
|
3081
|
+
existingConfig?.rememberSyncPassword ?? true
|
|
3082
|
+
);
|
|
3037
3083
|
const trimmedAnswers = {
|
|
3038
3084
|
webdavUrl: answers.webdavUrl?.trim(),
|
|
3039
3085
|
username: answers.username?.trim(),
|
|
@@ -3041,7 +3087,7 @@ function configCommand(program2) {
|
|
|
3041
3087
|
authType: answers.authType,
|
|
3042
3088
|
remoteDir: answers.remoteDir?.trim(),
|
|
3043
3089
|
syncPassword: answers.syncPassword?.trim(),
|
|
3044
|
-
rememberSyncPassword
|
|
3090
|
+
rememberSyncPassword
|
|
3045
3091
|
};
|
|
3046
3092
|
if (existingConfig) {
|
|
3047
3093
|
const hasTextInput = trimmedAnswers.webdavUrl || trimmedAnswers.username || trimmedAnswers.password || trimmedAnswers.remoteDir || trimmedAnswers.syncPassword;
|
|
@@ -3123,14 +3169,7 @@ function configCommand(program2) {
|
|
|
3123
3169
|
console.log();
|
|
3124
3170
|
console.log(chalk3.gray("\u914D\u7F6E\u6587\u4EF6:"), getSyncConfigPath());
|
|
3125
3171
|
console.log();
|
|
3126
|
-
const
|
|
3127
|
-
{
|
|
3128
|
-
type: "confirm",
|
|
3129
|
-
name: "testNow",
|
|
3130
|
-
message: "\u662F\u5426\u7ACB\u5373\u6D4B\u8BD5\u8FDE\u63A5?",
|
|
3131
|
-
default: true
|
|
3132
|
-
}
|
|
3133
|
-
]);
|
|
3172
|
+
const testNow = await promptConfirm("\u662F\u5426\u7ACB\u5373\u6D4B\u8BD5\u8FDE\u63A5?", true);
|
|
3134
3173
|
if (testNow) {
|
|
3135
3174
|
console.log(chalk3.bold("\n\u{1F50D} \u6D4B\u8BD5 WebDAV \u8FDE\u63A5...\n"));
|
|
3136
3175
|
const success = await testWebDAVConnection(newConfig);
|
|
@@ -3164,11 +3203,11 @@ var init_config2 = __esm({
|
|
|
3164
3203
|
"use strict";
|
|
3165
3204
|
init_sync_config();
|
|
3166
3205
|
init_dist2();
|
|
3206
|
+
init_confirm();
|
|
3167
3207
|
}
|
|
3168
3208
|
});
|
|
3169
3209
|
|
|
3170
3210
|
// src/commands/sync/helpers.ts
|
|
3171
|
-
import inquirer2 from "inquirer";
|
|
3172
3211
|
import chalk4 from "chalk";
|
|
3173
3212
|
import { Command } from "commander";
|
|
3174
3213
|
async function ensureConfigExists() {
|
|
@@ -3177,14 +3216,7 @@ async function ensureConfigExists() {
|
|
|
3177
3216
|
return config;
|
|
3178
3217
|
}
|
|
3179
3218
|
console.log(chalk4.yellow("\n\u26A0\uFE0F \u672A\u627E\u5230 WebDAV \u914D\u7F6E\n"));
|
|
3180
|
-
const
|
|
3181
|
-
{
|
|
3182
|
-
type: "confirm",
|
|
3183
|
-
name: "shouldConfig",
|
|
3184
|
-
message: "\u662F\u5426\u73B0\u5728\u914D\u7F6E WebDAV?",
|
|
3185
|
-
default: true
|
|
3186
|
-
}
|
|
3187
|
-
]);
|
|
3219
|
+
const shouldConfig = await promptConfirm("\u662F\u5426\u73B0\u5728\u914D\u7F6E WebDAV?", true);
|
|
3188
3220
|
if (!shouldConfig) {
|
|
3189
3221
|
return null;
|
|
3190
3222
|
}
|
|
@@ -3198,6 +3230,7 @@ var init_helpers = __esm({
|
|
|
3198
3230
|
"src/commands/sync/helpers.ts"() {
|
|
3199
3231
|
"use strict";
|
|
3200
3232
|
init_sync_config();
|
|
3233
|
+
init_confirm();
|
|
3201
3234
|
}
|
|
3202
3235
|
});
|
|
3203
3236
|
|
|
@@ -3294,14 +3327,7 @@ function uploadCommand(program2) {
|
|
|
3294
3327
|
console.log();
|
|
3295
3328
|
console.log(chalk6.yellow("\u26A0\uFE0F \u4E91\u7AEF\u73B0\u6709\u914D\u7F6E\u5C06\u88AB\u8986\u76D6"));
|
|
3296
3329
|
console.log();
|
|
3297
|
-
const
|
|
3298
|
-
{
|
|
3299
|
-
type: "confirm",
|
|
3300
|
-
name: "confirm",
|
|
3301
|
-
message: "\u786E\u8BA4\u4E0A\u4F20?",
|
|
3302
|
-
default: false
|
|
3303
|
-
}
|
|
3304
|
-
]);
|
|
3330
|
+
const confirm = await promptConfirm("\u786E\u8BA4\u4E0A\u4F20?", false);
|
|
3305
3331
|
if (!confirm) {
|
|
3306
3332
|
console.log(chalk6.gray("\n\u274C \u5DF2\u53D6\u6D88\n"));
|
|
3307
3333
|
return;
|
|
@@ -3332,6 +3358,7 @@ var init_upload = __esm({
|
|
|
3332
3358
|
"use strict";
|
|
3333
3359
|
init_dist2();
|
|
3334
3360
|
init_helpers();
|
|
3361
|
+
init_confirm();
|
|
3335
3362
|
}
|
|
3336
3363
|
});
|
|
3337
3364
|
|
|
@@ -3366,14 +3393,7 @@ function downloadCommand(program2) {
|
|
|
3366
3393
|
console.log(chalk7.bold("\n\u{1F4E5} \u4ECE\u4E91\u7AEF\u4E0B\u8F7D\u914D\u7F6E\n"));
|
|
3367
3394
|
console.log(chalk7.yellow("\u26A0\uFE0F \u5C06\u8986\u76D6\u672C\u5730\u914D\u7F6E\uFF08\u81EA\u52A8\u5907\u4EFD\uFF09"));
|
|
3368
3395
|
console.log();
|
|
3369
|
-
const
|
|
3370
|
-
{
|
|
3371
|
-
type: "confirm",
|
|
3372
|
-
name: "confirm",
|
|
3373
|
-
message: "\u786E\u8BA4\u4E0B\u8F7D?",
|
|
3374
|
-
default: false
|
|
3375
|
-
}
|
|
3376
|
-
]);
|
|
3396
|
+
const confirm = await promptConfirm("\u786E\u8BA4\u4E0B\u8F7D?", false);
|
|
3377
3397
|
if (!confirm) {
|
|
3378
3398
|
console.log(chalk7.gray("\n\u274C \u5DF2\u53D6\u6D88\n"));
|
|
3379
3399
|
return;
|
|
@@ -3406,6 +3426,7 @@ var init_download = __esm({
|
|
|
3406
3426
|
"use strict";
|
|
3407
3427
|
init_dist2();
|
|
3408
3428
|
init_helpers();
|
|
3429
|
+
init_confirm();
|
|
3409
3430
|
}
|
|
3410
3431
|
});
|
|
3411
3432
|
|
|
@@ -3712,6 +3733,7 @@ function formatProviderTable(providers, currentId) {
|
|
|
3712
3733
|
}
|
|
3713
3734
|
|
|
3714
3735
|
// src/interactive.ts
|
|
3736
|
+
init_confirm();
|
|
3715
3737
|
var CLI_TOOL_CONFIG = {
|
|
3716
3738
|
[TOOL_TYPES.CODEX]: { name: "Codex", emoji: "\u{1F536}", cmd: "cx" },
|
|
3717
3739
|
[TOOL_TYPES.CLAUDE]: { name: "Claude", emoji: "\u{1F537}", cmd: "cc" },
|
|
@@ -3994,14 +4016,7 @@ async function handleAdd(tool) {
|
|
|
3994
4016
|
console.log(` ${chalk11.bold(provider.name)} ${chalk11.blue(`[${toolName}]`)}`);
|
|
3995
4017
|
console.log(` ${chalk11.gray(provider.baseUrl)}`);
|
|
3996
4018
|
console.log();
|
|
3997
|
-
const
|
|
3998
|
-
{
|
|
3999
|
-
type: "confirm",
|
|
4000
|
-
name: "switchNow",
|
|
4001
|
-
message: "\u662F\u5426\u7ACB\u5373\u5207\u6362\u5230\u6B64\u670D\u52A1\u5546?",
|
|
4002
|
-
default: true
|
|
4003
|
-
}
|
|
4004
|
-
]);
|
|
4019
|
+
const switchNow = await promptConfirm("\u662F\u5426\u7ACB\u5373\u5207\u6362\u5230\u6B64\u670D\u52A1\u5546?", true);
|
|
4005
4020
|
if (switchNow) {
|
|
4006
4021
|
manager.switch(provider.id);
|
|
4007
4022
|
console.log(chalk11.green("\u2705 \u5DF2\u5207\u6362\u5230\u65B0\u670D\u52A1\u5546\n"));
|
|
@@ -4198,14 +4213,7 @@ async function handleRemove(tool) {
|
|
|
4198
4213
|
}
|
|
4199
4214
|
]);
|
|
4200
4215
|
const provider = providers.find((p) => p.id === providerId);
|
|
4201
|
-
const
|
|
4202
|
-
{
|
|
4203
|
-
type: "confirm",
|
|
4204
|
-
name: "confirm",
|
|
4205
|
-
message: `\u786E\u5B9A\u8981\u5220\u9664 "${provider.name}" \u5417?`,
|
|
4206
|
-
default: false
|
|
4207
|
-
}
|
|
4208
|
-
]);
|
|
4216
|
+
const confirm = await promptConfirm(`\u786E\u5B9A\u8981\u5220\u9664 "${provider.name}" \u5417?`, false);
|
|
4209
4217
|
if (confirm) {
|
|
4210
4218
|
manager.remove(providerId);
|
|
4211
4219
|
console.log(chalk11.green(`
|
|
@@ -4217,6 +4225,7 @@ async function handleRemove(tool) {
|
|
|
4217
4225
|
}
|
|
4218
4226
|
|
|
4219
4227
|
// src/commands/codex/add.ts
|
|
4228
|
+
init_confirm();
|
|
4220
4229
|
function addCommand(program2) {
|
|
4221
4230
|
program2.command("add").description("\u6DFB\u52A0\u65B0\u7684 Codex \u670D\u52A1\u5546(\u4EA4\u4E92\u5F0F)").action(async () => {
|
|
4222
4231
|
try {
|
|
@@ -4309,14 +4318,7 @@ function addCommand(program2) {
|
|
|
4309
4318
|
console.log(` ${chalk12.bold(provider.name)} ${chalk12.blue("[Codex]")}`);
|
|
4310
4319
|
console.log(` ${chalk12.gray(provider.baseUrl)}`);
|
|
4311
4320
|
console.log();
|
|
4312
|
-
const
|
|
4313
|
-
{
|
|
4314
|
-
type: "confirm",
|
|
4315
|
-
name: "switchNow",
|
|
4316
|
-
message: "\u662F\u5426\u7ACB\u5373\u5207\u6362\u5230\u6B64\u670D\u52A1\u5546?",
|
|
4317
|
-
default: true
|
|
4318
|
-
}
|
|
4319
|
-
]);
|
|
4321
|
+
const switchNow = await promptConfirm("\u662F\u5426\u7ACB\u5373\u5207\u6362\u5230\u6B64\u670D\u52A1\u5546?", true);
|
|
4320
4322
|
if (switchNow) {
|
|
4321
4323
|
manager.switch(provider.id);
|
|
4322
4324
|
console.log(chalk12.green("\u2705 \u5DF2\u5207\u6362\u5230\u65B0\u670D\u52A1\u5546"));
|
|
@@ -4458,6 +4460,7 @@ function currentCommand(program2) {
|
|
|
4458
4460
|
|
|
4459
4461
|
// src/commands/codex/remove.ts
|
|
4460
4462
|
init_dist2();
|
|
4463
|
+
init_confirm();
|
|
4461
4464
|
import chalk16 from "chalk";
|
|
4462
4465
|
import inquirer10 from "inquirer";
|
|
4463
4466
|
function removeCommand(program2) {
|
|
@@ -4494,14 +4497,7 @@ function removeCommand(program2) {
|
|
|
4494
4497
|
targetId = selectedId;
|
|
4495
4498
|
targetName = provider.name;
|
|
4496
4499
|
}
|
|
4497
|
-
const
|
|
4498
|
-
{
|
|
4499
|
-
type: "confirm",
|
|
4500
|
-
name: "confirmed",
|
|
4501
|
-
message: `\u786E\u5B9A\u5220\u9664 "${targetName}"?`,
|
|
4502
|
-
default: false
|
|
4503
|
-
}
|
|
4504
|
-
]);
|
|
4500
|
+
const confirmed = await promptConfirm(`\u786E\u5B9A\u5220\u9664 "${targetName}"?`, false);
|
|
4505
4501
|
if (!confirmed) {
|
|
4506
4502
|
console.log(chalk16.gray("\n\u5DF2\u53D6\u6D88\n"));
|
|
4507
4503
|
return;
|
|
@@ -4696,6 +4692,7 @@ function createCodexCommands(program2) {
|
|
|
4696
4692
|
init_dist2();
|
|
4697
4693
|
import chalk19 from "chalk";
|
|
4698
4694
|
import inquirer13 from "inquirer";
|
|
4695
|
+
init_confirm();
|
|
4699
4696
|
function addCommand2(program2) {
|
|
4700
4697
|
program2.command("add").description("\u6DFB\u52A0\u65B0\u7684 Claude Code \u670D\u52A1\u5546(\u4EA4\u4E92\u5F0F)").action(async () => {
|
|
4701
4698
|
try {
|
|
@@ -4788,14 +4785,7 @@ function addCommand2(program2) {
|
|
|
4788
4785
|
console.log(` ${chalk19.bold(provider.name)} ${chalk19.blue("[Claude Code]")}`);
|
|
4789
4786
|
console.log(` ${chalk19.gray(provider.baseUrl)}`);
|
|
4790
4787
|
console.log();
|
|
4791
|
-
const
|
|
4792
|
-
{
|
|
4793
|
-
type: "confirm",
|
|
4794
|
-
name: "switchNow",
|
|
4795
|
-
message: "\u662F\u5426\u7ACB\u5373\u5207\u6362\u5230\u6B64\u670D\u52A1\u5546?",
|
|
4796
|
-
default: true
|
|
4797
|
-
}
|
|
4798
|
-
]);
|
|
4788
|
+
const switchNow = await promptConfirm("\u662F\u5426\u7ACB\u5373\u5207\u6362\u5230\u6B64\u670D\u52A1\u5546?", true);
|
|
4799
4789
|
if (switchNow) {
|
|
4800
4790
|
manager.switch(provider.id);
|
|
4801
4791
|
console.log(chalk19.green("\u2705 \u5DF2\u5207\u6362\u5230\u65B0\u670D\u52A1\u5546"));
|
|
@@ -4935,6 +4925,7 @@ function currentCommand2(program2) {
|
|
|
4935
4925
|
|
|
4936
4926
|
// src/commands/claude/remove.ts
|
|
4937
4927
|
init_dist2();
|
|
4928
|
+
init_confirm();
|
|
4938
4929
|
import chalk23 from "chalk";
|
|
4939
4930
|
import inquirer15 from "inquirer";
|
|
4940
4931
|
function removeCommand2(program2) {
|
|
@@ -4971,14 +4962,7 @@ function removeCommand2(program2) {
|
|
|
4971
4962
|
targetId = selectedId;
|
|
4972
4963
|
targetName = provider.name;
|
|
4973
4964
|
}
|
|
4974
|
-
const
|
|
4975
|
-
{
|
|
4976
|
-
type: "confirm",
|
|
4977
|
-
name: "confirmed",
|
|
4978
|
-
message: `\u786E\u5B9A\u5220\u9664 "${targetName}"?`,
|
|
4979
|
-
default: false
|
|
4980
|
-
}
|
|
4981
|
-
]);
|
|
4965
|
+
const confirmed = await promptConfirm(`\u786E\u5B9A\u5220\u9664 "${targetName}"?`, false);
|
|
4982
4966
|
if (!confirmed) {
|
|
4983
4967
|
console.log(chalk23.gray("\n\u5DF2\u53D6\u6D88\n"));
|
|
4984
4968
|
return;
|
|
@@ -5160,6 +5144,7 @@ function cloneCommand2(program2) {
|
|
|
5160
5144
|
|
|
5161
5145
|
// src/commands/clean.ts
|
|
5162
5146
|
init_dist2();
|
|
5147
|
+
init_confirm();
|
|
5163
5148
|
import chalk26 from "chalk";
|
|
5164
5149
|
import inquirer18 from "inquirer";
|
|
5165
5150
|
function formatBytes2(bytes) {
|
|
@@ -5217,14 +5202,7 @@ function cleanCommand(program2) {
|
|
|
5217
5202
|
} else {
|
|
5218
5203
|
cleanOptions = await promptForOptions(analysis);
|
|
5219
5204
|
}
|
|
5220
|
-
const
|
|
5221
|
-
{
|
|
5222
|
-
type: "confirm",
|
|
5223
|
-
name: "confirmed",
|
|
5224
|
-
message: "\u786E\u8BA4\u6267\u884C\u6E05\u7406\uFF1F\uFF08\u4F1A\u81EA\u52A8\u5907\u4EFD\u539F\u6587\u4EF6\uFF09",
|
|
5225
|
-
default: true
|
|
5226
|
-
}
|
|
5227
|
-
]);
|
|
5205
|
+
const confirmed = await promptConfirm("\u786E\u8BA4\u6267\u884C\u6E05\u7406\uFF1F\uFF08\u4F1A\u81EA\u52A8\u5907\u4EFD\u539F\u6587\u4EF6\uFF09", true);
|
|
5228
5206
|
if (!confirmed) {
|
|
5229
5207
|
console.log(chalk26.yellow("\n\u274C \u5DF2\u53D6\u6D88\n"));
|
|
5230
5208
|
return;
|
|
@@ -5327,38 +5305,26 @@ async function promptForOptions(analysis) {
|
|
|
5327
5305
|
return CleanPresets.aggressive();
|
|
5328
5306
|
}
|
|
5329
5307
|
}
|
|
5330
|
-
const
|
|
5331
|
-
|
|
5332
|
-
|
|
5333
|
-
|
|
5334
|
-
|
|
5335
|
-
|
|
5336
|
-
|
|
5337
|
-
|
|
5338
|
-
|
|
5339
|
-
|
|
5340
|
-
|
|
5341
|
-
|
|
5342
|
-
|
|
5343
|
-
|
|
5344
|
-
|
|
5345
|
-
type: "confirm",
|
|
5346
|
-
name: "cleanCache",
|
|
5347
|
-
message: "\u6E05\u7406\u7F13\u5B58\u6570\u636E\uFF1F",
|
|
5348
|
-
default: true
|
|
5349
|
-
},
|
|
5350
|
-
{
|
|
5351
|
-
type: "confirm",
|
|
5352
|
-
name: "cleanStats",
|
|
5353
|
-
message: "\u91CD\u7F6E\u4F7F\u7528\u7EDF\u8BA1\uFF1F",
|
|
5354
|
-
default: false
|
|
5355
|
-
}
|
|
5356
|
-
]);
|
|
5308
|
+
const cleanHistory = await promptConfirm("\u6E05\u7406\u9879\u76EE\u5386\u53F2\u8BB0\u5F55\uFF1F", true);
|
|
5309
|
+
let keepCount = 10;
|
|
5310
|
+
if (cleanHistory) {
|
|
5311
|
+
const answers2 = await inquirer18.prompt([
|
|
5312
|
+
{
|
|
5313
|
+
type: "number",
|
|
5314
|
+
name: "keepCount",
|
|
5315
|
+
message: "\u6BCF\u4E2A\u9879\u76EE\u4FDD\u7559\u6700\u8FD1\u591A\u5C11\u6761\u8BB0\u5F55\uFF1F",
|
|
5316
|
+
default: 10
|
|
5317
|
+
}
|
|
5318
|
+
]);
|
|
5319
|
+
keepCount = answers2.keepCount;
|
|
5320
|
+
}
|
|
5321
|
+
const cleanCache = await promptConfirm("\u6E05\u7406\u7F13\u5B58\u6570\u636E\uFF1F", true);
|
|
5322
|
+
const cleanStats = await promptConfirm("\u91CD\u7F6E\u4F7F\u7528\u7EDF\u8BA1\uFF1F", false);
|
|
5357
5323
|
return {
|
|
5358
|
-
cleanProjectHistory:
|
|
5359
|
-
keepRecentCount:
|
|
5360
|
-
cleanCache
|
|
5361
|
-
cleanStats
|
|
5324
|
+
cleanProjectHistory: cleanHistory,
|
|
5325
|
+
keepRecentCount: cleanHistory ? keepCount || 0 : 0,
|
|
5326
|
+
cleanCache,
|
|
5327
|
+
cleanStats
|
|
5362
5328
|
};
|
|
5363
5329
|
}
|
|
5364
5330
|
|
|
@@ -5584,6 +5550,7 @@ function listCommand3(program2) {
|
|
|
5584
5550
|
|
|
5585
5551
|
// src/commands/mcp/remove.ts
|
|
5586
5552
|
init_dist2();
|
|
5553
|
+
init_confirm();
|
|
5587
5554
|
import chalk29 from "chalk";
|
|
5588
5555
|
import inquirer20 from "inquirer";
|
|
5589
5556
|
function removeCommand3(program2) {
|
|
@@ -5620,14 +5587,7 @@ function removeCommand3(program2) {
|
|
|
5620
5587
|
targetId = selectedId;
|
|
5621
5588
|
targetName = provider.name;
|
|
5622
5589
|
}
|
|
5623
|
-
const
|
|
5624
|
-
{
|
|
5625
|
-
type: "confirm",
|
|
5626
|
-
name: "confirmed",
|
|
5627
|
-
message: `\u786E\u5B9A\u5220\u9664 "${targetName}"?`,
|
|
5628
|
-
default: false
|
|
5629
|
-
}
|
|
5630
|
-
]);
|
|
5590
|
+
const confirmed = await promptConfirm(`\u786E\u5B9A\u5220\u9664 "${targetName}"?`, false);
|
|
5631
5591
|
if (!confirmed) {
|
|
5632
5592
|
console.log(chalk29.gray("\n\u5DF2\u53D6\u6D88\n"));
|
|
5633
5593
|
return;
|
|
@@ -5780,6 +5740,7 @@ function createMCPCommands(program2) {
|
|
|
5780
5740
|
init_dist2();
|
|
5781
5741
|
import chalk31 from "chalk";
|
|
5782
5742
|
import inquirer22 from "inquirer";
|
|
5743
|
+
init_confirm();
|
|
5783
5744
|
function addCommand4(program2) {
|
|
5784
5745
|
program2.command("add").description("\u6DFB\u52A0\u65B0\u7684 Gemini CLI \u670D\u52A1\u5546(\u4EA4\u4E92\u5F0F)").action(async () => {
|
|
5785
5746
|
try {
|
|
@@ -5868,14 +5829,7 @@ function addCommand4(program2) {
|
|
|
5868
5829
|
console.log(` ${chalk31.bold(provider.name)} ${chalk31.blue("[Gemini CLI]")}`);
|
|
5869
5830
|
console.log(` ${chalk31.gray(provider.baseUrl || "(\u4F7F\u7528\u9ED8\u8BA4\u7AEF\u70B9)")}`);
|
|
5870
5831
|
console.log();
|
|
5871
|
-
const
|
|
5872
|
-
{
|
|
5873
|
-
type: "confirm",
|
|
5874
|
-
name: "switchNow",
|
|
5875
|
-
message: "\u662F\u5426\u7ACB\u5373\u5207\u6362\u5230\u6B64\u670D\u52A1\u5546?",
|
|
5876
|
-
default: true
|
|
5877
|
-
}
|
|
5878
|
-
]);
|
|
5832
|
+
const switchNow = await promptConfirm("\u662F\u5426\u7ACB\u5373\u5207\u6362\u5230\u6B64\u670D\u52A1\u5546?", true);
|
|
5879
5833
|
if (switchNow) {
|
|
5880
5834
|
manager.switch(provider.id);
|
|
5881
5835
|
console.log(chalk31.green("\u2705 \u5DF2\u5207\u6362\u5230\u65B0\u670D\u52A1\u5546"));
|
|
@@ -6012,6 +5966,7 @@ function currentCommand3(program2) {
|
|
|
6012
5966
|
|
|
6013
5967
|
// src/commands/gemini/remove.ts
|
|
6014
5968
|
init_dist2();
|
|
5969
|
+
init_confirm();
|
|
6015
5970
|
import chalk35 from "chalk";
|
|
6016
5971
|
import inquirer24 from "inquirer";
|
|
6017
5972
|
function removeCommand4(program2) {
|
|
@@ -6052,14 +6007,7 @@ function removeCommand4(program2) {
|
|
|
6052
6007
|
targetId = provider.id;
|
|
6053
6008
|
targetName = provider.name;
|
|
6054
6009
|
}
|
|
6055
|
-
const
|
|
6056
|
-
{
|
|
6057
|
-
type: "confirm",
|
|
6058
|
-
name: "confirm",
|
|
6059
|
-
message: `\u786E\u5B9A\u8981\u5220\u9664\u670D\u52A1\u5546 "${targetName}" \u5417\uFF1F`,
|
|
6060
|
-
default: false
|
|
6061
|
-
}
|
|
6062
|
-
]);
|
|
6010
|
+
const confirm = await promptConfirm(`\u786E\u5B9A\u8981\u5220\u9664\u670D\u52A1\u5546 "${targetName}" \u5417\uFF1F`, false);
|
|
6063
6011
|
if (!confirm) {
|
|
6064
6012
|
console.log(chalk35.gray("\n\u5DF2\u53D6\u6D88\u5220\u9664\n"));
|
|
6065
6013
|
return;
|
|
@@ -6216,6 +6164,7 @@ function createGeminiCommands(program2) {
|
|
|
6216
6164
|
init_dist2();
|
|
6217
6165
|
import chalk38 from "chalk";
|
|
6218
6166
|
import inquirer27 from "inquirer";
|
|
6167
|
+
init_confirm();
|
|
6219
6168
|
function addCommand5(program2) {
|
|
6220
6169
|
program2.command("add").description("\u6DFB\u52A0\u65B0\u7684 OpenCode \u670D\u52A1\u5546(\u4EA4\u4E92\u5F0F)").action(async () => {
|
|
6221
6170
|
try {
|
|
@@ -6307,14 +6256,7 @@ function addCommand5(program2) {
|
|
|
6307
6256
|
console.log(` ${chalk38.bold(provider.name)} ${chalk38.blue("[OpenCode]")}`);
|
|
6308
6257
|
console.log(` ${chalk38.gray(provider.baseUrl)}`);
|
|
6309
6258
|
console.log();
|
|
6310
|
-
const
|
|
6311
|
-
{
|
|
6312
|
-
type: "confirm",
|
|
6313
|
-
name: "switchNow",
|
|
6314
|
-
message: "\u662F\u5426\u7ACB\u5373\u5207\u6362\u5230\u6B64\u670D\u52A1\u5546?",
|
|
6315
|
-
default: true
|
|
6316
|
-
}
|
|
6317
|
-
]);
|
|
6259
|
+
const switchNow = await promptConfirm("\u662F\u5426\u7ACB\u5373\u5207\u6362\u5230\u6B64\u670D\u52A1\u5546?", true);
|
|
6318
6260
|
if (switchNow) {
|
|
6319
6261
|
manager.switch(provider.id);
|
|
6320
6262
|
console.log(chalk38.green("\u2705 \u5DF2\u5207\u6362\u5230\u65B0\u670D\u52A1\u5546"));
|
|
@@ -6509,6 +6451,7 @@ function editCommand5(program2) {
|
|
|
6509
6451
|
|
|
6510
6452
|
// src/commands/opencode/remove.ts
|
|
6511
6453
|
init_dist2();
|
|
6454
|
+
init_confirm();
|
|
6512
6455
|
import chalk43 from "chalk";
|
|
6513
6456
|
import inquirer30 from "inquirer";
|
|
6514
6457
|
function removeCommand5(program2) {
|
|
@@ -6545,14 +6488,7 @@ function removeCommand5(program2) {
|
|
|
6545
6488
|
targetId = selectedId;
|
|
6546
6489
|
targetName = provider.name;
|
|
6547
6490
|
}
|
|
6548
|
-
const
|
|
6549
|
-
{
|
|
6550
|
-
type: "confirm",
|
|
6551
|
-
name: "confirmed",
|
|
6552
|
-
message: `\u786E\u5B9A\u5220\u9664 "${targetName}"?`,
|
|
6553
|
-
default: false
|
|
6554
|
-
}
|
|
6555
|
-
]);
|
|
6491
|
+
const confirmed = await promptConfirm(`\u786E\u5B9A\u5220\u9664 "${targetName}"?`, false);
|
|
6556
6492
|
if (!confirmed) {
|
|
6557
6493
|
console.log(chalk43.gray("\n\u5DF2\u53D6\u6D88\n"));
|
|
6558
6494
|
return;
|
|
@@ -6662,6 +6598,7 @@ function createOpenCodeCommands(program2) {
|
|
|
6662
6598
|
init_dist2();
|
|
6663
6599
|
import chalk45 from "chalk";
|
|
6664
6600
|
import inquirer32 from "inquirer";
|
|
6601
|
+
init_confirm();
|
|
6665
6602
|
function addCommand6(program2) {
|
|
6666
6603
|
program2.command("add").description("\u6DFB\u52A0\u65B0\u7684 OpenClaw \u670D\u52A1\u5546(\u4EA4\u4E92\u5F0F)").action(async () => {
|
|
6667
6604
|
try {
|
|
@@ -6753,14 +6690,7 @@ function addCommand6(program2) {
|
|
|
6753
6690
|
console.log(` ${chalk45.bold(provider.name)} ${chalk45.blue("[OpenClaw]")}`);
|
|
6754
6691
|
console.log(` ${chalk45.gray(provider.baseUrl)}`);
|
|
6755
6692
|
console.log();
|
|
6756
|
-
const
|
|
6757
|
-
{
|
|
6758
|
-
type: "confirm",
|
|
6759
|
-
name: "switchNow",
|
|
6760
|
-
message: "\u662F\u5426\u7ACB\u5373\u5207\u6362\u5230\u6B64\u670D\u52A1\u5546?",
|
|
6761
|
-
default: true
|
|
6762
|
-
}
|
|
6763
|
-
]);
|
|
6693
|
+
const switchNow = await promptConfirm("\u662F\u5426\u7ACB\u5373\u5207\u6362\u5230\u6B64\u670D\u52A1\u5546?", true);
|
|
6764
6694
|
if (switchNow) {
|
|
6765
6695
|
manager.switch(provider.id);
|
|
6766
6696
|
console.log(chalk45.green("\u2705 \u5DF2\u5207\u6362\u5230\u65B0\u670D\u52A1\u5546"));
|
|
@@ -6959,6 +6889,7 @@ function editCommand6(program2) {
|
|
|
6959
6889
|
|
|
6960
6890
|
// src/commands/openclaw/remove.ts
|
|
6961
6891
|
init_dist2();
|
|
6892
|
+
init_confirm();
|
|
6962
6893
|
import chalk50 from "chalk";
|
|
6963
6894
|
import inquirer35 from "inquirer";
|
|
6964
6895
|
function removeCommand6(program2) {
|
|
@@ -6995,14 +6926,7 @@ function removeCommand6(program2) {
|
|
|
6995
6926
|
targetId = selectedId;
|
|
6996
6927
|
targetName = provider.name;
|
|
6997
6928
|
}
|
|
6998
|
-
const
|
|
6999
|
-
{
|
|
7000
|
-
type: "confirm",
|
|
7001
|
-
name: "confirmed",
|
|
7002
|
-
message: `\u786E\u5B9A\u5220\u9664 "${targetName}"?`,
|
|
7003
|
-
default: false
|
|
7004
|
-
}
|
|
7005
|
-
]);
|
|
6929
|
+
const confirmed = await promptConfirm(`\u786E\u5B9A\u5220\u9664 "${targetName}"?`, false);
|
|
7006
6930
|
if (!confirmed) {
|
|
7007
6931
|
console.log(chalk50.gray("\n\u5DF2\u53D6\u6D88\n"));
|
|
7008
6932
|
return;
|
|
@@ -7156,8 +7080,8 @@ function exportCommand(program2) {
|
|
|
7156
7080
|
|
|
7157
7081
|
// src/commands/import.ts
|
|
7158
7082
|
init_dist2();
|
|
7083
|
+
init_confirm();
|
|
7159
7084
|
import chalk53 from "chalk";
|
|
7160
|
-
import inquirer37 from "inquirer";
|
|
7161
7085
|
import path14 from "path";
|
|
7162
7086
|
function importCommand(program2) {
|
|
7163
7087
|
program2.command("import <\u6E90\u76EE\u5F55>").description("\u4ECE\u672C\u5730\u76EE\u5F55\u5BFC\u5165\u914D\u7F6E\uFF08\u4F1A\u8986\u76D6\u5F53\u524D\u914D\u7F6E\uFF09").action(async (sourceDir) => {
|
|
@@ -7182,14 +7106,7 @@ function importCommand(program2) {
|
|
|
7182
7106
|
console.log();
|
|
7183
7107
|
console.log(chalk53.gray("\u5F53\u524D\u914D\u7F6E\u5C06\u88AB\u8986\u76D6\uFF08\u81EA\u52A8\u5907\u4EFD\uFF09"));
|
|
7184
7108
|
console.log();
|
|
7185
|
-
const
|
|
7186
|
-
{
|
|
7187
|
-
type: "confirm",
|
|
7188
|
-
name: "confirmFirst",
|
|
7189
|
-
message: "\u786E\u8BA4\u5BFC\u5165\uFF1F",
|
|
7190
|
-
default: false
|
|
7191
|
-
}
|
|
7192
|
-
]);
|
|
7109
|
+
const confirmFirst = await promptConfirm("\u786E\u8BA4\u5BFC\u5165\uFF1F", false);
|
|
7193
7110
|
if (!confirmFirst) {
|
|
7194
7111
|
console.log(chalk53.gray("\n\u274C \u5DF2\u53D6\u6D88\n"));
|
|
7195
7112
|
return;
|
|
@@ -7197,14 +7114,7 @@ function importCommand(program2) {
|
|
|
7197
7114
|
console.log();
|
|
7198
7115
|
console.log(chalk53.red.bold("\u26A0\uFE0F \u6700\u540E\u786E\u8BA4\uFF1A\u6B64\u64CD\u4F5C\u5C06\u8986\u76D6\u6240\u6709\u5F53\u524D\u914D\u7F6E\uFF01"));
|
|
7199
7116
|
console.log();
|
|
7200
|
-
const
|
|
7201
|
-
{
|
|
7202
|
-
type: "confirm",
|
|
7203
|
-
name: "confirmSecond",
|
|
7204
|
-
message: "\u771F\u7684\u8981\u7EE7\u7EED\u5417\uFF1F",
|
|
7205
|
-
default: false
|
|
7206
|
-
}
|
|
7207
|
-
]);
|
|
7117
|
+
const confirmSecond = await promptConfirm("\u771F\u7684\u8981\u7EE7\u7EED\u5417\uFF1F", false);
|
|
7208
7118
|
if (!confirmSecond) {
|
|
7209
7119
|
console.log(chalk53.gray("\n\u274C \u5DF2\u53D6\u6D88\n"));
|
|
7210
7120
|
return;
|
|
@@ -7243,7 +7153,7 @@ init_dist2();
|
|
|
7243
7153
|
import fs13 from "fs";
|
|
7244
7154
|
import path15 from "path";
|
|
7245
7155
|
import chalk54 from "chalk";
|
|
7246
|
-
import
|
|
7156
|
+
import inquirer37 from "inquirer";
|
|
7247
7157
|
|
|
7248
7158
|
// src/utils/endpoint-latency.ts
|
|
7249
7159
|
import { request as httpRequest } from "http";
|
|
@@ -7362,6 +7272,7 @@ function pickDefaultEndpoint(results) {
|
|
|
7362
7272
|
var GMN_PROFILE = {
|
|
7363
7273
|
commandName: "gmn",
|
|
7364
7274
|
title: "GMN",
|
|
7275
|
+
defaultProviderName: "gmn",
|
|
7365
7276
|
endpointGroupLabel: "GMN \u57DF\u540D\u7EBF\u8DEF",
|
|
7366
7277
|
endpointGroupDescription: "\u4EC5\u5305\u542B\u4E3B\u57DF\u540D\u548C CDN \u7684 2 \u6761\u5730\u5740",
|
|
7367
7278
|
baseUrls: [
|
|
@@ -7380,6 +7291,7 @@ var GMN_PROFILE = {
|
|
|
7380
7291
|
var GMN1_PROFILE = {
|
|
7381
7292
|
commandName: "gmn1",
|
|
7382
7293
|
title: "GMN1",
|
|
7294
|
+
defaultProviderName: "gmn1",
|
|
7383
7295
|
endpointGroupLabel: "\u6269\u5C55\u52A0\u901F\u7EBF\u8DEF",
|
|
7384
7296
|
endpointGroupDescription: "\u5305\u542B\u9664 chuangzuoli \u4E4B\u5916\u7684\u5176\u4F59 5 \u6761\u5730\u5740",
|
|
7385
7297
|
baseUrls: [
|
|
@@ -7419,7 +7331,6 @@ function formatEndpointChoiceLabel(result, index) {
|
|
|
7419
7331
|
}
|
|
7420
7332
|
|
|
7421
7333
|
// src/commands/gmn.ts
|
|
7422
|
-
var DEFAULT_PROVIDER_NAME2 = "gmn";
|
|
7423
7334
|
var VALID_PLATFORMS = ["codex", "opencode", "openclaw"];
|
|
7424
7335
|
var DEFAULT_PLATFORMS = ["codex", "opencode"];
|
|
7425
7336
|
var TOTAL_STEPS = 4;
|
|
@@ -7494,7 +7405,7 @@ function parsePlatforms(platformArg) {
|
|
|
7494
7405
|
return platforms;
|
|
7495
7406
|
}
|
|
7496
7407
|
async function promptApiKey(title) {
|
|
7497
|
-
const answers = await
|
|
7408
|
+
const answers = await inquirer37.prompt([
|
|
7498
7409
|
{
|
|
7499
7410
|
type: "password",
|
|
7500
7411
|
name: "apiKey",
|
|
@@ -7509,7 +7420,7 @@ async function promptApiKey(title) {
|
|
|
7509
7420
|
return answers.apiKey.trim();
|
|
7510
7421
|
}
|
|
7511
7422
|
async function promptPlatforms(title) {
|
|
7512
|
-
const answers = await
|
|
7423
|
+
const answers = await inquirer37.prompt([
|
|
7513
7424
|
{
|
|
7514
7425
|
type: "checkbox",
|
|
7515
7426
|
name: "platforms",
|
|
@@ -7604,7 +7515,7 @@ async function resolveOpenAiBaseUrl(profile, platforms, baseUrlArg) {
|
|
|
7604
7515
|
console.log(chalk54.yellow(`\u975E\u4EA4\u4E92\u73AF\u5883\uFF0C\u5DF2\u81EA\u52A8\u4F7F\u7528\u9ED8\u8BA4\u5730\u5740\uFF1A${defaultResult.url}`));
|
|
7605
7516
|
return defaultResult.url;
|
|
7606
7517
|
}
|
|
7607
|
-
const answers = await
|
|
7518
|
+
const answers = await inquirer37.prompt([
|
|
7608
7519
|
{
|
|
7609
7520
|
type: "list",
|
|
7610
7521
|
name: "baseUrl",
|
|
@@ -7618,16 +7529,16 @@ async function resolveOpenAiBaseUrl(profile, platforms, baseUrlArg) {
|
|
|
7618
7529
|
]);
|
|
7619
7530
|
return answers.baseUrl;
|
|
7620
7531
|
}
|
|
7621
|
-
function resolveProviderName2(providerNameArg) {
|
|
7532
|
+
function resolveProviderName2(profile, providerNameArg) {
|
|
7622
7533
|
if (providerNameArg === void 0) {
|
|
7623
|
-
return
|
|
7534
|
+
return profile.defaultProviderName;
|
|
7624
7535
|
}
|
|
7625
7536
|
const providerName = providerNameArg.trim();
|
|
7626
7537
|
if (!providerName) {
|
|
7627
7538
|
throw new Error("\u670D\u52A1\u5546\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A");
|
|
7628
7539
|
}
|
|
7629
|
-
if (providerName.toLowerCase() ===
|
|
7630
|
-
return
|
|
7540
|
+
if (providerName.toLowerCase() === profile.defaultProviderName) {
|
|
7541
|
+
return profile.defaultProviderName;
|
|
7631
7542
|
}
|
|
7632
7543
|
return providerName;
|
|
7633
7544
|
}
|
|
@@ -7715,7 +7626,7 @@ async function runGmnCommand(profile, apiKey, platformArg, providerNameArg, base
|
|
|
7715
7626
|
console.log(chalk54.cyan(`
|
|
7716
7627
|
${renderStep(1, TOTAL_STEPS, "\u9009\u62E9\u8981\u914D\u7F6E\u7684\u5DE5\u5177")}`));
|
|
7717
7628
|
platforms = await resolvePlatforms(platformArg, profile.title);
|
|
7718
|
-
providerName = resolveProviderName2(providerNameArg);
|
|
7629
|
+
providerName = resolveProviderName2(profile, providerNameArg);
|
|
7719
7630
|
} catch (error) {
|
|
7720
7631
|
console.error(chalk54.red(`\u274C ${error.message}`));
|
|
7721
7632
|
process.exit(1);
|
|
@@ -7947,7 +7858,7 @@ importCommand(program);
|
|
|
7947
7858
|
program.command("gmn [apiKey]").description("\u914D\u7F6E GMN \u5230 Codex\u3001OpenCode\u3001OpenClaw\uFF08\u6D4B\u901F\u5E76\u9009\u62E9\u6700\u4F4E\u5EF6\u8FDF\u8DEF\u7EBF\uFF09").option("-p, --platform <platforms>", "\u6307\u5B9A\u5E73\u53F0 (codex,opencode,openclaw,all)").option("-n, --name <providerName>", "\u6307\u5B9A\u670D\u52A1\u5546\u540D\u79F0\uFF08\u9ED8\u8BA4: gmn\uFF09").option("-b, --base-url <baseUrl>", "\u6307\u5B9A Base URL\uFF1B\u4E0D\u6307\u5B9A\u65F6\u81EA\u52A8\u6D4B\u901F\u5E76\u53EF\u624B\u52A8\u5207\u6362").action(async (apiKey, options) => {
|
|
7948
7859
|
await gmnCommand(apiKey, options.platform, options.name, options.baseUrl);
|
|
7949
7860
|
});
|
|
7950
|
-
program.command("gmn1 [apiKey]").alias("gmncode").description("\u914D\u7F6E GMN1 \u5230 Codex\u3001OpenCode\u3001OpenClaw\uFF08\u6D4B\u901F\u5E76\u9009\u62E9\u6700\u4F4E\u5EF6\u8FDF\u8DEF\u7EBF\uFF09").option("-p, --platform <platforms>", "\u6307\u5B9A\u5E73\u53F0 (codex,opencode,openclaw,all)").option("-n, --name <providerName>", "\u6307\u5B9A\u670D\u52A1\u5546\u540D\u79F0\uFF08\u9ED8\u8BA4:
|
|
7861
|
+
program.command("gmn1 [apiKey]").alias("gmncode").description("\u914D\u7F6E GMN1 \u5230 Codex\u3001OpenCode\u3001OpenClaw\uFF08\u6D4B\u901F\u5E76\u9009\u62E9\u6700\u4F4E\u5EF6\u8FDF\u8DEF\u7EBF\uFF09").option("-p, --platform <platforms>", "\u6307\u5B9A\u5E73\u53F0 (codex,opencode,openclaw,all)").option("-n, --name <providerName>", "\u6307\u5B9A\u670D\u52A1\u5546\u540D\u79F0\uFF08\u9ED8\u8BA4: gmn1\uFF09").option("-b, --base-url <baseUrl>", "\u6307\u5B9A Base URL\uFF1B\u4E0D\u6307\u5B9A\u65F6\u81EA\u52A8\u6D4B\u901F\u5E76\u53EF\u624B\u52A8\u5207\u6362").action(async (apiKey, options) => {
|
|
7951
7862
|
await gmn1Command(apiKey, options.platform, options.name, options.baseUrl);
|
|
7952
7863
|
});
|
|
7953
7864
|
(async () => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ccman",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.25",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Manage Codex, Claude Code, Gemini CLI, OpenCode, OpenClaw, and MCP API service provider configurations",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
"scripts": {
|
|
15
15
|
"build": "tsup",
|
|
16
16
|
"dev": "NODE_ENV=development tsx src/index.ts",
|
|
17
|
+
"test": "tsx --test src/utils/*.test.ts",
|
|
17
18
|
"clean": "rm -rf dist"
|
|
18
19
|
},
|
|
19
20
|
"keywords": [
|