ccman 3.0.8 → 3.0.9

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 +29 -79
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -2047,54 +2047,8 @@ function printLogo() {
2047
2047
  var import_chalk3 = __toESM(require("chalk"));
2048
2048
  var import_inquirer2 = __toESM(require("inquirer"));
2049
2049
 
2050
- // ../core/package.json
2051
- var package_default = {
2052
- name: "@ccman/core",
2053
- version: "3.0.8",
2054
- type: "module",
2055
- description: "Core business logic for ccman",
2056
- main: "./dist/index.js",
2057
- types: "./dist/index.d.ts",
2058
- files: [
2059
- "dist"
2060
- ],
2061
- scripts: {
2062
- build: "tsc",
2063
- test: "vitest run",
2064
- "test:watch": "vitest",
2065
- clean: "rm -rf dist"
2066
- },
2067
- keywords: [
2068
- "codex",
2069
- "claude",
2070
- "claude-code",
2071
- "ai",
2072
- "api",
2073
- "config",
2074
- "manager"
2075
- ],
2076
- author: "2ue",
2077
- license: "MIT",
2078
- repository: {
2079
- type: "git",
2080
- url: "https://github.com/2ue/ccm.git",
2081
- directory: "packages/core"
2082
- },
2083
- homepage: "https://github.com/2ue/ccm#readme",
2084
- bugs: {
2085
- url: "https://github.com/2ue/ccm/issues"
2086
- },
2087
- dependencies: {
2088
- "@iarna/toml": "^2.2.5",
2089
- "proper-lockfile": "^4.1.2"
2090
- },
2091
- devDependencies: {
2092
- vitest: "^1.0.0"
2093
- },
2094
- engines: {
2095
- node: ">=18.0.0"
2096
- }
2097
- };
2050
+ // ../core/dist/index.js
2051
+ var import_module = require("module");
2098
2052
 
2099
2053
  // ../core/dist/tool-manager.js
2100
2054
  var path3 = __toESM(require("path"), 1);
@@ -2702,7 +2656,10 @@ function createClaudeManager() {
2702
2656
  }
2703
2657
 
2704
2658
  // ../core/dist/index.js
2705
- var VERSION = package_default.version;
2659
+ var import_meta = {};
2660
+ var require2 = (0, import_module.createRequire)(import_meta.url);
2661
+ var pkg = require2("../package.json");
2662
+ var VERSION = pkg.version;
2706
2663
 
2707
2664
  // src/interactive.ts
2708
2665
  var import_inquirer = __toESM(require("inquirer"));
@@ -2885,18 +2842,17 @@ async function handleAdd(tool) {
2885
2842
  }
2886
2843
  ]);
2887
2844
  const preset = presets.find((p) => p.name === presetName);
2888
- const { inputApiKey } = await import_inquirer.default.prompt([
2889
- {
2890
- type: "password",
2891
- name: "inputApiKey",
2892
- message: "\u8F93\u5165 API \u5BC6\u94A5:",
2893
- mask: "*",
2894
- validate: (value) => value ? true : "API \u5BC6\u94A5\u4E0D\u80FD\u4E3A\u7A7A"
2895
- }
2896
- ]);
2897
- name = preset.name;
2898
- baseUrl = preset.baseUrl;
2899
- apiKey = inputApiKey;
2845
+ console.log(import_chalk2.default.blue(`
2846
+ \u4F7F\u7528\u9884\u8BBE: ${preset.name} - ${preset.description}
2847
+ `));
2848
+ const input = await promptProviderForm({
2849
+ name: preset.name,
2850
+ baseUrl: preset.baseUrl,
2851
+ apiKey: ""
2852
+ });
2853
+ name = input.name;
2854
+ baseUrl = input.baseUrl;
2855
+ apiKey = input.apiKey;
2900
2856
  } else {
2901
2857
  const answers = await import_inquirer.default.prompt([
2902
2858
  {
@@ -2934,8 +2890,7 @@ async function handleAdd(tool) {
2934
2890
  console.log(import_chalk2.default.green("\u2705 \u6DFB\u52A0\u6210\u529F"));
2935
2891
  console.log();
2936
2892
  console.log(` ${import_chalk2.default.bold(provider.name)} ${import_chalk2.default.blue(`[${toolName}]`)}`);
2937
- console.log(` ${import_chalk2.default.gray(`ID: ${provider.id}`)}`);
2938
- console.log(` ${import_chalk2.default.gray(`URL: ${provider.baseUrl}`)}`);
2893
+ console.log(` ${import_chalk2.default.gray(provider.baseUrl)}`);
2939
2894
  console.log();
2940
2895
  const { switchNow } = await import_inquirer.default.prompt([
2941
2896
  {
@@ -2997,8 +2952,7 @@ async function handleList(tool) {
2997
2952
  const marker = isCurrent ? import_chalk2.default.green("\u25CF") : import_chalk2.default.gray("\u25CB");
2998
2953
  const nameStyle = isCurrent ? import_chalk2.default.green.bold : import_chalk2.default.white;
2999
2954
  console.log(`${marker} ${nameStyle(p.name)}`);
3000
- console.log(` ${import_chalk2.default.gray(`ID: ${p.id}`)}`);
3001
- console.log(` ${import_chalk2.default.gray(`URL: ${p.baseUrl}`)}`);
2955
+ console.log(` ${import_chalk2.default.gray(p.baseUrl)}`);
3002
2956
  if (p.lastUsedAt) {
3003
2957
  const date = new Date(p.lastUsedAt).toLocaleString("zh-CN");
3004
2958
  console.log(` ${import_chalk2.default.gray(`\u6700\u540E\u4F7F\u7528: ${date}`)}`);
@@ -3026,8 +2980,7 @@ async function handleCurrent(tool) {
3026
2980
  \u{1F441}\uFE0F \u5F53\u524D ${toolName} \u670D\u52A1\u5546
3027
2981
  `));
3028
2982
  console.log(` ${import_chalk2.default.green.bold(current.name)}`);
3029
- console.log(` ${import_chalk2.default.gray(`ID: ${current.id}`)}`);
3030
- console.log(` ${import_chalk2.default.gray(`URL: ${current.baseUrl}`)}`);
2983
+ console.log(` ${import_chalk2.default.gray(current.baseUrl)}`);
3031
2984
  if (current.lastUsedAt) {
3032
2985
  const date = new Date(current.lastUsedAt).toLocaleString("zh-CN");
3033
2986
  console.log(` ${import_chalk2.default.gray(`\u6700\u540E\u4F7F\u7528: ${date}`)}`);
@@ -3130,7 +3083,7 @@ async function handleClone(tool) {
3130
3083
  });
3131
3084
  console.log(import_chalk2.default.green("\n\u2705 \u514B\u9686\u6210\u529F\n"));
3132
3085
  console.log(` ${import_chalk2.default.bold(newProvider.name)}`);
3133
- console.log(` ${import_chalk2.default.gray(`ID: ${newProvider.id}`)}`);
3086
+ console.log(` ${import_chalk2.default.gray(newProvider.baseUrl)}`);
3134
3087
  console.log();
3135
3088
  }
3136
3089
  async function handleRemove(tool) {
@@ -3257,8 +3210,7 @@ function addCommand(program2) {
3257
3210
  console.log(import_chalk3.default.green("\u2705 \u6DFB\u52A0\u6210\u529F"));
3258
3211
  console.log();
3259
3212
  console.log(` ${import_chalk3.default.bold(provider.name)} ${import_chalk3.default.blue("[Codex]")}`);
3260
- console.log(` ${import_chalk3.default.gray(`ID: ${provider.id}`)}`);
3261
- console.log(` ${import_chalk3.default.gray(`URL: ${provider.baseUrl}`)}`);
3213
+ console.log(` ${import_chalk3.default.gray(provider.baseUrl)}`);
3262
3214
  console.log();
3263
3215
  const { switchNow } = await import_inquirer2.default.prompt([
3264
3216
  {
@@ -3273,8 +3225,8 @@ function addCommand(program2) {
3273
3225
  console.log(import_chalk3.default.green("\u2705 \u5DF2\u5207\u6362\u5230\u65B0\u670D\u52A1\u5546"));
3274
3226
  console.log();
3275
3227
  console.log(import_chalk3.default.gray("\u914D\u7F6E\u5DF2\u66F4\u65B0:"));
3276
- console.log(import_chalk3.default.gray(" - ~/.codex/config.toml"));
3277
- console.log(import_chalk3.default.gray(" - ~/.codex/auth.json"));
3228
+ console.log(import_chalk3.default.gray(` - ${getCodexConfigPath()}`));
3229
+ console.log(import_chalk3.default.gray(` - ${getCodexAuthPath()}`));
3278
3230
  } else {
3279
3231
  console.log(import_chalk3.default.blue("\u{1F4A1} \u7A0D\u540E\u5207\u6362:") + import_chalk3.default.white(` ccman cx use "${provider.name}"`));
3280
3232
  }
@@ -3373,8 +3325,8 @@ function useCommand(program2) {
3373
3325
  console.log(` ${import_chalk5.default.gray(`URL: ${provider.baseUrl}`)}`);
3374
3326
  console.log();
3375
3327
  console.log(import_chalk5.default.gray("\u914D\u7F6E\u5DF2\u66F4\u65B0:"));
3376
- console.log(import_chalk5.default.gray(" - ~/.codex/config.toml"));
3377
- console.log(import_chalk5.default.gray(" - ~/.codex/auth.json"));
3328
+ console.log(import_chalk5.default.gray(` - ${getCodexConfigPath()}`));
3329
+ console.log(import_chalk5.default.gray(` - ${getCodexAuthPath()}`));
3378
3330
  console.log();
3379
3331
  } catch (error) {
3380
3332
  if (error instanceof ProviderNotFoundError) {
@@ -3742,8 +3694,7 @@ function addCommand2(program2) {
3742
3694
  console.log(import_chalk10.default.green("\u2705 \u6DFB\u52A0\u6210\u529F"));
3743
3695
  console.log();
3744
3696
  console.log(` ${import_chalk10.default.bold(provider.name)} ${import_chalk10.default.blue("[Claude Code]")}`);
3745
- console.log(` ${import_chalk10.default.gray(`ID: ${provider.id}`)}`);
3746
- console.log(` ${import_chalk10.default.gray(`URL: ${provider.baseUrl}`)}`);
3697
+ console.log(` ${import_chalk10.default.gray(provider.baseUrl)}`);
3747
3698
  console.log();
3748
3699
  const { switchNow } = await import_inquirer7.default.prompt([
3749
3700
  {
@@ -3758,7 +3709,7 @@ function addCommand2(program2) {
3758
3709
  console.log(import_chalk10.default.green("\u2705 \u5DF2\u5207\u6362\u5230\u65B0\u670D\u52A1\u5546"));
3759
3710
  console.log();
3760
3711
  console.log(import_chalk10.default.gray("\u914D\u7F6E\u5DF2\u66F4\u65B0:"));
3761
- console.log(import_chalk10.default.gray(" - ~/.claude/settings.json"));
3712
+ console.log(import_chalk10.default.gray(` - ${getClaudeConfigPath()}`));
3762
3713
  } else {
3763
3714
  console.log(import_chalk10.default.blue("\u{1F4A1} \u7A0D\u540E\u5207\u6362:") + import_chalk10.default.white(` ccman cc use "${provider.name}"`));
3764
3715
  }
@@ -3857,8 +3808,7 @@ function useCommand2(program2) {
3857
3808
  console.log(` ${import_chalk12.default.gray(`URL: ${provider.baseUrl}`)}`);
3858
3809
  console.log();
3859
3810
  console.log(import_chalk12.default.gray("\u914D\u7F6E\u5DF2\u66F4\u65B0:"));
3860
- console.log(import_chalk12.default.gray(" - ~/.claude/config.toml"));
3861
- console.log(import_chalk12.default.gray(" - ~/.claude/auth.json"));
3811
+ console.log(import_chalk12.default.gray(` - ${getClaudeConfigPath()}`));
3862
3812
  console.log();
3863
3813
  } catch (error) {
3864
3814
  if (error instanceof ProviderNotFoundError) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccman",
3
- "version": "3.0.8",
3
+ "version": "3.0.9",
4
4
  "description": "Manage Codex and Claude Code API service provider configurations",
5
5
  "main": "./dist/index.js",
6
6
  "bin": {