ai-account-switch 1.5.6 → 1.6.0
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/README.md +325 -5
- package/README_ZH.md +316 -5
- package/package.json +6 -4
- package/src/commands/README.md +124 -0
- package/src/commands/account.js +997 -0
- package/src/commands/helpers.js +35 -0
- package/src/commands/index.js +53 -0
- package/src/commands/model.js +383 -0
- package/src/commands/utility.js +326 -0
- package/src/config.js +158 -7
- package/src/index.js +55 -55
- package/src/ui-server.js +494 -47
- package/src/commands.js +0 -1182
package/src/index.js
CHANGED
|
@@ -25,158 +25,158 @@ const packageJson = require('../package.json');
|
|
|
25
25
|
|
|
26
26
|
program
|
|
27
27
|
.name('ais')
|
|
28
|
-
.description('AI Account Switch - Manage and switch Claude/Codex account configurations')
|
|
28
|
+
.description('AI Account Switch - Manage and switch Claude/Codex/Droids account configurations (AI 账号切换 - 管理和切换 Claude/Codex/Droids 账号配置)')
|
|
29
29
|
.version(packageJson.version);
|
|
30
30
|
|
|
31
31
|
// Add account command
|
|
32
32
|
program
|
|
33
33
|
.command('add [name]')
|
|
34
|
-
.description('Add a new account configuration')
|
|
34
|
+
.description('Add a new account configuration (添加新账号配置)')
|
|
35
35
|
.action(addAccount);
|
|
36
36
|
|
|
37
37
|
// List accounts command
|
|
38
38
|
program
|
|
39
39
|
.command('list')
|
|
40
40
|
.alias('ls')
|
|
41
|
-
.description('List all available accounts')
|
|
41
|
+
.description('List all available accounts (列出所有可用账号)')
|
|
42
42
|
.action(listAccounts);
|
|
43
43
|
|
|
44
44
|
// Use account command
|
|
45
45
|
program
|
|
46
46
|
.command('use [name]')
|
|
47
|
-
.description('Set the account to use for the current project')
|
|
47
|
+
.description('Set the account to use for the current project (设置当前项目使用的账号)')
|
|
48
48
|
.action(useAccount);
|
|
49
49
|
|
|
50
50
|
// Show info command
|
|
51
51
|
program
|
|
52
52
|
.command('info')
|
|
53
|
-
.description('Show current project\'s account information')
|
|
53
|
+
.description('Show current project\'s account information (显示当前项目的账号信息)')
|
|
54
54
|
.action(showInfo);
|
|
55
55
|
|
|
56
56
|
// Remove account command
|
|
57
57
|
program
|
|
58
58
|
.command('remove [name]')
|
|
59
59
|
.alias('rm')
|
|
60
|
-
.description('Remove an account')
|
|
60
|
+
.description('Remove an account (删除账号)')
|
|
61
61
|
.action(removeAccount);
|
|
62
62
|
|
|
63
63
|
// Show current account command
|
|
64
64
|
program
|
|
65
65
|
.command('current')
|
|
66
|
-
.description('Show the current account for this project')
|
|
66
|
+
.description('Show the current account for this project (显示当前项目的账号)')
|
|
67
67
|
.action(showCurrent);
|
|
68
68
|
|
|
69
69
|
// Show configuration paths
|
|
70
70
|
program
|
|
71
71
|
.command('paths')
|
|
72
|
-
.description('Show configuration file paths')
|
|
72
|
+
.description('Show configuration file paths (显示配置文件路径)')
|
|
73
73
|
.action(showPaths);
|
|
74
74
|
|
|
75
75
|
// Export account configuration
|
|
76
76
|
program
|
|
77
77
|
.command('export <name>')
|
|
78
|
-
.description('Export account configuration as JSON')
|
|
78
|
+
.description('Export account configuration as JSON (导出账号配置为 JSON)')
|
|
79
79
|
.action(exportAccount);
|
|
80
80
|
|
|
81
81
|
// Diagnostic command
|
|
82
82
|
program
|
|
83
83
|
.command('doctor')
|
|
84
|
-
.description('Diagnose Claude Code configuration issues')
|
|
84
|
+
.description('Diagnose Claude Code configuration issues (诊断 Claude Code 配置问题)')
|
|
85
85
|
.action(doctor);
|
|
86
86
|
|
|
87
87
|
// Web UI command
|
|
88
88
|
program
|
|
89
89
|
.command('ui')
|
|
90
|
-
.description('Start web-based account manager UI')
|
|
90
|
+
.description('Start web-based account manager UI (启动基于 Web 的账号管理界面)')
|
|
91
91
|
.action(startUI);
|
|
92
92
|
|
|
93
93
|
// Model management commands
|
|
94
94
|
const modelCommand = program
|
|
95
95
|
.command('model')
|
|
96
|
-
.description('Manage model groups for current project account');
|
|
96
|
+
.description('Manage model groups for current project account (管理当前项目账号的模型组)');
|
|
97
97
|
|
|
98
98
|
modelCommand
|
|
99
99
|
.command('list')
|
|
100
100
|
.alias('ls')
|
|
101
|
-
.description('List all model groups for current account')
|
|
101
|
+
.description('List all model groups for current account (列出当前账号的所有模型组)')
|
|
102
102
|
.action(listModelGroups);
|
|
103
103
|
|
|
104
104
|
modelCommand
|
|
105
105
|
.command('add [name]')
|
|
106
|
-
.description('Add a new model group')
|
|
106
|
+
.description('Add a new model group (添加新模型组)')
|
|
107
107
|
.action(addModelGroup);
|
|
108
108
|
|
|
109
109
|
modelCommand
|
|
110
110
|
.command('use <name>')
|
|
111
|
-
.description('Switch to a different model group')
|
|
111
|
+
.description('Switch to a different model group (切换到不同的模型组)')
|
|
112
112
|
.action(useModelGroup);
|
|
113
113
|
|
|
114
114
|
modelCommand
|
|
115
115
|
.command('remove [name]')
|
|
116
116
|
.alias('rm')
|
|
117
|
-
.description('Remove a model group')
|
|
117
|
+
.description('Remove a model group (删除模型组)')
|
|
118
118
|
.action(removeModelGroup);
|
|
119
119
|
|
|
120
120
|
modelCommand
|
|
121
121
|
.command('show [name]')
|
|
122
|
-
.description('Show model group configuration')
|
|
122
|
+
.description('Show model group configuration (显示模型组配置)')
|
|
123
123
|
.action(showModelGroup);
|
|
124
124
|
|
|
125
125
|
// Help command
|
|
126
126
|
program
|
|
127
127
|
.command('help')
|
|
128
|
-
.description('Display help information')
|
|
128
|
+
.description('Display help information (显示帮助信息)')
|
|
129
129
|
.action(() => {
|
|
130
|
-
console.log(chalk.bold.cyan('\n🤖 AI Account Switch (ais) - Help\n'));
|
|
131
|
-
console.log(chalk.bold('USAGE:'));
|
|
130
|
+
console.log(chalk.bold.cyan('\n🤖 AI Account Switch (ais) - Help (帮助)\n'));
|
|
131
|
+
console.log(chalk.bold('USAGE (用法):'));
|
|
132
132
|
console.log(' ais <command> [options]\n');
|
|
133
133
|
|
|
134
|
-
console.log(chalk.bold('COMMANDS:'));
|
|
135
|
-
console.log(' add [name] Add a new account configuration (with custom env vars)');
|
|
136
|
-
console.log(' list, ls List all available accounts');
|
|
137
|
-
console.log(' use [name] Set the account for current project');
|
|
138
|
-
console.log(' info Show current project\'s account info');
|
|
139
|
-
console.log(' current Show current account name');
|
|
140
|
-
console.log(' remove, rm Remove an account');
|
|
141
|
-
console.log(' paths Show configuration file paths');
|
|
142
|
-
console.log(' doctor Diagnose Claude Code configuration issues');
|
|
143
|
-
console.log(' export <name> Export account as JSON');
|
|
144
|
-
console.log(' ui Start web-based account manager UI');
|
|
145
|
-
console.log(' help Display this help message');
|
|
146
|
-
console.log(' version Show version number\n');
|
|
147
|
-
|
|
148
|
-
console.log(chalk.bold('EXAMPLES:'));
|
|
149
|
-
console.log(chalk.gray(' # Add a new account interactively'));
|
|
134
|
+
console.log(chalk.bold('COMMANDS (命令):'));
|
|
135
|
+
console.log(' add [name] Add a new account configuration (with custom env vars) (添加新账号配置,支持自定义环境变量)');
|
|
136
|
+
console.log(' list, ls List all available accounts (列出所有可用账号)');
|
|
137
|
+
console.log(' use [name] Set the account for current project (设置当前项目使用的账号)');
|
|
138
|
+
console.log(' info Show current project\'s account info (显示当前项目的账号信息)');
|
|
139
|
+
console.log(' current Show current account name (显示当前账号名称)');
|
|
140
|
+
console.log(' remove, rm Remove an account (删除账号)');
|
|
141
|
+
console.log(' paths Show configuration file paths (显示配置文件路径)');
|
|
142
|
+
console.log(' doctor Diagnose Claude Code configuration issues (诊断 Claude Code 配置问题)');
|
|
143
|
+
console.log(' export <name> Export account as JSON (导出账号为 JSON)');
|
|
144
|
+
console.log(' ui Start web-based account manager UI (启动基于 Web 的账号管理界面)');
|
|
145
|
+
console.log(' help Display this help message (显示此帮助信息)');
|
|
146
|
+
console.log(' version Show version number (显示版本号)\n');
|
|
147
|
+
|
|
148
|
+
console.log(chalk.bold('EXAMPLES (示例):'));
|
|
149
|
+
console.log(chalk.gray(' # Add a new account interactively (交互式添加新账号)'));
|
|
150
150
|
console.log(' ais add\n');
|
|
151
|
-
console.log(chalk.gray(' # Add a new account with a name'));
|
|
151
|
+
console.log(chalk.gray(' # Add a new account with a name (添加带名称的新账号)'));
|
|
152
152
|
console.log(' ais add my-claude-account\n');
|
|
153
|
-
console.log(chalk.gray(' # List all accounts'));
|
|
153
|
+
console.log(chalk.gray(' # List all accounts (列出所有账号)'));
|
|
154
154
|
console.log(' ais list\n');
|
|
155
|
-
console.log(chalk.gray(' # Use an account for current project'));
|
|
155
|
+
console.log(chalk.gray(' # Use an account for current project (为当前项目使用某个账号)'));
|
|
156
156
|
console.log(' ais use my-claude-account\n');
|
|
157
|
-
console.log(chalk.gray(' # Show current project info'));
|
|
157
|
+
console.log(chalk.gray(' # Show current project info (显示当前项目信息)'));
|
|
158
158
|
console.log(' ais info\n');
|
|
159
|
-
console.log(chalk.gray(' # Diagnose configuration issues'));
|
|
159
|
+
console.log(chalk.gray(' # Diagnose configuration issues (诊断配置问题)'));
|
|
160
160
|
console.log(' ais doctor\n');
|
|
161
|
-
console.log(chalk.gray(' # Remove an account'));
|
|
161
|
+
console.log(chalk.gray(' # Remove an account (删除账号)'));
|
|
162
162
|
console.log(' ais remove my-old-account\n');
|
|
163
|
-
console.log(chalk.gray(' # Start web UI for managing accounts'));
|
|
163
|
+
console.log(chalk.gray(' # Start web UI for managing accounts (启动 Web 界面管理账号)'));
|
|
164
164
|
console.log(' ais ui\n');
|
|
165
165
|
|
|
166
|
-
console.log(chalk.bold('FEATURES:'));
|
|
167
|
-
console.log(' • Custom environment variables support');
|
|
168
|
-
console.log(' • Automatic Claude Code .claude/settings.local.json generation');
|
|
169
|
-
console.log(' • Smart directory detection (works in any subdirectory)');
|
|
170
|
-
console.log(' • Configuration diagnostics with doctor command\n');
|
|
166
|
+
console.log(chalk.bold('FEATURES (功能特性):'));
|
|
167
|
+
console.log(' • Custom environment variables support (支持自定义环境变量)');
|
|
168
|
+
console.log(' • Automatic Claude Code .claude/settings.local.json generation (自动生成 Claude Code .claude/settings.local.json)');
|
|
169
|
+
console.log(' • Smart directory detection (works in any subdirectory) (智能目录检测,在任何子目录中都能工作)');
|
|
170
|
+
console.log(' • Configuration diagnostics with doctor command (使用 doctor 命令诊断配置问题)\n');
|
|
171
171
|
|
|
172
|
-
console.log(chalk.bold('CONFIGURATION:'));
|
|
173
|
-
console.log(' Global config: ~/.ai-account-switch/config.json');
|
|
174
|
-
console.log(' Project config: ./.ais-project-config');
|
|
175
|
-
console.log(' Claude config: ./.claude/settings.local.json\n');
|
|
172
|
+
console.log(chalk.bold('CONFIGURATION (配置):'));
|
|
173
|
+
console.log(' Global config (全局配置): ~/.ai-account-switch/config.json');
|
|
174
|
+
console.log(' Project config (项目配置): ./.ais-project-config');
|
|
175
|
+
console.log(' Claude config (Claude 配置): ./.claude/settings.local.json\n');
|
|
176
176
|
|
|
177
|
-
console.log(chalk.bold('CROSS-PLATFORM:'));
|
|
178
|
-
console.log(' Works on macOS, Linux, and Windows');
|
|
179
|
-
console.log(' Account data is stored in your user home directory\n');
|
|
177
|
+
console.log(chalk.bold('CROSS-PLATFORM (跨平台):'));
|
|
178
|
+
console.log(' Works on macOS, Linux, and Windows (支持 macOS、Linux 和 Windows)');
|
|
179
|
+
console.log(' Account data is stored in your user home directory (账号数据存储在用户主目录中)\n');
|
|
180
180
|
});
|
|
181
181
|
|
|
182
182
|
// Parse arguments
|