ccman 3.3.23 → 3.3.24

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.
Files changed (2) hide show
  1. package/dist/index.js +109 -206
  2. package/package.json +2 -1
package/dist/index.js CHANGED
@@ -2926,6 +2926,47 @@ var init_dist2 = __esm({
2926
2926
  }
2927
2927
  });
2928
2928
 
2929
+ // src/utils/confirm.ts
2930
+ import inquirer from "inquirer";
2931
+ function parseConfirmAnswer(value, defaultValue) {
2932
+ const normalized = value.trim().toLowerCase();
2933
+ if (normalized === "") {
2934
+ return defaultValue;
2935
+ }
2936
+ if (normalized === "y") {
2937
+ return true;
2938
+ }
2939
+ if (normalized === "n") {
2940
+ return false;
2941
+ }
2942
+ throw new Error(`\u65E0\u6548\u7684\u786E\u8BA4\u8F93\u5165: ${value}`);
2943
+ }
2944
+ async function promptConfirm(message, defaultValue = false) {
2945
+ const { answer } = await inquirer.prompt([
2946
+ {
2947
+ type: "input",
2948
+ name: "answer",
2949
+ message: `${message} (Y(y) / N(n))`,
2950
+ filter: (value) => value.trim(),
2951
+ validate: (value) => {
2952
+ if (value === "") {
2953
+ return true;
2954
+ }
2955
+ if (/^(y|n)$/i.test(value)) {
2956
+ return true;
2957
+ }
2958
+ return "\u8BF7\u8F93\u5165 Y \u6216 N";
2959
+ }
2960
+ }
2961
+ ]);
2962
+ return parseConfirmAnswer(answer, defaultValue);
2963
+ }
2964
+ var init_confirm = __esm({
2965
+ "src/utils/confirm.ts"() {
2966
+ "use strict";
2967
+ }
2968
+ });
2969
+
2929
2970
  // src/utils/sync-config.ts
2930
2971
  function loadSyncConfig() {
2931
2972
  try {
@@ -2965,7 +3006,7 @@ __export(config_exports, {
2965
3006
  configCommand: () => configCommand
2966
3007
  });
2967
3008
  import chalk3 from "chalk";
2968
- import inquirer from "inquirer";
3009
+ import inquirer2 from "inquirer";
2969
3010
  function configCommand(program2) {
2970
3011
  program2.command("config").description("\u914D\u7F6E WebDAV \u8FDE\u63A5").action(async () => {
2971
3012
  try {
@@ -2975,7 +3016,7 @@ function configCommand(program2) {
2975
3016
  console.log(chalk3.blue("\u2139\uFE0F \u68C0\u6D4B\u5230\u5DF2\u6709\u914D\u7F6E\uFF0C\u53EF\u4EE5\u66F4\u65B0 WebDAV \u5B57\u6BB5"));
2976
3017
  console.log(chalk3.gray(" \u7559\u7A7A\u8868\u793A\u4E0D\u66F4\u65B0\u8BE5\u5B57\u6BB5\n"));
2977
3018
  }
2978
- const answers = await inquirer.prompt([
3019
+ const answers = await inquirer2.prompt([
2979
3020
  {
2980
3021
  type: "input",
2981
3022
  name: "webdavUrl",
@@ -3026,14 +3067,12 @@ function configCommand(program2) {
3026
3067
  name: "syncPassword",
3027
3068
  message: existingConfig ? "\u540C\u6B65\u5BC6\u7801\uFF08\u7528\u4E8E\u52A0\u5BC6 API Key\uFF0C\u7559\u7A7A\u4E0D\u66F4\u65B0\uFF09:" : "\u540C\u6B65\u5BC6\u7801\uFF08\u7528\u4E8E\u52A0\u5BC6 API Key\uFF09:",
3028
3069
  mask: "*"
3029
- },
3030
- {
3031
- type: "confirm",
3032
- name: "rememberSyncPassword",
3033
- message: "\u8BB0\u4F4F\u540C\u6B65\u5BC6\u7801?",
3034
- default: existingConfig?.rememberSyncPassword ?? true
3035
3070
  }
3036
3071
  ]);
3072
+ const rememberSyncPassword = await promptConfirm(
3073
+ "\u8BB0\u4F4F\u540C\u6B65\u5BC6\u7801?",
3074
+ existingConfig?.rememberSyncPassword ?? true
3075
+ );
3037
3076
  const trimmedAnswers = {
3038
3077
  webdavUrl: answers.webdavUrl?.trim(),
3039
3078
  username: answers.username?.trim(),
@@ -3041,7 +3080,7 @@ function configCommand(program2) {
3041
3080
  authType: answers.authType,
3042
3081
  remoteDir: answers.remoteDir?.trim(),
3043
3082
  syncPassword: answers.syncPassword?.trim(),
3044
- rememberSyncPassword: answers.rememberSyncPassword
3083
+ rememberSyncPassword
3045
3084
  };
3046
3085
  if (existingConfig) {
3047
3086
  const hasTextInput = trimmedAnswers.webdavUrl || trimmedAnswers.username || trimmedAnswers.password || trimmedAnswers.remoteDir || trimmedAnswers.syncPassword;
@@ -3123,14 +3162,7 @@ function configCommand(program2) {
3123
3162
  console.log();
3124
3163
  console.log(chalk3.gray("\u914D\u7F6E\u6587\u4EF6:"), getSyncConfigPath());
3125
3164
  console.log();
3126
- const { testNow } = await inquirer.prompt([
3127
- {
3128
- type: "confirm",
3129
- name: "testNow",
3130
- message: "\u662F\u5426\u7ACB\u5373\u6D4B\u8BD5\u8FDE\u63A5?",
3131
- default: true
3132
- }
3133
- ]);
3165
+ const testNow = await promptConfirm("\u662F\u5426\u7ACB\u5373\u6D4B\u8BD5\u8FDE\u63A5?", true);
3134
3166
  if (testNow) {
3135
3167
  console.log(chalk3.bold("\n\u{1F50D} \u6D4B\u8BD5 WebDAV \u8FDE\u63A5...\n"));
3136
3168
  const success = await testWebDAVConnection(newConfig);
@@ -3164,11 +3196,11 @@ var init_config2 = __esm({
3164
3196
  "use strict";
3165
3197
  init_sync_config();
3166
3198
  init_dist2();
3199
+ init_confirm();
3167
3200
  }
3168
3201
  });
3169
3202
 
3170
3203
  // src/commands/sync/helpers.ts
3171
- import inquirer2 from "inquirer";
3172
3204
  import chalk4 from "chalk";
3173
3205
  import { Command } from "commander";
3174
3206
  async function ensureConfigExists() {
@@ -3177,14 +3209,7 @@ async function ensureConfigExists() {
3177
3209
  return config;
3178
3210
  }
3179
3211
  console.log(chalk4.yellow("\n\u26A0\uFE0F \u672A\u627E\u5230 WebDAV \u914D\u7F6E\n"));
3180
- const { shouldConfig } = await inquirer2.prompt([
3181
- {
3182
- type: "confirm",
3183
- name: "shouldConfig",
3184
- message: "\u662F\u5426\u73B0\u5728\u914D\u7F6E WebDAV?",
3185
- default: true
3186
- }
3187
- ]);
3212
+ const shouldConfig = await promptConfirm("\u662F\u5426\u73B0\u5728\u914D\u7F6E WebDAV?", true);
3188
3213
  if (!shouldConfig) {
3189
3214
  return null;
3190
3215
  }
@@ -3198,6 +3223,7 @@ var init_helpers = __esm({
3198
3223
  "src/commands/sync/helpers.ts"() {
3199
3224
  "use strict";
3200
3225
  init_sync_config();
3226
+ init_confirm();
3201
3227
  }
3202
3228
  });
3203
3229
 
@@ -3294,14 +3320,7 @@ function uploadCommand(program2) {
3294
3320
  console.log();
3295
3321
  console.log(chalk6.yellow("\u26A0\uFE0F \u4E91\u7AEF\u73B0\u6709\u914D\u7F6E\u5C06\u88AB\u8986\u76D6"));
3296
3322
  console.log();
3297
- const { confirm } = await inquirer3.prompt([
3298
- {
3299
- type: "confirm",
3300
- name: "confirm",
3301
- message: "\u786E\u8BA4\u4E0A\u4F20?",
3302
- default: false
3303
- }
3304
- ]);
3323
+ const confirm = await promptConfirm("\u786E\u8BA4\u4E0A\u4F20?", false);
3305
3324
  if (!confirm) {
3306
3325
  console.log(chalk6.gray("\n\u274C \u5DF2\u53D6\u6D88\n"));
3307
3326
  return;
@@ -3332,6 +3351,7 @@ var init_upload = __esm({
3332
3351
  "use strict";
3333
3352
  init_dist2();
3334
3353
  init_helpers();
3354
+ init_confirm();
3335
3355
  }
3336
3356
  });
3337
3357
 
@@ -3366,14 +3386,7 @@ function downloadCommand(program2) {
3366
3386
  console.log(chalk7.bold("\n\u{1F4E5} \u4ECE\u4E91\u7AEF\u4E0B\u8F7D\u914D\u7F6E\n"));
3367
3387
  console.log(chalk7.yellow("\u26A0\uFE0F \u5C06\u8986\u76D6\u672C\u5730\u914D\u7F6E\uFF08\u81EA\u52A8\u5907\u4EFD\uFF09"));
3368
3388
  console.log();
3369
- const { confirm } = await inquirer4.prompt([
3370
- {
3371
- type: "confirm",
3372
- name: "confirm",
3373
- message: "\u786E\u8BA4\u4E0B\u8F7D?",
3374
- default: false
3375
- }
3376
- ]);
3389
+ const confirm = await promptConfirm("\u786E\u8BA4\u4E0B\u8F7D?", false);
3377
3390
  if (!confirm) {
3378
3391
  console.log(chalk7.gray("\n\u274C \u5DF2\u53D6\u6D88\n"));
3379
3392
  return;
@@ -3406,6 +3419,7 @@ var init_download = __esm({
3406
3419
  "use strict";
3407
3420
  init_dist2();
3408
3421
  init_helpers();
3422
+ init_confirm();
3409
3423
  }
3410
3424
  });
3411
3425
 
@@ -3712,6 +3726,7 @@ function formatProviderTable(providers, currentId) {
3712
3726
  }
3713
3727
 
3714
3728
  // src/interactive.ts
3729
+ init_confirm();
3715
3730
  var CLI_TOOL_CONFIG = {
3716
3731
  [TOOL_TYPES.CODEX]: { name: "Codex", emoji: "\u{1F536}", cmd: "cx" },
3717
3732
  [TOOL_TYPES.CLAUDE]: { name: "Claude", emoji: "\u{1F537}", cmd: "cc" },
@@ -3994,14 +4009,7 @@ async function handleAdd(tool) {
3994
4009
  console.log(` ${chalk11.bold(provider.name)} ${chalk11.blue(`[${toolName}]`)}`);
3995
4010
  console.log(` ${chalk11.gray(provider.baseUrl)}`);
3996
4011
  console.log();
3997
- const { switchNow } = await inquirer7.prompt([
3998
- {
3999
- type: "confirm",
4000
- name: "switchNow",
4001
- message: "\u662F\u5426\u7ACB\u5373\u5207\u6362\u5230\u6B64\u670D\u52A1\u5546?",
4002
- default: true
4003
- }
4004
- ]);
4012
+ const switchNow = await promptConfirm("\u662F\u5426\u7ACB\u5373\u5207\u6362\u5230\u6B64\u670D\u52A1\u5546?", true);
4005
4013
  if (switchNow) {
4006
4014
  manager.switch(provider.id);
4007
4015
  console.log(chalk11.green("\u2705 \u5DF2\u5207\u6362\u5230\u65B0\u670D\u52A1\u5546\n"));
@@ -4198,14 +4206,7 @@ async function handleRemove(tool) {
4198
4206
  }
4199
4207
  ]);
4200
4208
  const provider = providers.find((p) => p.id === providerId);
4201
- const { confirm } = await inquirer7.prompt([
4202
- {
4203
- type: "confirm",
4204
- name: "confirm",
4205
- message: `\u786E\u5B9A\u8981\u5220\u9664 "${provider.name}" \u5417?`,
4206
- default: false
4207
- }
4208
- ]);
4209
+ const confirm = await promptConfirm(`\u786E\u5B9A\u8981\u5220\u9664 "${provider.name}" \u5417?`, false);
4209
4210
  if (confirm) {
4210
4211
  manager.remove(providerId);
4211
4212
  console.log(chalk11.green(`
@@ -4217,6 +4218,7 @@ async function handleRemove(tool) {
4217
4218
  }
4218
4219
 
4219
4220
  // src/commands/codex/add.ts
4221
+ init_confirm();
4220
4222
  function addCommand(program2) {
4221
4223
  program2.command("add").description("\u6DFB\u52A0\u65B0\u7684 Codex \u670D\u52A1\u5546(\u4EA4\u4E92\u5F0F)").action(async () => {
4222
4224
  try {
@@ -4309,14 +4311,7 @@ function addCommand(program2) {
4309
4311
  console.log(` ${chalk12.bold(provider.name)} ${chalk12.blue("[Codex]")}`);
4310
4312
  console.log(` ${chalk12.gray(provider.baseUrl)}`);
4311
4313
  console.log();
4312
- const { switchNow } = await inquirer8.prompt([
4313
- {
4314
- type: "confirm",
4315
- name: "switchNow",
4316
- message: "\u662F\u5426\u7ACB\u5373\u5207\u6362\u5230\u6B64\u670D\u52A1\u5546?",
4317
- default: true
4318
- }
4319
- ]);
4314
+ const switchNow = await promptConfirm("\u662F\u5426\u7ACB\u5373\u5207\u6362\u5230\u6B64\u670D\u52A1\u5546?", true);
4320
4315
  if (switchNow) {
4321
4316
  manager.switch(provider.id);
4322
4317
  console.log(chalk12.green("\u2705 \u5DF2\u5207\u6362\u5230\u65B0\u670D\u52A1\u5546"));
@@ -4458,6 +4453,7 @@ function currentCommand(program2) {
4458
4453
 
4459
4454
  // src/commands/codex/remove.ts
4460
4455
  init_dist2();
4456
+ init_confirm();
4461
4457
  import chalk16 from "chalk";
4462
4458
  import inquirer10 from "inquirer";
4463
4459
  function removeCommand(program2) {
@@ -4494,14 +4490,7 @@ function removeCommand(program2) {
4494
4490
  targetId = selectedId;
4495
4491
  targetName = provider.name;
4496
4492
  }
4497
- const { confirmed } = await inquirer10.prompt([
4498
- {
4499
- type: "confirm",
4500
- name: "confirmed",
4501
- message: `\u786E\u5B9A\u5220\u9664 "${targetName}"?`,
4502
- default: false
4503
- }
4504
- ]);
4493
+ const confirmed = await promptConfirm(`\u786E\u5B9A\u5220\u9664 "${targetName}"?`, false);
4505
4494
  if (!confirmed) {
4506
4495
  console.log(chalk16.gray("\n\u5DF2\u53D6\u6D88\n"));
4507
4496
  return;
@@ -4696,6 +4685,7 @@ function createCodexCommands(program2) {
4696
4685
  init_dist2();
4697
4686
  import chalk19 from "chalk";
4698
4687
  import inquirer13 from "inquirer";
4688
+ init_confirm();
4699
4689
  function addCommand2(program2) {
4700
4690
  program2.command("add").description("\u6DFB\u52A0\u65B0\u7684 Claude Code \u670D\u52A1\u5546(\u4EA4\u4E92\u5F0F)").action(async () => {
4701
4691
  try {
@@ -4788,14 +4778,7 @@ function addCommand2(program2) {
4788
4778
  console.log(` ${chalk19.bold(provider.name)} ${chalk19.blue("[Claude Code]")}`);
4789
4779
  console.log(` ${chalk19.gray(provider.baseUrl)}`);
4790
4780
  console.log();
4791
- const { switchNow } = await inquirer13.prompt([
4792
- {
4793
- type: "confirm",
4794
- name: "switchNow",
4795
- message: "\u662F\u5426\u7ACB\u5373\u5207\u6362\u5230\u6B64\u670D\u52A1\u5546?",
4796
- default: true
4797
- }
4798
- ]);
4781
+ const switchNow = await promptConfirm("\u662F\u5426\u7ACB\u5373\u5207\u6362\u5230\u6B64\u670D\u52A1\u5546?", true);
4799
4782
  if (switchNow) {
4800
4783
  manager.switch(provider.id);
4801
4784
  console.log(chalk19.green("\u2705 \u5DF2\u5207\u6362\u5230\u65B0\u670D\u52A1\u5546"));
@@ -4935,6 +4918,7 @@ function currentCommand2(program2) {
4935
4918
 
4936
4919
  // src/commands/claude/remove.ts
4937
4920
  init_dist2();
4921
+ init_confirm();
4938
4922
  import chalk23 from "chalk";
4939
4923
  import inquirer15 from "inquirer";
4940
4924
  function removeCommand2(program2) {
@@ -4971,14 +4955,7 @@ function removeCommand2(program2) {
4971
4955
  targetId = selectedId;
4972
4956
  targetName = provider.name;
4973
4957
  }
4974
- const { confirmed } = await inquirer15.prompt([
4975
- {
4976
- type: "confirm",
4977
- name: "confirmed",
4978
- message: `\u786E\u5B9A\u5220\u9664 "${targetName}"?`,
4979
- default: false
4980
- }
4981
- ]);
4958
+ const confirmed = await promptConfirm(`\u786E\u5B9A\u5220\u9664 "${targetName}"?`, false);
4982
4959
  if (!confirmed) {
4983
4960
  console.log(chalk23.gray("\n\u5DF2\u53D6\u6D88\n"));
4984
4961
  return;
@@ -5160,6 +5137,7 @@ function cloneCommand2(program2) {
5160
5137
 
5161
5138
  // src/commands/clean.ts
5162
5139
  init_dist2();
5140
+ init_confirm();
5163
5141
  import chalk26 from "chalk";
5164
5142
  import inquirer18 from "inquirer";
5165
5143
  function formatBytes2(bytes) {
@@ -5217,14 +5195,7 @@ function cleanCommand(program2) {
5217
5195
  } else {
5218
5196
  cleanOptions = await promptForOptions(analysis);
5219
5197
  }
5220
- const { confirmed } = await inquirer18.prompt([
5221
- {
5222
- type: "confirm",
5223
- name: "confirmed",
5224
- message: "\u786E\u8BA4\u6267\u884C\u6E05\u7406\uFF1F\uFF08\u4F1A\u81EA\u52A8\u5907\u4EFD\u539F\u6587\u4EF6\uFF09",
5225
- default: true
5226
- }
5227
- ]);
5198
+ const confirmed = await promptConfirm("\u786E\u8BA4\u6267\u884C\u6E05\u7406\uFF1F\uFF08\u4F1A\u81EA\u52A8\u5907\u4EFD\u539F\u6587\u4EF6\uFF09", true);
5228
5199
  if (!confirmed) {
5229
5200
  console.log(chalk26.yellow("\n\u274C \u5DF2\u53D6\u6D88\n"));
5230
5201
  return;
@@ -5327,38 +5298,26 @@ async function promptForOptions(analysis) {
5327
5298
  return CleanPresets.aggressive();
5328
5299
  }
5329
5300
  }
5330
- const customAnswers = await inquirer18.prompt([
5331
- {
5332
- type: "confirm",
5333
- name: "cleanHistory",
5334
- message: "\u6E05\u7406\u9879\u76EE\u5386\u53F2\u8BB0\u5F55\uFF1F",
5335
- default: true
5336
- },
5337
- {
5338
- type: "number",
5339
- name: "keepCount",
5340
- message: "\u6BCF\u4E2A\u9879\u76EE\u4FDD\u7559\u6700\u8FD1\u591A\u5C11\u6761\u8BB0\u5F55\uFF1F",
5341
- default: 10,
5342
- when: (answers2) => answers2.cleanHistory
5343
- },
5344
- {
5345
- type: "confirm",
5346
- name: "cleanCache",
5347
- message: "\u6E05\u7406\u7F13\u5B58\u6570\u636E\uFF1F",
5348
- default: true
5349
- },
5350
- {
5351
- type: "confirm",
5352
- name: "cleanStats",
5353
- message: "\u91CD\u7F6E\u4F7F\u7528\u7EDF\u8BA1\uFF1F",
5354
- default: false
5355
- }
5356
- ]);
5301
+ const cleanHistory = await promptConfirm("\u6E05\u7406\u9879\u76EE\u5386\u53F2\u8BB0\u5F55\uFF1F", true);
5302
+ let keepCount = 10;
5303
+ if (cleanHistory) {
5304
+ const answers2 = await inquirer18.prompt([
5305
+ {
5306
+ type: "number",
5307
+ name: "keepCount",
5308
+ message: "\u6BCF\u4E2A\u9879\u76EE\u4FDD\u7559\u6700\u8FD1\u591A\u5C11\u6761\u8BB0\u5F55\uFF1F",
5309
+ default: 10
5310
+ }
5311
+ ]);
5312
+ keepCount = answers2.keepCount;
5313
+ }
5314
+ const cleanCache = await promptConfirm("\u6E05\u7406\u7F13\u5B58\u6570\u636E\uFF1F", true);
5315
+ const cleanStats = await promptConfirm("\u91CD\u7F6E\u4F7F\u7528\u7EDF\u8BA1\uFF1F", false);
5357
5316
  return {
5358
- cleanProjectHistory: customAnswers.cleanHistory,
5359
- keepRecentCount: customAnswers.keepCount || 0,
5360
- cleanCache: customAnswers.cleanCache,
5361
- cleanStats: customAnswers.cleanStats
5317
+ cleanProjectHistory: cleanHistory,
5318
+ keepRecentCount: cleanHistory ? keepCount || 0 : 0,
5319
+ cleanCache,
5320
+ cleanStats
5362
5321
  };
5363
5322
  }
5364
5323
 
@@ -5584,6 +5543,7 @@ function listCommand3(program2) {
5584
5543
 
5585
5544
  // src/commands/mcp/remove.ts
5586
5545
  init_dist2();
5546
+ init_confirm();
5587
5547
  import chalk29 from "chalk";
5588
5548
  import inquirer20 from "inquirer";
5589
5549
  function removeCommand3(program2) {
@@ -5620,14 +5580,7 @@ function removeCommand3(program2) {
5620
5580
  targetId = selectedId;
5621
5581
  targetName = provider.name;
5622
5582
  }
5623
- const { confirmed } = await inquirer20.prompt([
5624
- {
5625
- type: "confirm",
5626
- name: "confirmed",
5627
- message: `\u786E\u5B9A\u5220\u9664 "${targetName}"?`,
5628
- default: false
5629
- }
5630
- ]);
5583
+ const confirmed = await promptConfirm(`\u786E\u5B9A\u5220\u9664 "${targetName}"?`, false);
5631
5584
  if (!confirmed) {
5632
5585
  console.log(chalk29.gray("\n\u5DF2\u53D6\u6D88\n"));
5633
5586
  return;
@@ -5780,6 +5733,7 @@ function createMCPCommands(program2) {
5780
5733
  init_dist2();
5781
5734
  import chalk31 from "chalk";
5782
5735
  import inquirer22 from "inquirer";
5736
+ init_confirm();
5783
5737
  function addCommand4(program2) {
5784
5738
  program2.command("add").description("\u6DFB\u52A0\u65B0\u7684 Gemini CLI \u670D\u52A1\u5546(\u4EA4\u4E92\u5F0F)").action(async () => {
5785
5739
  try {
@@ -5868,14 +5822,7 @@ function addCommand4(program2) {
5868
5822
  console.log(` ${chalk31.bold(provider.name)} ${chalk31.blue("[Gemini CLI]")}`);
5869
5823
  console.log(` ${chalk31.gray(provider.baseUrl || "(\u4F7F\u7528\u9ED8\u8BA4\u7AEF\u70B9)")}`);
5870
5824
  console.log();
5871
- const { switchNow } = await inquirer22.prompt([
5872
- {
5873
- type: "confirm",
5874
- name: "switchNow",
5875
- message: "\u662F\u5426\u7ACB\u5373\u5207\u6362\u5230\u6B64\u670D\u52A1\u5546?",
5876
- default: true
5877
- }
5878
- ]);
5825
+ const switchNow = await promptConfirm("\u662F\u5426\u7ACB\u5373\u5207\u6362\u5230\u6B64\u670D\u52A1\u5546?", true);
5879
5826
  if (switchNow) {
5880
5827
  manager.switch(provider.id);
5881
5828
  console.log(chalk31.green("\u2705 \u5DF2\u5207\u6362\u5230\u65B0\u670D\u52A1\u5546"));
@@ -6012,6 +5959,7 @@ function currentCommand3(program2) {
6012
5959
 
6013
5960
  // src/commands/gemini/remove.ts
6014
5961
  init_dist2();
5962
+ init_confirm();
6015
5963
  import chalk35 from "chalk";
6016
5964
  import inquirer24 from "inquirer";
6017
5965
  function removeCommand4(program2) {
@@ -6052,14 +6000,7 @@ function removeCommand4(program2) {
6052
6000
  targetId = provider.id;
6053
6001
  targetName = provider.name;
6054
6002
  }
6055
- const { confirm } = await inquirer24.prompt([
6056
- {
6057
- type: "confirm",
6058
- name: "confirm",
6059
- message: `\u786E\u5B9A\u8981\u5220\u9664\u670D\u52A1\u5546 "${targetName}" \u5417\uFF1F`,
6060
- default: false
6061
- }
6062
- ]);
6003
+ const confirm = await promptConfirm(`\u786E\u5B9A\u8981\u5220\u9664\u670D\u52A1\u5546 "${targetName}" \u5417\uFF1F`, false);
6063
6004
  if (!confirm) {
6064
6005
  console.log(chalk35.gray("\n\u5DF2\u53D6\u6D88\u5220\u9664\n"));
6065
6006
  return;
@@ -6216,6 +6157,7 @@ function createGeminiCommands(program2) {
6216
6157
  init_dist2();
6217
6158
  import chalk38 from "chalk";
6218
6159
  import inquirer27 from "inquirer";
6160
+ init_confirm();
6219
6161
  function addCommand5(program2) {
6220
6162
  program2.command("add").description("\u6DFB\u52A0\u65B0\u7684 OpenCode \u670D\u52A1\u5546(\u4EA4\u4E92\u5F0F)").action(async () => {
6221
6163
  try {
@@ -6307,14 +6249,7 @@ function addCommand5(program2) {
6307
6249
  console.log(` ${chalk38.bold(provider.name)} ${chalk38.blue("[OpenCode]")}`);
6308
6250
  console.log(` ${chalk38.gray(provider.baseUrl)}`);
6309
6251
  console.log();
6310
- const { switchNow } = await inquirer27.prompt([
6311
- {
6312
- type: "confirm",
6313
- name: "switchNow",
6314
- message: "\u662F\u5426\u7ACB\u5373\u5207\u6362\u5230\u6B64\u670D\u52A1\u5546?",
6315
- default: true
6316
- }
6317
- ]);
6252
+ const switchNow = await promptConfirm("\u662F\u5426\u7ACB\u5373\u5207\u6362\u5230\u6B64\u670D\u52A1\u5546?", true);
6318
6253
  if (switchNow) {
6319
6254
  manager.switch(provider.id);
6320
6255
  console.log(chalk38.green("\u2705 \u5DF2\u5207\u6362\u5230\u65B0\u670D\u52A1\u5546"));
@@ -6509,6 +6444,7 @@ function editCommand5(program2) {
6509
6444
 
6510
6445
  // src/commands/opencode/remove.ts
6511
6446
  init_dist2();
6447
+ init_confirm();
6512
6448
  import chalk43 from "chalk";
6513
6449
  import inquirer30 from "inquirer";
6514
6450
  function removeCommand5(program2) {
@@ -6545,14 +6481,7 @@ function removeCommand5(program2) {
6545
6481
  targetId = selectedId;
6546
6482
  targetName = provider.name;
6547
6483
  }
6548
- const { confirmed } = await inquirer30.prompt([
6549
- {
6550
- type: "confirm",
6551
- name: "confirmed",
6552
- message: `\u786E\u5B9A\u5220\u9664 "${targetName}"?`,
6553
- default: false
6554
- }
6555
- ]);
6484
+ const confirmed = await promptConfirm(`\u786E\u5B9A\u5220\u9664 "${targetName}"?`, false);
6556
6485
  if (!confirmed) {
6557
6486
  console.log(chalk43.gray("\n\u5DF2\u53D6\u6D88\n"));
6558
6487
  return;
@@ -6662,6 +6591,7 @@ function createOpenCodeCommands(program2) {
6662
6591
  init_dist2();
6663
6592
  import chalk45 from "chalk";
6664
6593
  import inquirer32 from "inquirer";
6594
+ init_confirm();
6665
6595
  function addCommand6(program2) {
6666
6596
  program2.command("add").description("\u6DFB\u52A0\u65B0\u7684 OpenClaw \u670D\u52A1\u5546(\u4EA4\u4E92\u5F0F)").action(async () => {
6667
6597
  try {
@@ -6753,14 +6683,7 @@ function addCommand6(program2) {
6753
6683
  console.log(` ${chalk45.bold(provider.name)} ${chalk45.blue("[OpenClaw]")}`);
6754
6684
  console.log(` ${chalk45.gray(provider.baseUrl)}`);
6755
6685
  console.log();
6756
- const { switchNow } = await inquirer32.prompt([
6757
- {
6758
- type: "confirm",
6759
- name: "switchNow",
6760
- message: "\u662F\u5426\u7ACB\u5373\u5207\u6362\u5230\u6B64\u670D\u52A1\u5546?",
6761
- default: true
6762
- }
6763
- ]);
6686
+ const switchNow = await promptConfirm("\u662F\u5426\u7ACB\u5373\u5207\u6362\u5230\u6B64\u670D\u52A1\u5546?", true);
6764
6687
  if (switchNow) {
6765
6688
  manager.switch(provider.id);
6766
6689
  console.log(chalk45.green("\u2705 \u5DF2\u5207\u6362\u5230\u65B0\u670D\u52A1\u5546"));
@@ -6959,6 +6882,7 @@ function editCommand6(program2) {
6959
6882
 
6960
6883
  // src/commands/openclaw/remove.ts
6961
6884
  init_dist2();
6885
+ init_confirm();
6962
6886
  import chalk50 from "chalk";
6963
6887
  import inquirer35 from "inquirer";
6964
6888
  function removeCommand6(program2) {
@@ -6995,14 +6919,7 @@ function removeCommand6(program2) {
6995
6919
  targetId = selectedId;
6996
6920
  targetName = provider.name;
6997
6921
  }
6998
- const { confirmed } = await inquirer35.prompt([
6999
- {
7000
- type: "confirm",
7001
- name: "confirmed",
7002
- message: `\u786E\u5B9A\u5220\u9664 "${targetName}"?`,
7003
- default: false
7004
- }
7005
- ]);
6922
+ const confirmed = await promptConfirm(`\u786E\u5B9A\u5220\u9664 "${targetName}"?`, false);
7006
6923
  if (!confirmed) {
7007
6924
  console.log(chalk50.gray("\n\u5DF2\u53D6\u6D88\n"));
7008
6925
  return;
@@ -7156,8 +7073,8 @@ function exportCommand(program2) {
7156
7073
 
7157
7074
  // src/commands/import.ts
7158
7075
  init_dist2();
7076
+ init_confirm();
7159
7077
  import chalk53 from "chalk";
7160
- import inquirer37 from "inquirer";
7161
7078
  import path14 from "path";
7162
7079
  function importCommand(program2) {
7163
7080
  program2.command("import <\u6E90\u76EE\u5F55>").description("\u4ECE\u672C\u5730\u76EE\u5F55\u5BFC\u5165\u914D\u7F6E\uFF08\u4F1A\u8986\u76D6\u5F53\u524D\u914D\u7F6E\uFF09").action(async (sourceDir) => {
@@ -7182,14 +7099,7 @@ function importCommand(program2) {
7182
7099
  console.log();
7183
7100
  console.log(chalk53.gray("\u5F53\u524D\u914D\u7F6E\u5C06\u88AB\u8986\u76D6\uFF08\u81EA\u52A8\u5907\u4EFD\uFF09"));
7184
7101
  console.log();
7185
- const { confirmFirst } = await inquirer37.prompt([
7186
- {
7187
- type: "confirm",
7188
- name: "confirmFirst",
7189
- message: "\u786E\u8BA4\u5BFC\u5165\uFF1F",
7190
- default: false
7191
- }
7192
- ]);
7102
+ const confirmFirst = await promptConfirm("\u786E\u8BA4\u5BFC\u5165\uFF1F", false);
7193
7103
  if (!confirmFirst) {
7194
7104
  console.log(chalk53.gray("\n\u274C \u5DF2\u53D6\u6D88\n"));
7195
7105
  return;
@@ -7197,14 +7107,7 @@ function importCommand(program2) {
7197
7107
  console.log();
7198
7108
  console.log(chalk53.red.bold("\u26A0\uFE0F \u6700\u540E\u786E\u8BA4\uFF1A\u6B64\u64CD\u4F5C\u5C06\u8986\u76D6\u6240\u6709\u5F53\u524D\u914D\u7F6E\uFF01"));
7199
7109
  console.log();
7200
- const { confirmSecond } = await inquirer37.prompt([
7201
- {
7202
- type: "confirm",
7203
- name: "confirmSecond",
7204
- message: "\u771F\u7684\u8981\u7EE7\u7EED\u5417\uFF1F",
7205
- default: false
7206
- }
7207
- ]);
7110
+ const confirmSecond = await promptConfirm("\u771F\u7684\u8981\u7EE7\u7EED\u5417\uFF1F", false);
7208
7111
  if (!confirmSecond) {
7209
7112
  console.log(chalk53.gray("\n\u274C \u5DF2\u53D6\u6D88\n"));
7210
7113
  return;
@@ -7243,7 +7146,7 @@ init_dist2();
7243
7146
  import fs13 from "fs";
7244
7147
  import path15 from "path";
7245
7148
  import chalk54 from "chalk";
7246
- import inquirer38 from "inquirer";
7149
+ import inquirer37 from "inquirer";
7247
7150
 
7248
7151
  // src/utils/endpoint-latency.ts
7249
7152
  import { request as httpRequest } from "http";
@@ -7494,7 +7397,7 @@ function parsePlatforms(platformArg) {
7494
7397
  return platforms;
7495
7398
  }
7496
7399
  async function promptApiKey(title) {
7497
- const answers = await inquirer38.prompt([
7400
+ const answers = await inquirer37.prompt([
7498
7401
  {
7499
7402
  type: "password",
7500
7403
  name: "apiKey",
@@ -7509,7 +7412,7 @@ async function promptApiKey(title) {
7509
7412
  return answers.apiKey.trim();
7510
7413
  }
7511
7414
  async function promptPlatforms(title) {
7512
- const answers = await inquirer38.prompt([
7415
+ const answers = await inquirer37.prompt([
7513
7416
  {
7514
7417
  type: "checkbox",
7515
7418
  name: "platforms",
@@ -7604,7 +7507,7 @@ async function resolveOpenAiBaseUrl(profile, platforms, baseUrlArg) {
7604
7507
  console.log(chalk54.yellow(`\u975E\u4EA4\u4E92\u73AF\u5883\uFF0C\u5DF2\u81EA\u52A8\u4F7F\u7528\u9ED8\u8BA4\u5730\u5740\uFF1A${defaultResult.url}`));
7605
7508
  return defaultResult.url;
7606
7509
  }
7607
- const answers = await inquirer38.prompt([
7510
+ const answers = await inquirer37.prompt([
7608
7511
  {
7609
7512
  type: "list",
7610
7513
  name: "baseUrl",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccman",
3
- "version": "3.3.23",
3
+ "version": "3.3.24",
4
4
  "type": "module",
5
5
  "description": "Manage Codex, Claude Code, Gemini CLI, OpenCode, OpenClaw, and MCP API service provider configurations",
6
6
  "main": "./dist/index.js",
@@ -14,6 +14,7 @@
14
14
  "scripts": {
15
15
  "build": "tsup",
16
16
  "dev": "NODE_ENV=development tsx src/index.ts",
17
+ "test": "tsx --test src/utils/*.test.ts",
17
18
  "clean": "rm -rf dist"
18
19
  },
19
20
  "keywords": [