@tkpdx01/ccc 1.2.2 → 1.2.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tkpdx01/ccc",
3
- "version": "1.2.2",
3
+ "version": "1.2.3",
4
4
  "description": "Claude Code Settings Launcher - Manage multiple Claude Code profiles",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -34,8 +34,24 @@ export function listCommand(program) {
34
34
  let apiUrl = chalk.gray('(未设置)');
35
35
 
36
36
  if (settings) {
37
- // 兼容两种格式:apiUrl 或 env.ANTHROPIC_BASE_URL
38
- apiUrl = settings.apiUrl || settings.env?.ANTHROPIC_BASE_URL || chalk.gray('(未设置)');
37
+ // 兼容多种格式:
38
+ // 1. apiUrl 字段
39
+ // 2. env 对象格式: { ANTHROPIC_BASE_URL: "xxx" }
40
+ // 3. env 数组格式: ["ANTHROPIC_BASE_URL=xxx"]
41
+ if (settings.apiUrl) {
42
+ apiUrl = settings.apiUrl;
43
+ } else if (settings.env) {
44
+ if (Array.isArray(settings.env)) {
45
+ // 数组格式,用正则提取
46
+ const envLine = settings.env.find(e => /^ANTHROPIC_BASE_URL=/.test(e));
47
+ if (envLine) {
48
+ apiUrl = envLine.replace(/^ANTHROPIC_BASE_URL=/, '');
49
+ }
50
+ } else if (typeof settings.env === 'object') {
51
+ // 对象格式
52
+ apiUrl = settings.env.ANTHROPIC_BASE_URL || chalk.gray('(未设置)');
53
+ }
54
+ }
39
55
  } else {
40
56
  apiUrl = chalk.red('(读取失败)');
41
57
  }