ccman 3.3.24 → 3.3.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -304,12 +304,28 @@ function loadCodexTemplateConfig() {
304
304
  return CODEX_DEFAULT_CONFIG;
305
305
  }
306
306
  function removeDeprecatedKeys(config) {
307
- if (config.features && typeof config.features === "object" && !Array.isArray(config.features) && "web_search_request" in config.features) {
308
- delete config.features.web_search_request;
307
+ const deprecatedFeatureKeys = [
308
+ "web_search_request",
309
+ "web_search_cached",
310
+ "web_search",
311
+ "plan_tool",
312
+ "view_image_tool",
313
+ "streamable_shell",
314
+ "rmcp_client"
315
+ ];
316
+ if (config.features && typeof config.features === "object" && !Array.isArray(config.features)) {
317
+ const features = config.features;
318
+ for (const key of deprecatedFeatureKeys) {
319
+ if (key in features)
320
+ delete features[key];
321
+ }
309
322
  }
310
323
  if ("web_search_request" in config) {
311
324
  delete config.web_search_request;
312
325
  }
326
+ if ("network_access" in config) {
327
+ delete config.network_access;
328
+ }
313
329
  }
314
330
  function loadExistingCodexConfig(configPath) {
315
331
  if (!fileExists(configPath)) {
@@ -402,7 +418,12 @@ var init_codex = __esm({
402
418
  __dirname = path3.dirname(__filename);
403
419
  CODEX_DEFAULT_CONFIG = {
404
420
  model: "gpt-5.4",
421
+ review_model: "gpt-5.4",
405
422
  model_reasoning_effort: "xhigh",
423
+ plan_mode_reasoning_effort: "xhigh",
424
+ model_reasoning_summary: "auto",
425
+ model_verbosity: "high",
426
+ personality: "pragmatic",
406
427
  disable_response_storage: true,
407
428
  sandbox_mode: "danger-full-access",
408
429
  windows_wsl_setup_acknowledged: true,
@@ -425,13 +446,14 @@ var init_codex = __esm({
425
446
  network_access: true
426
447
  },
427
448
  features: {
428
- plan_tool: true,
429
449
  apply_patch_freeform: true,
430
- view_image_tool: true,
431
450
  unified_exec: false,
432
- streamable_shell: false,
433
- rmcp_client: true,
434
- elevated_windows_sandbox: true
451
+ elevated_windows_sandbox: true,
452
+ multi_agent: true,
453
+ shell_tool: true,
454
+ shell_snapshot: true,
455
+ fast_mode: true,
456
+ personality: true
435
457
  },
436
458
  profiles: {
437
459
  "auto-max": {
@@ -448,7 +470,7 @@ var init_codex = __esm({
448
470
  }
449
471
  };
450
472
  GMN_PROVIDER_HOSTS = [
451
- "gmn.chuangzuoli.com",
473
+ "ai.gmncode.com",
452
474
  "cdn-gmn.chuangzuoli.com",
453
475
  "gmncodex.com",
454
476
  "gmncode.cn",
@@ -698,22 +720,43 @@ var init_mcp = __esm({
698
720
  }
699
721
  });
700
722
 
723
+ // ../core/dist/presets/gmn.js
724
+ function createDualGmnPresets(transformBaseUrl = (baseUrl) => baseUrl) {
725
+ return [
726
+ {
727
+ name: "GMN",
728
+ baseUrl: transformBaseUrl(GMN_ROOT_URL),
729
+ description: "GMN \u4E3B\u57DF\u540D\u7EBF\u8DEF (ai.gmncode.com)"
730
+ },
731
+ {
732
+ name: "GMN1",
733
+ baseUrl: transformBaseUrl(GMN1_ROOT_URL),
734
+ description: "GMN1 \u5907\u7528\u57DF\u540D\u7EBF\u8DEF (gmncode.cn)"
735
+ }
736
+ ];
737
+ }
738
+ var GMN_ROOT_URL, GMN1_ROOT_URL;
739
+ var init_gmn = __esm({
740
+ "../core/dist/presets/gmn.js"() {
741
+ "use strict";
742
+ GMN_ROOT_URL = "https://ai.gmncode.com";
743
+ GMN1_ROOT_URL = "https://gmncode.cn";
744
+ }
745
+ });
746
+
701
747
  // ../core/dist/presets/codex.js
702
748
  var CODEX_PRESETS;
703
749
  var init_codex2 = __esm({
704
750
  "../core/dist/presets/codex.js"() {
705
751
  "use strict";
752
+ init_gmn();
706
753
  CODEX_PRESETS = [
707
754
  {
708
755
  name: "OpenAI Official",
709
756
  baseUrl: "https://api.openai.com/v1",
710
757
  description: "OpenAI \u5B98\u65B9 API"
711
758
  },
712
- {
713
- name: "GMN",
714
- baseUrl: "https://gmn.chuangzuoli.com",
715
- description: "GMN \u670D\u52A1 (OpenAI/Codex \u517C\u5BB9)"
716
- }
759
+ ...createDualGmnPresets()
717
760
  ];
718
761
  }
719
762
  });
@@ -723,17 +766,14 @@ var CC_PRESETS;
723
766
  var init_claude2 = __esm({
724
767
  "../core/dist/presets/claude.js"() {
725
768
  "use strict";
769
+ init_gmn();
726
770
  CC_PRESETS = [
727
771
  {
728
772
  name: "Anthropic Official",
729
773
  baseUrl: "https://api.anthropic.com",
730
774
  description: "Anthropic \u5B98\u65B9 API"
731
775
  },
732
- {
733
- name: "GMN",
734
- baseUrl: "https://gmn.chuangzuoli.com/api",
735
- description: "GMN \u670D\u52A1 (Claude \u517C\u5BB9)"
736
- }
776
+ ...createDualGmnPresets()
737
777
  ];
738
778
  }
739
779
  });
@@ -813,17 +853,14 @@ var GEMINI_PRESETS;
813
853
  var init_gemini = __esm({
814
854
  "../core/dist/presets/gemini.js"() {
815
855
  "use strict";
856
+ init_gmn();
816
857
  GEMINI_PRESETS = [
817
858
  {
818
859
  name: "Google Gemini (API Key)",
819
860
  baseUrl: "",
820
861
  description: "\u4F7F\u7528\u5B98\u65B9 Gemini API\uFF08\u901A\u8FC7 GEMINI_API_KEY \u6216 GOOGLE_API_KEY \u8BA4\u8BC1\uFF09"
821
862
  },
822
- {
823
- name: "GMN",
824
- baseUrl: "https://gmn.chuangzuoli.com",
825
- description: "GMN \u670D\u52A1 (Gemini \u517C\u5BB9)"
826
- }
863
+ ...createDualGmnPresets()
827
864
  ];
828
865
  }
829
866
  });
@@ -833,13 +870,8 @@ var OPENCODE_PRESETS;
833
870
  var init_opencode = __esm({
834
871
  "../core/dist/presets/opencode.js"() {
835
872
  "use strict";
836
- OPENCODE_PRESETS = [
837
- {
838
- name: "GMN",
839
- baseUrl: "https://gmn.chuangzuoli.com",
840
- description: "GMN \u670D\u52A1 (OpenCode \u517C\u5BB9)"
841
- }
842
- ];
873
+ init_gmn();
874
+ OPENCODE_PRESETS = [...createDualGmnPresets()];
843
875
  }
844
876
  });
845
877
 
@@ -848,12 +880,9 @@ var OPENCLAW_PRESETS;
848
880
  var init_openclaw = __esm({
849
881
  "../core/dist/presets/openclaw.js"() {
850
882
  "use strict";
883
+ init_gmn();
851
884
  OPENCLAW_PRESETS = [
852
- {
853
- name: "GMN",
854
- baseUrl: "https://gmn.chuangzuoli.com/v1",
855
- description: "GMN \u670D\u52A1 (OpenClaw \u517C\u5BB9)"
856
- }
885
+ ...createDualGmnPresets((baseUrl) => `${baseUrl}/v1`)
857
886
  ];
858
887
  }
859
888
  });
@@ -3000,23 +3029,303 @@ var init_sync_config = __esm({
3000
3029
  }
3001
3030
  });
3002
3031
 
3032
+ // src/commands/sync/helpers.ts
3033
+ import chalk5 from "chalk";
3034
+ import { Command, Option } from "commander";
3035
+ import inquirer2 from "inquirer";
3036
+ function normalizeText(value) {
3037
+ if (value === void 0) {
3038
+ return void 0;
3039
+ }
3040
+ const trimmed = value.trim();
3041
+ return trimmed ? trimmed : void 0;
3042
+ }
3043
+ function resolveTextOption(cliValue, envKey, env) {
3044
+ return normalizeText(cliValue) ?? normalizeText(env[envKey]);
3045
+ }
3046
+ function resolveAuthType(cliValue, env) {
3047
+ const value = resolveTextOption(cliValue, SYNC_ENV_KEYS.authType, env);
3048
+ if (!value) {
3049
+ return void 0;
3050
+ }
3051
+ if (value === "password" || value === "digest") {
3052
+ return value;
3053
+ }
3054
+ throw new Error(`\u65E0\u6548\u7684\u8BA4\u8BC1\u7C7B\u578B: ${value}\uFF0C\u4EC5\u652F\u6301 password \u6216 digest`);
3055
+ }
3056
+ function hasSyncEnvInput(env) {
3057
+ return Object.values(SYNC_ENV_KEYS).some((key) => normalizeText(env[key]));
3058
+ }
3059
+ function formatMissingFields(fields) {
3060
+ const labels = {
3061
+ webdavUrl: "--webdav-url",
3062
+ username: "--username",
3063
+ password: "--password",
3064
+ authType: "--auth-type",
3065
+ remoteDir: "--remote-dir",
3066
+ syncPassword: "--sync-password"
3067
+ };
3068
+ return fields.map((field) => labels[field] || field).join(", ");
3069
+ }
3070
+ function addSyncConnectionOptions(command, options = {}) {
3071
+ command.option("--webdav-url <url>", `WebDAV \u670D\u52A1\u5668\u5730\u5740\uFF08\u6216\u73AF\u5883\u53D8\u91CF ${SYNC_ENV_KEYS.webdavUrl}\uFF09`).option("--username <username>", `WebDAV \u7528\u6237\u540D\uFF08\u6216\u73AF\u5883\u53D8\u91CF ${SYNC_ENV_KEYS.username}\uFF09`).option("--password <password>", `WebDAV \u5BC6\u7801\uFF08\u6216\u73AF\u5883\u53D8\u91CF ${SYNC_ENV_KEYS.password}\uFF09`).addOption(
3072
+ new Option(
3073
+ "--auth-type <type>",
3074
+ `\u8BA4\u8BC1\u7C7B\u578B\uFF08password|digest\uFF0C\u6216\u73AF\u5883\u53D8\u91CF ${SYNC_ENV_KEYS.authType}\uFF09`
3075
+ ).choices(["password", "digest"])
3076
+ ).option("--remote-dir <dir>", `\u8FDC\u7A0B\u540C\u6B65\u76EE\u5F55\uFF08\u6216\u73AF\u5883\u53D8\u91CF ${SYNC_ENV_KEYS.remoteDir}\uFF09`);
3077
+ if (options.includeSyncPassword) {
3078
+ command.option(
3079
+ "--sync-password <password>",
3080
+ `\u540C\u6B65\u5BC6\u7801\uFF08\u6216\u73AF\u5883\u53D8\u91CF ${SYNC_ENV_KEYS.syncPassword}\uFF09`
3081
+ );
3082
+ }
3083
+ if (options.includeConfirm) {
3084
+ command.option("-y, --yes", "\u8DF3\u8FC7\u786E\u8BA4\u63D0\u793A");
3085
+ }
3086
+ if (options.includeRememberFlags) {
3087
+ command.option("--remember-sync-password", "\u4FDD\u5B58\u540C\u6B65\u5BC6\u7801\u5230\u672C\u5730\u914D\u7F6E").option("--forget-sync-password", "\u4E0D\u4FDD\u5B58\u540C\u6B65\u5BC6\u7801\u5230\u672C\u5730\u914D\u7F6E");
3088
+ }
3089
+ if (options.includeTestFlag) {
3090
+ command.option("--test", "\u4FDD\u5B58\u540E\u7ACB\u5373\u6D4B\u8BD5\u8FDE\u63A5");
3091
+ }
3092
+ }
3093
+ function collectSyncCommandInput(options = {}, env = process.env) {
3094
+ if (options.rememberSyncPassword && options.forgetSyncPassword) {
3095
+ throw new Error("\u4E0D\u80FD\u540C\u65F6\u4F7F\u7528 --remember-sync-password \u548C --forget-sync-password");
3096
+ }
3097
+ const overrides = {
3098
+ webdavUrl: resolveTextOption(options.webdavUrl, SYNC_ENV_KEYS.webdavUrl, env),
3099
+ username: resolveTextOption(options.username, SYNC_ENV_KEYS.username, env),
3100
+ password: resolveTextOption(options.password, SYNC_ENV_KEYS.password, env),
3101
+ authType: resolveAuthType(options.authType, env),
3102
+ remoteDir: resolveTextOption(options.remoteDir, SYNC_ENV_KEYS.remoteDir, env),
3103
+ syncPassword: resolveTextOption(options.syncPassword, SYNC_ENV_KEYS.syncPassword, env)
3104
+ };
3105
+ const rememberSyncPassword = options.rememberSyncPassword ? true : options.forgetSyncPassword ? false : void 0;
3106
+ const nonInteractive = options.yes === true || rememberSyncPassword !== void 0 || hasSyncEnvInput(env) || Object.values(overrides).some((value) => value !== void 0);
3107
+ return {
3108
+ overrides,
3109
+ rememberSyncPassword,
3110
+ yes: options.yes === true,
3111
+ shouldTest: options.test === true,
3112
+ nonInteractive
3113
+ };
3114
+ }
3115
+ function mergeSyncConfig(baseConfig, overrides) {
3116
+ return {
3117
+ ...baseConfig || {},
3118
+ ...Object.fromEntries(Object.entries(overrides).filter(([, value]) => value !== void 0))
3119
+ };
3120
+ }
3121
+ function getMissingConnectionFields(config) {
3122
+ return REQUIRED_CONNECTION_FIELDS.filter((field) => !normalizeText(config[field]));
3123
+ }
3124
+ function buildRuntimeSyncConfig(existingConfig, input) {
3125
+ return mergeSyncConfig(existingConfig, input.overrides);
3126
+ }
3127
+ function assertCompleteSyncConfig(config) {
3128
+ const missingFields = getMissingConnectionFields(config);
3129
+ if (missingFields.length > 0) {
3130
+ throw new Error(`\u7F3A\u5C11\u540C\u6B65\u914D\u7F6E\u53C2\u6570: ${formatMissingFields(missingFields)}`);
3131
+ }
3132
+ }
3133
+ async function ensureConfigExists(options = {}) {
3134
+ const existingConfig = loadSyncConfig();
3135
+ const input = collectSyncCommandInput(options);
3136
+ const mergedConfig = buildRuntimeSyncConfig(existingConfig, input);
3137
+ if (getMissingConnectionFields(mergedConfig).length === 0) {
3138
+ assertCompleteSyncConfig(mergedConfig);
3139
+ return mergedConfig;
3140
+ }
3141
+ if (input.nonInteractive) {
3142
+ assertCompleteSyncConfig(mergedConfig);
3143
+ }
3144
+ console.log(chalk5.yellow("\n\u26A0\uFE0F \u672A\u627E\u5230 WebDAV \u914D\u7F6E\n"));
3145
+ const shouldConfig = await promptConfirm("\u662F\u5426\u73B0\u5728\u914D\u7F6E WebDAV?", true);
3146
+ if (!shouldConfig) {
3147
+ return null;
3148
+ }
3149
+ const { configCommand: configCommand2 } = await Promise.resolve().then(() => (init_config2(), config_exports));
3150
+ const cmd = new Command();
3151
+ configCommand2(cmd);
3152
+ await cmd.parseAsync(["node", "ccman", "config"]);
3153
+ return loadSyncConfig();
3154
+ }
3155
+ async function resolveSyncPassword(config, options = {}) {
3156
+ const input = collectSyncCommandInput(options);
3157
+ const syncPassword = normalizeText(input.overrides.syncPassword) || normalizeText(config.syncPassword);
3158
+ if (syncPassword) {
3159
+ return syncPassword;
3160
+ }
3161
+ if (input.nonInteractive) {
3162
+ throw new Error(`\u7F3A\u5C11\u540C\u6B65\u5BC6\u7801: ${formatMissingFields(["syncPassword"])}`);
3163
+ }
3164
+ const { password } = await inquirer2.prompt([
3165
+ {
3166
+ type: "password",
3167
+ name: "password",
3168
+ message: "\u8BF7\u8F93\u5165\u540C\u6B65\u5BC6\u7801:",
3169
+ mask: "*",
3170
+ validate: (value) => value ? true : "\u540C\u6B65\u5BC6\u7801\u4E0D\u80FD\u4E3A\u7A7A"
3171
+ }
3172
+ ]);
3173
+ return password;
3174
+ }
3175
+ async function confirmOrExit(message, defaultValue, options = {}) {
3176
+ const input = collectSyncCommandInput(options);
3177
+ if (input.yes) {
3178
+ return true;
3179
+ }
3180
+ if (input.nonInteractive) {
3181
+ throw new Error(`\u975E\u4EA4\u4E92\u6A21\u5F0F\u8BF7\u901A\u8FC7 --yes \u786E\u8BA4\u64CD\u4F5C`);
3182
+ }
3183
+ return promptConfirm(message, defaultValue);
3184
+ }
3185
+ var SYNC_ENV_KEYS, REQUIRED_CONNECTION_FIELDS;
3186
+ var init_helpers = __esm({
3187
+ "src/commands/sync/helpers.ts"() {
3188
+ "use strict";
3189
+ init_sync_config();
3190
+ init_confirm();
3191
+ SYNC_ENV_KEYS = {
3192
+ webdavUrl: "CCMAN_WEBDAV_URL",
3193
+ username: "CCMAN_WEBDAV_USERNAME",
3194
+ password: "CCMAN_WEBDAV_PASSWORD",
3195
+ authType: "CCMAN_WEBDAV_AUTH_TYPE",
3196
+ remoteDir: "CCMAN_WEBDAV_REMOTE_DIR",
3197
+ syncPassword: "CCMAN_SYNC_PASSWORD"
3198
+ };
3199
+ REQUIRED_CONNECTION_FIELDS = ["webdavUrl", "username", "password"];
3200
+ }
3201
+ });
3202
+
3003
3203
  // src/commands/sync/config.ts
3004
3204
  var config_exports = {};
3005
3205
  __export(config_exports, {
3006
3206
  configCommand: () => configCommand
3007
3207
  });
3008
- import chalk3 from "chalk";
3009
- import inquirer2 from "inquirer";
3208
+ import chalk6 from "chalk";
3209
+ import inquirer3 from "inquirer";
3210
+ function validateWebdavUrl(url) {
3211
+ if (!url.startsWith("http://") && !url.startsWith("https://")) {
3212
+ throw new Error("WebDAV \u5730\u5740\u5FC5\u987B\u4EE5 http:// \u6216 https:// \u5F00\u5934");
3213
+ }
3214
+ }
3215
+ function hasConfigChanges(existingConfig, newConfig) {
3216
+ if (!existingConfig) {
3217
+ return true;
3218
+ }
3219
+ return existingConfig.webdavUrl !== newConfig.webdavUrl || existingConfig.username !== newConfig.username || existingConfig.password !== newConfig.password || existingConfig.authType !== newConfig.authType || existingConfig.remoteDir !== newConfig.remoteDir || existingConfig.syncPassword !== newConfig.syncPassword || existingConfig.rememberSyncPassword !== newConfig.rememberSyncPassword;
3220
+ }
3221
+ function buildConfigFromInput(existingConfig, input) {
3222
+ const nextConfig = existingConfig ? { ...existingConfig } : {
3223
+ webdavUrl: "",
3224
+ username: "",
3225
+ password: "",
3226
+ authType: "password",
3227
+ remoteDir: "/",
3228
+ syncPassword: void 0,
3229
+ rememberSyncPassword: true,
3230
+ lastSync: void 0
3231
+ };
3232
+ if (input.overrides.webdavUrl !== void 0) {
3233
+ nextConfig.webdavUrl = input.overrides.webdavUrl;
3234
+ }
3235
+ if (input.overrides.username !== void 0) {
3236
+ nextConfig.username = input.overrides.username;
3237
+ }
3238
+ if (input.overrides.password !== void 0) {
3239
+ nextConfig.password = input.overrides.password;
3240
+ }
3241
+ if (input.overrides.authType !== void 0) {
3242
+ nextConfig.authType = input.overrides.authType;
3243
+ }
3244
+ if (input.overrides.remoteDir !== void 0) {
3245
+ nextConfig.remoteDir = input.overrides.remoteDir;
3246
+ }
3247
+ if (input.overrides.syncPassword !== void 0) {
3248
+ nextConfig.syncPassword = input.overrides.syncPassword;
3249
+ }
3250
+ if (input.rememberSyncPassword !== void 0) {
3251
+ nextConfig.rememberSyncPassword = input.rememberSyncPassword;
3252
+ }
3253
+ nextConfig.authType = nextConfig.authType || "password";
3254
+ nextConfig.remoteDir = nextConfig.remoteDir || "/";
3255
+ nextConfig.rememberSyncPassword = nextConfig.rememberSyncPassword ?? true;
3256
+ const missingFields = getMissingConnectionFields(nextConfig);
3257
+ if (missingFields.length > 0) {
3258
+ throw new Error(
3259
+ `\u7F3A\u5C11\u540C\u6B65\u914D\u7F6E\u53C2\u6570: ${missingFields.map((field) => `--${field.replace(/[A-Z]/g, (m) => `-${m.toLowerCase()}`)}`).join(", ")}`
3260
+ );
3261
+ }
3262
+ validateWebdavUrl(nextConfig.webdavUrl);
3263
+ if (!existingConfig && !nextConfig.syncPassword) {
3264
+ throw new Error("\u7F3A\u5C11\u540C\u6B65\u914D\u7F6E\u53C2\u6570: --sync-password");
3265
+ }
3266
+ return nextConfig;
3267
+ }
3268
+ async function printConnectionTestResult(config) {
3269
+ console.log(chalk6.bold("\n\u{1F50D} \u6D4B\u8BD5 WebDAV \u8FDE\u63A5...\n"));
3270
+ const success = await testWebDAVConnection(config);
3271
+ if (success) {
3272
+ console.log(chalk6.green("\u2705 \u8FDE\u63A5\u6210\u529F"));
3273
+ console.log();
3274
+ console.log(" ", chalk6.gray("URL:"), config.webdavUrl);
3275
+ console.log(" ", chalk6.gray("\u7528\u6237:"), config.username);
3276
+ console.log(" ", chalk6.gray("\u8FDC\u7A0B\u76EE\u5F55:"), config.remoteDir || "/");
3277
+ console.log(
3278
+ " ",
3279
+ chalk6.gray("\u8BA4\u8BC1\u7C7B\u578B:"),
3280
+ config.authType === "password" ? "Basic Auth" : "Digest Auth"
3281
+ );
3282
+ console.log();
3283
+ return;
3284
+ }
3285
+ console.log(chalk6.red("\u274C \u8FDE\u63A5\u5931\u8D25"));
3286
+ console.log();
3287
+ console.log(chalk6.yellow("\u8BF7\u68C0\u67E5:"));
3288
+ console.log(" 1. WebDAV \u670D\u52A1\u5668\u5730\u5740\u662F\u5426\u6B63\u786E");
3289
+ console.log(" 2. \u7528\u6237\u540D\u548C\u5BC6\u7801\u662F\u5426\u6B63\u786E");
3290
+ console.log(" 3. \u7F51\u7EDC\u8FDE\u63A5\u662F\u5426\u6B63\u5E38");
3291
+ console.log();
3292
+ }
3010
3293
  function configCommand(program2) {
3011
- program2.command("config").description("\u914D\u7F6E WebDAV \u8FDE\u63A5").action(async () => {
3294
+ const command = program2.command("config").description("\u914D\u7F6E WebDAV \u8FDE\u63A5");
3295
+ addSyncConnectionOptions(command, {
3296
+ includeSyncPassword: true,
3297
+ includeRememberFlags: true,
3298
+ includeTestFlag: true
3299
+ });
3300
+ command.action(async (options) => {
3012
3301
  try {
3013
- console.log(chalk3.bold("\n\u2699\uFE0F \u914D\u7F6E WebDAV \u540C\u6B65\n"));
3302
+ console.log(chalk6.bold("\n\u2699\uFE0F \u914D\u7F6E WebDAV \u540C\u6B65\n"));
3014
3303
  const existingConfig = loadSyncConfig();
3304
+ const input = collectSyncCommandInput(options);
3305
+ if (input.nonInteractive) {
3306
+ const newConfig2 = buildConfigFromInput(existingConfig, input);
3307
+ if (!hasConfigChanges(existingConfig, newConfig2)) {
3308
+ console.log();
3309
+ console.log(chalk6.yellow("\u2139\uFE0F \u672A\u68C0\u6D4B\u5230\u914D\u7F6E\u53D8\u66F4\uFF0C\u4E0D\u9700\u8981\u66F4\u65B0"));
3310
+ console.log();
3311
+ return;
3312
+ }
3313
+ saveSyncConfig2(newConfig2);
3314
+ console.log();
3315
+ console.log(chalk6.green("\u2705 \u914D\u7F6E\u4FDD\u5B58\u6210\u529F"));
3316
+ console.log();
3317
+ console.log(chalk6.gray("\u914D\u7F6E\u6587\u4EF6:"), getSyncConfigPath());
3318
+ console.log();
3319
+ if (input.shouldTest) {
3320
+ await printConnectionTestResult(newConfig2);
3321
+ }
3322
+ return;
3323
+ }
3015
3324
  if (existingConfig) {
3016
- console.log(chalk3.blue("\u2139\uFE0F \u68C0\u6D4B\u5230\u5DF2\u6709\u914D\u7F6E\uFF0C\u53EF\u4EE5\u66F4\u65B0 WebDAV \u5B57\u6BB5"));
3017
- console.log(chalk3.gray(" \u7559\u7A7A\u8868\u793A\u4E0D\u66F4\u65B0\u8BE5\u5B57\u6BB5\n"));
3325
+ console.log(chalk6.blue("\u2139\uFE0F \u68C0\u6D4B\u5230\u5DF2\u6709\u914D\u7F6E\uFF0C\u53EF\u4EE5\u66F4\u65B0 WebDAV \u5B57\u6BB5"));
3326
+ console.log(chalk6.gray(" \u7559\u7A7A\u8868\u793A\u4E0D\u66F4\u65B0\u8BE5\u5B57\u6BB5\n"));
3018
3327
  }
3019
- const answers = await inquirer2.prompt([
3328
+ const answers = await inquirer3.prompt([
3020
3329
  {
3021
3330
  type: "input",
3022
3331
  name: "webdavUrl",
@@ -3087,7 +3396,7 @@ function configCommand(program2) {
3087
3396
  const hasSelectChange = trimmedAnswers.authType !== existingConfig.authType || trimmedAnswers.rememberSyncPassword !== existingConfig.rememberSyncPassword;
3088
3397
  if (!hasTextInput && !hasSelectChange) {
3089
3398
  console.log();
3090
- console.log(chalk3.yellow("\u2139\uFE0F \u672A\u68C0\u6D4B\u5230\u914D\u7F6E\u53D8\u66F4\uFF0C\u4E0D\u9700\u8981\u66F4\u65B0"));
3399
+ console.log(chalk6.yellow("\u2139\uFE0F \u672A\u68C0\u6D4B\u5230\u914D\u7F6E\u53D8\u66F4\uFF0C\u4E0D\u9700\u8981\u66F4\u65B0"));
3091
3400
  console.log();
3092
3401
  return;
3093
3402
  }
@@ -3152,40 +3461,22 @@ function configCommand(program2) {
3152
3461
  }
3153
3462
  if (!hasChanges && existingConfig) {
3154
3463
  console.log();
3155
- console.log(chalk3.yellow("\u2139\uFE0F \u672A\u68C0\u6D4B\u5230\u914D\u7F6E\u53D8\u66F4\uFF0C\u4E0D\u9700\u8981\u66F4\u65B0"));
3464
+ console.log(chalk6.yellow("\u2139\uFE0F \u672A\u68C0\u6D4B\u5230\u914D\u7F6E\u53D8\u66F4\uFF0C\u4E0D\u9700\u8981\u66F4\u65B0"));
3156
3465
  console.log();
3157
3466
  return;
3158
3467
  }
3159
3468
  saveSyncConfig2(newConfig);
3160
3469
  console.log();
3161
- console.log(chalk3.green("\u2705 \u914D\u7F6E\u4FDD\u5B58\u6210\u529F"));
3470
+ console.log(chalk6.green("\u2705 \u914D\u7F6E\u4FDD\u5B58\u6210\u529F"));
3162
3471
  console.log();
3163
- console.log(chalk3.gray("\u914D\u7F6E\u6587\u4EF6:"), getSyncConfigPath());
3472
+ console.log(chalk6.gray("\u914D\u7F6E\u6587\u4EF6:"), getSyncConfigPath());
3164
3473
  console.log();
3165
3474
  const testNow = await promptConfirm("\u662F\u5426\u7ACB\u5373\u6D4B\u8BD5\u8FDE\u63A5?", true);
3166
3475
  if (testNow) {
3167
- console.log(chalk3.bold("\n\u{1F50D} \u6D4B\u8BD5 WebDAV \u8FDE\u63A5...\n"));
3168
- const success = await testWebDAVConnection(newConfig);
3169
- if (success) {
3170
- console.log(chalk3.green("\u2705 \u8FDE\u63A5\u6210\u529F"));
3171
- console.log();
3172
- console.log(" ", chalk3.gray("URL:"), newConfig.webdavUrl);
3173
- console.log(" ", chalk3.gray("\u7528\u6237:"), newConfig.username);
3174
- console.log(" ", chalk3.gray("\u8FDC\u7A0B\u76EE\u5F55:"), newConfig.remoteDir || "/");
3175
- console.log(" ", chalk3.gray("\u8BA4\u8BC1\u7C7B\u578B:"), newConfig.authType === "password" ? "Basic Auth" : "Digest Auth");
3176
- console.log();
3177
- } else {
3178
- console.log(chalk3.red("\u274C \u8FDE\u63A5\u5931\u8D25"));
3179
- console.log();
3180
- console.log(chalk3.yellow("\u8BF7\u68C0\u67E5:"));
3181
- console.log(" 1. WebDAV \u670D\u52A1\u5668\u5730\u5740\u662F\u5426\u6B63\u786E");
3182
- console.log(" 2. \u7528\u6237\u540D\u548C\u5BC6\u7801\u662F\u5426\u6B63\u786E");
3183
- console.log(" 3. \u7F51\u7EDC\u8FDE\u63A5\u662F\u5426\u6B63\u5E38");
3184
- console.log();
3185
- }
3476
+ await printConnectionTestResult(newConfig);
3186
3477
  }
3187
3478
  } catch (error) {
3188
- console.error(chalk3.red(`
3479
+ console.error(chalk6.red(`
3189
3480
  \u274C ${error.message}
3190
3481
  `));
3191
3482
  }
@@ -3197,33 +3488,7 @@ var init_config2 = __esm({
3197
3488
  init_sync_config();
3198
3489
  init_dist2();
3199
3490
  init_confirm();
3200
- }
3201
- });
3202
-
3203
- // src/commands/sync/helpers.ts
3204
- import chalk4 from "chalk";
3205
- import { Command } from "commander";
3206
- async function ensureConfigExists() {
3207
- const config = loadSyncConfig();
3208
- if (config) {
3209
- return config;
3210
- }
3211
- console.log(chalk4.yellow("\n\u26A0\uFE0F \u672A\u627E\u5230 WebDAV \u914D\u7F6E\n"));
3212
- const shouldConfig = await promptConfirm("\u662F\u5426\u73B0\u5728\u914D\u7F6E WebDAV?", true);
3213
- if (!shouldConfig) {
3214
- return null;
3215
- }
3216
- const { configCommand: configCommand2 } = await Promise.resolve().then(() => (init_config2(), config_exports));
3217
- const cmd = new Command();
3218
- configCommand2(cmd);
3219
- await cmd.parseAsync(["node", "ccman", "config"]);
3220
- return loadSyncConfig();
3221
- }
3222
- var init_helpers = __esm({
3223
- "src/commands/sync/helpers.ts"() {
3224
- "use strict";
3225
- init_sync_config();
3226
- init_confirm();
3491
+ init_helpers();
3227
3492
  }
3228
3493
  });
3229
3494
 
@@ -3232,36 +3497,42 @@ var test_exports = {};
3232
3497
  __export(test_exports, {
3233
3498
  testCommand: () => testCommand
3234
3499
  });
3235
- import chalk5 from "chalk";
3500
+ import chalk7 from "chalk";
3236
3501
  function testCommand(program2) {
3237
- program2.command("test").description("\u6D4B\u8BD5 WebDAV \u8FDE\u63A5").action(async () => {
3502
+ const command = program2.command("test").description("\u6D4B\u8BD5 WebDAV \u8FDE\u63A5");
3503
+ addSyncConnectionOptions(command);
3504
+ command.action(async (options) => {
3238
3505
  try {
3239
- const config = await ensureConfigExists();
3506
+ const config = await ensureConfigExists(options);
3240
3507
  if (!config) {
3241
- console.log(chalk5.gray("\n\u5DF2\u53D6\u6D88\n"));
3508
+ console.log(chalk7.gray("\n\u5DF2\u53D6\u6D88\n"));
3242
3509
  return;
3243
3510
  }
3244
- console.log(chalk5.bold("\n\u{1F50D} \u6D4B\u8BD5 WebDAV \u8FDE\u63A5...\n"));
3511
+ console.log(chalk7.bold("\n\u{1F50D} \u6D4B\u8BD5 WebDAV \u8FDE\u63A5...\n"));
3245
3512
  const success = await testWebDAVConnection(config);
3246
3513
  if (success) {
3247
- console.log(chalk5.green("\u2705 \u8FDE\u63A5\u6210\u529F"));
3514
+ console.log(chalk7.green("\u2705 \u8FDE\u63A5\u6210\u529F"));
3248
3515
  console.log();
3249
- console.log(" ", chalk5.gray("URL:"), config.webdavUrl);
3250
- console.log(" ", chalk5.gray("\u7528\u6237:"), config.username);
3251
- console.log(" ", chalk5.gray("\u8FDC\u7A0B\u76EE\u5F55:"), config.remoteDir);
3252
- console.log(" ", chalk5.gray("\u8BA4\u8BC1\u7C7B\u578B:"), config.authType === "password" ? "Basic Auth" : "Digest Auth");
3516
+ console.log(" ", chalk7.gray("URL:"), config.webdavUrl);
3517
+ console.log(" ", chalk7.gray("\u7528\u6237:"), config.username);
3518
+ console.log(" ", chalk7.gray("\u8FDC\u7A0B\u76EE\u5F55:"), config.remoteDir || "/");
3519
+ console.log(
3520
+ " ",
3521
+ chalk7.gray("\u8BA4\u8BC1\u7C7B\u578B:"),
3522
+ config.authType === "password" ? "Basic Auth" : "Digest Auth"
3523
+ );
3253
3524
  console.log();
3254
3525
  } else {
3255
- console.log(chalk5.red("\u274C \u8FDE\u63A5\u5931\u8D25"));
3526
+ console.log(chalk7.red("\u274C \u8FDE\u63A5\u5931\u8D25"));
3256
3527
  console.log();
3257
- console.log(chalk5.yellow("\u8BF7\u68C0\u67E5:"));
3528
+ console.log(chalk7.yellow("\u8BF7\u68C0\u67E5:"));
3258
3529
  console.log(" 1. WebDAV \u670D\u52A1\u5668\u5730\u5740\u662F\u5426\u6B63\u786E");
3259
3530
  console.log(" 2. \u7528\u6237\u540D\u548C\u5BC6\u7801\u662F\u5426\u6B63\u786E");
3260
3531
  console.log(" 3. \u7F51\u7EDC\u8FDE\u63A5\u662F\u5426\u6B63\u5E38");
3261
3532
  console.log();
3262
3533
  }
3263
3534
  } catch (error) {
3264
- console.error(chalk5.red(`
3535
+ console.error(chalk7.red(`
3265
3536
  \u274C ${error.message}
3266
3537
  `));
3267
3538
  }
@@ -3280,29 +3551,21 @@ var upload_exports = {};
3280
3551
  __export(upload_exports, {
3281
3552
  uploadCommand: () => uploadCommand
3282
3553
  });
3283
- import chalk6 from "chalk";
3284
- import inquirer3 from "inquirer";
3554
+ import chalk8 from "chalk";
3285
3555
  function uploadCommand(program2) {
3286
- program2.command("upload").description("\u4E0A\u4F20\u672C\u5730\u914D\u7F6E\u5230\u4E91\u7AEF").action(async () => {
3556
+ const command = program2.command("upload").description("\u4E0A\u4F20\u672C\u5730\u914D\u7F6E\u5230\u4E91\u7AEF");
3557
+ addSyncConnectionOptions(command, {
3558
+ includeSyncPassword: true,
3559
+ includeConfirm: true
3560
+ });
3561
+ command.action(async (options) => {
3287
3562
  try {
3288
- const config = await ensureConfigExists();
3563
+ const config = await ensureConfigExists(options);
3289
3564
  if (!config) {
3290
- console.log(chalk6.gray("\n\u5DF2\u53D6\u6D88\n"));
3565
+ console.log(chalk8.gray("\n\u5DF2\u53D6\u6D88\n"));
3291
3566
  return;
3292
3567
  }
3293
- let syncPassword = config.syncPassword || "";
3294
- if (!syncPassword) {
3295
- const { password } = await inquirer3.prompt([
3296
- {
3297
- type: "password",
3298
- name: "password",
3299
- message: "\u8BF7\u8F93\u5165\u540C\u6B65\u5BC6\u7801:",
3300
- mask: "*",
3301
- validate: (value) => value ? true : "\u540C\u6B65\u5BC6\u7801\u4E0D\u80FD\u4E3A\u7A7A"
3302
- }
3303
- ]);
3304
- syncPassword = password;
3305
- }
3568
+ const syncPassword = await resolveSyncPassword(config, options);
3306
3569
  const codexManager = createCodexManager();
3307
3570
  const claudeManager = createClaudeManager();
3308
3571
  const geminiManager = createGeminiManager();
@@ -3311,36 +3574,37 @@ function uploadCommand(program2) {
3311
3574
  const claudeProviders = claudeManager.list();
3312
3575
  const geminiProviders = geminiManager.list();
3313
3576
  const openclawProviders = openclawManager.list();
3314
- console.log(chalk6.bold("\n\u{1F4E4} \u4E0A\u4F20\u914D\u7F6E\u5230\u4E91\u7AEF\n"));
3577
+ console.log(chalk8.bold("\n\u{1F4E4} \u4E0A\u4F20\u914D\u7F6E\u5230\u4E91\u7AEF\n"));
3315
3578
  console.log("\u914D\u7F6E\u4FE1\u606F:");
3316
- console.log(` Codex \u670D\u52A1\u5546: ${chalk6.cyan(codexProviders.length)} \u4E2A`);
3317
- console.log(` Claude \u670D\u52A1\u5546: ${chalk6.cyan(claudeProviders.length)} \u4E2A`);
3318
- console.log(` Gemini \u670D\u52A1\u5546: ${chalk6.cyan(geminiProviders.length)} \u4E2A`);
3319
- console.log(` OpenClaw \u670D\u52A1\u5546: ${chalk6.cyan(openclawProviders.length)} \u4E2A`);
3579
+ console.log(` Codex \u670D\u52A1\u5546: ${chalk8.cyan(codexProviders.length)} \u4E2A`);
3580
+ console.log(` Claude \u670D\u52A1\u5546: ${chalk8.cyan(claudeProviders.length)} \u4E2A`);
3581
+ console.log(` Gemini \u670D\u52A1\u5546: ${chalk8.cyan(geminiProviders.length)} \u4E2A`);
3582
+ console.log(` OpenClaw \u670D\u52A1\u5546: ${chalk8.cyan(openclawProviders.length)} \u4E2A`);
3320
3583
  console.log();
3321
- console.log(chalk6.yellow("\u26A0\uFE0F \u4E91\u7AEF\u73B0\u6709\u914D\u7F6E\u5C06\u88AB\u8986\u76D6"));
3584
+ console.log(chalk8.yellow("\u26A0\uFE0F \u4E91\u7AEF\u73B0\u6709\u914D\u7F6E\u5C06\u88AB\u8986\u76D6"));
3322
3585
  console.log();
3323
- const confirm = await promptConfirm("\u786E\u8BA4\u4E0A\u4F20?", false);
3586
+ const confirm = await confirmOrExit("\u786E\u8BA4\u4E0A\u4F20?", false, options);
3324
3587
  if (!confirm) {
3325
- console.log(chalk6.gray("\n\u274C \u5DF2\u53D6\u6D88\n"));
3588
+ console.log(chalk8.gray("\n\u274C \u5DF2\u53D6\u6D88\n"));
3326
3589
  return;
3327
3590
  }
3328
3591
  console.log();
3329
- console.log(chalk6.gray("\u{1F510} \u52A0\u5BC6 API Key..."));
3330
- console.log(chalk6.gray("\u{1F4E4} \u4E0A\u4F20\u5230 WebDAV..."));
3592
+ console.log(chalk8.gray("\u{1F510} \u52A0\u5BC6 API Key..."));
3593
+ console.log(chalk8.gray("\u{1F4E4} \u4E0A\u4F20\u5230 WebDAV..."));
3331
3594
  await uploadToCloud(config, syncPassword);
3332
3595
  console.log();
3333
- console.log(chalk6.green("\u2705 \u4E0A\u4F20\u6210\u529F"));
3596
+ console.log(chalk8.green("\u2705 \u4E0A\u4F20\u6210\u529F"));
3334
3597
  console.log();
3335
- console.log(chalk6.gray("\u8FDC\u7A0B\u6587\u4EF6:"));
3336
- console.log(chalk6.gray(` ${config.webdavUrl}${config.remoteDir}/.ccman/codex.json`));
3337
- console.log(chalk6.gray(` ${config.webdavUrl}${config.remoteDir}/.ccman/claude.json`));
3338
- console.log(chalk6.gray(` ${config.webdavUrl}${config.remoteDir}/.ccman/gemini.json`));
3339
- console.log(chalk6.gray(` ${config.webdavUrl}${config.remoteDir}/.ccman/openclaw.json`));
3598
+ const remoteDir = config.remoteDir || "/";
3599
+ console.log(chalk8.gray("\u8FDC\u7A0B\u6587\u4EF6:"));
3600
+ console.log(chalk8.gray(` ${config.webdavUrl}${remoteDir}/.ccman/codex.json`));
3601
+ console.log(chalk8.gray(` ${config.webdavUrl}${remoteDir}/.ccman/claude.json`));
3602
+ console.log(chalk8.gray(` ${config.webdavUrl}${remoteDir}/.ccman/gemini.json`));
3603
+ console.log(chalk8.gray(` ${config.webdavUrl}${remoteDir}/.ccman/openclaw.json`));
3340
3604
  console.log();
3341
- console.log(chalk6.blue("\u{1F4A1} \u5176\u4ED6\u8BBE\u5907\u53EF\u901A\u8FC7 'ccman sync download' \u83B7\u53D6\u914D\u7F6E\n"));
3605
+ console.log(chalk8.blue("\u{1F4A1} \u5176\u4ED6\u8BBE\u5907\u53EF\u901A\u8FC7 'ccman sync download' \u83B7\u53D6\u914D\u7F6E\n"));
3342
3606
  } catch (error) {
3343
- console.error(chalk6.red(`
3607
+ console.error(chalk8.red(`
3344
3608
  \u274C ${error.message}
3345
3609
  `));
3346
3610
  }
@@ -3351,7 +3615,6 @@ var init_upload = __esm({
3351
3615
  "use strict";
3352
3616
  init_dist2();
3353
3617
  init_helpers();
3354
- init_confirm();
3355
3618
  }
3356
3619
  });
3357
3620
 
@@ -3360,55 +3623,47 @@ var download_exports = {};
3360
3623
  __export(download_exports, {
3361
3624
  downloadCommand: () => downloadCommand
3362
3625
  });
3363
- import chalk7 from "chalk";
3364
- import inquirer4 from "inquirer";
3626
+ import chalk9 from "chalk";
3365
3627
  function downloadCommand(program2) {
3366
- program2.command("download").description("\u4ECE\u4E91\u7AEF\u4E0B\u8F7D\u914D\u7F6E\u5230\u672C\u5730").action(async () => {
3628
+ const command = program2.command("download").description("\u4ECE\u4E91\u7AEF\u4E0B\u8F7D\u914D\u7F6E\u5230\u672C\u5730");
3629
+ addSyncConnectionOptions(command, {
3630
+ includeSyncPassword: true,
3631
+ includeConfirm: true
3632
+ });
3633
+ command.action(async (options) => {
3367
3634
  try {
3368
- const config = await ensureConfigExists();
3635
+ const config = await ensureConfigExists(options);
3369
3636
  if (!config) {
3370
- console.log(chalk7.gray("\n\u5DF2\u53D6\u6D88\n"));
3637
+ console.log(chalk9.gray("\n\u5DF2\u53D6\u6D88\n"));
3371
3638
  return;
3372
3639
  }
3373
- let syncPassword = config.syncPassword || "";
3374
- if (!syncPassword) {
3375
- const { password } = await inquirer4.prompt([
3376
- {
3377
- type: "password",
3378
- name: "password",
3379
- message: "\u8BF7\u8F93\u5165\u540C\u6B65\u5BC6\u7801:",
3380
- mask: "*",
3381
- validate: (value) => value ? true : "\u540C\u6B65\u5BC6\u7801\u4E0D\u80FD\u4E3A\u7A7A"
3382
- }
3383
- ]);
3384
- syncPassword = password;
3385
- }
3386
- console.log(chalk7.bold("\n\u{1F4E5} \u4ECE\u4E91\u7AEF\u4E0B\u8F7D\u914D\u7F6E\n"));
3387
- console.log(chalk7.yellow("\u26A0\uFE0F \u5C06\u8986\u76D6\u672C\u5730\u914D\u7F6E\uFF08\u81EA\u52A8\u5907\u4EFD\uFF09"));
3640
+ const syncPassword = await resolveSyncPassword(config, options);
3641
+ console.log(chalk9.bold("\n\u{1F4E5} \u4ECE\u4E91\u7AEF\u4E0B\u8F7D\u914D\u7F6E\n"));
3642
+ console.log(chalk9.yellow("\u26A0\uFE0F \u5C06\u8986\u76D6\u672C\u5730\u914D\u7F6E\uFF08\u81EA\u52A8\u5907\u4EFD\uFF09"));
3388
3643
  console.log();
3389
- const confirm = await promptConfirm("\u786E\u8BA4\u4E0B\u8F7D?", false);
3644
+ const confirm = await confirmOrExit("\u786E\u8BA4\u4E0B\u8F7D?", false, options);
3390
3645
  if (!confirm) {
3391
- console.log(chalk7.gray("\n\u274C \u5DF2\u53D6\u6D88\n"));
3646
+ console.log(chalk9.gray("\n\u274C \u5DF2\u53D6\u6D88\n"));
3392
3647
  return;
3393
3648
  }
3394
3649
  console.log();
3395
- console.log(chalk7.gray("\u{1F4BE} \u5907\u4EFD\u672C\u5730\u914D\u7F6E..."));
3396
- console.log(chalk7.gray("\u{1F4E5} \u4E0B\u8F7D\u8FDC\u7A0B\u914D\u7F6E..."));
3397
- console.log(chalk7.gray("\u{1F513} \u89E3\u5BC6 API Key..."));
3650
+ console.log(chalk9.gray("\u{1F4BE} \u5907\u4EFD\u672C\u5730\u914D\u7F6E..."));
3651
+ console.log(chalk9.gray("\u{1F4E5} \u4E0B\u8F7D\u8FDC\u7A0B\u914D\u7F6E..."));
3652
+ console.log(chalk9.gray("\u{1F513} \u89E3\u5BC6 API Key..."));
3398
3653
  const backupPaths = await downloadFromCloud(config, syncPassword);
3399
3654
  console.log();
3400
- console.log(chalk7.green("\u2705 \u4E0B\u8F7D\u6210\u529F"));
3655
+ console.log(chalk9.green("\u2705 \u4E0B\u8F7D\u6210\u529F"));
3401
3656
  console.log();
3402
3657
  if (backupPaths.length > 0) {
3403
- console.log(chalk7.gray("\u672C\u5730\u5907\u4EFD:"));
3658
+ console.log(chalk9.gray("\u672C\u5730\u5907\u4EFD:"));
3404
3659
  backupPaths.forEach((path16) => {
3405
- console.log(chalk7.gray(` ${path16}`));
3660
+ console.log(chalk9.gray(` ${path16}`));
3406
3661
  });
3407
3662
  console.log();
3408
3663
  }
3409
- console.log(chalk7.blue("\u{1F4A1} \u914D\u7F6E\u5DF2\u66F4\u65B0\uFF0C\u91CD\u65B0\u52A0\u8F7D\u751F\u6548\n"));
3664
+ console.log(chalk9.blue("\u{1F4A1} \u914D\u7F6E\u5DF2\u66F4\u65B0\uFF0C\u91CD\u65B0\u52A0\u8F7D\u751F\u6548\n"));
3410
3665
  } catch (error) {
3411
- console.error(chalk7.red(`
3666
+ console.error(chalk9.red(`
3412
3667
  \u274C ${error.message}
3413
3668
  `));
3414
3669
  }
@@ -3419,7 +3674,6 @@ var init_download = __esm({
3419
3674
  "use strict";
3420
3675
  init_dist2();
3421
3676
  init_helpers();
3422
- init_confirm();
3423
3677
  }
3424
3678
  });
3425
3679
 
@@ -3428,54 +3682,45 @@ var merge_exports = {};
3428
3682
  __export(merge_exports, {
3429
3683
  mergeCommand: () => mergeCommand
3430
3684
  });
3431
- import chalk8 from "chalk";
3432
- import inquirer5 from "inquirer";
3685
+ import chalk10 from "chalk";
3433
3686
  function mergeCommand(program2) {
3434
- program2.command("merge").description("\u667A\u80FD\u5408\u5E76\u672C\u5730\u548C\u4E91\u7AEF\u914D\u7F6E").action(async () => {
3687
+ const command = program2.command("merge").description("\u667A\u80FD\u5408\u5E76\u672C\u5730\u548C\u4E91\u7AEF\u914D\u7F6E");
3688
+ addSyncConnectionOptions(command, {
3689
+ includeSyncPassword: true
3690
+ });
3691
+ command.action(async (options) => {
3435
3692
  try {
3436
- const config = await ensureConfigExists();
3693
+ const config = await ensureConfigExists(options);
3437
3694
  if (!config) {
3438
- console.log(chalk8.gray("\n\u5DF2\u53D6\u6D88\n"));
3695
+ console.log(chalk10.gray("\n\u5DF2\u53D6\u6D88\n"));
3439
3696
  return;
3440
3697
  }
3441
- let syncPassword = config.syncPassword || "";
3442
- if (!syncPassword) {
3443
- const { password } = await inquirer5.prompt([
3444
- {
3445
- type: "password",
3446
- name: "password",
3447
- message: "\u8BF7\u8F93\u5165\u540C\u6B65\u5BC6\u7801:",
3448
- mask: "*",
3449
- validate: (value) => value ? true : "\u540C\u6B65\u5BC6\u7801\u4E0D\u80FD\u4E3A\u7A7A"
3450
- }
3451
- ]);
3452
- syncPassword = password;
3453
- }
3454
- console.log(chalk8.bold("\n\u{1F504} \u667A\u80FD\u5408\u5E76\u914D\u7F6E\n"));
3455
- console.log(chalk8.gray("\u5206\u6790\u672C\u5730\u548C\u4E91\u7AEF\u914D\u7F6E..."));
3698
+ const syncPassword = await resolveSyncPassword(config, options);
3699
+ console.log(chalk10.bold("\n\u{1F504} \u667A\u80FD\u5408\u5E76\u914D\u7F6E\n"));
3700
+ console.log(chalk10.gray("\u5206\u6790\u672C\u5730\u548C\u4E91\u7AEF\u914D\u7F6E..."));
3456
3701
  const result = await mergeSync(config, syncPassword);
3457
3702
  if (!result.hasChanges) {
3458
3703
  console.log();
3459
- console.log(chalk8.blue("\u2139\uFE0F \u914D\u7F6E\u5DF2\u540C\u6B65\uFF0C\u65E0\u9700\u64CD\u4F5C\n"));
3704
+ console.log(chalk10.blue("\u2139\uFE0F \u914D\u7F6E\u5DF2\u540C\u6B65\uFF0C\u65E0\u9700\u64CD\u4F5C\n"));
3460
3705
  return;
3461
3706
  }
3462
3707
  console.log();
3463
- console.log(chalk8.green("\u2705 \u914D\u7F6E\u5DF2\u667A\u80FD\u5408\u5E76\u5E76\u540C\u6B65"));
3708
+ console.log(chalk10.green("\u2705 \u914D\u7F6E\u5DF2\u667A\u80FD\u5408\u5E76\u5E76\u540C\u6B65"));
3464
3709
  console.log();
3465
3710
  if (result.backupPaths.length > 0) {
3466
- console.log(chalk8.gray("\u5907\u4EFD:"));
3711
+ console.log(chalk10.gray("\u5907\u4EFD:"));
3467
3712
  result.backupPaths.forEach((path16) => {
3468
- console.log(chalk8.gray(` ${path16}`));
3713
+ console.log(chalk10.gray(` ${path16}`));
3469
3714
  });
3470
3715
  console.log();
3471
3716
  }
3472
- console.log(chalk8.blue("\u5408\u5E76\u89C4\u5219:"));
3473
- console.log(chalk8.gray(" \u2022 \u76F8\u540C ID\uFF1A\u4FDD\u7559\u6700\u65B0\u4FEE\u6539"));
3474
- console.log(chalk8.gray(" \u2022 \u76F8\u540C\u914D\u7F6E\uFF08URL+Key\uFF09\uFF1A\u4FDD\u7559\u6700\u65B0\u4FEE\u6539"));
3475
- console.log(chalk8.gray(" \u2022 \u4E0D\u540C\u914D\u7F6E\uFF1A\u5168\u90E8\u4FDD\u7559\uFF0C\u81EA\u52A8\u5904\u7406 name \u51B2\u7A81"));
3717
+ console.log(chalk10.blue("\u5408\u5E76\u89C4\u5219:"));
3718
+ console.log(chalk10.gray(" \u2022 \u76F8\u540C ID\uFF1A\u4FDD\u7559\u6700\u65B0\u4FEE\u6539"));
3719
+ console.log(chalk10.gray(" \u2022 \u76F8\u540C\u914D\u7F6E\uFF08URL+Key\uFF09\uFF1A\u4FDD\u7559\u6700\u65B0\u4FEE\u6539"));
3720
+ console.log(chalk10.gray(" \u2022 \u4E0D\u540C\u914D\u7F6E\uFF1A\u5168\u90E8\u4FDD\u7559\uFF0C\u81EA\u52A8\u5904\u7406 name \u51B2\u7A81"));
3476
3721
  console.log();
3477
3722
  } catch (error) {
3478
- console.error(chalk8.red(`
3723
+ console.error(chalk10.red(`
3479
3724
  \u274C ${error.message}
3480
3725
  `));
3481
3726
  }
@@ -3494,27 +3739,27 @@ var status_exports = {};
3494
3739
  __export(status_exports, {
3495
3740
  statusCommand: () => statusCommand
3496
3741
  });
3497
- import chalk9 from "chalk";
3742
+ import chalk11 from "chalk";
3498
3743
  function statusCommand(program2) {
3499
3744
  program2.command("status").description("\u67E5\u770B\u540C\u6B65\u72B6\u6001").action(async () => {
3500
3745
  try {
3501
3746
  const config = loadSyncConfig();
3502
- console.log(chalk9.bold("\n\u{1F4CA} \u540C\u6B65\u72B6\u6001\n"));
3747
+ console.log(chalk11.bold("\n\u{1F4CA} \u540C\u6B65\u72B6\u6001\n"));
3503
3748
  if (!config) {
3504
- console.log(chalk9.yellow("\u26A0\uFE0F \u672A\u914D\u7F6E WebDAV \u540C\u6B65"));
3749
+ console.log(chalk11.yellow("\u26A0\uFE0F \u672A\u914D\u7F6E WebDAV \u540C\u6B65"));
3505
3750
  console.log();
3506
- console.log(chalk9.blue("\u{1F4A1} \u5F00\u59CB\u914D\u7F6E: ccman sync config\n"));
3751
+ console.log(chalk11.blue("\u{1F4A1} \u5F00\u59CB\u914D\u7F6E: ccman sync config\n"));
3507
3752
  return;
3508
3753
  }
3509
- console.log(chalk9.bold("WebDAV \u914D\u7F6E:"));
3510
- console.log(` URL: ${chalk9.gray(config.webdavUrl)}`);
3511
- console.log(` \u7528\u6237: ${chalk9.gray(config.username)}`);
3512
- console.log(` \u8FDC\u7A0B\u76EE\u5F55: ${chalk9.gray(config.remoteDir)}`);
3754
+ console.log(chalk11.bold("WebDAV \u914D\u7F6E:"));
3755
+ console.log(` URL: ${chalk11.gray(config.webdavUrl)}`);
3756
+ console.log(` \u7528\u6237: ${chalk11.gray(config.username)}`);
3757
+ console.log(` \u8FDC\u7A0B\u76EE\u5F55: ${chalk11.gray(config.remoteDir)}`);
3513
3758
  console.log(
3514
- ` \u8BA4\u8BC1: ${chalk9.gray(config.authType === "password" ? "Basic Auth" : "Digest Auth")}`
3759
+ ` \u8BA4\u8BC1: ${chalk11.gray(config.authType === "password" ? "Basic Auth" : "Digest Auth")}`
3515
3760
  );
3516
3761
  console.log(
3517
- ` \u540C\u6B65\u5BC6\u7801: ${config.syncPassword ? chalk9.green("\u2713 \u5DF2\u4FDD\u5B58") : chalk9.yellow("\u2717 \u672A\u4FDD\u5B58")}`
3762
+ ` \u540C\u6B65\u5BC6\u7801: ${config.syncPassword ? chalk11.green("\u2713 \u5DF2\u4FDD\u5B58") : chalk11.yellow("\u2717 \u672A\u4FDD\u5B58")}`
3518
3763
  );
3519
3764
  console.log();
3520
3765
  const codexManager = createCodexManager();
@@ -3525,23 +3770,23 @@ function statusCommand(program2) {
3525
3770
  const claudeProviders = claudeManager.list();
3526
3771
  const geminiProviders = geminiManager.list();
3527
3772
  const openclawProviders = openclawManager.list();
3528
- console.log(chalk9.bold("\u672C\u5730\u914D\u7F6E:"));
3529
- console.log(` Codex: ${chalk9.cyan(codexProviders.length)} \u4E2A\u670D\u52A1\u5546`);
3530
- console.log(` Claude: ${chalk9.cyan(claudeProviders.length)} \u4E2A\u670D\u52A1\u5546`);
3531
- console.log(` Gemini: ${chalk9.cyan(geminiProviders.length)} \u4E2A\u670D\u52A1\u5546`);
3532
- console.log(` OpenClaw: ${chalk9.cyan(openclawProviders.length)} \u4E2A\u670D\u52A1\u5546`);
3773
+ console.log(chalk11.bold("\u672C\u5730\u914D\u7F6E:"));
3774
+ console.log(` Codex: ${chalk11.cyan(codexProviders.length)} \u4E2A\u670D\u52A1\u5546`);
3775
+ console.log(` Claude: ${chalk11.cyan(claudeProviders.length)} \u4E2A\u670D\u52A1\u5546`);
3776
+ console.log(` Gemini: ${chalk11.cyan(geminiProviders.length)} \u4E2A\u670D\u52A1\u5546`);
3777
+ console.log(` OpenClaw: ${chalk11.cyan(openclawProviders.length)} \u4E2A\u670D\u52A1\u5546`);
3533
3778
  if (config.lastSync) {
3534
3779
  const date = new Date(config.lastSync).toLocaleString("zh-CN");
3535
- console.log(` \u6700\u540E\u540C\u6B65: ${chalk9.gray(date)}`);
3780
+ console.log(` \u6700\u540E\u540C\u6B65: ${chalk11.gray(date)}`);
3536
3781
  }
3537
3782
  console.log();
3538
- console.log(chalk9.bold("\u540C\u6B65\u5EFA\u8BAE:"));
3539
- console.log(chalk9.blue(" \u{1F4A1} \u4E0A\u4F20\u5230\u4E91\u7AEF: ccman sync upload"));
3540
- console.log(chalk9.blue(" \u{1F4A1} \u4ECE\u4E91\u7AEF\u4E0B\u8F7D: ccman sync download"));
3541
- console.log(chalk9.blue(" \u{1F4A1} \u667A\u80FD\u5408\u5E76: ccman sync merge"));
3783
+ console.log(chalk11.bold("\u540C\u6B65\u5EFA\u8BAE:"));
3784
+ console.log(chalk11.blue(" \u{1F4A1} \u4E0A\u4F20\u5230\u4E91\u7AEF: ccman sync upload"));
3785
+ console.log(chalk11.blue(" \u{1F4A1} \u4ECE\u4E91\u7AEF\u4E0B\u8F7D: ccman sync download"));
3786
+ console.log(chalk11.blue(" \u{1F4A1} \u667A\u80FD\u5408\u5E76: ccman sync merge"));
3542
3787
  console.log();
3543
3788
  } catch (error) {
3544
- console.error(chalk9.red(`
3789
+ console.error(chalk11.red(`
3545
3790
  \u274C ${error.message}
3546
3791
  `));
3547
3792
  }
@@ -3562,8 +3807,8 @@ __export(sync_exports, {
3562
3807
  startSyncMenu: () => startSyncMenu
3563
3808
  });
3564
3809
  import { Command as Command2 } from "commander";
3565
- import inquirer6 from "inquirer";
3566
- import chalk10 from "chalk";
3810
+ import inquirer4 from "inquirer";
3811
+ import chalk12 from "chalk";
3567
3812
  function createSyncCommands(program2) {
3568
3813
  configCommand(program2);
3569
3814
  testCommand(program2);
@@ -3575,7 +3820,7 @@ function createSyncCommands(program2) {
3575
3820
  async function startSyncMenu() {
3576
3821
  while (true) {
3577
3822
  console.log();
3578
- const { action } = await inquirer6.prompt([
3823
+ const { action } = await inquirer4.prompt([
3579
3824
  {
3580
3825
  type: "list",
3581
3826
  name: "action",
@@ -3640,11 +3885,11 @@ async function startSyncMenu() {
3640
3885
  }
3641
3886
  }
3642
3887
  } catch (error) {
3643
- console.error(chalk10.red(`
3888
+ console.error(chalk12.red(`
3644
3889
  \u274C ${error.message}
3645
3890
  `));
3646
3891
  }
3647
- await inquirer6.prompt([
3892
+ await inquirer4.prompt([
3648
3893
  {
3649
3894
  type: "input",
3650
3895
  name: "continue",
@@ -3667,7 +3912,7 @@ var init_sync = __esm({
3667
3912
 
3668
3913
  // src/index.ts
3669
3914
  import { Command as Command3 } from "commander";
3670
- import chalk55 from "chalk";
3915
+ import chalk57 from "chalk";
3671
3916
 
3672
3917
  // src/utils/logo.ts
3673
3918
  init_dist2();
@@ -3692,26 +3937,33 @@ function printLogo() {
3692
3937
 
3693
3938
  // src/commands/codex/add.ts
3694
3939
  init_dist2();
3695
- import chalk12 from "chalk";
3696
- import inquirer8 from "inquirer";
3940
+ import chalk14 from "chalk";
3941
+ import inquirer6 from "inquirer";
3697
3942
 
3698
3943
  // src/interactive.ts
3699
3944
  init_dist2();
3700
- import inquirer7 from "inquirer";
3701
- import chalk11 from "chalk";
3945
+ import inquirer5 from "inquirer";
3946
+ import chalk13 from "chalk";
3702
3947
 
3703
3948
  // src/utils/format.ts
3704
3949
  import chalk2 from "chalk";
3705
- function formatProviderTable(providers, currentId) {
3950
+ function formatProviderTable(providers, currentId, title) {
3706
3951
  const lines = [];
3707
- lines.push("");
3952
+ if (title) {
3953
+ lines.push(chalk2.bold(`
3954
+ \u{1F4CB} ${title}`));
3955
+ lines.push("");
3956
+ } else {
3957
+ lines.push("");
3958
+ }
3708
3959
  providers.forEach((p, index) => {
3709
3960
  const isCurrent = p.id === currentId;
3710
3961
  const marker = isCurrent ? chalk2.green("\u25CF") : chalk2.gray("\u25CB");
3711
3962
  const name = isCurrent ? chalk2.green.bold(p.name) : chalk2.white(p.name);
3712
3963
  const tag = isCurrent ? chalk2.green(" [\u5F53\u524D]") : "";
3713
3964
  lines.push(` ${marker} ${name}${tag}`);
3714
- const url = isCurrent ? chalk2.green(p.baseUrl) : chalk2.gray(p.baseUrl);
3965
+ const urlText = p.baseUrl || "(\u9ED8\u8BA4\u7AEF\u70B9)";
3966
+ const url = isCurrent ? chalk2.green(urlText) : chalk2.gray(urlText);
3715
3967
  lines.push(` ${url}`);
3716
3968
  if (p.desc) {
3717
3969
  const desc = isCurrent ? chalk2.green(p.desc) : chalk2.gray(p.desc);
@@ -3727,6 +3979,64 @@ function formatProviderTable(providers, currentId) {
3727
3979
 
3728
3980
  // src/interactive.ts
3729
3981
  init_confirm();
3982
+
3983
+ // src/utils/cli-theme.ts
3984
+ import chalk3 from "chalk";
3985
+ var TOOL_COLORS = {
3986
+ codex: chalk3.hex("#10A37F"),
3987
+ // OpenAI 绿
3988
+ claude: chalk3.hex("#D97706"),
3989
+ // Anthropic 橙
3990
+ gemini: chalk3.hex("#4285F4"),
3991
+ // Google 蓝
3992
+ opencode: chalk3.hex("#FF6B35"),
3993
+ // 活力橙
3994
+ openclaw: chalk3.hex("#E74C3C"),
3995
+ // 红色
3996
+ mcp: chalk3.hex("#9B59B6")
3997
+ // 紫色
3998
+ };
3999
+ var TOOL_NAMES = {
4000
+ codex: "Codex",
4001
+ claude: "Claude Code",
4002
+ gemini: "Gemini CLI",
4003
+ opencode: "OpenCode",
4004
+ openclaw: "OpenClaw",
4005
+ mcp: "MCP"
4006
+ };
4007
+ function toolBadge(tool) {
4008
+ const color = TOOL_COLORS[tool] || chalk3.blue;
4009
+ const label = TOOL_NAMES[tool] || tool;
4010
+ return color.bold(`[${label}]`);
4011
+ }
4012
+
4013
+ // src/utils/cli-output.ts
4014
+ import chalk4 from "chalk";
4015
+ function printBlock(header, lines = []) {
4016
+ console.log();
4017
+ console.log(header);
4018
+ if (lines.length > 0) {
4019
+ console.log();
4020
+ lines.forEach((line) => console.log(` ${line}`));
4021
+ }
4022
+ console.log();
4023
+ }
4024
+ function printSuccess(title, details = []) {
4025
+ printBlock(chalk4.green(`\u2705 ${title}`), details);
4026
+ }
4027
+ function printInfo(title, lines = []) {
4028
+ printBlock(chalk4.bold(title), lines);
4029
+ }
4030
+ function printWarning(message) {
4031
+ console.log(chalk4.yellow(`
4032
+ \u26A0\uFE0F ${message}
4033
+ `));
4034
+ }
4035
+ function printTip(message) {
4036
+ console.log(chalk4.blue("\u{1F4A1} ") + message);
4037
+ }
4038
+
4039
+ // src/interactive.ts
3730
4040
  var CLI_TOOL_CONFIG = {
3731
4041
  [TOOL_TYPES.CODEX]: { name: "Codex", emoji: "\u{1F536}", cmd: "cx" },
3732
4042
  [TOOL_TYPES.CLAUDE]: { name: "Claude", emoji: "\u{1F537}", cmd: "cc" },
@@ -3749,7 +4059,7 @@ function getManager(tool) {
3749
4059
  }
3750
4060
  }
3751
4061
  async function promptProviderForm(defaults) {
3752
- const answers = await inquirer7.prompt([
4062
+ const answers = await inquirer5.prompt([
3753
4063
  {
3754
4064
  type: "input",
3755
4065
  name: "name",
@@ -3802,7 +4112,7 @@ async function promptProviderForm(defaults) {
3802
4112
  async function startMainMenu() {
3803
4113
  while (true) {
3804
4114
  console.log();
3805
- const { choice } = await inquirer7.prompt([
4115
+ const { choice } = await inquirer5.prompt([
3806
4116
  {
3807
4117
  type: "list",
3808
4118
  name: "choice",
@@ -3820,7 +4130,7 @@ async function startMainMenu() {
3820
4130
  }
3821
4131
  ]);
3822
4132
  if (choice === "exit") {
3823
- console.log(chalk11.gray("\n\u{1F44B} \u518D\u89C1!\n"));
4133
+ console.log(chalk13.gray("\n\u{1F44B} \u518D\u89C1!\n"));
3824
4134
  break;
3825
4135
  }
3826
4136
  if (choice === "claude") {
@@ -3857,14 +4167,14 @@ async function startOpenClawMenu() {
3857
4167
  await showToolMenu(TOOL_TYPES.OPENCLAW);
3858
4168
  }
3859
4169
  async function showToolMenu(tool) {
3860
- const { name: toolName, emoji: toolEmoji } = CLI_TOOL_CONFIG[tool];
4170
+ const { name: toolDisplayName, emoji } = CLI_TOOL_CONFIG[tool];
3861
4171
  while (true) {
3862
4172
  console.log();
3863
- const { action } = await inquirer7.prompt([
4173
+ const { action } = await inquirer5.prompt([
3864
4174
  {
3865
4175
  type: "list",
3866
4176
  name: "action",
3867
- message: `${toolEmoji} ${toolName} \u64CD\u4F5C:`,
4177
+ message: `${emoji} ${toolDisplayName} \u64CD\u4F5C:`,
3868
4178
  choices: [
3869
4179
  { name: "\u2795 \u6DFB\u52A0\u670D\u52A1\u5546", value: "add" },
3870
4180
  { name: "\u{1F504} \u5207\u6362\u670D\u52A1\u5546", value: "switch" },
@@ -3905,11 +4215,11 @@ async function showToolMenu(tool) {
3905
4215
  break;
3906
4216
  }
3907
4217
  } catch (error) {
3908
- console.error(chalk11.red(`
4218
+ console.error(chalk13.red(`
3909
4219
  \u274C ${error.message}
3910
4220
  `));
3911
4221
  }
3912
- await inquirer7.prompt([
4222
+ await inquirer5.prompt([
3913
4223
  {
3914
4224
  type: "input",
3915
4225
  name: "continue",
@@ -3919,16 +4229,16 @@ async function showToolMenu(tool) {
3919
4229
  }
3920
4230
  }
3921
4231
  async function showPresetsMenu() {
3922
- console.log(chalk11.yellow("\n\u26A0\uFE0F \u9884\u7F6E\u670D\u52A1\u5546\u7BA1\u7406\u529F\u80FD\u5373\u5C06\u63A8\u51FA\n"));
4232
+ console.log(chalk13.yellow("\n\u26A0\uFE0F \u9884\u7F6E\u670D\u52A1\u5546\u7BA1\u7406\u529F\u80FD\u5373\u5C06\u63A8\u51FA\n"));
3923
4233
  }
3924
4234
  async function handleAdd(tool) {
3925
4235
  const manager = getManager(tool);
3926
- const { name: toolName, cmd } = CLI_TOOL_CONFIG[tool];
3927
4236
  const presets = manager.listPresets();
3928
- console.log(chalk11.bold(`
4237
+ const { name: toolName, cmd } = CLI_TOOL_CONFIG[tool];
4238
+ console.log(chalk13.bold(`
3929
4239
  \u{1F4DD} \u6DFB\u52A0 ${toolName} \u670D\u52A1\u5546
3930
4240
  `));
3931
- const { usePreset } = await inquirer7.prompt([
4241
+ const { usePreset } = await inquirer5.prompt([
3932
4242
  {
3933
4243
  type: "list",
3934
4244
  name: "usePreset",
@@ -3944,7 +4254,7 @@ async function handleAdd(tool) {
3944
4254
  let baseUrl;
3945
4255
  let apiKey;
3946
4256
  if (usePreset) {
3947
- const { presetName } = await inquirer7.prompt([
4257
+ const { presetName } = await inquirer5.prompt([
3948
4258
  {
3949
4259
  type: "list",
3950
4260
  name: "presetName",
@@ -3956,7 +4266,7 @@ async function handleAdd(tool) {
3956
4266
  }
3957
4267
  ]);
3958
4268
  const preset = presets.find((p) => p.name === presetName);
3959
- console.log(chalk11.blue(`
4269
+ console.log(chalk13.blue(`
3960
4270
  \u4F7F\u7528\u9884\u8BBE: ${preset.name} - ${preset.description}
3961
4271
  `));
3962
4272
  const input = await promptProviderForm({
@@ -3970,7 +4280,7 @@ async function handleAdd(tool) {
3970
4280
  baseUrl = input.baseUrl;
3971
4281
  apiKey = input.apiKey;
3972
4282
  } else {
3973
- const answers = await inquirer7.prompt([
4283
+ const answers = await inquirer5.prompt([
3974
4284
  {
3975
4285
  type: "input",
3976
4286
  name: "name",
@@ -4003,19 +4313,16 @@ async function handleAdd(tool) {
4003
4313
  apiKey = answers.apiKey;
4004
4314
  }
4005
4315
  const provider = manager.add({ name, desc, baseUrl, apiKey });
4006
- console.log();
4007
- console.log(chalk11.green("\u2705 \u6DFB\u52A0\u6210\u529F"));
4008
- console.log();
4009
- console.log(` ${chalk11.bold(provider.name)} ${chalk11.blue(`[${toolName}]`)}`);
4010
- console.log(` ${chalk11.gray(provider.baseUrl)}`);
4011
- console.log();
4316
+ printSuccess("\u6DFB\u52A0\u6210\u529F", [
4317
+ `${chalk13.bold(provider.name)} ${toolBadge(tool)}`,
4318
+ chalk13.gray(provider.baseUrl)
4319
+ ]);
4012
4320
  const switchNow = await promptConfirm("\u662F\u5426\u7ACB\u5373\u5207\u6362\u5230\u6B64\u670D\u52A1\u5546?", true);
4013
4321
  if (switchNow) {
4014
4322
  manager.switch(provider.id);
4015
- console.log(chalk11.green("\u2705 \u5DF2\u5207\u6362\u5230\u65B0\u670D\u52A1\u5546\n"));
4323
+ printSuccess("\u5DF2\u5207\u6362\u5230\u65B0\u670D\u52A1\u5546");
4016
4324
  } else {
4017
- console.log(chalk11.blue("\u{1F4A1} \u7A0D\u540E\u5207\u6362:") + chalk11.white(` ccman ${cmd} use "${provider.name}"
4018
- `));
4325
+ printTip(`\u7A0D\u540E\u5207\u6362: ${chalk13.white(`ccman ${cmd} use "${provider.name}"`)}`);
4019
4326
  }
4020
4327
  }
4021
4328
  async function handleSwitch(tool) {
@@ -4023,70 +4330,66 @@ async function handleSwitch(tool) {
4023
4330
  const providers = manager.list();
4024
4331
  const current = manager.getCurrent();
4025
4332
  if (providers.length === 0) {
4026
- console.log(chalk11.yellow("\n\u26A0\uFE0F \u6682\u65E0\u670D\u52A1\u5546\n"));
4333
+ printWarning("\u6682\u65E0\u670D\u52A1\u5546");
4027
4334
  return;
4028
4335
  }
4029
- const { providerId } = await inquirer7.prompt([
4336
+ const { providerId } = await inquirer5.prompt([
4030
4337
  {
4031
4338
  type: "list",
4032
4339
  name: "providerId",
4033
4340
  message: "\u9009\u62E9\u8981\u5207\u6362\u7684\u670D\u52A1\u5546:",
4034
4341
  choices: providers.map((p) => ({
4035
- name: `${p.name}${current?.id === p.id ? chalk11.green(" (\u5F53\u524D)") : ""}`,
4342
+ name: `${p.name}${current?.id === p.id ? chalk13.green(" (\u5F53\u524D)") : ""}`,
4036
4343
  value: p.id
4037
4344
  }))
4038
4345
  }
4039
4346
  ]);
4040
4347
  manager.switch(providerId);
4041
4348
  const provider = providers.find((p) => p.id === providerId);
4042
- console.log(chalk11.green(`
4043
- \u2705 \u5DF2\u5207\u6362\u5230: ${provider.name}
4044
- `));
4349
+ printSuccess("\u5207\u6362\u6210\u529F", [
4350
+ `${chalk13.bold(provider.name)} ${toolBadge(tool)}`,
4351
+ chalk13.gray(provider.baseUrl)
4352
+ ]);
4045
4353
  }
4046
4354
  async function handleList(tool) {
4047
4355
  const manager = getManager(tool);
4048
4356
  const providers = manager.list();
4049
4357
  const current = manager.getCurrent();
4050
- const { name: toolName } = CLI_TOOL_CONFIG[tool];
4358
+ const { name: tn, cmd } = CLI_TOOL_CONFIG[tool];
4051
4359
  if (providers.length === 0) {
4052
- console.log(chalk11.yellow(`
4053
- \u26A0\uFE0F \u6682\u65E0 ${toolName} \u670D\u52A1\u5546
4054
- `));
4360
+ printWarning(`\u6682\u65E0 ${tn} \u670D\u52A1\u5546`);
4361
+ printTip(`\u6DFB\u52A0\u670D\u52A1\u5546: ${chalk13.white(`ccman ${cmd} add`)}`);
4055
4362
  return;
4056
4363
  }
4057
- console.log(chalk11.bold(`
4058
- \u{1F4CB} ${toolName} \u670D\u52A1\u5546 (${providers.length} \u4E2A)`));
4059
- console.log(formatProviderTable(providers, current?.id));
4364
+ console.log(formatProviderTable(providers, current?.id, `${tn} \u670D\u52A1\u5546 (${providers.length} \u4E2A)`));
4060
4365
  }
4061
4366
  async function handleCurrent(tool) {
4062
4367
  const manager = getManager(tool);
4063
4368
  const current = manager.getCurrent();
4064
- const { name: toolName } = CLI_TOOL_CONFIG[tool];
4369
+ const { name: tn, cmd } = CLI_TOOL_CONFIG[tool];
4065
4370
  if (!current) {
4066
- console.log(chalk11.yellow(`
4067
- \u26A0\uFE0F \u672A\u9009\u62E9\u4EFB\u4F55 ${toolName} \u670D\u52A1\u5546
4068
- `));
4371
+ printWarning(`\u672A\u9009\u62E9\u4EFB\u4F55 ${tn} \u670D\u52A1\u5546`);
4372
+ printTip(`\u9009\u62E9\u670D\u52A1\u5546: ${chalk13.white(`ccman ${cmd} use`)}`);
4069
4373
  return;
4070
4374
  }
4071
- console.log(chalk11.bold(`
4072
- \u{1F441}\uFE0F \u5F53\u524D ${toolName} \u670D\u52A1\u5546
4073
- `));
4074
- console.log(` ${chalk11.green.bold(current.name)}`);
4075
- console.log(` ${chalk11.gray(current.baseUrl)}`);
4375
+ const lines = [
4376
+ chalk13.green.bold(current.name),
4377
+ chalk13.gray(`ID: ${current.id}`),
4378
+ chalk13.gray(`URL: ${current.baseUrl || "(\u9ED8\u8BA4\u7AEF\u70B9)"}`)
4379
+ ];
4076
4380
  if (current.lastUsedAt) {
4077
- const date = new Date(current.lastUsedAt).toLocaleString("zh-CN");
4078
- console.log(` ${chalk11.gray(`\u6700\u540E\u4F7F\u7528: ${date}`)}`);
4381
+ lines.push(chalk13.gray(`\u6700\u540E\u4F7F\u7528: ${new Date(current.lastUsedAt).toLocaleString("zh-CN")}`));
4079
4382
  }
4080
- console.log();
4383
+ printInfo(`\u{1F4CD} \u5F53\u524D ${tn} \u670D\u52A1\u5546`, lines);
4081
4384
  }
4082
4385
  async function handleEdit(tool) {
4083
4386
  const manager = getManager(tool);
4084
4387
  const providers = manager.list();
4085
4388
  if (providers.length === 0) {
4086
- console.log(chalk11.yellow("\n\u26A0\uFE0F \u6682\u65E0\u670D\u52A1\u5546\n"));
4389
+ printWarning("\u6682\u65E0\u670D\u52A1\u5546");
4087
4390
  return;
4088
4391
  }
4089
- const { providerId } = await inquirer7.prompt([
4392
+ const { providerId } = await inquirer5.prompt([
4090
4393
  {
4091
4394
  type: "list",
4092
4395
  name: "providerId",
@@ -4098,7 +4401,7 @@ async function handleEdit(tool) {
4098
4401
  }
4099
4402
  ]);
4100
4403
  const provider = providers.find((p) => p.id === providerId);
4101
- const answers = await inquirer7.prompt([
4404
+ const answers = await inquirer5.prompt([
4102
4405
  {
4103
4406
  type: "input",
4104
4407
  name: "name",
@@ -4138,16 +4441,16 @@ async function handleEdit(tool) {
4138
4441
  baseUrl: answers.baseUrl,
4139
4442
  apiKey: answers.apiKey || void 0
4140
4443
  });
4141
- console.log(chalk11.green("\n\u2705 \u7F16\u8F91\u6210\u529F\n"));
4444
+ printSuccess("\u7F16\u8F91\u6210\u529F");
4142
4445
  }
4143
4446
  async function handleClone(tool) {
4144
4447
  const manager = getManager(tool);
4145
4448
  const providers = manager.list();
4146
4449
  if (providers.length === 0) {
4147
- console.log(chalk11.yellow("\n\u26A0\uFE0F \u6682\u65E0\u670D\u52A1\u5546\n"));
4450
+ printWarning("\u6682\u65E0\u670D\u52A1\u5546");
4148
4451
  return;
4149
4452
  }
4150
- const { providerId } = await inquirer7.prompt([
4453
+ const { providerId } = await inquirer5.prompt([
4151
4454
  {
4152
4455
  type: "list",
4153
4456
  name: "providerId",
@@ -4159,7 +4462,7 @@ async function handleClone(tool) {
4159
4462
  }
4160
4463
  ]);
4161
4464
  const provider = providers.find((p) => p.id === providerId);
4162
- const answers = await inquirer7.prompt([
4465
+ const answers = await inquirer5.prompt([
4163
4466
  {
4164
4467
  type: "input",
4165
4468
  name: "name",
@@ -4182,19 +4485,16 @@ async function handleClone(tool) {
4182
4485
  baseUrl: provider.baseUrl,
4183
4486
  apiKey: answers.apiKey
4184
4487
  });
4185
- console.log(chalk11.green("\n\u2705 \u514B\u9686\u6210\u529F\n"));
4186
- console.log(` ${chalk11.bold(newProvider.name)}`);
4187
- console.log(` ${chalk11.gray(newProvider.baseUrl)}`);
4188
- console.log();
4488
+ printSuccess("\u514B\u9686\u6210\u529F", [chalk13.bold(newProvider.name), chalk13.gray(newProvider.baseUrl)]);
4189
4489
  }
4190
4490
  async function handleRemove(tool) {
4191
4491
  const manager = getManager(tool);
4192
4492
  const providers = manager.list();
4193
4493
  if (providers.length === 0) {
4194
- console.log(chalk11.yellow("\n\u26A0\uFE0F \u6682\u65E0\u670D\u52A1\u5546\n"));
4494
+ printWarning("\u6682\u65E0\u670D\u52A1\u5546");
4195
4495
  return;
4196
4496
  }
4197
- const { providerId } = await inquirer7.prompt([
4497
+ const { providerId } = await inquirer5.prompt([
4198
4498
  {
4199
4499
  type: "list",
4200
4500
  name: "providerId",
@@ -4209,22 +4509,153 @@ async function handleRemove(tool) {
4209
4509
  const confirm = await promptConfirm(`\u786E\u5B9A\u8981\u5220\u9664 "${provider.name}" \u5417?`, false);
4210
4510
  if (confirm) {
4211
4511
  manager.remove(providerId);
4212
- console.log(chalk11.green(`
4213
- \u2705 \u5DF2\u5220\u9664: ${provider.name}
4214
- `));
4512
+ printSuccess(`\u5DF2\u5220\u9664: ${provider.name}`);
4215
4513
  } else {
4216
- console.log(chalk11.gray("\n\u274C \u5DF2\u53D6\u6D88\n"));
4514
+ console.log(chalk13.gray("\n\u274C \u5DF2\u53D6\u6D88\n"));
4217
4515
  }
4218
4516
  }
4219
4517
 
4220
4518
  // src/commands/codex/add.ts
4221
4519
  init_confirm();
4520
+
4521
+ // src/utils/provider-params.ts
4522
+ init_confirm();
4523
+ function trimCliValue(value) {
4524
+ if (value === void 0) {
4525
+ return void 0;
4526
+ }
4527
+ return value.trim();
4528
+ }
4529
+ function validateBaseUrl(baseUrl, allowEmpty = false) {
4530
+ if (!baseUrl) {
4531
+ if (allowEmpty) {
4532
+ return;
4533
+ }
4534
+ throw new Error("\u7F3A\u5C11\u53C2\u6570: --base-url");
4535
+ }
4536
+ if (!baseUrl.startsWith("http://") && !baseUrl.startsWith("https://")) {
4537
+ throw new Error("API \u5730\u5740\u5FC5\u987B\u4EE5 http:// \u6216 https:// \u5F00\u5934");
4538
+ }
4539
+ }
4540
+ function validateApiKey(apiKey, allowEmpty = false) {
4541
+ if (!apiKey && !allowEmpty) {
4542
+ throw new Error("\u7F3A\u5C11\u53C2\u6570: --api-key");
4543
+ }
4544
+ }
4545
+ function resolvePreset(presets, presetName) {
4546
+ const normalizedName = trimCliValue(presetName);
4547
+ if (!normalizedName) {
4548
+ return void 0;
4549
+ }
4550
+ const preset = presets.find((item) => item.name.toLowerCase() === normalizedName.toLowerCase());
4551
+ if (!preset) {
4552
+ throw new Error(`\u9884\u8BBE\u4E0D\u5B58\u5728: ${normalizedName}`);
4553
+ }
4554
+ return preset;
4555
+ }
4556
+ function addProviderAddOptions(command) {
4557
+ command.option("--preset <name>", "\u4F7F\u7528\u6307\u5B9A\u9884\u8BBE").option("--name <name>", "\u670D\u52A1\u5546\u540D\u79F0").option("--desc <desc>", "\u63CF\u8FF0").option("--base-url <url>", "API \u5730\u5740").option("--api-key <key>", "API \u5BC6\u94A5").option("--switch", "\u6DFB\u52A0\u540E\u7ACB\u5373\u5207\u6362").option("--skip-switch", "\u6DFB\u52A0\u540E\u4E0D\u5207\u6362");
4558
+ }
4559
+ function addProviderEditOptions(command) {
4560
+ command.option("--new-name <name>", "\u65B0\u7684\u670D\u52A1\u5546\u540D\u79F0").option("--desc <desc>", "\u65B0\u7684\u63CF\u8FF0\uFF1B\u4F20\u7A7A\u5B57\u7B26\u4E32\u53EF\u6E05\u7A7A").option("--base-url <url>", "\u65B0\u7684 API \u5730\u5740").option("--api-key <key>", "\u65B0\u7684 API \u5BC6\u94A5");
4561
+ }
4562
+ function addProviderRemoveOptions(command) {
4563
+ command.option("-y, --yes", "\u8DF3\u8FC7\u5220\u9664\u786E\u8BA4");
4564
+ }
4565
+ function resolveProviderAddInput(options, presets, rules = {}) {
4566
+ if (options.switch && options.skipSwitch) {
4567
+ throw new Error("\u4E0D\u80FD\u540C\u65F6\u4F7F\u7528 --switch \u548C --skip-switch");
4568
+ }
4569
+ const nonInteractive = options.preset !== void 0 || options.name !== void 0 || options.desc !== void 0 || options.baseUrl !== void 0 || options.apiKey !== void 0 || options.switch === true || options.skipSwitch === true;
4570
+ if (!nonInteractive) {
4571
+ return {
4572
+ nonInteractive: false,
4573
+ switchNow: false
4574
+ };
4575
+ }
4576
+ const preset = resolvePreset(presets, options.preset);
4577
+ const name = trimCliValue(options.name) ?? preset?.name;
4578
+ const desc = options.desc === void 0 ? void 0 : options.desc.trim() || void 0;
4579
+ const baseUrl = trimCliValue(options.baseUrl) ?? preset?.baseUrl ?? "";
4580
+ const apiKey = options.apiKey === void 0 ? "" : options.apiKey.trim();
4581
+ if (!name) {
4582
+ throw new Error("\u7F3A\u5C11\u53C2\u6570: --name");
4583
+ }
4584
+ validateBaseUrl(baseUrl, rules.allowEmptyBaseUrl);
4585
+ validateApiKey(apiKey, rules.allowEmptyApiKey);
4586
+ return {
4587
+ nonInteractive: true,
4588
+ switchNow: options.switch === true,
4589
+ input: {
4590
+ name,
4591
+ desc,
4592
+ baseUrl,
4593
+ apiKey
4594
+ }
4595
+ };
4596
+ }
4597
+ function resolveProviderEditInput(options, rules = {}) {
4598
+ const nonInteractive = options.newName !== void 0 || options.desc !== void 0 || options.baseUrl !== void 0 || options.apiKey !== void 0;
4599
+ const updates = {};
4600
+ if (options.newName !== void 0) {
4601
+ const newName = trimCliValue(options.newName);
4602
+ if (!newName) {
4603
+ throw new Error("\u670D\u52A1\u5546\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A");
4604
+ }
4605
+ updates.name = newName;
4606
+ }
4607
+ if (options.desc !== void 0) {
4608
+ updates.desc = options.desc.trim();
4609
+ }
4610
+ if (options.baseUrl !== void 0) {
4611
+ const baseUrl = trimCliValue(options.baseUrl) ?? "";
4612
+ validateBaseUrl(baseUrl, rules.allowEmptyBaseUrl);
4613
+ updates.baseUrl = baseUrl;
4614
+ }
4615
+ if (options.apiKey !== void 0) {
4616
+ const apiKey = options.apiKey.trim();
4617
+ validateApiKey(apiKey, rules.allowEmptyApiKey);
4618
+ updates.apiKey = apiKey;
4619
+ }
4620
+ return {
4621
+ nonInteractive,
4622
+ updates
4623
+ };
4624
+ }
4625
+ async function confirmProviderRemoval(providerName, options = {}) {
4626
+ if (options.yes) {
4627
+ return true;
4628
+ }
4629
+ return promptConfirm(`\u786E\u5B9A\u5220\u9664 "${providerName}"?`, false);
4630
+ }
4631
+
4632
+ // src/commands/codex/add.ts
4222
4633
  function addCommand(program2) {
4223
- program2.command("add").description("\u6DFB\u52A0\u65B0\u7684 Codex \u670D\u52A1\u5546(\u4EA4\u4E92\u5F0F)").action(async () => {
4634
+ const command = program2.command("add").description("\u6DFB\u52A0\u65B0\u7684 Codex \u670D\u52A1\u5546");
4635
+ addProviderAddOptions(command);
4636
+ command.action(async (options) => {
4224
4637
  try {
4225
4638
  const manager = createCodexManager();
4226
- console.log(chalk12.bold("\n\u{1F4DD} \u6DFB\u52A0 Codex \u670D\u52A1\u5546\n"));
4227
- const { usePreset } = await inquirer8.prompt([
4639
+ console.log(chalk14.bold("\n\u{1F4DD} \u6DFB\u52A0 Codex \u670D\u52A1\u5546\n"));
4640
+ const resolved = resolveProviderAddInput(options, CODEX_PRESETS);
4641
+ if (resolved.nonInteractive && resolved.input) {
4642
+ const provider2 = manager.add(resolved.input);
4643
+ printSuccess("\u6DFB\u52A0\u6210\u529F", [
4644
+ `${chalk14.bold(provider2.name)} ${toolBadge("codex")}`,
4645
+ chalk14.gray(provider2.baseUrl)
4646
+ ]);
4647
+ if (resolved.switchNow) {
4648
+ manager.switch(provider2.id);
4649
+ printSuccess("\u5DF2\u5207\u6362\u5230\u65B0\u670D\u52A1\u5546", [
4650
+ chalk14.gray(`\u914D\u7F6E\u5DF2\u66F4\u65B0: ${getCodexConfigPath()}`),
4651
+ chalk14.gray(`\u914D\u7F6E\u5DF2\u66F4\u65B0: ${getCodexAuthPath()}`)
4652
+ ]);
4653
+ } else {
4654
+ printTip(`\u7A0D\u540E\u5207\u6362: ${chalk14.white(`ccman cx use "${provider2.name}"`)}`);
4655
+ }
4656
+ return;
4657
+ }
4658
+ const { usePreset } = await inquirer6.prompt([
4228
4659
  {
4229
4660
  type: "list",
4230
4661
  name: "usePreset",
@@ -4240,7 +4671,7 @@ function addCommand(program2) {
4240
4671
  let baseUrl;
4241
4672
  let apiKey;
4242
4673
  if (usePreset) {
4243
- const { presetName } = await inquirer8.prompt([
4674
+ const { presetName } = await inquirer6.prompt([
4244
4675
  {
4245
4676
  type: "list",
4246
4677
  name: "presetName",
@@ -4252,7 +4683,7 @@ function addCommand(program2) {
4252
4683
  }
4253
4684
  ]);
4254
4685
  const preset = CODEX_PRESETS.find((p) => p.name === presetName);
4255
- console.log(chalk12.blue(`
4686
+ console.log(chalk14.blue(`
4256
4687
  \u4F7F\u7528\u9884\u8BBE: ${preset.name} - ${preset.description}
4257
4688
  `));
4258
4689
  const input = await promptProviderForm({
@@ -4266,7 +4697,7 @@ function addCommand(program2) {
4266
4697
  baseUrl = input.baseUrl;
4267
4698
  apiKey = input.apiKey;
4268
4699
  } else {
4269
- const answers = await inquirer8.prompt([
4700
+ const answers = await inquirer6.prompt([
4270
4701
  {
4271
4702
  type: "input",
4272
4703
  name: "name",
@@ -4305,25 +4736,22 @@ function addCommand(program2) {
4305
4736
  apiKey = answers.apiKey;
4306
4737
  }
4307
4738
  const provider = manager.add({ name, desc, baseUrl, apiKey });
4308
- console.log();
4309
- console.log(chalk12.green("\u2705 \u6DFB\u52A0\u6210\u529F"));
4310
- console.log();
4311
- console.log(` ${chalk12.bold(provider.name)} ${chalk12.blue("[Codex]")}`);
4312
- console.log(` ${chalk12.gray(provider.baseUrl)}`);
4313
- console.log();
4739
+ printSuccess("\u6DFB\u52A0\u6210\u529F", [
4740
+ `${chalk14.bold(provider.name)} ${toolBadge("codex")}`,
4741
+ chalk14.gray(provider.baseUrl)
4742
+ ]);
4314
4743
  const switchNow = await promptConfirm("\u662F\u5426\u7ACB\u5373\u5207\u6362\u5230\u6B64\u670D\u52A1\u5546?", true);
4315
4744
  if (switchNow) {
4316
4745
  manager.switch(provider.id);
4317
- console.log(chalk12.green("\u2705 \u5DF2\u5207\u6362\u5230\u65B0\u670D\u52A1\u5546"));
4318
- console.log();
4319
- console.log(chalk12.gray("\u914D\u7F6E\u5DF2\u66F4\u65B0:"));
4320
- console.log(chalk12.gray(` - ${getCodexConfigPath()}`));
4321
- console.log(chalk12.gray(` - ${getCodexAuthPath()}`));
4746
+ printSuccess("\u5DF2\u5207\u6362\u5230\u65B0\u670D\u52A1\u5546", [
4747
+ chalk14.gray(`\u914D\u7F6E\u5DF2\u66F4\u65B0: ${getCodexConfigPath()}`),
4748
+ chalk14.gray(`\u914D\u7F6E\u5DF2\u66F4\u65B0: ${getCodexAuthPath()}`)
4749
+ ]);
4322
4750
  } else {
4323
- console.log(chalk12.blue("\u{1F4A1} \u7A0D\u540E\u5207\u6362:") + chalk12.white(` ccman cx use "${provider.name}"`));
4751
+ printTip(`\u7A0D\u540E\u5207\u6362: ${chalk14.white(`ccman cx use "${provider.name}"`)}`);
4324
4752
  }
4325
4753
  } catch (error) {
4326
- console.error(chalk12.red(`
4754
+ console.error(chalk14.red(`
4327
4755
  \u274C ${error.message}
4328
4756
  `));
4329
4757
  process.exit(1);
@@ -4333,7 +4761,7 @@ function addCommand(program2) {
4333
4761
 
4334
4762
  // src/commands/codex/list.ts
4335
4763
  init_dist2();
4336
- import chalk13 from "chalk";
4764
+ import chalk15 from "chalk";
4337
4765
  function listCommand(program2) {
4338
4766
  program2.command("list").alias("ls").description("\u5217\u51FA\u6240\u6709 Codex \u670D\u52A1\u5546").action(async () => {
4339
4767
  try {
@@ -4341,15 +4769,15 @@ function listCommand(program2) {
4341
4769
  const providers = manager.list();
4342
4770
  const current = manager.getCurrent();
4343
4771
  if (providers.length === 0) {
4344
- console.log(chalk13.yellow("\n\u26A0\uFE0F \u6682\u65E0 Codex \u670D\u52A1\u5546\n"));
4345
- console.log(chalk13.blue("\u{1F4A1} \u6DFB\u52A0\u670D\u52A1\u5546:") + chalk13.white(" ccman cx add\n"));
4772
+ printWarning("\u6682\u65E0 Codex \u670D\u52A1\u5546");
4773
+ printTip("\u6DFB\u52A0\u670D\u52A1\u5546: " + chalk15.white("ccman cx add"));
4346
4774
  return;
4347
4775
  }
4348
- console.log(chalk13.bold(`
4349
- \u{1F4CB} Codex \u670D\u52A1\u5546 (${providers.length} \u4E2A)`));
4350
- console.log(formatProviderTable(providers, current?.id));
4776
+ console.log(
4777
+ formatProviderTable(providers, current?.id, `Codex \u670D\u52A1\u5546 (${providers.length} \u4E2A)`)
4778
+ );
4351
4779
  } catch (error) {
4352
- console.error(chalk13.red(`
4780
+ console.error(chalk15.red(`
4353
4781
  \u274C ${error.message}
4354
4782
  `));
4355
4783
  process.exit(1);
@@ -4359,16 +4787,16 @@ function listCommand(program2) {
4359
4787
 
4360
4788
  // src/commands/codex/use.ts
4361
4789
  init_dist2();
4362
- import chalk14 from "chalk";
4363
- import inquirer9 from "inquirer";
4790
+ import chalk16 from "chalk";
4791
+ import inquirer7 from "inquirer";
4364
4792
  function useCommand(program2) {
4365
4793
  program2.command("use [name]").description("\u5207\u6362 Codex \u670D\u52A1\u5546").action(async (name) => {
4366
4794
  try {
4367
4795
  const manager = createCodexManager();
4368
4796
  const providers = manager.list();
4369
4797
  if (providers.length === 0) {
4370
- console.log(chalk14.yellow("\n\u26A0\uFE0F \u6682\u65E0 Codex \u670D\u52A1\u5546\n"));
4371
- console.log(chalk14.blue("\u{1F4A1} \u6DFB\u52A0\u670D\u52A1\u5546:") + chalk14.white(" ccman cx add\n"));
4798
+ printWarning("\u6682\u65E0 Codex \u670D\u52A1\u5546");
4799
+ printTip("\u6DFB\u52A0\u670D\u52A1\u5546: " + chalk16.white("ccman cx add"));
4372
4800
  return;
4373
4801
  }
4374
4802
  let targetId;
@@ -4379,7 +4807,7 @@ function useCommand(program2) {
4379
4807
  }
4380
4808
  targetId = provider2.id;
4381
4809
  } else {
4382
- const { selectedId } = await inquirer9.prompt([
4810
+ const { selectedId } = await inquirer7.prompt([
4383
4811
  {
4384
4812
  type: "list",
4385
4813
  name: "selectedId",
@@ -4394,24 +4822,20 @@ function useCommand(program2) {
4394
4822
  }
4395
4823
  manager.switch(targetId);
4396
4824
  const provider = manager.get(targetId);
4397
- console.log();
4398
- console.log(chalk14.green("\u2705 \u5207\u6362\u6210\u529F"));
4399
- console.log();
4400
- console.log(` ${chalk14.bold(provider.name)} ${chalk14.blue("[Codex]")}`);
4401
- console.log(` ${chalk14.gray(`URL: ${provider.baseUrl}`)}`);
4402
- console.log();
4403
- console.log(chalk14.gray("\u914D\u7F6E\u5DF2\u66F4\u65B0:"));
4404
- console.log(chalk14.gray(` - ${getCodexConfigPath()}`));
4405
- console.log(chalk14.gray(` - ${getCodexAuthPath()}`));
4406
- console.log();
4825
+ printSuccess("\u5207\u6362\u6210\u529F", [
4826
+ `${chalk16.bold(provider.name)} ${toolBadge("codex")}`,
4827
+ chalk16.gray(`URL: ${provider.baseUrl}`),
4828
+ chalk16.gray(`\u914D\u7F6E\u5DF2\u66F4\u65B0: ${getCodexConfigPath()}`),
4829
+ chalk16.gray(`\u914D\u7F6E\u5DF2\u66F4\u65B0: ${getCodexAuthPath()}`)
4830
+ ]);
4407
4831
  } catch (error) {
4408
4832
  if (error instanceof ProviderNotFoundError) {
4409
- console.error(chalk14.red(`
4833
+ console.error(chalk16.red(`
4410
4834
  \u274C \u670D\u52A1\u5546\u4E0D\u5B58\u5728: ${error.message}
4411
4835
  `));
4412
- console.log(chalk14.blue("\u{1F4A1} \u67E5\u770B\u6240\u6709\u670D\u52A1\u5546:") + chalk14.white(" ccman cx list\n"));
4836
+ console.log(chalk16.blue("\u{1F4A1} \u67E5\u770B\u6240\u6709\u670D\u52A1\u5546:") + chalk16.white(" ccman cx list\n"));
4413
4837
  } else {
4414
- console.error(chalk14.red(`
4838
+ console.error(chalk16.red(`
4415
4839
  \u274C ${error.message}
4416
4840
  `));
4417
4841
  }
@@ -4422,28 +4846,30 @@ function useCommand(program2) {
4422
4846
 
4423
4847
  // src/commands/codex/current.ts
4424
4848
  init_dist2();
4425
- import chalk15 from "chalk";
4849
+ import chalk17 from "chalk";
4426
4850
  function currentCommand(program2) {
4427
4851
  program2.command("current").description("\u663E\u793A\u5F53\u524D\u4F7F\u7528\u7684 Codex \u670D\u52A1\u5546").action(async () => {
4428
4852
  try {
4429
4853
  const manager = createCodexManager();
4430
4854
  const current = manager.getCurrent();
4431
4855
  if (!current) {
4432
- console.log(chalk15.yellow("\n\u26A0\uFE0F \u672A\u9009\u62E9\u4EFB\u4F55 Codex \u670D\u52A1\u5546\n"));
4433
- console.log(chalk15.blue("\u{1F4A1} \u9009\u62E9\u670D\u52A1\u5546:") + chalk15.white(" ccman cx use\n"));
4856
+ printWarning("\u672A\u9009\u62E9\u4EFB\u4F55 Codex \u670D\u52A1\u5546");
4857
+ printTip("\u9009\u62E9\u670D\u52A1\u5546: " + chalk17.white("ccman cx use"));
4434
4858
  return;
4435
4859
  }
4436
- console.log(chalk15.bold("\n\u{1F4CD} \u5F53\u524D Codex \u670D\u52A1\u5546\n"));
4437
- console.log(` ${chalk15.green.bold(current.name)}`);
4438
- console.log(` ${chalk15.gray(`ID: ${current.id}`)}`);
4439
- console.log(` ${chalk15.gray(`URL: ${current.baseUrl}`)}`);
4860
+ const lines = [
4861
+ chalk17.green.bold(current.name),
4862
+ chalk17.gray(`ID: ${current.id}`),
4863
+ chalk17.gray(`URL: ${current.baseUrl}`)
4864
+ ];
4440
4865
  if (current.lastUsedAt) {
4441
- const date = new Date(current.lastUsedAt).toLocaleString("zh-CN");
4442
- console.log(` ${chalk15.gray(`\u6700\u540E\u4F7F\u7528: ${date}`)}`);
4866
+ lines.push(
4867
+ chalk17.gray(`\u6700\u540E\u4F7F\u7528: ${new Date(current.lastUsedAt).toLocaleString("zh-CN")}`)
4868
+ );
4443
4869
  }
4444
- console.log();
4870
+ printInfo("\u{1F4CD} \u5F53\u524D Codex \u670D\u52A1\u5546", lines);
4445
4871
  } catch (error) {
4446
- console.error(chalk15.red(`
4872
+ console.error(chalk17.red(`
4447
4873
  \u274C ${error.message}
4448
4874
  `));
4449
4875
  process.exit(1);
@@ -4453,16 +4879,17 @@ function currentCommand(program2) {
4453
4879
 
4454
4880
  // src/commands/codex/remove.ts
4455
4881
  init_dist2();
4456
- init_confirm();
4457
- import chalk16 from "chalk";
4458
- import inquirer10 from "inquirer";
4882
+ import chalk18 from "chalk";
4883
+ import inquirer8 from "inquirer";
4459
4884
  function removeCommand(program2) {
4460
- program2.command("remove [name]").alias("rm").description("\u5220\u9664 Codex \u670D\u52A1\u5546").action(async (name) => {
4885
+ const command = program2.command("remove [name]").alias("rm").description("\u5220\u9664 Codex \u670D\u52A1\u5546");
4886
+ addProviderRemoveOptions(command);
4887
+ command.action(async (name, options) => {
4461
4888
  try {
4462
4889
  const manager = createCodexManager();
4463
4890
  const providers = manager.list();
4464
4891
  if (providers.length === 0) {
4465
- console.log(chalk16.yellow("\n\u26A0\uFE0F \u6682\u65E0 Codex \u670D\u52A1\u5546\n"));
4892
+ console.log(chalk18.yellow("\n\u26A0\uFE0F \u6682\u65E0 Codex \u670D\u52A1\u5546\n"));
4466
4893
  return;
4467
4894
  }
4468
4895
  let targetId;
@@ -4474,8 +4901,10 @@ function removeCommand(program2) {
4474
4901
  }
4475
4902
  targetId = provider.id;
4476
4903
  targetName = provider.name;
4904
+ } else if (options.yes) {
4905
+ throw new Error("\u975E\u4EA4\u4E92\u6A21\u5F0F\u8BF7\u63D0\u4F9B\u8981\u5220\u9664\u7684\u670D\u52A1\u5546\u540D\u79F0");
4477
4906
  } else {
4478
- const { selectedId } = await inquirer10.prompt([
4907
+ const { selectedId } = await inquirer8.prompt([
4479
4908
  {
4480
4909
  type: "list",
4481
4910
  name: "selectedId",
@@ -4490,23 +4919,23 @@ function removeCommand(program2) {
4490
4919
  targetId = selectedId;
4491
4920
  targetName = provider.name;
4492
4921
  }
4493
- const confirmed = await promptConfirm(`\u786E\u5B9A\u5220\u9664 "${targetName}"?`, false);
4922
+ const confirmed = await confirmProviderRemoval(targetName, options);
4494
4923
  if (!confirmed) {
4495
- console.log(chalk16.gray("\n\u5DF2\u53D6\u6D88\n"));
4924
+ console.log(chalk18.gray("\n\u5DF2\u53D6\u6D88\n"));
4496
4925
  return;
4497
4926
  }
4498
4927
  manager.remove(targetId);
4499
4928
  console.log();
4500
- console.log(chalk16.green(`\u2705 \u5DF2\u5220\u9664: ${targetName}`));
4929
+ console.log(chalk18.green(`\u2705 \u5DF2\u5220\u9664: ${targetName}`));
4501
4930
  console.log();
4502
4931
  } catch (error) {
4503
4932
  if (error instanceof ProviderNotFoundError) {
4504
- console.error(chalk16.red(`
4933
+ console.error(chalk18.red(`
4505
4934
  \u274C \u670D\u52A1\u5546\u4E0D\u5B58\u5728
4506
4935
  `));
4507
- console.log(chalk16.blue("\u{1F4A1} \u67E5\u770B\u6240\u6709\u670D\u52A1\u5546:") + chalk16.white(" ccman cx list\n"));
4936
+ console.log(chalk18.blue("\u{1F4A1} \u67E5\u770B\u6240\u6709\u670D\u52A1\u5546:") + chalk18.white(" ccman cx list\n"));
4508
4937
  } else {
4509
- console.error(chalk16.red(`
4938
+ console.error(chalk18.red(`
4510
4939
  \u274C ${error.message}
4511
4940
  `));
4512
4941
  }
@@ -4517,17 +4946,20 @@ function removeCommand(program2) {
4517
4946
 
4518
4947
  // src/commands/codex/edit.ts
4519
4948
  init_dist2();
4520
- import chalk17 from "chalk";
4521
- import inquirer11 from "inquirer";
4949
+ import chalk19 from "chalk";
4950
+ import inquirer9 from "inquirer";
4522
4951
  function editCommand(program2) {
4523
- program2.command("edit [name]").description("\u7F16\u8F91 Codex \u670D\u52A1\u5546").action(async (name) => {
4952
+ const command = program2.command("edit [name]").description("\u7F16\u8F91 Codex \u670D\u52A1\u5546");
4953
+ addProviderEditOptions(command);
4954
+ command.action(async (name, options) => {
4524
4955
  try {
4525
4956
  const manager = createCodexManager();
4526
4957
  const providers = manager.list();
4527
4958
  if (providers.length === 0) {
4528
- console.log(chalk17.yellow("\n\u26A0\uFE0F \u6682\u65E0 Codex \u670D\u52A1\u5546\n"));
4959
+ console.log(chalk19.yellow("\n\u26A0\uFE0F \u6682\u65E0 Codex \u670D\u52A1\u5546\n"));
4529
4960
  return;
4530
4961
  }
4962
+ const resolved = resolveProviderEditInput(options);
4531
4963
  let targetId;
4532
4964
  if (name) {
4533
4965
  const provider2 = manager.findByName(name);
@@ -4535,8 +4967,10 @@ function editCommand(program2) {
4535
4967
  throw new ProviderNotFoundError(name);
4536
4968
  }
4537
4969
  targetId = provider2.id;
4970
+ } else if (resolved.nonInteractive) {
4971
+ throw new Error("\u975E\u4EA4\u4E92\u6A21\u5F0F\u8BF7\u63D0\u4F9B\u8981\u7F16\u8F91\u7684\u670D\u52A1\u5546\u540D\u79F0");
4538
4972
  } else {
4539
- const { selectedId } = await inquirer11.prompt([
4973
+ const { selectedId } = await inquirer9.prompt([
4540
4974
  {
4541
4975
  type: "list",
4542
4976
  name: "selectedId",
@@ -4550,9 +4984,24 @@ function editCommand(program2) {
4550
4984
  targetId = selectedId;
4551
4985
  }
4552
4986
  const provider = manager.get(targetId);
4553
- console.log(chalk17.bold("\n\u270F\uFE0F \u7F16\u8F91\u670D\u52A1\u5546\n"));
4554
- console.log(chalk17.gray("\u63D0\u793A: \u7559\u7A7A\u5219\u4FDD\u6301\u539F\u503C\n"));
4555
- const answers = await inquirer11.prompt([
4987
+ if (resolved.nonInteractive) {
4988
+ if (Object.keys(resolved.updates).length === 0) {
4989
+ console.log(chalk19.gray("\n\u672A\u505A\u4EFB\u4F55\u4FEE\u6539\n"));
4990
+ return;
4991
+ }
4992
+ const updated2 = manager.edit(targetId, resolved.updates);
4993
+ console.log();
4994
+ console.log(chalk19.green("\u2705 \u7F16\u8F91\u6210\u529F"));
4995
+ console.log();
4996
+ console.log(` ${chalk19.bold(updated2.name)} ${chalk19.blue("[Codex]")}`);
4997
+ console.log(` ${chalk19.gray(`ID: ${updated2.id}`)}`);
4998
+ console.log(` ${chalk19.gray(`URL: ${updated2.baseUrl}`)}`);
4999
+ console.log();
5000
+ return;
5001
+ }
5002
+ console.log(chalk19.bold("\n\u270F\uFE0F \u7F16\u8F91\u670D\u52A1\u5546\n"));
5003
+ console.log(chalk19.gray("\u63D0\u793A: \u7559\u7A7A\u5219\u4FDD\u6301\u539F\u503C\n"));
5004
+ const answers = await inquirer9.prompt([
4556
5005
  {
4557
5006
  type: "input",
4558
5007
  name: "name",
@@ -4583,19 +5032,19 @@ function editCommand(program2) {
4583
5032
  if (answers.baseUrl && answers.baseUrl !== provider.baseUrl) updates.baseUrl = answers.baseUrl;
4584
5033
  if (answers.apiKey) updates.apiKey = answers.apiKey;
4585
5034
  if (Object.keys(updates).length === 0) {
4586
- console.log(chalk17.gray("\n\u672A\u505A\u4EFB\u4F55\u4FEE\u6539\n"));
5035
+ console.log(chalk19.gray("\n\u672A\u505A\u4EFB\u4F55\u4FEE\u6539\n"));
4587
5036
  return;
4588
5037
  }
4589
5038
  const updated = manager.edit(targetId, updates);
4590
5039
  console.log();
4591
- console.log(chalk17.green("\u2705 \u7F16\u8F91\u6210\u529F"));
5040
+ console.log(chalk19.green("\u2705 \u7F16\u8F91\u6210\u529F"));
4592
5041
  console.log();
4593
- console.log(` ${chalk17.bold(updated.name)} ${chalk17.blue("[Codex]")}`);
4594
- console.log(` ${chalk17.gray(`ID: ${updated.id}`)}`);
4595
- console.log(` ${chalk17.gray(`URL: ${updated.baseUrl}`)}`);
5042
+ console.log(` ${chalk19.bold(updated.name)} ${chalk19.blue("[Codex]")}`);
5043
+ console.log(` ${chalk19.gray(`ID: ${updated.id}`)}`);
5044
+ console.log(` ${chalk19.gray(`URL: ${updated.baseUrl}`)}`);
4596
5045
  console.log();
4597
5046
  } catch (error) {
4598
- console.error(chalk17.red(`
5047
+ console.error(chalk19.red(`
4599
5048
  \u274C ${error.message}
4600
5049
  `));
4601
5050
  process.exit(1);
@@ -4605,15 +5054,15 @@ function editCommand(program2) {
4605
5054
 
4606
5055
  // src/commands/codex/clone.ts
4607
5056
  init_dist2();
4608
- import chalk18 from "chalk";
4609
- import inquirer12 from "inquirer";
5057
+ import chalk20 from "chalk";
5058
+ import inquirer10 from "inquirer";
4610
5059
  function cloneCommand(program2) {
4611
5060
  program2.command("clone [source-name] [new-name]").description("\u514B\u9686 Codex \u670D\u52A1\u5546").action(async (sourceName, newName) => {
4612
5061
  try {
4613
5062
  const manager = createCodexManager();
4614
5063
  const providers = manager.list();
4615
5064
  if (providers.length === 0) {
4616
- console.log(chalk18.yellow("\n\u26A0\uFE0F \u6682\u65E0 Codex \u670D\u52A1\u5546\n"));
5065
+ console.log(chalk20.yellow("\n\u26A0\uFE0F \u6682\u65E0 Codex \u670D\u52A1\u5546\n"));
4617
5066
  return;
4618
5067
  }
4619
5068
  let sourceId;
@@ -4624,7 +5073,7 @@ function cloneCommand(program2) {
4624
5073
  }
4625
5074
  sourceId = provider.id;
4626
5075
  } else {
4627
- const { selectedId } = await inquirer12.prompt([
5076
+ const { selectedId } = await inquirer10.prompt([
4628
5077
  {
4629
5078
  type: "list",
4630
5079
  name: "selectedId",
@@ -4642,7 +5091,7 @@ function cloneCommand(program2) {
4642
5091
  if (newName) {
4643
5092
  cloned = manager.clone(sourceId, newName);
4644
5093
  } else {
4645
- console.log(chalk18.blue(`
5094
+ console.log(chalk20.blue(`
4646
5095
  \u514B\u9686\u81EA: ${source.name}
4647
5096
  `));
4648
5097
  const input = await promptProviderForm({
@@ -4655,14 +5104,14 @@ function cloneCommand(program2) {
4655
5104
  cloned = manager.add(input);
4656
5105
  }
4657
5106
  console.log();
4658
- console.log(chalk18.green("\u2705 \u514B\u9686\u6210\u529F"));
5107
+ console.log(chalk20.green("\u2705 \u514B\u9686\u6210\u529F"));
4659
5108
  console.log();
4660
- console.log(` ${chalk18.bold(cloned.name)} ${chalk18.blue("[Codex]")}`);
4661
- console.log(` ${chalk18.gray(`ID: ${cloned.id}`)}`);
4662
- console.log(` ${chalk18.gray(`URL: ${cloned.baseUrl}`)}`);
5109
+ console.log(` ${chalk20.bold(cloned.name)} ${chalk20.blue("[Codex]")}`);
5110
+ console.log(` ${chalk20.gray(`ID: ${cloned.id}`)}`);
5111
+ console.log(` ${chalk20.gray(`URL: ${cloned.baseUrl}`)}`);
4663
5112
  console.log();
4664
5113
  } catch (error) {
4665
- console.error(chalk18.red(`
5114
+ console.error(chalk20.red(`
4666
5115
  \u274C ${error.message}
4667
5116
  `));
4668
5117
  process.exit(1);
@@ -4683,15 +5132,32 @@ function createCodexCommands(program2) {
4683
5132
 
4684
5133
  // src/commands/claude/add.ts
4685
5134
  init_dist2();
4686
- import chalk19 from "chalk";
4687
- import inquirer13 from "inquirer";
5135
+ import chalk21 from "chalk";
5136
+ import inquirer11 from "inquirer";
4688
5137
  init_confirm();
4689
5138
  function addCommand2(program2) {
4690
- program2.command("add").description("\u6DFB\u52A0\u65B0\u7684 Claude Code \u670D\u52A1\u5546(\u4EA4\u4E92\u5F0F)").action(async () => {
5139
+ const command = program2.command("add").description("\u6DFB\u52A0\u65B0\u7684 Claude Code \u670D\u52A1\u5546");
5140
+ addProviderAddOptions(command);
5141
+ command.action(async (options) => {
4691
5142
  try {
4692
5143
  const manager = createClaudeManager();
4693
- console.log(chalk19.bold("\n\u{1F4DD} \u6DFB\u52A0 Claude Code \u670D\u52A1\u5546\n"));
4694
- const { usePreset } = await inquirer13.prompt([
5144
+ console.log(chalk21.bold("\n\u{1F4DD} \u6DFB\u52A0 Claude Code \u670D\u52A1\u5546\n"));
5145
+ const resolved = resolveProviderAddInput(options, CC_PRESETS);
5146
+ if (resolved.nonInteractive && resolved.input) {
5147
+ const provider2 = manager.add(resolved.input);
5148
+ printSuccess("\u6DFB\u52A0\u6210\u529F", [
5149
+ `${chalk21.bold(provider2.name)} ${toolBadge("claude")}`,
5150
+ chalk21.gray(provider2.baseUrl)
5151
+ ]);
5152
+ if (resolved.switchNow) {
5153
+ manager.switch(provider2.id);
5154
+ printSuccess("\u5DF2\u5207\u6362\u5230\u65B0\u670D\u52A1\u5546", [chalk21.gray(`\u914D\u7F6E\u5DF2\u66F4\u65B0: ${getClaudeConfigPath()}`)]);
5155
+ } else {
5156
+ printTip(`\u7A0D\u540E\u5207\u6362: ${chalk21.white(`ccman cc use "${provider2.name}"`)}`);
5157
+ }
5158
+ return;
5159
+ }
5160
+ const { usePreset } = await inquirer11.prompt([
4695
5161
  {
4696
5162
  type: "list",
4697
5163
  name: "usePreset",
@@ -4707,7 +5173,7 @@ function addCommand2(program2) {
4707
5173
  let baseUrl;
4708
5174
  let apiKey;
4709
5175
  if (usePreset) {
4710
- const { presetName } = await inquirer13.prompt([
5176
+ const { presetName } = await inquirer11.prompt([
4711
5177
  {
4712
5178
  type: "list",
4713
5179
  name: "presetName",
@@ -4719,7 +5185,7 @@ function addCommand2(program2) {
4719
5185
  }
4720
5186
  ]);
4721
5187
  const preset = CC_PRESETS.find((p) => p.name === presetName);
4722
- console.log(chalk19.blue(`
5188
+ console.log(chalk21.blue(`
4723
5189
  \u4F7F\u7528\u9884\u8BBE: ${preset.name} - ${preset.description}
4724
5190
  `));
4725
5191
  const input = await promptProviderForm({
@@ -4733,7 +5199,7 @@ function addCommand2(program2) {
4733
5199
  baseUrl = input.baseUrl;
4734
5200
  apiKey = input.apiKey;
4735
5201
  } else {
4736
- const answers = await inquirer13.prompt([
5202
+ const answers = await inquirer11.prompt([
4737
5203
  {
4738
5204
  type: "input",
4739
5205
  name: "name",
@@ -4772,24 +5238,19 @@ function addCommand2(program2) {
4772
5238
  apiKey = answers.apiKey;
4773
5239
  }
4774
5240
  const provider = manager.add({ name, desc, baseUrl, apiKey });
4775
- console.log();
4776
- console.log(chalk19.green("\u2705 \u6DFB\u52A0\u6210\u529F"));
4777
- console.log();
4778
- console.log(` ${chalk19.bold(provider.name)} ${chalk19.blue("[Claude Code]")}`);
4779
- console.log(` ${chalk19.gray(provider.baseUrl)}`);
4780
- console.log();
5241
+ printSuccess("\u6DFB\u52A0\u6210\u529F", [
5242
+ `${chalk21.bold(provider.name)} ${toolBadge("claude")}`,
5243
+ chalk21.gray(provider.baseUrl)
5244
+ ]);
4781
5245
  const switchNow = await promptConfirm("\u662F\u5426\u7ACB\u5373\u5207\u6362\u5230\u6B64\u670D\u52A1\u5546?", true);
4782
5246
  if (switchNow) {
4783
5247
  manager.switch(provider.id);
4784
- console.log(chalk19.green("\u2705 \u5DF2\u5207\u6362\u5230\u65B0\u670D\u52A1\u5546"));
4785
- console.log();
4786
- console.log(chalk19.gray("\u914D\u7F6E\u5DF2\u66F4\u65B0:"));
4787
- console.log(chalk19.gray(` - ${getClaudeConfigPath()}`));
5248
+ printSuccess("\u5DF2\u5207\u6362\u5230\u65B0\u670D\u52A1\u5546", [chalk21.gray(`\u914D\u7F6E\u5DF2\u66F4\u65B0: ${getClaudeConfigPath()}`)]);
4788
5249
  } else {
4789
- console.log(chalk19.blue("\u{1F4A1} \u7A0D\u540E\u5207\u6362:") + chalk19.white(` ccman cc use "${provider.name}"`));
5250
+ printTip(`\u7A0D\u540E\u5207\u6362: ${chalk21.white(`ccman cc use "${provider.name}"`)}`);
4790
5251
  }
4791
5252
  } catch (error) {
4792
- console.error(chalk19.red(`
5253
+ console.error(chalk21.red(`
4793
5254
  \u274C ${error.message}
4794
5255
  `));
4795
5256
  process.exit(1);
@@ -4799,7 +5260,7 @@ function addCommand2(program2) {
4799
5260
 
4800
5261
  // src/commands/claude/list.ts
4801
5262
  init_dist2();
4802
- import chalk20 from "chalk";
5263
+ import chalk22 from "chalk";
4803
5264
  function listCommand2(program2) {
4804
5265
  program2.command("list").alias("ls").description("\u5217\u51FA\u6240\u6709 Claude Code \u670D\u52A1\u5546").action(async () => {
4805
5266
  try {
@@ -4807,15 +5268,15 @@ function listCommand2(program2) {
4807
5268
  const providers = manager.list();
4808
5269
  const current = manager.getCurrent();
4809
5270
  if (providers.length === 0) {
4810
- console.log(chalk20.yellow("\n\u26A0\uFE0F \u6682\u65E0 Claude Code \u670D\u52A1\u5546\n"));
4811
- console.log(chalk20.blue("\u{1F4A1} \u6DFB\u52A0\u670D\u52A1\u5546:") + chalk20.white(" ccman cc add\n"));
5271
+ printWarning("\u6682\u65E0 Claude Code \u670D\u52A1\u5546");
5272
+ printTip("\u6DFB\u52A0\u670D\u52A1\u5546: " + chalk22.white("ccman cc add"));
4812
5273
  return;
4813
5274
  }
4814
- console.log(chalk20.bold(`
4815
- \u{1F4CB} Claude Code \u670D\u52A1\u5546 (${providers.length} \u4E2A)`));
4816
- console.log(formatProviderTable(providers, current?.id));
5275
+ console.log(
5276
+ formatProviderTable(providers, current?.id, `Claude Code \u670D\u52A1\u5546 (${providers.length} \u4E2A)`)
5277
+ );
4817
5278
  } catch (error) {
4818
- console.error(chalk20.red(`
5279
+ console.error(chalk22.red(`
4819
5280
  \u274C ${error.message}
4820
5281
  `));
4821
5282
  process.exit(1);
@@ -4825,16 +5286,16 @@ function listCommand2(program2) {
4825
5286
 
4826
5287
  // src/commands/claude/use.ts
4827
5288
  init_dist2();
4828
- import chalk21 from "chalk";
4829
- import inquirer14 from "inquirer";
5289
+ import chalk23 from "chalk";
5290
+ import inquirer12 from "inquirer";
4830
5291
  function useCommand2(program2) {
4831
5292
  program2.command("use [name]").description("\u5207\u6362 Claude Code \u670D\u52A1\u5546").action(async (name) => {
4832
5293
  try {
4833
5294
  const manager = createClaudeManager();
4834
5295
  const providers = manager.list();
4835
5296
  if (providers.length === 0) {
4836
- console.log(chalk21.yellow("\n\u26A0\uFE0F \u6682\u65E0 Claude Code \u670D\u52A1\u5546\n"));
4837
- console.log(chalk21.blue("\u{1F4A1} \u6DFB\u52A0\u670D\u52A1\u5546:") + chalk21.white(" ccman cc add\n"));
5297
+ printWarning("\u6682\u65E0 Claude Code \u670D\u52A1\u5546");
5298
+ printTip("\u6DFB\u52A0\u670D\u52A1\u5546: " + chalk23.white("ccman cc add"));
4838
5299
  return;
4839
5300
  }
4840
5301
  let targetId;
@@ -4845,7 +5306,7 @@ function useCommand2(program2) {
4845
5306
  }
4846
5307
  targetId = provider2.id;
4847
5308
  } else {
4848
- const { selectedId } = await inquirer14.prompt([
5309
+ const { selectedId } = await inquirer12.prompt([
4849
5310
  {
4850
5311
  type: "list",
4851
5312
  name: "selectedId",
@@ -4860,23 +5321,19 @@ function useCommand2(program2) {
4860
5321
  }
4861
5322
  manager.switch(targetId);
4862
5323
  const provider = manager.get(targetId);
4863
- console.log();
4864
- console.log(chalk21.green("\u2705 \u5207\u6362\u6210\u529F"));
4865
- console.log();
4866
- console.log(` ${chalk21.bold(provider.name)} ${chalk21.blue("[Claude Code]")}`);
4867
- console.log(` ${chalk21.gray(`URL: ${provider.baseUrl}`)}`);
4868
- console.log();
4869
- console.log(chalk21.gray("\u914D\u7F6E\u5DF2\u66F4\u65B0:"));
4870
- console.log(chalk21.gray(` - ${getClaudeConfigPath()}`));
4871
- console.log();
5324
+ printSuccess("\u5207\u6362\u6210\u529F", [
5325
+ `${chalk23.bold(provider.name)} ${toolBadge("claude")}`,
5326
+ chalk23.gray(`URL: ${provider.baseUrl}`),
5327
+ chalk23.gray(`\u914D\u7F6E\u5DF2\u66F4\u65B0: ${getClaudeConfigPath()}`)
5328
+ ]);
4872
5329
  } catch (error) {
4873
5330
  if (error instanceof ProviderNotFoundError) {
4874
- console.error(chalk21.red(`
5331
+ console.error(chalk23.red(`
4875
5332
  \u274C \u670D\u52A1\u5546\u4E0D\u5B58\u5728: ${error.message}
4876
5333
  `));
4877
- console.log(chalk21.blue("\u{1F4A1} \u67E5\u770B\u6240\u6709\u670D\u52A1\u5546:") + chalk21.white(" ccman cc list\n"));
5334
+ console.log(chalk23.blue("\u{1F4A1} \u67E5\u770B\u6240\u6709\u670D\u52A1\u5546:") + chalk23.white(" ccman cc list\n"));
4878
5335
  } else {
4879
- console.error(chalk21.red(`
5336
+ console.error(chalk23.red(`
4880
5337
  \u274C ${error.message}
4881
5338
  `));
4882
5339
  }
@@ -4887,28 +5344,30 @@ function useCommand2(program2) {
4887
5344
 
4888
5345
  // src/commands/claude/current.ts
4889
5346
  init_dist2();
4890
- import chalk22 from "chalk";
5347
+ import chalk24 from "chalk";
4891
5348
  function currentCommand2(program2) {
4892
5349
  program2.command("current").description("\u663E\u793A\u5F53\u524D\u4F7F\u7528\u7684 Claude Code \u670D\u52A1\u5546").action(async () => {
4893
5350
  try {
4894
5351
  const manager = createClaudeManager();
4895
5352
  const current = manager.getCurrent();
4896
5353
  if (!current) {
4897
- console.log(chalk22.yellow("\n\u26A0\uFE0F \u672A\u9009\u62E9\u4EFB\u4F55 Claude Code \u670D\u52A1\u5546\n"));
4898
- console.log(chalk22.blue("\u{1F4A1} \u9009\u62E9\u670D\u52A1\u5546:") + chalk22.white(" ccman cc use\n"));
5354
+ printWarning("\u672A\u9009\u62E9\u4EFB\u4F55 Claude Code \u670D\u52A1\u5546");
5355
+ printTip("\u9009\u62E9\u670D\u52A1\u5546: " + chalk24.white("ccman cc use"));
4899
5356
  return;
4900
5357
  }
4901
- console.log(chalk22.bold("\n\u{1F4CD} \u5F53\u524D Claude Code \u670D\u52A1\u5546\n"));
4902
- console.log(` ${chalk22.green.bold(current.name)}`);
4903
- console.log(` ${chalk22.gray(`ID: ${current.id}`)}`);
4904
- console.log(` ${chalk22.gray(`URL: ${current.baseUrl}`)}`);
5358
+ const lines = [
5359
+ chalk24.green.bold(current.name),
5360
+ chalk24.gray(`ID: ${current.id}`),
5361
+ chalk24.gray(`URL: ${current.baseUrl}`)
5362
+ ];
4905
5363
  if (current.lastUsedAt) {
4906
- const date = new Date(current.lastUsedAt).toLocaleString("zh-CN");
4907
- console.log(` ${chalk22.gray(`\u6700\u540E\u4F7F\u7528: ${date}`)}`);
5364
+ lines.push(
5365
+ chalk24.gray(`\u6700\u540E\u4F7F\u7528: ${new Date(current.lastUsedAt).toLocaleString("zh-CN")}`)
5366
+ );
4908
5367
  }
4909
- console.log();
5368
+ printInfo("\u{1F4CD} \u5F53\u524D Claude Code \u670D\u52A1\u5546", lines);
4910
5369
  } catch (error) {
4911
- console.error(chalk22.red(`
5370
+ console.error(chalk24.red(`
4912
5371
  \u274C ${error.message}
4913
5372
  `));
4914
5373
  process.exit(1);
@@ -4918,16 +5377,17 @@ function currentCommand2(program2) {
4918
5377
 
4919
5378
  // src/commands/claude/remove.ts
4920
5379
  init_dist2();
4921
- init_confirm();
4922
- import chalk23 from "chalk";
4923
- import inquirer15 from "inquirer";
5380
+ import chalk25 from "chalk";
5381
+ import inquirer13 from "inquirer";
4924
5382
  function removeCommand2(program2) {
4925
- program2.command("remove [name]").alias("rm").description("\u5220\u9664 Claude Code \u670D\u52A1\u5546").action(async (name) => {
5383
+ const command = program2.command("remove [name]").alias("rm").description("\u5220\u9664 Claude Code \u670D\u52A1\u5546");
5384
+ addProviderRemoveOptions(command);
5385
+ command.action(async (name, options) => {
4926
5386
  try {
4927
5387
  const manager = createClaudeManager();
4928
5388
  const providers = manager.list();
4929
5389
  if (providers.length === 0) {
4930
- console.log(chalk23.yellow("\n\u26A0\uFE0F \u6682\u65E0 Claude Code \u670D\u52A1\u5546\n"));
5390
+ console.log(chalk25.yellow("\n\u26A0\uFE0F \u6682\u65E0 Claude Code \u670D\u52A1\u5546\n"));
4931
5391
  return;
4932
5392
  }
4933
5393
  let targetId;
@@ -4939,8 +5399,10 @@ function removeCommand2(program2) {
4939
5399
  }
4940
5400
  targetId = provider.id;
4941
5401
  targetName = provider.name;
5402
+ } else if (options.yes) {
5403
+ throw new Error("\u975E\u4EA4\u4E92\u6A21\u5F0F\u8BF7\u63D0\u4F9B\u8981\u5220\u9664\u7684\u670D\u52A1\u5546\u540D\u79F0");
4942
5404
  } else {
4943
- const { selectedId } = await inquirer15.prompt([
5405
+ const { selectedId } = await inquirer13.prompt([
4944
5406
  {
4945
5407
  type: "list",
4946
5408
  name: "selectedId",
@@ -4955,23 +5417,23 @@ function removeCommand2(program2) {
4955
5417
  targetId = selectedId;
4956
5418
  targetName = provider.name;
4957
5419
  }
4958
- const confirmed = await promptConfirm(`\u786E\u5B9A\u5220\u9664 "${targetName}"?`, false);
5420
+ const confirmed = await confirmProviderRemoval(targetName, options);
4959
5421
  if (!confirmed) {
4960
- console.log(chalk23.gray("\n\u5DF2\u53D6\u6D88\n"));
5422
+ console.log(chalk25.gray("\n\u5DF2\u53D6\u6D88\n"));
4961
5423
  return;
4962
5424
  }
4963
5425
  manager.remove(targetId);
4964
5426
  console.log();
4965
- console.log(chalk23.green(`\u2705 \u5DF2\u5220\u9664: ${targetName}`));
5427
+ console.log(chalk25.green(`\u2705 \u5DF2\u5220\u9664: ${targetName}`));
4966
5428
  console.log();
4967
5429
  } catch (error) {
4968
5430
  if (error instanceof ProviderNotFoundError) {
4969
- console.error(chalk23.red(`
5431
+ console.error(chalk25.red(`
4970
5432
  \u274C \u670D\u52A1\u5546\u4E0D\u5B58\u5728
4971
5433
  `));
4972
- console.log(chalk23.blue("\u{1F4A1} \u67E5\u770B\u6240\u6709\u670D\u52A1\u5546:") + chalk23.white(" ccman cc list\n"));
5434
+ console.log(chalk25.blue("\u{1F4A1} \u67E5\u770B\u6240\u6709\u670D\u52A1\u5546:") + chalk25.white(" ccman cc list\n"));
4973
5435
  } else {
4974
- console.error(chalk23.red(`
5436
+ console.error(chalk25.red(`
4975
5437
  \u274C ${error.message}
4976
5438
  `));
4977
5439
  }
@@ -4982,17 +5444,20 @@ function removeCommand2(program2) {
4982
5444
 
4983
5445
  // src/commands/claude/edit.ts
4984
5446
  init_dist2();
4985
- import chalk24 from "chalk";
4986
- import inquirer16 from "inquirer";
5447
+ import chalk26 from "chalk";
5448
+ import inquirer14 from "inquirer";
4987
5449
  function editCommand2(program2) {
4988
- program2.command("edit [name]").description("\u7F16\u8F91 Claude Code \u670D\u52A1\u5546").action(async (name) => {
5450
+ const command = program2.command("edit [name]").description("\u7F16\u8F91 Claude Code \u670D\u52A1\u5546");
5451
+ addProviderEditOptions(command);
5452
+ command.action(async (name, options) => {
4989
5453
  try {
4990
5454
  const manager = createClaudeManager();
4991
5455
  const providers = manager.list();
4992
5456
  if (providers.length === 0) {
4993
- console.log(chalk24.yellow("\n\u26A0\uFE0F \u6682\u65E0 Claude Code \u670D\u52A1\u5546\n"));
5457
+ console.log(chalk26.yellow("\n\u26A0\uFE0F \u6682\u65E0 Claude Code \u670D\u52A1\u5546\n"));
4994
5458
  return;
4995
5459
  }
5460
+ const resolved = resolveProviderEditInput(options);
4996
5461
  let targetId;
4997
5462
  if (name) {
4998
5463
  const provider2 = manager.findByName(name);
@@ -5000,8 +5465,10 @@ function editCommand2(program2) {
5000
5465
  throw new ProviderNotFoundError(name);
5001
5466
  }
5002
5467
  targetId = provider2.id;
5468
+ } else if (resolved.nonInteractive) {
5469
+ throw new Error("\u975E\u4EA4\u4E92\u6A21\u5F0F\u8BF7\u63D0\u4F9B\u8981\u7F16\u8F91\u7684\u670D\u52A1\u5546\u540D\u79F0");
5003
5470
  } else {
5004
- const { selectedId } = await inquirer16.prompt([
5471
+ const { selectedId } = await inquirer14.prompt([
5005
5472
  {
5006
5473
  type: "list",
5007
5474
  name: "selectedId",
@@ -5015,9 +5482,24 @@ function editCommand2(program2) {
5015
5482
  targetId = selectedId;
5016
5483
  }
5017
5484
  const provider = manager.get(targetId);
5018
- console.log(chalk24.bold("\n\u270F\uFE0F \u7F16\u8F91\u670D\u52A1\u5546\n"));
5019
- console.log(chalk24.gray("\u63D0\u793A: \u7559\u7A7A\u5219\u4FDD\u6301\u539F\u503C\n"));
5020
- const answers = await inquirer16.prompt([
5485
+ if (resolved.nonInteractive) {
5486
+ if (Object.keys(resolved.updates).length === 0) {
5487
+ console.log(chalk26.gray("\n\u672A\u505A\u4EFB\u4F55\u4FEE\u6539\n"));
5488
+ return;
5489
+ }
5490
+ const updated2 = manager.edit(targetId, resolved.updates);
5491
+ console.log();
5492
+ console.log(chalk26.green("\u2705 \u7F16\u8F91\u6210\u529F"));
5493
+ console.log();
5494
+ console.log(` ${chalk26.bold(updated2.name)} ${chalk26.blue("[Claude Code]")}`);
5495
+ console.log(` ${chalk26.gray(`ID: ${updated2.id}`)}`);
5496
+ console.log(` ${chalk26.gray(`URL: ${updated2.baseUrl}`)}`);
5497
+ console.log();
5498
+ return;
5499
+ }
5500
+ console.log(chalk26.bold("\n\u270F\uFE0F \u7F16\u8F91\u670D\u52A1\u5546\n"));
5501
+ console.log(chalk26.gray("\u63D0\u793A: \u7559\u7A7A\u5219\u4FDD\u6301\u539F\u503C\n"));
5502
+ const answers = await inquirer14.prompt([
5021
5503
  {
5022
5504
  type: "input",
5023
5505
  name: "name",
@@ -5048,19 +5530,19 @@ function editCommand2(program2) {
5048
5530
  if (answers.baseUrl && answers.baseUrl !== provider.baseUrl) updates.baseUrl = answers.baseUrl;
5049
5531
  if (answers.apiKey) updates.apiKey = answers.apiKey;
5050
5532
  if (Object.keys(updates).length === 0) {
5051
- console.log(chalk24.gray("\n\u672A\u505A\u4EFB\u4F55\u4FEE\u6539\n"));
5533
+ console.log(chalk26.gray("\n\u672A\u505A\u4EFB\u4F55\u4FEE\u6539\n"));
5052
5534
  return;
5053
5535
  }
5054
5536
  const updated = manager.edit(targetId, updates);
5055
5537
  console.log();
5056
- console.log(chalk24.green("\u2705 \u7F16\u8F91\u6210\u529F"));
5538
+ console.log(chalk26.green("\u2705 \u7F16\u8F91\u6210\u529F"));
5057
5539
  console.log();
5058
- console.log(` ${chalk24.bold(updated.name)} ${chalk24.blue("[Claude Code]")}`);
5059
- console.log(` ${chalk24.gray(`ID: ${updated.id}`)}`);
5060
- console.log(` ${chalk24.gray(`URL: ${updated.baseUrl}`)}`);
5540
+ console.log(` ${chalk26.bold(updated.name)} ${chalk26.blue("[Claude Code]")}`);
5541
+ console.log(` ${chalk26.gray(`ID: ${updated.id}`)}`);
5542
+ console.log(` ${chalk26.gray(`URL: ${updated.baseUrl}`)}`);
5061
5543
  console.log();
5062
5544
  } catch (error) {
5063
- console.error(chalk24.red(`
5545
+ console.error(chalk26.red(`
5064
5546
  \u274C ${error.message}
5065
5547
  `));
5066
5548
  process.exit(1);
@@ -5070,15 +5552,15 @@ function editCommand2(program2) {
5070
5552
 
5071
5553
  // src/commands/claude/clone.ts
5072
5554
  init_dist2();
5073
- import chalk25 from "chalk";
5074
- import inquirer17 from "inquirer";
5555
+ import chalk27 from "chalk";
5556
+ import inquirer15 from "inquirer";
5075
5557
  function cloneCommand2(program2) {
5076
5558
  program2.command("clone [source-name] [new-name]").description("\u514B\u9686 Claude Code \u670D\u52A1\u5546").action(async (sourceName, newName) => {
5077
5559
  try {
5078
5560
  const manager = createClaudeManager();
5079
5561
  const providers = manager.list();
5080
5562
  if (providers.length === 0) {
5081
- console.log(chalk25.yellow("\n\u26A0\uFE0F \u6682\u65E0 Claude Code \u670D\u52A1\u5546\n"));
5563
+ console.log(chalk27.yellow("\n\u26A0\uFE0F \u6682\u65E0 Claude Code \u670D\u52A1\u5546\n"));
5082
5564
  return;
5083
5565
  }
5084
5566
  let sourceId;
@@ -5089,7 +5571,7 @@ function cloneCommand2(program2) {
5089
5571
  }
5090
5572
  sourceId = provider.id;
5091
5573
  } else {
5092
- const { selectedId } = await inquirer17.prompt([
5574
+ const { selectedId } = await inquirer15.prompt([
5093
5575
  {
5094
5576
  type: "list",
5095
5577
  name: "selectedId",
@@ -5107,7 +5589,7 @@ function cloneCommand2(program2) {
5107
5589
  if (newName) {
5108
5590
  cloned = manager.clone(sourceId, newName);
5109
5591
  } else {
5110
- console.log(chalk25.blue(`
5592
+ console.log(chalk27.blue(`
5111
5593
  \u514B\u9686\u81EA: ${source.name}
5112
5594
  `));
5113
5595
  const input = await promptProviderForm({
@@ -5120,14 +5602,14 @@ function cloneCommand2(program2) {
5120
5602
  cloned = manager.add(input);
5121
5603
  }
5122
5604
  console.log();
5123
- console.log(chalk25.green("\u2705 \u514B\u9686\u6210\u529F"));
5605
+ console.log(chalk27.green("\u2705 \u514B\u9686\u6210\u529F"));
5124
5606
  console.log();
5125
- console.log(` ${chalk25.bold(cloned.name)} ${chalk25.blue("[Claude Code]")}`);
5126
- console.log(` ${chalk25.gray(`ID: ${cloned.id}`)}`);
5127
- console.log(` ${chalk25.gray(`URL: ${cloned.baseUrl}`)}`);
5607
+ console.log(` ${chalk27.bold(cloned.name)} ${chalk27.blue("[Claude Code]")}`);
5608
+ console.log(` ${chalk27.gray(`ID: ${cloned.id}`)}`);
5609
+ console.log(` ${chalk27.gray(`URL: ${cloned.baseUrl}`)}`);
5128
5610
  console.log();
5129
5611
  } catch (error) {
5130
- console.error(chalk25.red(`
5612
+ console.error(chalk27.red(`
5131
5613
  \u274C ${error.message}
5132
5614
  `));
5133
5615
  process.exit(1);
@@ -5138,8 +5620,8 @@ function cloneCommand2(program2) {
5138
5620
  // src/commands/clean.ts
5139
5621
  init_dist2();
5140
5622
  init_confirm();
5141
- import chalk26 from "chalk";
5142
- import inquirer18 from "inquirer";
5623
+ import chalk28 from "chalk";
5624
+ import inquirer16 from "inquirer";
5143
5625
  function formatBytes2(bytes) {
5144
5626
  if (bytes < 1024) return `${bytes} B`;
5145
5627
  if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;
@@ -5147,30 +5629,30 @@ function formatBytes2(bytes) {
5147
5629
  }
5148
5630
  function displayAnalysis() {
5149
5631
  try {
5150
- console.log(chalk26.bold("\n\u{1F4CA} \u5206\u6790 ~/.claude.json\n"));
5632
+ console.log(chalk28.bold("\n\u{1F4CA} \u5206\u6790 ~/.claude.json\n"));
5151
5633
  const analysis = analyzeClaudeJson();
5152
- console.log(chalk26.cyan("\u6587\u4EF6\u5927\u5C0F:"), chalk26.bold(analysis.fileSizeFormatted));
5634
+ console.log(chalk28.cyan("\u6587\u4EF6\u5927\u5C0F:"), chalk28.bold(analysis.fileSizeFormatted));
5153
5635
  console.log();
5154
- console.log(chalk26.cyan("\u9879\u76EE\u7EDF\u8BA1:"));
5155
- console.log(` \u9879\u76EE\u603B\u6570: ${chalk26.bold(analysis.projectCount)}`);
5156
- console.log(` \u5386\u53F2\u8BB0\u5F55\u603B\u6570: ${chalk26.bold(analysis.totalHistoryCount)} \u6761`);
5636
+ console.log(chalk28.cyan("\u9879\u76EE\u7EDF\u8BA1:"));
5637
+ console.log(` \u9879\u76EE\u603B\u6570: ${chalk28.bold(analysis.projectCount)}`);
5638
+ console.log(` \u5386\u53F2\u8BB0\u5F55\u603B\u6570: ${chalk28.bold(analysis.totalHistoryCount)} \u6761`);
5157
5639
  console.log();
5158
- console.log(chalk26.cyan("\u5386\u53F2\u8BB0\u5F55\u6700\u591A\u7684\u9879\u76EE:"));
5640
+ console.log(chalk28.cyan("\u5386\u53F2\u8BB0\u5F55\u6700\u591A\u7684\u9879\u76EE:"));
5159
5641
  const top5 = analysis.projectHistory.slice(0, 5);
5160
5642
  for (const project of top5) {
5161
5643
  const displayPath = project.path.length > 50 ? "..." + project.path.slice(-47) : project.path;
5162
- console.log(` ${chalk26.bold(project.count.toString().padStart(3))} \u6761 ${displayPath}`);
5644
+ console.log(` ${chalk28.bold(project.count.toString().padStart(3))} \u6761 ${displayPath}`);
5163
5645
  }
5164
5646
  console.log();
5165
- console.log(chalk26.cyan("\u9884\u8BA1\u53EF\u8282\u7701\u7A7A\u95F4:"));
5166
- console.log(` ${chalk26.green("\u4FDD\u5B88\u6E05\u7406")} (\u4FDD\u755910\u6761): ${chalk26.bold(formatBytes2(analysis.estimatedSavings.conservative))}`);
5167
- console.log(` ${chalk26.yellow("\u4E2D\u7B49\u6E05\u7406")} (\u4FDD\u75595\u6761): ${chalk26.bold(formatBytes2(analysis.estimatedSavings.moderate))}`);
5168
- console.log(` ${chalk26.red("\u6FC0\u8FDB\u6E05\u7406")} (\u6E05\u7A7A\u5386\u53F2): ${chalk26.bold(formatBytes2(analysis.estimatedSavings.aggressive))}`);
5647
+ console.log(chalk28.cyan("\u9884\u8BA1\u53EF\u8282\u7701\u7A7A\u95F4:"));
5648
+ console.log(` ${chalk28.green("\u4FDD\u5B88\u6E05\u7406")} (\u4FDD\u755910\u6761): ${chalk28.bold(formatBytes2(analysis.estimatedSavings.conservative))}`);
5649
+ console.log(` ${chalk28.yellow("\u4E2D\u7B49\u6E05\u7406")} (\u4FDD\u75595\u6761): ${chalk28.bold(formatBytes2(analysis.estimatedSavings.moderate))}`);
5650
+ console.log(` ${chalk28.red("\u6FC0\u8FDB\u6E05\u7406")} (\u6E05\u7A7A\u5386\u53F2): ${chalk28.bold(formatBytes2(analysis.estimatedSavings.aggressive))}`);
5169
5651
  console.log();
5170
- console.log(chalk26.blue(`\u{1F4A1} \u6267\u884C\u6E05\u7406: ccman cc clean
5652
+ console.log(chalk28.blue(`\u{1F4A1} \u6267\u884C\u6E05\u7406: ccman cc clean
5171
5653
  `));
5172
5654
  } catch (error) {
5173
- console.error(chalk26.red(`
5655
+ console.error(chalk28.red(`
5174
5656
  \u274C ${error.message}
5175
5657
  `));
5176
5658
  process.exit(1);
@@ -5184,9 +5666,9 @@ function cleanAnalyzeCommand(program2) {
5184
5666
  function cleanCommand(program2) {
5185
5667
  program2.command("clean").description("\u6E05\u7406 ~/.claude.json \u6587\u4EF6\uFF08\u5386\u53F2\u8BB0\u5F55\u3001\u7F13\u5B58\u7B49\uFF09").option("--preset <type>", "\u4F7F\u7528\u9884\u8BBE\u65B9\u6848 (conservative|moderate|aggressive)").option("--keep <count>", "\u4FDD\u7559\u6700\u8FD1N\u6761\u5386\u53F2\u8BB0\u5F55").option("--cache", "\u6E05\u7406\u7F13\u5B58\u6570\u636E").option("--stats", "\u91CD\u7F6E\u4F7F\u7528\u7EDF\u8BA1").option("--projects <paths>", "\u53EA\u6E05\u7406\u6307\u5B9A\u9879\u76EE\uFF08\u9017\u53F7\u5206\u9694\uFF09").action(async (options) => {
5186
5668
  try {
5187
- console.log(chalk26.bold("\n\u{1F9F9} \u6E05\u7406 ~/.claude.json\n"));
5669
+ console.log(chalk28.bold("\n\u{1F9F9} \u6E05\u7406 ~/.claude.json\n"));
5188
5670
  const analysis = analyzeClaudeJson();
5189
- console.log(`\u5F53\u524D\u6587\u4EF6\u5927\u5C0F: ${chalk26.bold(analysis.fileSizeFormatted)}`);
5671
+ console.log(`\u5F53\u524D\u6587\u4EF6\u5927\u5C0F: ${chalk28.bold(analysis.fileSizeFormatted)}`);
5190
5672
  console.log(`\u9879\u76EE\u6570: ${analysis.projectCount}, \u5386\u53F2\u8BB0\u5F55: ${analysis.totalHistoryCount} \u6761`);
5191
5673
  console.log();
5192
5674
  let cleanOptions;
@@ -5197,30 +5679,30 @@ function cleanCommand(program2) {
5197
5679
  }
5198
5680
  const confirmed = await promptConfirm("\u786E\u8BA4\u6267\u884C\u6E05\u7406\uFF1F\uFF08\u4F1A\u81EA\u52A8\u5907\u4EFD\u539F\u6587\u4EF6\uFF09", true);
5199
5681
  if (!confirmed) {
5200
- console.log(chalk26.yellow("\n\u274C \u5DF2\u53D6\u6D88\n"));
5682
+ console.log(chalk28.yellow("\n\u274C \u5DF2\u53D6\u6D88\n"));
5201
5683
  return;
5202
5684
  }
5203
- console.log(chalk26.cyan("\n\u6B63\u5728\u6E05\u7406...\n"));
5685
+ console.log(chalk28.cyan("\n\u6B63\u5728\u6E05\u7406...\n"));
5204
5686
  const result = cleanClaudeJson(cleanOptions);
5205
- console.log(chalk26.green("\u2705 \u6E05\u7406\u5B8C\u6210\n"));
5206
- console.log(`\u6E05\u7406\u524D: ${chalk26.bold(formatBytes2(result.sizeBefore))}`);
5207
- console.log(`\u6E05\u7406\u540E: ${chalk26.bold(formatBytes2(result.sizeAfter))}`);
5208
- console.log(`\u8282\u7701\u7A7A\u95F4: ${chalk26.green.bold(formatBytes2(result.saved))} (${(result.saved / result.sizeBefore * 100).toFixed(1)}%)`);
5687
+ console.log(chalk28.green("\u2705 \u6E05\u7406\u5B8C\u6210\n"));
5688
+ console.log(`\u6E05\u7406\u524D: ${chalk28.bold(formatBytes2(result.sizeBefore))}`);
5689
+ console.log(`\u6E05\u7406\u540E: ${chalk28.bold(formatBytes2(result.sizeAfter))}`);
5690
+ console.log(`\u8282\u7701\u7A7A\u95F4: ${chalk28.green.bold(formatBytes2(result.saved))} (${(result.saved / result.sizeBefore * 100).toFixed(1)}%)`);
5209
5691
  console.log();
5210
5692
  if (result.cleanedItems.projectHistory > 0) {
5211
- console.log(`\u6E05\u7406\u5386\u53F2\u8BB0\u5F55: ${chalk26.bold(result.cleanedItems.projectHistory)} \u6761`);
5693
+ console.log(`\u6E05\u7406\u5386\u53F2\u8BB0\u5F55: ${chalk28.bold(result.cleanedItems.projectHistory)} \u6761`);
5212
5694
  }
5213
5695
  if (result.cleanedItems.cache) {
5214
- console.log(`\u6E05\u7406\u7F13\u5B58: ${chalk26.green("\u2713")}`);
5696
+ console.log(`\u6E05\u7406\u7F13\u5B58: ${chalk28.green("\u2713")}`);
5215
5697
  }
5216
5698
  if (result.cleanedItems.stats) {
5217
- console.log(`\u91CD\u7F6E\u7EDF\u8BA1: ${chalk26.green("\u2713")}`);
5699
+ console.log(`\u91CD\u7F6E\u7EDF\u8BA1: ${chalk28.green("\u2713")}`);
5218
5700
  }
5219
5701
  console.log();
5220
- console.log(`\u5907\u4EFD\u6587\u4EF6: ${chalk26.cyan(result.backupPath)}`);
5702
+ console.log(`\u5907\u4EFD\u6587\u4EF6: ${chalk28.cyan(result.backupPath)}`);
5221
5703
  console.log();
5222
5704
  } catch (error) {
5223
- console.error(chalk26.red(`
5705
+ console.error(chalk28.red(`
5224
5706
  \u274C ${error.message}
5225
5707
  `));
5226
5708
  process.exit(1);
@@ -5258,32 +5740,32 @@ function buildOptionsFromArgs(args) {
5258
5740
  options.projectPaths = args.projects.split(",").map((p) => p.trim());
5259
5741
  }
5260
5742
  if (!options.cleanProjectHistory && !options.cleanCache && !options.cleanStats) {
5261
- console.log(chalk26.yellow("\u672A\u6307\u5B9A\u6E05\u7406\u9009\u9879\uFF0C\u4F7F\u7528\u4FDD\u5B88\u9884\u8BBE\n"));
5743
+ console.log(chalk28.yellow("\u672A\u6307\u5B9A\u6E05\u7406\u9009\u9879\uFF0C\u4F7F\u7528\u4FDD\u5B88\u9884\u8BBE\n"));
5262
5744
  return CleanPresets.conservative();
5263
5745
  }
5264
5746
  return options;
5265
5747
  }
5266
5748
  async function promptForOptions(analysis) {
5267
- const answers = await inquirer18.prompt([
5749
+ const answers = await inquirer16.prompt([
5268
5750
  {
5269
5751
  type: "list",
5270
5752
  name: "preset",
5271
5753
  message: "\u9009\u62E9\u6E05\u7406\u65B9\u6848:",
5272
5754
  choices: [
5273
5755
  {
5274
- name: `${chalk26.green("\u4FDD\u5B88\u6E05\u7406")} - \u4FDD\u7559\u6700\u8FD110\u6761\u8BB0\u5F55\uFF0C\u6E05\u7406\u7F13\u5B58 (\u8282\u7701\u7EA6 ${formatBytes2(analysis.estimatedSavings.conservative)})`,
5756
+ name: `${chalk28.green("\u4FDD\u5B88\u6E05\u7406")} - \u4FDD\u7559\u6700\u8FD110\u6761\u8BB0\u5F55\uFF0C\u6E05\u7406\u7F13\u5B58 (\u8282\u7701\u7EA6 ${formatBytes2(analysis.estimatedSavings.conservative)})`,
5275
5757
  value: "conservative"
5276
5758
  },
5277
5759
  {
5278
- name: `${chalk26.yellow("\u4E2D\u7B49\u6E05\u7406")} - \u4FDD\u7559\u6700\u8FD15\u6761\u8BB0\u5F55\uFF0C\u6E05\u7406\u7F13\u5B58\u548C\u7EDF\u8BA1 (\u8282\u7701\u7EA6 ${formatBytes2(analysis.estimatedSavings.moderate)})`,
5760
+ name: `${chalk28.yellow("\u4E2D\u7B49\u6E05\u7406")} - \u4FDD\u7559\u6700\u8FD15\u6761\u8BB0\u5F55\uFF0C\u6E05\u7406\u7F13\u5B58\u548C\u7EDF\u8BA1 (\u8282\u7701\u7EA6 ${formatBytes2(analysis.estimatedSavings.moderate)})`,
5279
5761
  value: "moderate"
5280
5762
  },
5281
5763
  {
5282
- name: `${chalk26.red("\u6FC0\u8FDB\u6E05\u7406")} - \u6E05\u7A7A\u5386\u53F2\u8BB0\u5F55\uFF0C\u6E05\u7406\u7F13\u5B58\u548C\u7EDF\u8BA1 (\u8282\u7701\u7EA6 ${formatBytes2(analysis.estimatedSavings.aggressive)})`,
5764
+ name: `${chalk28.red("\u6FC0\u8FDB\u6E05\u7406")} - \u6E05\u7A7A\u5386\u53F2\u8BB0\u5F55\uFF0C\u6E05\u7406\u7F13\u5B58\u548C\u7EDF\u8BA1 (\u8282\u7701\u7EA6 ${formatBytes2(analysis.estimatedSavings.aggressive)})`,
5283
5765
  value: "aggressive"
5284
5766
  },
5285
5767
  {
5286
- name: `${chalk26.cyan("\u81EA\u5B9A\u4E49")} - \u81EA\u5B9A\u4E49\u6E05\u7406\u9009\u9879`,
5768
+ name: `${chalk28.cyan("\u81EA\u5B9A\u4E49")} - \u81EA\u5B9A\u4E49\u6E05\u7406\u9009\u9879`,
5287
5769
  value: "custom"
5288
5770
  }
5289
5771
  ]
@@ -5301,7 +5783,7 @@ async function promptForOptions(analysis) {
5301
5783
  const cleanHistory = await promptConfirm("\u6E05\u7406\u9879\u76EE\u5386\u53F2\u8BB0\u5F55\uFF1F", true);
5302
5784
  let keepCount = 10;
5303
5785
  if (cleanHistory) {
5304
- const answers2 = await inquirer18.prompt([
5786
+ const answers2 = await inquirer16.prompt([
5305
5787
  {
5306
5788
  type: "number",
5307
5789
  name: "keepCount",
@@ -5336,14 +5818,14 @@ function createClaudeCommands(program2) {
5336
5818
 
5337
5819
  // src/commands/mcp/add.ts
5338
5820
  init_dist2();
5339
- import chalk27 from "chalk";
5340
- import inquirer19 from "inquirer";
5821
+ import chalk29 from "chalk";
5822
+ import inquirer17 from "inquirer";
5341
5823
  function addCommand3(program2) {
5342
5824
  program2.command("add").description("\u6DFB\u52A0\u65B0\u7684 MCP \u670D\u52A1\u5668(\u4EA4\u4E92\u5F0F)").action(async () => {
5343
5825
  try {
5344
5826
  const manager = createMCPManager();
5345
- console.log(chalk27.bold("\n\u{1F4DD} \u6DFB\u52A0 MCP \u670D\u52A1\u5668\n"));
5346
- const { usePreset } = await inquirer19.prompt([
5827
+ console.log(chalk29.bold("\n\u{1F4DD} \u6DFB\u52A0 MCP \u670D\u52A1\u5668\n"));
5828
+ const { usePreset } = await inquirer17.prompt([
5347
5829
  {
5348
5830
  type: "list",
5349
5831
  name: "usePreset",
@@ -5359,7 +5841,7 @@ function addCommand3(program2) {
5359
5841
  let args;
5360
5842
  let env;
5361
5843
  if (usePreset) {
5362
- const { presetName } = await inquirer19.prompt([
5844
+ const { presetName } = await inquirer17.prompt([
5363
5845
  {
5364
5846
  type: "list",
5365
5847
  name: "presetName",
@@ -5371,18 +5853,18 @@ function addCommand3(program2) {
5371
5853
  }
5372
5854
  ]);
5373
5855
  const preset = MCP_PRESETS_DETAIL.find((p) => p.name === presetName);
5374
- console.log(chalk27.blue(`
5856
+ console.log(chalk29.blue(`
5375
5857
  \u4F7F\u7528\u9884\u8BBE: ${preset.name} - ${preset.description}
5376
5858
  `));
5377
5859
  if (preset.argsPlaceholder) {
5378
- console.log(chalk27.yellow(`\u26A0\uFE0F ${preset.argsPlaceholder}
5860
+ console.log(chalk29.yellow(`\u26A0\uFE0F ${preset.argsPlaceholder}
5379
5861
  `));
5380
5862
  }
5381
5863
  if (preset.envRequired && preset.envRequired.length > 0) {
5382
- console.log(chalk27.yellow(`\u26A0\uFE0F \u9700\u8981\u914D\u7F6E\u73AF\u5883\u53D8\u91CF: ${preset.envRequired.join(", ")}
5864
+ console.log(chalk29.yellow(`\u26A0\uFE0F \u9700\u8981\u914D\u7F6E\u73AF\u5883\u53D8\u91CF: ${preset.envRequired.join(", ")}
5383
5865
  `));
5384
5866
  }
5385
- const input = await inquirer19.prompt([
5867
+ const input = await inquirer17.prompt([
5386
5868
  {
5387
5869
  type: "input",
5388
5870
  name: "name",
@@ -5425,7 +5907,7 @@ function addCommand3(program2) {
5425
5907
  args = input.args.split(" ").filter((arg) => arg.length > 0);
5426
5908
  env = input.env ? JSON.parse(input.env) : void 0;
5427
5909
  } else {
5428
- const answers = await inquirer19.prompt([
5910
+ const answers = await inquirer17.prompt([
5429
5911
  {
5430
5912
  type: "input",
5431
5913
  name: "name",
@@ -5473,21 +5955,21 @@ function addCommand3(program2) {
5473
5955
  model: env ? JSON.stringify(env) : void 0
5474
5956
  });
5475
5957
  console.log();
5476
- console.log(chalk27.green("\u2705 MCP \u670D\u52A1\u5668\u6DFB\u52A0\u6210\u529F"));
5958
+ console.log(chalk29.green("\u2705 MCP \u670D\u52A1\u5668\u6DFB\u52A0\u6210\u529F"));
5477
5959
  console.log();
5478
- console.log(` ${chalk27.bold(provider.name)} ${chalk27.blue("[MCP]")}`);
5479
- console.log(` ${chalk27.gray(`${command} ${args.join(" ")}`)}`);
5960
+ console.log(` ${chalk29.bold(provider.name)} ${chalk29.blue("[MCP]")}`);
5961
+ console.log(` ${chalk29.gray(`${command} ${args.join(" ")}`)}`);
5480
5962
  if (env) {
5481
- console.log(chalk27.gray(` \u73AF\u5883\u53D8\u91CF: ${Object.keys(env).join(", ")}`));
5963
+ console.log(chalk29.gray(` \u73AF\u5883\u53D8\u91CF: ${Object.keys(env).join(", ")}`));
5482
5964
  }
5483
5965
  console.log();
5484
- console.log(chalk27.green("\u2705 \u914D\u7F6E\u5DF2\u81EA\u52A8\u540C\u6B65\u5230 ~/.claude.json"));
5966
+ console.log(chalk29.green("\u2705 \u914D\u7F6E\u5DF2\u81EA\u52A8\u540C\u6B65\u5230 ~/.claude.json"));
5485
5967
  console.log();
5486
- console.log(chalk27.gray("\u914D\u7F6E\u6587\u4EF6:"));
5487
- console.log(chalk27.gray(` - ${getClaudeConfigPath()}`));
5968
+ console.log(chalk29.gray("\u914D\u7F6E\u6587\u4EF6:"));
5969
+ console.log(chalk29.gray(` - ${getClaudeConfigPath()}`));
5488
5970
  console.log();
5489
5971
  } catch (error) {
5490
- console.error(chalk27.red(`
5972
+ console.error(chalk29.red(`
5491
5973
  \u274C ${error.message}
5492
5974
  `));
5493
5975
  process.exit(1);
@@ -5497,25 +5979,25 @@ function addCommand3(program2) {
5497
5979
 
5498
5980
  // src/commands/mcp/list.ts
5499
5981
  init_dist2();
5500
- import chalk28 from "chalk";
5982
+ import chalk30 from "chalk";
5501
5983
  function listCommand3(program2) {
5502
5984
  program2.command("list").alias("ls").description("\u5217\u51FA\u6240\u6709 MCP \u670D\u52A1\u5668").action(async () => {
5503
5985
  try {
5504
5986
  const manager = createMCPManager();
5505
5987
  const providers = manager.list();
5506
5988
  if (providers.length === 0) {
5507
- console.log(chalk28.yellow("\n\u26A0\uFE0F \u6682\u65E0 MCP \u670D\u52A1\u5668\n"));
5508
- console.log(chalk28.blue("\u{1F4A1} \u6DFB\u52A0 MCP \u670D\u52A1\u5668:") + chalk28.white(" ccman mcp add\n"));
5989
+ console.log(chalk30.yellow("\n\u26A0\uFE0F \u6682\u65E0 MCP \u670D\u52A1\u5668\n"));
5990
+ console.log(chalk30.blue("\u{1F4A1} \u6DFB\u52A0 MCP \u670D\u52A1\u5668:") + chalk30.white(" ccman mcp add\n"));
5509
5991
  return;
5510
5992
  }
5511
- console.log(chalk28.bold(`
5993
+ console.log(chalk30.bold(`
5512
5994
  \u{1F4CB} MCP \u670D\u52A1\u5668 (${providers.length} \u4E2A)
5513
5995
  `));
5514
5996
  providers.forEach((provider) => {
5515
5997
  const isActive = false;
5516
- const indicator = isActive ? chalk28.green("\u25CF") : chalk28.gray("\u25CB");
5517
- const nameDisplay = chalk28.bold(provider.name);
5518
- const commandDisplay = chalk28.gray(`${provider.baseUrl} ${provider.apiKey}`);
5998
+ const indicator = isActive ? chalk30.green("\u25CF") : chalk30.gray("\u25CB");
5999
+ const nameDisplay = chalk30.bold(provider.name);
6000
+ const commandDisplay = chalk30.gray(`${provider.baseUrl} ${provider.apiKey}`);
5519
6001
  console.log(` ${indicator} ${nameDisplay}`);
5520
6002
  console.log(` ${commandDisplay}`);
5521
6003
  if (provider.model) {
@@ -5523,17 +6005,17 @@ function listCommand3(program2) {
5523
6005
  const env = JSON.parse(provider.model);
5524
6006
  const envKeys = Object.keys(env);
5525
6007
  if (envKeys.length > 0) {
5526
- console.log(chalk28.gray(` \u73AF\u5883\u53D8\u91CF: ${envKeys.join(", ")}`));
6008
+ console.log(chalk30.gray(` \u73AF\u5883\u53D8\u91CF: ${envKeys.join(", ")}`));
5527
6009
  }
5528
6010
  } catch {
5529
6011
  }
5530
6012
  }
5531
6013
  console.log();
5532
6014
  });
5533
- console.log(chalk28.gray("\u63D0\u793A: \u6240\u6709\u914D\u7F6E\u7684 MCP \u670D\u52A1\u5668\u4F1A\u81EA\u52A8\u540C\u6B65\u5230 ~/.claude.json"));
6015
+ console.log(chalk30.gray("\u63D0\u793A: \u6240\u6709\u914D\u7F6E\u7684 MCP \u670D\u52A1\u5668\u4F1A\u81EA\u52A8\u540C\u6B65\u5230 ~/.claude.json"));
5534
6016
  console.log();
5535
6017
  } catch (error) {
5536
- console.error(chalk28.red(`
6018
+ console.error(chalk30.red(`
5537
6019
  \u274C ${error.message}
5538
6020
  `));
5539
6021
  process.exit(1);
@@ -5544,15 +6026,15 @@ function listCommand3(program2) {
5544
6026
  // src/commands/mcp/remove.ts
5545
6027
  init_dist2();
5546
6028
  init_confirm();
5547
- import chalk29 from "chalk";
5548
- import inquirer20 from "inquirer";
6029
+ import chalk31 from "chalk";
6030
+ import inquirer18 from "inquirer";
5549
6031
  function removeCommand3(program2) {
5550
6032
  program2.command("remove [name]").alias("rm").description("\u5220\u9664 MCP \u670D\u52A1\u5668").action(async (name) => {
5551
6033
  try {
5552
6034
  const manager = createMCPManager();
5553
6035
  const providers = manager.list();
5554
6036
  if (providers.length === 0) {
5555
- console.log(chalk29.yellow("\n\u26A0\uFE0F \u6682\u65E0 MCP \u670D\u52A1\u5668\n"));
6037
+ console.log(chalk31.yellow("\n\u26A0\uFE0F \u6682\u65E0 MCP \u670D\u52A1\u5668\n"));
5556
6038
  return;
5557
6039
  }
5558
6040
  let targetId;
@@ -5565,7 +6047,7 @@ function removeCommand3(program2) {
5565
6047
  targetId = provider.id;
5566
6048
  targetName = provider.name;
5567
6049
  } else {
5568
- const { selectedId } = await inquirer20.prompt([
6050
+ const { selectedId } = await inquirer18.prompt([
5569
6051
  {
5570
6052
  type: "list",
5571
6053
  name: "selectedId",
@@ -5582,26 +6064,26 @@ function removeCommand3(program2) {
5582
6064
  }
5583
6065
  const confirmed = await promptConfirm(`\u786E\u5B9A\u5220\u9664 "${targetName}"?`, false);
5584
6066
  if (!confirmed) {
5585
- console.log(chalk29.gray("\n\u5DF2\u53D6\u6D88\n"));
6067
+ console.log(chalk31.gray("\n\u5DF2\u53D6\u6D88\n"));
5586
6068
  return;
5587
6069
  }
5588
6070
  manager.remove(targetId);
5589
6071
  console.log();
5590
- console.log(chalk29.green(`\u2705 \u5DF2\u5220\u9664: ${targetName}`));
6072
+ console.log(chalk31.green(`\u2705 \u5DF2\u5220\u9664: ${targetName}`));
5591
6073
  console.log();
5592
- console.log(chalk29.green("\u2705 \u914D\u7F6E\u5DF2\u81EA\u52A8\u540C\u6B65\u5230 ~/.claude.json"));
6074
+ console.log(chalk31.green("\u2705 \u914D\u7F6E\u5DF2\u81EA\u52A8\u540C\u6B65\u5230 ~/.claude.json"));
5593
6075
  console.log();
5594
- console.log(chalk29.gray("\u914D\u7F6E\u6587\u4EF6:"));
5595
- console.log(chalk29.gray(` - ${getClaudeConfigPath()}`));
6076
+ console.log(chalk31.gray("\u914D\u7F6E\u6587\u4EF6:"));
6077
+ console.log(chalk31.gray(` - ${getClaudeConfigPath()}`));
5596
6078
  console.log();
5597
6079
  } catch (error) {
5598
6080
  if (error instanceof ProviderNotFoundError) {
5599
- console.error(chalk29.red(`
6081
+ console.error(chalk31.red(`
5600
6082
  \u274C MCP \u670D\u52A1\u5668\u4E0D\u5B58\u5728
5601
6083
  `));
5602
- console.log(chalk29.blue("\u{1F4A1} \u67E5\u770B\u6240\u6709 MCP \u670D\u52A1\u5668:") + chalk29.white(" ccman mcp list\n"));
6084
+ console.log(chalk31.blue("\u{1F4A1} \u67E5\u770B\u6240\u6709 MCP \u670D\u52A1\u5668:") + chalk31.white(" ccman mcp list\n"));
5603
6085
  } else {
5604
- console.error(chalk29.red(`
6086
+ console.error(chalk31.red(`
5605
6087
  \u274C ${error.message}
5606
6088
  `));
5607
6089
  }
@@ -5612,15 +6094,15 @@ function removeCommand3(program2) {
5612
6094
 
5613
6095
  // src/commands/mcp/edit.ts
5614
6096
  init_dist2();
5615
- import chalk30 from "chalk";
5616
- import inquirer21 from "inquirer";
6097
+ import chalk32 from "chalk";
6098
+ import inquirer19 from "inquirer";
5617
6099
  function editCommand3(program2) {
5618
6100
  program2.command("edit [name]").description("\u7F16\u8F91 MCP \u670D\u52A1\u5668").action(async (name) => {
5619
6101
  try {
5620
6102
  const manager = createMCPManager();
5621
6103
  const providers = manager.list();
5622
6104
  if (providers.length === 0) {
5623
- console.log(chalk30.yellow("\n\u26A0\uFE0F \u6682\u65E0 MCP \u670D\u52A1\u5668\n"));
6105
+ console.log(chalk32.yellow("\n\u26A0\uFE0F \u6682\u65E0 MCP \u670D\u52A1\u5668\n"));
5624
6106
  return;
5625
6107
  }
5626
6108
  let targetId;
@@ -5631,7 +6113,7 @@ function editCommand3(program2) {
5631
6113
  }
5632
6114
  targetId = provider2.id;
5633
6115
  } else {
5634
- const { selectedId } = await inquirer21.prompt([
6116
+ const { selectedId } = await inquirer19.prompt([
5635
6117
  {
5636
6118
  type: "list",
5637
6119
  name: "selectedId",
@@ -5648,9 +6130,9 @@ function editCommand3(program2) {
5648
6130
  const currentCommand6 = provider.baseUrl;
5649
6131
  const currentArgs = provider.apiKey;
5650
6132
  const currentEnv = provider.model;
5651
- console.log(chalk30.bold("\n\u270F\uFE0F \u7F16\u8F91 MCP \u670D\u52A1\u5668\n"));
5652
- console.log(chalk30.gray("\u63D0\u793A: \u7559\u7A7A\u5219\u4FDD\u6301\u539F\u503C\n"));
5653
- const answers = await inquirer21.prompt([
6133
+ console.log(chalk32.bold("\n\u270F\uFE0F \u7F16\u8F91 MCP \u670D\u52A1\u5668\n"));
6134
+ console.log(chalk32.gray("\u63D0\u793A: \u7559\u7A7A\u5219\u4FDD\u6301\u539F\u503C\n"));
6135
+ const answers = await inquirer19.prompt([
5654
6136
  {
5655
6137
  type: "input",
5656
6138
  name: "name",
@@ -5690,30 +6172,30 @@ function editCommand3(program2) {
5690
6172
  updates.model = answers.env || void 0;
5691
6173
  }
5692
6174
  if (Object.keys(updates).length === 0) {
5693
- console.log(chalk30.gray("\n\u672A\u505A\u4EFB\u4F55\u4FEE\u6539\n"));
6175
+ console.log(chalk32.gray("\n\u672A\u505A\u4EFB\u4F55\u4FEE\u6539\n"));
5694
6176
  return;
5695
6177
  }
5696
6178
  const updated = manager.edit(targetId, updates);
5697
6179
  console.log();
5698
- console.log(chalk30.green("\u2705 \u7F16\u8F91\u6210\u529F"));
6180
+ console.log(chalk32.green("\u2705 \u7F16\u8F91\u6210\u529F"));
5699
6181
  console.log();
5700
- console.log(` ${chalk30.bold(updated.name)} ${chalk30.blue("[MCP]")}`);
5701
- console.log(` ${chalk30.gray(`\u547D\u4EE4: ${updated.baseUrl} ${updated.apiKey}`)}`);
6182
+ console.log(` ${chalk32.bold(updated.name)} ${chalk32.blue("[MCP]")}`);
6183
+ console.log(` ${chalk32.gray(`\u547D\u4EE4: ${updated.baseUrl} ${updated.apiKey}`)}`);
5702
6184
  if (updated.model) {
5703
6185
  try {
5704
6186
  const env = JSON.parse(updated.model);
5705
- console.log(chalk30.gray(` \u73AF\u5883\u53D8\u91CF: ${Object.keys(env).join(", ")}`));
6187
+ console.log(chalk32.gray(` \u73AF\u5883\u53D8\u91CF: ${Object.keys(env).join(", ")}`));
5706
6188
  } catch {
5707
6189
  }
5708
6190
  }
5709
6191
  console.log();
5710
- console.log(chalk30.green("\u2705 \u914D\u7F6E\u5DF2\u81EA\u52A8\u540C\u6B65\u5230 ~/.claude.json"));
6192
+ console.log(chalk32.green("\u2705 \u914D\u7F6E\u5DF2\u81EA\u52A8\u540C\u6B65\u5230 ~/.claude.json"));
5711
6193
  console.log();
5712
- console.log(chalk30.gray("\u914D\u7F6E\u6587\u4EF6:"));
5713
- console.log(chalk30.gray(` - ${getClaudeConfigPath()}`));
6194
+ console.log(chalk32.gray("\u914D\u7F6E\u6587\u4EF6:"));
6195
+ console.log(chalk32.gray(` - ${getClaudeConfigPath()}`));
5714
6196
  console.log();
5715
6197
  } catch (error) {
5716
- console.error(chalk30.red(`
6198
+ console.error(chalk32.red(`
5717
6199
  \u274C ${error.message}
5718
6200
  `));
5719
6201
  process.exit(1);
@@ -5731,15 +6213,38 @@ function createMCPCommands(program2) {
5731
6213
 
5732
6214
  // src/commands/gemini/add.ts
5733
6215
  init_dist2();
5734
- import chalk31 from "chalk";
5735
- import inquirer22 from "inquirer";
6216
+ import chalk33 from "chalk";
6217
+ import inquirer20 from "inquirer";
5736
6218
  init_confirm();
5737
6219
  function addCommand4(program2) {
5738
- program2.command("add").description("\u6DFB\u52A0\u65B0\u7684 Gemini CLI \u670D\u52A1\u5546(\u4EA4\u4E92\u5F0F)").action(async () => {
6220
+ const command = program2.command("add").description("\u6DFB\u52A0\u65B0\u7684 Gemini CLI \u670D\u52A1\u5546");
6221
+ addProviderAddOptions(command);
6222
+ command.action(async (options) => {
5739
6223
  try {
5740
6224
  const manager = createGeminiManager();
5741
- console.log(chalk31.bold("\n\u{1F4DD} \u6DFB\u52A0 Gemini CLI \u670D\u52A1\u5546\n"));
5742
- const { usePreset } = await inquirer22.prompt([
6225
+ console.log(chalk33.bold("\n\u{1F4DD} \u6DFB\u52A0 Gemini CLI \u670D\u52A1\u5546\n"));
6226
+ const resolved = resolveProviderAddInput(options, GEMINI_PRESETS, {
6227
+ allowEmptyBaseUrl: true,
6228
+ allowEmptyApiKey: true
6229
+ });
6230
+ if (resolved.nonInteractive && resolved.input) {
6231
+ const provider2 = manager.add(resolved.input);
6232
+ printSuccess("\u6DFB\u52A0\u6210\u529F", [
6233
+ `${chalk33.bold(provider2.name)} ${toolBadge("gemini")}`,
6234
+ chalk33.gray(provider2.baseUrl || "(\u4F7F\u7528\u9ED8\u8BA4\u7AEF\u70B9)")
6235
+ ]);
6236
+ if (resolved.switchNow) {
6237
+ manager.switch(provider2.id);
6238
+ printSuccess("\u5DF2\u5207\u6362\u5230\u65B0\u670D\u52A1\u5546", [
6239
+ chalk33.gray(`\u914D\u7F6E\u5DF2\u66F4\u65B0: ${getGeminiSettingsPath()}`),
6240
+ chalk33.gray(`\u914D\u7F6E\u5DF2\u66F4\u65B0: ${getGeminiEnvPath()}`)
6241
+ ]);
6242
+ } else {
6243
+ printTip(`\u7A0D\u540E\u5207\u6362: ${chalk33.white(`ccman gm use "${provider2.name}"`)}`);
6244
+ }
6245
+ return;
6246
+ }
6247
+ const { usePreset } = await inquirer20.prompt([
5743
6248
  {
5744
6249
  type: "list",
5745
6250
  name: "usePreset",
@@ -5755,7 +6260,7 @@ function addCommand4(program2) {
5755
6260
  let baseUrl;
5756
6261
  let apiKey;
5757
6262
  if (usePreset) {
5758
- const { presetName } = await inquirer22.prompt([
6263
+ const { presetName } = await inquirer20.prompt([
5759
6264
  {
5760
6265
  type: "list",
5761
6266
  name: "presetName",
@@ -5767,7 +6272,7 @@ function addCommand4(program2) {
5767
6272
  }
5768
6273
  ]);
5769
6274
  const preset = GEMINI_PRESETS.find((p) => p.name === presetName);
5770
- console.log(chalk31.blue(`
6275
+ console.log(chalk33.blue(`
5771
6276
  \u4F7F\u7528\u9884\u8BBE: ${preset.name} - ${preset.description}
5772
6277
  `));
5773
6278
  const input = await promptProviderForm({
@@ -5781,7 +6286,7 @@ function addCommand4(program2) {
5781
6286
  baseUrl = input.baseUrl;
5782
6287
  apiKey = input.apiKey;
5783
6288
  } else {
5784
- const answers = await inquirer22.prompt([
6289
+ const answers = await inquirer20.prompt([
5785
6290
  {
5786
6291
  type: "input",
5787
6292
  name: "name",
@@ -5816,25 +6321,22 @@ function addCommand4(program2) {
5816
6321
  apiKey = answers.apiKey || "";
5817
6322
  }
5818
6323
  const provider = manager.add({ name, desc, baseUrl, apiKey });
5819
- console.log();
5820
- console.log(chalk31.green("\u2705 \u6DFB\u52A0\u6210\u529F"));
5821
- console.log();
5822
- console.log(` ${chalk31.bold(provider.name)} ${chalk31.blue("[Gemini CLI]")}`);
5823
- console.log(` ${chalk31.gray(provider.baseUrl || "(\u4F7F\u7528\u9ED8\u8BA4\u7AEF\u70B9)")}`);
5824
- console.log();
6324
+ printSuccess("\u6DFB\u52A0\u6210\u529F", [
6325
+ `${chalk33.bold(provider.name)} ${toolBadge("gemini")}`,
6326
+ chalk33.gray(provider.baseUrl || "(\u4F7F\u7528\u9ED8\u8BA4\u7AEF\u70B9)")
6327
+ ]);
5825
6328
  const switchNow = await promptConfirm("\u662F\u5426\u7ACB\u5373\u5207\u6362\u5230\u6B64\u670D\u52A1\u5546?", true);
5826
6329
  if (switchNow) {
5827
6330
  manager.switch(provider.id);
5828
- console.log(chalk31.green("\u2705 \u5DF2\u5207\u6362\u5230\u65B0\u670D\u52A1\u5546"));
5829
- console.log();
5830
- console.log(chalk31.gray("\u914D\u7F6E\u5DF2\u66F4\u65B0:"));
5831
- console.log(chalk31.gray(` - ${getGeminiSettingsPath()}`));
5832
- console.log(chalk31.gray(` - ${getGeminiEnvPath()}`));
6331
+ printSuccess("\u5DF2\u5207\u6362\u5230\u65B0\u670D\u52A1\u5546", [
6332
+ chalk33.gray(`\u914D\u7F6E\u5DF2\u66F4\u65B0: ${getGeminiSettingsPath()}`),
6333
+ chalk33.gray(`\u914D\u7F6E\u5DF2\u66F4\u65B0: ${getGeminiEnvPath()}`)
6334
+ ]);
5833
6335
  } else {
5834
- console.log(chalk31.blue("\u{1F4A1} \u7A0D\u540E\u5207\u6362:") + chalk31.white(` ccman gm use "${provider.name}"`));
6336
+ printTip(`\u7A0D\u540E\u5207\u6362: ${chalk33.white(`ccman gm use "${provider.name}"`)}`);
5835
6337
  }
5836
6338
  } catch (error) {
5837
- console.error(chalk31.red(`
6339
+ console.error(chalk33.red(`
5838
6340
  \u274C ${error.message}
5839
6341
  `));
5840
6342
  process.exit(1);
@@ -5844,7 +6346,7 @@ function addCommand4(program2) {
5844
6346
 
5845
6347
  // src/commands/gemini/list.ts
5846
6348
  init_dist2();
5847
- import chalk32 from "chalk";
6349
+ import chalk34 from "chalk";
5848
6350
  function listCommand4(program2) {
5849
6351
  program2.command("list").alias("ls").description("\u5217\u51FA\u6240\u6709 Gemini CLI \u670D\u52A1\u5546").action(async () => {
5850
6352
  try {
@@ -5852,15 +6354,15 @@ function listCommand4(program2) {
5852
6354
  const providers = manager.list();
5853
6355
  const current = manager.getCurrent();
5854
6356
  if (providers.length === 0) {
5855
- console.log(chalk32.yellow("\n\u26A0\uFE0F \u6682\u65E0 Gemini CLI \u670D\u52A1\u5546\n"));
5856
- console.log(chalk32.blue("\u{1F4A1} \u6DFB\u52A0\u670D\u52A1\u5546:") + chalk32.white(" ccman gm add\n"));
6357
+ printWarning("\u6682\u65E0 Gemini CLI \u670D\u52A1\u5546");
6358
+ printTip("\u6DFB\u52A0\u670D\u52A1\u5546: " + chalk34.white("ccman gm add"));
5857
6359
  return;
5858
6360
  }
5859
- console.log(chalk32.bold(`
5860
- \u{1F4CB} Gemini CLI \u670D\u52A1\u5546 (${providers.length} \u4E2A)`));
5861
- console.log(formatProviderTable(providers, current?.id));
6361
+ console.log(
6362
+ formatProviderTable(providers, current?.id, `Gemini CLI \u670D\u52A1\u5546 (${providers.length} \u4E2A)`)
6363
+ );
5862
6364
  } catch (error) {
5863
- console.error(chalk32.red(`
6365
+ console.error(chalk34.red(`
5864
6366
  \u274C ${error.message}
5865
6367
  `));
5866
6368
  process.exit(1);
@@ -5870,16 +6372,16 @@ function listCommand4(program2) {
5870
6372
 
5871
6373
  // src/commands/gemini/use.ts
5872
6374
  init_dist2();
5873
- import chalk33 from "chalk";
5874
- import inquirer23 from "inquirer";
6375
+ import chalk35 from "chalk";
6376
+ import inquirer21 from "inquirer";
5875
6377
  function useCommand3(program2) {
5876
6378
  program2.command("use [name]").description("\u5207\u6362 Gemini CLI \u670D\u52A1\u5546").action(async (name) => {
5877
6379
  try {
5878
6380
  const manager = createGeminiManager();
5879
6381
  const providers = manager.list();
5880
6382
  if (providers.length === 0) {
5881
- console.log(chalk33.yellow("\n\u26A0\uFE0F \u6682\u65E0 Gemini CLI \u670D\u52A1\u5546\n"));
5882
- console.log(chalk33.blue("\u{1F4A1} \u6DFB\u52A0\u670D\u52A1\u5546:") + chalk33.white(" ccman gm add\n"));
6383
+ printWarning("\u6682\u65E0 Gemini CLI \u670D\u52A1\u5546");
6384
+ printTip("\u6DFB\u52A0\u670D\u52A1\u5546: " + chalk35.white("ccman gm add"));
5883
6385
  return;
5884
6386
  }
5885
6387
  let targetId;
@@ -5890,7 +6392,7 @@ function useCommand3(program2) {
5890
6392
  }
5891
6393
  targetId = provider2.id;
5892
6394
  } else {
5893
- const { selectedId } = await inquirer23.prompt([
6395
+ const { selectedId } = await inquirer21.prompt([
5894
6396
  {
5895
6397
  type: "list",
5896
6398
  name: "selectedId",
@@ -5905,24 +6407,20 @@ function useCommand3(program2) {
5905
6407
  }
5906
6408
  manager.switch(targetId);
5907
6409
  const provider = manager.get(targetId);
5908
- console.log();
5909
- console.log(chalk33.green("\u2705 \u5207\u6362\u6210\u529F"));
5910
- console.log();
5911
- console.log(` ${chalk33.bold(provider.name)} ${chalk33.blue("[Gemini CLI]")}`);
5912
- console.log(` ${chalk33.gray(`URL: ${provider.baseUrl || "(\u9ED8\u8BA4\u7AEF\u70B9)"}`)}`);
5913
- console.log();
5914
- console.log(chalk33.gray("\u914D\u7F6E\u5DF2\u66F4\u65B0:"));
5915
- console.log(chalk33.gray(` - ${getGeminiSettingsPath()}`));
5916
- console.log(chalk33.gray(` - ${getGeminiEnvPath()}`));
5917
- console.log();
6410
+ printSuccess("\u5207\u6362\u6210\u529F", [
6411
+ `${chalk35.bold(provider.name)} ${toolBadge("gemini")}`,
6412
+ chalk35.gray(`URL: ${provider.baseUrl || "(\u9ED8\u8BA4\u7AEF\u70B9)"}`),
6413
+ chalk35.gray(`\u914D\u7F6E\u5DF2\u66F4\u65B0: ${getGeminiSettingsPath()}`),
6414
+ chalk35.gray(`\u914D\u7F6E\u5DF2\u66F4\u65B0: ${getGeminiEnvPath()}`)
6415
+ ]);
5918
6416
  } catch (error) {
5919
6417
  if (error instanceof ProviderNotFoundError) {
5920
- console.error(chalk33.red(`
6418
+ console.error(chalk35.red(`
5921
6419
  \u274C \u670D\u52A1\u5546\u4E0D\u5B58\u5728: ${error.message}
5922
6420
  `));
5923
- console.log(chalk33.blue("\u{1F4A1} \u67E5\u770B\u6240\u6709\u670D\u52A1\u5546:") + chalk33.white(" ccman gm list\n"));
6421
+ console.log(chalk35.blue("\u{1F4A1} \u67E5\u770B\u6240\u6709\u670D\u52A1\u5546:") + chalk35.white(" ccman gm list\n"));
5924
6422
  } else {
5925
- console.error(chalk33.red(`
6423
+ console.error(chalk35.red(`
5926
6424
  \u274C ${error.message}
5927
6425
  `));
5928
6426
  }
@@ -5933,23 +6431,30 @@ function useCommand3(program2) {
5933
6431
 
5934
6432
  // src/commands/gemini/current.ts
5935
6433
  init_dist2();
5936
- import chalk34 from "chalk";
6434
+ import chalk36 from "chalk";
5937
6435
  function currentCommand3(program2) {
5938
6436
  program2.command("current").description("\u663E\u793A\u5F53\u524D Gemini CLI \u670D\u52A1\u5546").action(async () => {
5939
6437
  try {
5940
6438
  const manager = createGeminiManager();
5941
6439
  const current = manager.getCurrent();
5942
6440
  if (!current) {
5943
- console.log(chalk34.yellow("\n\u26A0\uFE0F \u5F53\u524D\u6CA1\u6709\u6FC0\u6D3B\u7684 Gemini CLI \u670D\u52A1\u5546\n"));
5944
- console.log(chalk34.blue("\u{1F4A1} \u5217\u51FA\u670D\u52A1\u5546:") + chalk34.white(" ccman gm list\n"));
6441
+ printWarning("\u672A\u9009\u62E9\u4EFB\u4F55 Gemini CLI \u670D\u52A1\u5546");
6442
+ printTip("\u9009\u62E9\u670D\u52A1\u5546: " + chalk36.white("ccman gm use"));
5945
6443
  return;
5946
6444
  }
5947
- console.log(chalk34.bold("\n\u{1F3AF} \u5F53\u524D Gemini CLI \u670D\u52A1\u5546\n"));
5948
- console.log(` \u540D\u79F0: ${chalk34.bold(current.name)}`);
5949
- console.log(` \u5730\u5740: ${chalk34.gray(current.baseUrl || "(\u9ED8\u8BA4\u7AEF\u70B9)")}`);
5950
- console.log();
6445
+ const lines = [
6446
+ chalk36.green.bold(current.name),
6447
+ chalk36.gray(`ID: ${current.id}`),
6448
+ chalk36.gray(`URL: ${current.baseUrl || "(\u9ED8\u8BA4\u7AEF\u70B9)"}`)
6449
+ ];
6450
+ if (current.lastUsedAt) {
6451
+ lines.push(
6452
+ chalk36.gray(`\u6700\u540E\u4F7F\u7528: ${new Date(current.lastUsedAt).toLocaleString("zh-CN")}`)
6453
+ );
6454
+ }
6455
+ printInfo("\u{1F4CD} \u5F53\u524D Gemini CLI \u670D\u52A1\u5546", lines);
5951
6456
  } catch (error) {
5952
- console.error(chalk34.red(`
6457
+ console.error(chalk36.red(`
5953
6458
  \u274C ${error.message}
5954
6459
  `));
5955
6460
  process.exit(1);
@@ -5959,17 +6464,18 @@ function currentCommand3(program2) {
5959
6464
 
5960
6465
  // src/commands/gemini/remove.ts
5961
6466
  init_dist2();
5962
- init_confirm();
5963
- import chalk35 from "chalk";
5964
- import inquirer24 from "inquirer";
6467
+ import chalk37 from "chalk";
6468
+ import inquirer22 from "inquirer";
5965
6469
  function removeCommand4(program2) {
5966
- program2.command("remove [name]").alias("rm").description("\u5220\u9664 Gemini CLI \u670D\u52A1\u5546").action(async (name) => {
6470
+ const command = program2.command("remove [name]").alias("rm").description("\u5220\u9664 Gemini CLI \u670D\u52A1\u5546");
6471
+ addProviderRemoveOptions(command);
6472
+ command.action(async (name, options) => {
5967
6473
  try {
5968
6474
  const manager = createGeminiManager();
5969
6475
  const providers = manager.list();
5970
6476
  if (providers.length === 0) {
5971
- console.log(chalk35.yellow("\n\u26A0\uFE0F \u6682\u65E0 Gemini CLI \u670D\u52A1\u5546\n"));
5972
- console.log(chalk35.blue("\u{1F4A1} \u6DFB\u52A0\u670D\u52A1\u5546:") + chalk35.white(" ccman gm add\n"));
6477
+ console.log(chalk37.yellow("\n\u26A0\uFE0F \u6682\u65E0 Gemini CLI \u670D\u52A1\u5546\n"));
6478
+ console.log(chalk37.blue("\u{1F4A1} \u6DFB\u52A0\u670D\u52A1\u5546:") + chalk37.white(" ccman gm add\n"));
5973
6479
  return;
5974
6480
  }
5975
6481
  let targetId;
@@ -5977,15 +6483,14 @@ function removeCommand4(program2) {
5977
6483
  if (name) {
5978
6484
  const provider = manager.findByName(name);
5979
6485
  if (!provider) {
5980
- console.log(chalk35.red(`
5981
- \u274C \u670D\u52A1\u5546\u4E0D\u5B58\u5728: ${name}
5982
- `));
5983
- process.exit(1);
6486
+ throw new ProviderNotFoundError(name);
5984
6487
  }
5985
6488
  targetId = provider.id;
5986
6489
  targetName = provider.name;
6490
+ } else if (options.yes) {
6491
+ throw new Error("\u975E\u4EA4\u4E92\u6A21\u5F0F\u8BF7\u63D0\u4F9B\u8981\u5220\u9664\u7684\u670D\u52A1\u5546\u540D\u79F0");
5987
6492
  } else {
5988
- const { selectedId } = await inquirer24.prompt([
6493
+ const { selectedId } = await inquirer22.prompt([
5989
6494
  {
5990
6495
  type: "list",
5991
6496
  name: "selectedId",
@@ -6000,17 +6505,23 @@ function removeCommand4(program2) {
6000
6505
  targetId = provider.id;
6001
6506
  targetName = provider.name;
6002
6507
  }
6003
- const confirm = await promptConfirm(`\u786E\u5B9A\u8981\u5220\u9664\u670D\u52A1\u5546 "${targetName}" \u5417\uFF1F`, false);
6508
+ const confirm = await confirmProviderRemoval(targetName, options);
6004
6509
  if (!confirm) {
6005
- console.log(chalk35.gray("\n\u5DF2\u53D6\u6D88\u5220\u9664\n"));
6510
+ console.log(chalk37.gray("\n\u5DF2\u53D6\u6D88\u5220\u9664\n"));
6006
6511
  return;
6007
6512
  }
6008
6513
  manager.remove(targetId);
6009
- console.log(chalk35.green("\n\u2705 \u5DF2\u5220\u9664\u670D\u52A1\u5546\n"));
6514
+ console.log(chalk37.green("\n\u2705 \u5DF2\u5220\u9664\u670D\u52A1\u5546\n"));
6010
6515
  } catch (error) {
6011
- console.error(chalk35.red(`
6516
+ if (error instanceof ProviderNotFoundError) {
6517
+ console.error(chalk37.red(`
6518
+ \u274C \u670D\u52A1\u5546\u4E0D\u5B58\u5728: ${name}
6519
+ `));
6520
+ } else {
6521
+ console.error(chalk37.red(`
6012
6522
  \u274C ${error.message}
6013
6523
  `));
6524
+ }
6014
6525
  process.exit(1);
6015
6526
  }
6016
6527
  });
@@ -6018,30 +6529,35 @@ function removeCommand4(program2) {
6018
6529
 
6019
6530
  // src/commands/gemini/edit.ts
6020
6531
  init_dist2();
6021
- import chalk36 from "chalk";
6022
- import inquirer25 from "inquirer";
6532
+ import chalk38 from "chalk";
6533
+ import inquirer23 from "inquirer";
6023
6534
  function editCommand4(program2) {
6024
- program2.command("edit [name]").description("\u7F16\u8F91 Gemini CLI \u670D\u52A1\u5546").action(async (name) => {
6535
+ const command = program2.command("edit [name]").description("\u7F16\u8F91 Gemini CLI \u670D\u52A1\u5546");
6536
+ addProviderEditOptions(command);
6537
+ command.action(async (name, options) => {
6025
6538
  try {
6026
6539
  const manager = createGeminiManager();
6027
6540
  const providers = manager.list();
6028
6541
  if (providers.length === 0) {
6029
- console.log(chalk36.yellow("\n\u26A0\uFE0F \u6682\u65E0 Gemini CLI \u670D\u52A1\u5546\n"));
6030
- console.log(chalk36.blue("\u{1F4A1} \u6DFB\u52A0\u670D\u52A1\u5546:") + chalk36.white(" ccman gm add\n"));
6542
+ console.log(chalk38.yellow("\n\u26A0\uFE0F \u6682\u65E0 Gemini CLI \u670D\u52A1\u5546\n"));
6543
+ console.log(chalk38.blue("\u{1F4A1} \u6DFB\u52A0\u670D\u52A1\u5546:") + chalk38.white(" ccman gm add\n"));
6031
6544
  return;
6032
6545
  }
6546
+ const resolved = resolveProviderEditInput(options, {
6547
+ allowEmptyBaseUrl: true,
6548
+ allowEmptyApiKey: true
6549
+ });
6033
6550
  let targetId;
6034
6551
  if (name) {
6035
6552
  const provider2 = manager.findByName(name);
6036
6553
  if (!provider2) {
6037
- console.log(chalk36.red(`
6038
- \u274C \u670D\u52A1\u5546\u4E0D\u5B58\u5728: ${name}
6039
- `));
6040
- process.exit(1);
6554
+ throw new ProviderNotFoundError(name);
6041
6555
  }
6042
6556
  targetId = provider2.id;
6557
+ } else if (resolved.nonInteractive) {
6558
+ throw new Error("\u975E\u4EA4\u4E92\u6A21\u5F0F\u8BF7\u63D0\u4F9B\u8981\u7F16\u8F91\u7684\u670D\u52A1\u5546\u540D\u79F0");
6043
6559
  } else {
6044
- const { selectedId } = await inquirer25.prompt([
6560
+ const { selectedId } = await inquirer23.prompt([
6045
6561
  {
6046
6562
  type: "list",
6047
6563
  name: "selectedId",
@@ -6055,6 +6571,15 @@ function editCommand4(program2) {
6055
6571
  targetId = selectedId;
6056
6572
  }
6057
6573
  const provider = manager.get(targetId);
6574
+ if (resolved.nonInteractive) {
6575
+ if (Object.keys(resolved.updates).length === 0) {
6576
+ console.log(chalk38.gray("\n\u672A\u505A\u4EFB\u4F55\u4FEE\u6539\n"));
6577
+ return;
6578
+ }
6579
+ manager.edit(targetId, resolved.updates);
6580
+ console.log(chalk38.green("\n\u2705 \u7F16\u8F91\u6210\u529F\n"));
6581
+ return;
6582
+ }
6058
6583
  const input = await promptProviderForm({
6059
6584
  name: provider.name,
6060
6585
  desc: provider.desc ?? "",
@@ -6067,11 +6592,17 @@ function editCommand4(program2) {
6067
6592
  baseUrl: input.baseUrl,
6068
6593
  apiKey: input.apiKey
6069
6594
  });
6070
- console.log(chalk36.green("\n\u2705 \u7F16\u8F91\u6210\u529F\n"));
6595
+ console.log(chalk38.green("\n\u2705 \u7F16\u8F91\u6210\u529F\n"));
6071
6596
  } catch (error) {
6072
- console.error(chalk36.red(`
6597
+ if (error instanceof ProviderNotFoundError) {
6598
+ console.error(chalk38.red(`
6599
+ \u274C \u670D\u52A1\u5546\u4E0D\u5B58\u5728: ${name}
6600
+ `));
6601
+ } else {
6602
+ console.error(chalk38.red(`
6073
6603
  \u274C ${error.message}
6074
6604
  `));
6605
+ }
6075
6606
  process.exit(1);
6076
6607
  }
6077
6608
  });
@@ -6079,30 +6610,30 @@ function editCommand4(program2) {
6079
6610
 
6080
6611
  // src/commands/gemini/clone.ts
6081
6612
  init_dist2();
6082
- import chalk37 from "chalk";
6083
- import inquirer26 from "inquirer";
6613
+ import chalk39 from "chalk";
6614
+ import inquirer24 from "inquirer";
6084
6615
  function cloneCommand3(program2) {
6085
6616
  program2.command("clone [name]").description("\u514B\u9686 Gemini CLI \u670D\u52A1\u5546").action(async (name) => {
6086
6617
  try {
6087
6618
  const manager = createGeminiManager();
6088
6619
  const providers = manager.list();
6089
6620
  if (providers.length === 0) {
6090
- console.log(chalk37.yellow("\n\u26A0\uFE0F \u6682\u65E0 Gemini CLI \u670D\u52A1\u5546\n"));
6091
- console.log(chalk37.blue("\u{1F4A1} \u6DFB\u52A0\u670D\u52A1\u5546:") + chalk37.white(" ccman gm add\n"));
6621
+ console.log(chalk39.yellow("\n\u26A0\uFE0F \u6682\u65E0 Gemini CLI \u670D\u52A1\u5546\n"));
6622
+ console.log(chalk39.blue("\u{1F4A1} \u6DFB\u52A0\u670D\u52A1\u5546:") + chalk39.white(" ccman gm add\n"));
6092
6623
  return;
6093
6624
  }
6094
6625
  let sourceId;
6095
6626
  if (name) {
6096
6627
  const provider = manager.findByName(name);
6097
6628
  if (!provider) {
6098
- console.log(chalk37.red(`
6629
+ console.log(chalk39.red(`
6099
6630
  \u274C \u670D\u52A1\u5546\u4E0D\u5B58\u5728: ${name}
6100
6631
  `));
6101
6632
  process.exit(1);
6102
6633
  }
6103
6634
  sourceId = provider.id;
6104
6635
  } else {
6105
- const { selectedId } = await inquirer26.prompt([
6636
+ const { selectedId } = await inquirer24.prompt([
6106
6637
  {
6107
6638
  type: "list",
6108
6639
  name: "selectedId",
@@ -6115,7 +6646,7 @@ function cloneCommand3(program2) {
6115
6646
  ]);
6116
6647
  sourceId = selectedId;
6117
6648
  }
6118
- const { newName } = await inquirer26.prompt([
6649
+ const { newName } = await inquirer24.prompt([
6119
6650
  {
6120
6651
  type: "input",
6121
6652
  name: "newName",
@@ -6128,13 +6659,13 @@ function cloneCommand3(program2) {
6128
6659
  ]);
6129
6660
  const newProvider = manager.clone(sourceId, newName);
6130
6661
  console.log();
6131
- console.log(chalk37.green("\u2705 \u514B\u9686\u6210\u529F"));
6662
+ console.log(chalk39.green("\u2705 \u514B\u9686\u6210\u529F"));
6132
6663
  console.log();
6133
- console.log(` ${chalk37.bold(newProvider.name)} ${chalk37.blue("[Gemini CLI]")}`);
6134
- console.log(` ${chalk37.gray(newProvider.baseUrl || "(\u9ED8\u8BA4\u7AEF\u70B9)")}`);
6664
+ console.log(` ${chalk39.bold(newProvider.name)} ${chalk39.blue("[Gemini CLI]")}`);
6665
+ console.log(` ${chalk39.gray(newProvider.baseUrl || "(\u9ED8\u8BA4\u7AEF\u70B9)")}`);
6135
6666
  console.log();
6136
6667
  } catch (error) {
6137
- console.error(chalk37.red(`
6668
+ console.error(chalk39.red(`
6138
6669
  \u274C ${error.message}
6139
6670
  `));
6140
6671
  process.exit(1);
@@ -6155,15 +6686,32 @@ function createGeminiCommands(program2) {
6155
6686
 
6156
6687
  // src/commands/opencode/add.ts
6157
6688
  init_dist2();
6158
- import chalk38 from "chalk";
6159
- import inquirer27 from "inquirer";
6689
+ import chalk40 from "chalk";
6690
+ import inquirer25 from "inquirer";
6160
6691
  init_confirm();
6161
6692
  function addCommand5(program2) {
6162
- program2.command("add").description("\u6DFB\u52A0\u65B0\u7684 OpenCode \u670D\u52A1\u5546(\u4EA4\u4E92\u5F0F)").action(async () => {
6693
+ const command = program2.command("add").description("\u6DFB\u52A0\u65B0\u7684 OpenCode \u670D\u52A1\u5546");
6694
+ addProviderAddOptions(command);
6695
+ command.action(async (options) => {
6163
6696
  try {
6164
6697
  const manager = createOpenCodeManager();
6165
- console.log(chalk38.bold("\n\u{1F4DD} \u6DFB\u52A0 OpenCode \u670D\u52A1\u5546\n"));
6166
- const { usePreset } = await inquirer27.prompt([
6698
+ console.log(chalk40.bold("\n\u{1F4DD} \u6DFB\u52A0 OpenCode \u670D\u52A1\u5546\n"));
6699
+ const resolved = resolveProviderAddInput(options, OPENCODE_PRESETS);
6700
+ if (resolved.nonInteractive && resolved.input) {
6701
+ const provider2 = manager.add(resolved.input);
6702
+ printSuccess("\u6DFB\u52A0\u6210\u529F", [
6703
+ `${chalk40.bold(provider2.name)} ${toolBadge("opencode")}`,
6704
+ chalk40.gray(provider2.baseUrl)
6705
+ ]);
6706
+ if (resolved.switchNow) {
6707
+ manager.switch(provider2.id);
6708
+ printSuccess("\u5DF2\u5207\u6362\u5230\u65B0\u670D\u52A1\u5546", [chalk40.gray(`\u914D\u7F6E\u5DF2\u66F4\u65B0: ${getOpenCodeConfigPath()}`)]);
6709
+ } else {
6710
+ printTip(`\u7A0D\u540E\u5207\u6362: ${chalk40.white(`ccman oc use "${provider2.name}"`)}`);
6711
+ }
6712
+ return;
6713
+ }
6714
+ const { usePreset } = await inquirer25.prompt([
6167
6715
  {
6168
6716
  type: "list",
6169
6717
  name: "usePreset",
@@ -6179,7 +6727,7 @@ function addCommand5(program2) {
6179
6727
  let baseUrl;
6180
6728
  let apiKey;
6181
6729
  if (usePreset) {
6182
- const { presetName } = await inquirer27.prompt([
6730
+ const { presetName } = await inquirer25.prompt([
6183
6731
  {
6184
6732
  type: "list",
6185
6733
  name: "presetName",
@@ -6191,7 +6739,7 @@ function addCommand5(program2) {
6191
6739
  }
6192
6740
  ]);
6193
6741
  const preset = OPENCODE_PRESETS.find((p) => p.name === presetName);
6194
- console.log(chalk38.blue(`
6742
+ console.log(chalk40.blue(`
6195
6743
  \u4F7F\u7528\u9884\u8BBE: ${preset.name} - ${preset.description}
6196
6744
  `));
6197
6745
  const input = await promptProviderForm({
@@ -6205,7 +6753,7 @@ function addCommand5(program2) {
6205
6753
  baseUrl = input.baseUrl;
6206
6754
  apiKey = input.apiKey;
6207
6755
  } else {
6208
- const answers = await inquirer27.prompt([
6756
+ const answers = await inquirer25.prompt([
6209
6757
  {
6210
6758
  type: "input",
6211
6759
  name: "name",
@@ -6243,24 +6791,19 @@ function addCommand5(program2) {
6243
6791
  baseUrl,
6244
6792
  apiKey
6245
6793
  });
6246
- console.log();
6247
- console.log(chalk38.green("\u2705 \u6DFB\u52A0\u6210\u529F"));
6248
- console.log();
6249
- console.log(` ${chalk38.bold(provider.name)} ${chalk38.blue("[OpenCode]")}`);
6250
- console.log(` ${chalk38.gray(provider.baseUrl)}`);
6251
- console.log();
6794
+ printSuccess("\u6DFB\u52A0\u6210\u529F", [
6795
+ `${chalk40.bold(provider.name)} ${toolBadge("opencode")}`,
6796
+ chalk40.gray(provider.baseUrl)
6797
+ ]);
6252
6798
  const switchNow = await promptConfirm("\u662F\u5426\u7ACB\u5373\u5207\u6362\u5230\u6B64\u670D\u52A1\u5546?", true);
6253
6799
  if (switchNow) {
6254
6800
  manager.switch(provider.id);
6255
- console.log(chalk38.green("\u2705 \u5DF2\u5207\u6362\u5230\u65B0\u670D\u52A1\u5546"));
6256
- console.log();
6257
- console.log(chalk38.gray("\u914D\u7F6E\u5DF2\u66F4\u65B0:"));
6258
- console.log(chalk38.gray(` - ${getOpenCodeConfigPath()}`));
6801
+ printSuccess("\u5DF2\u5207\u6362\u5230\u65B0\u670D\u52A1\u5546", [chalk40.gray(`\u914D\u7F6E\u5DF2\u66F4\u65B0: ${getOpenCodeConfigPath()}`)]);
6259
6802
  } else {
6260
- console.log(chalk38.blue("\u{1F4A1} \u7A0D\u540E\u5207\u6362:") + chalk38.white(` ccman oc use "${provider.name}"`));
6803
+ printTip(`\u7A0D\u540E\u5207\u6362: ${chalk40.white(`ccman oc use "${provider.name}"`)}`);
6261
6804
  }
6262
6805
  } catch (error) {
6263
- console.error(chalk38.red(`
6806
+ console.error(chalk40.red(`
6264
6807
  \u274C ${error.message}
6265
6808
  `));
6266
6809
  process.exit(1);
@@ -6270,7 +6813,7 @@ function addCommand5(program2) {
6270
6813
 
6271
6814
  // src/commands/opencode/list.ts
6272
6815
  init_dist2();
6273
- import chalk39 from "chalk";
6816
+ import chalk41 from "chalk";
6274
6817
  function listCommand5(program2) {
6275
6818
  program2.command("list").alias("ls").description("\u5217\u51FA\u6240\u6709 OpenCode \u670D\u52A1\u5546").action(async () => {
6276
6819
  try {
@@ -6278,15 +6821,15 @@ function listCommand5(program2) {
6278
6821
  const providers = manager.list();
6279
6822
  const current = manager.getCurrent();
6280
6823
  if (providers.length === 0) {
6281
- console.log(chalk39.yellow("\n\u26A0\uFE0F \u6682\u65E0 OpenCode \u670D\u52A1\u5546\n"));
6282
- console.log(chalk39.blue("\u{1F4A1} \u6DFB\u52A0\u670D\u52A1\u5546:") + chalk39.white(" ccman oc add\n"));
6824
+ printWarning("\u6682\u65E0 OpenCode \u670D\u52A1\u5546");
6825
+ printTip("\u6DFB\u52A0\u670D\u52A1\u5546: " + chalk41.white("ccman oc add"));
6283
6826
  return;
6284
6827
  }
6285
- console.log(chalk39.bold(`
6286
- \u{1F4CB} OpenCode \u670D\u52A1\u5546 (${providers.length} \u4E2A)`));
6287
- console.log(formatProviderTable(providers, current?.id));
6828
+ console.log(
6829
+ formatProviderTable(providers, current?.id, `OpenCode \u670D\u52A1\u5546 (${providers.length} \u4E2A)`)
6830
+ );
6288
6831
  } catch (error) {
6289
- console.error(chalk39.red(`
6832
+ console.error(chalk41.red(`
6290
6833
  \u274C ${error.message}
6291
6834
  `));
6292
6835
  process.exit(1);
@@ -6296,16 +6839,16 @@ function listCommand5(program2) {
6296
6839
 
6297
6840
  // src/commands/opencode/use.ts
6298
6841
  init_dist2();
6299
- import chalk40 from "chalk";
6300
- import inquirer28 from "inquirer";
6842
+ import chalk42 from "chalk";
6843
+ import inquirer26 from "inquirer";
6301
6844
  function useCommand4(program2) {
6302
6845
  program2.command("use [name]").description("\u5207\u6362 OpenCode \u670D\u52A1\u5546").action(async (name) => {
6303
6846
  try {
6304
6847
  const manager = createOpenCodeManager();
6305
6848
  const providers = manager.list();
6306
6849
  if (providers.length === 0) {
6307
- console.log(chalk40.yellow("\n\u26A0\uFE0F \u6682\u65E0 OpenCode \u670D\u52A1\u5546\n"));
6308
- console.log(chalk40.blue("\u{1F4A1} \u6DFB\u52A0\u670D\u52A1\u5546:") + chalk40.white(" ccman oc add\n"));
6850
+ printWarning("\u6682\u65E0 OpenCode \u670D\u52A1\u5546");
6851
+ printTip("\u6DFB\u52A0\u670D\u52A1\u5546: " + chalk42.white("ccman oc add"));
6309
6852
  return;
6310
6853
  }
6311
6854
  let targetId;
@@ -6316,7 +6859,7 @@ function useCommand4(program2) {
6316
6859
  }
6317
6860
  targetId = provider2.id;
6318
6861
  } else {
6319
- const { selectedId } = await inquirer28.prompt([
6862
+ const { selectedId } = await inquirer26.prompt([
6320
6863
  {
6321
6864
  type: "list",
6322
6865
  name: "selectedId",
@@ -6331,19 +6874,18 @@ function useCommand4(program2) {
6331
6874
  }
6332
6875
  manager.switch(targetId);
6333
6876
  const provider = manager.get(targetId);
6334
- console.log(chalk40.green("\n\u2705 \u5207\u6362\u6210\u529F\n"));
6335
- console.log(` ${chalk40.bold(provider.name)} ${chalk40.blue("[OpenCode]")}`);
6336
- console.log(` ${chalk40.gray(`URL: ${provider.baseUrl}`)}`);
6337
- console.log();
6338
- console.log(chalk40.gray("\u914D\u7F6E\u5DF2\u66F4\u65B0:"));
6339
- console.log(chalk40.gray(` - ${getOpenCodeConfigPath()}`));
6877
+ printSuccess("\u5207\u6362\u6210\u529F", [
6878
+ `${chalk42.bold(provider.name)} ${toolBadge("opencode")}`,
6879
+ chalk42.gray(`URL: ${provider.baseUrl}`),
6880
+ chalk42.gray(`\u914D\u7F6E\u5DF2\u66F4\u65B0: ${getOpenCodeConfigPath()}`)
6881
+ ]);
6340
6882
  } catch (error) {
6341
6883
  if (error instanceof ProviderNotFoundError) {
6342
- console.error(chalk40.red(`
6884
+ console.error(chalk42.red(`
6343
6885
  \u274C \u670D\u52A1\u5546\u4E0D\u5B58\u5728: ${name}
6344
6886
  `));
6345
6887
  } else {
6346
- console.error(chalk40.red(`
6888
+ console.error(chalk42.red(`
6347
6889
  \u274C ${error.message}
6348
6890
  `));
6349
6891
  }
@@ -6354,23 +6896,30 @@ function useCommand4(program2) {
6354
6896
 
6355
6897
  // src/commands/opencode/current.ts
6356
6898
  init_dist2();
6357
- import chalk41 from "chalk";
6899
+ import chalk43 from "chalk";
6358
6900
  function currentCommand4(program2) {
6359
6901
  program2.command("current").description("\u663E\u793A\u5F53\u524D OpenCode \u670D\u52A1\u5546").action(async () => {
6360
6902
  try {
6361
6903
  const manager = createOpenCodeManager();
6362
6904
  const current = manager.getCurrent();
6363
6905
  if (!current) {
6364
- console.log(chalk41.yellow("\n\u26A0\uFE0F \u5F53\u524D\u6CA1\u6709\u6FC0\u6D3B\u7684 OpenCode \u670D\u52A1\u5546\n"));
6365
- console.log(chalk41.blue("\u{1F4A1} \u5217\u51FA\u670D\u52A1\u5546:") + chalk41.white(" ccman oc list\n"));
6906
+ printWarning("\u672A\u9009\u62E9\u4EFB\u4F55 OpenCode \u670D\u52A1\u5546");
6907
+ printTip("\u9009\u62E9\u670D\u52A1\u5546: " + chalk43.white("ccman oc use"));
6366
6908
  return;
6367
6909
  }
6368
- console.log(chalk41.bold("\n\u{1F3AF} \u5F53\u524D OpenCode \u670D\u52A1\u5546\n"));
6369
- console.log(` \u540D\u79F0: ${chalk41.bold(current.name)}`);
6370
- console.log(` \u5730\u5740: ${chalk41.gray(current.baseUrl)}`);
6371
- console.log();
6910
+ const lines = [
6911
+ chalk43.green.bold(current.name),
6912
+ chalk43.gray(`ID: ${current.id}`),
6913
+ chalk43.gray(`URL: ${current.baseUrl}`)
6914
+ ];
6915
+ if (current.lastUsedAt) {
6916
+ lines.push(
6917
+ chalk43.gray(`\u6700\u540E\u4F7F\u7528: ${new Date(current.lastUsedAt).toLocaleString("zh-CN")}`)
6918
+ );
6919
+ }
6920
+ printInfo("\u{1F4CD} \u5F53\u524D OpenCode \u670D\u52A1\u5546", lines);
6372
6921
  } catch (error) {
6373
- console.error(chalk41.red(`
6922
+ console.error(chalk43.red(`
6374
6923
  \u274C ${error.message}
6375
6924
  `));
6376
6925
  process.exit(1);
@@ -6380,18 +6929,21 @@ function currentCommand4(program2) {
6380
6929
 
6381
6930
  // src/commands/opencode/edit.ts
6382
6931
  init_dist2();
6383
- import chalk42 from "chalk";
6384
- import inquirer29 from "inquirer";
6932
+ import chalk44 from "chalk";
6933
+ import inquirer27 from "inquirer";
6385
6934
  function editCommand5(program2) {
6386
- program2.command("edit [name]").description("\u7F16\u8F91 OpenCode \u670D\u52A1\u5546").action(async (name) => {
6935
+ const command = program2.command("edit [name]").description("\u7F16\u8F91 OpenCode \u670D\u52A1\u5546");
6936
+ addProviderEditOptions(command);
6937
+ command.action(async (name, options) => {
6387
6938
  try {
6388
6939
  const manager = createOpenCodeManager();
6389
6940
  const providers = manager.list();
6390
6941
  if (providers.length === 0) {
6391
- console.log(chalk42.yellow("\n\u26A0\uFE0F \u6682\u65E0 OpenCode \u670D\u52A1\u5546\n"));
6392
- console.log(chalk42.blue("\u{1F4A1} \u6DFB\u52A0\u670D\u52A1\u5546:") + chalk42.white(" ccman oc add\n"));
6942
+ console.log(chalk44.yellow("\n\u26A0\uFE0F \u6682\u65E0 OpenCode \u670D\u52A1\u5546\n"));
6943
+ console.log(chalk44.blue("\u{1F4A1} \u6DFB\u52A0\u670D\u52A1\u5546:") + chalk44.white(" ccman oc add\n"));
6393
6944
  return;
6394
6945
  }
6946
+ const resolved = resolveProviderEditInput(options);
6395
6947
  let targetId;
6396
6948
  if (name) {
6397
6949
  const provider2 = manager.findByName(name);
@@ -6399,8 +6951,10 @@ function editCommand5(program2) {
6399
6951
  throw new ProviderNotFoundError(name);
6400
6952
  }
6401
6953
  targetId = provider2.id;
6954
+ } else if (resolved.nonInteractive) {
6955
+ throw new Error("\u975E\u4EA4\u4E92\u6A21\u5F0F\u8BF7\u63D0\u4F9B\u8981\u7F16\u8F91\u7684\u670D\u52A1\u5546\u540D\u79F0");
6402
6956
  } else {
6403
- const { selectedId } = await inquirer29.prompt([
6957
+ const { selectedId } = await inquirer27.prompt([
6404
6958
  {
6405
6959
  type: "list",
6406
6960
  name: "selectedId",
@@ -6414,6 +6968,15 @@ function editCommand5(program2) {
6414
6968
  targetId = selectedId;
6415
6969
  }
6416
6970
  const provider = manager.get(targetId);
6971
+ if (resolved.nonInteractive) {
6972
+ if (Object.keys(resolved.updates).length === 0) {
6973
+ console.log(chalk44.gray("\n\u672A\u505A\u4EFB\u4F55\u4FEE\u6539\n"));
6974
+ return;
6975
+ }
6976
+ manager.edit(targetId, resolved.updates);
6977
+ console.log(chalk44.green("\n\u2705 \u7F16\u8F91\u6210\u529F\n"));
6978
+ return;
6979
+ }
6417
6980
  const input = await promptProviderForm({
6418
6981
  name: provider.name,
6419
6982
  desc: provider.desc ?? "",
@@ -6426,14 +6989,14 @@ function editCommand5(program2) {
6426
6989
  baseUrl: input.baseUrl,
6427
6990
  apiKey: input.apiKey
6428
6991
  });
6429
- console.log(chalk42.green("\n\u2705 \u7F16\u8F91\u6210\u529F\n"));
6992
+ console.log(chalk44.green("\n\u2705 \u7F16\u8F91\u6210\u529F\n"));
6430
6993
  } catch (error) {
6431
6994
  if (error instanceof ProviderNotFoundError) {
6432
- console.error(chalk42.red(`
6995
+ console.error(chalk44.red(`
6433
6996
  \u274C \u670D\u52A1\u5546\u4E0D\u5B58\u5728: ${name}
6434
6997
  `));
6435
6998
  } else {
6436
- console.error(chalk42.red(`
6999
+ console.error(chalk44.red(`
6437
7000
  \u274C ${error.message}
6438
7001
  `));
6439
7002
  }
@@ -6444,16 +7007,17 @@ function editCommand5(program2) {
6444
7007
 
6445
7008
  // src/commands/opencode/remove.ts
6446
7009
  init_dist2();
6447
- init_confirm();
6448
- import chalk43 from "chalk";
6449
- import inquirer30 from "inquirer";
7010
+ import chalk45 from "chalk";
7011
+ import inquirer28 from "inquirer";
6450
7012
  function removeCommand5(program2) {
6451
- program2.command("remove [name]").alias("rm").description("\u5220\u9664 OpenCode \u670D\u52A1\u5546").action(async (name) => {
7013
+ const command = program2.command("remove [name]").alias("rm").description("\u5220\u9664 OpenCode \u670D\u52A1\u5546");
7014
+ addProviderRemoveOptions(command);
7015
+ command.action(async (name, options) => {
6452
7016
  try {
6453
7017
  const manager = createOpenCodeManager();
6454
7018
  const providers = manager.list();
6455
7019
  if (providers.length === 0) {
6456
- console.log(chalk43.yellow("\n\u26A0\uFE0F \u6682\u65E0 OpenCode \u670D\u52A1\u5546\n"));
7020
+ console.log(chalk45.yellow("\n\u26A0\uFE0F \u6682\u65E0 OpenCode \u670D\u52A1\u5546\n"));
6457
7021
  return;
6458
7022
  }
6459
7023
  let targetId;
@@ -6465,8 +7029,10 @@ function removeCommand5(program2) {
6465
7029
  }
6466
7030
  targetId = provider.id;
6467
7031
  targetName = provider.name;
7032
+ } else if (options.yes) {
7033
+ throw new Error("\u975E\u4EA4\u4E92\u6A21\u5F0F\u8BF7\u63D0\u4F9B\u8981\u5220\u9664\u7684\u670D\u52A1\u5546\u540D\u79F0");
6468
7034
  } else {
6469
- const { selectedId } = await inquirer30.prompt([
7035
+ const { selectedId } = await inquirer28.prompt([
6470
7036
  {
6471
7037
  type: "list",
6472
7038
  name: "selectedId",
@@ -6481,22 +7047,22 @@ function removeCommand5(program2) {
6481
7047
  targetId = selectedId;
6482
7048
  targetName = provider.name;
6483
7049
  }
6484
- const confirmed = await promptConfirm(`\u786E\u5B9A\u5220\u9664 "${targetName}"?`, false);
7050
+ const confirmed = await confirmProviderRemoval(targetName, options);
6485
7051
  if (!confirmed) {
6486
- console.log(chalk43.gray("\n\u5DF2\u53D6\u6D88\n"));
7052
+ console.log(chalk45.gray("\n\u5DF2\u53D6\u6D88\n"));
6487
7053
  return;
6488
7054
  }
6489
7055
  manager.remove(targetId);
6490
- console.log(chalk43.green(`
7056
+ console.log(chalk45.green(`
6491
7057
  \u2705 \u5DF2\u5220\u9664: ${targetName}
6492
7058
  `));
6493
7059
  } catch (error) {
6494
7060
  if (error instanceof ProviderNotFoundError) {
6495
- console.error(chalk43.red(`
7061
+ console.error(chalk45.red(`
6496
7062
  \u274C \u670D\u52A1\u5546\u4E0D\u5B58\u5728: ${name}
6497
7063
  `));
6498
7064
  } else {
6499
- console.error(chalk43.red(`
7065
+ console.error(chalk45.red(`
6500
7066
  \u274C ${error.message}
6501
7067
  `));
6502
7068
  }
@@ -6507,15 +7073,15 @@ function removeCommand5(program2) {
6507
7073
 
6508
7074
  // src/commands/opencode/clone.ts
6509
7075
  init_dist2();
6510
- import chalk44 from "chalk";
6511
- import inquirer31 from "inquirer";
7076
+ import chalk46 from "chalk";
7077
+ import inquirer29 from "inquirer";
6512
7078
  function cloneCommand4(program2) {
6513
7079
  program2.command("clone [source-name] [new-name]").description("\u514B\u9686 OpenCode \u670D\u52A1\u5546").action(async (sourceName, newName) => {
6514
7080
  try {
6515
7081
  const manager = createOpenCodeManager();
6516
7082
  const providers = manager.list();
6517
7083
  if (providers.length === 0) {
6518
- console.log(chalk44.yellow("\n\u26A0\uFE0F \u6682\u65E0 OpenCode \u670D\u52A1\u5546\n"));
7084
+ console.log(chalk46.yellow("\n\u26A0\uFE0F \u6682\u65E0 OpenCode \u670D\u52A1\u5546\n"));
6519
7085
  return;
6520
7086
  }
6521
7087
  let sourceId;
@@ -6526,7 +7092,7 @@ function cloneCommand4(program2) {
6526
7092
  }
6527
7093
  sourceId = provider.id;
6528
7094
  } else {
6529
- const { selectedId } = await inquirer31.prompt([
7095
+ const { selectedId } = await inquirer29.prompt([
6530
7096
  {
6531
7097
  type: "list",
6532
7098
  name: "selectedId",
@@ -6544,7 +7110,7 @@ function cloneCommand4(program2) {
6544
7110
  if (newName) {
6545
7111
  cloned = manager.clone(sourceId, newName);
6546
7112
  } else {
6547
- console.log(chalk44.blue(`
7113
+ console.log(chalk46.blue(`
6548
7114
  \u514B\u9686\u81EA: ${source.name}
6549
7115
  `));
6550
7116
  const input = await promptProviderForm({
@@ -6561,14 +7127,14 @@ function cloneCommand4(program2) {
6561
7127
  });
6562
7128
  }
6563
7129
  console.log();
6564
- console.log(chalk44.green("\u2705 \u514B\u9686\u6210\u529F"));
7130
+ console.log(chalk46.green("\u2705 \u514B\u9686\u6210\u529F"));
6565
7131
  console.log();
6566
- console.log(` ${chalk44.bold(cloned.name)} ${chalk44.blue("[OpenCode]")}`);
6567
- console.log(` ${chalk44.gray(`ID: ${cloned.id}`)}`);
6568
- console.log(` ${chalk44.gray(`URL: ${cloned.baseUrl}`)}`);
7132
+ console.log(` ${chalk46.bold(cloned.name)} ${chalk46.blue("[OpenCode]")}`);
7133
+ console.log(` ${chalk46.gray(`ID: ${cloned.id}`)}`);
7134
+ console.log(` ${chalk46.gray(`URL: ${cloned.baseUrl}`)}`);
6569
7135
  console.log();
6570
7136
  } catch (error) {
6571
- console.error(chalk44.red(`
7137
+ console.error(chalk46.red(`
6572
7138
  \u274C ${error.message}
6573
7139
  `));
6574
7140
  process.exit(1);
@@ -6589,15 +7155,35 @@ function createOpenCodeCommands(program2) {
6589
7155
 
6590
7156
  // src/commands/openclaw/add.ts
6591
7157
  init_dist2();
6592
- import chalk45 from "chalk";
6593
- import inquirer32 from "inquirer";
7158
+ import chalk47 from "chalk";
7159
+ import inquirer30 from "inquirer";
6594
7160
  init_confirm();
6595
7161
  function addCommand6(program2) {
6596
- program2.command("add").description("\u6DFB\u52A0\u65B0\u7684 OpenClaw \u670D\u52A1\u5546(\u4EA4\u4E92\u5F0F)").action(async () => {
7162
+ const command = program2.command("add").description("\u6DFB\u52A0\u65B0\u7684 OpenClaw \u670D\u52A1\u5546");
7163
+ addProviderAddOptions(command);
7164
+ command.action(async (options) => {
6597
7165
  try {
6598
7166
  const manager = createOpenClawManager();
6599
- console.log(chalk45.bold("\n\u{1F4DD} \u6DFB\u52A0 OpenClaw \u670D\u52A1\u5546\n"));
6600
- const { usePreset } = await inquirer32.prompt([
7167
+ console.log(chalk47.bold("\n\u{1F4DD} \u6DFB\u52A0 OpenClaw \u670D\u52A1\u5546\n"));
7168
+ const resolved = resolveProviderAddInput(options, OPENCLAW_PRESETS);
7169
+ if (resolved.nonInteractive && resolved.input) {
7170
+ const provider2 = manager.add(resolved.input);
7171
+ printSuccess("\u6DFB\u52A0\u6210\u529F", [
7172
+ `${chalk47.bold(provider2.name)} ${toolBadge("openclaw")}`,
7173
+ chalk47.gray(provider2.baseUrl)
7174
+ ]);
7175
+ if (resolved.switchNow) {
7176
+ manager.switch(provider2.id);
7177
+ printSuccess("\u5DF2\u5207\u6362\u5230\u65B0\u670D\u52A1\u5546", [
7178
+ chalk47.gray(`\u914D\u7F6E\u5DF2\u66F4\u65B0: ${getOpenClawConfigPath()}`),
7179
+ chalk47.gray(`\u914D\u7F6E\u5DF2\u66F4\u65B0: ${getOpenClawModelsPath()}`)
7180
+ ]);
7181
+ } else {
7182
+ printTip(`\u7A0D\u540E\u5207\u6362: ${chalk47.white(`ccman openclaw use "${provider2.name}"`)}`);
7183
+ }
7184
+ return;
7185
+ }
7186
+ const { usePreset } = await inquirer30.prompt([
6601
7187
  {
6602
7188
  type: "list",
6603
7189
  name: "usePreset",
@@ -6613,7 +7199,7 @@ function addCommand6(program2) {
6613
7199
  let baseUrl;
6614
7200
  let apiKey;
6615
7201
  if (usePreset) {
6616
- const { presetName } = await inquirer32.prompt([
7202
+ const { presetName } = await inquirer30.prompt([
6617
7203
  {
6618
7204
  type: "list",
6619
7205
  name: "presetName",
@@ -6625,7 +7211,7 @@ function addCommand6(program2) {
6625
7211
  }
6626
7212
  ]);
6627
7213
  const preset = OPENCLAW_PRESETS.find((p) => p.name === presetName);
6628
- console.log(chalk45.blue(`
7214
+ console.log(chalk47.blue(`
6629
7215
  \u4F7F\u7528\u9884\u8BBE: ${preset.name} - ${preset.description}
6630
7216
  `));
6631
7217
  const input = await promptProviderForm({
@@ -6639,7 +7225,7 @@ function addCommand6(program2) {
6639
7225
  baseUrl = input.baseUrl;
6640
7226
  apiKey = input.apiKey;
6641
7227
  } else {
6642
- const answers = await inquirer32.prompt([
7228
+ const answers = await inquirer30.prompt([
6643
7229
  {
6644
7230
  type: "input",
6645
7231
  name: "name",
@@ -6677,27 +7263,22 @@ function addCommand6(program2) {
6677
7263
  baseUrl,
6678
7264
  apiKey
6679
7265
  });
6680
- console.log();
6681
- console.log(chalk45.green("\u2705 \u6DFB\u52A0\u6210\u529F"));
6682
- console.log();
6683
- console.log(` ${chalk45.bold(provider.name)} ${chalk45.blue("[OpenClaw]")}`);
6684
- console.log(` ${chalk45.gray(provider.baseUrl)}`);
6685
- console.log();
7266
+ printSuccess("\u6DFB\u52A0\u6210\u529F", [
7267
+ `${chalk47.bold(provider.name)} ${toolBadge("openclaw")}`,
7268
+ chalk47.gray(provider.baseUrl)
7269
+ ]);
6686
7270
  const switchNow = await promptConfirm("\u662F\u5426\u7ACB\u5373\u5207\u6362\u5230\u6B64\u670D\u52A1\u5546?", true);
6687
7271
  if (switchNow) {
6688
7272
  manager.switch(provider.id);
6689
- console.log(chalk45.green("\u2705 \u5DF2\u5207\u6362\u5230\u65B0\u670D\u52A1\u5546"));
6690
- console.log();
6691
- console.log(chalk45.gray("\u914D\u7F6E\u5DF2\u66F4\u65B0:"));
6692
- console.log(chalk45.gray(` - ${getOpenClawConfigPath()}`));
6693
- console.log(chalk45.gray(` - ${getOpenClawModelsPath()}`));
7273
+ printSuccess("\u5DF2\u5207\u6362\u5230\u65B0\u670D\u52A1\u5546", [
7274
+ chalk47.gray(`\u914D\u7F6E\u5DF2\u66F4\u65B0: ${getOpenClawConfigPath()}`),
7275
+ chalk47.gray(`\u914D\u7F6E\u5DF2\u66F4\u65B0: ${getOpenClawModelsPath()}`)
7276
+ ]);
6694
7277
  } else {
6695
- console.log(
6696
- chalk45.blue("\u{1F4A1} \u7A0D\u540E\u5207\u6362:") + chalk45.white(` ccman openclaw use "${provider.name}"`)
6697
- );
7278
+ printTip(`\u7A0D\u540E\u5207\u6362: ${chalk47.white(`ccman openclaw use "${provider.name}"`)}`);
6698
7279
  }
6699
7280
  } catch (error) {
6700
- console.error(chalk45.red(`
7281
+ console.error(chalk47.red(`
6701
7282
  \u274C ${error.message}
6702
7283
  `));
6703
7284
  process.exit(1);
@@ -6707,7 +7288,7 @@ function addCommand6(program2) {
6707
7288
 
6708
7289
  // src/commands/openclaw/list.ts
6709
7290
  init_dist2();
6710
- import chalk46 from "chalk";
7291
+ import chalk48 from "chalk";
6711
7292
  function listCommand6(program2) {
6712
7293
  program2.command("list").alias("ls").description("\u5217\u51FA\u6240\u6709 OpenClaw \u670D\u52A1\u5546").action(async () => {
6713
7294
  try {
@@ -6715,15 +7296,15 @@ function listCommand6(program2) {
6715
7296
  const providers = manager.list();
6716
7297
  const current = manager.getCurrent();
6717
7298
  if (providers.length === 0) {
6718
- console.log(chalk46.yellow("\n\u26A0\uFE0F \u6682\u65E0 OpenClaw \u670D\u52A1\u5546\n"));
6719
- console.log(chalk46.blue("\u{1F4A1} \u6DFB\u52A0\u670D\u52A1\u5546:") + chalk46.white(" ccman openclaw add\n"));
7299
+ printWarning("\u6682\u65E0 OpenClaw \u670D\u52A1\u5546");
7300
+ printTip("\u6DFB\u52A0\u670D\u52A1\u5546: " + chalk48.white("ccman openclaw add"));
6720
7301
  return;
6721
7302
  }
6722
- console.log(chalk46.bold(`
6723
- \u{1F4CB} OpenClaw \u670D\u52A1\u5546 (${providers.length} \u4E2A)`));
6724
- console.log(formatProviderTable(providers, current?.id));
7303
+ console.log(
7304
+ formatProviderTable(providers, current?.id, `OpenClaw \u670D\u52A1\u5546 (${providers.length} \u4E2A)`)
7305
+ );
6725
7306
  } catch (error) {
6726
- console.error(chalk46.red(`
7307
+ console.error(chalk48.red(`
6727
7308
  \u274C ${error.message}
6728
7309
  `));
6729
7310
  process.exit(1);
@@ -6733,16 +7314,16 @@ function listCommand6(program2) {
6733
7314
 
6734
7315
  // src/commands/openclaw/use.ts
6735
7316
  init_dist2();
6736
- import chalk47 from "chalk";
6737
- import inquirer33 from "inquirer";
7317
+ import chalk49 from "chalk";
7318
+ import inquirer31 from "inquirer";
6738
7319
  function useCommand5(program2) {
6739
7320
  program2.command("use [name]").description("\u5207\u6362 OpenClaw \u670D\u52A1\u5546").action(async (name) => {
6740
7321
  try {
6741
7322
  const manager = createOpenClawManager();
6742
7323
  const providers = manager.list();
6743
7324
  if (providers.length === 0) {
6744
- console.log(chalk47.yellow("\n\u26A0\uFE0F \u6682\u65E0 OpenClaw \u670D\u52A1\u5546\n"));
6745
- console.log(chalk47.blue("\u{1F4A1} \u6DFB\u52A0\u670D\u52A1\u5546:") + chalk47.white(" ccman openclaw add\n"));
7325
+ printWarning("\u6682\u65E0 OpenClaw \u670D\u52A1\u5546");
7326
+ printTip("\u6DFB\u52A0\u670D\u52A1\u5546: " + chalk49.white("ccman openclaw add"));
6746
7327
  return;
6747
7328
  }
6748
7329
  let targetId;
@@ -6753,7 +7334,7 @@ function useCommand5(program2) {
6753
7334
  }
6754
7335
  targetId = provider2.id;
6755
7336
  } else {
6756
- const { selectedId } = await inquirer33.prompt([
7337
+ const { selectedId } = await inquirer31.prompt([
6757
7338
  {
6758
7339
  type: "list",
6759
7340
  name: "selectedId",
@@ -6768,20 +7349,19 @@ function useCommand5(program2) {
6768
7349
  }
6769
7350
  manager.switch(targetId);
6770
7351
  const provider = manager.get(targetId);
6771
- console.log(chalk47.green("\n\u2705 \u5207\u6362\u6210\u529F\n"));
6772
- console.log(` ${chalk47.bold(provider.name)} ${chalk47.blue("[OpenClaw]")}`);
6773
- console.log(` ${chalk47.gray(`URL: ${provider.baseUrl}`)}`);
6774
- console.log();
6775
- console.log(chalk47.gray("\u914D\u7F6E\u5DF2\u66F4\u65B0:"));
6776
- console.log(chalk47.gray(` - ${getOpenClawConfigPath()}`));
6777
- console.log(chalk47.gray(` - ${getOpenClawModelsPath()}`));
7352
+ printSuccess("\u5207\u6362\u6210\u529F", [
7353
+ `${chalk49.bold(provider.name)} ${toolBadge("openclaw")}`,
7354
+ chalk49.gray(`URL: ${provider.baseUrl}`),
7355
+ chalk49.gray(`\u914D\u7F6E\u5DF2\u66F4\u65B0: ${getOpenClawConfigPath()}`),
7356
+ chalk49.gray(`\u914D\u7F6E\u5DF2\u66F4\u65B0: ${getOpenClawModelsPath()}`)
7357
+ ]);
6778
7358
  } catch (error) {
6779
7359
  if (error instanceof ProviderNotFoundError) {
6780
- console.error(chalk47.red(`
7360
+ console.error(chalk49.red(`
6781
7361
  \u274C \u670D\u52A1\u5546\u4E0D\u5B58\u5728: ${name}
6782
7362
  `));
6783
7363
  } else {
6784
- console.error(chalk47.red(`
7364
+ console.error(chalk49.red(`
6785
7365
  \u274C ${error.message}
6786
7366
  `));
6787
7367
  }
@@ -6792,23 +7372,30 @@ function useCommand5(program2) {
6792
7372
 
6793
7373
  // src/commands/openclaw/current.ts
6794
7374
  init_dist2();
6795
- import chalk48 from "chalk";
7375
+ import chalk50 from "chalk";
6796
7376
  function currentCommand5(program2) {
6797
7377
  program2.command("current").description("\u663E\u793A\u5F53\u524D OpenClaw \u670D\u52A1\u5546").action(async () => {
6798
7378
  try {
6799
7379
  const manager = createOpenClawManager();
6800
7380
  const current = manager.getCurrent();
6801
7381
  if (!current) {
6802
- console.log(chalk48.yellow("\n\u26A0\uFE0F \u5F53\u524D\u6CA1\u6709\u6FC0\u6D3B\u7684 OpenClaw \u670D\u52A1\u5546\n"));
6803
- console.log(chalk48.blue("\u{1F4A1} \u5217\u51FA\u670D\u52A1\u5546:") + chalk48.white(" ccman openclaw list\n"));
7382
+ printWarning("\u672A\u9009\u62E9\u4EFB\u4F55 OpenClaw \u670D\u52A1\u5546");
7383
+ printTip("\u9009\u62E9\u670D\u52A1\u5546: " + chalk50.white("ccman openclaw use"));
6804
7384
  return;
6805
7385
  }
6806
- console.log(chalk48.bold("\n\u{1F3AF} \u5F53\u524D OpenClaw \u670D\u52A1\u5546\n"));
6807
- console.log(` \u540D\u79F0: ${chalk48.bold(current.name)}`);
6808
- console.log(` \u5730\u5740: ${chalk48.gray(current.baseUrl)}`);
6809
- console.log();
7386
+ const lines = [
7387
+ chalk50.green.bold(current.name),
7388
+ chalk50.gray(`ID: ${current.id}`),
7389
+ chalk50.gray(`URL: ${current.baseUrl}`)
7390
+ ];
7391
+ if (current.lastUsedAt) {
7392
+ lines.push(
7393
+ chalk50.gray(`\u6700\u540E\u4F7F\u7528: ${new Date(current.lastUsedAt).toLocaleString("zh-CN")}`)
7394
+ );
7395
+ }
7396
+ printInfo("\u{1F4CD} \u5F53\u524D OpenClaw \u670D\u52A1\u5546", lines);
6810
7397
  } catch (error) {
6811
- console.error(chalk48.red(`
7398
+ console.error(chalk50.red(`
6812
7399
  \u274C ${error.message}
6813
7400
  `));
6814
7401
  process.exit(1);
@@ -6818,18 +7405,21 @@ function currentCommand5(program2) {
6818
7405
 
6819
7406
  // src/commands/openclaw/edit.ts
6820
7407
  init_dist2();
6821
- import chalk49 from "chalk";
6822
- import inquirer34 from "inquirer";
7408
+ import chalk51 from "chalk";
7409
+ import inquirer32 from "inquirer";
6823
7410
  function editCommand6(program2) {
6824
- program2.command("edit [name]").description("\u7F16\u8F91 OpenClaw \u670D\u52A1\u5546").action(async (name) => {
7411
+ const command = program2.command("edit [name]").description("\u7F16\u8F91 OpenClaw \u670D\u52A1\u5546");
7412
+ addProviderEditOptions(command);
7413
+ command.action(async (name, options) => {
6825
7414
  try {
6826
7415
  const manager = createOpenClawManager();
6827
7416
  const providers = manager.list();
6828
7417
  if (providers.length === 0) {
6829
- console.log(chalk49.yellow("\n\u26A0\uFE0F \u6682\u65E0 OpenClaw \u670D\u52A1\u5546\n"));
6830
- console.log(chalk49.blue("\u{1F4A1} \u6DFB\u52A0\u670D\u52A1\u5546:") + chalk49.white(" ccman openclaw add\n"));
7418
+ console.log(chalk51.yellow("\n\u26A0\uFE0F \u6682\u65E0 OpenClaw \u670D\u52A1\u5546\n"));
7419
+ console.log(chalk51.blue("\u{1F4A1} \u6DFB\u52A0\u670D\u52A1\u5546:") + chalk51.white(" ccman openclaw add\n"));
6831
7420
  return;
6832
7421
  }
7422
+ const resolved = resolveProviderEditInput(options);
6833
7423
  let targetId;
6834
7424
  if (name) {
6835
7425
  const provider2 = manager.findByName(name);
@@ -6837,8 +7427,10 @@ function editCommand6(program2) {
6837
7427
  throw new ProviderNotFoundError(name);
6838
7428
  }
6839
7429
  targetId = provider2.id;
7430
+ } else if (resolved.nonInteractive) {
7431
+ throw new Error("\u975E\u4EA4\u4E92\u6A21\u5F0F\u8BF7\u63D0\u4F9B\u8981\u7F16\u8F91\u7684\u670D\u52A1\u5546\u540D\u79F0");
6840
7432
  } else {
6841
- const { selectedId } = await inquirer34.prompt([
7433
+ const { selectedId } = await inquirer32.prompt([
6842
7434
  {
6843
7435
  type: "list",
6844
7436
  name: "selectedId",
@@ -6852,6 +7444,15 @@ function editCommand6(program2) {
6852
7444
  targetId = selectedId;
6853
7445
  }
6854
7446
  const provider = manager.get(targetId);
7447
+ if (resolved.nonInteractive) {
7448
+ if (Object.keys(resolved.updates).length === 0) {
7449
+ console.log(chalk51.gray("\n\u672A\u505A\u4EFB\u4F55\u4FEE\u6539\n"));
7450
+ return;
7451
+ }
7452
+ manager.edit(targetId, resolved.updates);
7453
+ console.log(chalk51.green("\n\u2705 \u7F16\u8F91\u6210\u529F\n"));
7454
+ return;
7455
+ }
6855
7456
  const input = await promptProviderForm({
6856
7457
  name: provider.name,
6857
7458
  desc: provider.desc ?? "",
@@ -6864,14 +7465,14 @@ function editCommand6(program2) {
6864
7465
  baseUrl: input.baseUrl,
6865
7466
  apiKey: input.apiKey
6866
7467
  });
6867
- console.log(chalk49.green("\n\u2705 \u7F16\u8F91\u6210\u529F\n"));
7468
+ console.log(chalk51.green("\n\u2705 \u7F16\u8F91\u6210\u529F\n"));
6868
7469
  } catch (error) {
6869
7470
  if (error instanceof ProviderNotFoundError) {
6870
- console.error(chalk49.red(`
7471
+ console.error(chalk51.red(`
6871
7472
  \u274C \u670D\u52A1\u5546\u4E0D\u5B58\u5728: ${name}
6872
7473
  `));
6873
7474
  } else {
6874
- console.error(chalk49.red(`
7475
+ console.error(chalk51.red(`
6875
7476
  \u274C ${error.message}
6876
7477
  `));
6877
7478
  }
@@ -6882,16 +7483,17 @@ function editCommand6(program2) {
6882
7483
 
6883
7484
  // src/commands/openclaw/remove.ts
6884
7485
  init_dist2();
6885
- init_confirm();
6886
- import chalk50 from "chalk";
6887
- import inquirer35 from "inquirer";
7486
+ import chalk52 from "chalk";
7487
+ import inquirer33 from "inquirer";
6888
7488
  function removeCommand6(program2) {
6889
- program2.command("remove [name]").alias("rm").description("\u5220\u9664 OpenClaw \u670D\u52A1\u5546").action(async (name) => {
7489
+ const command = program2.command("remove [name]").alias("rm").description("\u5220\u9664 OpenClaw \u670D\u52A1\u5546");
7490
+ addProviderRemoveOptions(command);
7491
+ command.action(async (name, options) => {
6890
7492
  try {
6891
7493
  const manager = createOpenClawManager();
6892
7494
  const providers = manager.list();
6893
7495
  if (providers.length === 0) {
6894
- console.log(chalk50.yellow("\n\u26A0\uFE0F \u6682\u65E0 OpenClaw \u670D\u52A1\u5546\n"));
7496
+ console.log(chalk52.yellow("\n\u26A0\uFE0F \u6682\u65E0 OpenClaw \u670D\u52A1\u5546\n"));
6895
7497
  return;
6896
7498
  }
6897
7499
  let targetId;
@@ -6903,8 +7505,10 @@ function removeCommand6(program2) {
6903
7505
  }
6904
7506
  targetId = provider.id;
6905
7507
  targetName = provider.name;
7508
+ } else if (options.yes) {
7509
+ throw new Error("\u975E\u4EA4\u4E92\u6A21\u5F0F\u8BF7\u63D0\u4F9B\u8981\u5220\u9664\u7684\u670D\u52A1\u5546\u540D\u79F0");
6906
7510
  } else {
6907
- const { selectedId } = await inquirer35.prompt([
7511
+ const { selectedId } = await inquirer33.prompt([
6908
7512
  {
6909
7513
  type: "list",
6910
7514
  name: "selectedId",
@@ -6919,22 +7523,22 @@ function removeCommand6(program2) {
6919
7523
  targetId = selectedId;
6920
7524
  targetName = provider.name;
6921
7525
  }
6922
- const confirmed = await promptConfirm(`\u786E\u5B9A\u5220\u9664 "${targetName}"?`, false);
7526
+ const confirmed = await confirmProviderRemoval(targetName, options);
6923
7527
  if (!confirmed) {
6924
- console.log(chalk50.gray("\n\u5DF2\u53D6\u6D88\n"));
7528
+ console.log(chalk52.gray("\n\u5DF2\u53D6\u6D88\n"));
6925
7529
  return;
6926
7530
  }
6927
7531
  manager.remove(targetId);
6928
- console.log(chalk50.green(`
7532
+ console.log(chalk52.green(`
6929
7533
  \u2705 \u5DF2\u5220\u9664: ${targetName}
6930
7534
  `));
6931
7535
  } catch (error) {
6932
7536
  if (error instanceof ProviderNotFoundError) {
6933
- console.error(chalk50.red(`
7537
+ console.error(chalk52.red(`
6934
7538
  \u274C \u670D\u52A1\u5546\u4E0D\u5B58\u5728: ${name}
6935
7539
  `));
6936
7540
  } else {
6937
- console.error(chalk50.red(`
7541
+ console.error(chalk52.red(`
6938
7542
  \u274C ${error.message}
6939
7543
  `));
6940
7544
  }
@@ -6945,15 +7549,15 @@ function removeCommand6(program2) {
6945
7549
 
6946
7550
  // src/commands/openclaw/clone.ts
6947
7551
  init_dist2();
6948
- import chalk51 from "chalk";
6949
- import inquirer36 from "inquirer";
7552
+ import chalk53 from "chalk";
7553
+ import inquirer34 from "inquirer";
6950
7554
  function cloneCommand5(program2) {
6951
7555
  program2.command("clone [source-name] [new-name]").description("\u514B\u9686 OpenClaw \u670D\u52A1\u5546").action(async (sourceName, newName) => {
6952
7556
  try {
6953
7557
  const manager = createOpenClawManager();
6954
7558
  const providers = manager.list();
6955
7559
  if (providers.length === 0) {
6956
- console.log(chalk51.yellow("\n\u26A0\uFE0F \u6682\u65E0 OpenClaw \u670D\u52A1\u5546\n"));
7560
+ console.log(chalk53.yellow("\n\u26A0\uFE0F \u6682\u65E0 OpenClaw \u670D\u52A1\u5546\n"));
6957
7561
  return;
6958
7562
  }
6959
7563
  let sourceId;
@@ -6964,7 +7568,7 @@ function cloneCommand5(program2) {
6964
7568
  }
6965
7569
  sourceId = provider.id;
6966
7570
  } else {
6967
- const { selectedId } = await inquirer36.prompt([
7571
+ const { selectedId } = await inquirer34.prompt([
6968
7572
  {
6969
7573
  type: "list",
6970
7574
  name: "selectedId",
@@ -6982,7 +7586,7 @@ function cloneCommand5(program2) {
6982
7586
  if (newName) {
6983
7587
  cloned = manager.clone(sourceId, newName);
6984
7588
  } else {
6985
- console.log(chalk51.blue(`
7589
+ console.log(chalk53.blue(`
6986
7590
  \u514B\u9686\u81EA: ${source.name}
6987
7591
  `));
6988
7592
  const input = await promptProviderForm({
@@ -6999,14 +7603,14 @@ function cloneCommand5(program2) {
6999
7603
  });
7000
7604
  }
7001
7605
  console.log();
7002
- console.log(chalk51.green("\u2705 \u514B\u9686\u6210\u529F"));
7606
+ console.log(chalk53.green("\u2705 \u514B\u9686\u6210\u529F"));
7003
7607
  console.log();
7004
- console.log(` ${chalk51.bold(cloned.name)} ${chalk51.blue("[OpenClaw]")}`);
7005
- console.log(` ${chalk51.gray(`ID: ${cloned.id}`)}`);
7006
- console.log(` ${chalk51.gray(`URL: ${cloned.baseUrl}`)}`);
7608
+ console.log(` ${chalk53.bold(cloned.name)} ${chalk53.blue("[OpenClaw]")}`);
7609
+ console.log(` ${chalk53.gray(`ID: ${cloned.id}`)}`);
7610
+ console.log(` ${chalk53.gray(`URL: ${cloned.baseUrl}`)}`);
7007
7611
  console.log();
7008
7612
  } catch (error) {
7009
- console.error(chalk51.red(`
7613
+ console.error(chalk53.red(`
7010
7614
  \u274C ${error.message}
7011
7615
  `));
7012
7616
  process.exit(1);
@@ -7030,40 +7634,40 @@ init_sync();
7030
7634
 
7031
7635
  // src/commands/export.ts
7032
7636
  init_dist2();
7033
- import chalk52 from "chalk";
7637
+ import chalk54 from "chalk";
7034
7638
  import path13 from "path";
7035
7639
  function exportCommand(program2) {
7036
7640
  program2.command("export <\u76EE\u6807\u76EE\u5F55>").description("\u5BFC\u51FA\u914D\u7F6E\u5230\u672C\u5730\u76EE\u5F55\uFF08\u5305\u542B API Key\uFF09").action(async (targetDir) => {
7037
7641
  try {
7038
- console.log(chalk52.bold("\n\u{1F4E6} \u5BFC\u51FA\u914D\u7F6E\n"));
7642
+ console.log(chalk54.bold("\n\u{1F4E6} \u5BFC\u51FA\u914D\u7F6E\n"));
7039
7643
  const validation = validateExport();
7040
7644
  if (!validation.valid) {
7041
- console.log(chalk52.red(`\u274C ${validation.message}
7645
+ console.log(chalk54.red(`\u274C ${validation.message}
7042
7646
  `));
7043
7647
  process.exit(1);
7044
7648
  }
7045
7649
  const resolvedPath = targetDir.startsWith("~") ? path13.join(process.env.HOME || "", targetDir.slice(1)) : path13.resolve(targetDir);
7046
7650
  console.log("\u5BFC\u51FA\u6587\u4EF6\uFF08\u5B58\u5728\u5219\u5BFC\u51FA\uFF0C\u4E0D\u5B58\u5728\u5219\u8DF3\u8FC7\uFF09:");
7047
- console.log(` ${chalk52.cyan("codex.json")} - Codex \u914D\u7F6E`);
7048
- console.log(` ${chalk52.cyan("claude.json")} - Claude \u914D\u7F6E`);
7049
- console.log(` ${chalk52.cyan("openclaw.json")} - OpenClaw \u914D\u7F6E`);
7651
+ console.log(` ${chalk54.cyan("codex.json")} - Codex \u914D\u7F6E`);
7652
+ console.log(` ${chalk54.cyan("claude.json")} - Claude \u914D\u7F6E`);
7653
+ console.log(` ${chalk54.cyan("openclaw.json")} - OpenClaw \u914D\u7F6E`);
7050
7654
  console.log();
7051
- console.log(`\u76EE\u6807\u76EE\u5F55: ${chalk52.cyan(resolvedPath)}`);
7655
+ console.log(`\u76EE\u6807\u76EE\u5F55: ${chalk54.cyan(resolvedPath)}`);
7052
7656
  console.log();
7053
- console.log(chalk52.yellow("\u26A0\uFE0F \u5BFC\u51FA\u6587\u4EF6\u5305\u542B API Key\uFF0C\u8BF7\u59A5\u5584\u4FDD\u7BA1"));
7657
+ console.log(chalk54.yellow("\u26A0\uFE0F \u5BFC\u51FA\u6587\u4EF6\u5305\u542B API Key\uFF0C\u8BF7\u59A5\u5584\u4FDD\u7BA1"));
7054
7658
  console.log();
7055
7659
  const result = exportConfig(resolvedPath);
7056
- console.log(chalk52.green("\u2705 \u5BFC\u51FA\u6210\u529F"));
7660
+ console.log(chalk54.green("\u2705 \u5BFC\u51FA\u6210\u529F"));
7057
7661
  console.log();
7058
7662
  console.log("\u5DF2\u5BFC\u51FA\u6587\u4EF6:");
7059
7663
  for (const file of result.exportedFiles) {
7060
- console.log(` ${chalk52.cyan("\u2713")} ${file}`);
7664
+ console.log(` ${chalk54.cyan("\u2713")} ${file}`);
7061
7665
  }
7062
7666
  console.log();
7063
- console.log(chalk52.blue(`\u{1F4A1} \u5BFC\u5165\u547D\u4EE4: ccman import ${resolvedPath}
7667
+ console.log(chalk54.blue(`\u{1F4A1} \u5BFC\u5165\u547D\u4EE4: ccman import ${resolvedPath}
7064
7668
  `));
7065
7669
  } catch (error) {
7066
- console.error(chalk52.red(`
7670
+ console.error(chalk54.red(`
7067
7671
  \u274C ${error.message}
7068
7672
  `));
7069
7673
  process.exit(1);
@@ -7074,66 +7678,66 @@ function exportCommand(program2) {
7074
7678
  // src/commands/import.ts
7075
7679
  init_dist2();
7076
7680
  init_confirm();
7077
- import chalk53 from "chalk";
7681
+ import chalk55 from "chalk";
7078
7682
  import path14 from "path";
7079
7683
  function importCommand(program2) {
7080
7684
  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) => {
7081
7685
  try {
7082
7686
  const resolvedPath = sourceDir.startsWith("~") ? path14.join(process.env.HOME || "", sourceDir.slice(1)) : path14.resolve(sourceDir);
7083
- console.log(chalk53.bold("\n\u{1F4E5} \u5BFC\u5165\u914D\u7F6E\n"));
7687
+ console.log(chalk55.bold("\n\u{1F4E5} \u5BFC\u5165\u914D\u7F6E\n"));
7084
7688
  const validation = validateImportDir(resolvedPath);
7085
7689
  if (!validation.valid) {
7086
- console.log(chalk53.red(`\u274C ${validation.message}
7690
+ console.log(chalk55.red(`\u274C ${validation.message}
7087
7691
  `));
7088
7692
  process.exit(1);
7089
7693
  }
7090
- console.log(chalk53.yellow("\u26A0\uFE0F \u8B66\u544A\uFF1A\u5BFC\u5165\u5C06\u8986\u76D6\u5F53\u524D\u914D\u7F6E\n"));
7091
- console.log(`\u6E90\u76EE\u5F55: ${chalk53.cyan(resolvedPath)}`);
7694
+ console.log(chalk55.yellow("\u26A0\uFE0F \u8B66\u544A\uFF1A\u5BFC\u5165\u5C06\u8986\u76D6\u5F53\u524D\u914D\u7F6E\n"));
7695
+ console.log(`\u6E90\u76EE\u5F55: ${chalk55.cyan(resolvedPath)}`);
7092
7696
  console.log();
7093
7697
  console.log("\u627E\u5230\u914D\u7F6E\u6587\u4EF6:");
7094
7698
  for (const file of validation.foundFiles) {
7095
- console.log(` ${chalk53.cyan("\u2713")} ${file}`);
7699
+ console.log(` ${chalk55.cyan("\u2713")} ${file}`);
7096
7700
  }
7097
7701
  console.log();
7098
- console.log(chalk53.gray("\u672A\u627E\u5230\u7684\u53D7\u652F\u6301\u6587\u4EF6\u5C06\u81EA\u52A8\u8DF3\u8FC7\uFF0C\u4E0D\u4F1A\u4E2D\u65AD\u5BFC\u5165"));
7702
+ console.log(chalk55.gray("\u672A\u627E\u5230\u7684\u53D7\u652F\u6301\u6587\u4EF6\u5C06\u81EA\u52A8\u8DF3\u8FC7\uFF0C\u4E0D\u4F1A\u4E2D\u65AD\u5BFC\u5165"));
7099
7703
  console.log();
7100
- console.log(chalk53.gray("\u5F53\u524D\u914D\u7F6E\u5C06\u88AB\u8986\u76D6\uFF08\u81EA\u52A8\u5907\u4EFD\uFF09"));
7704
+ console.log(chalk55.gray("\u5F53\u524D\u914D\u7F6E\u5C06\u88AB\u8986\u76D6\uFF08\u81EA\u52A8\u5907\u4EFD\uFF09"));
7101
7705
  console.log();
7102
7706
  const confirmFirst = await promptConfirm("\u786E\u8BA4\u5BFC\u5165\uFF1F", false);
7103
7707
  if (!confirmFirst) {
7104
- console.log(chalk53.gray("\n\u274C \u5DF2\u53D6\u6D88\n"));
7708
+ console.log(chalk55.gray("\n\u274C \u5DF2\u53D6\u6D88\n"));
7105
7709
  return;
7106
7710
  }
7107
7711
  console.log();
7108
- 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"));
7712
+ console.log(chalk55.red.bold("\u26A0\uFE0F \u6700\u540E\u786E\u8BA4\uFF1A\u6B64\u64CD\u4F5C\u5C06\u8986\u76D6\u6240\u6709\u5F53\u524D\u914D\u7F6E\uFF01"));
7109
7713
  console.log();
7110
7714
  const confirmSecond = await promptConfirm("\u771F\u7684\u8981\u7EE7\u7EED\u5417\uFF1F", false);
7111
7715
  if (!confirmSecond) {
7112
- console.log(chalk53.gray("\n\u274C \u5DF2\u53D6\u6D88\n"));
7716
+ console.log(chalk55.gray("\n\u274C \u5DF2\u53D6\u6D88\n"));
7113
7717
  return;
7114
7718
  }
7115
7719
  console.log();
7116
- console.log(chalk53.gray("\u{1F4BE} \u5907\u4EFD\u5F53\u524D\u914D\u7F6E..."));
7117
- console.log(chalk53.gray("\u{1F4E5} \u5BFC\u5165\u65B0\u914D\u7F6E..."));
7720
+ console.log(chalk55.gray("\u{1F4BE} \u5907\u4EFD\u5F53\u524D\u914D\u7F6E..."));
7721
+ console.log(chalk55.gray("\u{1F4E5} \u5BFC\u5165\u65B0\u914D\u7F6E..."));
7118
7722
  const result = importConfig(resolvedPath);
7119
7723
  console.log();
7120
- console.log(chalk53.green("\u2705 \u5BFC\u5165\u6210\u529F"));
7724
+ console.log(chalk55.green("\u2705 \u5BFC\u5165\u6210\u529F"));
7121
7725
  console.log();
7122
7726
  if (result.backupPaths.length > 0) {
7123
7727
  console.log("\u5907\u4EFD\u6587\u4EF6:");
7124
7728
  for (const backupPath of result.backupPaths) {
7125
- console.log(` ${chalk53.gray(backupPath)}`);
7729
+ console.log(` ${chalk55.gray(backupPath)}`);
7126
7730
  }
7127
7731
  console.log();
7128
7732
  }
7129
7733
  console.log("\u5DF2\u5BFC\u5165\u6587\u4EF6:");
7130
7734
  for (const file of result.importedFiles) {
7131
- console.log(` ${chalk53.cyan("\u2713")} ${file}`);
7735
+ console.log(` ${chalk55.cyan("\u2713")} ${file}`);
7132
7736
  }
7133
7737
  console.log();
7134
- console.log(chalk53.blue("\u{1F4A1} \u8BF7\u4F7F\u7528 'ccman cx use' \u6216 'ccman cc use' \u5207\u6362\u670D\u52A1\u5546\n"));
7738
+ console.log(chalk55.blue("\u{1F4A1} \u8BF7\u4F7F\u7528 'ccman cx use' \u6216 'ccman cc use' \u5207\u6362\u670D\u52A1\u5546\n"));
7135
7739
  } catch (error) {
7136
- console.error(chalk53.red(`
7740
+ console.error(chalk55.red(`
7137
7741
  \u274C ${error.message}
7138
7742
  `));
7139
7743
  process.exit(1);
@@ -7145,8 +7749,8 @@ function importCommand(program2) {
7145
7749
  init_dist2();
7146
7750
  import fs13 from "fs";
7147
7751
  import path15 from "path";
7148
- import chalk54 from "chalk";
7149
- import inquirer37 from "inquirer";
7752
+ import chalk56 from "chalk";
7753
+ import inquirer35 from "inquirer";
7150
7754
 
7151
7755
  // src/utils/endpoint-latency.ts
7152
7756
  import { request as httpRequest } from "http";
@@ -7265,12 +7869,13 @@ function pickDefaultEndpoint(results) {
7265
7869
  var GMN_PROFILE = {
7266
7870
  commandName: "gmn",
7267
7871
  title: "GMN",
7872
+ defaultProviderName: "gmn",
7268
7873
  endpointGroupLabel: "GMN \u57DF\u540D\u7EBF\u8DEF",
7269
7874
  endpointGroupDescription: "\u4EC5\u5305\u542B\u4E3B\u57DF\u540D\u548C CDN \u7684 2 \u6761\u5730\u5740",
7270
7875
  baseUrls: [
7271
7876
  {
7272
7877
  label: "GMN \u4E3B\u7AD9",
7273
- url: "https://gmn.chuangzuoli.com",
7878
+ url: "https://ai.gmncode.com",
7274
7879
  description: "GMN \u4E3B\u57DF\u540D\u5165\u53E3"
7275
7880
  },
7276
7881
  {
@@ -7283,6 +7888,7 @@ var GMN_PROFILE = {
7283
7888
  var GMN1_PROFILE = {
7284
7889
  commandName: "gmn1",
7285
7890
  title: "GMN1",
7891
+ defaultProviderName: "gmn1",
7286
7892
  endpointGroupLabel: "\u6269\u5C55\u52A0\u901F\u7EBF\u8DEF",
7287
7893
  endpointGroupDescription: "\u5305\u542B\u9664 chuangzuoli \u4E4B\u5916\u7684\u5176\u4F59 5 \u6761\u5730\u5740",
7288
7894
  baseUrls: [
@@ -7322,7 +7928,6 @@ function formatEndpointChoiceLabel(result, index) {
7322
7928
  }
7323
7929
 
7324
7930
  // src/commands/gmn.ts
7325
- var DEFAULT_PROVIDER_NAME2 = "gmn";
7326
7931
  var VALID_PLATFORMS = ["codex", "opencode", "openclaw"];
7327
7932
  var DEFAULT_PLATFORMS = ["codex", "opencode"];
7328
7933
  var TOTAL_STEPS = 4;
@@ -7337,7 +7942,7 @@ function renderStep(current, total, title) {
7337
7942
  function printBanner(title) {
7338
7943
  printLogo();
7339
7944
  console.log(
7340
- chalk54.cyanBright(
7945
+ chalk56.cyanBright(
7341
7946
  [
7342
7947
  " \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2557 \u2588\u2588\u2557",
7343
7948
  " \u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D \u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2551",
@@ -7349,11 +7954,11 @@ function printBanner(title) {
7349
7954
  ].join("\n")
7350
7955
  )
7351
7956
  );
7352
- console.log(chalk54.gray("\u81EA\u52A8\u5199\u5165\u9009\u4E2D\u5DE5\u5177\u914D\u7F6E\uFF0C\u652F\u6301\u591A\u9009\u3002\n"));
7957
+ console.log(chalk56.gray("\u81EA\u52A8\u5199\u5165\u9009\u4E2D\u5DE5\u5177\u914D\u7F6E\uFF0C\u652F\u6301\u591A\u9009\u3002\n"));
7353
7958
  }
7354
7959
  function printKeyNotice() {
7355
7960
  console.log(
7356
- chalk54.yellow(
7961
+ chalk56.yellow(
7357
7962
  [
7358
7963
  "\u63D0\u793A\uFF1A\u672C\u547D\u4EE4\u652F\u6301 Codex\u3001OpenCode\u3001OpenClaw \u4E09\u4E2A\u5E73\u53F0\u3002",
7359
7964
  "Codex \u4E0E OpenCode \u5171\u4EAB OpenAI \u7AEF\u70B9\uFF1BOpenClaw \u4F7F\u7528 /v1 \u7AEF\u70B9\u3002",
@@ -7363,22 +7968,22 @@ function printKeyNotice() {
7363
7968
  );
7364
7969
  }
7365
7970
  function printWriteTargets(platforms) {
7366
- console.log(chalk54.gray(`\u5199\u5165\u76EE\u5F55: ${getCcmanDir()}`));
7971
+ console.log(chalk56.gray(`\u5199\u5165\u76EE\u5F55: ${getCcmanDir()}`));
7367
7972
  if (platforms.includes("codex")) {
7368
- console.log(chalk54.gray(` - Codex: ${getCodexConfigPath()}`));
7369
- console.log(chalk54.gray(` - Codex: ${getCodexAuthPath()}`));
7973
+ console.log(chalk56.gray(` - Codex: ${getCodexConfigPath()}`));
7974
+ console.log(chalk56.gray(` - Codex: ${getCodexAuthPath()}`));
7370
7975
  }
7371
7976
  if (platforms.includes("opencode")) {
7372
- console.log(chalk54.gray(` - OpenCode: ${getOpenCodeConfigPath()}`));
7977
+ console.log(chalk56.gray(` - OpenCode: ${getOpenCodeConfigPath()}`));
7373
7978
  }
7374
7979
  if (platforms.includes("openclaw")) {
7375
- console.log(chalk54.gray(` - OpenClaw: ${getOpenClawConfigPath()}`));
7376
- console.log(chalk54.gray(` - OpenClaw: ${getOpenClawModelsPath()}`));
7980
+ console.log(chalk56.gray(` - OpenClaw: ${getOpenClawConfigPath()}`));
7981
+ console.log(chalk56.gray(` - OpenClaw: ${getOpenClawModelsPath()}`));
7377
7982
  }
7378
7983
  const env = process.env.NODE_ENV;
7379
7984
  if (env === "development" || env === "test") {
7380
7985
  console.log(
7381
- chalk54.yellow(
7986
+ chalk56.yellow(
7382
7987
  `\u26A0\uFE0F \u5F53\u524D NODE_ENV=${env}\uFF0C\u5C06\u5199\u5165\u5F00\u53D1/\u6D4B\u8BD5\u76EE\u5F55\uFF1B\u5982\u9700\u5199\u5165\u771F\u5B9E HOME\uFF0C\u8BF7\u5728\u751F\u4EA7\u73AF\u5883\u8FD0\u884C\uFF08unset NODE_ENV\uFF09\u3002`
7383
7988
  )
7384
7989
  );
@@ -7397,7 +8002,7 @@ function parsePlatforms(platformArg) {
7397
8002
  return platforms;
7398
8003
  }
7399
8004
  async function promptApiKey(title) {
7400
- const answers = await inquirer37.prompt([
8005
+ const answers = await inquirer35.prompt([
7401
8006
  {
7402
8007
  type: "password",
7403
8008
  name: "apiKey",
@@ -7412,7 +8017,7 @@ async function promptApiKey(title) {
7412
8017
  return answers.apiKey.trim();
7413
8018
  }
7414
8019
  async function promptPlatforms(title) {
7415
- const answers = await inquirer37.prompt([
8020
+ const answers = await inquirer35.prompt([
7416
8021
  {
7417
8022
  type: "checkbox",
7418
8023
  name: "platforms",
@@ -7458,20 +8063,20 @@ function buildProbeCandidates(baseUrls, platforms) {
7458
8063
  }
7459
8064
  function printBaseUrlProbeResults(profile, results, platforms) {
7460
8065
  const usingOpenClawPath = platforms.length === 1 && platforms[0] === "openclaw";
7461
- console.log(chalk54.bold(`\u5F53\u524D\u6D4B\u901F\u8303\u56F4\uFF1A${profile.endpointGroupLabel}`));
7462
- console.log(chalk54.gray(`${profile.endpointGroupDescription}\uFF08\u5171 ${results.length} \u6761\uFF09`));
8066
+ console.log(chalk56.bold(`\u5F53\u524D\u6D4B\u901F\u8303\u56F4\uFF1A${profile.endpointGroupLabel}`));
8067
+ console.log(chalk56.gray(`${profile.endpointGroupDescription}\uFF08\u5171 ${results.length} \u6761\uFF09`));
7463
8068
  console.log(
7464
- chalk54.gray(
8069
+ chalk56.gray(
7465
8070
  `\u6D4B\u901F\u65B9\u5F0F\uFF1AHTTPS \u9996\u5305\u5EF6\u8FDF\uFF08${BASE_URL_PROBE_SAMPLE_COUNT} \u6B21\u4E2D\u4F4D\u6570\uFF09${usingOpenClawPath ? "\uFF0C\u5F53\u524D\u4EC5\u68C0\u6D4B OpenClaw \u7684 /v1 \u7AEF\u70B9" : ""}`
7466
8071
  )
7467
8072
  );
7468
8073
  console.log();
7469
8074
  for (const [index, result] of results.entries()) {
7470
- const latencyText = result.latencyMs === null ? chalk54.red(formatLatency(result)) : chalk54.green(formatLatency(result));
7471
- console.log(` ${chalk54.cyan(`${index + 1}. ${result.label}`)}`);
7472
- console.log(chalk54.gray(` \u57DF\u540D: ${getEndpointHost(result.url)}`));
7473
- console.log(chalk54.gray(` \u5730\u5740: ${result.url}`));
7474
- console.log(chalk54.gray(` \u8BF4\u660E: ${result.description}`));
8075
+ const latencyText = result.latencyMs === null ? chalk56.red(formatLatency(result)) : chalk56.green(formatLatency(result));
8076
+ console.log(` ${chalk56.cyan(`${index + 1}. ${result.label}`)}`);
8077
+ console.log(chalk56.gray(` \u57DF\u540D: ${getEndpointHost(result.url)}`));
8078
+ console.log(chalk56.gray(` \u5730\u5740: ${result.url}`));
8079
+ console.log(chalk56.gray(` \u8BF4\u660E: ${result.description}`));
7475
8080
  console.log(` \u5EF6\u8FDF: ${latencyText}`);
7476
8081
  console.log();
7477
8082
  }
@@ -7479,7 +8084,7 @@ function printBaseUrlProbeResults(profile, results, platforms) {
7479
8084
  async function resolveOpenAiBaseUrl(profile, platforms, baseUrlArg) {
7480
8085
  if (baseUrlArg && baseUrlArg.trim().length > 0) {
7481
8086
  const normalized = normalizeEndpointUrl(baseUrlArg);
7482
- console.log(chalk54.gray(`\u5DF2\u901A\u8FC7\u53C2\u6570\u6307\u5B9A Base URL: ${normalized}`));
8087
+ console.log(chalk56.gray(`\u5DF2\u901A\u8FC7\u53C2\u6570\u6307\u5B9A Base URL: ${normalized}`));
7483
8088
  return normalized;
7484
8089
  }
7485
8090
  const probeResults = sortEndpointProbeResults(
@@ -7495,19 +8100,19 @@ async function resolveOpenAiBaseUrl(profile, platforms, baseUrlArg) {
7495
8100
  const defaultResult = pickDefaultEndpoint(probeResults) || probeResults[0];
7496
8101
  const allFailed = probeResults.every((result) => result.latencyMs === null);
7497
8102
  if (allFailed) {
7498
- console.log(chalk54.yellow("\u26A0\uFE0F \u6240\u6709\u5019\u9009\u5730\u5740\u6D4B\u901F\u5931\u8D25\uFF0C\u5C06\u9ED8\u8BA4\u9009\u4E2D\u7B2C\u4E00\u4E2A\u5730\u5740\uFF0C\u4F60\u4E5F\u53EF\u4EE5\u624B\u52A8\u5207\u6362\u3002"));
8103
+ console.log(chalk56.yellow("\u26A0\uFE0F \u6240\u6709\u5019\u9009\u5730\u5740\u6D4B\u901F\u5931\u8D25\uFF0C\u5C06\u9ED8\u8BA4\u9009\u4E2D\u7B2C\u4E00\u4E2A\u5730\u5740\uFF0C\u4F60\u4E5F\u53EF\u4EE5\u624B\u52A8\u5207\u6362\u3002"));
7499
8104
  } else {
7500
- console.log(chalk54.gray(`\u9ED8\u8BA4\u5DF2\u9009\u6700\u4F4E\u5EF6\u8FDF\u7EBF\u8DEF\uFF1A${defaultResult.url}`));
8105
+ console.log(chalk56.gray(`\u9ED8\u8BA4\u5DF2\u9009\u6700\u4F4E\u5EF6\u8FDF\u7EBF\u8DEF\uFF1A${defaultResult.url}`));
7501
8106
  }
7502
8107
  if (probeResults.length === 1) {
7503
- console.log(chalk54.green(`\u5DF2\u81EA\u52A8\u9009\u62E9: ${defaultResult.url}`));
8108
+ console.log(chalk56.green(`\u5DF2\u81EA\u52A8\u9009\u62E9: ${defaultResult.url}`));
7504
8109
  return defaultResult.url;
7505
8110
  }
7506
8111
  if (!process.stdin.isTTY || !process.stdout.isTTY) {
7507
- console.log(chalk54.yellow(`\u975E\u4EA4\u4E92\u73AF\u5883\uFF0C\u5DF2\u81EA\u52A8\u4F7F\u7528\u9ED8\u8BA4\u5730\u5740\uFF1A${defaultResult.url}`));
8112
+ console.log(chalk56.yellow(`\u975E\u4EA4\u4E92\u73AF\u5883\uFF0C\u5DF2\u81EA\u52A8\u4F7F\u7528\u9ED8\u8BA4\u5730\u5740\uFF1A${defaultResult.url}`));
7508
8113
  return defaultResult.url;
7509
8114
  }
7510
- const answers = await inquirer37.prompt([
8115
+ const answers = await inquirer35.prompt([
7511
8116
  {
7512
8117
  type: "list",
7513
8118
  name: "baseUrl",
@@ -7521,16 +8126,16 @@ async function resolveOpenAiBaseUrl(profile, platforms, baseUrlArg) {
7521
8126
  ]);
7522
8127
  return answers.baseUrl;
7523
8128
  }
7524
- function resolveProviderName2(providerNameArg) {
8129
+ function resolveProviderName2(profile, providerNameArg) {
7525
8130
  if (providerNameArg === void 0) {
7526
- return DEFAULT_PROVIDER_NAME2;
8131
+ return profile.defaultProviderName;
7527
8132
  }
7528
8133
  const providerName = providerNameArg.trim();
7529
8134
  if (!providerName) {
7530
8135
  throw new Error("\u670D\u52A1\u5546\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A");
7531
8136
  }
7532
- if (providerName.toLowerCase() === DEFAULT_PROVIDER_NAME2) {
7533
- return DEFAULT_PROVIDER_NAME2;
8137
+ if (providerName.toLowerCase() === profile.defaultProviderName) {
8138
+ return profile.defaultProviderName;
7534
8139
  }
7535
8140
  return providerName;
7536
8141
  }
@@ -7615,24 +8220,24 @@ async function runGmnCommand(profile, apiKey, platformArg, providerNameArg, base
7615
8220
  let platforms;
7616
8221
  let providerName;
7617
8222
  try {
7618
- console.log(chalk54.cyan(`
8223
+ console.log(chalk56.cyan(`
7619
8224
  ${renderStep(1, TOTAL_STEPS, "\u9009\u62E9\u8981\u914D\u7F6E\u7684\u5DE5\u5177")}`));
7620
8225
  platforms = await resolvePlatforms(platformArg, profile.title);
7621
- providerName = resolveProviderName2(providerNameArg);
8226
+ providerName = resolveProviderName2(profile, providerNameArg);
7622
8227
  } catch (error) {
7623
- console.error(chalk54.red(`\u274C ${error.message}`));
8228
+ console.error(chalk56.red(`\u274C ${error.message}`));
7624
8229
  process.exit(1);
7625
8230
  }
7626
- console.log(chalk54.gray(`\u5DF2\u9009\u62E9: ${platforms.join(", ")}`));
7627
- console.log(chalk54.gray(`\u670D\u52A1\u5546\u540D\u79F0: ${providerName}`));
8231
+ console.log(chalk56.gray(`\u5DF2\u9009\u62E9: ${platforms.join(", ")}`));
8232
+ console.log(chalk56.gray(`\u670D\u52A1\u5546\u540D\u79F0: ${providerName}`));
7628
8233
  printKeyNotice();
7629
- console.log(chalk54.cyan(`
8234
+ console.log(chalk56.cyan(`
7630
8235
  ${renderStep(2, TOTAL_STEPS, "\u6D4B\u901F\u5E76\u9009\u62E9 Base URL")}`));
7631
8236
  let openaiBaseUrl;
7632
8237
  try {
7633
8238
  openaiBaseUrl = await resolveOpenAiBaseUrl(profile, platforms, baseUrlArg);
7634
8239
  } catch (error) {
7635
- console.error(chalk54.red(`\u274C ${error.message}`));
8240
+ console.error(chalk56.red(`\u274C ${error.message}`));
7636
8241
  process.exit(1);
7637
8242
  }
7638
8243
  const openclawBaseUrl = buildOpenClawBaseUrl(openaiBaseUrl);
@@ -7642,23 +8247,23 @@ ${renderStep(2, TOTAL_STEPS, "\u6D4B\u901F\u5E76\u9009\u62E9 Base URL")}`));
7642
8247
  openclaw: openclawBaseUrl
7643
8248
  };
7644
8249
  let resolvedApiKey = apiKey?.trim();
7645
- console.log(chalk54.cyan(`
8250
+ console.log(chalk56.cyan(`
7646
8251
  ${renderStep(3, TOTAL_STEPS, "\u8F93\u5165 API Key")}`));
7647
8252
  if (!resolvedApiKey) {
7648
8253
  resolvedApiKey = await promptApiKey(profile.title);
7649
8254
  } else {
7650
- console.log(chalk54.gray("\u5DF2\u901A\u8FC7\u53C2\u6570\u63D0\u4F9B API Key\uFF08\u5DF2\u9690\u85CF\uFF09"));
8255
+ console.log(chalk56.gray("\u5DF2\u901A\u8FC7\u53C2\u6570\u63D0\u4F9B API Key\uFF08\u5DF2\u9690\u85CF\uFF09"));
7651
8256
  }
7652
8257
  if (!resolvedApiKey?.trim()) {
7653
- console.error(chalk54.red("\u274C \u9519\u8BEF: API Key \u4E0D\u80FD\u4E3A\u7A7A"));
8258
+ console.error(chalk56.red("\u274C \u9519\u8BEF: API Key \u4E0D\u80FD\u4E3A\u7A7A"));
7654
8259
  process.exit(1);
7655
8260
  }
7656
- console.log(chalk54.cyan(`
8261
+ console.log(chalk56.cyan(`
7657
8262
  ${renderStep(4, TOTAL_STEPS, "\u5F00\u59CB\u5199\u5165\u914D\u7F6E")}`));
7658
- console.log(chalk54.gray(`\u5DF2\u9009\u62E9\u5E73\u53F0: ${platforms.join(", ")}`));
7659
- console.log(chalk54.gray(`OpenAI Base URL: ${openaiBaseUrl}`));
8263
+ console.log(chalk56.gray(`\u5DF2\u9009\u62E9\u5E73\u53F0: ${platforms.join(", ")}`));
8264
+ console.log(chalk56.gray(`OpenAI Base URL: ${openaiBaseUrl}`));
7660
8265
  if (platforms.includes("openclaw")) {
7661
- console.log(chalk54.gray(`OpenClaw Base URL: ${openclawBaseUrl}`));
8266
+ console.log(chalk56.gray(`OpenClaw Base URL: ${openclawBaseUrl}`));
7662
8267
  }
7663
8268
  printWriteTargets(platforms);
7664
8269
  console.log();
@@ -7668,7 +8273,7 @@ ${renderStep(4, TOTAL_STEPS, "\u5F00\u59CB\u5199\u5165\u914D\u7F6E")}`));
7668
8273
  `${profile.commandName}-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`
7669
8274
  );
7670
8275
  fs13.mkdirSync(backupRootDir, { recursive: true, mode: 448 });
7671
- console.log(chalk54.gray(`\u5907\u4EFD\u6839\u76EE\u5F55: ${backupRootDir}`));
8276
+ console.log(chalk56.gray(`\u5907\u4EFD\u6839\u76EE\u5F55: ${backupRootDir}`));
7672
8277
  console.log();
7673
8278
  const ALL_TOOLS = {
7674
8279
  codex: { name: "Codex", manager: createCodexManager() },
@@ -7684,13 +8289,13 @@ ${renderStep(4, TOTAL_STEPS, "\u5F00\u59CB\u5199\u5165\u914D\u7F6E")}`));
7684
8289
  for (const { platform, name, manager } of tools) {
7685
8290
  let backupResult = null;
7686
8291
  try {
7687
- console.log(chalk54.gray(`\u2192 \u914D\u7F6E ${name}...`));
8292
+ console.log(chalk56.gray(`\u2192 \u914D\u7F6E ${name}...`));
7688
8293
  backupResult = createPlatformBackupOrThrow(platform, backupRootDir);
7689
8294
  const backupFiles = backupResult.entries.map((entry) => entry.backupPath).filter((p) => p !== null);
7690
8295
  if (backupFiles.length > 0) {
7691
- console.log(chalk54.gray(` \u5DF2\u5907\u4EFD ${backupFiles.length} \u4E2A\u6587\u4EF6`));
8296
+ console.log(chalk56.gray(` \u5DF2\u5907\u4EFD ${backupFiles.length} \u4E2A\u6587\u4EF6`));
7692
8297
  } else {
7693
- console.log(chalk54.gray(" \u65E0\u5386\u53F2\u6587\u4EF6\u53EF\u5907\u4EFD"));
8298
+ console.log(chalk56.gray(" \u65E0\u5386\u53F2\u6587\u4EF6\u53EF\u5907\u4EFD"));
7694
8299
  }
7695
8300
  const baseUrl = platformBaseUrls[platform];
7696
8301
  const existing = findPreferredProvider(manager.list(), providerName);
@@ -7701,7 +8306,7 @@ ${renderStep(4, TOTAL_STEPS, "\u5F00\u59CB\u5199\u5165\u914D\u7F6E")}`));
7701
8306
  ) : manager.add({ name: providerName, baseUrl, apiKey: resolvedApiKey });
7702
8307
  manager.switch(provider.id, { mode: "overwrite" });
7703
8308
  completed += 1;
7704
- console.log(chalk54.green(`\u2705 ${name}`));
8309
+ console.log(chalk56.green(`\u2705 ${name}`));
7705
8310
  successBackups.push({
7706
8311
  name,
7707
8312
  backupDir: backupResult.backupDir,
@@ -7712,38 +8317,38 @@ ${renderStep(4, TOTAL_STEPS, "\u5F00\u59CB\u5199\u5165\u914D\u7F6E")}`));
7712
8317
  if (backupResult !== null) {
7713
8318
  try {
7714
8319
  rollbackFromBackupOrThrow(backupResult);
7715
- console.error(chalk54.red(`\u274C ${name}: ${operationError.message}\uFF08\u5DF2\u56DE\u6EDA\u5386\u53F2\u6587\u4EF6\uFF09`));
8320
+ console.error(chalk56.red(`\u274C ${name}: ${operationError.message}\uFF08\u5DF2\u56DE\u6EDA\u5386\u53F2\u6587\u4EF6\uFF09`));
7716
8321
  } catch (rollbackError) {
7717
8322
  console.error(
7718
- chalk54.red(
8323
+ chalk56.red(
7719
8324
  `\u274C ${name}: ${operationError.message}\uFF1B\u56DE\u6EDA\u4E5F\u5931\u8D25: ${rollbackError.message}`
7720
8325
  )
7721
8326
  );
7722
8327
  }
7723
8328
  } else {
7724
- console.error(chalk54.red(`\u274C ${name}: ${operationError.message}`));
8329
+ console.error(chalk56.red(`\u274C ${name}: ${operationError.message}`));
7725
8330
  }
7726
8331
  }
7727
8332
  }
7728
- console.log(chalk54.green(`
8333
+ console.log(chalk56.green(`
7729
8334
  \u{1F389} ${profile.title} \u914D\u7F6E\u5B8C\u6210\uFF01(${completed}/${tools.length})`));
7730
8335
  console.log();
7731
- console.log(chalk54.bold("\u5907\u4EFD\u4FE1\u606F:"));
8336
+ console.log(chalk56.bold("\u5907\u4EFD\u4FE1\u606F:"));
7732
8337
  if (successBackups.length === 0) {
7733
- console.log(chalk54.gray(" \u65E0\u6210\u529F\u914D\u7F6E\u9879\uFF0C\u672A\u751F\u6210\u53EF\u7528\u5907\u4EFD\u76EE\u5F55\u3002"));
8338
+ console.log(chalk56.gray(" \u65E0\u6210\u529F\u914D\u7F6E\u9879\uFF0C\u672A\u751F\u6210\u53EF\u7528\u5907\u4EFD\u76EE\u5F55\u3002"));
7734
8339
  } else {
7735
8340
  for (const item of successBackups) {
7736
- console.log(chalk54.gray(` ${item.name}: ${item.backupDir}`));
8341
+ console.log(chalk56.gray(` ${item.name}: ${item.backupDir}`));
7737
8342
  if (item.backupFiles.length === 0) {
7738
- console.log(chalk54.gray(" - \u65E0\u5386\u53F2\u6587\u4EF6\u53EF\u5907\u4EFD"));
8343
+ console.log(chalk56.gray(" - \u65E0\u5386\u53F2\u6587\u4EF6\u53EF\u5907\u4EFD"));
7739
8344
  } else {
7740
8345
  for (const file of item.backupFiles) {
7741
- console.log(chalk54.gray(` - ${file}`));
8346
+ console.log(chalk56.gray(` - ${file}`));
7742
8347
  }
7743
8348
  }
7744
8349
  }
7745
8350
  }
7746
- console.log(chalk54.gray("\u63D0\u793A\uFF1A\u8BF7\u91CD\u542F\u5BF9\u5E94\u5DE5\u5177/\u63D2\u4EF6\u4EE5\u4F7F\u914D\u7F6E\u751F\u6548\u3002"));
8351
+ console.log(chalk56.gray("\u63D0\u793A\uFF1A\u8BF7\u91CD\u542F\u5BF9\u5E94\u5DE5\u5177/\u63D2\u4EF6\u4EE5\u4F7F\u914D\u7F6E\u751F\u6548\u3002"));
7747
8352
  }
7748
8353
  async function gmnCommand(apiKey, platformArg, providerNameArg, baseUrlArg) {
7749
8354
  await runGmnCommand(GMN_PROFILE, apiKey, platformArg, providerNameArg, baseUrlArg);
@@ -7755,12 +8360,12 @@ async function gmn1Command(apiKey, platformArg, providerNameArg, baseUrlArg) {
7755
8360
  // src/index.ts
7756
8361
  init_dist2();
7757
8362
  if (process.env.NODE_ENV === "development") {
7758
- console.log(chalk55.gray("\n[\u5F00\u53D1\u6A21\u5F0F] \u914D\u7F6E\u76EE\u5F55:"));
7759
- console.log(chalk55.gray(` ccman: ${getCcmanDir()}`));
7760
- console.log(chalk55.gray(` codex: ${getCodexDir()}`));
7761
- console.log(chalk55.gray(` claude: ${getClaudeDir()}`));
7762
- console.log(chalk55.gray(` opencode: ${getOpenCodeDir()}`));
7763
- console.log(chalk55.gray(` openclaw: ${getOpenClawDir()}`));
8363
+ console.log(chalk57.gray("\n[\u5F00\u53D1\u6A21\u5F0F] \u914D\u7F6E\u76EE\u5F55:"));
8364
+ console.log(chalk57.gray(` ccman: ${getCcmanDir()}`));
8365
+ console.log(chalk57.gray(` codex: ${getCodexDir()}`));
8366
+ console.log(chalk57.gray(` claude: ${getClaudeDir()}`));
8367
+ console.log(chalk57.gray(` opencode: ${getOpenCodeDir()}`));
8368
+ console.log(chalk57.gray(` openclaw: ${getOpenClawDir()}`));
7764
8369
  console.log();
7765
8370
  }
7766
8371
  var program = new Command3();
@@ -7772,7 +8377,7 @@ program.name("ccman").description("Codex/Claude Code/Gemini/OpenCode/OpenClaw AP
7772
8377
  });
7773
8378
  program.on("command:*", (operands) => {
7774
8379
  const unknownCommand = operands[0];
7775
- console.error(chalk55.red(`
8380
+ console.error(chalk57.red(`
7776
8381
  \u274C \u672A\u77E5\u547D\u4EE4: ${unknownCommand}
7777
8382
  `));
7778
8383
  const availableCommands = [
@@ -7794,13 +8399,13 @@ program.on("command:*", (operands) => {
7794
8399
  (cmd) => cmd.includes(unknownCommand) || unknownCommand.includes(cmd)
7795
8400
  );
7796
8401
  if (suggestions.length > 0) {
7797
- console.log(chalk55.yellow("\u{1F4A1} \u4F60\u662F\u4E0D\u662F\u60F3\u8F93\u5165:"));
8402
+ console.log(chalk57.yellow("\u{1F4A1} \u4F60\u662F\u4E0D\u662F\u60F3\u8F93\u5165:"));
7798
8403
  suggestions.forEach((cmd) => {
7799
- console.log(chalk55.cyan(` ccman ${cmd}`));
8404
+ console.log(chalk57.cyan(` ccman ${cmd}`));
7800
8405
  });
7801
8406
  console.log();
7802
8407
  }
7803
- console.log(chalk55.gray("\u67E5\u770B\u6240\u6709\u53EF\u7528\u547D\u4EE4: ") + chalk55.cyan("ccman --help"));
8408
+ console.log(chalk57.gray("\u67E5\u770B\u6240\u6709\u53EF\u7528\u547D\u4EE4: ") + chalk57.cyan("ccman --help"));
7804
8409
  console.log();
7805
8410
  process.exit(1);
7806
8411
  });
@@ -7850,7 +8455,7 @@ importCommand(program);
7850
8455
  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) => {
7851
8456
  await gmnCommand(apiKey, options.platform, options.name, options.baseUrl);
7852
8457
  });
7853
- 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: 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) => {
8458
+ 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) => {
7854
8459
  await gmn1Command(apiKey, options.platform, options.name, options.baseUrl);
7855
8460
  });
7856
8461
  (async () => {