@pikecode/api-key-manager 1.0.12 → 1.0.14
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 +1 -1
- package/src/commands/list.js +33 -12
package/package.json
CHANGED
package/src/commands/list.js
CHANGED
|
@@ -32,27 +32,48 @@ class ProviderLister {
|
|
|
32
32
|
const availabilityIcon = this._iconForState(availability.state);
|
|
33
33
|
const availabilityText = this._formatAvailability(availability);
|
|
34
34
|
const nameColor = isCurrent ? chalk.green : chalk.white;
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
|
|
36
|
+
// 显示 IDE 类型
|
|
37
|
+
const ideIcon = provider.ideName === 'codex' ? '⚙️' : '🚀';
|
|
38
|
+
const ideLabel = provider.ideName === 'codex' ? 'Codex' : 'Claude Code';
|
|
39
|
+
|
|
40
|
+
console.log(`${status} ${availabilityIcon} ${nameColor(provider.name)} (${provider.displayName}) [${ideIcon} ${ideLabel}] - ${availabilityText}`);
|
|
37
41
|
|
|
38
42
|
// 显示认证模式
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
43
|
+
let authModeDisplay;
|
|
44
|
+
if (provider.ideName === 'codex') {
|
|
45
|
+
// Codex 认证模式
|
|
46
|
+
authModeDisplay = {
|
|
47
|
+
api_key: 'OpenAI API Key',
|
|
48
|
+
chatgpt_login: 'ChatGPT 登录'
|
|
49
|
+
};
|
|
50
|
+
} else {
|
|
51
|
+
// Claude Code 认证模式
|
|
52
|
+
authModeDisplay = {
|
|
53
|
+
api_key: '通用API密钥模式',
|
|
54
|
+
auth_token: '认证令牌模式',
|
|
55
|
+
oauth_token: 'OAuth令牌模式'
|
|
56
|
+
};
|
|
57
|
+
}
|
|
44
58
|
console.log(chalk.gray(` 认证模式: ${authModeDisplay[provider.authMode] || provider.authMode}`));
|
|
45
59
|
|
|
46
|
-
// 如果是 api_key 模式,显示 tokenType
|
|
47
|
-
if (provider.authMode === 'api_key' && provider.tokenType) {
|
|
60
|
+
// 如果是 Claude Code api_key 模式,显示 tokenType
|
|
61
|
+
if (provider.ideName === 'claude' && provider.authMode === 'api_key' && provider.tokenType) {
|
|
48
62
|
const tokenTypeDisplay = provider.tokenType === 'auth_token' ? 'ANTHROPIC_AUTH_TOKEN' : 'ANTHROPIC_API_KEY';
|
|
49
63
|
console.log(chalk.gray(` Token类型: ${tokenTypeDisplay}`));
|
|
50
64
|
}
|
|
51
65
|
|
|
52
66
|
if (provider.baseUrl) {
|
|
53
|
-
console.log(chalk.gray(` URL: ${provider.baseUrl}`));
|
|
67
|
+
console.log(chalk.gray(` API基础URL: ${provider.baseUrl}`));
|
|
54
68
|
}
|
|
55
|
-
|
|
69
|
+
|
|
70
|
+
// 仅在有 authToken 时显示(Codex ChatGPT 登录模式没有 Token)
|
|
71
|
+
if (provider.authToken) {
|
|
72
|
+
console.log(chalk.gray(` Token: ${provider.authToken.substring(0, 10)}...`));
|
|
73
|
+
} else if (provider.ideName === 'codex') {
|
|
74
|
+
console.log(chalk.gray(` 认证: ChatGPT 交互式登录(无需 Token)`));
|
|
75
|
+
}
|
|
76
|
+
|
|
56
77
|
if (provider.launchArgs && provider.launchArgs.length > 0) {
|
|
57
78
|
console.log(chalk.gray(` 启动参数: ${provider.launchArgs.join(' ')}`));
|
|
58
79
|
}
|
|
@@ -62,7 +83,7 @@ class ProviderLister {
|
|
|
62
83
|
}
|
|
63
84
|
console.log(chalk.gray(` 创建时间: ${new Date(provider.createdAt).toLocaleString()}`));
|
|
64
85
|
console.log(chalk.gray(` 最后使用: ${new Date(provider.lastUsed).toLocaleString()}`));
|
|
65
|
-
|
|
86
|
+
|
|
66
87
|
if (index < providers.length - 1) {
|
|
67
88
|
console.log(chalk.gray('─'.repeat(60)));
|
|
68
89
|
}
|