@tkpdx01/ccc 1.2.2 → 1.2.5

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.5",
4
4
  "description": "Claude Code Settings Launcher - Manage multiple Claude Code profiles",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -1,6 +1,7 @@
1
+ import fs from 'fs';
1
2
  import chalk from 'chalk';
2
3
  import Table from 'cli-table3';
3
- import { getProfiles, getDefaultProfile, getProfilePath, readProfile } from '../profiles.js';
4
+ import { getProfiles, getDefaultProfile, getProfilePath } from '../profiles.js';
4
5
 
5
6
  export function listCommand(program) {
6
7
  program
@@ -18,7 +19,7 @@ export function listCommand(program) {
18
19
  }
19
20
 
20
21
  const table = new Table({
21
- head: [chalk.cyan('#'), chalk.cyan('Profile'), chalk.cyan('API URL')],
22
+ head: [chalk.cyan('#'), chalk.cyan('Profile'), chalk.cyan('ANTHROPIC_BASE_URL')],
22
23
  style: { head: [], border: [] },
23
24
  chars: {
24
25
  'top': '─', 'top-mid': '┬', 'top-left': '┌', 'top-right': '┐',
@@ -30,19 +31,23 @@ export function listCommand(program) {
30
31
 
31
32
  profiles.forEach((p, index) => {
32
33
  const isDefault = p === defaultProfile;
33
- const settings = readProfile(p);
34
- let apiUrl = chalk.gray('(未设置)');
35
-
36
- if (settings) {
37
- // 兼容两种格式:apiUrl env.ANTHROPIC_BASE_URL
38
- apiUrl = settings.apiUrl || settings.env?.ANTHROPIC_BASE_URL || chalk.gray('(未设置)');
39
- } else {
40
- apiUrl = chalk.red('(读取失败)');
34
+ const profilePath = getProfilePath(p);
35
+ let baseUrl = chalk.gray('(未设置)');
36
+
37
+ try {
38
+ const content = fs.readFileSync(profilePath, 'utf-8');
39
+ // 用正则从 JSON 文件内容中提取 ANTHROPIC_BASE_URL
40
+ const match = content.match(/"ANTHROPIC_BASE_URL"\s*:\s*"([^"]+)"/);
41
+ if (match && match[1]) {
42
+ baseUrl = match[1];
43
+ }
44
+ } catch {
45
+ baseUrl = chalk.red('(读取失败)');
41
46
  }
42
47
 
43
48
  const num = isDefault ? chalk.green(`${index + 1}`) : chalk.gray(`${index + 1}`);
44
49
  const name = isDefault ? chalk.green(`${p} *`) : p;
45
- table.push([num, name, apiUrl]);
50
+ table.push([num, name, baseUrl]);
46
51
  });
47
52
 
48
53
  console.log();