ccman 3.3.25 → 3.3.29

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)) {
@@ -338,7 +354,7 @@ function writeCodexConfigOverwrite(provider) {
338
354
  removeDeprecatedKeys(nextConfig);
339
355
  const providerKey = resolveCodexProviderKey(provider);
340
356
  nextConfig.model_provider = providerKey;
341
- nextConfig.model = provider.model || nextConfig.model || "gpt-5.4";
357
+ nextConfig.model = provider.model || nextConfig.model || "gpt-5.5";
342
358
  nextConfig.model_providers = {
343
359
  [providerKey]: buildManagedProvider(provider, providerKey)
344
360
  };
@@ -356,7 +372,7 @@ function writeCodexConfigMerge(provider) {
356
372
  const providerKey = resolveCodexProviderKey(provider);
357
373
  removeDeprecatedKeys(nextConfig);
358
374
  nextConfig.model_provider = providerKey;
359
- nextConfig.model = provider.model || nextConfig.model || "gpt-5.4";
375
+ nextConfig.model = provider.model || nextConfig.model || "gpt-5.5";
360
376
  const existingProviders = nextConfig.model_providers && typeof nextConfig.model_providers === "object" && !Array.isArray(nextConfig.model_providers) ? { ...nextConfig.model_providers } : {};
361
377
  const lowerProviderKey = providerKey.toLowerCase();
362
378
  for (const key of Object.keys(existingProviders)) {
@@ -401,8 +417,13 @@ var init_codex = __esm({
401
417
  __filename = fileURLToPath2(import.meta.url);
402
418
  __dirname = path3.dirname(__filename);
403
419
  CODEX_DEFAULT_CONFIG = {
404
- model: "gpt-5.4",
420
+ model: "gpt-5.5",
421
+ review_model: "gpt-5.5",
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",
@@ -524,6 +546,7 @@ var init_claude = __esm({
524
546
  __filename2 = fileURLToPath3(import.meta.url);
525
547
  __dirname2 = path4.dirname(__filename2);
526
548
  CLAUDE_CONFIG_TEMPLATE = {
549
+ model: "sonnet",
527
550
  env: {
528
551
  ANTHROPIC_AUTH_TOKEN: "{{apiKey}}",
529
552
  ANTHROPIC_BASE_URL: "{{baseUrl}}",
@@ -704,7 +727,7 @@ function createDualGmnPresets(transformBaseUrl = (baseUrl) => baseUrl) {
704
727
  {
705
728
  name: "GMN",
706
729
  baseUrl: transformBaseUrl(GMN_ROOT_URL),
707
- description: "GMN \u4E3B\u57DF\u540D\u7EBF\u8DEF (gmn.chuangzuoli.com)"
730
+ description: "GMN \u4E3B\u57DF\u540D\u7EBF\u8DEF (ai.gmncode.com)"
708
731
  },
709
732
  {
710
733
  name: "GMN1",
@@ -717,7 +740,7 @@ var GMN_ROOT_URL, GMN1_ROOT_URL;
717
740
  var init_gmn = __esm({
718
741
  "../core/dist/presets/gmn.js"() {
719
742
  "use strict";
720
- GMN_ROOT_URL = "https://gmn.chuangzuoli.com";
743
+ GMN_ROOT_URL = "https://ai.gmncode.com";
721
744
  GMN1_ROOT_URL = "https://gmncode.cn";
722
745
  }
723
746
  });
@@ -990,12 +1013,16 @@ function writeGeminiConfig(provider, options = {}) {
990
1013
  ...existingEnv,
991
1014
  ...templateEnv
992
1015
  };
1016
+ const existingGeminiModel = existingEnv.GEMINI_MODEL;
993
1017
  if (!templateEnv.GOOGLE_GEMINI_BASE_URL) {
994
1018
  delete env.GOOGLE_GEMINI_BASE_URL;
995
1019
  }
996
1020
  if (!templateEnv.GEMINI_API_KEY) {
997
1021
  delete env.GEMINI_API_KEY;
998
1022
  }
1023
+ if (options.mode !== "overwrite" && existingGeminiModel) {
1024
+ env.GEMINI_MODEL = existingGeminiModel;
1025
+ }
999
1026
  let modelMeta = null;
1000
1027
  if (provider.model && provider.model.trim().length > 0) {
1001
1028
  try {
@@ -1015,7 +1042,7 @@ function writeGeminiConfig(provider, options = {}) {
1015
1042
  }
1016
1043
  }
1017
1044
  }
1018
- if (!env.GEMINI_MODEL && modelMeta.defaultModel) {
1045
+ if (modelMeta.defaultModel && (!existingGeminiModel || options.mode === "overwrite")) {
1019
1046
  env.GEMINI_MODEL = modelMeta.defaultModel;
1020
1047
  }
1021
1048
  }
@@ -1043,7 +1070,8 @@ var init_gemini2 = __esm({
1043
1070
  GEMINI_ENV_TEMPLATE = [
1044
1071
  "# Managed by ccman",
1045
1072
  "GOOGLE_GEMINI_BASE_URL={{baseUrl}}",
1046
- "GEMINI_API_KEY={{apiKey}}"
1073
+ "GEMINI_API_KEY={{apiKey}}",
1074
+ "GEMINI_MODEL=gemini-3.5-flash"
1047
1075
  ].join("\n");
1048
1076
  }
1049
1077
  });
@@ -1123,17 +1151,6 @@ function enforceModelStoreFalse(models) {
1123
1151
  high: {},
1124
1152
  xhigh: {}
1125
1153
  }
1126
- },
1127
- [OPENCODE_SECONDARY_MODEL_KEY]: {
1128
- options: {
1129
- store: false
1130
- },
1131
- variants: {
1132
- low: {},
1133
- medium: {},
1134
- high: {},
1135
- xhigh: {}
1136
- }
1137
1154
  }
1138
1155
  });
1139
1156
  }
@@ -1173,7 +1190,7 @@ function writeOpenCodeConfig(provider, options = {}) {
1173
1190
  };
1174
1191
  writeJSON(configPath, nextConfig);
1175
1192
  }
1176
- var OPENCODE_SCHEMA, OPENCODE_PROVIDER_KEY, OPENCODE_MODEL, OPENCODE_MODEL_KEY, OPENCODE_SECONDARY_MODEL_KEY, __filename4, __dirname4, DEFAULT_MODELS, OPENCODE_CONFIG_TEMPLATE;
1193
+ var OPENCODE_SCHEMA, OPENCODE_PROVIDER_KEY, OPENCODE_MODEL, OPENCODE_MODEL_KEY, __filename4, __dirname4, DEFAULT_MODELS, OPENCODE_CONFIG_TEMPLATE;
1177
1194
  var init_opencode2 = __esm({
1178
1195
  "../core/dist/writers/opencode.js"() {
1179
1196
  "use strict";
@@ -1182,26 +1199,13 @@ var init_opencode2 = __esm({
1182
1199
  init_template();
1183
1200
  OPENCODE_SCHEMA = "https://opencode.ai/config.json";
1184
1201
  OPENCODE_PROVIDER_KEY = "openai";
1185
- OPENCODE_MODEL = "openai/gpt-5.4";
1186
- OPENCODE_MODEL_KEY = "gpt-5.4";
1187
- OPENCODE_SECONDARY_MODEL_KEY = "gpt-5.3-codex";
1202
+ OPENCODE_MODEL = "openai/gpt-5.5";
1203
+ OPENCODE_MODEL_KEY = "gpt-5.5";
1188
1204
  __filename4 = fileURLToPath5(import.meta.url);
1189
1205
  __dirname4 = path7.dirname(__filename4);
1190
1206
  DEFAULT_MODELS = {
1191
1207
  [OPENCODE_MODEL_KEY]: {
1192
- name: "GPT-5.4",
1193
- options: {
1194
- store: false
1195
- },
1196
- variants: {
1197
- low: {},
1198
- medium: {},
1199
- high: {},
1200
- xhigh: {}
1201
- }
1202
- },
1203
- [OPENCODE_SECONDARY_MODEL_KEY]: {
1204
- name: "GPT-5.3 Codex",
1208
+ name: "GPT-5.5",
1205
1209
  options: {
1206
1210
  store: false
1207
1211
  },
@@ -1354,10 +1358,10 @@ function writeOpenClawConfig(provider, options = {}) {
1354
1358
  defaults: {
1355
1359
  ...nextOpenClawConfig.agents?.defaults || {},
1356
1360
  workspace: homeDir,
1357
- imageModel: nextOpenClawConfig.agents?.defaults?.imageModel || `${providerName}/gpt-5.4`,
1361
+ imageModel: nextOpenClawConfig.agents?.defaults?.imageModel || `${providerName}/gpt-5.5`,
1358
1362
  model: {
1359
1363
  ...nextOpenClawConfig.agents?.defaults?.model || {},
1360
- primary: nextOpenClawConfig.agents?.defaults?.model?.primary || `${providerName}/gpt-5.4`
1364
+ primary: nextOpenClawConfig.agents?.defaults?.model?.primary || `${providerName}/gpt-5.5`
1361
1365
  }
1362
1366
  }
1363
1367
  }
@@ -1375,8 +1379,8 @@ function writeOpenClawConfig(provider, options = {}) {
1375
1379
  const mergedAgents = deepMerge(nextOpenClawConfig.agents || {}, existingOpenClawConfig.agents || {});
1376
1380
  const mergedDefaults = mergedAgents.defaults || {};
1377
1381
  const mergedModel = mergedDefaults.model || {};
1378
- const templatePrimary = nextOpenClawConfig.agents?.defaults?.model?.primary || `${providerName}/gpt-5.4`;
1379
- const templateImageModel = nextOpenClawConfig.agents?.defaults?.imageModel || `${providerName}/gpt-5.4`;
1382
+ const templatePrimary = nextOpenClawConfig.agents?.defaults?.model?.primary || `${providerName}/gpt-5.5`;
1383
+ const templateImageModel = nextOpenClawConfig.agents?.defaults?.imageModel || `${providerName}/gpt-5.5`;
1380
1384
  const workspace = typeof mergedDefaults.workspace === "string" && mergedDefaults.workspace.trim() ? mergedDefaults.workspace : homeDir;
1381
1385
  const finalOpenClawConfig = {
1382
1386
  ...existingOpenClawConfig,
@@ -1403,7 +1407,7 @@ function writeOpenClawConfig(provider, options = {}) {
1403
1407
  writeJSON(configPath, finalOpenClawConfig);
1404
1408
  writeJSON(modelsPath, finalModelsConfig);
1405
1409
  }
1406
- var DEFAULT_PROVIDER_NAME, PRIMARY_MODEL_ID, SECONDARY_MODEL_ID, PRIMARY_MODEL_INPUTS, SECONDARY_MODEL_INPUTS, __filename5, __dirname5, OPENCLAW_CONFIG_TEMPLATE, OPENCLAW_MODELS_TEMPLATE;
1410
+ var DEFAULT_PROVIDER_NAME, PRIMARY_MODEL_ID, PRIMARY_MODEL_INPUTS, __filename5, __dirname5, OPENCLAW_CONFIG_TEMPLATE, OPENCLAW_MODELS_TEMPLATE;
1407
1411
  var init_openclaw2 = __esm({
1408
1412
  "../core/dist/writers/openclaw.js"() {
1409
1413
  "use strict";
@@ -1411,10 +1415,8 @@ var init_openclaw2 = __esm({
1411
1415
  init_file();
1412
1416
  init_template();
1413
1417
  DEFAULT_PROVIDER_NAME = "gmn";
1414
- PRIMARY_MODEL_ID = "gpt-5.4";
1415
- SECONDARY_MODEL_ID = "gpt-5.3-codex";
1418
+ PRIMARY_MODEL_ID = "gpt-5.5";
1416
1419
  PRIMARY_MODEL_INPUTS = ["text", "image"];
1417
- SECONDARY_MODEL_INPUTS = ["text", "image"];
1418
1420
  __filename5 = fileURLToPath6(import.meta.url);
1419
1421
  __dirname5 = path8.dirname(__filename5);
1420
1422
  OPENCLAW_CONFIG_TEMPLATE = {
@@ -1432,24 +1434,14 @@ var init_openclaw2 = __esm({
1432
1434
  authHeader: true,
1433
1435
  models: [
1434
1436
  {
1435
- id: "gpt-5.4",
1436
- name: "gpt-5.4",
1437
+ id: "gpt-5.5",
1438
+ name: "gpt-5.5",
1437
1439
  api: "openai-responses",
1438
1440
  reasoning: true,
1439
1441
  input: PRIMARY_MODEL_INPUTS,
1440
1442
  cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
1441
1443
  contextWindow: 105e4,
1442
1444
  maxTokens: 128e3
1443
- },
1444
- {
1445
- id: SECONDARY_MODEL_ID,
1446
- name: SECONDARY_MODEL_ID,
1447
- api: "openai-responses",
1448
- reasoning: false,
1449
- input: SECONDARY_MODEL_INPUTS,
1450
- cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
1451
- contextWindow: 4e5,
1452
- maxTokens: 128e3
1453
1445
  }
1454
1446
  ]
1455
1447
  }
@@ -1458,9 +1450,9 @@ var init_openclaw2 = __esm({
1458
1450
  agents: {
1459
1451
  defaults: {
1460
1452
  workspace: "",
1461
- imageModel: "{{providerName}}/gpt-5.4",
1453
+ imageModel: "{{providerName}}/gpt-5.5",
1462
1454
  model: {
1463
- primary: "{{providerName}}/gpt-5.4"
1455
+ primary: "{{providerName}}/gpt-5.5"
1464
1456
  },
1465
1457
  thinkingDefault: "xhigh"
1466
1458
  }
@@ -1479,24 +1471,14 @@ var init_openclaw2 = __esm({
1479
1471
  },
1480
1472
  models: [
1481
1473
  {
1482
- id: "gpt-5.4",
1483
- name: "gpt-5.4",
1474
+ id: "gpt-5.5",
1475
+ name: "gpt-5.5",
1484
1476
  api: "openai-responses",
1485
1477
  reasoning: true,
1486
1478
  input: PRIMARY_MODEL_INPUTS,
1487
1479
  cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
1488
1480
  contextWindow: 105e4,
1489
1481
  maxTokens: 128e3
1490
- },
1491
- {
1492
- id: SECONDARY_MODEL_ID,
1493
- name: SECONDARY_MODEL_ID,
1494
- api: "openai-responses",
1495
- reasoning: false,
1496
- input: SECONDARY_MODEL_INPUTS,
1497
- cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
1498
- contextWindow: 4e5,
1499
- maxTokens: 128e3
1500
1482
  }
1501
1483
  ]
1502
1484
  }
@@ -3007,23 +2989,303 @@ var init_sync_config = __esm({
3007
2989
  }
3008
2990
  });
3009
2991
 
2992
+ // src/commands/sync/helpers.ts
2993
+ import chalk5 from "chalk";
2994
+ import { Command, Option } from "commander";
2995
+ import inquirer2 from "inquirer";
2996
+ function normalizeText(value) {
2997
+ if (value === void 0) {
2998
+ return void 0;
2999
+ }
3000
+ const trimmed = value.trim();
3001
+ return trimmed ? trimmed : void 0;
3002
+ }
3003
+ function resolveTextOption(cliValue, envKey, env) {
3004
+ return normalizeText(cliValue) ?? normalizeText(env[envKey]);
3005
+ }
3006
+ function resolveAuthType(cliValue, env) {
3007
+ const value = resolveTextOption(cliValue, SYNC_ENV_KEYS.authType, env);
3008
+ if (!value) {
3009
+ return void 0;
3010
+ }
3011
+ if (value === "password" || value === "digest") {
3012
+ return value;
3013
+ }
3014
+ throw new Error(`\u65E0\u6548\u7684\u8BA4\u8BC1\u7C7B\u578B: ${value}\uFF0C\u4EC5\u652F\u6301 password \u6216 digest`);
3015
+ }
3016
+ function hasSyncEnvInput(env) {
3017
+ return Object.values(SYNC_ENV_KEYS).some((key) => normalizeText(env[key]));
3018
+ }
3019
+ function formatMissingFields(fields) {
3020
+ const labels = {
3021
+ webdavUrl: "--webdav-url",
3022
+ username: "--username",
3023
+ password: "--password",
3024
+ authType: "--auth-type",
3025
+ remoteDir: "--remote-dir",
3026
+ syncPassword: "--sync-password"
3027
+ };
3028
+ return fields.map((field) => labels[field] || field).join(", ");
3029
+ }
3030
+ function addSyncConnectionOptions(command, options = {}) {
3031
+ 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(
3032
+ new Option(
3033
+ "--auth-type <type>",
3034
+ `\u8BA4\u8BC1\u7C7B\u578B\uFF08password|digest\uFF0C\u6216\u73AF\u5883\u53D8\u91CF ${SYNC_ENV_KEYS.authType}\uFF09`
3035
+ ).choices(["password", "digest"])
3036
+ ).option("--remote-dir <dir>", `\u8FDC\u7A0B\u540C\u6B65\u76EE\u5F55\uFF08\u6216\u73AF\u5883\u53D8\u91CF ${SYNC_ENV_KEYS.remoteDir}\uFF09`);
3037
+ if (options.includeSyncPassword) {
3038
+ command.option(
3039
+ "--sync-password <password>",
3040
+ `\u540C\u6B65\u5BC6\u7801\uFF08\u6216\u73AF\u5883\u53D8\u91CF ${SYNC_ENV_KEYS.syncPassword}\uFF09`
3041
+ );
3042
+ }
3043
+ if (options.includeConfirm) {
3044
+ command.option("-y, --yes", "\u8DF3\u8FC7\u786E\u8BA4\u63D0\u793A");
3045
+ }
3046
+ if (options.includeRememberFlags) {
3047
+ 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");
3048
+ }
3049
+ if (options.includeTestFlag) {
3050
+ command.option("--test", "\u4FDD\u5B58\u540E\u7ACB\u5373\u6D4B\u8BD5\u8FDE\u63A5");
3051
+ }
3052
+ }
3053
+ function collectSyncCommandInput(options = {}, env = process.env) {
3054
+ if (options.rememberSyncPassword && options.forgetSyncPassword) {
3055
+ throw new Error("\u4E0D\u80FD\u540C\u65F6\u4F7F\u7528 --remember-sync-password \u548C --forget-sync-password");
3056
+ }
3057
+ const overrides = {
3058
+ webdavUrl: resolveTextOption(options.webdavUrl, SYNC_ENV_KEYS.webdavUrl, env),
3059
+ username: resolveTextOption(options.username, SYNC_ENV_KEYS.username, env),
3060
+ password: resolveTextOption(options.password, SYNC_ENV_KEYS.password, env),
3061
+ authType: resolveAuthType(options.authType, env),
3062
+ remoteDir: resolveTextOption(options.remoteDir, SYNC_ENV_KEYS.remoteDir, env),
3063
+ syncPassword: resolveTextOption(options.syncPassword, SYNC_ENV_KEYS.syncPassword, env)
3064
+ };
3065
+ const rememberSyncPassword = options.rememberSyncPassword ? true : options.forgetSyncPassword ? false : void 0;
3066
+ const nonInteractive = options.yes === true || rememberSyncPassword !== void 0 || hasSyncEnvInput(env) || Object.values(overrides).some((value) => value !== void 0);
3067
+ return {
3068
+ overrides,
3069
+ rememberSyncPassword,
3070
+ yes: options.yes === true,
3071
+ shouldTest: options.test === true,
3072
+ nonInteractive
3073
+ };
3074
+ }
3075
+ function mergeSyncConfig(baseConfig, overrides) {
3076
+ return {
3077
+ ...baseConfig || {},
3078
+ ...Object.fromEntries(Object.entries(overrides).filter(([, value]) => value !== void 0))
3079
+ };
3080
+ }
3081
+ function getMissingConnectionFields(config) {
3082
+ return REQUIRED_CONNECTION_FIELDS.filter((field) => !normalizeText(config[field]));
3083
+ }
3084
+ function buildRuntimeSyncConfig(existingConfig, input) {
3085
+ return mergeSyncConfig(existingConfig, input.overrides);
3086
+ }
3087
+ function assertCompleteSyncConfig(config) {
3088
+ const missingFields = getMissingConnectionFields(config);
3089
+ if (missingFields.length > 0) {
3090
+ throw new Error(`\u7F3A\u5C11\u540C\u6B65\u914D\u7F6E\u53C2\u6570: ${formatMissingFields(missingFields)}`);
3091
+ }
3092
+ }
3093
+ async function ensureConfigExists(options = {}) {
3094
+ const existingConfig = loadSyncConfig();
3095
+ const input = collectSyncCommandInput(options);
3096
+ const mergedConfig = buildRuntimeSyncConfig(existingConfig, input);
3097
+ if (getMissingConnectionFields(mergedConfig).length === 0) {
3098
+ assertCompleteSyncConfig(mergedConfig);
3099
+ return mergedConfig;
3100
+ }
3101
+ if (input.nonInteractive) {
3102
+ assertCompleteSyncConfig(mergedConfig);
3103
+ }
3104
+ console.log(chalk5.yellow("\n\u26A0\uFE0F \u672A\u627E\u5230 WebDAV \u914D\u7F6E\n"));
3105
+ const shouldConfig = await promptConfirm("\u662F\u5426\u73B0\u5728\u914D\u7F6E WebDAV?", true);
3106
+ if (!shouldConfig) {
3107
+ return null;
3108
+ }
3109
+ const { configCommand: configCommand2 } = await Promise.resolve().then(() => (init_config2(), config_exports));
3110
+ const cmd = new Command();
3111
+ configCommand2(cmd);
3112
+ await cmd.parseAsync(["node", "ccman", "config"]);
3113
+ return loadSyncConfig();
3114
+ }
3115
+ async function resolveSyncPassword(config, options = {}) {
3116
+ const input = collectSyncCommandInput(options);
3117
+ const syncPassword = normalizeText(input.overrides.syncPassword) || normalizeText(config.syncPassword);
3118
+ if (syncPassword) {
3119
+ return syncPassword;
3120
+ }
3121
+ if (input.nonInteractive) {
3122
+ throw new Error(`\u7F3A\u5C11\u540C\u6B65\u5BC6\u7801: ${formatMissingFields(["syncPassword"])}`);
3123
+ }
3124
+ const { password } = await inquirer2.prompt([
3125
+ {
3126
+ type: "password",
3127
+ name: "password",
3128
+ message: "\u8BF7\u8F93\u5165\u540C\u6B65\u5BC6\u7801:",
3129
+ mask: "*",
3130
+ validate: (value) => value ? true : "\u540C\u6B65\u5BC6\u7801\u4E0D\u80FD\u4E3A\u7A7A"
3131
+ }
3132
+ ]);
3133
+ return password;
3134
+ }
3135
+ async function confirmOrExit(message, defaultValue, options = {}) {
3136
+ const input = collectSyncCommandInput(options);
3137
+ if (input.yes) {
3138
+ return true;
3139
+ }
3140
+ if (input.nonInteractive) {
3141
+ throw new Error(`\u975E\u4EA4\u4E92\u6A21\u5F0F\u8BF7\u901A\u8FC7 --yes \u786E\u8BA4\u64CD\u4F5C`);
3142
+ }
3143
+ return promptConfirm(message, defaultValue);
3144
+ }
3145
+ var SYNC_ENV_KEYS, REQUIRED_CONNECTION_FIELDS;
3146
+ var init_helpers = __esm({
3147
+ "src/commands/sync/helpers.ts"() {
3148
+ "use strict";
3149
+ init_sync_config();
3150
+ init_confirm();
3151
+ SYNC_ENV_KEYS = {
3152
+ webdavUrl: "CCMAN_WEBDAV_URL",
3153
+ username: "CCMAN_WEBDAV_USERNAME",
3154
+ password: "CCMAN_WEBDAV_PASSWORD",
3155
+ authType: "CCMAN_WEBDAV_AUTH_TYPE",
3156
+ remoteDir: "CCMAN_WEBDAV_REMOTE_DIR",
3157
+ syncPassword: "CCMAN_SYNC_PASSWORD"
3158
+ };
3159
+ REQUIRED_CONNECTION_FIELDS = ["webdavUrl", "username", "password"];
3160
+ }
3161
+ });
3162
+
3010
3163
  // src/commands/sync/config.ts
3011
3164
  var config_exports = {};
3012
3165
  __export(config_exports, {
3013
3166
  configCommand: () => configCommand
3014
3167
  });
3015
- import chalk3 from "chalk";
3016
- import inquirer2 from "inquirer";
3168
+ import chalk6 from "chalk";
3169
+ import inquirer3 from "inquirer";
3170
+ function validateWebdavUrl(url) {
3171
+ if (!url.startsWith("http://") && !url.startsWith("https://")) {
3172
+ throw new Error("WebDAV \u5730\u5740\u5FC5\u987B\u4EE5 http:// \u6216 https:// \u5F00\u5934");
3173
+ }
3174
+ }
3175
+ function hasConfigChanges(existingConfig, newConfig) {
3176
+ if (!existingConfig) {
3177
+ return true;
3178
+ }
3179
+ 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;
3180
+ }
3181
+ function buildConfigFromInput(existingConfig, input) {
3182
+ const nextConfig = existingConfig ? { ...existingConfig } : {
3183
+ webdavUrl: "",
3184
+ username: "",
3185
+ password: "",
3186
+ authType: "password",
3187
+ remoteDir: "/",
3188
+ syncPassword: void 0,
3189
+ rememberSyncPassword: true,
3190
+ lastSync: void 0
3191
+ };
3192
+ if (input.overrides.webdavUrl !== void 0) {
3193
+ nextConfig.webdavUrl = input.overrides.webdavUrl;
3194
+ }
3195
+ if (input.overrides.username !== void 0) {
3196
+ nextConfig.username = input.overrides.username;
3197
+ }
3198
+ if (input.overrides.password !== void 0) {
3199
+ nextConfig.password = input.overrides.password;
3200
+ }
3201
+ if (input.overrides.authType !== void 0) {
3202
+ nextConfig.authType = input.overrides.authType;
3203
+ }
3204
+ if (input.overrides.remoteDir !== void 0) {
3205
+ nextConfig.remoteDir = input.overrides.remoteDir;
3206
+ }
3207
+ if (input.overrides.syncPassword !== void 0) {
3208
+ nextConfig.syncPassword = input.overrides.syncPassword;
3209
+ }
3210
+ if (input.rememberSyncPassword !== void 0) {
3211
+ nextConfig.rememberSyncPassword = input.rememberSyncPassword;
3212
+ }
3213
+ nextConfig.authType = nextConfig.authType || "password";
3214
+ nextConfig.remoteDir = nextConfig.remoteDir || "/";
3215
+ nextConfig.rememberSyncPassword = nextConfig.rememberSyncPassword ?? true;
3216
+ const missingFields = getMissingConnectionFields(nextConfig);
3217
+ if (missingFields.length > 0) {
3218
+ throw new Error(
3219
+ `\u7F3A\u5C11\u540C\u6B65\u914D\u7F6E\u53C2\u6570: ${missingFields.map((field) => `--${field.replace(/[A-Z]/g, (m) => `-${m.toLowerCase()}`)}`).join(", ")}`
3220
+ );
3221
+ }
3222
+ validateWebdavUrl(nextConfig.webdavUrl);
3223
+ if (!existingConfig && !nextConfig.syncPassword) {
3224
+ throw new Error("\u7F3A\u5C11\u540C\u6B65\u914D\u7F6E\u53C2\u6570: --sync-password");
3225
+ }
3226
+ return nextConfig;
3227
+ }
3228
+ async function printConnectionTestResult(config) {
3229
+ console.log(chalk6.bold("\n\u{1F50D} \u6D4B\u8BD5 WebDAV \u8FDE\u63A5...\n"));
3230
+ const success = await testWebDAVConnection(config);
3231
+ if (success) {
3232
+ console.log(chalk6.green("\u2705 \u8FDE\u63A5\u6210\u529F"));
3233
+ console.log();
3234
+ console.log(" ", chalk6.gray("URL:"), config.webdavUrl);
3235
+ console.log(" ", chalk6.gray("\u7528\u6237:"), config.username);
3236
+ console.log(" ", chalk6.gray("\u8FDC\u7A0B\u76EE\u5F55:"), config.remoteDir || "/");
3237
+ console.log(
3238
+ " ",
3239
+ chalk6.gray("\u8BA4\u8BC1\u7C7B\u578B:"),
3240
+ config.authType === "password" ? "Basic Auth" : "Digest Auth"
3241
+ );
3242
+ console.log();
3243
+ return;
3244
+ }
3245
+ console.log(chalk6.red("\u274C \u8FDE\u63A5\u5931\u8D25"));
3246
+ console.log();
3247
+ console.log(chalk6.yellow("\u8BF7\u68C0\u67E5:"));
3248
+ console.log(" 1. WebDAV \u670D\u52A1\u5668\u5730\u5740\u662F\u5426\u6B63\u786E");
3249
+ console.log(" 2. \u7528\u6237\u540D\u548C\u5BC6\u7801\u662F\u5426\u6B63\u786E");
3250
+ console.log(" 3. \u7F51\u7EDC\u8FDE\u63A5\u662F\u5426\u6B63\u5E38");
3251
+ console.log();
3252
+ }
3017
3253
  function configCommand(program2) {
3018
- program2.command("config").description("\u914D\u7F6E WebDAV \u8FDE\u63A5").action(async () => {
3254
+ const command = program2.command("config").description("\u914D\u7F6E WebDAV \u8FDE\u63A5");
3255
+ addSyncConnectionOptions(command, {
3256
+ includeSyncPassword: true,
3257
+ includeRememberFlags: true,
3258
+ includeTestFlag: true
3259
+ });
3260
+ command.action(async (options) => {
3019
3261
  try {
3020
- console.log(chalk3.bold("\n\u2699\uFE0F \u914D\u7F6E WebDAV \u540C\u6B65\n"));
3262
+ console.log(chalk6.bold("\n\u2699\uFE0F \u914D\u7F6E WebDAV \u540C\u6B65\n"));
3021
3263
  const existingConfig = loadSyncConfig();
3264
+ const input = collectSyncCommandInput(options);
3265
+ if (input.nonInteractive) {
3266
+ const newConfig2 = buildConfigFromInput(existingConfig, input);
3267
+ if (!hasConfigChanges(existingConfig, newConfig2)) {
3268
+ console.log();
3269
+ console.log(chalk6.yellow("\u2139\uFE0F \u672A\u68C0\u6D4B\u5230\u914D\u7F6E\u53D8\u66F4\uFF0C\u4E0D\u9700\u8981\u66F4\u65B0"));
3270
+ console.log();
3271
+ return;
3272
+ }
3273
+ saveSyncConfig2(newConfig2);
3274
+ console.log();
3275
+ console.log(chalk6.green("\u2705 \u914D\u7F6E\u4FDD\u5B58\u6210\u529F"));
3276
+ console.log();
3277
+ console.log(chalk6.gray("\u914D\u7F6E\u6587\u4EF6:"), getSyncConfigPath());
3278
+ console.log();
3279
+ if (input.shouldTest) {
3280
+ await printConnectionTestResult(newConfig2);
3281
+ }
3282
+ return;
3283
+ }
3022
3284
  if (existingConfig) {
3023
- console.log(chalk3.blue("\u2139\uFE0F \u68C0\u6D4B\u5230\u5DF2\u6709\u914D\u7F6E\uFF0C\u53EF\u4EE5\u66F4\u65B0 WebDAV \u5B57\u6BB5"));
3024
- console.log(chalk3.gray(" \u7559\u7A7A\u8868\u793A\u4E0D\u66F4\u65B0\u8BE5\u5B57\u6BB5\n"));
3285
+ console.log(chalk6.blue("\u2139\uFE0F \u68C0\u6D4B\u5230\u5DF2\u6709\u914D\u7F6E\uFF0C\u53EF\u4EE5\u66F4\u65B0 WebDAV \u5B57\u6BB5"));
3286
+ console.log(chalk6.gray(" \u7559\u7A7A\u8868\u793A\u4E0D\u66F4\u65B0\u8BE5\u5B57\u6BB5\n"));
3025
3287
  }
3026
- const answers = await inquirer2.prompt([
3288
+ const answers = await inquirer3.prompt([
3027
3289
  {
3028
3290
  type: "input",
3029
3291
  name: "webdavUrl",
@@ -3094,7 +3356,7 @@ function configCommand(program2) {
3094
3356
  const hasSelectChange = trimmedAnswers.authType !== existingConfig.authType || trimmedAnswers.rememberSyncPassword !== existingConfig.rememberSyncPassword;
3095
3357
  if (!hasTextInput && !hasSelectChange) {
3096
3358
  console.log();
3097
- console.log(chalk3.yellow("\u2139\uFE0F \u672A\u68C0\u6D4B\u5230\u914D\u7F6E\u53D8\u66F4\uFF0C\u4E0D\u9700\u8981\u66F4\u65B0"));
3359
+ console.log(chalk6.yellow("\u2139\uFE0F \u672A\u68C0\u6D4B\u5230\u914D\u7F6E\u53D8\u66F4\uFF0C\u4E0D\u9700\u8981\u66F4\u65B0"));
3098
3360
  console.log();
3099
3361
  return;
3100
3362
  }
@@ -3159,40 +3421,22 @@ function configCommand(program2) {
3159
3421
  }
3160
3422
  if (!hasChanges && existingConfig) {
3161
3423
  console.log();
3162
- console.log(chalk3.yellow("\u2139\uFE0F \u672A\u68C0\u6D4B\u5230\u914D\u7F6E\u53D8\u66F4\uFF0C\u4E0D\u9700\u8981\u66F4\u65B0"));
3424
+ console.log(chalk6.yellow("\u2139\uFE0F \u672A\u68C0\u6D4B\u5230\u914D\u7F6E\u53D8\u66F4\uFF0C\u4E0D\u9700\u8981\u66F4\u65B0"));
3163
3425
  console.log();
3164
3426
  return;
3165
3427
  }
3166
3428
  saveSyncConfig2(newConfig);
3167
3429
  console.log();
3168
- console.log(chalk3.green("\u2705 \u914D\u7F6E\u4FDD\u5B58\u6210\u529F"));
3430
+ console.log(chalk6.green("\u2705 \u914D\u7F6E\u4FDD\u5B58\u6210\u529F"));
3169
3431
  console.log();
3170
- console.log(chalk3.gray("\u914D\u7F6E\u6587\u4EF6:"), getSyncConfigPath());
3432
+ console.log(chalk6.gray("\u914D\u7F6E\u6587\u4EF6:"), getSyncConfigPath());
3171
3433
  console.log();
3172
3434
  const testNow = await promptConfirm("\u662F\u5426\u7ACB\u5373\u6D4B\u8BD5\u8FDE\u63A5?", true);
3173
3435
  if (testNow) {
3174
- console.log(chalk3.bold("\n\u{1F50D} \u6D4B\u8BD5 WebDAV \u8FDE\u63A5...\n"));
3175
- const success = await testWebDAVConnection(newConfig);
3176
- if (success) {
3177
- console.log(chalk3.green("\u2705 \u8FDE\u63A5\u6210\u529F"));
3178
- console.log();
3179
- console.log(" ", chalk3.gray("URL:"), newConfig.webdavUrl);
3180
- console.log(" ", chalk3.gray("\u7528\u6237:"), newConfig.username);
3181
- console.log(" ", chalk3.gray("\u8FDC\u7A0B\u76EE\u5F55:"), newConfig.remoteDir || "/");
3182
- console.log(" ", chalk3.gray("\u8BA4\u8BC1\u7C7B\u578B:"), newConfig.authType === "password" ? "Basic Auth" : "Digest Auth");
3183
- console.log();
3184
- } else {
3185
- console.log(chalk3.red("\u274C \u8FDE\u63A5\u5931\u8D25"));
3186
- console.log();
3187
- console.log(chalk3.yellow("\u8BF7\u68C0\u67E5:"));
3188
- console.log(" 1. WebDAV \u670D\u52A1\u5668\u5730\u5740\u662F\u5426\u6B63\u786E");
3189
- console.log(" 2. \u7528\u6237\u540D\u548C\u5BC6\u7801\u662F\u5426\u6B63\u786E");
3190
- console.log(" 3. \u7F51\u7EDC\u8FDE\u63A5\u662F\u5426\u6B63\u5E38");
3191
- console.log();
3192
- }
3436
+ await printConnectionTestResult(newConfig);
3193
3437
  }
3194
3438
  } catch (error) {
3195
- console.error(chalk3.red(`
3439
+ console.error(chalk6.red(`
3196
3440
  \u274C ${error.message}
3197
3441
  `));
3198
3442
  }
@@ -3204,33 +3448,7 @@ var init_config2 = __esm({
3204
3448
  init_sync_config();
3205
3449
  init_dist2();
3206
3450
  init_confirm();
3207
- }
3208
- });
3209
-
3210
- // src/commands/sync/helpers.ts
3211
- import chalk4 from "chalk";
3212
- import { Command } from "commander";
3213
- async function ensureConfigExists() {
3214
- const config = loadSyncConfig();
3215
- if (config) {
3216
- return config;
3217
- }
3218
- console.log(chalk4.yellow("\n\u26A0\uFE0F \u672A\u627E\u5230 WebDAV \u914D\u7F6E\n"));
3219
- const shouldConfig = await promptConfirm("\u662F\u5426\u73B0\u5728\u914D\u7F6E WebDAV?", true);
3220
- if (!shouldConfig) {
3221
- return null;
3222
- }
3223
- const { configCommand: configCommand2 } = await Promise.resolve().then(() => (init_config2(), config_exports));
3224
- const cmd = new Command();
3225
- configCommand2(cmd);
3226
- await cmd.parseAsync(["node", "ccman", "config"]);
3227
- return loadSyncConfig();
3228
- }
3229
- var init_helpers = __esm({
3230
- "src/commands/sync/helpers.ts"() {
3231
- "use strict";
3232
- init_sync_config();
3233
- init_confirm();
3451
+ init_helpers();
3234
3452
  }
3235
3453
  });
3236
3454
 
@@ -3239,36 +3457,42 @@ var test_exports = {};
3239
3457
  __export(test_exports, {
3240
3458
  testCommand: () => testCommand
3241
3459
  });
3242
- import chalk5 from "chalk";
3460
+ import chalk7 from "chalk";
3243
3461
  function testCommand(program2) {
3244
- program2.command("test").description("\u6D4B\u8BD5 WebDAV \u8FDE\u63A5").action(async () => {
3462
+ const command = program2.command("test").description("\u6D4B\u8BD5 WebDAV \u8FDE\u63A5");
3463
+ addSyncConnectionOptions(command);
3464
+ command.action(async (options) => {
3245
3465
  try {
3246
- const config = await ensureConfigExists();
3466
+ const config = await ensureConfigExists(options);
3247
3467
  if (!config) {
3248
- console.log(chalk5.gray("\n\u5DF2\u53D6\u6D88\n"));
3468
+ console.log(chalk7.gray("\n\u5DF2\u53D6\u6D88\n"));
3249
3469
  return;
3250
3470
  }
3251
- console.log(chalk5.bold("\n\u{1F50D} \u6D4B\u8BD5 WebDAV \u8FDE\u63A5...\n"));
3471
+ console.log(chalk7.bold("\n\u{1F50D} \u6D4B\u8BD5 WebDAV \u8FDE\u63A5...\n"));
3252
3472
  const success = await testWebDAVConnection(config);
3253
3473
  if (success) {
3254
- console.log(chalk5.green("\u2705 \u8FDE\u63A5\u6210\u529F"));
3474
+ console.log(chalk7.green("\u2705 \u8FDE\u63A5\u6210\u529F"));
3255
3475
  console.log();
3256
- console.log(" ", chalk5.gray("URL:"), config.webdavUrl);
3257
- console.log(" ", chalk5.gray("\u7528\u6237:"), config.username);
3258
- console.log(" ", chalk5.gray("\u8FDC\u7A0B\u76EE\u5F55:"), config.remoteDir);
3259
- console.log(" ", chalk5.gray("\u8BA4\u8BC1\u7C7B\u578B:"), config.authType === "password" ? "Basic Auth" : "Digest Auth");
3476
+ console.log(" ", chalk7.gray("URL:"), config.webdavUrl);
3477
+ console.log(" ", chalk7.gray("\u7528\u6237:"), config.username);
3478
+ console.log(" ", chalk7.gray("\u8FDC\u7A0B\u76EE\u5F55:"), config.remoteDir || "/");
3479
+ console.log(
3480
+ " ",
3481
+ chalk7.gray("\u8BA4\u8BC1\u7C7B\u578B:"),
3482
+ config.authType === "password" ? "Basic Auth" : "Digest Auth"
3483
+ );
3260
3484
  console.log();
3261
3485
  } else {
3262
- console.log(chalk5.red("\u274C \u8FDE\u63A5\u5931\u8D25"));
3486
+ console.log(chalk7.red("\u274C \u8FDE\u63A5\u5931\u8D25"));
3263
3487
  console.log();
3264
- console.log(chalk5.yellow("\u8BF7\u68C0\u67E5:"));
3488
+ console.log(chalk7.yellow("\u8BF7\u68C0\u67E5:"));
3265
3489
  console.log(" 1. WebDAV \u670D\u52A1\u5668\u5730\u5740\u662F\u5426\u6B63\u786E");
3266
3490
  console.log(" 2. \u7528\u6237\u540D\u548C\u5BC6\u7801\u662F\u5426\u6B63\u786E");
3267
3491
  console.log(" 3. \u7F51\u7EDC\u8FDE\u63A5\u662F\u5426\u6B63\u5E38");
3268
3492
  console.log();
3269
3493
  }
3270
3494
  } catch (error) {
3271
- console.error(chalk5.red(`
3495
+ console.error(chalk7.red(`
3272
3496
  \u274C ${error.message}
3273
3497
  `));
3274
3498
  }
@@ -3287,29 +3511,21 @@ var upload_exports = {};
3287
3511
  __export(upload_exports, {
3288
3512
  uploadCommand: () => uploadCommand
3289
3513
  });
3290
- import chalk6 from "chalk";
3291
- import inquirer3 from "inquirer";
3514
+ import chalk8 from "chalk";
3292
3515
  function uploadCommand(program2) {
3293
- program2.command("upload").description("\u4E0A\u4F20\u672C\u5730\u914D\u7F6E\u5230\u4E91\u7AEF").action(async () => {
3516
+ const command = program2.command("upload").description("\u4E0A\u4F20\u672C\u5730\u914D\u7F6E\u5230\u4E91\u7AEF");
3517
+ addSyncConnectionOptions(command, {
3518
+ includeSyncPassword: true,
3519
+ includeConfirm: true
3520
+ });
3521
+ command.action(async (options) => {
3294
3522
  try {
3295
- const config = await ensureConfigExists();
3523
+ const config = await ensureConfigExists(options);
3296
3524
  if (!config) {
3297
- console.log(chalk6.gray("\n\u5DF2\u53D6\u6D88\n"));
3525
+ console.log(chalk8.gray("\n\u5DF2\u53D6\u6D88\n"));
3298
3526
  return;
3299
3527
  }
3300
- let syncPassword = config.syncPassword || "";
3301
- if (!syncPassword) {
3302
- const { password } = await inquirer3.prompt([
3303
- {
3304
- type: "password",
3305
- name: "password",
3306
- message: "\u8BF7\u8F93\u5165\u540C\u6B65\u5BC6\u7801:",
3307
- mask: "*",
3308
- validate: (value) => value ? true : "\u540C\u6B65\u5BC6\u7801\u4E0D\u80FD\u4E3A\u7A7A"
3309
- }
3310
- ]);
3311
- syncPassword = password;
3312
- }
3528
+ const syncPassword = await resolveSyncPassword(config, options);
3313
3529
  const codexManager = createCodexManager();
3314
3530
  const claudeManager = createClaudeManager();
3315
3531
  const geminiManager = createGeminiManager();
@@ -3318,36 +3534,37 @@ function uploadCommand(program2) {
3318
3534
  const claudeProviders = claudeManager.list();
3319
3535
  const geminiProviders = geminiManager.list();
3320
3536
  const openclawProviders = openclawManager.list();
3321
- console.log(chalk6.bold("\n\u{1F4E4} \u4E0A\u4F20\u914D\u7F6E\u5230\u4E91\u7AEF\n"));
3537
+ console.log(chalk8.bold("\n\u{1F4E4} \u4E0A\u4F20\u914D\u7F6E\u5230\u4E91\u7AEF\n"));
3322
3538
  console.log("\u914D\u7F6E\u4FE1\u606F:");
3323
- console.log(` Codex \u670D\u52A1\u5546: ${chalk6.cyan(codexProviders.length)} \u4E2A`);
3324
- console.log(` Claude \u670D\u52A1\u5546: ${chalk6.cyan(claudeProviders.length)} \u4E2A`);
3325
- console.log(` Gemini \u670D\u52A1\u5546: ${chalk6.cyan(geminiProviders.length)} \u4E2A`);
3326
- console.log(` OpenClaw \u670D\u52A1\u5546: ${chalk6.cyan(openclawProviders.length)} \u4E2A`);
3539
+ console.log(` Codex \u670D\u52A1\u5546: ${chalk8.cyan(codexProviders.length)} \u4E2A`);
3540
+ console.log(` Claude \u670D\u52A1\u5546: ${chalk8.cyan(claudeProviders.length)} \u4E2A`);
3541
+ console.log(` Gemini \u670D\u52A1\u5546: ${chalk8.cyan(geminiProviders.length)} \u4E2A`);
3542
+ console.log(` OpenClaw \u670D\u52A1\u5546: ${chalk8.cyan(openclawProviders.length)} \u4E2A`);
3327
3543
  console.log();
3328
- console.log(chalk6.yellow("\u26A0\uFE0F \u4E91\u7AEF\u73B0\u6709\u914D\u7F6E\u5C06\u88AB\u8986\u76D6"));
3544
+ console.log(chalk8.yellow("\u26A0\uFE0F \u4E91\u7AEF\u73B0\u6709\u914D\u7F6E\u5C06\u88AB\u8986\u76D6"));
3329
3545
  console.log();
3330
- const confirm = await promptConfirm("\u786E\u8BA4\u4E0A\u4F20?", false);
3546
+ const confirm = await confirmOrExit("\u786E\u8BA4\u4E0A\u4F20?", false, options);
3331
3547
  if (!confirm) {
3332
- console.log(chalk6.gray("\n\u274C \u5DF2\u53D6\u6D88\n"));
3548
+ console.log(chalk8.gray("\n\u274C \u5DF2\u53D6\u6D88\n"));
3333
3549
  return;
3334
3550
  }
3335
3551
  console.log();
3336
- console.log(chalk6.gray("\u{1F510} \u52A0\u5BC6 API Key..."));
3337
- console.log(chalk6.gray("\u{1F4E4} \u4E0A\u4F20\u5230 WebDAV..."));
3552
+ console.log(chalk8.gray("\u{1F510} \u52A0\u5BC6 API Key..."));
3553
+ console.log(chalk8.gray("\u{1F4E4} \u4E0A\u4F20\u5230 WebDAV..."));
3338
3554
  await uploadToCloud(config, syncPassword);
3339
3555
  console.log();
3340
- console.log(chalk6.green("\u2705 \u4E0A\u4F20\u6210\u529F"));
3556
+ console.log(chalk8.green("\u2705 \u4E0A\u4F20\u6210\u529F"));
3341
3557
  console.log();
3342
- console.log(chalk6.gray("\u8FDC\u7A0B\u6587\u4EF6:"));
3343
- console.log(chalk6.gray(` ${config.webdavUrl}${config.remoteDir}/.ccman/codex.json`));
3344
- console.log(chalk6.gray(` ${config.webdavUrl}${config.remoteDir}/.ccman/claude.json`));
3345
- console.log(chalk6.gray(` ${config.webdavUrl}${config.remoteDir}/.ccman/gemini.json`));
3346
- console.log(chalk6.gray(` ${config.webdavUrl}${config.remoteDir}/.ccman/openclaw.json`));
3558
+ const remoteDir = config.remoteDir || "/";
3559
+ console.log(chalk8.gray("\u8FDC\u7A0B\u6587\u4EF6:"));
3560
+ console.log(chalk8.gray(` ${config.webdavUrl}${remoteDir}/.ccman/codex.json`));
3561
+ console.log(chalk8.gray(` ${config.webdavUrl}${remoteDir}/.ccman/claude.json`));
3562
+ console.log(chalk8.gray(` ${config.webdavUrl}${remoteDir}/.ccman/gemini.json`));
3563
+ console.log(chalk8.gray(` ${config.webdavUrl}${remoteDir}/.ccman/openclaw.json`));
3347
3564
  console.log();
3348
- console.log(chalk6.blue("\u{1F4A1} \u5176\u4ED6\u8BBE\u5907\u53EF\u901A\u8FC7 'ccman sync download' \u83B7\u53D6\u914D\u7F6E\n"));
3565
+ console.log(chalk8.blue("\u{1F4A1} \u5176\u4ED6\u8BBE\u5907\u53EF\u901A\u8FC7 'ccman sync download' \u83B7\u53D6\u914D\u7F6E\n"));
3349
3566
  } catch (error) {
3350
- console.error(chalk6.red(`
3567
+ console.error(chalk8.red(`
3351
3568
  \u274C ${error.message}
3352
3569
  `));
3353
3570
  }
@@ -3358,7 +3575,6 @@ var init_upload = __esm({
3358
3575
  "use strict";
3359
3576
  init_dist2();
3360
3577
  init_helpers();
3361
- init_confirm();
3362
3578
  }
3363
3579
  });
3364
3580
 
@@ -3367,55 +3583,47 @@ var download_exports = {};
3367
3583
  __export(download_exports, {
3368
3584
  downloadCommand: () => downloadCommand
3369
3585
  });
3370
- import chalk7 from "chalk";
3371
- import inquirer4 from "inquirer";
3586
+ import chalk9 from "chalk";
3372
3587
  function downloadCommand(program2) {
3373
- program2.command("download").description("\u4ECE\u4E91\u7AEF\u4E0B\u8F7D\u914D\u7F6E\u5230\u672C\u5730").action(async () => {
3588
+ const command = program2.command("download").description("\u4ECE\u4E91\u7AEF\u4E0B\u8F7D\u914D\u7F6E\u5230\u672C\u5730");
3589
+ addSyncConnectionOptions(command, {
3590
+ includeSyncPassword: true,
3591
+ includeConfirm: true
3592
+ });
3593
+ command.action(async (options) => {
3374
3594
  try {
3375
- const config = await ensureConfigExists();
3595
+ const config = await ensureConfigExists(options);
3376
3596
  if (!config) {
3377
- console.log(chalk7.gray("\n\u5DF2\u53D6\u6D88\n"));
3597
+ console.log(chalk9.gray("\n\u5DF2\u53D6\u6D88\n"));
3378
3598
  return;
3379
3599
  }
3380
- let syncPassword = config.syncPassword || "";
3381
- if (!syncPassword) {
3382
- const { password } = await inquirer4.prompt([
3383
- {
3384
- type: "password",
3385
- name: "password",
3386
- message: "\u8BF7\u8F93\u5165\u540C\u6B65\u5BC6\u7801:",
3387
- mask: "*",
3388
- validate: (value) => value ? true : "\u540C\u6B65\u5BC6\u7801\u4E0D\u80FD\u4E3A\u7A7A"
3389
- }
3390
- ]);
3391
- syncPassword = password;
3392
- }
3393
- console.log(chalk7.bold("\n\u{1F4E5} \u4ECE\u4E91\u7AEF\u4E0B\u8F7D\u914D\u7F6E\n"));
3394
- console.log(chalk7.yellow("\u26A0\uFE0F \u5C06\u8986\u76D6\u672C\u5730\u914D\u7F6E\uFF08\u81EA\u52A8\u5907\u4EFD\uFF09"));
3600
+ const syncPassword = await resolveSyncPassword(config, options);
3601
+ console.log(chalk9.bold("\n\u{1F4E5} \u4ECE\u4E91\u7AEF\u4E0B\u8F7D\u914D\u7F6E\n"));
3602
+ console.log(chalk9.yellow("\u26A0\uFE0F \u5C06\u8986\u76D6\u672C\u5730\u914D\u7F6E\uFF08\u81EA\u52A8\u5907\u4EFD\uFF09"));
3395
3603
  console.log();
3396
- const confirm = await promptConfirm("\u786E\u8BA4\u4E0B\u8F7D?", false);
3604
+ const confirm = await confirmOrExit("\u786E\u8BA4\u4E0B\u8F7D?", false, options);
3397
3605
  if (!confirm) {
3398
- console.log(chalk7.gray("\n\u274C \u5DF2\u53D6\u6D88\n"));
3606
+ console.log(chalk9.gray("\n\u274C \u5DF2\u53D6\u6D88\n"));
3399
3607
  return;
3400
3608
  }
3401
3609
  console.log();
3402
- console.log(chalk7.gray("\u{1F4BE} \u5907\u4EFD\u672C\u5730\u914D\u7F6E..."));
3403
- console.log(chalk7.gray("\u{1F4E5} \u4E0B\u8F7D\u8FDC\u7A0B\u914D\u7F6E..."));
3404
- console.log(chalk7.gray("\u{1F513} \u89E3\u5BC6 API Key..."));
3610
+ console.log(chalk9.gray("\u{1F4BE} \u5907\u4EFD\u672C\u5730\u914D\u7F6E..."));
3611
+ console.log(chalk9.gray("\u{1F4E5} \u4E0B\u8F7D\u8FDC\u7A0B\u914D\u7F6E..."));
3612
+ console.log(chalk9.gray("\u{1F513} \u89E3\u5BC6 API Key..."));
3405
3613
  const backupPaths = await downloadFromCloud(config, syncPassword);
3406
3614
  console.log();
3407
- console.log(chalk7.green("\u2705 \u4E0B\u8F7D\u6210\u529F"));
3615
+ console.log(chalk9.green("\u2705 \u4E0B\u8F7D\u6210\u529F"));
3408
3616
  console.log();
3409
3617
  if (backupPaths.length > 0) {
3410
- console.log(chalk7.gray("\u672C\u5730\u5907\u4EFD:"));
3618
+ console.log(chalk9.gray("\u672C\u5730\u5907\u4EFD:"));
3411
3619
  backupPaths.forEach((path16) => {
3412
- console.log(chalk7.gray(` ${path16}`));
3620
+ console.log(chalk9.gray(` ${path16}`));
3413
3621
  });
3414
3622
  console.log();
3415
3623
  }
3416
- console.log(chalk7.blue("\u{1F4A1} \u914D\u7F6E\u5DF2\u66F4\u65B0\uFF0C\u91CD\u65B0\u52A0\u8F7D\u751F\u6548\n"));
3624
+ console.log(chalk9.blue("\u{1F4A1} \u914D\u7F6E\u5DF2\u66F4\u65B0\uFF0C\u91CD\u65B0\u52A0\u8F7D\u751F\u6548\n"));
3417
3625
  } catch (error) {
3418
- console.error(chalk7.red(`
3626
+ console.error(chalk9.red(`
3419
3627
  \u274C ${error.message}
3420
3628
  `));
3421
3629
  }
@@ -3426,7 +3634,6 @@ var init_download = __esm({
3426
3634
  "use strict";
3427
3635
  init_dist2();
3428
3636
  init_helpers();
3429
- init_confirm();
3430
3637
  }
3431
3638
  });
3432
3639
 
@@ -3435,54 +3642,45 @@ var merge_exports = {};
3435
3642
  __export(merge_exports, {
3436
3643
  mergeCommand: () => mergeCommand
3437
3644
  });
3438
- import chalk8 from "chalk";
3439
- import inquirer5 from "inquirer";
3645
+ import chalk10 from "chalk";
3440
3646
  function mergeCommand(program2) {
3441
- program2.command("merge").description("\u667A\u80FD\u5408\u5E76\u672C\u5730\u548C\u4E91\u7AEF\u914D\u7F6E").action(async () => {
3647
+ const command = program2.command("merge").description("\u667A\u80FD\u5408\u5E76\u672C\u5730\u548C\u4E91\u7AEF\u914D\u7F6E");
3648
+ addSyncConnectionOptions(command, {
3649
+ includeSyncPassword: true
3650
+ });
3651
+ command.action(async (options) => {
3442
3652
  try {
3443
- const config = await ensureConfigExists();
3653
+ const config = await ensureConfigExists(options);
3444
3654
  if (!config) {
3445
- console.log(chalk8.gray("\n\u5DF2\u53D6\u6D88\n"));
3655
+ console.log(chalk10.gray("\n\u5DF2\u53D6\u6D88\n"));
3446
3656
  return;
3447
3657
  }
3448
- let syncPassword = config.syncPassword || "";
3449
- if (!syncPassword) {
3450
- const { password } = await inquirer5.prompt([
3451
- {
3452
- type: "password",
3453
- name: "password",
3454
- message: "\u8BF7\u8F93\u5165\u540C\u6B65\u5BC6\u7801:",
3455
- mask: "*",
3456
- validate: (value) => value ? true : "\u540C\u6B65\u5BC6\u7801\u4E0D\u80FD\u4E3A\u7A7A"
3457
- }
3458
- ]);
3459
- syncPassword = password;
3460
- }
3461
- console.log(chalk8.bold("\n\u{1F504} \u667A\u80FD\u5408\u5E76\u914D\u7F6E\n"));
3462
- console.log(chalk8.gray("\u5206\u6790\u672C\u5730\u548C\u4E91\u7AEF\u914D\u7F6E..."));
3658
+ const syncPassword = await resolveSyncPassword(config, options);
3659
+ console.log(chalk10.bold("\n\u{1F504} \u667A\u80FD\u5408\u5E76\u914D\u7F6E\n"));
3660
+ console.log(chalk10.gray("\u5206\u6790\u672C\u5730\u548C\u4E91\u7AEF\u914D\u7F6E..."));
3463
3661
  const result = await mergeSync(config, syncPassword);
3464
3662
  if (!result.hasChanges) {
3465
3663
  console.log();
3466
- console.log(chalk8.blue("\u2139\uFE0F \u914D\u7F6E\u5DF2\u540C\u6B65\uFF0C\u65E0\u9700\u64CD\u4F5C\n"));
3664
+ console.log(chalk10.blue("\u2139\uFE0F \u914D\u7F6E\u5DF2\u540C\u6B65\uFF0C\u65E0\u9700\u64CD\u4F5C\n"));
3467
3665
  return;
3468
3666
  }
3469
3667
  console.log();
3470
- console.log(chalk8.green("\u2705 \u914D\u7F6E\u5DF2\u667A\u80FD\u5408\u5E76\u5E76\u540C\u6B65"));
3668
+ console.log(chalk10.green("\u2705 \u914D\u7F6E\u5DF2\u667A\u80FD\u5408\u5E76\u5E76\u540C\u6B65"));
3471
3669
  console.log();
3472
3670
  if (result.backupPaths.length > 0) {
3473
- console.log(chalk8.gray("\u5907\u4EFD:"));
3671
+ console.log(chalk10.gray("\u5907\u4EFD:"));
3474
3672
  result.backupPaths.forEach((path16) => {
3475
- console.log(chalk8.gray(` ${path16}`));
3673
+ console.log(chalk10.gray(` ${path16}`));
3476
3674
  });
3477
3675
  console.log();
3478
3676
  }
3479
- console.log(chalk8.blue("\u5408\u5E76\u89C4\u5219:"));
3480
- console.log(chalk8.gray(" \u2022 \u76F8\u540C ID\uFF1A\u4FDD\u7559\u6700\u65B0\u4FEE\u6539"));
3481
- console.log(chalk8.gray(" \u2022 \u76F8\u540C\u914D\u7F6E\uFF08URL+Key\uFF09\uFF1A\u4FDD\u7559\u6700\u65B0\u4FEE\u6539"));
3482
- console.log(chalk8.gray(" \u2022 \u4E0D\u540C\u914D\u7F6E\uFF1A\u5168\u90E8\u4FDD\u7559\uFF0C\u81EA\u52A8\u5904\u7406 name \u51B2\u7A81"));
3677
+ console.log(chalk10.blue("\u5408\u5E76\u89C4\u5219:"));
3678
+ console.log(chalk10.gray(" \u2022 \u76F8\u540C ID\uFF1A\u4FDD\u7559\u6700\u65B0\u4FEE\u6539"));
3679
+ console.log(chalk10.gray(" \u2022 \u76F8\u540C\u914D\u7F6E\uFF08URL+Key\uFF09\uFF1A\u4FDD\u7559\u6700\u65B0\u4FEE\u6539"));
3680
+ console.log(chalk10.gray(" \u2022 \u4E0D\u540C\u914D\u7F6E\uFF1A\u5168\u90E8\u4FDD\u7559\uFF0C\u81EA\u52A8\u5904\u7406 name \u51B2\u7A81"));
3483
3681
  console.log();
3484
3682
  } catch (error) {
3485
- console.error(chalk8.red(`
3683
+ console.error(chalk10.red(`
3486
3684
  \u274C ${error.message}
3487
3685
  `));
3488
3686
  }
@@ -3501,27 +3699,27 @@ var status_exports = {};
3501
3699
  __export(status_exports, {
3502
3700
  statusCommand: () => statusCommand
3503
3701
  });
3504
- import chalk9 from "chalk";
3702
+ import chalk11 from "chalk";
3505
3703
  function statusCommand(program2) {
3506
3704
  program2.command("status").description("\u67E5\u770B\u540C\u6B65\u72B6\u6001").action(async () => {
3507
3705
  try {
3508
3706
  const config = loadSyncConfig();
3509
- console.log(chalk9.bold("\n\u{1F4CA} \u540C\u6B65\u72B6\u6001\n"));
3707
+ console.log(chalk11.bold("\n\u{1F4CA} \u540C\u6B65\u72B6\u6001\n"));
3510
3708
  if (!config) {
3511
- console.log(chalk9.yellow("\u26A0\uFE0F \u672A\u914D\u7F6E WebDAV \u540C\u6B65"));
3709
+ console.log(chalk11.yellow("\u26A0\uFE0F \u672A\u914D\u7F6E WebDAV \u540C\u6B65"));
3512
3710
  console.log();
3513
- console.log(chalk9.blue("\u{1F4A1} \u5F00\u59CB\u914D\u7F6E: ccman sync config\n"));
3711
+ console.log(chalk11.blue("\u{1F4A1} \u5F00\u59CB\u914D\u7F6E: ccman sync config\n"));
3514
3712
  return;
3515
3713
  }
3516
- console.log(chalk9.bold("WebDAV \u914D\u7F6E:"));
3517
- console.log(` URL: ${chalk9.gray(config.webdavUrl)}`);
3518
- console.log(` \u7528\u6237: ${chalk9.gray(config.username)}`);
3519
- console.log(` \u8FDC\u7A0B\u76EE\u5F55: ${chalk9.gray(config.remoteDir)}`);
3714
+ console.log(chalk11.bold("WebDAV \u914D\u7F6E:"));
3715
+ console.log(` URL: ${chalk11.gray(config.webdavUrl)}`);
3716
+ console.log(` \u7528\u6237: ${chalk11.gray(config.username)}`);
3717
+ console.log(` \u8FDC\u7A0B\u76EE\u5F55: ${chalk11.gray(config.remoteDir)}`);
3520
3718
  console.log(
3521
- ` \u8BA4\u8BC1: ${chalk9.gray(config.authType === "password" ? "Basic Auth" : "Digest Auth")}`
3719
+ ` \u8BA4\u8BC1: ${chalk11.gray(config.authType === "password" ? "Basic Auth" : "Digest Auth")}`
3522
3720
  );
3523
3721
  console.log(
3524
- ` \u540C\u6B65\u5BC6\u7801: ${config.syncPassword ? chalk9.green("\u2713 \u5DF2\u4FDD\u5B58") : chalk9.yellow("\u2717 \u672A\u4FDD\u5B58")}`
3722
+ ` \u540C\u6B65\u5BC6\u7801: ${config.syncPassword ? chalk11.green("\u2713 \u5DF2\u4FDD\u5B58") : chalk11.yellow("\u2717 \u672A\u4FDD\u5B58")}`
3525
3723
  );
3526
3724
  console.log();
3527
3725
  const codexManager = createCodexManager();
@@ -3532,23 +3730,23 @@ function statusCommand(program2) {
3532
3730
  const claudeProviders = claudeManager.list();
3533
3731
  const geminiProviders = geminiManager.list();
3534
3732
  const openclawProviders = openclawManager.list();
3535
- console.log(chalk9.bold("\u672C\u5730\u914D\u7F6E:"));
3536
- console.log(` Codex: ${chalk9.cyan(codexProviders.length)} \u4E2A\u670D\u52A1\u5546`);
3537
- console.log(` Claude: ${chalk9.cyan(claudeProviders.length)} \u4E2A\u670D\u52A1\u5546`);
3538
- console.log(` Gemini: ${chalk9.cyan(geminiProviders.length)} \u4E2A\u670D\u52A1\u5546`);
3539
- console.log(` OpenClaw: ${chalk9.cyan(openclawProviders.length)} \u4E2A\u670D\u52A1\u5546`);
3733
+ console.log(chalk11.bold("\u672C\u5730\u914D\u7F6E:"));
3734
+ console.log(` Codex: ${chalk11.cyan(codexProviders.length)} \u4E2A\u670D\u52A1\u5546`);
3735
+ console.log(` Claude: ${chalk11.cyan(claudeProviders.length)} \u4E2A\u670D\u52A1\u5546`);
3736
+ console.log(` Gemini: ${chalk11.cyan(geminiProviders.length)} \u4E2A\u670D\u52A1\u5546`);
3737
+ console.log(` OpenClaw: ${chalk11.cyan(openclawProviders.length)} \u4E2A\u670D\u52A1\u5546`);
3540
3738
  if (config.lastSync) {
3541
3739
  const date = new Date(config.lastSync).toLocaleString("zh-CN");
3542
- console.log(` \u6700\u540E\u540C\u6B65: ${chalk9.gray(date)}`);
3740
+ console.log(` \u6700\u540E\u540C\u6B65: ${chalk11.gray(date)}`);
3543
3741
  }
3544
3742
  console.log();
3545
- console.log(chalk9.bold("\u540C\u6B65\u5EFA\u8BAE:"));
3546
- console.log(chalk9.blue(" \u{1F4A1} \u4E0A\u4F20\u5230\u4E91\u7AEF: ccman sync upload"));
3547
- console.log(chalk9.blue(" \u{1F4A1} \u4ECE\u4E91\u7AEF\u4E0B\u8F7D: ccman sync download"));
3548
- console.log(chalk9.blue(" \u{1F4A1} \u667A\u80FD\u5408\u5E76: ccman sync merge"));
3743
+ console.log(chalk11.bold("\u540C\u6B65\u5EFA\u8BAE:"));
3744
+ console.log(chalk11.blue(" \u{1F4A1} \u4E0A\u4F20\u5230\u4E91\u7AEF: ccman sync upload"));
3745
+ console.log(chalk11.blue(" \u{1F4A1} \u4ECE\u4E91\u7AEF\u4E0B\u8F7D: ccman sync download"));
3746
+ console.log(chalk11.blue(" \u{1F4A1} \u667A\u80FD\u5408\u5E76: ccman sync merge"));
3549
3747
  console.log();
3550
3748
  } catch (error) {
3551
- console.error(chalk9.red(`
3749
+ console.error(chalk11.red(`
3552
3750
  \u274C ${error.message}
3553
3751
  `));
3554
3752
  }
@@ -3569,8 +3767,8 @@ __export(sync_exports, {
3569
3767
  startSyncMenu: () => startSyncMenu
3570
3768
  });
3571
3769
  import { Command as Command2 } from "commander";
3572
- import inquirer6 from "inquirer";
3573
- import chalk10 from "chalk";
3770
+ import inquirer4 from "inquirer";
3771
+ import chalk12 from "chalk";
3574
3772
  function createSyncCommands(program2) {
3575
3773
  configCommand(program2);
3576
3774
  testCommand(program2);
@@ -3582,7 +3780,7 @@ function createSyncCommands(program2) {
3582
3780
  async function startSyncMenu() {
3583
3781
  while (true) {
3584
3782
  console.log();
3585
- const { action } = await inquirer6.prompt([
3783
+ const { action } = await inquirer4.prompt([
3586
3784
  {
3587
3785
  type: "list",
3588
3786
  name: "action",
@@ -3647,11 +3845,11 @@ async function startSyncMenu() {
3647
3845
  }
3648
3846
  }
3649
3847
  } catch (error) {
3650
- console.error(chalk10.red(`
3848
+ console.error(chalk12.red(`
3651
3849
  \u274C ${error.message}
3652
3850
  `));
3653
3851
  }
3654
- await inquirer6.prompt([
3852
+ await inquirer4.prompt([
3655
3853
  {
3656
3854
  type: "input",
3657
3855
  name: "continue",
@@ -3674,7 +3872,7 @@ var init_sync = __esm({
3674
3872
 
3675
3873
  // src/index.ts
3676
3874
  import { Command as Command3 } from "commander";
3677
- import chalk55 from "chalk";
3875
+ import chalk57 from "chalk";
3678
3876
 
3679
3877
  // src/utils/logo.ts
3680
3878
  init_dist2();
@@ -3699,26 +3897,33 @@ function printLogo() {
3699
3897
 
3700
3898
  // src/commands/codex/add.ts
3701
3899
  init_dist2();
3702
- import chalk12 from "chalk";
3703
- import inquirer8 from "inquirer";
3900
+ import chalk14 from "chalk";
3901
+ import inquirer6 from "inquirer";
3704
3902
 
3705
3903
  // src/interactive.ts
3706
3904
  init_dist2();
3707
- import inquirer7 from "inquirer";
3708
- import chalk11 from "chalk";
3905
+ import inquirer5 from "inquirer";
3906
+ import chalk13 from "chalk";
3709
3907
 
3710
3908
  // src/utils/format.ts
3711
3909
  import chalk2 from "chalk";
3712
- function formatProviderTable(providers, currentId) {
3910
+ function formatProviderTable(providers, currentId, title) {
3713
3911
  const lines = [];
3714
- lines.push("");
3912
+ if (title) {
3913
+ lines.push(chalk2.bold(`
3914
+ \u{1F4CB} ${title}`));
3915
+ lines.push("");
3916
+ } else {
3917
+ lines.push("");
3918
+ }
3715
3919
  providers.forEach((p, index) => {
3716
3920
  const isCurrent = p.id === currentId;
3717
3921
  const marker = isCurrent ? chalk2.green("\u25CF") : chalk2.gray("\u25CB");
3718
3922
  const name = isCurrent ? chalk2.green.bold(p.name) : chalk2.white(p.name);
3719
3923
  const tag = isCurrent ? chalk2.green(" [\u5F53\u524D]") : "";
3720
3924
  lines.push(` ${marker} ${name}${tag}`);
3721
- const url = isCurrent ? chalk2.green(p.baseUrl) : chalk2.gray(p.baseUrl);
3925
+ const urlText = p.baseUrl || "(\u9ED8\u8BA4\u7AEF\u70B9)";
3926
+ const url = isCurrent ? chalk2.green(urlText) : chalk2.gray(urlText);
3722
3927
  lines.push(` ${url}`);
3723
3928
  if (p.desc) {
3724
3929
  const desc = isCurrent ? chalk2.green(p.desc) : chalk2.gray(p.desc);
@@ -3734,6 +3939,64 @@ function formatProviderTable(providers, currentId) {
3734
3939
 
3735
3940
  // src/interactive.ts
3736
3941
  init_confirm();
3942
+
3943
+ // src/utils/cli-theme.ts
3944
+ import chalk3 from "chalk";
3945
+ var TOOL_COLORS = {
3946
+ codex: chalk3.hex("#10A37F"),
3947
+ // OpenAI 绿
3948
+ claude: chalk3.hex("#D97706"),
3949
+ // Anthropic 橙
3950
+ gemini: chalk3.hex("#4285F4"),
3951
+ // Google 蓝
3952
+ opencode: chalk3.hex("#FF6B35"),
3953
+ // 活力橙
3954
+ openclaw: chalk3.hex("#E74C3C"),
3955
+ // 红色
3956
+ mcp: chalk3.hex("#9B59B6")
3957
+ // 紫色
3958
+ };
3959
+ var TOOL_NAMES = {
3960
+ codex: "Codex",
3961
+ claude: "Claude Code",
3962
+ gemini: "Gemini CLI",
3963
+ opencode: "OpenCode",
3964
+ openclaw: "OpenClaw",
3965
+ mcp: "MCP"
3966
+ };
3967
+ function toolBadge(tool) {
3968
+ const color = TOOL_COLORS[tool] || chalk3.blue;
3969
+ const label = TOOL_NAMES[tool] || tool;
3970
+ return color.bold(`[${label}]`);
3971
+ }
3972
+
3973
+ // src/utils/cli-output.ts
3974
+ import chalk4 from "chalk";
3975
+ function printBlock(header, lines = []) {
3976
+ console.log();
3977
+ console.log(header);
3978
+ if (lines.length > 0) {
3979
+ console.log();
3980
+ lines.forEach((line) => console.log(` ${line}`));
3981
+ }
3982
+ console.log();
3983
+ }
3984
+ function printSuccess(title, details = []) {
3985
+ printBlock(chalk4.green(`\u2705 ${title}`), details);
3986
+ }
3987
+ function printInfo(title, lines = []) {
3988
+ printBlock(chalk4.bold(title), lines);
3989
+ }
3990
+ function printWarning(message) {
3991
+ console.log(chalk4.yellow(`
3992
+ \u26A0\uFE0F ${message}
3993
+ `));
3994
+ }
3995
+ function printTip(message) {
3996
+ console.log(chalk4.blue("\u{1F4A1} ") + message);
3997
+ }
3998
+
3999
+ // src/interactive.ts
3737
4000
  var CLI_TOOL_CONFIG = {
3738
4001
  [TOOL_TYPES.CODEX]: { name: "Codex", emoji: "\u{1F536}", cmd: "cx" },
3739
4002
  [TOOL_TYPES.CLAUDE]: { name: "Claude", emoji: "\u{1F537}", cmd: "cc" },
@@ -3756,7 +4019,7 @@ function getManager(tool) {
3756
4019
  }
3757
4020
  }
3758
4021
  async function promptProviderForm(defaults) {
3759
- const answers = await inquirer7.prompt([
4022
+ const answers = await inquirer5.prompt([
3760
4023
  {
3761
4024
  type: "input",
3762
4025
  name: "name",
@@ -3809,7 +4072,7 @@ async function promptProviderForm(defaults) {
3809
4072
  async function startMainMenu() {
3810
4073
  while (true) {
3811
4074
  console.log();
3812
- const { choice } = await inquirer7.prompt([
4075
+ const { choice } = await inquirer5.prompt([
3813
4076
  {
3814
4077
  type: "list",
3815
4078
  name: "choice",
@@ -3827,7 +4090,7 @@ async function startMainMenu() {
3827
4090
  }
3828
4091
  ]);
3829
4092
  if (choice === "exit") {
3830
- console.log(chalk11.gray("\n\u{1F44B} \u518D\u89C1!\n"));
4093
+ console.log(chalk13.gray("\n\u{1F44B} \u518D\u89C1!\n"));
3831
4094
  break;
3832
4095
  }
3833
4096
  if (choice === "claude") {
@@ -3864,14 +4127,14 @@ async function startOpenClawMenu() {
3864
4127
  await showToolMenu(TOOL_TYPES.OPENCLAW);
3865
4128
  }
3866
4129
  async function showToolMenu(tool) {
3867
- const { name: toolName, emoji: toolEmoji } = CLI_TOOL_CONFIG[tool];
4130
+ const { name: toolDisplayName, emoji } = CLI_TOOL_CONFIG[tool];
3868
4131
  while (true) {
3869
4132
  console.log();
3870
- const { action } = await inquirer7.prompt([
4133
+ const { action } = await inquirer5.prompt([
3871
4134
  {
3872
4135
  type: "list",
3873
4136
  name: "action",
3874
- message: `${toolEmoji} ${toolName} \u64CD\u4F5C:`,
4137
+ message: `${emoji} ${toolDisplayName} \u64CD\u4F5C:`,
3875
4138
  choices: [
3876
4139
  { name: "\u2795 \u6DFB\u52A0\u670D\u52A1\u5546", value: "add" },
3877
4140
  { name: "\u{1F504} \u5207\u6362\u670D\u52A1\u5546", value: "switch" },
@@ -3912,11 +4175,11 @@ async function showToolMenu(tool) {
3912
4175
  break;
3913
4176
  }
3914
4177
  } catch (error) {
3915
- console.error(chalk11.red(`
4178
+ console.error(chalk13.red(`
3916
4179
  \u274C ${error.message}
3917
4180
  `));
3918
4181
  }
3919
- await inquirer7.prompt([
4182
+ await inquirer5.prompt([
3920
4183
  {
3921
4184
  type: "input",
3922
4185
  name: "continue",
@@ -3926,16 +4189,16 @@ async function showToolMenu(tool) {
3926
4189
  }
3927
4190
  }
3928
4191
  async function showPresetsMenu() {
3929
- console.log(chalk11.yellow("\n\u26A0\uFE0F \u9884\u7F6E\u670D\u52A1\u5546\u7BA1\u7406\u529F\u80FD\u5373\u5C06\u63A8\u51FA\n"));
4192
+ console.log(chalk13.yellow("\n\u26A0\uFE0F \u9884\u7F6E\u670D\u52A1\u5546\u7BA1\u7406\u529F\u80FD\u5373\u5C06\u63A8\u51FA\n"));
3930
4193
  }
3931
4194
  async function handleAdd(tool) {
3932
4195
  const manager = getManager(tool);
3933
- const { name: toolName, cmd } = CLI_TOOL_CONFIG[tool];
3934
4196
  const presets = manager.listPresets();
3935
- console.log(chalk11.bold(`
4197
+ const { name: toolName, cmd } = CLI_TOOL_CONFIG[tool];
4198
+ console.log(chalk13.bold(`
3936
4199
  \u{1F4DD} \u6DFB\u52A0 ${toolName} \u670D\u52A1\u5546
3937
4200
  `));
3938
- const { usePreset } = await inquirer7.prompt([
4201
+ const { usePreset } = await inquirer5.prompt([
3939
4202
  {
3940
4203
  type: "list",
3941
4204
  name: "usePreset",
@@ -3951,7 +4214,7 @@ async function handleAdd(tool) {
3951
4214
  let baseUrl;
3952
4215
  let apiKey;
3953
4216
  if (usePreset) {
3954
- const { presetName } = await inquirer7.prompt([
4217
+ const { presetName } = await inquirer5.prompt([
3955
4218
  {
3956
4219
  type: "list",
3957
4220
  name: "presetName",
@@ -3963,7 +4226,7 @@ async function handleAdd(tool) {
3963
4226
  }
3964
4227
  ]);
3965
4228
  const preset = presets.find((p) => p.name === presetName);
3966
- console.log(chalk11.blue(`
4229
+ console.log(chalk13.blue(`
3967
4230
  \u4F7F\u7528\u9884\u8BBE: ${preset.name} - ${preset.description}
3968
4231
  `));
3969
4232
  const input = await promptProviderForm({
@@ -3977,7 +4240,7 @@ async function handleAdd(tool) {
3977
4240
  baseUrl = input.baseUrl;
3978
4241
  apiKey = input.apiKey;
3979
4242
  } else {
3980
- const answers = await inquirer7.prompt([
4243
+ const answers = await inquirer5.prompt([
3981
4244
  {
3982
4245
  type: "input",
3983
4246
  name: "name",
@@ -4010,19 +4273,16 @@ async function handleAdd(tool) {
4010
4273
  apiKey = answers.apiKey;
4011
4274
  }
4012
4275
  const provider = manager.add({ name, desc, baseUrl, apiKey });
4013
- console.log();
4014
- console.log(chalk11.green("\u2705 \u6DFB\u52A0\u6210\u529F"));
4015
- console.log();
4016
- console.log(` ${chalk11.bold(provider.name)} ${chalk11.blue(`[${toolName}]`)}`);
4017
- console.log(` ${chalk11.gray(provider.baseUrl)}`);
4018
- console.log();
4276
+ printSuccess("\u6DFB\u52A0\u6210\u529F", [
4277
+ `${chalk13.bold(provider.name)} ${toolBadge(tool)}`,
4278
+ chalk13.gray(provider.baseUrl)
4279
+ ]);
4019
4280
  const switchNow = await promptConfirm("\u662F\u5426\u7ACB\u5373\u5207\u6362\u5230\u6B64\u670D\u52A1\u5546?", true);
4020
4281
  if (switchNow) {
4021
4282
  manager.switch(provider.id);
4022
- console.log(chalk11.green("\u2705 \u5DF2\u5207\u6362\u5230\u65B0\u670D\u52A1\u5546\n"));
4283
+ printSuccess("\u5DF2\u5207\u6362\u5230\u65B0\u670D\u52A1\u5546");
4023
4284
  } else {
4024
- console.log(chalk11.blue("\u{1F4A1} \u7A0D\u540E\u5207\u6362:") + chalk11.white(` ccman ${cmd} use "${provider.name}"
4025
- `));
4285
+ printTip(`\u7A0D\u540E\u5207\u6362: ${chalk13.white(`ccman ${cmd} use "${provider.name}"`)}`);
4026
4286
  }
4027
4287
  }
4028
4288
  async function handleSwitch(tool) {
@@ -4030,70 +4290,66 @@ async function handleSwitch(tool) {
4030
4290
  const providers = manager.list();
4031
4291
  const current = manager.getCurrent();
4032
4292
  if (providers.length === 0) {
4033
- console.log(chalk11.yellow("\n\u26A0\uFE0F \u6682\u65E0\u670D\u52A1\u5546\n"));
4293
+ printWarning("\u6682\u65E0\u670D\u52A1\u5546");
4034
4294
  return;
4035
4295
  }
4036
- const { providerId } = await inquirer7.prompt([
4296
+ const { providerId } = await inquirer5.prompt([
4037
4297
  {
4038
4298
  type: "list",
4039
4299
  name: "providerId",
4040
4300
  message: "\u9009\u62E9\u8981\u5207\u6362\u7684\u670D\u52A1\u5546:",
4041
4301
  choices: providers.map((p) => ({
4042
- name: `${p.name}${current?.id === p.id ? chalk11.green(" (\u5F53\u524D)") : ""}`,
4302
+ name: `${p.name}${current?.id === p.id ? chalk13.green(" (\u5F53\u524D)") : ""}`,
4043
4303
  value: p.id
4044
4304
  }))
4045
4305
  }
4046
4306
  ]);
4047
4307
  manager.switch(providerId);
4048
4308
  const provider = providers.find((p) => p.id === providerId);
4049
- console.log(chalk11.green(`
4050
- \u2705 \u5DF2\u5207\u6362\u5230: ${provider.name}
4051
- `));
4309
+ printSuccess("\u5207\u6362\u6210\u529F", [
4310
+ `${chalk13.bold(provider.name)} ${toolBadge(tool)}`,
4311
+ chalk13.gray(provider.baseUrl)
4312
+ ]);
4052
4313
  }
4053
4314
  async function handleList(tool) {
4054
4315
  const manager = getManager(tool);
4055
4316
  const providers = manager.list();
4056
4317
  const current = manager.getCurrent();
4057
- const { name: toolName } = CLI_TOOL_CONFIG[tool];
4318
+ const { name: tn, cmd } = CLI_TOOL_CONFIG[tool];
4058
4319
  if (providers.length === 0) {
4059
- console.log(chalk11.yellow(`
4060
- \u26A0\uFE0F \u6682\u65E0 ${toolName} \u670D\u52A1\u5546
4061
- `));
4320
+ printWarning(`\u6682\u65E0 ${tn} \u670D\u52A1\u5546`);
4321
+ printTip(`\u6DFB\u52A0\u670D\u52A1\u5546: ${chalk13.white(`ccman ${cmd} add`)}`);
4062
4322
  return;
4063
4323
  }
4064
- console.log(chalk11.bold(`
4065
- \u{1F4CB} ${toolName} \u670D\u52A1\u5546 (${providers.length} \u4E2A)`));
4066
- console.log(formatProviderTable(providers, current?.id));
4324
+ console.log(formatProviderTable(providers, current?.id, `${tn} \u670D\u52A1\u5546 (${providers.length} \u4E2A)`));
4067
4325
  }
4068
4326
  async function handleCurrent(tool) {
4069
4327
  const manager = getManager(tool);
4070
4328
  const current = manager.getCurrent();
4071
- const { name: toolName } = CLI_TOOL_CONFIG[tool];
4329
+ const { name: tn, cmd } = CLI_TOOL_CONFIG[tool];
4072
4330
  if (!current) {
4073
- console.log(chalk11.yellow(`
4074
- \u26A0\uFE0F \u672A\u9009\u62E9\u4EFB\u4F55 ${toolName} \u670D\u52A1\u5546
4075
- `));
4331
+ printWarning(`\u672A\u9009\u62E9\u4EFB\u4F55 ${tn} \u670D\u52A1\u5546`);
4332
+ printTip(`\u9009\u62E9\u670D\u52A1\u5546: ${chalk13.white(`ccman ${cmd} use`)}`);
4076
4333
  return;
4077
4334
  }
4078
- console.log(chalk11.bold(`
4079
- \u{1F441}\uFE0F \u5F53\u524D ${toolName} \u670D\u52A1\u5546
4080
- `));
4081
- console.log(` ${chalk11.green.bold(current.name)}`);
4082
- console.log(` ${chalk11.gray(current.baseUrl)}`);
4335
+ const lines = [
4336
+ chalk13.green.bold(current.name),
4337
+ chalk13.gray(`ID: ${current.id}`),
4338
+ chalk13.gray(`URL: ${current.baseUrl || "(\u9ED8\u8BA4\u7AEF\u70B9)"}`)
4339
+ ];
4083
4340
  if (current.lastUsedAt) {
4084
- const date = new Date(current.lastUsedAt).toLocaleString("zh-CN");
4085
- console.log(` ${chalk11.gray(`\u6700\u540E\u4F7F\u7528: ${date}`)}`);
4341
+ lines.push(chalk13.gray(`\u6700\u540E\u4F7F\u7528: ${new Date(current.lastUsedAt).toLocaleString("zh-CN")}`));
4086
4342
  }
4087
- console.log();
4343
+ printInfo(`\u{1F4CD} \u5F53\u524D ${tn} \u670D\u52A1\u5546`, lines);
4088
4344
  }
4089
4345
  async function handleEdit(tool) {
4090
4346
  const manager = getManager(tool);
4091
4347
  const providers = manager.list();
4092
4348
  if (providers.length === 0) {
4093
- console.log(chalk11.yellow("\n\u26A0\uFE0F \u6682\u65E0\u670D\u52A1\u5546\n"));
4349
+ printWarning("\u6682\u65E0\u670D\u52A1\u5546");
4094
4350
  return;
4095
4351
  }
4096
- const { providerId } = await inquirer7.prompt([
4352
+ const { providerId } = await inquirer5.prompt([
4097
4353
  {
4098
4354
  type: "list",
4099
4355
  name: "providerId",
@@ -4105,7 +4361,7 @@ async function handleEdit(tool) {
4105
4361
  }
4106
4362
  ]);
4107
4363
  const provider = providers.find((p) => p.id === providerId);
4108
- const answers = await inquirer7.prompt([
4364
+ const answers = await inquirer5.prompt([
4109
4365
  {
4110
4366
  type: "input",
4111
4367
  name: "name",
@@ -4145,16 +4401,16 @@ async function handleEdit(tool) {
4145
4401
  baseUrl: answers.baseUrl,
4146
4402
  apiKey: answers.apiKey || void 0
4147
4403
  });
4148
- console.log(chalk11.green("\n\u2705 \u7F16\u8F91\u6210\u529F\n"));
4404
+ printSuccess("\u7F16\u8F91\u6210\u529F");
4149
4405
  }
4150
4406
  async function handleClone(tool) {
4151
4407
  const manager = getManager(tool);
4152
4408
  const providers = manager.list();
4153
4409
  if (providers.length === 0) {
4154
- console.log(chalk11.yellow("\n\u26A0\uFE0F \u6682\u65E0\u670D\u52A1\u5546\n"));
4410
+ printWarning("\u6682\u65E0\u670D\u52A1\u5546");
4155
4411
  return;
4156
4412
  }
4157
- const { providerId } = await inquirer7.prompt([
4413
+ const { providerId } = await inquirer5.prompt([
4158
4414
  {
4159
4415
  type: "list",
4160
4416
  name: "providerId",
@@ -4166,7 +4422,7 @@ async function handleClone(tool) {
4166
4422
  }
4167
4423
  ]);
4168
4424
  const provider = providers.find((p) => p.id === providerId);
4169
- const answers = await inquirer7.prompt([
4425
+ const answers = await inquirer5.prompt([
4170
4426
  {
4171
4427
  type: "input",
4172
4428
  name: "name",
@@ -4189,19 +4445,16 @@ async function handleClone(tool) {
4189
4445
  baseUrl: provider.baseUrl,
4190
4446
  apiKey: answers.apiKey
4191
4447
  });
4192
- console.log(chalk11.green("\n\u2705 \u514B\u9686\u6210\u529F\n"));
4193
- console.log(` ${chalk11.bold(newProvider.name)}`);
4194
- console.log(` ${chalk11.gray(newProvider.baseUrl)}`);
4195
- console.log();
4448
+ printSuccess("\u514B\u9686\u6210\u529F", [chalk13.bold(newProvider.name), chalk13.gray(newProvider.baseUrl)]);
4196
4449
  }
4197
4450
  async function handleRemove(tool) {
4198
4451
  const manager = getManager(tool);
4199
4452
  const providers = manager.list();
4200
4453
  if (providers.length === 0) {
4201
- console.log(chalk11.yellow("\n\u26A0\uFE0F \u6682\u65E0\u670D\u52A1\u5546\n"));
4454
+ printWarning("\u6682\u65E0\u670D\u52A1\u5546");
4202
4455
  return;
4203
4456
  }
4204
- const { providerId } = await inquirer7.prompt([
4457
+ const { providerId } = await inquirer5.prompt([
4205
4458
  {
4206
4459
  type: "list",
4207
4460
  name: "providerId",
@@ -4216,22 +4469,153 @@ async function handleRemove(tool) {
4216
4469
  const confirm = await promptConfirm(`\u786E\u5B9A\u8981\u5220\u9664 "${provider.name}" \u5417?`, false);
4217
4470
  if (confirm) {
4218
4471
  manager.remove(providerId);
4219
- console.log(chalk11.green(`
4220
- \u2705 \u5DF2\u5220\u9664: ${provider.name}
4221
- `));
4472
+ printSuccess(`\u5DF2\u5220\u9664: ${provider.name}`);
4222
4473
  } else {
4223
- console.log(chalk11.gray("\n\u274C \u5DF2\u53D6\u6D88\n"));
4474
+ console.log(chalk13.gray("\n\u274C \u5DF2\u53D6\u6D88\n"));
4224
4475
  }
4225
4476
  }
4226
4477
 
4227
4478
  // src/commands/codex/add.ts
4228
4479
  init_confirm();
4480
+
4481
+ // src/utils/provider-params.ts
4482
+ init_confirm();
4483
+ function trimCliValue(value) {
4484
+ if (value === void 0) {
4485
+ return void 0;
4486
+ }
4487
+ return value.trim();
4488
+ }
4489
+ function validateBaseUrl(baseUrl, allowEmpty = false) {
4490
+ if (!baseUrl) {
4491
+ if (allowEmpty) {
4492
+ return;
4493
+ }
4494
+ throw new Error("\u7F3A\u5C11\u53C2\u6570: --base-url");
4495
+ }
4496
+ if (!baseUrl.startsWith("http://") && !baseUrl.startsWith("https://")) {
4497
+ throw new Error("API \u5730\u5740\u5FC5\u987B\u4EE5 http:// \u6216 https:// \u5F00\u5934");
4498
+ }
4499
+ }
4500
+ function validateApiKey(apiKey, allowEmpty = false) {
4501
+ if (!apiKey && !allowEmpty) {
4502
+ throw new Error("\u7F3A\u5C11\u53C2\u6570: --api-key");
4503
+ }
4504
+ }
4505
+ function resolvePreset(presets, presetName) {
4506
+ const normalizedName = trimCliValue(presetName);
4507
+ if (!normalizedName) {
4508
+ return void 0;
4509
+ }
4510
+ const preset = presets.find((item) => item.name.toLowerCase() === normalizedName.toLowerCase());
4511
+ if (!preset) {
4512
+ throw new Error(`\u9884\u8BBE\u4E0D\u5B58\u5728: ${normalizedName}`);
4513
+ }
4514
+ return preset;
4515
+ }
4516
+ function addProviderAddOptions(command) {
4517
+ 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");
4518
+ }
4519
+ function addProviderEditOptions(command) {
4520
+ 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");
4521
+ }
4522
+ function addProviderRemoveOptions(command) {
4523
+ command.option("-y, --yes", "\u8DF3\u8FC7\u5220\u9664\u786E\u8BA4");
4524
+ }
4525
+ function resolveProviderAddInput(options, presets, rules = {}) {
4526
+ if (options.switch && options.skipSwitch) {
4527
+ throw new Error("\u4E0D\u80FD\u540C\u65F6\u4F7F\u7528 --switch \u548C --skip-switch");
4528
+ }
4529
+ 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;
4530
+ if (!nonInteractive) {
4531
+ return {
4532
+ nonInteractive: false,
4533
+ switchNow: false
4534
+ };
4535
+ }
4536
+ const preset = resolvePreset(presets, options.preset);
4537
+ const name = trimCliValue(options.name) ?? preset?.name;
4538
+ const desc = options.desc === void 0 ? void 0 : options.desc.trim() || void 0;
4539
+ const baseUrl = trimCliValue(options.baseUrl) ?? preset?.baseUrl ?? "";
4540
+ const apiKey = options.apiKey === void 0 ? "" : options.apiKey.trim();
4541
+ if (!name) {
4542
+ throw new Error("\u7F3A\u5C11\u53C2\u6570: --name");
4543
+ }
4544
+ validateBaseUrl(baseUrl, rules.allowEmptyBaseUrl);
4545
+ validateApiKey(apiKey, rules.allowEmptyApiKey);
4546
+ return {
4547
+ nonInteractive: true,
4548
+ switchNow: options.switch === true,
4549
+ input: {
4550
+ name,
4551
+ desc,
4552
+ baseUrl,
4553
+ apiKey
4554
+ }
4555
+ };
4556
+ }
4557
+ function resolveProviderEditInput(options, rules = {}) {
4558
+ const nonInteractive = options.newName !== void 0 || options.desc !== void 0 || options.baseUrl !== void 0 || options.apiKey !== void 0;
4559
+ const updates = {};
4560
+ if (options.newName !== void 0) {
4561
+ const newName = trimCliValue(options.newName);
4562
+ if (!newName) {
4563
+ throw new Error("\u670D\u52A1\u5546\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A");
4564
+ }
4565
+ updates.name = newName;
4566
+ }
4567
+ if (options.desc !== void 0) {
4568
+ updates.desc = options.desc.trim();
4569
+ }
4570
+ if (options.baseUrl !== void 0) {
4571
+ const baseUrl = trimCliValue(options.baseUrl) ?? "";
4572
+ validateBaseUrl(baseUrl, rules.allowEmptyBaseUrl);
4573
+ updates.baseUrl = baseUrl;
4574
+ }
4575
+ if (options.apiKey !== void 0) {
4576
+ const apiKey = options.apiKey.trim();
4577
+ validateApiKey(apiKey, rules.allowEmptyApiKey);
4578
+ updates.apiKey = apiKey;
4579
+ }
4580
+ return {
4581
+ nonInteractive,
4582
+ updates
4583
+ };
4584
+ }
4585
+ async function confirmProviderRemoval(providerName, options = {}) {
4586
+ if (options.yes) {
4587
+ return true;
4588
+ }
4589
+ return promptConfirm(`\u786E\u5B9A\u5220\u9664 "${providerName}"?`, false);
4590
+ }
4591
+
4592
+ // src/commands/codex/add.ts
4229
4593
  function addCommand(program2) {
4230
- program2.command("add").description("\u6DFB\u52A0\u65B0\u7684 Codex \u670D\u52A1\u5546(\u4EA4\u4E92\u5F0F)").action(async () => {
4594
+ const command = program2.command("add").description("\u6DFB\u52A0\u65B0\u7684 Codex \u670D\u52A1\u5546");
4595
+ addProviderAddOptions(command);
4596
+ command.action(async (options) => {
4231
4597
  try {
4232
4598
  const manager = createCodexManager();
4233
- console.log(chalk12.bold("\n\u{1F4DD} \u6DFB\u52A0 Codex \u670D\u52A1\u5546\n"));
4234
- const { usePreset } = await inquirer8.prompt([
4599
+ console.log(chalk14.bold("\n\u{1F4DD} \u6DFB\u52A0 Codex \u670D\u52A1\u5546\n"));
4600
+ const resolved = resolveProviderAddInput(options, CODEX_PRESETS);
4601
+ if (resolved.nonInteractive && resolved.input) {
4602
+ const provider2 = manager.add(resolved.input);
4603
+ printSuccess("\u6DFB\u52A0\u6210\u529F", [
4604
+ `${chalk14.bold(provider2.name)} ${toolBadge("codex")}`,
4605
+ chalk14.gray(provider2.baseUrl)
4606
+ ]);
4607
+ if (resolved.switchNow) {
4608
+ manager.switch(provider2.id);
4609
+ printSuccess("\u5DF2\u5207\u6362\u5230\u65B0\u670D\u52A1\u5546", [
4610
+ chalk14.gray(`\u914D\u7F6E\u5DF2\u66F4\u65B0: ${getCodexConfigPath()}`),
4611
+ chalk14.gray(`\u914D\u7F6E\u5DF2\u66F4\u65B0: ${getCodexAuthPath()}`)
4612
+ ]);
4613
+ } else {
4614
+ printTip(`\u7A0D\u540E\u5207\u6362: ${chalk14.white(`ccman cx use "${provider2.name}"`)}`);
4615
+ }
4616
+ return;
4617
+ }
4618
+ const { usePreset } = await inquirer6.prompt([
4235
4619
  {
4236
4620
  type: "list",
4237
4621
  name: "usePreset",
@@ -4247,7 +4631,7 @@ function addCommand(program2) {
4247
4631
  let baseUrl;
4248
4632
  let apiKey;
4249
4633
  if (usePreset) {
4250
- const { presetName } = await inquirer8.prompt([
4634
+ const { presetName } = await inquirer6.prompt([
4251
4635
  {
4252
4636
  type: "list",
4253
4637
  name: "presetName",
@@ -4259,7 +4643,7 @@ function addCommand(program2) {
4259
4643
  }
4260
4644
  ]);
4261
4645
  const preset = CODEX_PRESETS.find((p) => p.name === presetName);
4262
- console.log(chalk12.blue(`
4646
+ console.log(chalk14.blue(`
4263
4647
  \u4F7F\u7528\u9884\u8BBE: ${preset.name} - ${preset.description}
4264
4648
  `));
4265
4649
  const input = await promptProviderForm({
@@ -4273,7 +4657,7 @@ function addCommand(program2) {
4273
4657
  baseUrl = input.baseUrl;
4274
4658
  apiKey = input.apiKey;
4275
4659
  } else {
4276
- const answers = await inquirer8.prompt([
4660
+ const answers = await inquirer6.prompt([
4277
4661
  {
4278
4662
  type: "input",
4279
4663
  name: "name",
@@ -4312,25 +4696,22 @@ function addCommand(program2) {
4312
4696
  apiKey = answers.apiKey;
4313
4697
  }
4314
4698
  const provider = manager.add({ name, desc, baseUrl, apiKey });
4315
- console.log();
4316
- console.log(chalk12.green("\u2705 \u6DFB\u52A0\u6210\u529F"));
4317
- console.log();
4318
- console.log(` ${chalk12.bold(provider.name)} ${chalk12.blue("[Codex]")}`);
4319
- console.log(` ${chalk12.gray(provider.baseUrl)}`);
4320
- console.log();
4699
+ printSuccess("\u6DFB\u52A0\u6210\u529F", [
4700
+ `${chalk14.bold(provider.name)} ${toolBadge("codex")}`,
4701
+ chalk14.gray(provider.baseUrl)
4702
+ ]);
4321
4703
  const switchNow = await promptConfirm("\u662F\u5426\u7ACB\u5373\u5207\u6362\u5230\u6B64\u670D\u52A1\u5546?", true);
4322
4704
  if (switchNow) {
4323
4705
  manager.switch(provider.id);
4324
- console.log(chalk12.green("\u2705 \u5DF2\u5207\u6362\u5230\u65B0\u670D\u52A1\u5546"));
4325
- console.log();
4326
- console.log(chalk12.gray("\u914D\u7F6E\u5DF2\u66F4\u65B0:"));
4327
- console.log(chalk12.gray(` - ${getCodexConfigPath()}`));
4328
- console.log(chalk12.gray(` - ${getCodexAuthPath()}`));
4706
+ printSuccess("\u5DF2\u5207\u6362\u5230\u65B0\u670D\u52A1\u5546", [
4707
+ chalk14.gray(`\u914D\u7F6E\u5DF2\u66F4\u65B0: ${getCodexConfigPath()}`),
4708
+ chalk14.gray(`\u914D\u7F6E\u5DF2\u66F4\u65B0: ${getCodexAuthPath()}`)
4709
+ ]);
4329
4710
  } else {
4330
- console.log(chalk12.blue("\u{1F4A1} \u7A0D\u540E\u5207\u6362:") + chalk12.white(` ccman cx use "${provider.name}"`));
4711
+ printTip(`\u7A0D\u540E\u5207\u6362: ${chalk14.white(`ccman cx use "${provider.name}"`)}`);
4331
4712
  }
4332
4713
  } catch (error) {
4333
- console.error(chalk12.red(`
4714
+ console.error(chalk14.red(`
4334
4715
  \u274C ${error.message}
4335
4716
  `));
4336
4717
  process.exit(1);
@@ -4340,7 +4721,7 @@ function addCommand(program2) {
4340
4721
 
4341
4722
  // src/commands/codex/list.ts
4342
4723
  init_dist2();
4343
- import chalk13 from "chalk";
4724
+ import chalk15 from "chalk";
4344
4725
  function listCommand(program2) {
4345
4726
  program2.command("list").alias("ls").description("\u5217\u51FA\u6240\u6709 Codex \u670D\u52A1\u5546").action(async () => {
4346
4727
  try {
@@ -4348,15 +4729,15 @@ function listCommand(program2) {
4348
4729
  const providers = manager.list();
4349
4730
  const current = manager.getCurrent();
4350
4731
  if (providers.length === 0) {
4351
- console.log(chalk13.yellow("\n\u26A0\uFE0F \u6682\u65E0 Codex \u670D\u52A1\u5546\n"));
4352
- console.log(chalk13.blue("\u{1F4A1} \u6DFB\u52A0\u670D\u52A1\u5546:") + chalk13.white(" ccman cx add\n"));
4732
+ printWarning("\u6682\u65E0 Codex \u670D\u52A1\u5546");
4733
+ printTip("\u6DFB\u52A0\u670D\u52A1\u5546: " + chalk15.white("ccman cx add"));
4353
4734
  return;
4354
4735
  }
4355
- console.log(chalk13.bold(`
4356
- \u{1F4CB} Codex \u670D\u52A1\u5546 (${providers.length} \u4E2A)`));
4357
- console.log(formatProviderTable(providers, current?.id));
4736
+ console.log(
4737
+ formatProviderTable(providers, current?.id, `Codex \u670D\u52A1\u5546 (${providers.length} \u4E2A)`)
4738
+ );
4358
4739
  } catch (error) {
4359
- console.error(chalk13.red(`
4740
+ console.error(chalk15.red(`
4360
4741
  \u274C ${error.message}
4361
4742
  `));
4362
4743
  process.exit(1);
@@ -4366,16 +4747,16 @@ function listCommand(program2) {
4366
4747
 
4367
4748
  // src/commands/codex/use.ts
4368
4749
  init_dist2();
4369
- import chalk14 from "chalk";
4370
- import inquirer9 from "inquirer";
4750
+ import chalk16 from "chalk";
4751
+ import inquirer7 from "inquirer";
4371
4752
  function useCommand(program2) {
4372
4753
  program2.command("use [name]").description("\u5207\u6362 Codex \u670D\u52A1\u5546").action(async (name) => {
4373
4754
  try {
4374
4755
  const manager = createCodexManager();
4375
4756
  const providers = manager.list();
4376
4757
  if (providers.length === 0) {
4377
- console.log(chalk14.yellow("\n\u26A0\uFE0F \u6682\u65E0 Codex \u670D\u52A1\u5546\n"));
4378
- console.log(chalk14.blue("\u{1F4A1} \u6DFB\u52A0\u670D\u52A1\u5546:") + chalk14.white(" ccman cx add\n"));
4758
+ printWarning("\u6682\u65E0 Codex \u670D\u52A1\u5546");
4759
+ printTip("\u6DFB\u52A0\u670D\u52A1\u5546: " + chalk16.white("ccman cx add"));
4379
4760
  return;
4380
4761
  }
4381
4762
  let targetId;
@@ -4386,7 +4767,7 @@ function useCommand(program2) {
4386
4767
  }
4387
4768
  targetId = provider2.id;
4388
4769
  } else {
4389
- const { selectedId } = await inquirer9.prompt([
4770
+ const { selectedId } = await inquirer7.prompt([
4390
4771
  {
4391
4772
  type: "list",
4392
4773
  name: "selectedId",
@@ -4401,24 +4782,20 @@ function useCommand(program2) {
4401
4782
  }
4402
4783
  manager.switch(targetId);
4403
4784
  const provider = manager.get(targetId);
4404
- console.log();
4405
- console.log(chalk14.green("\u2705 \u5207\u6362\u6210\u529F"));
4406
- console.log();
4407
- console.log(` ${chalk14.bold(provider.name)} ${chalk14.blue("[Codex]")}`);
4408
- console.log(` ${chalk14.gray(`URL: ${provider.baseUrl}`)}`);
4409
- console.log();
4410
- console.log(chalk14.gray("\u914D\u7F6E\u5DF2\u66F4\u65B0:"));
4411
- console.log(chalk14.gray(` - ${getCodexConfigPath()}`));
4412
- console.log(chalk14.gray(` - ${getCodexAuthPath()}`));
4413
- console.log();
4785
+ printSuccess("\u5207\u6362\u6210\u529F", [
4786
+ `${chalk16.bold(provider.name)} ${toolBadge("codex")}`,
4787
+ chalk16.gray(`URL: ${provider.baseUrl}`),
4788
+ chalk16.gray(`\u914D\u7F6E\u5DF2\u66F4\u65B0: ${getCodexConfigPath()}`),
4789
+ chalk16.gray(`\u914D\u7F6E\u5DF2\u66F4\u65B0: ${getCodexAuthPath()}`)
4790
+ ]);
4414
4791
  } catch (error) {
4415
4792
  if (error instanceof ProviderNotFoundError) {
4416
- console.error(chalk14.red(`
4793
+ console.error(chalk16.red(`
4417
4794
  \u274C \u670D\u52A1\u5546\u4E0D\u5B58\u5728: ${error.message}
4418
4795
  `));
4419
- console.log(chalk14.blue("\u{1F4A1} \u67E5\u770B\u6240\u6709\u670D\u52A1\u5546:") + chalk14.white(" ccman cx list\n"));
4796
+ console.log(chalk16.blue("\u{1F4A1} \u67E5\u770B\u6240\u6709\u670D\u52A1\u5546:") + chalk16.white(" ccman cx list\n"));
4420
4797
  } else {
4421
- console.error(chalk14.red(`
4798
+ console.error(chalk16.red(`
4422
4799
  \u274C ${error.message}
4423
4800
  `));
4424
4801
  }
@@ -4429,28 +4806,30 @@ function useCommand(program2) {
4429
4806
 
4430
4807
  // src/commands/codex/current.ts
4431
4808
  init_dist2();
4432
- import chalk15 from "chalk";
4809
+ import chalk17 from "chalk";
4433
4810
  function currentCommand(program2) {
4434
4811
  program2.command("current").description("\u663E\u793A\u5F53\u524D\u4F7F\u7528\u7684 Codex \u670D\u52A1\u5546").action(async () => {
4435
4812
  try {
4436
4813
  const manager = createCodexManager();
4437
4814
  const current = manager.getCurrent();
4438
4815
  if (!current) {
4439
- console.log(chalk15.yellow("\n\u26A0\uFE0F \u672A\u9009\u62E9\u4EFB\u4F55 Codex \u670D\u52A1\u5546\n"));
4440
- console.log(chalk15.blue("\u{1F4A1} \u9009\u62E9\u670D\u52A1\u5546:") + chalk15.white(" ccman cx use\n"));
4816
+ printWarning("\u672A\u9009\u62E9\u4EFB\u4F55 Codex \u670D\u52A1\u5546");
4817
+ printTip("\u9009\u62E9\u670D\u52A1\u5546: " + chalk17.white("ccman cx use"));
4441
4818
  return;
4442
4819
  }
4443
- console.log(chalk15.bold("\n\u{1F4CD} \u5F53\u524D Codex \u670D\u52A1\u5546\n"));
4444
- console.log(` ${chalk15.green.bold(current.name)}`);
4445
- console.log(` ${chalk15.gray(`ID: ${current.id}`)}`);
4446
- console.log(` ${chalk15.gray(`URL: ${current.baseUrl}`)}`);
4820
+ const lines = [
4821
+ chalk17.green.bold(current.name),
4822
+ chalk17.gray(`ID: ${current.id}`),
4823
+ chalk17.gray(`URL: ${current.baseUrl}`)
4824
+ ];
4447
4825
  if (current.lastUsedAt) {
4448
- const date = new Date(current.lastUsedAt).toLocaleString("zh-CN");
4449
- console.log(` ${chalk15.gray(`\u6700\u540E\u4F7F\u7528: ${date}`)}`);
4826
+ lines.push(
4827
+ chalk17.gray(`\u6700\u540E\u4F7F\u7528: ${new Date(current.lastUsedAt).toLocaleString("zh-CN")}`)
4828
+ );
4450
4829
  }
4451
- console.log();
4830
+ printInfo("\u{1F4CD} \u5F53\u524D Codex \u670D\u52A1\u5546", lines);
4452
4831
  } catch (error) {
4453
- console.error(chalk15.red(`
4832
+ console.error(chalk17.red(`
4454
4833
  \u274C ${error.message}
4455
4834
  `));
4456
4835
  process.exit(1);
@@ -4460,16 +4839,17 @@ function currentCommand(program2) {
4460
4839
 
4461
4840
  // src/commands/codex/remove.ts
4462
4841
  init_dist2();
4463
- init_confirm();
4464
- import chalk16 from "chalk";
4465
- import inquirer10 from "inquirer";
4842
+ import chalk18 from "chalk";
4843
+ import inquirer8 from "inquirer";
4466
4844
  function removeCommand(program2) {
4467
- program2.command("remove [name]").alias("rm").description("\u5220\u9664 Codex \u670D\u52A1\u5546").action(async (name) => {
4845
+ const command = program2.command("remove [name]").alias("rm").description("\u5220\u9664 Codex \u670D\u52A1\u5546");
4846
+ addProviderRemoveOptions(command);
4847
+ command.action(async (name, options) => {
4468
4848
  try {
4469
4849
  const manager = createCodexManager();
4470
4850
  const providers = manager.list();
4471
4851
  if (providers.length === 0) {
4472
- console.log(chalk16.yellow("\n\u26A0\uFE0F \u6682\u65E0 Codex \u670D\u52A1\u5546\n"));
4852
+ console.log(chalk18.yellow("\n\u26A0\uFE0F \u6682\u65E0 Codex \u670D\u52A1\u5546\n"));
4473
4853
  return;
4474
4854
  }
4475
4855
  let targetId;
@@ -4481,8 +4861,10 @@ function removeCommand(program2) {
4481
4861
  }
4482
4862
  targetId = provider.id;
4483
4863
  targetName = provider.name;
4864
+ } else if (options.yes) {
4865
+ throw new Error("\u975E\u4EA4\u4E92\u6A21\u5F0F\u8BF7\u63D0\u4F9B\u8981\u5220\u9664\u7684\u670D\u52A1\u5546\u540D\u79F0");
4484
4866
  } else {
4485
- const { selectedId } = await inquirer10.prompt([
4867
+ const { selectedId } = await inquirer8.prompt([
4486
4868
  {
4487
4869
  type: "list",
4488
4870
  name: "selectedId",
@@ -4497,23 +4879,23 @@ function removeCommand(program2) {
4497
4879
  targetId = selectedId;
4498
4880
  targetName = provider.name;
4499
4881
  }
4500
- const confirmed = await promptConfirm(`\u786E\u5B9A\u5220\u9664 "${targetName}"?`, false);
4882
+ const confirmed = await confirmProviderRemoval(targetName, options);
4501
4883
  if (!confirmed) {
4502
- console.log(chalk16.gray("\n\u5DF2\u53D6\u6D88\n"));
4884
+ console.log(chalk18.gray("\n\u5DF2\u53D6\u6D88\n"));
4503
4885
  return;
4504
4886
  }
4505
4887
  manager.remove(targetId);
4506
4888
  console.log();
4507
- console.log(chalk16.green(`\u2705 \u5DF2\u5220\u9664: ${targetName}`));
4889
+ console.log(chalk18.green(`\u2705 \u5DF2\u5220\u9664: ${targetName}`));
4508
4890
  console.log();
4509
4891
  } catch (error) {
4510
4892
  if (error instanceof ProviderNotFoundError) {
4511
- console.error(chalk16.red(`
4893
+ console.error(chalk18.red(`
4512
4894
  \u274C \u670D\u52A1\u5546\u4E0D\u5B58\u5728
4513
4895
  `));
4514
- console.log(chalk16.blue("\u{1F4A1} \u67E5\u770B\u6240\u6709\u670D\u52A1\u5546:") + chalk16.white(" ccman cx list\n"));
4896
+ console.log(chalk18.blue("\u{1F4A1} \u67E5\u770B\u6240\u6709\u670D\u52A1\u5546:") + chalk18.white(" ccman cx list\n"));
4515
4897
  } else {
4516
- console.error(chalk16.red(`
4898
+ console.error(chalk18.red(`
4517
4899
  \u274C ${error.message}
4518
4900
  `));
4519
4901
  }
@@ -4524,17 +4906,20 @@ function removeCommand(program2) {
4524
4906
 
4525
4907
  // src/commands/codex/edit.ts
4526
4908
  init_dist2();
4527
- import chalk17 from "chalk";
4528
- import inquirer11 from "inquirer";
4909
+ import chalk19 from "chalk";
4910
+ import inquirer9 from "inquirer";
4529
4911
  function editCommand(program2) {
4530
- program2.command("edit [name]").description("\u7F16\u8F91 Codex \u670D\u52A1\u5546").action(async (name) => {
4912
+ const command = program2.command("edit [name]").description("\u7F16\u8F91 Codex \u670D\u52A1\u5546");
4913
+ addProviderEditOptions(command);
4914
+ command.action(async (name, options) => {
4531
4915
  try {
4532
4916
  const manager = createCodexManager();
4533
4917
  const providers = manager.list();
4534
4918
  if (providers.length === 0) {
4535
- console.log(chalk17.yellow("\n\u26A0\uFE0F \u6682\u65E0 Codex \u670D\u52A1\u5546\n"));
4919
+ console.log(chalk19.yellow("\n\u26A0\uFE0F \u6682\u65E0 Codex \u670D\u52A1\u5546\n"));
4536
4920
  return;
4537
4921
  }
4922
+ const resolved = resolveProviderEditInput(options);
4538
4923
  let targetId;
4539
4924
  if (name) {
4540
4925
  const provider2 = manager.findByName(name);
@@ -4542,8 +4927,10 @@ function editCommand(program2) {
4542
4927
  throw new ProviderNotFoundError(name);
4543
4928
  }
4544
4929
  targetId = provider2.id;
4930
+ } else if (resolved.nonInteractive) {
4931
+ throw new Error("\u975E\u4EA4\u4E92\u6A21\u5F0F\u8BF7\u63D0\u4F9B\u8981\u7F16\u8F91\u7684\u670D\u52A1\u5546\u540D\u79F0");
4545
4932
  } else {
4546
- const { selectedId } = await inquirer11.prompt([
4933
+ const { selectedId } = await inquirer9.prompt([
4547
4934
  {
4548
4935
  type: "list",
4549
4936
  name: "selectedId",
@@ -4557,9 +4944,24 @@ function editCommand(program2) {
4557
4944
  targetId = selectedId;
4558
4945
  }
4559
4946
  const provider = manager.get(targetId);
4560
- console.log(chalk17.bold("\n\u270F\uFE0F \u7F16\u8F91\u670D\u52A1\u5546\n"));
4561
- console.log(chalk17.gray("\u63D0\u793A: \u7559\u7A7A\u5219\u4FDD\u6301\u539F\u503C\n"));
4562
- const answers = await inquirer11.prompt([
4947
+ if (resolved.nonInteractive) {
4948
+ if (Object.keys(resolved.updates).length === 0) {
4949
+ console.log(chalk19.gray("\n\u672A\u505A\u4EFB\u4F55\u4FEE\u6539\n"));
4950
+ return;
4951
+ }
4952
+ const updated2 = manager.edit(targetId, resolved.updates);
4953
+ console.log();
4954
+ console.log(chalk19.green("\u2705 \u7F16\u8F91\u6210\u529F"));
4955
+ console.log();
4956
+ console.log(` ${chalk19.bold(updated2.name)} ${chalk19.blue("[Codex]")}`);
4957
+ console.log(` ${chalk19.gray(`ID: ${updated2.id}`)}`);
4958
+ console.log(` ${chalk19.gray(`URL: ${updated2.baseUrl}`)}`);
4959
+ console.log();
4960
+ return;
4961
+ }
4962
+ console.log(chalk19.bold("\n\u270F\uFE0F \u7F16\u8F91\u670D\u52A1\u5546\n"));
4963
+ console.log(chalk19.gray("\u63D0\u793A: \u7559\u7A7A\u5219\u4FDD\u6301\u539F\u503C\n"));
4964
+ const answers = await inquirer9.prompt([
4563
4965
  {
4564
4966
  type: "input",
4565
4967
  name: "name",
@@ -4590,19 +4992,19 @@ function editCommand(program2) {
4590
4992
  if (answers.baseUrl && answers.baseUrl !== provider.baseUrl) updates.baseUrl = answers.baseUrl;
4591
4993
  if (answers.apiKey) updates.apiKey = answers.apiKey;
4592
4994
  if (Object.keys(updates).length === 0) {
4593
- console.log(chalk17.gray("\n\u672A\u505A\u4EFB\u4F55\u4FEE\u6539\n"));
4995
+ console.log(chalk19.gray("\n\u672A\u505A\u4EFB\u4F55\u4FEE\u6539\n"));
4594
4996
  return;
4595
4997
  }
4596
4998
  const updated = manager.edit(targetId, updates);
4597
4999
  console.log();
4598
- console.log(chalk17.green("\u2705 \u7F16\u8F91\u6210\u529F"));
5000
+ console.log(chalk19.green("\u2705 \u7F16\u8F91\u6210\u529F"));
4599
5001
  console.log();
4600
- console.log(` ${chalk17.bold(updated.name)} ${chalk17.blue("[Codex]")}`);
4601
- console.log(` ${chalk17.gray(`ID: ${updated.id}`)}`);
4602
- console.log(` ${chalk17.gray(`URL: ${updated.baseUrl}`)}`);
5002
+ console.log(` ${chalk19.bold(updated.name)} ${chalk19.blue("[Codex]")}`);
5003
+ console.log(` ${chalk19.gray(`ID: ${updated.id}`)}`);
5004
+ console.log(` ${chalk19.gray(`URL: ${updated.baseUrl}`)}`);
4603
5005
  console.log();
4604
5006
  } catch (error) {
4605
- console.error(chalk17.red(`
5007
+ console.error(chalk19.red(`
4606
5008
  \u274C ${error.message}
4607
5009
  `));
4608
5010
  process.exit(1);
@@ -4612,15 +5014,15 @@ function editCommand(program2) {
4612
5014
 
4613
5015
  // src/commands/codex/clone.ts
4614
5016
  init_dist2();
4615
- import chalk18 from "chalk";
4616
- import inquirer12 from "inquirer";
5017
+ import chalk20 from "chalk";
5018
+ import inquirer10 from "inquirer";
4617
5019
  function cloneCommand(program2) {
4618
5020
  program2.command("clone [source-name] [new-name]").description("\u514B\u9686 Codex \u670D\u52A1\u5546").action(async (sourceName, newName) => {
4619
5021
  try {
4620
5022
  const manager = createCodexManager();
4621
5023
  const providers = manager.list();
4622
5024
  if (providers.length === 0) {
4623
- console.log(chalk18.yellow("\n\u26A0\uFE0F \u6682\u65E0 Codex \u670D\u52A1\u5546\n"));
5025
+ console.log(chalk20.yellow("\n\u26A0\uFE0F \u6682\u65E0 Codex \u670D\u52A1\u5546\n"));
4624
5026
  return;
4625
5027
  }
4626
5028
  let sourceId;
@@ -4631,7 +5033,7 @@ function cloneCommand(program2) {
4631
5033
  }
4632
5034
  sourceId = provider.id;
4633
5035
  } else {
4634
- const { selectedId } = await inquirer12.prompt([
5036
+ const { selectedId } = await inquirer10.prompt([
4635
5037
  {
4636
5038
  type: "list",
4637
5039
  name: "selectedId",
@@ -4649,7 +5051,7 @@ function cloneCommand(program2) {
4649
5051
  if (newName) {
4650
5052
  cloned = manager.clone(sourceId, newName);
4651
5053
  } else {
4652
- console.log(chalk18.blue(`
5054
+ console.log(chalk20.blue(`
4653
5055
  \u514B\u9686\u81EA: ${source.name}
4654
5056
  `));
4655
5057
  const input = await promptProviderForm({
@@ -4662,14 +5064,14 @@ function cloneCommand(program2) {
4662
5064
  cloned = manager.add(input);
4663
5065
  }
4664
5066
  console.log();
4665
- console.log(chalk18.green("\u2705 \u514B\u9686\u6210\u529F"));
5067
+ console.log(chalk20.green("\u2705 \u514B\u9686\u6210\u529F"));
4666
5068
  console.log();
4667
- console.log(` ${chalk18.bold(cloned.name)} ${chalk18.blue("[Codex]")}`);
4668
- console.log(` ${chalk18.gray(`ID: ${cloned.id}`)}`);
4669
- console.log(` ${chalk18.gray(`URL: ${cloned.baseUrl}`)}`);
5069
+ console.log(` ${chalk20.bold(cloned.name)} ${chalk20.blue("[Codex]")}`);
5070
+ console.log(` ${chalk20.gray(`ID: ${cloned.id}`)}`);
5071
+ console.log(` ${chalk20.gray(`URL: ${cloned.baseUrl}`)}`);
4670
5072
  console.log();
4671
5073
  } catch (error) {
4672
- console.error(chalk18.red(`
5074
+ console.error(chalk20.red(`
4673
5075
  \u274C ${error.message}
4674
5076
  `));
4675
5077
  process.exit(1);
@@ -4690,15 +5092,32 @@ function createCodexCommands(program2) {
4690
5092
 
4691
5093
  // src/commands/claude/add.ts
4692
5094
  init_dist2();
4693
- import chalk19 from "chalk";
4694
- import inquirer13 from "inquirer";
5095
+ import chalk21 from "chalk";
5096
+ import inquirer11 from "inquirer";
4695
5097
  init_confirm();
4696
5098
  function addCommand2(program2) {
4697
- program2.command("add").description("\u6DFB\u52A0\u65B0\u7684 Claude Code \u670D\u52A1\u5546(\u4EA4\u4E92\u5F0F)").action(async () => {
5099
+ const command = program2.command("add").description("\u6DFB\u52A0\u65B0\u7684 Claude Code \u670D\u52A1\u5546");
5100
+ addProviderAddOptions(command);
5101
+ command.action(async (options) => {
4698
5102
  try {
4699
5103
  const manager = createClaudeManager();
4700
- console.log(chalk19.bold("\n\u{1F4DD} \u6DFB\u52A0 Claude Code \u670D\u52A1\u5546\n"));
4701
- const { usePreset } = await inquirer13.prompt([
5104
+ console.log(chalk21.bold("\n\u{1F4DD} \u6DFB\u52A0 Claude Code \u670D\u52A1\u5546\n"));
5105
+ const resolved = resolveProviderAddInput(options, CC_PRESETS);
5106
+ if (resolved.nonInteractive && resolved.input) {
5107
+ const provider2 = manager.add(resolved.input);
5108
+ printSuccess("\u6DFB\u52A0\u6210\u529F", [
5109
+ `${chalk21.bold(provider2.name)} ${toolBadge("claude")}`,
5110
+ chalk21.gray(provider2.baseUrl)
5111
+ ]);
5112
+ if (resolved.switchNow) {
5113
+ manager.switch(provider2.id);
5114
+ printSuccess("\u5DF2\u5207\u6362\u5230\u65B0\u670D\u52A1\u5546", [chalk21.gray(`\u914D\u7F6E\u5DF2\u66F4\u65B0: ${getClaudeConfigPath()}`)]);
5115
+ } else {
5116
+ printTip(`\u7A0D\u540E\u5207\u6362: ${chalk21.white(`ccman cc use "${provider2.name}"`)}`);
5117
+ }
5118
+ return;
5119
+ }
5120
+ const { usePreset } = await inquirer11.prompt([
4702
5121
  {
4703
5122
  type: "list",
4704
5123
  name: "usePreset",
@@ -4714,7 +5133,7 @@ function addCommand2(program2) {
4714
5133
  let baseUrl;
4715
5134
  let apiKey;
4716
5135
  if (usePreset) {
4717
- const { presetName } = await inquirer13.prompt([
5136
+ const { presetName } = await inquirer11.prompt([
4718
5137
  {
4719
5138
  type: "list",
4720
5139
  name: "presetName",
@@ -4726,7 +5145,7 @@ function addCommand2(program2) {
4726
5145
  }
4727
5146
  ]);
4728
5147
  const preset = CC_PRESETS.find((p) => p.name === presetName);
4729
- console.log(chalk19.blue(`
5148
+ console.log(chalk21.blue(`
4730
5149
  \u4F7F\u7528\u9884\u8BBE: ${preset.name} - ${preset.description}
4731
5150
  `));
4732
5151
  const input = await promptProviderForm({
@@ -4740,7 +5159,7 @@ function addCommand2(program2) {
4740
5159
  baseUrl = input.baseUrl;
4741
5160
  apiKey = input.apiKey;
4742
5161
  } else {
4743
- const answers = await inquirer13.prompt([
5162
+ const answers = await inquirer11.prompt([
4744
5163
  {
4745
5164
  type: "input",
4746
5165
  name: "name",
@@ -4779,24 +5198,19 @@ function addCommand2(program2) {
4779
5198
  apiKey = answers.apiKey;
4780
5199
  }
4781
5200
  const provider = manager.add({ name, desc, baseUrl, apiKey });
4782
- console.log();
4783
- console.log(chalk19.green("\u2705 \u6DFB\u52A0\u6210\u529F"));
4784
- console.log();
4785
- console.log(` ${chalk19.bold(provider.name)} ${chalk19.blue("[Claude Code]")}`);
4786
- console.log(` ${chalk19.gray(provider.baseUrl)}`);
4787
- console.log();
5201
+ printSuccess("\u6DFB\u52A0\u6210\u529F", [
5202
+ `${chalk21.bold(provider.name)} ${toolBadge("claude")}`,
5203
+ chalk21.gray(provider.baseUrl)
5204
+ ]);
4788
5205
  const switchNow = await promptConfirm("\u662F\u5426\u7ACB\u5373\u5207\u6362\u5230\u6B64\u670D\u52A1\u5546?", true);
4789
5206
  if (switchNow) {
4790
5207
  manager.switch(provider.id);
4791
- console.log(chalk19.green("\u2705 \u5DF2\u5207\u6362\u5230\u65B0\u670D\u52A1\u5546"));
4792
- console.log();
4793
- console.log(chalk19.gray("\u914D\u7F6E\u5DF2\u66F4\u65B0:"));
4794
- console.log(chalk19.gray(` - ${getClaudeConfigPath()}`));
5208
+ printSuccess("\u5DF2\u5207\u6362\u5230\u65B0\u670D\u52A1\u5546", [chalk21.gray(`\u914D\u7F6E\u5DF2\u66F4\u65B0: ${getClaudeConfigPath()}`)]);
4795
5209
  } else {
4796
- console.log(chalk19.blue("\u{1F4A1} \u7A0D\u540E\u5207\u6362:") + chalk19.white(` ccman cc use "${provider.name}"`));
5210
+ printTip(`\u7A0D\u540E\u5207\u6362: ${chalk21.white(`ccman cc use "${provider.name}"`)}`);
4797
5211
  }
4798
5212
  } catch (error) {
4799
- console.error(chalk19.red(`
5213
+ console.error(chalk21.red(`
4800
5214
  \u274C ${error.message}
4801
5215
  `));
4802
5216
  process.exit(1);
@@ -4806,7 +5220,7 @@ function addCommand2(program2) {
4806
5220
 
4807
5221
  // src/commands/claude/list.ts
4808
5222
  init_dist2();
4809
- import chalk20 from "chalk";
5223
+ import chalk22 from "chalk";
4810
5224
  function listCommand2(program2) {
4811
5225
  program2.command("list").alias("ls").description("\u5217\u51FA\u6240\u6709 Claude Code \u670D\u52A1\u5546").action(async () => {
4812
5226
  try {
@@ -4814,15 +5228,15 @@ function listCommand2(program2) {
4814
5228
  const providers = manager.list();
4815
5229
  const current = manager.getCurrent();
4816
5230
  if (providers.length === 0) {
4817
- console.log(chalk20.yellow("\n\u26A0\uFE0F \u6682\u65E0 Claude Code \u670D\u52A1\u5546\n"));
4818
- console.log(chalk20.blue("\u{1F4A1} \u6DFB\u52A0\u670D\u52A1\u5546:") + chalk20.white(" ccman cc add\n"));
5231
+ printWarning("\u6682\u65E0 Claude Code \u670D\u52A1\u5546");
5232
+ printTip("\u6DFB\u52A0\u670D\u52A1\u5546: " + chalk22.white("ccman cc add"));
4819
5233
  return;
4820
5234
  }
4821
- console.log(chalk20.bold(`
4822
- \u{1F4CB} Claude Code \u670D\u52A1\u5546 (${providers.length} \u4E2A)`));
4823
- console.log(formatProviderTable(providers, current?.id));
5235
+ console.log(
5236
+ formatProviderTable(providers, current?.id, `Claude Code \u670D\u52A1\u5546 (${providers.length} \u4E2A)`)
5237
+ );
4824
5238
  } catch (error) {
4825
- console.error(chalk20.red(`
5239
+ console.error(chalk22.red(`
4826
5240
  \u274C ${error.message}
4827
5241
  `));
4828
5242
  process.exit(1);
@@ -4832,16 +5246,16 @@ function listCommand2(program2) {
4832
5246
 
4833
5247
  // src/commands/claude/use.ts
4834
5248
  init_dist2();
4835
- import chalk21 from "chalk";
4836
- import inquirer14 from "inquirer";
5249
+ import chalk23 from "chalk";
5250
+ import inquirer12 from "inquirer";
4837
5251
  function useCommand2(program2) {
4838
5252
  program2.command("use [name]").description("\u5207\u6362 Claude Code \u670D\u52A1\u5546").action(async (name) => {
4839
5253
  try {
4840
5254
  const manager = createClaudeManager();
4841
5255
  const providers = manager.list();
4842
5256
  if (providers.length === 0) {
4843
- console.log(chalk21.yellow("\n\u26A0\uFE0F \u6682\u65E0 Claude Code \u670D\u52A1\u5546\n"));
4844
- console.log(chalk21.blue("\u{1F4A1} \u6DFB\u52A0\u670D\u52A1\u5546:") + chalk21.white(" ccman cc add\n"));
5257
+ printWarning("\u6682\u65E0 Claude Code \u670D\u52A1\u5546");
5258
+ printTip("\u6DFB\u52A0\u670D\u52A1\u5546: " + chalk23.white("ccman cc add"));
4845
5259
  return;
4846
5260
  }
4847
5261
  let targetId;
@@ -4852,7 +5266,7 @@ function useCommand2(program2) {
4852
5266
  }
4853
5267
  targetId = provider2.id;
4854
5268
  } else {
4855
- const { selectedId } = await inquirer14.prompt([
5269
+ const { selectedId } = await inquirer12.prompt([
4856
5270
  {
4857
5271
  type: "list",
4858
5272
  name: "selectedId",
@@ -4867,23 +5281,19 @@ function useCommand2(program2) {
4867
5281
  }
4868
5282
  manager.switch(targetId);
4869
5283
  const provider = manager.get(targetId);
4870
- console.log();
4871
- console.log(chalk21.green("\u2705 \u5207\u6362\u6210\u529F"));
4872
- console.log();
4873
- console.log(` ${chalk21.bold(provider.name)} ${chalk21.blue("[Claude Code]")}`);
4874
- console.log(` ${chalk21.gray(`URL: ${provider.baseUrl}`)}`);
4875
- console.log();
4876
- console.log(chalk21.gray("\u914D\u7F6E\u5DF2\u66F4\u65B0:"));
4877
- console.log(chalk21.gray(` - ${getClaudeConfigPath()}`));
4878
- console.log();
5284
+ printSuccess("\u5207\u6362\u6210\u529F", [
5285
+ `${chalk23.bold(provider.name)} ${toolBadge("claude")}`,
5286
+ chalk23.gray(`URL: ${provider.baseUrl}`),
5287
+ chalk23.gray(`\u914D\u7F6E\u5DF2\u66F4\u65B0: ${getClaudeConfigPath()}`)
5288
+ ]);
4879
5289
  } catch (error) {
4880
5290
  if (error instanceof ProviderNotFoundError) {
4881
- console.error(chalk21.red(`
5291
+ console.error(chalk23.red(`
4882
5292
  \u274C \u670D\u52A1\u5546\u4E0D\u5B58\u5728: ${error.message}
4883
5293
  `));
4884
- console.log(chalk21.blue("\u{1F4A1} \u67E5\u770B\u6240\u6709\u670D\u52A1\u5546:") + chalk21.white(" ccman cc list\n"));
5294
+ console.log(chalk23.blue("\u{1F4A1} \u67E5\u770B\u6240\u6709\u670D\u52A1\u5546:") + chalk23.white(" ccman cc list\n"));
4885
5295
  } else {
4886
- console.error(chalk21.red(`
5296
+ console.error(chalk23.red(`
4887
5297
  \u274C ${error.message}
4888
5298
  `));
4889
5299
  }
@@ -4894,28 +5304,30 @@ function useCommand2(program2) {
4894
5304
 
4895
5305
  // src/commands/claude/current.ts
4896
5306
  init_dist2();
4897
- import chalk22 from "chalk";
5307
+ import chalk24 from "chalk";
4898
5308
  function currentCommand2(program2) {
4899
5309
  program2.command("current").description("\u663E\u793A\u5F53\u524D\u4F7F\u7528\u7684 Claude Code \u670D\u52A1\u5546").action(async () => {
4900
5310
  try {
4901
5311
  const manager = createClaudeManager();
4902
5312
  const current = manager.getCurrent();
4903
5313
  if (!current) {
4904
- console.log(chalk22.yellow("\n\u26A0\uFE0F \u672A\u9009\u62E9\u4EFB\u4F55 Claude Code \u670D\u52A1\u5546\n"));
4905
- console.log(chalk22.blue("\u{1F4A1} \u9009\u62E9\u670D\u52A1\u5546:") + chalk22.white(" ccman cc use\n"));
5314
+ printWarning("\u672A\u9009\u62E9\u4EFB\u4F55 Claude Code \u670D\u52A1\u5546");
5315
+ printTip("\u9009\u62E9\u670D\u52A1\u5546: " + chalk24.white("ccman cc use"));
4906
5316
  return;
4907
5317
  }
4908
- console.log(chalk22.bold("\n\u{1F4CD} \u5F53\u524D Claude Code \u670D\u52A1\u5546\n"));
4909
- console.log(` ${chalk22.green.bold(current.name)}`);
4910
- console.log(` ${chalk22.gray(`ID: ${current.id}`)}`);
4911
- console.log(` ${chalk22.gray(`URL: ${current.baseUrl}`)}`);
5318
+ const lines = [
5319
+ chalk24.green.bold(current.name),
5320
+ chalk24.gray(`ID: ${current.id}`),
5321
+ chalk24.gray(`URL: ${current.baseUrl}`)
5322
+ ];
4912
5323
  if (current.lastUsedAt) {
4913
- const date = new Date(current.lastUsedAt).toLocaleString("zh-CN");
4914
- console.log(` ${chalk22.gray(`\u6700\u540E\u4F7F\u7528: ${date}`)}`);
5324
+ lines.push(
5325
+ chalk24.gray(`\u6700\u540E\u4F7F\u7528: ${new Date(current.lastUsedAt).toLocaleString("zh-CN")}`)
5326
+ );
4915
5327
  }
4916
- console.log();
5328
+ printInfo("\u{1F4CD} \u5F53\u524D Claude Code \u670D\u52A1\u5546", lines);
4917
5329
  } catch (error) {
4918
- console.error(chalk22.red(`
5330
+ console.error(chalk24.red(`
4919
5331
  \u274C ${error.message}
4920
5332
  `));
4921
5333
  process.exit(1);
@@ -4925,16 +5337,17 @@ function currentCommand2(program2) {
4925
5337
 
4926
5338
  // src/commands/claude/remove.ts
4927
5339
  init_dist2();
4928
- init_confirm();
4929
- import chalk23 from "chalk";
4930
- import inquirer15 from "inquirer";
5340
+ import chalk25 from "chalk";
5341
+ import inquirer13 from "inquirer";
4931
5342
  function removeCommand2(program2) {
4932
- program2.command("remove [name]").alias("rm").description("\u5220\u9664 Claude Code \u670D\u52A1\u5546").action(async (name) => {
5343
+ const command = program2.command("remove [name]").alias("rm").description("\u5220\u9664 Claude Code \u670D\u52A1\u5546");
5344
+ addProviderRemoveOptions(command);
5345
+ command.action(async (name, options) => {
4933
5346
  try {
4934
5347
  const manager = createClaudeManager();
4935
5348
  const providers = manager.list();
4936
5349
  if (providers.length === 0) {
4937
- console.log(chalk23.yellow("\n\u26A0\uFE0F \u6682\u65E0 Claude Code \u670D\u52A1\u5546\n"));
5350
+ console.log(chalk25.yellow("\n\u26A0\uFE0F \u6682\u65E0 Claude Code \u670D\u52A1\u5546\n"));
4938
5351
  return;
4939
5352
  }
4940
5353
  let targetId;
@@ -4946,8 +5359,10 @@ function removeCommand2(program2) {
4946
5359
  }
4947
5360
  targetId = provider.id;
4948
5361
  targetName = provider.name;
5362
+ } else if (options.yes) {
5363
+ throw new Error("\u975E\u4EA4\u4E92\u6A21\u5F0F\u8BF7\u63D0\u4F9B\u8981\u5220\u9664\u7684\u670D\u52A1\u5546\u540D\u79F0");
4949
5364
  } else {
4950
- const { selectedId } = await inquirer15.prompt([
5365
+ const { selectedId } = await inquirer13.prompt([
4951
5366
  {
4952
5367
  type: "list",
4953
5368
  name: "selectedId",
@@ -4962,23 +5377,23 @@ function removeCommand2(program2) {
4962
5377
  targetId = selectedId;
4963
5378
  targetName = provider.name;
4964
5379
  }
4965
- const confirmed = await promptConfirm(`\u786E\u5B9A\u5220\u9664 "${targetName}"?`, false);
5380
+ const confirmed = await confirmProviderRemoval(targetName, options);
4966
5381
  if (!confirmed) {
4967
- console.log(chalk23.gray("\n\u5DF2\u53D6\u6D88\n"));
5382
+ console.log(chalk25.gray("\n\u5DF2\u53D6\u6D88\n"));
4968
5383
  return;
4969
5384
  }
4970
5385
  manager.remove(targetId);
4971
5386
  console.log();
4972
- console.log(chalk23.green(`\u2705 \u5DF2\u5220\u9664: ${targetName}`));
5387
+ console.log(chalk25.green(`\u2705 \u5DF2\u5220\u9664: ${targetName}`));
4973
5388
  console.log();
4974
5389
  } catch (error) {
4975
5390
  if (error instanceof ProviderNotFoundError) {
4976
- console.error(chalk23.red(`
5391
+ console.error(chalk25.red(`
4977
5392
  \u274C \u670D\u52A1\u5546\u4E0D\u5B58\u5728
4978
5393
  `));
4979
- console.log(chalk23.blue("\u{1F4A1} \u67E5\u770B\u6240\u6709\u670D\u52A1\u5546:") + chalk23.white(" ccman cc list\n"));
5394
+ console.log(chalk25.blue("\u{1F4A1} \u67E5\u770B\u6240\u6709\u670D\u52A1\u5546:") + chalk25.white(" ccman cc list\n"));
4980
5395
  } else {
4981
- console.error(chalk23.red(`
5396
+ console.error(chalk25.red(`
4982
5397
  \u274C ${error.message}
4983
5398
  `));
4984
5399
  }
@@ -4989,17 +5404,20 @@ function removeCommand2(program2) {
4989
5404
 
4990
5405
  // src/commands/claude/edit.ts
4991
5406
  init_dist2();
4992
- import chalk24 from "chalk";
4993
- import inquirer16 from "inquirer";
5407
+ import chalk26 from "chalk";
5408
+ import inquirer14 from "inquirer";
4994
5409
  function editCommand2(program2) {
4995
- program2.command("edit [name]").description("\u7F16\u8F91 Claude Code \u670D\u52A1\u5546").action(async (name) => {
5410
+ const command = program2.command("edit [name]").description("\u7F16\u8F91 Claude Code \u670D\u52A1\u5546");
5411
+ addProviderEditOptions(command);
5412
+ command.action(async (name, options) => {
4996
5413
  try {
4997
5414
  const manager = createClaudeManager();
4998
5415
  const providers = manager.list();
4999
5416
  if (providers.length === 0) {
5000
- console.log(chalk24.yellow("\n\u26A0\uFE0F \u6682\u65E0 Claude Code \u670D\u52A1\u5546\n"));
5417
+ console.log(chalk26.yellow("\n\u26A0\uFE0F \u6682\u65E0 Claude Code \u670D\u52A1\u5546\n"));
5001
5418
  return;
5002
5419
  }
5420
+ const resolved = resolveProviderEditInput(options);
5003
5421
  let targetId;
5004
5422
  if (name) {
5005
5423
  const provider2 = manager.findByName(name);
@@ -5007,8 +5425,10 @@ function editCommand2(program2) {
5007
5425
  throw new ProviderNotFoundError(name);
5008
5426
  }
5009
5427
  targetId = provider2.id;
5428
+ } else if (resolved.nonInteractive) {
5429
+ throw new Error("\u975E\u4EA4\u4E92\u6A21\u5F0F\u8BF7\u63D0\u4F9B\u8981\u7F16\u8F91\u7684\u670D\u52A1\u5546\u540D\u79F0");
5010
5430
  } else {
5011
- const { selectedId } = await inquirer16.prompt([
5431
+ const { selectedId } = await inquirer14.prompt([
5012
5432
  {
5013
5433
  type: "list",
5014
5434
  name: "selectedId",
@@ -5022,9 +5442,24 @@ function editCommand2(program2) {
5022
5442
  targetId = selectedId;
5023
5443
  }
5024
5444
  const provider = manager.get(targetId);
5025
- console.log(chalk24.bold("\n\u270F\uFE0F \u7F16\u8F91\u670D\u52A1\u5546\n"));
5026
- console.log(chalk24.gray("\u63D0\u793A: \u7559\u7A7A\u5219\u4FDD\u6301\u539F\u503C\n"));
5027
- const answers = await inquirer16.prompt([
5445
+ if (resolved.nonInteractive) {
5446
+ if (Object.keys(resolved.updates).length === 0) {
5447
+ console.log(chalk26.gray("\n\u672A\u505A\u4EFB\u4F55\u4FEE\u6539\n"));
5448
+ return;
5449
+ }
5450
+ const updated2 = manager.edit(targetId, resolved.updates);
5451
+ console.log();
5452
+ console.log(chalk26.green("\u2705 \u7F16\u8F91\u6210\u529F"));
5453
+ console.log();
5454
+ console.log(` ${chalk26.bold(updated2.name)} ${chalk26.blue("[Claude Code]")}`);
5455
+ console.log(` ${chalk26.gray(`ID: ${updated2.id}`)}`);
5456
+ console.log(` ${chalk26.gray(`URL: ${updated2.baseUrl}`)}`);
5457
+ console.log();
5458
+ return;
5459
+ }
5460
+ console.log(chalk26.bold("\n\u270F\uFE0F \u7F16\u8F91\u670D\u52A1\u5546\n"));
5461
+ console.log(chalk26.gray("\u63D0\u793A: \u7559\u7A7A\u5219\u4FDD\u6301\u539F\u503C\n"));
5462
+ const answers = await inquirer14.prompt([
5028
5463
  {
5029
5464
  type: "input",
5030
5465
  name: "name",
@@ -5055,19 +5490,19 @@ function editCommand2(program2) {
5055
5490
  if (answers.baseUrl && answers.baseUrl !== provider.baseUrl) updates.baseUrl = answers.baseUrl;
5056
5491
  if (answers.apiKey) updates.apiKey = answers.apiKey;
5057
5492
  if (Object.keys(updates).length === 0) {
5058
- console.log(chalk24.gray("\n\u672A\u505A\u4EFB\u4F55\u4FEE\u6539\n"));
5493
+ console.log(chalk26.gray("\n\u672A\u505A\u4EFB\u4F55\u4FEE\u6539\n"));
5059
5494
  return;
5060
5495
  }
5061
5496
  const updated = manager.edit(targetId, updates);
5062
5497
  console.log();
5063
- console.log(chalk24.green("\u2705 \u7F16\u8F91\u6210\u529F"));
5498
+ console.log(chalk26.green("\u2705 \u7F16\u8F91\u6210\u529F"));
5064
5499
  console.log();
5065
- console.log(` ${chalk24.bold(updated.name)} ${chalk24.blue("[Claude Code]")}`);
5066
- console.log(` ${chalk24.gray(`ID: ${updated.id}`)}`);
5067
- console.log(` ${chalk24.gray(`URL: ${updated.baseUrl}`)}`);
5500
+ console.log(` ${chalk26.bold(updated.name)} ${chalk26.blue("[Claude Code]")}`);
5501
+ console.log(` ${chalk26.gray(`ID: ${updated.id}`)}`);
5502
+ console.log(` ${chalk26.gray(`URL: ${updated.baseUrl}`)}`);
5068
5503
  console.log();
5069
5504
  } catch (error) {
5070
- console.error(chalk24.red(`
5505
+ console.error(chalk26.red(`
5071
5506
  \u274C ${error.message}
5072
5507
  `));
5073
5508
  process.exit(1);
@@ -5077,15 +5512,15 @@ function editCommand2(program2) {
5077
5512
 
5078
5513
  // src/commands/claude/clone.ts
5079
5514
  init_dist2();
5080
- import chalk25 from "chalk";
5081
- import inquirer17 from "inquirer";
5515
+ import chalk27 from "chalk";
5516
+ import inquirer15 from "inquirer";
5082
5517
  function cloneCommand2(program2) {
5083
5518
  program2.command("clone [source-name] [new-name]").description("\u514B\u9686 Claude Code \u670D\u52A1\u5546").action(async (sourceName, newName) => {
5084
5519
  try {
5085
5520
  const manager = createClaudeManager();
5086
5521
  const providers = manager.list();
5087
5522
  if (providers.length === 0) {
5088
- console.log(chalk25.yellow("\n\u26A0\uFE0F \u6682\u65E0 Claude Code \u670D\u52A1\u5546\n"));
5523
+ console.log(chalk27.yellow("\n\u26A0\uFE0F \u6682\u65E0 Claude Code \u670D\u52A1\u5546\n"));
5089
5524
  return;
5090
5525
  }
5091
5526
  let sourceId;
@@ -5096,7 +5531,7 @@ function cloneCommand2(program2) {
5096
5531
  }
5097
5532
  sourceId = provider.id;
5098
5533
  } else {
5099
- const { selectedId } = await inquirer17.prompt([
5534
+ const { selectedId } = await inquirer15.prompt([
5100
5535
  {
5101
5536
  type: "list",
5102
5537
  name: "selectedId",
@@ -5114,7 +5549,7 @@ function cloneCommand2(program2) {
5114
5549
  if (newName) {
5115
5550
  cloned = manager.clone(sourceId, newName);
5116
5551
  } else {
5117
- console.log(chalk25.blue(`
5552
+ console.log(chalk27.blue(`
5118
5553
  \u514B\u9686\u81EA: ${source.name}
5119
5554
  `));
5120
5555
  const input = await promptProviderForm({
@@ -5127,14 +5562,14 @@ function cloneCommand2(program2) {
5127
5562
  cloned = manager.add(input);
5128
5563
  }
5129
5564
  console.log();
5130
- console.log(chalk25.green("\u2705 \u514B\u9686\u6210\u529F"));
5565
+ console.log(chalk27.green("\u2705 \u514B\u9686\u6210\u529F"));
5131
5566
  console.log();
5132
- console.log(` ${chalk25.bold(cloned.name)} ${chalk25.blue("[Claude Code]")}`);
5133
- console.log(` ${chalk25.gray(`ID: ${cloned.id}`)}`);
5134
- console.log(` ${chalk25.gray(`URL: ${cloned.baseUrl}`)}`);
5567
+ console.log(` ${chalk27.bold(cloned.name)} ${chalk27.blue("[Claude Code]")}`);
5568
+ console.log(` ${chalk27.gray(`ID: ${cloned.id}`)}`);
5569
+ console.log(` ${chalk27.gray(`URL: ${cloned.baseUrl}`)}`);
5135
5570
  console.log();
5136
5571
  } catch (error) {
5137
- console.error(chalk25.red(`
5572
+ console.error(chalk27.red(`
5138
5573
  \u274C ${error.message}
5139
5574
  `));
5140
5575
  process.exit(1);
@@ -5145,8 +5580,8 @@ function cloneCommand2(program2) {
5145
5580
  // src/commands/clean.ts
5146
5581
  init_dist2();
5147
5582
  init_confirm();
5148
- import chalk26 from "chalk";
5149
- import inquirer18 from "inquirer";
5583
+ import chalk28 from "chalk";
5584
+ import inquirer16 from "inquirer";
5150
5585
  function formatBytes2(bytes) {
5151
5586
  if (bytes < 1024) return `${bytes} B`;
5152
5587
  if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;
@@ -5154,30 +5589,30 @@ function formatBytes2(bytes) {
5154
5589
  }
5155
5590
  function displayAnalysis() {
5156
5591
  try {
5157
- console.log(chalk26.bold("\n\u{1F4CA} \u5206\u6790 ~/.claude.json\n"));
5592
+ console.log(chalk28.bold("\n\u{1F4CA} \u5206\u6790 ~/.claude.json\n"));
5158
5593
  const analysis = analyzeClaudeJson();
5159
- console.log(chalk26.cyan("\u6587\u4EF6\u5927\u5C0F:"), chalk26.bold(analysis.fileSizeFormatted));
5594
+ console.log(chalk28.cyan("\u6587\u4EF6\u5927\u5C0F:"), chalk28.bold(analysis.fileSizeFormatted));
5160
5595
  console.log();
5161
- console.log(chalk26.cyan("\u9879\u76EE\u7EDF\u8BA1:"));
5162
- console.log(` \u9879\u76EE\u603B\u6570: ${chalk26.bold(analysis.projectCount)}`);
5163
- console.log(` \u5386\u53F2\u8BB0\u5F55\u603B\u6570: ${chalk26.bold(analysis.totalHistoryCount)} \u6761`);
5596
+ console.log(chalk28.cyan("\u9879\u76EE\u7EDF\u8BA1:"));
5597
+ console.log(` \u9879\u76EE\u603B\u6570: ${chalk28.bold(analysis.projectCount)}`);
5598
+ console.log(` \u5386\u53F2\u8BB0\u5F55\u603B\u6570: ${chalk28.bold(analysis.totalHistoryCount)} \u6761`);
5164
5599
  console.log();
5165
- console.log(chalk26.cyan("\u5386\u53F2\u8BB0\u5F55\u6700\u591A\u7684\u9879\u76EE:"));
5600
+ console.log(chalk28.cyan("\u5386\u53F2\u8BB0\u5F55\u6700\u591A\u7684\u9879\u76EE:"));
5166
5601
  const top5 = analysis.projectHistory.slice(0, 5);
5167
5602
  for (const project of top5) {
5168
5603
  const displayPath = project.path.length > 50 ? "..." + project.path.slice(-47) : project.path;
5169
- console.log(` ${chalk26.bold(project.count.toString().padStart(3))} \u6761 ${displayPath}`);
5604
+ console.log(` ${chalk28.bold(project.count.toString().padStart(3))} \u6761 ${displayPath}`);
5170
5605
  }
5171
5606
  console.log();
5172
- console.log(chalk26.cyan("\u9884\u8BA1\u53EF\u8282\u7701\u7A7A\u95F4:"));
5173
- console.log(` ${chalk26.green("\u4FDD\u5B88\u6E05\u7406")} (\u4FDD\u755910\u6761): ${chalk26.bold(formatBytes2(analysis.estimatedSavings.conservative))}`);
5174
- console.log(` ${chalk26.yellow("\u4E2D\u7B49\u6E05\u7406")} (\u4FDD\u75595\u6761): ${chalk26.bold(formatBytes2(analysis.estimatedSavings.moderate))}`);
5175
- console.log(` ${chalk26.red("\u6FC0\u8FDB\u6E05\u7406")} (\u6E05\u7A7A\u5386\u53F2): ${chalk26.bold(formatBytes2(analysis.estimatedSavings.aggressive))}`);
5607
+ console.log(chalk28.cyan("\u9884\u8BA1\u53EF\u8282\u7701\u7A7A\u95F4:"));
5608
+ console.log(` ${chalk28.green("\u4FDD\u5B88\u6E05\u7406")} (\u4FDD\u755910\u6761): ${chalk28.bold(formatBytes2(analysis.estimatedSavings.conservative))}`);
5609
+ console.log(` ${chalk28.yellow("\u4E2D\u7B49\u6E05\u7406")} (\u4FDD\u75595\u6761): ${chalk28.bold(formatBytes2(analysis.estimatedSavings.moderate))}`);
5610
+ console.log(` ${chalk28.red("\u6FC0\u8FDB\u6E05\u7406")} (\u6E05\u7A7A\u5386\u53F2): ${chalk28.bold(formatBytes2(analysis.estimatedSavings.aggressive))}`);
5176
5611
  console.log();
5177
- console.log(chalk26.blue(`\u{1F4A1} \u6267\u884C\u6E05\u7406: ccman cc clean
5612
+ console.log(chalk28.blue(`\u{1F4A1} \u6267\u884C\u6E05\u7406: ccman cc clean
5178
5613
  `));
5179
5614
  } catch (error) {
5180
- console.error(chalk26.red(`
5615
+ console.error(chalk28.red(`
5181
5616
  \u274C ${error.message}
5182
5617
  `));
5183
5618
  process.exit(1);
@@ -5191,9 +5626,9 @@ function cleanAnalyzeCommand(program2) {
5191
5626
  function cleanCommand(program2) {
5192
5627
  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) => {
5193
5628
  try {
5194
- console.log(chalk26.bold("\n\u{1F9F9} \u6E05\u7406 ~/.claude.json\n"));
5629
+ console.log(chalk28.bold("\n\u{1F9F9} \u6E05\u7406 ~/.claude.json\n"));
5195
5630
  const analysis = analyzeClaudeJson();
5196
- console.log(`\u5F53\u524D\u6587\u4EF6\u5927\u5C0F: ${chalk26.bold(analysis.fileSizeFormatted)}`);
5631
+ console.log(`\u5F53\u524D\u6587\u4EF6\u5927\u5C0F: ${chalk28.bold(analysis.fileSizeFormatted)}`);
5197
5632
  console.log(`\u9879\u76EE\u6570: ${analysis.projectCount}, \u5386\u53F2\u8BB0\u5F55: ${analysis.totalHistoryCount} \u6761`);
5198
5633
  console.log();
5199
5634
  let cleanOptions;
@@ -5204,30 +5639,30 @@ function cleanCommand(program2) {
5204
5639
  }
5205
5640
  const confirmed = await promptConfirm("\u786E\u8BA4\u6267\u884C\u6E05\u7406\uFF1F\uFF08\u4F1A\u81EA\u52A8\u5907\u4EFD\u539F\u6587\u4EF6\uFF09", true);
5206
5641
  if (!confirmed) {
5207
- console.log(chalk26.yellow("\n\u274C \u5DF2\u53D6\u6D88\n"));
5642
+ console.log(chalk28.yellow("\n\u274C \u5DF2\u53D6\u6D88\n"));
5208
5643
  return;
5209
5644
  }
5210
- console.log(chalk26.cyan("\n\u6B63\u5728\u6E05\u7406...\n"));
5645
+ console.log(chalk28.cyan("\n\u6B63\u5728\u6E05\u7406...\n"));
5211
5646
  const result = cleanClaudeJson(cleanOptions);
5212
- console.log(chalk26.green("\u2705 \u6E05\u7406\u5B8C\u6210\n"));
5213
- console.log(`\u6E05\u7406\u524D: ${chalk26.bold(formatBytes2(result.sizeBefore))}`);
5214
- console.log(`\u6E05\u7406\u540E: ${chalk26.bold(formatBytes2(result.sizeAfter))}`);
5215
- console.log(`\u8282\u7701\u7A7A\u95F4: ${chalk26.green.bold(formatBytes2(result.saved))} (${(result.saved / result.sizeBefore * 100).toFixed(1)}%)`);
5647
+ console.log(chalk28.green("\u2705 \u6E05\u7406\u5B8C\u6210\n"));
5648
+ console.log(`\u6E05\u7406\u524D: ${chalk28.bold(formatBytes2(result.sizeBefore))}`);
5649
+ console.log(`\u6E05\u7406\u540E: ${chalk28.bold(formatBytes2(result.sizeAfter))}`);
5650
+ console.log(`\u8282\u7701\u7A7A\u95F4: ${chalk28.green.bold(formatBytes2(result.saved))} (${(result.saved / result.sizeBefore * 100).toFixed(1)}%)`);
5216
5651
  console.log();
5217
5652
  if (result.cleanedItems.projectHistory > 0) {
5218
- console.log(`\u6E05\u7406\u5386\u53F2\u8BB0\u5F55: ${chalk26.bold(result.cleanedItems.projectHistory)} \u6761`);
5653
+ console.log(`\u6E05\u7406\u5386\u53F2\u8BB0\u5F55: ${chalk28.bold(result.cleanedItems.projectHistory)} \u6761`);
5219
5654
  }
5220
5655
  if (result.cleanedItems.cache) {
5221
- console.log(`\u6E05\u7406\u7F13\u5B58: ${chalk26.green("\u2713")}`);
5656
+ console.log(`\u6E05\u7406\u7F13\u5B58: ${chalk28.green("\u2713")}`);
5222
5657
  }
5223
5658
  if (result.cleanedItems.stats) {
5224
- console.log(`\u91CD\u7F6E\u7EDF\u8BA1: ${chalk26.green("\u2713")}`);
5659
+ console.log(`\u91CD\u7F6E\u7EDF\u8BA1: ${chalk28.green("\u2713")}`);
5225
5660
  }
5226
5661
  console.log();
5227
- console.log(`\u5907\u4EFD\u6587\u4EF6: ${chalk26.cyan(result.backupPath)}`);
5662
+ console.log(`\u5907\u4EFD\u6587\u4EF6: ${chalk28.cyan(result.backupPath)}`);
5228
5663
  console.log();
5229
5664
  } catch (error) {
5230
- console.error(chalk26.red(`
5665
+ console.error(chalk28.red(`
5231
5666
  \u274C ${error.message}
5232
5667
  `));
5233
5668
  process.exit(1);
@@ -5265,32 +5700,32 @@ function buildOptionsFromArgs(args) {
5265
5700
  options.projectPaths = args.projects.split(",").map((p) => p.trim());
5266
5701
  }
5267
5702
  if (!options.cleanProjectHistory && !options.cleanCache && !options.cleanStats) {
5268
- console.log(chalk26.yellow("\u672A\u6307\u5B9A\u6E05\u7406\u9009\u9879\uFF0C\u4F7F\u7528\u4FDD\u5B88\u9884\u8BBE\n"));
5703
+ console.log(chalk28.yellow("\u672A\u6307\u5B9A\u6E05\u7406\u9009\u9879\uFF0C\u4F7F\u7528\u4FDD\u5B88\u9884\u8BBE\n"));
5269
5704
  return CleanPresets.conservative();
5270
5705
  }
5271
5706
  return options;
5272
5707
  }
5273
5708
  async function promptForOptions(analysis) {
5274
- const answers = await inquirer18.prompt([
5709
+ const answers = await inquirer16.prompt([
5275
5710
  {
5276
5711
  type: "list",
5277
5712
  name: "preset",
5278
5713
  message: "\u9009\u62E9\u6E05\u7406\u65B9\u6848:",
5279
5714
  choices: [
5280
5715
  {
5281
- 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)})`,
5716
+ 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)})`,
5282
5717
  value: "conservative"
5283
5718
  },
5284
5719
  {
5285
- 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)})`,
5720
+ 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)})`,
5286
5721
  value: "moderate"
5287
5722
  },
5288
5723
  {
5289
- 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)})`,
5724
+ 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)})`,
5290
5725
  value: "aggressive"
5291
5726
  },
5292
5727
  {
5293
- name: `${chalk26.cyan("\u81EA\u5B9A\u4E49")} - \u81EA\u5B9A\u4E49\u6E05\u7406\u9009\u9879`,
5728
+ name: `${chalk28.cyan("\u81EA\u5B9A\u4E49")} - \u81EA\u5B9A\u4E49\u6E05\u7406\u9009\u9879`,
5294
5729
  value: "custom"
5295
5730
  }
5296
5731
  ]
@@ -5308,7 +5743,7 @@ async function promptForOptions(analysis) {
5308
5743
  const cleanHistory = await promptConfirm("\u6E05\u7406\u9879\u76EE\u5386\u53F2\u8BB0\u5F55\uFF1F", true);
5309
5744
  let keepCount = 10;
5310
5745
  if (cleanHistory) {
5311
- const answers2 = await inquirer18.prompt([
5746
+ const answers2 = await inquirer16.prompt([
5312
5747
  {
5313
5748
  type: "number",
5314
5749
  name: "keepCount",
@@ -5343,14 +5778,14 @@ function createClaudeCommands(program2) {
5343
5778
 
5344
5779
  // src/commands/mcp/add.ts
5345
5780
  init_dist2();
5346
- import chalk27 from "chalk";
5347
- import inquirer19 from "inquirer";
5781
+ import chalk29 from "chalk";
5782
+ import inquirer17 from "inquirer";
5348
5783
  function addCommand3(program2) {
5349
5784
  program2.command("add").description("\u6DFB\u52A0\u65B0\u7684 MCP \u670D\u52A1\u5668(\u4EA4\u4E92\u5F0F)").action(async () => {
5350
5785
  try {
5351
5786
  const manager = createMCPManager();
5352
- console.log(chalk27.bold("\n\u{1F4DD} \u6DFB\u52A0 MCP \u670D\u52A1\u5668\n"));
5353
- const { usePreset } = await inquirer19.prompt([
5787
+ console.log(chalk29.bold("\n\u{1F4DD} \u6DFB\u52A0 MCP \u670D\u52A1\u5668\n"));
5788
+ const { usePreset } = await inquirer17.prompt([
5354
5789
  {
5355
5790
  type: "list",
5356
5791
  name: "usePreset",
@@ -5366,7 +5801,7 @@ function addCommand3(program2) {
5366
5801
  let args;
5367
5802
  let env;
5368
5803
  if (usePreset) {
5369
- const { presetName } = await inquirer19.prompt([
5804
+ const { presetName } = await inquirer17.prompt([
5370
5805
  {
5371
5806
  type: "list",
5372
5807
  name: "presetName",
@@ -5378,18 +5813,18 @@ function addCommand3(program2) {
5378
5813
  }
5379
5814
  ]);
5380
5815
  const preset = MCP_PRESETS_DETAIL.find((p) => p.name === presetName);
5381
- console.log(chalk27.blue(`
5816
+ console.log(chalk29.blue(`
5382
5817
  \u4F7F\u7528\u9884\u8BBE: ${preset.name} - ${preset.description}
5383
5818
  `));
5384
5819
  if (preset.argsPlaceholder) {
5385
- console.log(chalk27.yellow(`\u26A0\uFE0F ${preset.argsPlaceholder}
5820
+ console.log(chalk29.yellow(`\u26A0\uFE0F ${preset.argsPlaceholder}
5386
5821
  `));
5387
5822
  }
5388
5823
  if (preset.envRequired && preset.envRequired.length > 0) {
5389
- console.log(chalk27.yellow(`\u26A0\uFE0F \u9700\u8981\u914D\u7F6E\u73AF\u5883\u53D8\u91CF: ${preset.envRequired.join(", ")}
5824
+ console.log(chalk29.yellow(`\u26A0\uFE0F \u9700\u8981\u914D\u7F6E\u73AF\u5883\u53D8\u91CF: ${preset.envRequired.join(", ")}
5390
5825
  `));
5391
5826
  }
5392
- const input = await inquirer19.prompt([
5827
+ const input = await inquirer17.prompt([
5393
5828
  {
5394
5829
  type: "input",
5395
5830
  name: "name",
@@ -5432,7 +5867,7 @@ function addCommand3(program2) {
5432
5867
  args = input.args.split(" ").filter((arg) => arg.length > 0);
5433
5868
  env = input.env ? JSON.parse(input.env) : void 0;
5434
5869
  } else {
5435
- const answers = await inquirer19.prompt([
5870
+ const answers = await inquirer17.prompt([
5436
5871
  {
5437
5872
  type: "input",
5438
5873
  name: "name",
@@ -5480,21 +5915,21 @@ function addCommand3(program2) {
5480
5915
  model: env ? JSON.stringify(env) : void 0
5481
5916
  });
5482
5917
  console.log();
5483
- console.log(chalk27.green("\u2705 MCP \u670D\u52A1\u5668\u6DFB\u52A0\u6210\u529F"));
5918
+ console.log(chalk29.green("\u2705 MCP \u670D\u52A1\u5668\u6DFB\u52A0\u6210\u529F"));
5484
5919
  console.log();
5485
- console.log(` ${chalk27.bold(provider.name)} ${chalk27.blue("[MCP]")}`);
5486
- console.log(` ${chalk27.gray(`${command} ${args.join(" ")}`)}`);
5920
+ console.log(` ${chalk29.bold(provider.name)} ${chalk29.blue("[MCP]")}`);
5921
+ console.log(` ${chalk29.gray(`${command} ${args.join(" ")}`)}`);
5487
5922
  if (env) {
5488
- console.log(chalk27.gray(` \u73AF\u5883\u53D8\u91CF: ${Object.keys(env).join(", ")}`));
5923
+ console.log(chalk29.gray(` \u73AF\u5883\u53D8\u91CF: ${Object.keys(env).join(", ")}`));
5489
5924
  }
5490
5925
  console.log();
5491
- console.log(chalk27.green("\u2705 \u914D\u7F6E\u5DF2\u81EA\u52A8\u540C\u6B65\u5230 ~/.claude.json"));
5926
+ console.log(chalk29.green("\u2705 \u914D\u7F6E\u5DF2\u81EA\u52A8\u540C\u6B65\u5230 ~/.claude.json"));
5492
5927
  console.log();
5493
- console.log(chalk27.gray("\u914D\u7F6E\u6587\u4EF6:"));
5494
- console.log(chalk27.gray(` - ${getClaudeConfigPath()}`));
5928
+ console.log(chalk29.gray("\u914D\u7F6E\u6587\u4EF6:"));
5929
+ console.log(chalk29.gray(` - ${getClaudeConfigPath()}`));
5495
5930
  console.log();
5496
5931
  } catch (error) {
5497
- console.error(chalk27.red(`
5932
+ console.error(chalk29.red(`
5498
5933
  \u274C ${error.message}
5499
5934
  `));
5500
5935
  process.exit(1);
@@ -5504,25 +5939,25 @@ function addCommand3(program2) {
5504
5939
 
5505
5940
  // src/commands/mcp/list.ts
5506
5941
  init_dist2();
5507
- import chalk28 from "chalk";
5942
+ import chalk30 from "chalk";
5508
5943
  function listCommand3(program2) {
5509
5944
  program2.command("list").alias("ls").description("\u5217\u51FA\u6240\u6709 MCP \u670D\u52A1\u5668").action(async () => {
5510
5945
  try {
5511
5946
  const manager = createMCPManager();
5512
5947
  const providers = manager.list();
5513
5948
  if (providers.length === 0) {
5514
- console.log(chalk28.yellow("\n\u26A0\uFE0F \u6682\u65E0 MCP \u670D\u52A1\u5668\n"));
5515
- console.log(chalk28.blue("\u{1F4A1} \u6DFB\u52A0 MCP \u670D\u52A1\u5668:") + chalk28.white(" ccman mcp add\n"));
5949
+ console.log(chalk30.yellow("\n\u26A0\uFE0F \u6682\u65E0 MCP \u670D\u52A1\u5668\n"));
5950
+ console.log(chalk30.blue("\u{1F4A1} \u6DFB\u52A0 MCP \u670D\u52A1\u5668:") + chalk30.white(" ccman mcp add\n"));
5516
5951
  return;
5517
5952
  }
5518
- console.log(chalk28.bold(`
5953
+ console.log(chalk30.bold(`
5519
5954
  \u{1F4CB} MCP \u670D\u52A1\u5668 (${providers.length} \u4E2A)
5520
5955
  `));
5521
5956
  providers.forEach((provider) => {
5522
5957
  const isActive = false;
5523
- const indicator = isActive ? chalk28.green("\u25CF") : chalk28.gray("\u25CB");
5524
- const nameDisplay = chalk28.bold(provider.name);
5525
- const commandDisplay = chalk28.gray(`${provider.baseUrl} ${provider.apiKey}`);
5958
+ const indicator = isActive ? chalk30.green("\u25CF") : chalk30.gray("\u25CB");
5959
+ const nameDisplay = chalk30.bold(provider.name);
5960
+ const commandDisplay = chalk30.gray(`${provider.baseUrl} ${provider.apiKey}`);
5526
5961
  console.log(` ${indicator} ${nameDisplay}`);
5527
5962
  console.log(` ${commandDisplay}`);
5528
5963
  if (provider.model) {
@@ -5530,17 +5965,17 @@ function listCommand3(program2) {
5530
5965
  const env = JSON.parse(provider.model);
5531
5966
  const envKeys = Object.keys(env);
5532
5967
  if (envKeys.length > 0) {
5533
- console.log(chalk28.gray(` \u73AF\u5883\u53D8\u91CF: ${envKeys.join(", ")}`));
5968
+ console.log(chalk30.gray(` \u73AF\u5883\u53D8\u91CF: ${envKeys.join(", ")}`));
5534
5969
  }
5535
5970
  } catch {
5536
5971
  }
5537
5972
  }
5538
5973
  console.log();
5539
5974
  });
5540
- console.log(chalk28.gray("\u63D0\u793A: \u6240\u6709\u914D\u7F6E\u7684 MCP \u670D\u52A1\u5668\u4F1A\u81EA\u52A8\u540C\u6B65\u5230 ~/.claude.json"));
5975
+ console.log(chalk30.gray("\u63D0\u793A: \u6240\u6709\u914D\u7F6E\u7684 MCP \u670D\u52A1\u5668\u4F1A\u81EA\u52A8\u540C\u6B65\u5230 ~/.claude.json"));
5541
5976
  console.log();
5542
5977
  } catch (error) {
5543
- console.error(chalk28.red(`
5978
+ console.error(chalk30.red(`
5544
5979
  \u274C ${error.message}
5545
5980
  `));
5546
5981
  process.exit(1);
@@ -5551,15 +5986,15 @@ function listCommand3(program2) {
5551
5986
  // src/commands/mcp/remove.ts
5552
5987
  init_dist2();
5553
5988
  init_confirm();
5554
- import chalk29 from "chalk";
5555
- import inquirer20 from "inquirer";
5989
+ import chalk31 from "chalk";
5990
+ import inquirer18 from "inquirer";
5556
5991
  function removeCommand3(program2) {
5557
5992
  program2.command("remove [name]").alias("rm").description("\u5220\u9664 MCP \u670D\u52A1\u5668").action(async (name) => {
5558
5993
  try {
5559
5994
  const manager = createMCPManager();
5560
5995
  const providers = manager.list();
5561
5996
  if (providers.length === 0) {
5562
- console.log(chalk29.yellow("\n\u26A0\uFE0F \u6682\u65E0 MCP \u670D\u52A1\u5668\n"));
5997
+ console.log(chalk31.yellow("\n\u26A0\uFE0F \u6682\u65E0 MCP \u670D\u52A1\u5668\n"));
5563
5998
  return;
5564
5999
  }
5565
6000
  let targetId;
@@ -5572,7 +6007,7 @@ function removeCommand3(program2) {
5572
6007
  targetId = provider.id;
5573
6008
  targetName = provider.name;
5574
6009
  } else {
5575
- const { selectedId } = await inquirer20.prompt([
6010
+ const { selectedId } = await inquirer18.prompt([
5576
6011
  {
5577
6012
  type: "list",
5578
6013
  name: "selectedId",
@@ -5589,26 +6024,26 @@ function removeCommand3(program2) {
5589
6024
  }
5590
6025
  const confirmed = await promptConfirm(`\u786E\u5B9A\u5220\u9664 "${targetName}"?`, false);
5591
6026
  if (!confirmed) {
5592
- console.log(chalk29.gray("\n\u5DF2\u53D6\u6D88\n"));
6027
+ console.log(chalk31.gray("\n\u5DF2\u53D6\u6D88\n"));
5593
6028
  return;
5594
6029
  }
5595
6030
  manager.remove(targetId);
5596
6031
  console.log();
5597
- console.log(chalk29.green(`\u2705 \u5DF2\u5220\u9664: ${targetName}`));
6032
+ console.log(chalk31.green(`\u2705 \u5DF2\u5220\u9664: ${targetName}`));
5598
6033
  console.log();
5599
- console.log(chalk29.green("\u2705 \u914D\u7F6E\u5DF2\u81EA\u52A8\u540C\u6B65\u5230 ~/.claude.json"));
6034
+ console.log(chalk31.green("\u2705 \u914D\u7F6E\u5DF2\u81EA\u52A8\u540C\u6B65\u5230 ~/.claude.json"));
5600
6035
  console.log();
5601
- console.log(chalk29.gray("\u914D\u7F6E\u6587\u4EF6:"));
5602
- console.log(chalk29.gray(` - ${getClaudeConfigPath()}`));
6036
+ console.log(chalk31.gray("\u914D\u7F6E\u6587\u4EF6:"));
6037
+ console.log(chalk31.gray(` - ${getClaudeConfigPath()}`));
5603
6038
  console.log();
5604
6039
  } catch (error) {
5605
6040
  if (error instanceof ProviderNotFoundError) {
5606
- console.error(chalk29.red(`
6041
+ console.error(chalk31.red(`
5607
6042
  \u274C MCP \u670D\u52A1\u5668\u4E0D\u5B58\u5728
5608
6043
  `));
5609
- console.log(chalk29.blue("\u{1F4A1} \u67E5\u770B\u6240\u6709 MCP \u670D\u52A1\u5668:") + chalk29.white(" ccman mcp list\n"));
6044
+ console.log(chalk31.blue("\u{1F4A1} \u67E5\u770B\u6240\u6709 MCP \u670D\u52A1\u5668:") + chalk31.white(" ccman mcp list\n"));
5610
6045
  } else {
5611
- console.error(chalk29.red(`
6046
+ console.error(chalk31.red(`
5612
6047
  \u274C ${error.message}
5613
6048
  `));
5614
6049
  }
@@ -5619,15 +6054,15 @@ function removeCommand3(program2) {
5619
6054
 
5620
6055
  // src/commands/mcp/edit.ts
5621
6056
  init_dist2();
5622
- import chalk30 from "chalk";
5623
- import inquirer21 from "inquirer";
6057
+ import chalk32 from "chalk";
6058
+ import inquirer19 from "inquirer";
5624
6059
  function editCommand3(program2) {
5625
6060
  program2.command("edit [name]").description("\u7F16\u8F91 MCP \u670D\u52A1\u5668").action(async (name) => {
5626
6061
  try {
5627
6062
  const manager = createMCPManager();
5628
6063
  const providers = manager.list();
5629
6064
  if (providers.length === 0) {
5630
- console.log(chalk30.yellow("\n\u26A0\uFE0F \u6682\u65E0 MCP \u670D\u52A1\u5668\n"));
6065
+ console.log(chalk32.yellow("\n\u26A0\uFE0F \u6682\u65E0 MCP \u670D\u52A1\u5668\n"));
5631
6066
  return;
5632
6067
  }
5633
6068
  let targetId;
@@ -5638,7 +6073,7 @@ function editCommand3(program2) {
5638
6073
  }
5639
6074
  targetId = provider2.id;
5640
6075
  } else {
5641
- const { selectedId } = await inquirer21.prompt([
6076
+ const { selectedId } = await inquirer19.prompt([
5642
6077
  {
5643
6078
  type: "list",
5644
6079
  name: "selectedId",
@@ -5655,9 +6090,9 @@ function editCommand3(program2) {
5655
6090
  const currentCommand6 = provider.baseUrl;
5656
6091
  const currentArgs = provider.apiKey;
5657
6092
  const currentEnv = provider.model;
5658
- console.log(chalk30.bold("\n\u270F\uFE0F \u7F16\u8F91 MCP \u670D\u52A1\u5668\n"));
5659
- console.log(chalk30.gray("\u63D0\u793A: \u7559\u7A7A\u5219\u4FDD\u6301\u539F\u503C\n"));
5660
- const answers = await inquirer21.prompt([
6093
+ console.log(chalk32.bold("\n\u270F\uFE0F \u7F16\u8F91 MCP \u670D\u52A1\u5668\n"));
6094
+ console.log(chalk32.gray("\u63D0\u793A: \u7559\u7A7A\u5219\u4FDD\u6301\u539F\u503C\n"));
6095
+ const answers = await inquirer19.prompt([
5661
6096
  {
5662
6097
  type: "input",
5663
6098
  name: "name",
@@ -5697,30 +6132,30 @@ function editCommand3(program2) {
5697
6132
  updates.model = answers.env || void 0;
5698
6133
  }
5699
6134
  if (Object.keys(updates).length === 0) {
5700
- console.log(chalk30.gray("\n\u672A\u505A\u4EFB\u4F55\u4FEE\u6539\n"));
6135
+ console.log(chalk32.gray("\n\u672A\u505A\u4EFB\u4F55\u4FEE\u6539\n"));
5701
6136
  return;
5702
6137
  }
5703
6138
  const updated = manager.edit(targetId, updates);
5704
6139
  console.log();
5705
- console.log(chalk30.green("\u2705 \u7F16\u8F91\u6210\u529F"));
6140
+ console.log(chalk32.green("\u2705 \u7F16\u8F91\u6210\u529F"));
5706
6141
  console.log();
5707
- console.log(` ${chalk30.bold(updated.name)} ${chalk30.blue("[MCP]")}`);
5708
- console.log(` ${chalk30.gray(`\u547D\u4EE4: ${updated.baseUrl} ${updated.apiKey}`)}`);
6142
+ console.log(` ${chalk32.bold(updated.name)} ${chalk32.blue("[MCP]")}`);
6143
+ console.log(` ${chalk32.gray(`\u547D\u4EE4: ${updated.baseUrl} ${updated.apiKey}`)}`);
5709
6144
  if (updated.model) {
5710
6145
  try {
5711
6146
  const env = JSON.parse(updated.model);
5712
- console.log(chalk30.gray(` \u73AF\u5883\u53D8\u91CF: ${Object.keys(env).join(", ")}`));
6147
+ console.log(chalk32.gray(` \u73AF\u5883\u53D8\u91CF: ${Object.keys(env).join(", ")}`));
5713
6148
  } catch {
5714
6149
  }
5715
6150
  }
5716
6151
  console.log();
5717
- console.log(chalk30.green("\u2705 \u914D\u7F6E\u5DF2\u81EA\u52A8\u540C\u6B65\u5230 ~/.claude.json"));
6152
+ console.log(chalk32.green("\u2705 \u914D\u7F6E\u5DF2\u81EA\u52A8\u540C\u6B65\u5230 ~/.claude.json"));
5718
6153
  console.log();
5719
- console.log(chalk30.gray("\u914D\u7F6E\u6587\u4EF6:"));
5720
- console.log(chalk30.gray(` - ${getClaudeConfigPath()}`));
6154
+ console.log(chalk32.gray("\u914D\u7F6E\u6587\u4EF6:"));
6155
+ console.log(chalk32.gray(` - ${getClaudeConfigPath()}`));
5721
6156
  console.log();
5722
6157
  } catch (error) {
5723
- console.error(chalk30.red(`
6158
+ console.error(chalk32.red(`
5724
6159
  \u274C ${error.message}
5725
6160
  `));
5726
6161
  process.exit(1);
@@ -5738,15 +6173,38 @@ function createMCPCommands(program2) {
5738
6173
 
5739
6174
  // src/commands/gemini/add.ts
5740
6175
  init_dist2();
5741
- import chalk31 from "chalk";
5742
- import inquirer22 from "inquirer";
6176
+ import chalk33 from "chalk";
6177
+ import inquirer20 from "inquirer";
5743
6178
  init_confirm();
5744
6179
  function addCommand4(program2) {
5745
- program2.command("add").description("\u6DFB\u52A0\u65B0\u7684 Gemini CLI \u670D\u52A1\u5546(\u4EA4\u4E92\u5F0F)").action(async () => {
6180
+ const command = program2.command("add").description("\u6DFB\u52A0\u65B0\u7684 Gemini CLI \u670D\u52A1\u5546");
6181
+ addProviderAddOptions(command);
6182
+ command.action(async (options) => {
5746
6183
  try {
5747
6184
  const manager = createGeminiManager();
5748
- console.log(chalk31.bold("\n\u{1F4DD} \u6DFB\u52A0 Gemini CLI \u670D\u52A1\u5546\n"));
5749
- const { usePreset } = await inquirer22.prompt([
6185
+ console.log(chalk33.bold("\n\u{1F4DD} \u6DFB\u52A0 Gemini CLI \u670D\u52A1\u5546\n"));
6186
+ const resolved = resolveProviderAddInput(options, GEMINI_PRESETS, {
6187
+ allowEmptyBaseUrl: true,
6188
+ allowEmptyApiKey: true
6189
+ });
6190
+ if (resolved.nonInteractive && resolved.input) {
6191
+ const provider2 = manager.add(resolved.input);
6192
+ printSuccess("\u6DFB\u52A0\u6210\u529F", [
6193
+ `${chalk33.bold(provider2.name)} ${toolBadge("gemini")}`,
6194
+ chalk33.gray(provider2.baseUrl || "(\u4F7F\u7528\u9ED8\u8BA4\u7AEF\u70B9)")
6195
+ ]);
6196
+ if (resolved.switchNow) {
6197
+ manager.switch(provider2.id);
6198
+ printSuccess("\u5DF2\u5207\u6362\u5230\u65B0\u670D\u52A1\u5546", [
6199
+ chalk33.gray(`\u914D\u7F6E\u5DF2\u66F4\u65B0: ${getGeminiSettingsPath()}`),
6200
+ chalk33.gray(`\u914D\u7F6E\u5DF2\u66F4\u65B0: ${getGeminiEnvPath()}`)
6201
+ ]);
6202
+ } else {
6203
+ printTip(`\u7A0D\u540E\u5207\u6362: ${chalk33.white(`ccman gm use "${provider2.name}"`)}`);
6204
+ }
6205
+ return;
6206
+ }
6207
+ const { usePreset } = await inquirer20.prompt([
5750
6208
  {
5751
6209
  type: "list",
5752
6210
  name: "usePreset",
@@ -5762,7 +6220,7 @@ function addCommand4(program2) {
5762
6220
  let baseUrl;
5763
6221
  let apiKey;
5764
6222
  if (usePreset) {
5765
- const { presetName } = await inquirer22.prompt([
6223
+ const { presetName } = await inquirer20.prompt([
5766
6224
  {
5767
6225
  type: "list",
5768
6226
  name: "presetName",
@@ -5774,7 +6232,7 @@ function addCommand4(program2) {
5774
6232
  }
5775
6233
  ]);
5776
6234
  const preset = GEMINI_PRESETS.find((p) => p.name === presetName);
5777
- console.log(chalk31.blue(`
6235
+ console.log(chalk33.blue(`
5778
6236
  \u4F7F\u7528\u9884\u8BBE: ${preset.name} - ${preset.description}
5779
6237
  `));
5780
6238
  const input = await promptProviderForm({
@@ -5788,7 +6246,7 @@ function addCommand4(program2) {
5788
6246
  baseUrl = input.baseUrl;
5789
6247
  apiKey = input.apiKey;
5790
6248
  } else {
5791
- const answers = await inquirer22.prompt([
6249
+ const answers = await inquirer20.prompt([
5792
6250
  {
5793
6251
  type: "input",
5794
6252
  name: "name",
@@ -5823,25 +6281,22 @@ function addCommand4(program2) {
5823
6281
  apiKey = answers.apiKey || "";
5824
6282
  }
5825
6283
  const provider = manager.add({ name, desc, baseUrl, apiKey });
5826
- console.log();
5827
- console.log(chalk31.green("\u2705 \u6DFB\u52A0\u6210\u529F"));
5828
- console.log();
5829
- console.log(` ${chalk31.bold(provider.name)} ${chalk31.blue("[Gemini CLI]")}`);
5830
- console.log(` ${chalk31.gray(provider.baseUrl || "(\u4F7F\u7528\u9ED8\u8BA4\u7AEF\u70B9)")}`);
5831
- console.log();
6284
+ printSuccess("\u6DFB\u52A0\u6210\u529F", [
6285
+ `${chalk33.bold(provider.name)} ${toolBadge("gemini")}`,
6286
+ chalk33.gray(provider.baseUrl || "(\u4F7F\u7528\u9ED8\u8BA4\u7AEF\u70B9)")
6287
+ ]);
5832
6288
  const switchNow = await promptConfirm("\u662F\u5426\u7ACB\u5373\u5207\u6362\u5230\u6B64\u670D\u52A1\u5546?", true);
5833
6289
  if (switchNow) {
5834
6290
  manager.switch(provider.id);
5835
- console.log(chalk31.green("\u2705 \u5DF2\u5207\u6362\u5230\u65B0\u670D\u52A1\u5546"));
5836
- console.log();
5837
- console.log(chalk31.gray("\u914D\u7F6E\u5DF2\u66F4\u65B0:"));
5838
- console.log(chalk31.gray(` - ${getGeminiSettingsPath()}`));
5839
- console.log(chalk31.gray(` - ${getGeminiEnvPath()}`));
6291
+ printSuccess("\u5DF2\u5207\u6362\u5230\u65B0\u670D\u52A1\u5546", [
6292
+ chalk33.gray(`\u914D\u7F6E\u5DF2\u66F4\u65B0: ${getGeminiSettingsPath()}`),
6293
+ chalk33.gray(`\u914D\u7F6E\u5DF2\u66F4\u65B0: ${getGeminiEnvPath()}`)
6294
+ ]);
5840
6295
  } else {
5841
- console.log(chalk31.blue("\u{1F4A1} \u7A0D\u540E\u5207\u6362:") + chalk31.white(` ccman gm use "${provider.name}"`));
6296
+ printTip(`\u7A0D\u540E\u5207\u6362: ${chalk33.white(`ccman gm use "${provider.name}"`)}`);
5842
6297
  }
5843
6298
  } catch (error) {
5844
- console.error(chalk31.red(`
6299
+ console.error(chalk33.red(`
5845
6300
  \u274C ${error.message}
5846
6301
  `));
5847
6302
  process.exit(1);
@@ -5851,7 +6306,7 @@ function addCommand4(program2) {
5851
6306
 
5852
6307
  // src/commands/gemini/list.ts
5853
6308
  init_dist2();
5854
- import chalk32 from "chalk";
6309
+ import chalk34 from "chalk";
5855
6310
  function listCommand4(program2) {
5856
6311
  program2.command("list").alias("ls").description("\u5217\u51FA\u6240\u6709 Gemini CLI \u670D\u52A1\u5546").action(async () => {
5857
6312
  try {
@@ -5859,15 +6314,15 @@ function listCommand4(program2) {
5859
6314
  const providers = manager.list();
5860
6315
  const current = manager.getCurrent();
5861
6316
  if (providers.length === 0) {
5862
- console.log(chalk32.yellow("\n\u26A0\uFE0F \u6682\u65E0 Gemini CLI \u670D\u52A1\u5546\n"));
5863
- console.log(chalk32.blue("\u{1F4A1} \u6DFB\u52A0\u670D\u52A1\u5546:") + chalk32.white(" ccman gm add\n"));
6317
+ printWarning("\u6682\u65E0 Gemini CLI \u670D\u52A1\u5546");
6318
+ printTip("\u6DFB\u52A0\u670D\u52A1\u5546: " + chalk34.white("ccman gm add"));
5864
6319
  return;
5865
6320
  }
5866
- console.log(chalk32.bold(`
5867
- \u{1F4CB} Gemini CLI \u670D\u52A1\u5546 (${providers.length} \u4E2A)`));
5868
- console.log(formatProviderTable(providers, current?.id));
6321
+ console.log(
6322
+ formatProviderTable(providers, current?.id, `Gemini CLI \u670D\u52A1\u5546 (${providers.length} \u4E2A)`)
6323
+ );
5869
6324
  } catch (error) {
5870
- console.error(chalk32.red(`
6325
+ console.error(chalk34.red(`
5871
6326
  \u274C ${error.message}
5872
6327
  `));
5873
6328
  process.exit(1);
@@ -5877,16 +6332,16 @@ function listCommand4(program2) {
5877
6332
 
5878
6333
  // src/commands/gemini/use.ts
5879
6334
  init_dist2();
5880
- import chalk33 from "chalk";
5881
- import inquirer23 from "inquirer";
6335
+ import chalk35 from "chalk";
6336
+ import inquirer21 from "inquirer";
5882
6337
  function useCommand3(program2) {
5883
6338
  program2.command("use [name]").description("\u5207\u6362 Gemini CLI \u670D\u52A1\u5546").action(async (name) => {
5884
6339
  try {
5885
6340
  const manager = createGeminiManager();
5886
6341
  const providers = manager.list();
5887
6342
  if (providers.length === 0) {
5888
- console.log(chalk33.yellow("\n\u26A0\uFE0F \u6682\u65E0 Gemini CLI \u670D\u52A1\u5546\n"));
5889
- console.log(chalk33.blue("\u{1F4A1} \u6DFB\u52A0\u670D\u52A1\u5546:") + chalk33.white(" ccman gm add\n"));
6343
+ printWarning("\u6682\u65E0 Gemini CLI \u670D\u52A1\u5546");
6344
+ printTip("\u6DFB\u52A0\u670D\u52A1\u5546: " + chalk35.white("ccman gm add"));
5890
6345
  return;
5891
6346
  }
5892
6347
  let targetId;
@@ -5897,7 +6352,7 @@ function useCommand3(program2) {
5897
6352
  }
5898
6353
  targetId = provider2.id;
5899
6354
  } else {
5900
- const { selectedId } = await inquirer23.prompt([
6355
+ const { selectedId } = await inquirer21.prompt([
5901
6356
  {
5902
6357
  type: "list",
5903
6358
  name: "selectedId",
@@ -5912,24 +6367,20 @@ function useCommand3(program2) {
5912
6367
  }
5913
6368
  manager.switch(targetId);
5914
6369
  const provider = manager.get(targetId);
5915
- console.log();
5916
- console.log(chalk33.green("\u2705 \u5207\u6362\u6210\u529F"));
5917
- console.log();
5918
- console.log(` ${chalk33.bold(provider.name)} ${chalk33.blue("[Gemini CLI]")}`);
5919
- console.log(` ${chalk33.gray(`URL: ${provider.baseUrl || "(\u9ED8\u8BA4\u7AEF\u70B9)"}`)}`);
5920
- console.log();
5921
- console.log(chalk33.gray("\u914D\u7F6E\u5DF2\u66F4\u65B0:"));
5922
- console.log(chalk33.gray(` - ${getGeminiSettingsPath()}`));
5923
- console.log(chalk33.gray(` - ${getGeminiEnvPath()}`));
5924
- console.log();
6370
+ printSuccess("\u5207\u6362\u6210\u529F", [
6371
+ `${chalk35.bold(provider.name)} ${toolBadge("gemini")}`,
6372
+ chalk35.gray(`URL: ${provider.baseUrl || "(\u9ED8\u8BA4\u7AEF\u70B9)"}`),
6373
+ chalk35.gray(`\u914D\u7F6E\u5DF2\u66F4\u65B0: ${getGeminiSettingsPath()}`),
6374
+ chalk35.gray(`\u914D\u7F6E\u5DF2\u66F4\u65B0: ${getGeminiEnvPath()}`)
6375
+ ]);
5925
6376
  } catch (error) {
5926
6377
  if (error instanceof ProviderNotFoundError) {
5927
- console.error(chalk33.red(`
6378
+ console.error(chalk35.red(`
5928
6379
  \u274C \u670D\u52A1\u5546\u4E0D\u5B58\u5728: ${error.message}
5929
6380
  `));
5930
- console.log(chalk33.blue("\u{1F4A1} \u67E5\u770B\u6240\u6709\u670D\u52A1\u5546:") + chalk33.white(" ccman gm list\n"));
6381
+ console.log(chalk35.blue("\u{1F4A1} \u67E5\u770B\u6240\u6709\u670D\u52A1\u5546:") + chalk35.white(" ccman gm list\n"));
5931
6382
  } else {
5932
- console.error(chalk33.red(`
6383
+ console.error(chalk35.red(`
5933
6384
  \u274C ${error.message}
5934
6385
  `));
5935
6386
  }
@@ -5940,23 +6391,30 @@ function useCommand3(program2) {
5940
6391
 
5941
6392
  // src/commands/gemini/current.ts
5942
6393
  init_dist2();
5943
- import chalk34 from "chalk";
6394
+ import chalk36 from "chalk";
5944
6395
  function currentCommand3(program2) {
5945
6396
  program2.command("current").description("\u663E\u793A\u5F53\u524D Gemini CLI \u670D\u52A1\u5546").action(async () => {
5946
6397
  try {
5947
6398
  const manager = createGeminiManager();
5948
6399
  const current = manager.getCurrent();
5949
6400
  if (!current) {
5950
- console.log(chalk34.yellow("\n\u26A0\uFE0F \u5F53\u524D\u6CA1\u6709\u6FC0\u6D3B\u7684 Gemini CLI \u670D\u52A1\u5546\n"));
5951
- console.log(chalk34.blue("\u{1F4A1} \u5217\u51FA\u670D\u52A1\u5546:") + chalk34.white(" ccman gm list\n"));
6401
+ printWarning("\u672A\u9009\u62E9\u4EFB\u4F55 Gemini CLI \u670D\u52A1\u5546");
6402
+ printTip("\u9009\u62E9\u670D\u52A1\u5546: " + chalk36.white("ccman gm use"));
5952
6403
  return;
5953
6404
  }
5954
- console.log(chalk34.bold("\n\u{1F3AF} \u5F53\u524D Gemini CLI \u670D\u52A1\u5546\n"));
5955
- console.log(` \u540D\u79F0: ${chalk34.bold(current.name)}`);
5956
- console.log(` \u5730\u5740: ${chalk34.gray(current.baseUrl || "(\u9ED8\u8BA4\u7AEF\u70B9)")}`);
5957
- console.log();
6405
+ const lines = [
6406
+ chalk36.green.bold(current.name),
6407
+ chalk36.gray(`ID: ${current.id}`),
6408
+ chalk36.gray(`URL: ${current.baseUrl || "(\u9ED8\u8BA4\u7AEF\u70B9)"}`)
6409
+ ];
6410
+ if (current.lastUsedAt) {
6411
+ lines.push(
6412
+ chalk36.gray(`\u6700\u540E\u4F7F\u7528: ${new Date(current.lastUsedAt).toLocaleString("zh-CN")}`)
6413
+ );
6414
+ }
6415
+ printInfo("\u{1F4CD} \u5F53\u524D Gemini CLI \u670D\u52A1\u5546", lines);
5958
6416
  } catch (error) {
5959
- console.error(chalk34.red(`
6417
+ console.error(chalk36.red(`
5960
6418
  \u274C ${error.message}
5961
6419
  `));
5962
6420
  process.exit(1);
@@ -5966,17 +6424,18 @@ function currentCommand3(program2) {
5966
6424
 
5967
6425
  // src/commands/gemini/remove.ts
5968
6426
  init_dist2();
5969
- init_confirm();
5970
- import chalk35 from "chalk";
5971
- import inquirer24 from "inquirer";
6427
+ import chalk37 from "chalk";
6428
+ import inquirer22 from "inquirer";
5972
6429
  function removeCommand4(program2) {
5973
- program2.command("remove [name]").alias("rm").description("\u5220\u9664 Gemini CLI \u670D\u52A1\u5546").action(async (name) => {
6430
+ const command = program2.command("remove [name]").alias("rm").description("\u5220\u9664 Gemini CLI \u670D\u52A1\u5546");
6431
+ addProviderRemoveOptions(command);
6432
+ command.action(async (name, options) => {
5974
6433
  try {
5975
6434
  const manager = createGeminiManager();
5976
6435
  const providers = manager.list();
5977
6436
  if (providers.length === 0) {
5978
- console.log(chalk35.yellow("\n\u26A0\uFE0F \u6682\u65E0 Gemini CLI \u670D\u52A1\u5546\n"));
5979
- console.log(chalk35.blue("\u{1F4A1} \u6DFB\u52A0\u670D\u52A1\u5546:") + chalk35.white(" ccman gm add\n"));
6437
+ console.log(chalk37.yellow("\n\u26A0\uFE0F \u6682\u65E0 Gemini CLI \u670D\u52A1\u5546\n"));
6438
+ console.log(chalk37.blue("\u{1F4A1} \u6DFB\u52A0\u670D\u52A1\u5546:") + chalk37.white(" ccman gm add\n"));
5980
6439
  return;
5981
6440
  }
5982
6441
  let targetId;
@@ -5984,15 +6443,14 @@ function removeCommand4(program2) {
5984
6443
  if (name) {
5985
6444
  const provider = manager.findByName(name);
5986
6445
  if (!provider) {
5987
- console.log(chalk35.red(`
5988
- \u274C \u670D\u52A1\u5546\u4E0D\u5B58\u5728: ${name}
5989
- `));
5990
- process.exit(1);
6446
+ throw new ProviderNotFoundError(name);
5991
6447
  }
5992
6448
  targetId = provider.id;
5993
6449
  targetName = provider.name;
6450
+ } else if (options.yes) {
6451
+ throw new Error("\u975E\u4EA4\u4E92\u6A21\u5F0F\u8BF7\u63D0\u4F9B\u8981\u5220\u9664\u7684\u670D\u52A1\u5546\u540D\u79F0");
5994
6452
  } else {
5995
- const { selectedId } = await inquirer24.prompt([
6453
+ const { selectedId } = await inquirer22.prompt([
5996
6454
  {
5997
6455
  type: "list",
5998
6456
  name: "selectedId",
@@ -6007,17 +6465,23 @@ function removeCommand4(program2) {
6007
6465
  targetId = provider.id;
6008
6466
  targetName = provider.name;
6009
6467
  }
6010
- const confirm = await promptConfirm(`\u786E\u5B9A\u8981\u5220\u9664\u670D\u52A1\u5546 "${targetName}" \u5417\uFF1F`, false);
6468
+ const confirm = await confirmProviderRemoval(targetName, options);
6011
6469
  if (!confirm) {
6012
- console.log(chalk35.gray("\n\u5DF2\u53D6\u6D88\u5220\u9664\n"));
6470
+ console.log(chalk37.gray("\n\u5DF2\u53D6\u6D88\u5220\u9664\n"));
6013
6471
  return;
6014
6472
  }
6015
6473
  manager.remove(targetId);
6016
- console.log(chalk35.green("\n\u2705 \u5DF2\u5220\u9664\u670D\u52A1\u5546\n"));
6474
+ console.log(chalk37.green("\n\u2705 \u5DF2\u5220\u9664\u670D\u52A1\u5546\n"));
6017
6475
  } catch (error) {
6018
- console.error(chalk35.red(`
6476
+ if (error instanceof ProviderNotFoundError) {
6477
+ console.error(chalk37.red(`
6478
+ \u274C \u670D\u52A1\u5546\u4E0D\u5B58\u5728: ${name}
6479
+ `));
6480
+ } else {
6481
+ console.error(chalk37.red(`
6019
6482
  \u274C ${error.message}
6020
6483
  `));
6484
+ }
6021
6485
  process.exit(1);
6022
6486
  }
6023
6487
  });
@@ -6025,30 +6489,35 @@ function removeCommand4(program2) {
6025
6489
 
6026
6490
  // src/commands/gemini/edit.ts
6027
6491
  init_dist2();
6028
- import chalk36 from "chalk";
6029
- import inquirer25 from "inquirer";
6492
+ import chalk38 from "chalk";
6493
+ import inquirer23 from "inquirer";
6030
6494
  function editCommand4(program2) {
6031
- program2.command("edit [name]").description("\u7F16\u8F91 Gemini CLI \u670D\u52A1\u5546").action(async (name) => {
6495
+ const command = program2.command("edit [name]").description("\u7F16\u8F91 Gemini CLI \u670D\u52A1\u5546");
6496
+ addProviderEditOptions(command);
6497
+ command.action(async (name, options) => {
6032
6498
  try {
6033
6499
  const manager = createGeminiManager();
6034
6500
  const providers = manager.list();
6035
6501
  if (providers.length === 0) {
6036
- console.log(chalk36.yellow("\n\u26A0\uFE0F \u6682\u65E0 Gemini CLI \u670D\u52A1\u5546\n"));
6037
- console.log(chalk36.blue("\u{1F4A1} \u6DFB\u52A0\u670D\u52A1\u5546:") + chalk36.white(" ccman gm add\n"));
6502
+ console.log(chalk38.yellow("\n\u26A0\uFE0F \u6682\u65E0 Gemini CLI \u670D\u52A1\u5546\n"));
6503
+ console.log(chalk38.blue("\u{1F4A1} \u6DFB\u52A0\u670D\u52A1\u5546:") + chalk38.white(" ccman gm add\n"));
6038
6504
  return;
6039
6505
  }
6506
+ const resolved = resolveProviderEditInput(options, {
6507
+ allowEmptyBaseUrl: true,
6508
+ allowEmptyApiKey: true
6509
+ });
6040
6510
  let targetId;
6041
6511
  if (name) {
6042
6512
  const provider2 = manager.findByName(name);
6043
6513
  if (!provider2) {
6044
- console.log(chalk36.red(`
6045
- \u274C \u670D\u52A1\u5546\u4E0D\u5B58\u5728: ${name}
6046
- `));
6047
- process.exit(1);
6514
+ throw new ProviderNotFoundError(name);
6048
6515
  }
6049
6516
  targetId = provider2.id;
6517
+ } else if (resolved.nonInteractive) {
6518
+ throw new Error("\u975E\u4EA4\u4E92\u6A21\u5F0F\u8BF7\u63D0\u4F9B\u8981\u7F16\u8F91\u7684\u670D\u52A1\u5546\u540D\u79F0");
6050
6519
  } else {
6051
- const { selectedId } = await inquirer25.prompt([
6520
+ const { selectedId } = await inquirer23.prompt([
6052
6521
  {
6053
6522
  type: "list",
6054
6523
  name: "selectedId",
@@ -6062,6 +6531,15 @@ function editCommand4(program2) {
6062
6531
  targetId = selectedId;
6063
6532
  }
6064
6533
  const provider = manager.get(targetId);
6534
+ if (resolved.nonInteractive) {
6535
+ if (Object.keys(resolved.updates).length === 0) {
6536
+ console.log(chalk38.gray("\n\u672A\u505A\u4EFB\u4F55\u4FEE\u6539\n"));
6537
+ return;
6538
+ }
6539
+ manager.edit(targetId, resolved.updates);
6540
+ console.log(chalk38.green("\n\u2705 \u7F16\u8F91\u6210\u529F\n"));
6541
+ return;
6542
+ }
6065
6543
  const input = await promptProviderForm({
6066
6544
  name: provider.name,
6067
6545
  desc: provider.desc ?? "",
@@ -6074,11 +6552,17 @@ function editCommand4(program2) {
6074
6552
  baseUrl: input.baseUrl,
6075
6553
  apiKey: input.apiKey
6076
6554
  });
6077
- console.log(chalk36.green("\n\u2705 \u7F16\u8F91\u6210\u529F\n"));
6555
+ console.log(chalk38.green("\n\u2705 \u7F16\u8F91\u6210\u529F\n"));
6078
6556
  } catch (error) {
6079
- console.error(chalk36.red(`
6557
+ if (error instanceof ProviderNotFoundError) {
6558
+ console.error(chalk38.red(`
6559
+ \u274C \u670D\u52A1\u5546\u4E0D\u5B58\u5728: ${name}
6560
+ `));
6561
+ } else {
6562
+ console.error(chalk38.red(`
6080
6563
  \u274C ${error.message}
6081
6564
  `));
6565
+ }
6082
6566
  process.exit(1);
6083
6567
  }
6084
6568
  });
@@ -6086,30 +6570,30 @@ function editCommand4(program2) {
6086
6570
 
6087
6571
  // src/commands/gemini/clone.ts
6088
6572
  init_dist2();
6089
- import chalk37 from "chalk";
6090
- import inquirer26 from "inquirer";
6573
+ import chalk39 from "chalk";
6574
+ import inquirer24 from "inquirer";
6091
6575
  function cloneCommand3(program2) {
6092
6576
  program2.command("clone [name]").description("\u514B\u9686 Gemini CLI \u670D\u52A1\u5546").action(async (name) => {
6093
6577
  try {
6094
6578
  const manager = createGeminiManager();
6095
6579
  const providers = manager.list();
6096
6580
  if (providers.length === 0) {
6097
- console.log(chalk37.yellow("\n\u26A0\uFE0F \u6682\u65E0 Gemini CLI \u670D\u52A1\u5546\n"));
6098
- console.log(chalk37.blue("\u{1F4A1} \u6DFB\u52A0\u670D\u52A1\u5546:") + chalk37.white(" ccman gm add\n"));
6581
+ console.log(chalk39.yellow("\n\u26A0\uFE0F \u6682\u65E0 Gemini CLI \u670D\u52A1\u5546\n"));
6582
+ console.log(chalk39.blue("\u{1F4A1} \u6DFB\u52A0\u670D\u52A1\u5546:") + chalk39.white(" ccman gm add\n"));
6099
6583
  return;
6100
6584
  }
6101
6585
  let sourceId;
6102
6586
  if (name) {
6103
6587
  const provider = manager.findByName(name);
6104
6588
  if (!provider) {
6105
- console.log(chalk37.red(`
6589
+ console.log(chalk39.red(`
6106
6590
  \u274C \u670D\u52A1\u5546\u4E0D\u5B58\u5728: ${name}
6107
6591
  `));
6108
6592
  process.exit(1);
6109
6593
  }
6110
6594
  sourceId = provider.id;
6111
6595
  } else {
6112
- const { selectedId } = await inquirer26.prompt([
6596
+ const { selectedId } = await inquirer24.prompt([
6113
6597
  {
6114
6598
  type: "list",
6115
6599
  name: "selectedId",
@@ -6122,7 +6606,7 @@ function cloneCommand3(program2) {
6122
6606
  ]);
6123
6607
  sourceId = selectedId;
6124
6608
  }
6125
- const { newName } = await inquirer26.prompt([
6609
+ const { newName } = await inquirer24.prompt([
6126
6610
  {
6127
6611
  type: "input",
6128
6612
  name: "newName",
@@ -6135,13 +6619,13 @@ function cloneCommand3(program2) {
6135
6619
  ]);
6136
6620
  const newProvider = manager.clone(sourceId, newName);
6137
6621
  console.log();
6138
- console.log(chalk37.green("\u2705 \u514B\u9686\u6210\u529F"));
6622
+ console.log(chalk39.green("\u2705 \u514B\u9686\u6210\u529F"));
6139
6623
  console.log();
6140
- console.log(` ${chalk37.bold(newProvider.name)} ${chalk37.blue("[Gemini CLI]")}`);
6141
- console.log(` ${chalk37.gray(newProvider.baseUrl || "(\u9ED8\u8BA4\u7AEF\u70B9)")}`);
6624
+ console.log(` ${chalk39.bold(newProvider.name)} ${chalk39.blue("[Gemini CLI]")}`);
6625
+ console.log(` ${chalk39.gray(newProvider.baseUrl || "(\u9ED8\u8BA4\u7AEF\u70B9)")}`);
6142
6626
  console.log();
6143
6627
  } catch (error) {
6144
- console.error(chalk37.red(`
6628
+ console.error(chalk39.red(`
6145
6629
  \u274C ${error.message}
6146
6630
  `));
6147
6631
  process.exit(1);
@@ -6162,15 +6646,32 @@ function createGeminiCommands(program2) {
6162
6646
 
6163
6647
  // src/commands/opencode/add.ts
6164
6648
  init_dist2();
6165
- import chalk38 from "chalk";
6166
- import inquirer27 from "inquirer";
6649
+ import chalk40 from "chalk";
6650
+ import inquirer25 from "inquirer";
6167
6651
  init_confirm();
6168
6652
  function addCommand5(program2) {
6169
- program2.command("add").description("\u6DFB\u52A0\u65B0\u7684 OpenCode \u670D\u52A1\u5546(\u4EA4\u4E92\u5F0F)").action(async () => {
6653
+ const command = program2.command("add").description("\u6DFB\u52A0\u65B0\u7684 OpenCode \u670D\u52A1\u5546");
6654
+ addProviderAddOptions(command);
6655
+ command.action(async (options) => {
6170
6656
  try {
6171
6657
  const manager = createOpenCodeManager();
6172
- console.log(chalk38.bold("\n\u{1F4DD} \u6DFB\u52A0 OpenCode \u670D\u52A1\u5546\n"));
6173
- const { usePreset } = await inquirer27.prompt([
6658
+ console.log(chalk40.bold("\n\u{1F4DD} \u6DFB\u52A0 OpenCode \u670D\u52A1\u5546\n"));
6659
+ const resolved = resolveProviderAddInput(options, OPENCODE_PRESETS);
6660
+ if (resolved.nonInteractive && resolved.input) {
6661
+ const provider2 = manager.add(resolved.input);
6662
+ printSuccess("\u6DFB\u52A0\u6210\u529F", [
6663
+ `${chalk40.bold(provider2.name)} ${toolBadge("opencode")}`,
6664
+ chalk40.gray(provider2.baseUrl)
6665
+ ]);
6666
+ if (resolved.switchNow) {
6667
+ manager.switch(provider2.id);
6668
+ printSuccess("\u5DF2\u5207\u6362\u5230\u65B0\u670D\u52A1\u5546", [chalk40.gray(`\u914D\u7F6E\u5DF2\u66F4\u65B0: ${getOpenCodeConfigPath()}`)]);
6669
+ } else {
6670
+ printTip(`\u7A0D\u540E\u5207\u6362: ${chalk40.white(`ccman oc use "${provider2.name}"`)}`);
6671
+ }
6672
+ return;
6673
+ }
6674
+ const { usePreset } = await inquirer25.prompt([
6174
6675
  {
6175
6676
  type: "list",
6176
6677
  name: "usePreset",
@@ -6186,7 +6687,7 @@ function addCommand5(program2) {
6186
6687
  let baseUrl;
6187
6688
  let apiKey;
6188
6689
  if (usePreset) {
6189
- const { presetName } = await inquirer27.prompt([
6690
+ const { presetName } = await inquirer25.prompt([
6190
6691
  {
6191
6692
  type: "list",
6192
6693
  name: "presetName",
@@ -6198,7 +6699,7 @@ function addCommand5(program2) {
6198
6699
  }
6199
6700
  ]);
6200
6701
  const preset = OPENCODE_PRESETS.find((p) => p.name === presetName);
6201
- console.log(chalk38.blue(`
6702
+ console.log(chalk40.blue(`
6202
6703
  \u4F7F\u7528\u9884\u8BBE: ${preset.name} - ${preset.description}
6203
6704
  `));
6204
6705
  const input = await promptProviderForm({
@@ -6212,7 +6713,7 @@ function addCommand5(program2) {
6212
6713
  baseUrl = input.baseUrl;
6213
6714
  apiKey = input.apiKey;
6214
6715
  } else {
6215
- const answers = await inquirer27.prompt([
6716
+ const answers = await inquirer25.prompt([
6216
6717
  {
6217
6718
  type: "input",
6218
6719
  name: "name",
@@ -6250,24 +6751,19 @@ function addCommand5(program2) {
6250
6751
  baseUrl,
6251
6752
  apiKey
6252
6753
  });
6253
- console.log();
6254
- console.log(chalk38.green("\u2705 \u6DFB\u52A0\u6210\u529F"));
6255
- console.log();
6256
- console.log(` ${chalk38.bold(provider.name)} ${chalk38.blue("[OpenCode]")}`);
6257
- console.log(` ${chalk38.gray(provider.baseUrl)}`);
6258
- console.log();
6754
+ printSuccess("\u6DFB\u52A0\u6210\u529F", [
6755
+ `${chalk40.bold(provider.name)} ${toolBadge("opencode")}`,
6756
+ chalk40.gray(provider.baseUrl)
6757
+ ]);
6259
6758
  const switchNow = await promptConfirm("\u662F\u5426\u7ACB\u5373\u5207\u6362\u5230\u6B64\u670D\u52A1\u5546?", true);
6260
6759
  if (switchNow) {
6261
6760
  manager.switch(provider.id);
6262
- console.log(chalk38.green("\u2705 \u5DF2\u5207\u6362\u5230\u65B0\u670D\u52A1\u5546"));
6263
- console.log();
6264
- console.log(chalk38.gray("\u914D\u7F6E\u5DF2\u66F4\u65B0:"));
6265
- console.log(chalk38.gray(` - ${getOpenCodeConfigPath()}`));
6761
+ printSuccess("\u5DF2\u5207\u6362\u5230\u65B0\u670D\u52A1\u5546", [chalk40.gray(`\u914D\u7F6E\u5DF2\u66F4\u65B0: ${getOpenCodeConfigPath()}`)]);
6266
6762
  } else {
6267
- console.log(chalk38.blue("\u{1F4A1} \u7A0D\u540E\u5207\u6362:") + chalk38.white(` ccman oc use "${provider.name}"`));
6763
+ printTip(`\u7A0D\u540E\u5207\u6362: ${chalk40.white(`ccman oc use "${provider.name}"`)}`);
6268
6764
  }
6269
6765
  } catch (error) {
6270
- console.error(chalk38.red(`
6766
+ console.error(chalk40.red(`
6271
6767
  \u274C ${error.message}
6272
6768
  `));
6273
6769
  process.exit(1);
@@ -6277,7 +6773,7 @@ function addCommand5(program2) {
6277
6773
 
6278
6774
  // src/commands/opencode/list.ts
6279
6775
  init_dist2();
6280
- import chalk39 from "chalk";
6776
+ import chalk41 from "chalk";
6281
6777
  function listCommand5(program2) {
6282
6778
  program2.command("list").alias("ls").description("\u5217\u51FA\u6240\u6709 OpenCode \u670D\u52A1\u5546").action(async () => {
6283
6779
  try {
@@ -6285,15 +6781,15 @@ function listCommand5(program2) {
6285
6781
  const providers = manager.list();
6286
6782
  const current = manager.getCurrent();
6287
6783
  if (providers.length === 0) {
6288
- console.log(chalk39.yellow("\n\u26A0\uFE0F \u6682\u65E0 OpenCode \u670D\u52A1\u5546\n"));
6289
- console.log(chalk39.blue("\u{1F4A1} \u6DFB\u52A0\u670D\u52A1\u5546:") + chalk39.white(" ccman oc add\n"));
6784
+ printWarning("\u6682\u65E0 OpenCode \u670D\u52A1\u5546");
6785
+ printTip("\u6DFB\u52A0\u670D\u52A1\u5546: " + chalk41.white("ccman oc add"));
6290
6786
  return;
6291
6787
  }
6292
- console.log(chalk39.bold(`
6293
- \u{1F4CB} OpenCode \u670D\u52A1\u5546 (${providers.length} \u4E2A)`));
6294
- console.log(formatProviderTable(providers, current?.id));
6788
+ console.log(
6789
+ formatProviderTable(providers, current?.id, `OpenCode \u670D\u52A1\u5546 (${providers.length} \u4E2A)`)
6790
+ );
6295
6791
  } catch (error) {
6296
- console.error(chalk39.red(`
6792
+ console.error(chalk41.red(`
6297
6793
  \u274C ${error.message}
6298
6794
  `));
6299
6795
  process.exit(1);
@@ -6303,16 +6799,16 @@ function listCommand5(program2) {
6303
6799
 
6304
6800
  // src/commands/opencode/use.ts
6305
6801
  init_dist2();
6306
- import chalk40 from "chalk";
6307
- import inquirer28 from "inquirer";
6802
+ import chalk42 from "chalk";
6803
+ import inquirer26 from "inquirer";
6308
6804
  function useCommand4(program2) {
6309
6805
  program2.command("use [name]").description("\u5207\u6362 OpenCode \u670D\u52A1\u5546").action(async (name) => {
6310
6806
  try {
6311
6807
  const manager = createOpenCodeManager();
6312
6808
  const providers = manager.list();
6313
6809
  if (providers.length === 0) {
6314
- console.log(chalk40.yellow("\n\u26A0\uFE0F \u6682\u65E0 OpenCode \u670D\u52A1\u5546\n"));
6315
- console.log(chalk40.blue("\u{1F4A1} \u6DFB\u52A0\u670D\u52A1\u5546:") + chalk40.white(" ccman oc add\n"));
6810
+ printWarning("\u6682\u65E0 OpenCode \u670D\u52A1\u5546");
6811
+ printTip("\u6DFB\u52A0\u670D\u52A1\u5546: " + chalk42.white("ccman oc add"));
6316
6812
  return;
6317
6813
  }
6318
6814
  let targetId;
@@ -6323,7 +6819,7 @@ function useCommand4(program2) {
6323
6819
  }
6324
6820
  targetId = provider2.id;
6325
6821
  } else {
6326
- const { selectedId } = await inquirer28.prompt([
6822
+ const { selectedId } = await inquirer26.prompt([
6327
6823
  {
6328
6824
  type: "list",
6329
6825
  name: "selectedId",
@@ -6338,19 +6834,18 @@ function useCommand4(program2) {
6338
6834
  }
6339
6835
  manager.switch(targetId);
6340
6836
  const provider = manager.get(targetId);
6341
- console.log(chalk40.green("\n\u2705 \u5207\u6362\u6210\u529F\n"));
6342
- console.log(` ${chalk40.bold(provider.name)} ${chalk40.blue("[OpenCode]")}`);
6343
- console.log(` ${chalk40.gray(`URL: ${provider.baseUrl}`)}`);
6344
- console.log();
6345
- console.log(chalk40.gray("\u914D\u7F6E\u5DF2\u66F4\u65B0:"));
6346
- console.log(chalk40.gray(` - ${getOpenCodeConfigPath()}`));
6837
+ printSuccess("\u5207\u6362\u6210\u529F", [
6838
+ `${chalk42.bold(provider.name)} ${toolBadge("opencode")}`,
6839
+ chalk42.gray(`URL: ${provider.baseUrl}`),
6840
+ chalk42.gray(`\u914D\u7F6E\u5DF2\u66F4\u65B0: ${getOpenCodeConfigPath()}`)
6841
+ ]);
6347
6842
  } catch (error) {
6348
6843
  if (error instanceof ProviderNotFoundError) {
6349
- console.error(chalk40.red(`
6844
+ console.error(chalk42.red(`
6350
6845
  \u274C \u670D\u52A1\u5546\u4E0D\u5B58\u5728: ${name}
6351
6846
  `));
6352
6847
  } else {
6353
- console.error(chalk40.red(`
6848
+ console.error(chalk42.red(`
6354
6849
  \u274C ${error.message}
6355
6850
  `));
6356
6851
  }
@@ -6361,23 +6856,30 @@ function useCommand4(program2) {
6361
6856
 
6362
6857
  // src/commands/opencode/current.ts
6363
6858
  init_dist2();
6364
- import chalk41 from "chalk";
6859
+ import chalk43 from "chalk";
6365
6860
  function currentCommand4(program2) {
6366
6861
  program2.command("current").description("\u663E\u793A\u5F53\u524D OpenCode \u670D\u52A1\u5546").action(async () => {
6367
6862
  try {
6368
6863
  const manager = createOpenCodeManager();
6369
6864
  const current = manager.getCurrent();
6370
6865
  if (!current) {
6371
- console.log(chalk41.yellow("\n\u26A0\uFE0F \u5F53\u524D\u6CA1\u6709\u6FC0\u6D3B\u7684 OpenCode \u670D\u52A1\u5546\n"));
6372
- console.log(chalk41.blue("\u{1F4A1} \u5217\u51FA\u670D\u52A1\u5546:") + chalk41.white(" ccman oc list\n"));
6866
+ printWarning("\u672A\u9009\u62E9\u4EFB\u4F55 OpenCode \u670D\u52A1\u5546");
6867
+ printTip("\u9009\u62E9\u670D\u52A1\u5546: " + chalk43.white("ccman oc use"));
6373
6868
  return;
6374
6869
  }
6375
- console.log(chalk41.bold("\n\u{1F3AF} \u5F53\u524D OpenCode \u670D\u52A1\u5546\n"));
6376
- console.log(` \u540D\u79F0: ${chalk41.bold(current.name)}`);
6377
- console.log(` \u5730\u5740: ${chalk41.gray(current.baseUrl)}`);
6378
- console.log();
6870
+ const lines = [
6871
+ chalk43.green.bold(current.name),
6872
+ chalk43.gray(`ID: ${current.id}`),
6873
+ chalk43.gray(`URL: ${current.baseUrl}`)
6874
+ ];
6875
+ if (current.lastUsedAt) {
6876
+ lines.push(
6877
+ chalk43.gray(`\u6700\u540E\u4F7F\u7528: ${new Date(current.lastUsedAt).toLocaleString("zh-CN")}`)
6878
+ );
6879
+ }
6880
+ printInfo("\u{1F4CD} \u5F53\u524D OpenCode \u670D\u52A1\u5546", lines);
6379
6881
  } catch (error) {
6380
- console.error(chalk41.red(`
6882
+ console.error(chalk43.red(`
6381
6883
  \u274C ${error.message}
6382
6884
  `));
6383
6885
  process.exit(1);
@@ -6387,18 +6889,21 @@ function currentCommand4(program2) {
6387
6889
 
6388
6890
  // src/commands/opencode/edit.ts
6389
6891
  init_dist2();
6390
- import chalk42 from "chalk";
6391
- import inquirer29 from "inquirer";
6892
+ import chalk44 from "chalk";
6893
+ import inquirer27 from "inquirer";
6392
6894
  function editCommand5(program2) {
6393
- program2.command("edit [name]").description("\u7F16\u8F91 OpenCode \u670D\u52A1\u5546").action(async (name) => {
6895
+ const command = program2.command("edit [name]").description("\u7F16\u8F91 OpenCode \u670D\u52A1\u5546");
6896
+ addProviderEditOptions(command);
6897
+ command.action(async (name, options) => {
6394
6898
  try {
6395
6899
  const manager = createOpenCodeManager();
6396
6900
  const providers = manager.list();
6397
6901
  if (providers.length === 0) {
6398
- console.log(chalk42.yellow("\n\u26A0\uFE0F \u6682\u65E0 OpenCode \u670D\u52A1\u5546\n"));
6399
- console.log(chalk42.blue("\u{1F4A1} \u6DFB\u52A0\u670D\u52A1\u5546:") + chalk42.white(" ccman oc add\n"));
6902
+ console.log(chalk44.yellow("\n\u26A0\uFE0F \u6682\u65E0 OpenCode \u670D\u52A1\u5546\n"));
6903
+ console.log(chalk44.blue("\u{1F4A1} \u6DFB\u52A0\u670D\u52A1\u5546:") + chalk44.white(" ccman oc add\n"));
6400
6904
  return;
6401
6905
  }
6906
+ const resolved = resolveProviderEditInput(options);
6402
6907
  let targetId;
6403
6908
  if (name) {
6404
6909
  const provider2 = manager.findByName(name);
@@ -6406,8 +6911,10 @@ function editCommand5(program2) {
6406
6911
  throw new ProviderNotFoundError(name);
6407
6912
  }
6408
6913
  targetId = provider2.id;
6914
+ } else if (resolved.nonInteractive) {
6915
+ throw new Error("\u975E\u4EA4\u4E92\u6A21\u5F0F\u8BF7\u63D0\u4F9B\u8981\u7F16\u8F91\u7684\u670D\u52A1\u5546\u540D\u79F0");
6409
6916
  } else {
6410
- const { selectedId } = await inquirer29.prompt([
6917
+ const { selectedId } = await inquirer27.prompt([
6411
6918
  {
6412
6919
  type: "list",
6413
6920
  name: "selectedId",
@@ -6421,6 +6928,15 @@ function editCommand5(program2) {
6421
6928
  targetId = selectedId;
6422
6929
  }
6423
6930
  const provider = manager.get(targetId);
6931
+ if (resolved.nonInteractive) {
6932
+ if (Object.keys(resolved.updates).length === 0) {
6933
+ console.log(chalk44.gray("\n\u672A\u505A\u4EFB\u4F55\u4FEE\u6539\n"));
6934
+ return;
6935
+ }
6936
+ manager.edit(targetId, resolved.updates);
6937
+ console.log(chalk44.green("\n\u2705 \u7F16\u8F91\u6210\u529F\n"));
6938
+ return;
6939
+ }
6424
6940
  const input = await promptProviderForm({
6425
6941
  name: provider.name,
6426
6942
  desc: provider.desc ?? "",
@@ -6433,14 +6949,14 @@ function editCommand5(program2) {
6433
6949
  baseUrl: input.baseUrl,
6434
6950
  apiKey: input.apiKey
6435
6951
  });
6436
- console.log(chalk42.green("\n\u2705 \u7F16\u8F91\u6210\u529F\n"));
6952
+ console.log(chalk44.green("\n\u2705 \u7F16\u8F91\u6210\u529F\n"));
6437
6953
  } catch (error) {
6438
6954
  if (error instanceof ProviderNotFoundError) {
6439
- console.error(chalk42.red(`
6955
+ console.error(chalk44.red(`
6440
6956
  \u274C \u670D\u52A1\u5546\u4E0D\u5B58\u5728: ${name}
6441
6957
  `));
6442
6958
  } else {
6443
- console.error(chalk42.red(`
6959
+ console.error(chalk44.red(`
6444
6960
  \u274C ${error.message}
6445
6961
  `));
6446
6962
  }
@@ -6451,16 +6967,17 @@ function editCommand5(program2) {
6451
6967
 
6452
6968
  // src/commands/opencode/remove.ts
6453
6969
  init_dist2();
6454
- init_confirm();
6455
- import chalk43 from "chalk";
6456
- import inquirer30 from "inquirer";
6970
+ import chalk45 from "chalk";
6971
+ import inquirer28 from "inquirer";
6457
6972
  function removeCommand5(program2) {
6458
- program2.command("remove [name]").alias("rm").description("\u5220\u9664 OpenCode \u670D\u52A1\u5546").action(async (name) => {
6973
+ const command = program2.command("remove [name]").alias("rm").description("\u5220\u9664 OpenCode \u670D\u52A1\u5546");
6974
+ addProviderRemoveOptions(command);
6975
+ command.action(async (name, options) => {
6459
6976
  try {
6460
6977
  const manager = createOpenCodeManager();
6461
6978
  const providers = manager.list();
6462
6979
  if (providers.length === 0) {
6463
- console.log(chalk43.yellow("\n\u26A0\uFE0F \u6682\u65E0 OpenCode \u670D\u52A1\u5546\n"));
6980
+ console.log(chalk45.yellow("\n\u26A0\uFE0F \u6682\u65E0 OpenCode \u670D\u52A1\u5546\n"));
6464
6981
  return;
6465
6982
  }
6466
6983
  let targetId;
@@ -6472,8 +6989,10 @@ function removeCommand5(program2) {
6472
6989
  }
6473
6990
  targetId = provider.id;
6474
6991
  targetName = provider.name;
6992
+ } else if (options.yes) {
6993
+ throw new Error("\u975E\u4EA4\u4E92\u6A21\u5F0F\u8BF7\u63D0\u4F9B\u8981\u5220\u9664\u7684\u670D\u52A1\u5546\u540D\u79F0");
6475
6994
  } else {
6476
- const { selectedId } = await inquirer30.prompt([
6995
+ const { selectedId } = await inquirer28.prompt([
6477
6996
  {
6478
6997
  type: "list",
6479
6998
  name: "selectedId",
@@ -6488,22 +7007,22 @@ function removeCommand5(program2) {
6488
7007
  targetId = selectedId;
6489
7008
  targetName = provider.name;
6490
7009
  }
6491
- const confirmed = await promptConfirm(`\u786E\u5B9A\u5220\u9664 "${targetName}"?`, false);
7010
+ const confirmed = await confirmProviderRemoval(targetName, options);
6492
7011
  if (!confirmed) {
6493
- console.log(chalk43.gray("\n\u5DF2\u53D6\u6D88\n"));
7012
+ console.log(chalk45.gray("\n\u5DF2\u53D6\u6D88\n"));
6494
7013
  return;
6495
7014
  }
6496
7015
  manager.remove(targetId);
6497
- console.log(chalk43.green(`
7016
+ console.log(chalk45.green(`
6498
7017
  \u2705 \u5DF2\u5220\u9664: ${targetName}
6499
7018
  `));
6500
7019
  } catch (error) {
6501
7020
  if (error instanceof ProviderNotFoundError) {
6502
- console.error(chalk43.red(`
7021
+ console.error(chalk45.red(`
6503
7022
  \u274C \u670D\u52A1\u5546\u4E0D\u5B58\u5728: ${name}
6504
7023
  `));
6505
7024
  } else {
6506
- console.error(chalk43.red(`
7025
+ console.error(chalk45.red(`
6507
7026
  \u274C ${error.message}
6508
7027
  `));
6509
7028
  }
@@ -6514,15 +7033,15 @@ function removeCommand5(program2) {
6514
7033
 
6515
7034
  // src/commands/opencode/clone.ts
6516
7035
  init_dist2();
6517
- import chalk44 from "chalk";
6518
- import inquirer31 from "inquirer";
7036
+ import chalk46 from "chalk";
7037
+ import inquirer29 from "inquirer";
6519
7038
  function cloneCommand4(program2) {
6520
7039
  program2.command("clone [source-name] [new-name]").description("\u514B\u9686 OpenCode \u670D\u52A1\u5546").action(async (sourceName, newName) => {
6521
7040
  try {
6522
7041
  const manager = createOpenCodeManager();
6523
7042
  const providers = manager.list();
6524
7043
  if (providers.length === 0) {
6525
- console.log(chalk44.yellow("\n\u26A0\uFE0F \u6682\u65E0 OpenCode \u670D\u52A1\u5546\n"));
7044
+ console.log(chalk46.yellow("\n\u26A0\uFE0F \u6682\u65E0 OpenCode \u670D\u52A1\u5546\n"));
6526
7045
  return;
6527
7046
  }
6528
7047
  let sourceId;
@@ -6533,7 +7052,7 @@ function cloneCommand4(program2) {
6533
7052
  }
6534
7053
  sourceId = provider.id;
6535
7054
  } else {
6536
- const { selectedId } = await inquirer31.prompt([
7055
+ const { selectedId } = await inquirer29.prompt([
6537
7056
  {
6538
7057
  type: "list",
6539
7058
  name: "selectedId",
@@ -6551,7 +7070,7 @@ function cloneCommand4(program2) {
6551
7070
  if (newName) {
6552
7071
  cloned = manager.clone(sourceId, newName);
6553
7072
  } else {
6554
- console.log(chalk44.blue(`
7073
+ console.log(chalk46.blue(`
6555
7074
  \u514B\u9686\u81EA: ${source.name}
6556
7075
  `));
6557
7076
  const input = await promptProviderForm({
@@ -6568,14 +7087,14 @@ function cloneCommand4(program2) {
6568
7087
  });
6569
7088
  }
6570
7089
  console.log();
6571
- console.log(chalk44.green("\u2705 \u514B\u9686\u6210\u529F"));
7090
+ console.log(chalk46.green("\u2705 \u514B\u9686\u6210\u529F"));
6572
7091
  console.log();
6573
- console.log(` ${chalk44.bold(cloned.name)} ${chalk44.blue("[OpenCode]")}`);
6574
- console.log(` ${chalk44.gray(`ID: ${cloned.id}`)}`);
6575
- console.log(` ${chalk44.gray(`URL: ${cloned.baseUrl}`)}`);
7092
+ console.log(` ${chalk46.bold(cloned.name)} ${chalk46.blue("[OpenCode]")}`);
7093
+ console.log(` ${chalk46.gray(`ID: ${cloned.id}`)}`);
7094
+ console.log(` ${chalk46.gray(`URL: ${cloned.baseUrl}`)}`);
6576
7095
  console.log();
6577
7096
  } catch (error) {
6578
- console.error(chalk44.red(`
7097
+ console.error(chalk46.red(`
6579
7098
  \u274C ${error.message}
6580
7099
  `));
6581
7100
  process.exit(1);
@@ -6596,15 +7115,35 @@ function createOpenCodeCommands(program2) {
6596
7115
 
6597
7116
  // src/commands/openclaw/add.ts
6598
7117
  init_dist2();
6599
- import chalk45 from "chalk";
6600
- import inquirer32 from "inquirer";
7118
+ import chalk47 from "chalk";
7119
+ import inquirer30 from "inquirer";
6601
7120
  init_confirm();
6602
7121
  function addCommand6(program2) {
6603
- program2.command("add").description("\u6DFB\u52A0\u65B0\u7684 OpenClaw \u670D\u52A1\u5546(\u4EA4\u4E92\u5F0F)").action(async () => {
7122
+ const command = program2.command("add").description("\u6DFB\u52A0\u65B0\u7684 OpenClaw \u670D\u52A1\u5546");
7123
+ addProviderAddOptions(command);
7124
+ command.action(async (options) => {
6604
7125
  try {
6605
7126
  const manager = createOpenClawManager();
6606
- console.log(chalk45.bold("\n\u{1F4DD} \u6DFB\u52A0 OpenClaw \u670D\u52A1\u5546\n"));
6607
- const { usePreset } = await inquirer32.prompt([
7127
+ console.log(chalk47.bold("\n\u{1F4DD} \u6DFB\u52A0 OpenClaw \u670D\u52A1\u5546\n"));
7128
+ const resolved = resolveProviderAddInput(options, OPENCLAW_PRESETS);
7129
+ if (resolved.nonInteractive && resolved.input) {
7130
+ const provider2 = manager.add(resolved.input);
7131
+ printSuccess("\u6DFB\u52A0\u6210\u529F", [
7132
+ `${chalk47.bold(provider2.name)} ${toolBadge("openclaw")}`,
7133
+ chalk47.gray(provider2.baseUrl)
7134
+ ]);
7135
+ if (resolved.switchNow) {
7136
+ manager.switch(provider2.id);
7137
+ printSuccess("\u5DF2\u5207\u6362\u5230\u65B0\u670D\u52A1\u5546", [
7138
+ chalk47.gray(`\u914D\u7F6E\u5DF2\u66F4\u65B0: ${getOpenClawConfigPath()}`),
7139
+ chalk47.gray(`\u914D\u7F6E\u5DF2\u66F4\u65B0: ${getOpenClawModelsPath()}`)
7140
+ ]);
7141
+ } else {
7142
+ printTip(`\u7A0D\u540E\u5207\u6362: ${chalk47.white(`ccman openclaw use "${provider2.name}"`)}`);
7143
+ }
7144
+ return;
7145
+ }
7146
+ const { usePreset } = await inquirer30.prompt([
6608
7147
  {
6609
7148
  type: "list",
6610
7149
  name: "usePreset",
@@ -6620,7 +7159,7 @@ function addCommand6(program2) {
6620
7159
  let baseUrl;
6621
7160
  let apiKey;
6622
7161
  if (usePreset) {
6623
- const { presetName } = await inquirer32.prompt([
7162
+ const { presetName } = await inquirer30.prompt([
6624
7163
  {
6625
7164
  type: "list",
6626
7165
  name: "presetName",
@@ -6632,7 +7171,7 @@ function addCommand6(program2) {
6632
7171
  }
6633
7172
  ]);
6634
7173
  const preset = OPENCLAW_PRESETS.find((p) => p.name === presetName);
6635
- console.log(chalk45.blue(`
7174
+ console.log(chalk47.blue(`
6636
7175
  \u4F7F\u7528\u9884\u8BBE: ${preset.name} - ${preset.description}
6637
7176
  `));
6638
7177
  const input = await promptProviderForm({
@@ -6646,7 +7185,7 @@ function addCommand6(program2) {
6646
7185
  baseUrl = input.baseUrl;
6647
7186
  apiKey = input.apiKey;
6648
7187
  } else {
6649
- const answers = await inquirer32.prompt([
7188
+ const answers = await inquirer30.prompt([
6650
7189
  {
6651
7190
  type: "input",
6652
7191
  name: "name",
@@ -6684,27 +7223,22 @@ function addCommand6(program2) {
6684
7223
  baseUrl,
6685
7224
  apiKey
6686
7225
  });
6687
- console.log();
6688
- console.log(chalk45.green("\u2705 \u6DFB\u52A0\u6210\u529F"));
6689
- console.log();
6690
- console.log(` ${chalk45.bold(provider.name)} ${chalk45.blue("[OpenClaw]")}`);
6691
- console.log(` ${chalk45.gray(provider.baseUrl)}`);
6692
- console.log();
7226
+ printSuccess("\u6DFB\u52A0\u6210\u529F", [
7227
+ `${chalk47.bold(provider.name)} ${toolBadge("openclaw")}`,
7228
+ chalk47.gray(provider.baseUrl)
7229
+ ]);
6693
7230
  const switchNow = await promptConfirm("\u662F\u5426\u7ACB\u5373\u5207\u6362\u5230\u6B64\u670D\u52A1\u5546?", true);
6694
7231
  if (switchNow) {
6695
7232
  manager.switch(provider.id);
6696
- console.log(chalk45.green("\u2705 \u5DF2\u5207\u6362\u5230\u65B0\u670D\u52A1\u5546"));
6697
- console.log();
6698
- console.log(chalk45.gray("\u914D\u7F6E\u5DF2\u66F4\u65B0:"));
6699
- console.log(chalk45.gray(` - ${getOpenClawConfigPath()}`));
6700
- console.log(chalk45.gray(` - ${getOpenClawModelsPath()}`));
7233
+ printSuccess("\u5DF2\u5207\u6362\u5230\u65B0\u670D\u52A1\u5546", [
7234
+ chalk47.gray(`\u914D\u7F6E\u5DF2\u66F4\u65B0: ${getOpenClawConfigPath()}`),
7235
+ chalk47.gray(`\u914D\u7F6E\u5DF2\u66F4\u65B0: ${getOpenClawModelsPath()}`)
7236
+ ]);
6701
7237
  } else {
6702
- console.log(
6703
- chalk45.blue("\u{1F4A1} \u7A0D\u540E\u5207\u6362:") + chalk45.white(` ccman openclaw use "${provider.name}"`)
6704
- );
7238
+ printTip(`\u7A0D\u540E\u5207\u6362: ${chalk47.white(`ccman openclaw use "${provider.name}"`)}`);
6705
7239
  }
6706
7240
  } catch (error) {
6707
- console.error(chalk45.red(`
7241
+ console.error(chalk47.red(`
6708
7242
  \u274C ${error.message}
6709
7243
  `));
6710
7244
  process.exit(1);
@@ -6714,7 +7248,7 @@ function addCommand6(program2) {
6714
7248
 
6715
7249
  // src/commands/openclaw/list.ts
6716
7250
  init_dist2();
6717
- import chalk46 from "chalk";
7251
+ import chalk48 from "chalk";
6718
7252
  function listCommand6(program2) {
6719
7253
  program2.command("list").alias("ls").description("\u5217\u51FA\u6240\u6709 OpenClaw \u670D\u52A1\u5546").action(async () => {
6720
7254
  try {
@@ -6722,15 +7256,15 @@ function listCommand6(program2) {
6722
7256
  const providers = manager.list();
6723
7257
  const current = manager.getCurrent();
6724
7258
  if (providers.length === 0) {
6725
- console.log(chalk46.yellow("\n\u26A0\uFE0F \u6682\u65E0 OpenClaw \u670D\u52A1\u5546\n"));
6726
- console.log(chalk46.blue("\u{1F4A1} \u6DFB\u52A0\u670D\u52A1\u5546:") + chalk46.white(" ccman openclaw add\n"));
7259
+ printWarning("\u6682\u65E0 OpenClaw \u670D\u52A1\u5546");
7260
+ printTip("\u6DFB\u52A0\u670D\u52A1\u5546: " + chalk48.white("ccman openclaw add"));
6727
7261
  return;
6728
7262
  }
6729
- console.log(chalk46.bold(`
6730
- \u{1F4CB} OpenClaw \u670D\u52A1\u5546 (${providers.length} \u4E2A)`));
6731
- console.log(formatProviderTable(providers, current?.id));
7263
+ console.log(
7264
+ formatProviderTable(providers, current?.id, `OpenClaw \u670D\u52A1\u5546 (${providers.length} \u4E2A)`)
7265
+ );
6732
7266
  } catch (error) {
6733
- console.error(chalk46.red(`
7267
+ console.error(chalk48.red(`
6734
7268
  \u274C ${error.message}
6735
7269
  `));
6736
7270
  process.exit(1);
@@ -6740,16 +7274,16 @@ function listCommand6(program2) {
6740
7274
 
6741
7275
  // src/commands/openclaw/use.ts
6742
7276
  init_dist2();
6743
- import chalk47 from "chalk";
6744
- import inquirer33 from "inquirer";
7277
+ import chalk49 from "chalk";
7278
+ import inquirer31 from "inquirer";
6745
7279
  function useCommand5(program2) {
6746
7280
  program2.command("use [name]").description("\u5207\u6362 OpenClaw \u670D\u52A1\u5546").action(async (name) => {
6747
7281
  try {
6748
7282
  const manager = createOpenClawManager();
6749
7283
  const providers = manager.list();
6750
7284
  if (providers.length === 0) {
6751
- console.log(chalk47.yellow("\n\u26A0\uFE0F \u6682\u65E0 OpenClaw \u670D\u52A1\u5546\n"));
6752
- console.log(chalk47.blue("\u{1F4A1} \u6DFB\u52A0\u670D\u52A1\u5546:") + chalk47.white(" ccman openclaw add\n"));
7285
+ printWarning("\u6682\u65E0 OpenClaw \u670D\u52A1\u5546");
7286
+ printTip("\u6DFB\u52A0\u670D\u52A1\u5546: " + chalk49.white("ccman openclaw add"));
6753
7287
  return;
6754
7288
  }
6755
7289
  let targetId;
@@ -6760,7 +7294,7 @@ function useCommand5(program2) {
6760
7294
  }
6761
7295
  targetId = provider2.id;
6762
7296
  } else {
6763
- const { selectedId } = await inquirer33.prompt([
7297
+ const { selectedId } = await inquirer31.prompt([
6764
7298
  {
6765
7299
  type: "list",
6766
7300
  name: "selectedId",
@@ -6775,20 +7309,19 @@ function useCommand5(program2) {
6775
7309
  }
6776
7310
  manager.switch(targetId);
6777
7311
  const provider = manager.get(targetId);
6778
- console.log(chalk47.green("\n\u2705 \u5207\u6362\u6210\u529F\n"));
6779
- console.log(` ${chalk47.bold(provider.name)} ${chalk47.blue("[OpenClaw]")}`);
6780
- console.log(` ${chalk47.gray(`URL: ${provider.baseUrl}`)}`);
6781
- console.log();
6782
- console.log(chalk47.gray("\u914D\u7F6E\u5DF2\u66F4\u65B0:"));
6783
- console.log(chalk47.gray(` - ${getOpenClawConfigPath()}`));
6784
- console.log(chalk47.gray(` - ${getOpenClawModelsPath()}`));
7312
+ printSuccess("\u5207\u6362\u6210\u529F", [
7313
+ `${chalk49.bold(provider.name)} ${toolBadge("openclaw")}`,
7314
+ chalk49.gray(`URL: ${provider.baseUrl}`),
7315
+ chalk49.gray(`\u914D\u7F6E\u5DF2\u66F4\u65B0: ${getOpenClawConfigPath()}`),
7316
+ chalk49.gray(`\u914D\u7F6E\u5DF2\u66F4\u65B0: ${getOpenClawModelsPath()}`)
7317
+ ]);
6785
7318
  } catch (error) {
6786
7319
  if (error instanceof ProviderNotFoundError) {
6787
- console.error(chalk47.red(`
7320
+ console.error(chalk49.red(`
6788
7321
  \u274C \u670D\u52A1\u5546\u4E0D\u5B58\u5728: ${name}
6789
7322
  `));
6790
7323
  } else {
6791
- console.error(chalk47.red(`
7324
+ console.error(chalk49.red(`
6792
7325
  \u274C ${error.message}
6793
7326
  `));
6794
7327
  }
@@ -6799,23 +7332,30 @@ function useCommand5(program2) {
6799
7332
 
6800
7333
  // src/commands/openclaw/current.ts
6801
7334
  init_dist2();
6802
- import chalk48 from "chalk";
7335
+ import chalk50 from "chalk";
6803
7336
  function currentCommand5(program2) {
6804
7337
  program2.command("current").description("\u663E\u793A\u5F53\u524D OpenClaw \u670D\u52A1\u5546").action(async () => {
6805
7338
  try {
6806
7339
  const manager = createOpenClawManager();
6807
7340
  const current = manager.getCurrent();
6808
7341
  if (!current) {
6809
- console.log(chalk48.yellow("\n\u26A0\uFE0F \u5F53\u524D\u6CA1\u6709\u6FC0\u6D3B\u7684 OpenClaw \u670D\u52A1\u5546\n"));
6810
- console.log(chalk48.blue("\u{1F4A1} \u5217\u51FA\u670D\u52A1\u5546:") + chalk48.white(" ccman openclaw list\n"));
7342
+ printWarning("\u672A\u9009\u62E9\u4EFB\u4F55 OpenClaw \u670D\u52A1\u5546");
7343
+ printTip("\u9009\u62E9\u670D\u52A1\u5546: " + chalk50.white("ccman openclaw use"));
6811
7344
  return;
6812
7345
  }
6813
- console.log(chalk48.bold("\n\u{1F3AF} \u5F53\u524D OpenClaw \u670D\u52A1\u5546\n"));
6814
- console.log(` \u540D\u79F0: ${chalk48.bold(current.name)}`);
6815
- console.log(` \u5730\u5740: ${chalk48.gray(current.baseUrl)}`);
6816
- console.log();
7346
+ const lines = [
7347
+ chalk50.green.bold(current.name),
7348
+ chalk50.gray(`ID: ${current.id}`),
7349
+ chalk50.gray(`URL: ${current.baseUrl}`)
7350
+ ];
7351
+ if (current.lastUsedAt) {
7352
+ lines.push(
7353
+ chalk50.gray(`\u6700\u540E\u4F7F\u7528: ${new Date(current.lastUsedAt).toLocaleString("zh-CN")}`)
7354
+ );
7355
+ }
7356
+ printInfo("\u{1F4CD} \u5F53\u524D OpenClaw \u670D\u52A1\u5546", lines);
6817
7357
  } catch (error) {
6818
- console.error(chalk48.red(`
7358
+ console.error(chalk50.red(`
6819
7359
  \u274C ${error.message}
6820
7360
  `));
6821
7361
  process.exit(1);
@@ -6825,18 +7365,21 @@ function currentCommand5(program2) {
6825
7365
 
6826
7366
  // src/commands/openclaw/edit.ts
6827
7367
  init_dist2();
6828
- import chalk49 from "chalk";
6829
- import inquirer34 from "inquirer";
7368
+ import chalk51 from "chalk";
7369
+ import inquirer32 from "inquirer";
6830
7370
  function editCommand6(program2) {
6831
- program2.command("edit [name]").description("\u7F16\u8F91 OpenClaw \u670D\u52A1\u5546").action(async (name) => {
7371
+ const command = program2.command("edit [name]").description("\u7F16\u8F91 OpenClaw \u670D\u52A1\u5546");
7372
+ addProviderEditOptions(command);
7373
+ command.action(async (name, options) => {
6832
7374
  try {
6833
7375
  const manager = createOpenClawManager();
6834
7376
  const providers = manager.list();
6835
7377
  if (providers.length === 0) {
6836
- console.log(chalk49.yellow("\n\u26A0\uFE0F \u6682\u65E0 OpenClaw \u670D\u52A1\u5546\n"));
6837
- console.log(chalk49.blue("\u{1F4A1} \u6DFB\u52A0\u670D\u52A1\u5546:") + chalk49.white(" ccman openclaw add\n"));
7378
+ console.log(chalk51.yellow("\n\u26A0\uFE0F \u6682\u65E0 OpenClaw \u670D\u52A1\u5546\n"));
7379
+ console.log(chalk51.blue("\u{1F4A1} \u6DFB\u52A0\u670D\u52A1\u5546:") + chalk51.white(" ccman openclaw add\n"));
6838
7380
  return;
6839
7381
  }
7382
+ const resolved = resolveProviderEditInput(options);
6840
7383
  let targetId;
6841
7384
  if (name) {
6842
7385
  const provider2 = manager.findByName(name);
@@ -6844,8 +7387,10 @@ function editCommand6(program2) {
6844
7387
  throw new ProviderNotFoundError(name);
6845
7388
  }
6846
7389
  targetId = provider2.id;
7390
+ } else if (resolved.nonInteractive) {
7391
+ throw new Error("\u975E\u4EA4\u4E92\u6A21\u5F0F\u8BF7\u63D0\u4F9B\u8981\u7F16\u8F91\u7684\u670D\u52A1\u5546\u540D\u79F0");
6847
7392
  } else {
6848
- const { selectedId } = await inquirer34.prompt([
7393
+ const { selectedId } = await inquirer32.prompt([
6849
7394
  {
6850
7395
  type: "list",
6851
7396
  name: "selectedId",
@@ -6859,6 +7404,15 @@ function editCommand6(program2) {
6859
7404
  targetId = selectedId;
6860
7405
  }
6861
7406
  const provider = manager.get(targetId);
7407
+ if (resolved.nonInteractive) {
7408
+ if (Object.keys(resolved.updates).length === 0) {
7409
+ console.log(chalk51.gray("\n\u672A\u505A\u4EFB\u4F55\u4FEE\u6539\n"));
7410
+ return;
7411
+ }
7412
+ manager.edit(targetId, resolved.updates);
7413
+ console.log(chalk51.green("\n\u2705 \u7F16\u8F91\u6210\u529F\n"));
7414
+ return;
7415
+ }
6862
7416
  const input = await promptProviderForm({
6863
7417
  name: provider.name,
6864
7418
  desc: provider.desc ?? "",
@@ -6871,14 +7425,14 @@ function editCommand6(program2) {
6871
7425
  baseUrl: input.baseUrl,
6872
7426
  apiKey: input.apiKey
6873
7427
  });
6874
- console.log(chalk49.green("\n\u2705 \u7F16\u8F91\u6210\u529F\n"));
7428
+ console.log(chalk51.green("\n\u2705 \u7F16\u8F91\u6210\u529F\n"));
6875
7429
  } catch (error) {
6876
7430
  if (error instanceof ProviderNotFoundError) {
6877
- console.error(chalk49.red(`
7431
+ console.error(chalk51.red(`
6878
7432
  \u274C \u670D\u52A1\u5546\u4E0D\u5B58\u5728: ${name}
6879
7433
  `));
6880
7434
  } else {
6881
- console.error(chalk49.red(`
7435
+ console.error(chalk51.red(`
6882
7436
  \u274C ${error.message}
6883
7437
  `));
6884
7438
  }
@@ -6889,16 +7443,17 @@ function editCommand6(program2) {
6889
7443
 
6890
7444
  // src/commands/openclaw/remove.ts
6891
7445
  init_dist2();
6892
- init_confirm();
6893
- import chalk50 from "chalk";
6894
- import inquirer35 from "inquirer";
7446
+ import chalk52 from "chalk";
7447
+ import inquirer33 from "inquirer";
6895
7448
  function removeCommand6(program2) {
6896
- program2.command("remove [name]").alias("rm").description("\u5220\u9664 OpenClaw \u670D\u52A1\u5546").action(async (name) => {
7449
+ const command = program2.command("remove [name]").alias("rm").description("\u5220\u9664 OpenClaw \u670D\u52A1\u5546");
7450
+ addProviderRemoveOptions(command);
7451
+ command.action(async (name, options) => {
6897
7452
  try {
6898
7453
  const manager = createOpenClawManager();
6899
7454
  const providers = manager.list();
6900
7455
  if (providers.length === 0) {
6901
- console.log(chalk50.yellow("\n\u26A0\uFE0F \u6682\u65E0 OpenClaw \u670D\u52A1\u5546\n"));
7456
+ console.log(chalk52.yellow("\n\u26A0\uFE0F \u6682\u65E0 OpenClaw \u670D\u52A1\u5546\n"));
6902
7457
  return;
6903
7458
  }
6904
7459
  let targetId;
@@ -6910,8 +7465,10 @@ function removeCommand6(program2) {
6910
7465
  }
6911
7466
  targetId = provider.id;
6912
7467
  targetName = provider.name;
7468
+ } else if (options.yes) {
7469
+ throw new Error("\u975E\u4EA4\u4E92\u6A21\u5F0F\u8BF7\u63D0\u4F9B\u8981\u5220\u9664\u7684\u670D\u52A1\u5546\u540D\u79F0");
6913
7470
  } else {
6914
- const { selectedId } = await inquirer35.prompt([
7471
+ const { selectedId } = await inquirer33.prompt([
6915
7472
  {
6916
7473
  type: "list",
6917
7474
  name: "selectedId",
@@ -6926,22 +7483,22 @@ function removeCommand6(program2) {
6926
7483
  targetId = selectedId;
6927
7484
  targetName = provider.name;
6928
7485
  }
6929
- const confirmed = await promptConfirm(`\u786E\u5B9A\u5220\u9664 "${targetName}"?`, false);
7486
+ const confirmed = await confirmProviderRemoval(targetName, options);
6930
7487
  if (!confirmed) {
6931
- console.log(chalk50.gray("\n\u5DF2\u53D6\u6D88\n"));
7488
+ console.log(chalk52.gray("\n\u5DF2\u53D6\u6D88\n"));
6932
7489
  return;
6933
7490
  }
6934
7491
  manager.remove(targetId);
6935
- console.log(chalk50.green(`
7492
+ console.log(chalk52.green(`
6936
7493
  \u2705 \u5DF2\u5220\u9664: ${targetName}
6937
7494
  `));
6938
7495
  } catch (error) {
6939
7496
  if (error instanceof ProviderNotFoundError) {
6940
- console.error(chalk50.red(`
7497
+ console.error(chalk52.red(`
6941
7498
  \u274C \u670D\u52A1\u5546\u4E0D\u5B58\u5728: ${name}
6942
7499
  `));
6943
7500
  } else {
6944
- console.error(chalk50.red(`
7501
+ console.error(chalk52.red(`
6945
7502
  \u274C ${error.message}
6946
7503
  `));
6947
7504
  }
@@ -6952,15 +7509,15 @@ function removeCommand6(program2) {
6952
7509
 
6953
7510
  // src/commands/openclaw/clone.ts
6954
7511
  init_dist2();
6955
- import chalk51 from "chalk";
6956
- import inquirer36 from "inquirer";
7512
+ import chalk53 from "chalk";
7513
+ import inquirer34 from "inquirer";
6957
7514
  function cloneCommand5(program2) {
6958
7515
  program2.command("clone [source-name] [new-name]").description("\u514B\u9686 OpenClaw \u670D\u52A1\u5546").action(async (sourceName, newName) => {
6959
7516
  try {
6960
7517
  const manager = createOpenClawManager();
6961
7518
  const providers = manager.list();
6962
7519
  if (providers.length === 0) {
6963
- console.log(chalk51.yellow("\n\u26A0\uFE0F \u6682\u65E0 OpenClaw \u670D\u52A1\u5546\n"));
7520
+ console.log(chalk53.yellow("\n\u26A0\uFE0F \u6682\u65E0 OpenClaw \u670D\u52A1\u5546\n"));
6964
7521
  return;
6965
7522
  }
6966
7523
  let sourceId;
@@ -6971,7 +7528,7 @@ function cloneCommand5(program2) {
6971
7528
  }
6972
7529
  sourceId = provider.id;
6973
7530
  } else {
6974
- const { selectedId } = await inquirer36.prompt([
7531
+ const { selectedId } = await inquirer34.prompt([
6975
7532
  {
6976
7533
  type: "list",
6977
7534
  name: "selectedId",
@@ -6989,7 +7546,7 @@ function cloneCommand5(program2) {
6989
7546
  if (newName) {
6990
7547
  cloned = manager.clone(sourceId, newName);
6991
7548
  } else {
6992
- console.log(chalk51.blue(`
7549
+ console.log(chalk53.blue(`
6993
7550
  \u514B\u9686\u81EA: ${source.name}
6994
7551
  `));
6995
7552
  const input = await promptProviderForm({
@@ -7006,14 +7563,14 @@ function cloneCommand5(program2) {
7006
7563
  });
7007
7564
  }
7008
7565
  console.log();
7009
- console.log(chalk51.green("\u2705 \u514B\u9686\u6210\u529F"));
7566
+ console.log(chalk53.green("\u2705 \u514B\u9686\u6210\u529F"));
7010
7567
  console.log();
7011
- console.log(` ${chalk51.bold(cloned.name)} ${chalk51.blue("[OpenClaw]")}`);
7012
- console.log(` ${chalk51.gray(`ID: ${cloned.id}`)}`);
7013
- console.log(` ${chalk51.gray(`URL: ${cloned.baseUrl}`)}`);
7568
+ console.log(` ${chalk53.bold(cloned.name)} ${chalk53.blue("[OpenClaw]")}`);
7569
+ console.log(` ${chalk53.gray(`ID: ${cloned.id}`)}`);
7570
+ console.log(` ${chalk53.gray(`URL: ${cloned.baseUrl}`)}`);
7014
7571
  console.log();
7015
7572
  } catch (error) {
7016
- console.error(chalk51.red(`
7573
+ console.error(chalk53.red(`
7017
7574
  \u274C ${error.message}
7018
7575
  `));
7019
7576
  process.exit(1);
@@ -7037,40 +7594,40 @@ init_sync();
7037
7594
 
7038
7595
  // src/commands/export.ts
7039
7596
  init_dist2();
7040
- import chalk52 from "chalk";
7597
+ import chalk54 from "chalk";
7041
7598
  import path13 from "path";
7042
7599
  function exportCommand(program2) {
7043
7600
  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) => {
7044
7601
  try {
7045
- console.log(chalk52.bold("\n\u{1F4E6} \u5BFC\u51FA\u914D\u7F6E\n"));
7602
+ console.log(chalk54.bold("\n\u{1F4E6} \u5BFC\u51FA\u914D\u7F6E\n"));
7046
7603
  const validation = validateExport();
7047
7604
  if (!validation.valid) {
7048
- console.log(chalk52.red(`\u274C ${validation.message}
7605
+ console.log(chalk54.red(`\u274C ${validation.message}
7049
7606
  `));
7050
7607
  process.exit(1);
7051
7608
  }
7052
7609
  const resolvedPath = targetDir.startsWith("~") ? path13.join(process.env.HOME || "", targetDir.slice(1)) : path13.resolve(targetDir);
7053
7610
  console.log("\u5BFC\u51FA\u6587\u4EF6\uFF08\u5B58\u5728\u5219\u5BFC\u51FA\uFF0C\u4E0D\u5B58\u5728\u5219\u8DF3\u8FC7\uFF09:");
7054
- console.log(` ${chalk52.cyan("codex.json")} - Codex \u914D\u7F6E`);
7055
- console.log(` ${chalk52.cyan("claude.json")} - Claude \u914D\u7F6E`);
7056
- console.log(` ${chalk52.cyan("openclaw.json")} - OpenClaw \u914D\u7F6E`);
7611
+ console.log(` ${chalk54.cyan("codex.json")} - Codex \u914D\u7F6E`);
7612
+ console.log(` ${chalk54.cyan("claude.json")} - Claude \u914D\u7F6E`);
7613
+ console.log(` ${chalk54.cyan("openclaw.json")} - OpenClaw \u914D\u7F6E`);
7057
7614
  console.log();
7058
- console.log(`\u76EE\u6807\u76EE\u5F55: ${chalk52.cyan(resolvedPath)}`);
7615
+ console.log(`\u76EE\u6807\u76EE\u5F55: ${chalk54.cyan(resolvedPath)}`);
7059
7616
  console.log();
7060
- console.log(chalk52.yellow("\u26A0\uFE0F \u5BFC\u51FA\u6587\u4EF6\u5305\u542B API Key\uFF0C\u8BF7\u59A5\u5584\u4FDD\u7BA1"));
7617
+ console.log(chalk54.yellow("\u26A0\uFE0F \u5BFC\u51FA\u6587\u4EF6\u5305\u542B API Key\uFF0C\u8BF7\u59A5\u5584\u4FDD\u7BA1"));
7061
7618
  console.log();
7062
7619
  const result = exportConfig(resolvedPath);
7063
- console.log(chalk52.green("\u2705 \u5BFC\u51FA\u6210\u529F"));
7620
+ console.log(chalk54.green("\u2705 \u5BFC\u51FA\u6210\u529F"));
7064
7621
  console.log();
7065
7622
  console.log("\u5DF2\u5BFC\u51FA\u6587\u4EF6:");
7066
7623
  for (const file of result.exportedFiles) {
7067
- console.log(` ${chalk52.cyan("\u2713")} ${file}`);
7624
+ console.log(` ${chalk54.cyan("\u2713")} ${file}`);
7068
7625
  }
7069
7626
  console.log();
7070
- console.log(chalk52.blue(`\u{1F4A1} \u5BFC\u5165\u547D\u4EE4: ccman import ${resolvedPath}
7627
+ console.log(chalk54.blue(`\u{1F4A1} \u5BFC\u5165\u547D\u4EE4: ccman import ${resolvedPath}
7071
7628
  `));
7072
7629
  } catch (error) {
7073
- console.error(chalk52.red(`
7630
+ console.error(chalk54.red(`
7074
7631
  \u274C ${error.message}
7075
7632
  `));
7076
7633
  process.exit(1);
@@ -7081,66 +7638,66 @@ function exportCommand(program2) {
7081
7638
  // src/commands/import.ts
7082
7639
  init_dist2();
7083
7640
  init_confirm();
7084
- import chalk53 from "chalk";
7641
+ import chalk55 from "chalk";
7085
7642
  import path14 from "path";
7086
7643
  function importCommand(program2) {
7087
7644
  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) => {
7088
7645
  try {
7089
7646
  const resolvedPath = sourceDir.startsWith("~") ? path14.join(process.env.HOME || "", sourceDir.slice(1)) : path14.resolve(sourceDir);
7090
- console.log(chalk53.bold("\n\u{1F4E5} \u5BFC\u5165\u914D\u7F6E\n"));
7647
+ console.log(chalk55.bold("\n\u{1F4E5} \u5BFC\u5165\u914D\u7F6E\n"));
7091
7648
  const validation = validateImportDir(resolvedPath);
7092
7649
  if (!validation.valid) {
7093
- console.log(chalk53.red(`\u274C ${validation.message}
7650
+ console.log(chalk55.red(`\u274C ${validation.message}
7094
7651
  `));
7095
7652
  process.exit(1);
7096
7653
  }
7097
- console.log(chalk53.yellow("\u26A0\uFE0F \u8B66\u544A\uFF1A\u5BFC\u5165\u5C06\u8986\u76D6\u5F53\u524D\u914D\u7F6E\n"));
7098
- console.log(`\u6E90\u76EE\u5F55: ${chalk53.cyan(resolvedPath)}`);
7654
+ console.log(chalk55.yellow("\u26A0\uFE0F \u8B66\u544A\uFF1A\u5BFC\u5165\u5C06\u8986\u76D6\u5F53\u524D\u914D\u7F6E\n"));
7655
+ console.log(`\u6E90\u76EE\u5F55: ${chalk55.cyan(resolvedPath)}`);
7099
7656
  console.log();
7100
7657
  console.log("\u627E\u5230\u914D\u7F6E\u6587\u4EF6:");
7101
7658
  for (const file of validation.foundFiles) {
7102
- console.log(` ${chalk53.cyan("\u2713")} ${file}`);
7659
+ console.log(` ${chalk55.cyan("\u2713")} ${file}`);
7103
7660
  }
7104
7661
  console.log();
7105
- 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"));
7662
+ 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"));
7106
7663
  console.log();
7107
- console.log(chalk53.gray("\u5F53\u524D\u914D\u7F6E\u5C06\u88AB\u8986\u76D6\uFF08\u81EA\u52A8\u5907\u4EFD\uFF09"));
7664
+ console.log(chalk55.gray("\u5F53\u524D\u914D\u7F6E\u5C06\u88AB\u8986\u76D6\uFF08\u81EA\u52A8\u5907\u4EFD\uFF09"));
7108
7665
  console.log();
7109
7666
  const confirmFirst = await promptConfirm("\u786E\u8BA4\u5BFC\u5165\uFF1F", false);
7110
7667
  if (!confirmFirst) {
7111
- console.log(chalk53.gray("\n\u274C \u5DF2\u53D6\u6D88\n"));
7668
+ console.log(chalk55.gray("\n\u274C \u5DF2\u53D6\u6D88\n"));
7112
7669
  return;
7113
7670
  }
7114
7671
  console.log();
7115
- console.log(chalk53.red.bold("\u26A0\uFE0F \u6700\u540E\u786E\u8BA4\uFF1A\u6B64\u64CD\u4F5C\u5C06\u8986\u76D6\u6240\u6709\u5F53\u524D\u914D\u7F6E\uFF01"));
7672
+ 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"));
7116
7673
  console.log();
7117
7674
  const confirmSecond = await promptConfirm("\u771F\u7684\u8981\u7EE7\u7EED\u5417\uFF1F", false);
7118
7675
  if (!confirmSecond) {
7119
- console.log(chalk53.gray("\n\u274C \u5DF2\u53D6\u6D88\n"));
7676
+ console.log(chalk55.gray("\n\u274C \u5DF2\u53D6\u6D88\n"));
7120
7677
  return;
7121
7678
  }
7122
7679
  console.log();
7123
- console.log(chalk53.gray("\u{1F4BE} \u5907\u4EFD\u5F53\u524D\u914D\u7F6E..."));
7124
- console.log(chalk53.gray("\u{1F4E5} \u5BFC\u5165\u65B0\u914D\u7F6E..."));
7680
+ console.log(chalk55.gray("\u{1F4BE} \u5907\u4EFD\u5F53\u524D\u914D\u7F6E..."));
7681
+ console.log(chalk55.gray("\u{1F4E5} \u5BFC\u5165\u65B0\u914D\u7F6E..."));
7125
7682
  const result = importConfig(resolvedPath);
7126
7683
  console.log();
7127
- console.log(chalk53.green("\u2705 \u5BFC\u5165\u6210\u529F"));
7684
+ console.log(chalk55.green("\u2705 \u5BFC\u5165\u6210\u529F"));
7128
7685
  console.log();
7129
7686
  if (result.backupPaths.length > 0) {
7130
7687
  console.log("\u5907\u4EFD\u6587\u4EF6:");
7131
7688
  for (const backupPath of result.backupPaths) {
7132
- console.log(` ${chalk53.gray(backupPath)}`);
7689
+ console.log(` ${chalk55.gray(backupPath)}`);
7133
7690
  }
7134
7691
  console.log();
7135
7692
  }
7136
7693
  console.log("\u5DF2\u5BFC\u5165\u6587\u4EF6:");
7137
7694
  for (const file of result.importedFiles) {
7138
- console.log(` ${chalk53.cyan("\u2713")} ${file}`);
7695
+ console.log(` ${chalk55.cyan("\u2713")} ${file}`);
7139
7696
  }
7140
7697
  console.log();
7141
- console.log(chalk53.blue("\u{1F4A1} \u8BF7\u4F7F\u7528 'ccman cx use' \u6216 'ccman cc use' \u5207\u6362\u670D\u52A1\u5546\n"));
7698
+ console.log(chalk55.blue("\u{1F4A1} \u8BF7\u4F7F\u7528 'ccman cx use' \u6216 'ccman cc use' \u5207\u6362\u670D\u52A1\u5546\n"));
7142
7699
  } catch (error) {
7143
- console.error(chalk53.red(`
7700
+ console.error(chalk55.red(`
7144
7701
  \u274C ${error.message}
7145
7702
  `));
7146
7703
  process.exit(1);
@@ -7152,8 +7709,8 @@ function importCommand(program2) {
7152
7709
  init_dist2();
7153
7710
  import fs13 from "fs";
7154
7711
  import path15 from "path";
7155
- import chalk54 from "chalk";
7156
- import inquirer37 from "inquirer";
7712
+ import chalk56 from "chalk";
7713
+ import inquirer35 from "inquirer";
7157
7714
 
7158
7715
  // src/utils/endpoint-latency.ts
7159
7716
  import { request as httpRequest } from "http";
@@ -7278,7 +7835,7 @@ var GMN_PROFILE = {
7278
7835
  baseUrls: [
7279
7836
  {
7280
7837
  label: "GMN \u4E3B\u7AD9",
7281
- url: "https://gmn.chuangzuoli.com",
7838
+ url: "https://ai.gmncode.com",
7282
7839
  description: "GMN \u4E3B\u57DF\u540D\u5165\u53E3"
7283
7840
  },
7284
7841
  {
@@ -7345,7 +7902,7 @@ function renderStep(current, total, title) {
7345
7902
  function printBanner(title) {
7346
7903
  printLogo();
7347
7904
  console.log(
7348
- chalk54.cyanBright(
7905
+ chalk56.cyanBright(
7349
7906
  [
7350
7907
  " \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2557 \u2588\u2588\u2557",
7351
7908
  " \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",
@@ -7357,11 +7914,11 @@ function printBanner(title) {
7357
7914
  ].join("\n")
7358
7915
  )
7359
7916
  );
7360
- console.log(chalk54.gray("\u81EA\u52A8\u5199\u5165\u9009\u4E2D\u5DE5\u5177\u914D\u7F6E\uFF0C\u652F\u6301\u591A\u9009\u3002\n"));
7917
+ console.log(chalk56.gray("\u81EA\u52A8\u5199\u5165\u9009\u4E2D\u5DE5\u5177\u914D\u7F6E\uFF0C\u652F\u6301\u591A\u9009\u3002\n"));
7361
7918
  }
7362
7919
  function printKeyNotice() {
7363
7920
  console.log(
7364
- chalk54.yellow(
7921
+ chalk56.yellow(
7365
7922
  [
7366
7923
  "\u63D0\u793A\uFF1A\u672C\u547D\u4EE4\u652F\u6301 Codex\u3001OpenCode\u3001OpenClaw \u4E09\u4E2A\u5E73\u53F0\u3002",
7367
7924
  "Codex \u4E0E OpenCode \u5171\u4EAB OpenAI \u7AEF\u70B9\uFF1BOpenClaw \u4F7F\u7528 /v1 \u7AEF\u70B9\u3002",
@@ -7371,22 +7928,22 @@ function printKeyNotice() {
7371
7928
  );
7372
7929
  }
7373
7930
  function printWriteTargets(platforms) {
7374
- console.log(chalk54.gray(`\u5199\u5165\u76EE\u5F55: ${getCcmanDir()}`));
7931
+ console.log(chalk56.gray(`\u5199\u5165\u76EE\u5F55: ${getCcmanDir()}`));
7375
7932
  if (platforms.includes("codex")) {
7376
- console.log(chalk54.gray(` - Codex: ${getCodexConfigPath()}`));
7377
- console.log(chalk54.gray(` - Codex: ${getCodexAuthPath()}`));
7933
+ console.log(chalk56.gray(` - Codex: ${getCodexConfigPath()}`));
7934
+ console.log(chalk56.gray(` - Codex: ${getCodexAuthPath()}`));
7378
7935
  }
7379
7936
  if (platforms.includes("opencode")) {
7380
- console.log(chalk54.gray(` - OpenCode: ${getOpenCodeConfigPath()}`));
7937
+ console.log(chalk56.gray(` - OpenCode: ${getOpenCodeConfigPath()}`));
7381
7938
  }
7382
7939
  if (platforms.includes("openclaw")) {
7383
- console.log(chalk54.gray(` - OpenClaw: ${getOpenClawConfigPath()}`));
7384
- console.log(chalk54.gray(` - OpenClaw: ${getOpenClawModelsPath()}`));
7940
+ console.log(chalk56.gray(` - OpenClaw: ${getOpenClawConfigPath()}`));
7941
+ console.log(chalk56.gray(` - OpenClaw: ${getOpenClawModelsPath()}`));
7385
7942
  }
7386
7943
  const env = process.env.NODE_ENV;
7387
7944
  if (env === "development" || env === "test") {
7388
7945
  console.log(
7389
- chalk54.yellow(
7946
+ chalk56.yellow(
7390
7947
  `\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`
7391
7948
  )
7392
7949
  );
@@ -7405,7 +7962,7 @@ function parsePlatforms(platformArg) {
7405
7962
  return platforms;
7406
7963
  }
7407
7964
  async function promptApiKey(title) {
7408
- const answers = await inquirer37.prompt([
7965
+ const answers = await inquirer35.prompt([
7409
7966
  {
7410
7967
  type: "password",
7411
7968
  name: "apiKey",
@@ -7420,7 +7977,7 @@ async function promptApiKey(title) {
7420
7977
  return answers.apiKey.trim();
7421
7978
  }
7422
7979
  async function promptPlatforms(title) {
7423
- const answers = await inquirer37.prompt([
7980
+ const answers = await inquirer35.prompt([
7424
7981
  {
7425
7982
  type: "checkbox",
7426
7983
  name: "platforms",
@@ -7466,20 +8023,20 @@ function buildProbeCandidates(baseUrls, platforms) {
7466
8023
  }
7467
8024
  function printBaseUrlProbeResults(profile, results, platforms) {
7468
8025
  const usingOpenClawPath = platforms.length === 1 && platforms[0] === "openclaw";
7469
- console.log(chalk54.bold(`\u5F53\u524D\u6D4B\u901F\u8303\u56F4\uFF1A${profile.endpointGroupLabel}`));
7470
- console.log(chalk54.gray(`${profile.endpointGroupDescription}\uFF08\u5171 ${results.length} \u6761\uFF09`));
8026
+ console.log(chalk56.bold(`\u5F53\u524D\u6D4B\u901F\u8303\u56F4\uFF1A${profile.endpointGroupLabel}`));
8027
+ console.log(chalk56.gray(`${profile.endpointGroupDescription}\uFF08\u5171 ${results.length} \u6761\uFF09`));
7471
8028
  console.log(
7472
- chalk54.gray(
8029
+ chalk56.gray(
7473
8030
  `\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" : ""}`
7474
8031
  )
7475
8032
  );
7476
8033
  console.log();
7477
8034
  for (const [index, result] of results.entries()) {
7478
- const latencyText = result.latencyMs === null ? chalk54.red(formatLatency(result)) : chalk54.green(formatLatency(result));
7479
- console.log(` ${chalk54.cyan(`${index + 1}. ${result.label}`)}`);
7480
- console.log(chalk54.gray(` \u57DF\u540D: ${getEndpointHost(result.url)}`));
7481
- console.log(chalk54.gray(` \u5730\u5740: ${result.url}`));
7482
- console.log(chalk54.gray(` \u8BF4\u660E: ${result.description}`));
8035
+ const latencyText = result.latencyMs === null ? chalk56.red(formatLatency(result)) : chalk56.green(formatLatency(result));
8036
+ console.log(` ${chalk56.cyan(`${index + 1}. ${result.label}`)}`);
8037
+ console.log(chalk56.gray(` \u57DF\u540D: ${getEndpointHost(result.url)}`));
8038
+ console.log(chalk56.gray(` \u5730\u5740: ${result.url}`));
8039
+ console.log(chalk56.gray(` \u8BF4\u660E: ${result.description}`));
7483
8040
  console.log(` \u5EF6\u8FDF: ${latencyText}`);
7484
8041
  console.log();
7485
8042
  }
@@ -7487,7 +8044,7 @@ function printBaseUrlProbeResults(profile, results, platforms) {
7487
8044
  async function resolveOpenAiBaseUrl(profile, platforms, baseUrlArg) {
7488
8045
  if (baseUrlArg && baseUrlArg.trim().length > 0) {
7489
8046
  const normalized = normalizeEndpointUrl(baseUrlArg);
7490
- console.log(chalk54.gray(`\u5DF2\u901A\u8FC7\u53C2\u6570\u6307\u5B9A Base URL: ${normalized}`));
8047
+ console.log(chalk56.gray(`\u5DF2\u901A\u8FC7\u53C2\u6570\u6307\u5B9A Base URL: ${normalized}`));
7491
8048
  return normalized;
7492
8049
  }
7493
8050
  const probeResults = sortEndpointProbeResults(
@@ -7503,19 +8060,19 @@ async function resolveOpenAiBaseUrl(profile, platforms, baseUrlArg) {
7503
8060
  const defaultResult = pickDefaultEndpoint(probeResults) || probeResults[0];
7504
8061
  const allFailed = probeResults.every((result) => result.latencyMs === null);
7505
8062
  if (allFailed) {
7506
- 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"));
8063
+ 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"));
7507
8064
  } else {
7508
- console.log(chalk54.gray(`\u9ED8\u8BA4\u5DF2\u9009\u6700\u4F4E\u5EF6\u8FDF\u7EBF\u8DEF\uFF1A${defaultResult.url}`));
8065
+ console.log(chalk56.gray(`\u9ED8\u8BA4\u5DF2\u9009\u6700\u4F4E\u5EF6\u8FDF\u7EBF\u8DEF\uFF1A${defaultResult.url}`));
7509
8066
  }
7510
8067
  if (probeResults.length === 1) {
7511
- console.log(chalk54.green(`\u5DF2\u81EA\u52A8\u9009\u62E9: ${defaultResult.url}`));
8068
+ console.log(chalk56.green(`\u5DF2\u81EA\u52A8\u9009\u62E9: ${defaultResult.url}`));
7512
8069
  return defaultResult.url;
7513
8070
  }
7514
8071
  if (!process.stdin.isTTY || !process.stdout.isTTY) {
7515
- console.log(chalk54.yellow(`\u975E\u4EA4\u4E92\u73AF\u5883\uFF0C\u5DF2\u81EA\u52A8\u4F7F\u7528\u9ED8\u8BA4\u5730\u5740\uFF1A${defaultResult.url}`));
8072
+ console.log(chalk56.yellow(`\u975E\u4EA4\u4E92\u73AF\u5883\uFF0C\u5DF2\u81EA\u52A8\u4F7F\u7528\u9ED8\u8BA4\u5730\u5740\uFF1A${defaultResult.url}`));
7516
8073
  return defaultResult.url;
7517
8074
  }
7518
- const answers = await inquirer37.prompt([
8075
+ const answers = await inquirer35.prompt([
7519
8076
  {
7520
8077
  type: "list",
7521
8078
  name: "baseUrl",
@@ -7623,24 +8180,24 @@ async function runGmnCommand(profile, apiKey, platformArg, providerNameArg, base
7623
8180
  let platforms;
7624
8181
  let providerName;
7625
8182
  try {
7626
- console.log(chalk54.cyan(`
8183
+ console.log(chalk56.cyan(`
7627
8184
  ${renderStep(1, TOTAL_STEPS, "\u9009\u62E9\u8981\u914D\u7F6E\u7684\u5DE5\u5177")}`));
7628
8185
  platforms = await resolvePlatforms(platformArg, profile.title);
7629
8186
  providerName = resolveProviderName2(profile, providerNameArg);
7630
8187
  } catch (error) {
7631
- console.error(chalk54.red(`\u274C ${error.message}`));
8188
+ console.error(chalk56.red(`\u274C ${error.message}`));
7632
8189
  process.exit(1);
7633
8190
  }
7634
- console.log(chalk54.gray(`\u5DF2\u9009\u62E9: ${platforms.join(", ")}`));
7635
- console.log(chalk54.gray(`\u670D\u52A1\u5546\u540D\u79F0: ${providerName}`));
8191
+ console.log(chalk56.gray(`\u5DF2\u9009\u62E9: ${platforms.join(", ")}`));
8192
+ console.log(chalk56.gray(`\u670D\u52A1\u5546\u540D\u79F0: ${providerName}`));
7636
8193
  printKeyNotice();
7637
- console.log(chalk54.cyan(`
8194
+ console.log(chalk56.cyan(`
7638
8195
  ${renderStep(2, TOTAL_STEPS, "\u6D4B\u901F\u5E76\u9009\u62E9 Base URL")}`));
7639
8196
  let openaiBaseUrl;
7640
8197
  try {
7641
8198
  openaiBaseUrl = await resolveOpenAiBaseUrl(profile, platforms, baseUrlArg);
7642
8199
  } catch (error) {
7643
- console.error(chalk54.red(`\u274C ${error.message}`));
8200
+ console.error(chalk56.red(`\u274C ${error.message}`));
7644
8201
  process.exit(1);
7645
8202
  }
7646
8203
  const openclawBaseUrl = buildOpenClawBaseUrl(openaiBaseUrl);
@@ -7650,23 +8207,23 @@ ${renderStep(2, TOTAL_STEPS, "\u6D4B\u901F\u5E76\u9009\u62E9 Base URL")}`));
7650
8207
  openclaw: openclawBaseUrl
7651
8208
  };
7652
8209
  let resolvedApiKey = apiKey?.trim();
7653
- console.log(chalk54.cyan(`
8210
+ console.log(chalk56.cyan(`
7654
8211
  ${renderStep(3, TOTAL_STEPS, "\u8F93\u5165 API Key")}`));
7655
8212
  if (!resolvedApiKey) {
7656
8213
  resolvedApiKey = await promptApiKey(profile.title);
7657
8214
  } else {
7658
- console.log(chalk54.gray("\u5DF2\u901A\u8FC7\u53C2\u6570\u63D0\u4F9B API Key\uFF08\u5DF2\u9690\u85CF\uFF09"));
8215
+ console.log(chalk56.gray("\u5DF2\u901A\u8FC7\u53C2\u6570\u63D0\u4F9B API Key\uFF08\u5DF2\u9690\u85CF\uFF09"));
7659
8216
  }
7660
8217
  if (!resolvedApiKey?.trim()) {
7661
- console.error(chalk54.red("\u274C \u9519\u8BEF: API Key \u4E0D\u80FD\u4E3A\u7A7A"));
8218
+ console.error(chalk56.red("\u274C \u9519\u8BEF: API Key \u4E0D\u80FD\u4E3A\u7A7A"));
7662
8219
  process.exit(1);
7663
8220
  }
7664
- console.log(chalk54.cyan(`
8221
+ console.log(chalk56.cyan(`
7665
8222
  ${renderStep(4, TOTAL_STEPS, "\u5F00\u59CB\u5199\u5165\u914D\u7F6E")}`));
7666
- console.log(chalk54.gray(`\u5DF2\u9009\u62E9\u5E73\u53F0: ${platforms.join(", ")}`));
7667
- console.log(chalk54.gray(`OpenAI Base URL: ${openaiBaseUrl}`));
8223
+ console.log(chalk56.gray(`\u5DF2\u9009\u62E9\u5E73\u53F0: ${platforms.join(", ")}`));
8224
+ console.log(chalk56.gray(`OpenAI Base URL: ${openaiBaseUrl}`));
7668
8225
  if (platforms.includes("openclaw")) {
7669
- console.log(chalk54.gray(`OpenClaw Base URL: ${openclawBaseUrl}`));
8226
+ console.log(chalk56.gray(`OpenClaw Base URL: ${openclawBaseUrl}`));
7670
8227
  }
7671
8228
  printWriteTargets(platforms);
7672
8229
  console.log();
@@ -7676,7 +8233,7 @@ ${renderStep(4, TOTAL_STEPS, "\u5F00\u59CB\u5199\u5165\u914D\u7F6E")}`));
7676
8233
  `${profile.commandName}-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`
7677
8234
  );
7678
8235
  fs13.mkdirSync(backupRootDir, { recursive: true, mode: 448 });
7679
- console.log(chalk54.gray(`\u5907\u4EFD\u6839\u76EE\u5F55: ${backupRootDir}`));
8236
+ console.log(chalk56.gray(`\u5907\u4EFD\u6839\u76EE\u5F55: ${backupRootDir}`));
7680
8237
  console.log();
7681
8238
  const ALL_TOOLS = {
7682
8239
  codex: { name: "Codex", manager: createCodexManager() },
@@ -7692,13 +8249,13 @@ ${renderStep(4, TOTAL_STEPS, "\u5F00\u59CB\u5199\u5165\u914D\u7F6E")}`));
7692
8249
  for (const { platform, name, manager } of tools) {
7693
8250
  let backupResult = null;
7694
8251
  try {
7695
- console.log(chalk54.gray(`\u2192 \u914D\u7F6E ${name}...`));
8252
+ console.log(chalk56.gray(`\u2192 \u914D\u7F6E ${name}...`));
7696
8253
  backupResult = createPlatformBackupOrThrow(platform, backupRootDir);
7697
8254
  const backupFiles = backupResult.entries.map((entry) => entry.backupPath).filter((p) => p !== null);
7698
8255
  if (backupFiles.length > 0) {
7699
- console.log(chalk54.gray(` \u5DF2\u5907\u4EFD ${backupFiles.length} \u4E2A\u6587\u4EF6`));
8256
+ console.log(chalk56.gray(` \u5DF2\u5907\u4EFD ${backupFiles.length} \u4E2A\u6587\u4EF6`));
7700
8257
  } else {
7701
- console.log(chalk54.gray(" \u65E0\u5386\u53F2\u6587\u4EF6\u53EF\u5907\u4EFD"));
8258
+ console.log(chalk56.gray(" \u65E0\u5386\u53F2\u6587\u4EF6\u53EF\u5907\u4EFD"));
7702
8259
  }
7703
8260
  const baseUrl = platformBaseUrls[platform];
7704
8261
  const existing = findPreferredProvider(manager.list(), providerName);
@@ -7709,7 +8266,7 @@ ${renderStep(4, TOTAL_STEPS, "\u5F00\u59CB\u5199\u5165\u914D\u7F6E")}`));
7709
8266
  ) : manager.add({ name: providerName, baseUrl, apiKey: resolvedApiKey });
7710
8267
  manager.switch(provider.id, { mode: "overwrite" });
7711
8268
  completed += 1;
7712
- console.log(chalk54.green(`\u2705 ${name}`));
8269
+ console.log(chalk56.green(`\u2705 ${name}`));
7713
8270
  successBackups.push({
7714
8271
  name,
7715
8272
  backupDir: backupResult.backupDir,
@@ -7720,38 +8277,38 @@ ${renderStep(4, TOTAL_STEPS, "\u5F00\u59CB\u5199\u5165\u914D\u7F6E")}`));
7720
8277
  if (backupResult !== null) {
7721
8278
  try {
7722
8279
  rollbackFromBackupOrThrow(backupResult);
7723
- console.error(chalk54.red(`\u274C ${name}: ${operationError.message}\uFF08\u5DF2\u56DE\u6EDA\u5386\u53F2\u6587\u4EF6\uFF09`));
8280
+ console.error(chalk56.red(`\u274C ${name}: ${operationError.message}\uFF08\u5DF2\u56DE\u6EDA\u5386\u53F2\u6587\u4EF6\uFF09`));
7724
8281
  } catch (rollbackError) {
7725
8282
  console.error(
7726
- chalk54.red(
8283
+ chalk56.red(
7727
8284
  `\u274C ${name}: ${operationError.message}\uFF1B\u56DE\u6EDA\u4E5F\u5931\u8D25: ${rollbackError.message}`
7728
8285
  )
7729
8286
  );
7730
8287
  }
7731
8288
  } else {
7732
- console.error(chalk54.red(`\u274C ${name}: ${operationError.message}`));
8289
+ console.error(chalk56.red(`\u274C ${name}: ${operationError.message}`));
7733
8290
  }
7734
8291
  }
7735
8292
  }
7736
- console.log(chalk54.green(`
8293
+ console.log(chalk56.green(`
7737
8294
  \u{1F389} ${profile.title} \u914D\u7F6E\u5B8C\u6210\uFF01(${completed}/${tools.length})`));
7738
8295
  console.log();
7739
- console.log(chalk54.bold("\u5907\u4EFD\u4FE1\u606F:"));
8296
+ console.log(chalk56.bold("\u5907\u4EFD\u4FE1\u606F:"));
7740
8297
  if (successBackups.length === 0) {
7741
- console.log(chalk54.gray(" \u65E0\u6210\u529F\u914D\u7F6E\u9879\uFF0C\u672A\u751F\u6210\u53EF\u7528\u5907\u4EFD\u76EE\u5F55\u3002"));
8298
+ console.log(chalk56.gray(" \u65E0\u6210\u529F\u914D\u7F6E\u9879\uFF0C\u672A\u751F\u6210\u53EF\u7528\u5907\u4EFD\u76EE\u5F55\u3002"));
7742
8299
  } else {
7743
8300
  for (const item of successBackups) {
7744
- console.log(chalk54.gray(` ${item.name}: ${item.backupDir}`));
8301
+ console.log(chalk56.gray(` ${item.name}: ${item.backupDir}`));
7745
8302
  if (item.backupFiles.length === 0) {
7746
- console.log(chalk54.gray(" - \u65E0\u5386\u53F2\u6587\u4EF6\u53EF\u5907\u4EFD"));
8303
+ console.log(chalk56.gray(" - \u65E0\u5386\u53F2\u6587\u4EF6\u53EF\u5907\u4EFD"));
7747
8304
  } else {
7748
8305
  for (const file of item.backupFiles) {
7749
- console.log(chalk54.gray(` - ${file}`));
8306
+ console.log(chalk56.gray(` - ${file}`));
7750
8307
  }
7751
8308
  }
7752
8309
  }
7753
8310
  }
7754
- console.log(chalk54.gray("\u63D0\u793A\uFF1A\u8BF7\u91CD\u542F\u5BF9\u5E94\u5DE5\u5177/\u63D2\u4EF6\u4EE5\u4F7F\u914D\u7F6E\u751F\u6548\u3002"));
8311
+ console.log(chalk56.gray("\u63D0\u793A\uFF1A\u8BF7\u91CD\u542F\u5BF9\u5E94\u5DE5\u5177/\u63D2\u4EF6\u4EE5\u4F7F\u914D\u7F6E\u751F\u6548\u3002"));
7755
8312
  }
7756
8313
  async function gmnCommand(apiKey, platformArg, providerNameArg, baseUrlArg) {
7757
8314
  await runGmnCommand(GMN_PROFILE, apiKey, platformArg, providerNameArg, baseUrlArg);
@@ -7763,12 +8320,12 @@ async function gmn1Command(apiKey, platformArg, providerNameArg, baseUrlArg) {
7763
8320
  // src/index.ts
7764
8321
  init_dist2();
7765
8322
  if (process.env.NODE_ENV === "development") {
7766
- console.log(chalk55.gray("\n[\u5F00\u53D1\u6A21\u5F0F] \u914D\u7F6E\u76EE\u5F55:"));
7767
- console.log(chalk55.gray(` ccman: ${getCcmanDir()}`));
7768
- console.log(chalk55.gray(` codex: ${getCodexDir()}`));
7769
- console.log(chalk55.gray(` claude: ${getClaudeDir()}`));
7770
- console.log(chalk55.gray(` opencode: ${getOpenCodeDir()}`));
7771
- console.log(chalk55.gray(` openclaw: ${getOpenClawDir()}`));
8323
+ console.log(chalk57.gray("\n[\u5F00\u53D1\u6A21\u5F0F] \u914D\u7F6E\u76EE\u5F55:"));
8324
+ console.log(chalk57.gray(` ccman: ${getCcmanDir()}`));
8325
+ console.log(chalk57.gray(` codex: ${getCodexDir()}`));
8326
+ console.log(chalk57.gray(` claude: ${getClaudeDir()}`));
8327
+ console.log(chalk57.gray(` opencode: ${getOpenCodeDir()}`));
8328
+ console.log(chalk57.gray(` openclaw: ${getOpenClawDir()}`));
7772
8329
  console.log();
7773
8330
  }
7774
8331
  var program = new Command3();
@@ -7780,7 +8337,7 @@ program.name("ccman").description("Codex/Claude Code/Gemini/OpenCode/OpenClaw AP
7780
8337
  });
7781
8338
  program.on("command:*", (operands) => {
7782
8339
  const unknownCommand = operands[0];
7783
- console.error(chalk55.red(`
8340
+ console.error(chalk57.red(`
7784
8341
  \u274C \u672A\u77E5\u547D\u4EE4: ${unknownCommand}
7785
8342
  `));
7786
8343
  const availableCommands = [
@@ -7802,13 +8359,13 @@ program.on("command:*", (operands) => {
7802
8359
  (cmd) => cmd.includes(unknownCommand) || unknownCommand.includes(cmd)
7803
8360
  );
7804
8361
  if (suggestions.length > 0) {
7805
- console.log(chalk55.yellow("\u{1F4A1} \u4F60\u662F\u4E0D\u662F\u60F3\u8F93\u5165:"));
8362
+ console.log(chalk57.yellow("\u{1F4A1} \u4F60\u662F\u4E0D\u662F\u60F3\u8F93\u5165:"));
7806
8363
  suggestions.forEach((cmd) => {
7807
- console.log(chalk55.cyan(` ccman ${cmd}`));
8364
+ console.log(chalk57.cyan(` ccman ${cmd}`));
7808
8365
  });
7809
8366
  console.log();
7810
8367
  }
7811
- console.log(chalk55.gray("\u67E5\u770B\u6240\u6709\u53EF\u7528\u547D\u4EE4: ") + chalk55.cyan("ccman --help"));
8368
+ console.log(chalk57.gray("\u67E5\u770B\u6240\u6709\u53EF\u7528\u547D\u4EE4: ") + chalk57.cyan("ccman --help"));
7812
8369
  console.log();
7813
8370
  process.exit(1);
7814
8371
  });