ai-account-switch 1.6.0 → 1.7.1

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 CHANGED
@@ -1,211 +1,281 @@
1
1
  # AI Account Switch (ais)
2
2
 
3
- English | [简体中文](README_ZH.md)
4
-
5
- A cross-platform CLI tool to manage and switch between Claude/Codex/Droids account configurations for different projects.
6
-
7
- ## Features
8
-
9
- - **Cross-Platform**: Works seamlessly on macOS, Linux, and Windows
10
- - **Multiple Accounts**: Store and manage multiple AI service accounts
11
- - **Project-Specific**: Each project can use a different account
12
- - **Smart Directory Detection**: Works in any subdirectory of your project (like git)
13
- - **Claude Code Integration**: Automatically generates `.claude/settings.local.json` for Claude Code CLI
14
- - **Secure Storage**: Account credentials stored locally in your home directory
15
- - **Interactive CLI**: Easy-to-use interactive prompts for all operations
16
- - **Account Types**: Support for Claude, Codex, CCR (Claude Code Router), Droids, and other AI services
17
- - **Web UI**: Modern web interface with account status checking and management
18
-
19
- ## Installation
20
-
21
- ### npm Installation (Recommended)
3
+ 简体中文 | [English](README_EN.md)
4
+
5
+ 一个跨平台的命令行工具,用于管理和切换不同项目的 Claude/Codex/Droids 账户配置。
6
+
7
+ ## 特性
8
+
9
+ - **跨平台支持**:在 macOSLinux Windows 上无缝运行
10
+ - **多账户管理**:存储和管理多个 AI 服务账户
11
+ - **项目级配置**:每个项目可以使用不同的账户
12
+ - **智能目录检测**:在项目的任何子目录中都能工作(类似 git
13
+ - **Claude Code 集成**:自动生成 `.claude/settings.local.json` 配置文件
14
+ - **Web UI 管理界面**:
15
+ - 🎨 现代化单页面应用,支持深色/浅色主题
16
+ - 🌍 中英文双语支持,一键切换
17
+ - ⚙️ 可视化管理账号:增删改查一目了然
18
+ - 📤 导入/导出功能:批量管理账号配置
19
+ - 🔍 实时搜索过滤账号
20
+ - 💾 自定义环境变量配置
21
+ - 🎯 主题自动跟随系统设置
22
+ - **MCP Web UI 管理**:完整的 MCP (Model Context Protocol) 服务器管理
23
+ - 🖥️ 直观的界面添加、编辑、删除 MCP 服务器
24
+ - 🔌 支持 stdio、sse、http 三种服务器类型
25
+ - 🧪 测试 MCP 服务器连接
26
+ - ⚡ 一键启用/禁用项目级服务器
27
+ - 🔍 搜索和筛选功能
28
+ - 🌐 完整的中英文支持
29
+ - **安全存储**:账户凭证仅存储在本地
30
+ - **交互式命令行**:所有操作都有易用的交互式提示
31
+ - **多种账户类型**:支持 Claude、Codex、CCR (Claude Code Router)、Droids 和其他 AI 服务
32
+
33
+ ## 安装
34
+
35
+ ### npm 安装(推荐)
22
36
 
23
37
  ```bash
24
38
  npm install -g ai-account-switch
25
39
  ```
26
40
 
27
- After installation, the `ais` command will be available globally.
41
+ 安装后,`ais` 命令将在全局可用。
28
42
 
29
- **Troubleshooting**: If you encounter "command not found" after installation:
43
+ **故障排除**:如果安装后提示"命令未找到"
30
44
 
31
45
  ```bash
32
- # Check npm global bin path
46
+ # 查看 npm 全局 bin 路径
33
47
  npm config get prefix
34
48
 
35
- # Add to PATH (Linux/macOS)
49
+ # 添加到 PATH (Linux/macOS)
36
50
  export PATH="$PATH:$(npm config get prefix)/bin"
37
51
 
38
- # On Windows, add to system PATH: %APPDATA%\npm
52
+ # Windows 上,添加到系统 PATH:%APPDATA%\npm
39
53
  ```
40
54
 
41
- ### Install from Source
55
+ ### 从源码安装
42
56
 
43
57
  ```bash
44
- # Clone the repository
58
+ # 克隆仓库
45
59
  git clone https://github.com/yourusername/ai-agent-user-swith.git
46
60
  cd ai-agent-user-swith
47
61
 
48
- # Install dependencies
62
+ # 安装依赖
49
63
  npm install
50
64
 
51
- # Link the CLI tool globally
65
+ # 全局链接 CLI 工具
52
66
  npm link
53
67
  ```
54
68
 
55
- ## Usage
56
-
57
- ### Commands Overview
58
-
59
- | Command | Alias | Description |
60
- |---------|-------|-------------|
61
- | `ais add [name]` | - | Add a new account configuration |
62
- | `ais list` | `ls` | List all available accounts |
63
- | `ais use [name]` | - | Set account for current project |
64
- | `ais info` | - | Show current project's account info |
65
- | `ais current` | - | Show current account name |
66
- | `ais remove [name]` | `rm` | Remove an account |
67
- | `ais model list` | `ls` | List all model groups for current account |
68
- | `ais model add [name]` | - | Add a new model group |
69
- | `ais model use <name>` | - | Switch to a different model group |
70
- | `ais model remove [name]` | `rm` | Remove a model group |
71
- | `ais model show [name]` | - | Show model group configuration |
72
- | `ais ui` | - | Start web-based UI manager |
73
- | `ais paths` | - | Show configuration file paths |
74
- | `ais doctor` | - | Diagnose configuration issues |
75
- | `ais export <name>` | - | Export account as JSON |
76
- | `ais help` | - | Display help information |
77
- | `ais --version` | - | Show version number |
78
-
79
- ### Quick Start
80
-
81
- #### 1. Add an Account
82
-
83
- Add your first account interactively:
69
+ ## 使用方法
70
+
71
+ ### 命令概览
72
+
73
+ | 命令 | 别名 | 描述 |
74
+ |------|------|------|
75
+ | `ais add [name]` | - | 添加新的账户配置 |
76
+ | `ais list` | `ls` | 列出所有可用账户 |
77
+ | `ais use [name]` | - | 为当前项目设置账户 |
78
+ | `ais info` | - | 显示当前项目的账户信息 |
79
+ | `ais current` | - | 显示当前账户名称 |
80
+ | `ais remove [name]` | `rm` | 删除账户 |
81
+ | `ais model list` | `ls` | 列出当前账户的所有模型组 |
82
+ | `ais model add [name]` | - | 添加新的模型组 |
83
+ | `ais model use <name>` | - | 切换到不同的模型组 |
84
+ | `ais model remove [name]` | `rm` | 删除模型组 |
85
+ | `ais model show [name]` | - | 显示模型组配置 |
86
+ | `ais mcp add [name]` | - | 添加新的 MCP 服务器 |
87
+ | `ais mcp list` | `ls` | 列出所有 MCP 服务器 |
88
+ | `ais mcp show [name]` | - | 显示 MCP 服务器详情 |
89
+ | `ais mcp update [name]` | - | 更新 MCP 服务器配置 |
90
+ | `ais mcp remove [name]` | `rm` | 删除 MCP 服务器 |
91
+ | `ais mcp enable [name]` | - | 为当前项目启用 MCP 服务器 |
92
+ | `ais mcp disable [name]` | - | 为当前项目禁用 MCP 服务器 |
93
+ | `ais mcp enabled` | - | 显示已启用的 MCP 服务器 |
94
+ | `ais mcp sync` | - | 同步 MCP 配置到 Claude Code |
95
+ | `ais ui` | - | 启动 Web UI 管理界面 |
96
+ | `ais paths` | - | 显示配置文件路径 |
97
+ | `ais doctor` | - | 诊断 Claude Code 配置问题 |
98
+ | `ais export <name>` | - | 导出账户为 JSON 格式 |
99
+ | `ais help` | - | 显示帮助信息 |
100
+ | `ais --version` | - | 显示版本号 |
101
+
102
+ ### 快速开始
103
+
104
+ #### 1. 添加账户
105
+
106
+ 交互式添加第一个账户:
84
107
 
85
108
  ```bash
86
109
  ais add
87
110
  ```
88
111
 
89
- Or specify a name directly:
112
+ 或直接指定名称:
90
113
 
91
114
  ```bash
92
115
  ais add my-claude-account
93
116
  ```
94
117
 
95
- You'll be prompted to enter:
96
- - Account type (Claude, Codex, CCR, Droids, Other)
118
+ 系统将提示你输入:
119
+ - 账户类型(ClaudeCodexCCRDroids、其他)
97
120
  - API Key
98
- - API URL (optional)
99
- - Organization ID (optional)
100
- - Email (optional)
101
- - Description (optional)
102
- - Custom environment variables (optional)
103
- - Enter in `KEY=VALUE` format (e.g., `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1`)
104
- - The tool will display all added variables before completion
105
- - Press Enter without input to finish adding variables
121
+ - API URL(可选)
122
+ - Email(可选)
123
+ - 描述(可选)
124
+ - 自定义环境变量(可选)
125
+ - 使用 `KEY=VALUE` 格式输入(例如:`CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1`)
126
+ - 工具会在完成前显示所有已添加的变量
127
+ - 直接按回车(不输入)即可完成添加
106
128
 
107
- #### 2. List All Accounts
129
+ #### 2. 列出所有账户
108
130
 
109
- View all your configured accounts:
131
+ 查看所有已配置的账户:
110
132
 
111
133
  ```bash
112
134
  ais list
113
- # or
135
+ #
114
136
  ais ls
115
137
  ```
116
138
 
117
- The active account for the current project will be marked with a green dot.
139
+ 当前项目激活的账户将用绿色圆点标记。
118
140
 
119
- #### 3. Switch Account for Current Project
141
+ #### 3. 为当前项目切换账户
120
142
 
121
- Set which account to use in your current project:
143
+ 设置当前项目使用的账户:
122
144
 
123
145
  ```bash
124
146
  ais use my-claude-account
125
147
  ```
126
148
 
127
- Or select interactively:
149
+ 或交互式选择:
128
150
 
129
151
  ```bash
130
152
  ais use
131
153
  ```
132
154
 
133
- **Note:** This command automatically generates `.claude/settings.local.json` for Claude Code CLI integration.
134
- You can run this command from any subdirectory within your project - it will automatically find the project root.
155
+ **注意**:此命令会自动生成 `.claude/settings.local.json` 文件用于 Claude Code CLI 集成。
156
+ 如果检测到当前项目是 Git 仓库,还会自动将配置文件添加到 `.gitignore` 中,避免将敏感信息提交到版本控制。
157
+ 你可以在项目的任何子目录中运行此命令 - 它会自动找到项目根目录。
135
158
 
136
- #### 4. Check Current Project Info
159
+ #### 4. 查看当前项目信息
137
160
 
138
- See which account is active for your current project:
161
+ 查看当前项目激活的账户:
139
162
 
140
163
  ```bash
141
164
  ais info
142
165
  ```
143
166
 
144
- Or just show the account name:
167
+ 或仅显示账户名称:
145
168
 
146
169
  ```bash
147
170
  ais current
148
171
  ```
149
172
 
150
- **Note:** These commands work from any subdirectory within your project, similar to how git commands work.
173
+ **注意**:这些命令可以在项目的任何子目录中使用,类似 git 命令的工作方式。
174
+
175
+ #### 5. 使用 Web UI 管理界面
176
+
177
+ 启动可视化管理界面:
151
178
 
152
- #### 5. Remove an Account
179
+ ```bash
180
+ ais ui
181
+ ```
153
182
 
154
- Remove an account you no longer need:
183
+ 这将在浏览器中打开 Web UI,服务器会自动使用一个随机的高位端口(49152-65535)。如果端口被占用,会自动尝试其他端口,提供以下功能:
184
+
185
+ **界面特性:**
186
+ - **账号管理**: 可视化的卡片界面,显示所有账号信息
187
+ - **添加/编辑账号**: 友好的表单界面,支持所有配置项
188
+ - **删除账号**: 一键删除,带确认提示
189
+ - **搜索过滤**: 实时搜索账号名称、邮箱或类型
190
+ - **批量操作**:
191
+ - 导出所有账号为 JSON 文件
192
+ - 从 JSON 文件导入账号(支持覆盖选项)
193
+ - **主题切换**:
194
+ - iOS 风格的 Switch 开关
195
+ - 支持浅色和深色主题
196
+ - 默认跟随系统主题设置
197
+ - **多语言支持**:
198
+ - 中文/英文一键切换
199
+ - 界面默认使用中文
200
+ - 语言设置自动保存
201
+
202
+ **UI 使用提示:**
203
+ - 所有修改实时同步到本地配置
204
+ - 关闭浏览器窗口不影响数据
205
+ - 按 `Ctrl+C` 停止 Web 服务器
206
+ - 支持在任何浏览器中使用
207
+
208
+ #### 6. 删除账户
209
+
210
+ 删除不再需要的账户:
155
211
 
156
212
  ```bash
157
213
  ais remove old-account
158
- # or
214
+ #
159
215
  ais rm
160
216
  ```
161
217
 
162
- ### Advanced Usage
218
+ ### 高级用法
163
219
 
164
- #### Show Configuration Paths
220
+ #### 显示配置路径
165
221
 
166
- See where your configurations are stored:
222
+ 查看配置文件的存储位置:
167
223
 
168
224
  ```bash
169
225
  ais paths
170
226
  ```
171
227
 
172
- #### Export Account Configuration
228
+ #### 诊断配置问题
173
229
 
174
- Export an account's configuration as JSON:
230
+ 如果 Claude Code 使用了错误的账户,运行诊断:
231
+
232
+ ```bash
233
+ ais doctor
234
+ ```
235
+
236
+ 此命令会检查:
237
+ - 当前目录和项目根目录
238
+ - AIS 项目配置
239
+ - Claude Code 配置
240
+ - 全局 Claude 配置
241
+ - 提供解决建议
242
+
243
+ #### 导出账户配置
244
+
245
+ 以 JSON 格式导出账户配置:
175
246
 
176
247
  ```bash
177
248
  ais export my-claude-account
178
249
  ```
179
250
 
180
- ## Configuration
251
+ ## 配置
181
252
 
182
- ### Global Configuration
253
+ ### 全局配置
183
254
 
184
- All accounts are stored globally in your home directory:
255
+ 所有账户都存储在用户主目录的全局配置中:
185
256
 
186
257
  - **macOS/Linux**: `~/.ai-account-switch/config.json`
187
258
  - **Windows**: `%USERPROFILE%\.ai-account-switch\config.json`
188
259
 
189
- ### Project Configuration
260
+ ### 项目配置
190
261
 
191
- Each project stores its active account reference in:
262
+ 每个项目将其活动账户引用存储在:
192
263
 
193
264
  ```
194
265
  ./.ais-project-config
195
266
  ```
196
267
 
197
- This file is created automatically when you run `ais use` and should be added to `.gitignore`.
268
+ 此文件在运行 `ais use` 时自动创建,应添加到 `.gitignore` 中。
198
269
 
199
- ### Claude Code Integration
270
+ ### Claude Code 集成
200
271
 
201
- When you run `ais use`, the tool automatically creates `.claude/settings.local.json` with the following structure:
272
+ 运行 `ais use` 时,工具会自动创建 `.claude/settings.local.json`,结构如下:
202
273
 
203
274
  ```json
204
275
  {
205
276
  "env": {
206
277
  "ANTHROPIC_AUTH_TOKEN": "your-api-key",
207
278
  "ANTHROPIC_BASE_URL": "your-api-url",
208
- "ANTHROPIC_ORGANIZATION_ID": "your-org-id",
209
279
  "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1"
210
280
  },
211
281
  "permissions": {
@@ -216,15 +286,15 @@ When you run `ais use`, the tool automatically creates `.claude/settings.local.j
216
286
  }
217
287
  ```
218
288
 
219
- This ensures Claude Code CLI automatically uses the correct account for your project.
289
+ 这确保 Claude Code CLI 自动使用项目的正确账户。
220
290
 
221
- ### Codex Integration
291
+ ### Codex 集成
222
292
 
223
- When you add a **Codex** type account and run `ais use`, the tool automatically creates a profile in `~/.codex/config.toml` and a `.codex-profile` file in your project directory.
293
+ 当你添加 **Codex** 类型账户并运行 `ais use` 时,工具会自动在 `~/.codex/config.toml` 中创建 profile,并在项目目录中创建 `.codex-profile` 文件。
224
294
 
225
- #### Adding a Codex Account
295
+ #### 添加 Codex 账户
226
296
 
227
- When adding a Codex account, you'll see helpful configuration tips:
297
+ 添加 Codex 账户时,你会看到有用的配置提示:
228
298
 
229
299
  ```bash
230
300
  ais add my-codex-account
@@ -240,44 +310,44 @@ ais add my-codex-account
240
310
  ? Enter API URL (e.g., https://api.example.com or https://api.example.com/v1): https://zone.veloera.org
241
311
  ```
242
312
 
243
- **Important Notes:**
244
- - AIS automatically adds `/v1` to the API URL if it's missing
245
- - The configuration uses `wire_api = "chat"` (OpenAI-compatible format)
246
- - This prevents common issues like Cloudflare 400 errors
313
+ **重要说明:**
314
+ - AIS 会自动为 API URL 添加 `/v1` 路径(如果缺少)
315
+ - 配置使用 `wire_api = "chat"`(OpenAI 兼容格式)
316
+ - 这可以防止常见的 Cloudflare 400 错误
247
317
 
248
- #### Using Codex with Your Project
318
+ #### 在项目中使用 Codex
249
319
 
250
- After running `ais use` with a Codex account:
320
+ 使用 Codex 账户运行 `ais use` 后:
251
321
 
252
322
  ```bash
253
323
  cd ~/my-project
254
324
  ais use my-codex-account
255
325
 
256
- # Output:
326
+ # 输出:
257
327
  # ✓ Switched to account 'my-codex-account' for current project.
258
328
  # ✓ Codex profile created: ais_my-project
259
329
  # Use: codex --profile ais_my-project [prompt]
260
330
  ```
261
331
 
262
- The tool creates:
263
- 1. **Global Profile**: `~/.codex/config.toml` with your account configuration
264
- 2. **Project Reference**: `.codex-profile` containing the profile name
332
+ 工具会创建:
333
+ 1. **全局 Profile**:`~/.codex/config.toml` 包含你的账户配置
334
+ 2. **项目引用**:`.codex-profile` 包含 profile 名称
265
335
 
266
- #### Running Codex
336
+ #### 运行 Codex
267
337
 
268
- Use Codex with the generated profile:
338
+ 使用生成的 profile 运行 Codex:
269
339
 
270
340
  ```bash
271
- # In your project directory
341
+ # 在项目目录中
272
342
  codex --profile ais_my-project "your prompt here"
273
343
 
274
- # Or use the profile name from .codex-profile
344
+ # 或使用 .codex-profile 中的 profile 名称
275
345
  codex --profile $(cat .codex-profile) "your prompt"
276
346
  ```
277
347
 
278
- #### Codex Configuration Structure
348
+ #### Codex 配置结构
279
349
 
280
- The generated configuration in `~/.codex/config.toml`:
350
+ `~/.codex/config.toml` 中生成的配置:
281
351
 
282
352
  ```toml
283
353
  # AIS Profile for project: /path/to/your/project
@@ -291,61 +361,61 @@ wire_api = "chat"
291
361
  http_headers = { "Authorization" = "Bearer sk-xxx..." }
292
362
  ```
293
363
 
294
- #### Switching Between Projects
364
+ #### 在不同项目间切换
295
365
 
296
- Each project can use a different Codex account:
366
+ 每个项目可以使用不同的 Codex 账户:
297
367
 
298
368
  ```bash
299
- # Project A
369
+ # 项目 A
300
370
  cd ~/project-a
301
371
  ais use codex-account-1
302
372
  codex --profile ais_project-a "implement feature X"
303
373
 
304
- # Project B
374
+ # 项目 B
305
375
  cd ~/project-b
306
376
  ais use codex-account-2
307
377
  codex --profile ais_project-b "fix bug Y"
308
378
  ```
309
379
 
310
- #### Troubleshooting Codex
380
+ #### Codex 故障排除
311
381
 
312
- **Error: "duplicate key" in TOML**
313
- - This happens if profiles weren't cleaned up properly
314
- - Solution: Run `ais use <account>` again to regenerate the configuration
382
+ **错误:"duplicate key" in TOML**
383
+ - 这是因为 profile 没有正确清理
384
+ - 解决方案:再次运行 `ais use <account>` 重新生成配置
315
385
 
316
- **Error: "400 Bad Request" from Cloudflare**
317
- - This usually means the API URL is incorrect
318
- - Solution: Make sure your API URL includes `/v1` or let AIS add it automatically
319
- - Run `ais use <account>` to regenerate with the correct configuration
386
+ **错误:"400 Bad Request" from Cloudflare**
387
+ - 这通常意味着 API URL 不正确
388
+ - 解决方案:确保 API URL 包含 `/v1` 或让 AIS 自动添加
389
+ - 运行 `ais use <account>` 使用正确的配置重新生成
320
390
 
321
- **Check Codex Configuration**
391
+ **检查 Codex 配置**
322
392
  ```bash
323
- # View your Codex profile
393
+ # 查看你的 Codex profile
324
394
  cat .codex-profile
325
395
 
326
- # Check the configuration
396
+ # 检查配置
327
397
  grep -A 10 "$(cat .codex-profile)" ~/.codex/config.toml
328
398
 
329
- # Or use the doctor command
399
+ # 或使用 doctor 命令
330
400
  ais doctor
331
401
  ```
332
402
 
333
- ### CCR (Claude Code Router) Integration
403
+ ### CCR (Claude Code Router) 集成
334
404
 
335
- [Claude Code Router](https://github.com/musistudio/claude-code-router) is a powerful routing layer for Claude Code that allows you to use multiple AI providers and models seamlessly.
405
+ [Claude Code Router](https://github.com/musistudio/claude-code-router) 是一个强大的 Claude Code 路由层,允许你无缝使用多个 AI 提供商和模型。
336
406
 
337
- When you add a **CCR** type account and run `ais use`, the tool automatically:
338
- 1. Updates `~/.claude-code-router/config.json` with Provider and Router configuration
339
- 2. Generates `.claude/settings.local.json` pointing to the local CCR Router
340
- 3. Automatically restarts CCR Router to apply changes
407
+ 当你添加 **CCR** 类型账户并运行 `ais use` 时,工具会自动:
408
+ 1. 更新 `~/.claude-code-router/config.json` 中的 Provider Router 配置
409
+ 2. 生成指向本地 CCR Router 的 `.claude/settings.local.json`
410
+ 3. 自动重启 CCR Router 以应用更改
341
411
 
342
- **Prerequisites:**
343
- - Install Claude Code Router: `npm install -g @musistudio/claude-code-router`
344
- - Start CCR Router: `ccr start`
412
+ **前提条件:**
413
+ - 安装 Claude Code Router:`npm install -g @musistudio/claude-code-router`
414
+ - 启动 CCR Router:`ccr start`
345
415
 
346
- #### Adding a CCR Account
416
+ #### 添加 CCR 账户
347
417
 
348
- When adding a CCR account, you'll see helpful configuration tips:
418
+ 添加 CCR 账户时,你会看到有用的配置提示:
349
419
 
350
420
  ```bash
351
421
  ais add my-ccr-account
@@ -365,20 +435,20 @@ ais add my-ccr-account
365
435
  ? Enter think model: gemini-2.5-pro
366
436
  ```
367
437
 
368
- **Important Notes:**
369
- - Default API URL is `http://localhost:3000/v1/chat/completions`
370
- - You need to specify three models: default, background, and think
371
- - Models are automatically deduplicated in the Provider configuration
438
+ **重要说明:**
439
+ - 默认 API URL `http://localhost:3000/v1/chat/completions`
440
+ - 你需要指定三个模型:defaultbackground think
441
+ - 模型会在 Provider 配置中自动去重
372
442
 
373
- #### Using CCR with Your Project
443
+ #### 在项目中使用 CCR
374
444
 
375
- After running `ais use` with a CCR account:
445
+ 使用 CCR 账户运行 `ais use` 后:
376
446
 
377
447
  ```bash
378
448
  cd ~/my-project
379
449
  ais use my-ccr-account
380
450
 
381
- # Output:
451
+ # 输出:
382
452
  # ✓ Switched to account 'my-ccr-account' for current project.
383
453
  # 🔄 Restarting CCR Router...
384
454
  # ✓ CCR Router restarted successfully
@@ -391,27 +461,27 @@ ais use my-ccr-account
391
461
  # Claude Code will use CCR Router to route requests
392
462
  ```
393
463
 
394
- The tool:
395
- 1. **Updates CCR Config**: Adds/updates Provider in `~/.claude-code-router/config.json`
396
- 2. **Updates Router**: Sets default, background, and think models
397
- 3. **Generates Claude Config**: Creates `.claude/settings.local.json` with `ANTHROPIC_BASE_URL` pointing to CCR Router
398
- 4. **Restarts CCR**: Automatically runs `ccr restart` to apply changes
464
+ 工具会:
465
+ 1. **更新 CCR 配置**:在 `~/.claude-code-router/config.json` 中添加/更新 Provider
466
+ 2. **更新 Router**:设置 defaultbackground think 模型
467
+ 3. **生成 Claude 配置**:创建 `.claude/settings.local.json`,`ANTHROPIC_BASE_URL` 指向 CCR Router
468
+ 4. **重启 CCR**:自动运行 `ccr restart` 以应用更改
399
469
 
400
- #### Running Claude with CCR
470
+ #### 使用 CCR 运行 Claude
401
471
 
402
- Start Claude interactive session:
472
+ 启动 Claude 交互会话:
403
473
 
404
474
  ```bash
405
- # In your project directory
475
+ # 在项目目录中
406
476
  claude
407
477
 
408
- # Claude Code will automatically use CCR Router
409
- # Requests are routed based on your CCR configuration
478
+ # Claude Code 会自动使用 CCR Router
479
+ # 请求会根据你的 CCR 配置进行路由
410
480
  ```
411
481
 
412
- #### CCR Configuration Structure
482
+ #### CCR 配置结构
413
483
 
414
- The generated configuration in `~/.claude-code-router/config.json`:
484
+ `~/.claude-code-router/config.json` 中生成的配置:
415
485
 
416
486
  ```json
417
487
  {
@@ -432,7 +502,7 @@ The generated configuration in `~/.claude-code-router/config.json`:
432
502
  }
433
503
  ```
434
504
 
435
- The generated configuration in `.claude/settings.local.json`:
505
+ `.claude/settings.local.json` 中生成的配置:
436
506
 
437
507
  ```json
438
508
  {
@@ -443,57 +513,57 @@ The generated configuration in `.claude/settings.local.json`:
443
513
  }
444
514
  ```
445
515
 
446
- #### Switching Between Projects
516
+ #### 在不同项目间切换
447
517
 
448
- Each project can use a different CCR configuration:
518
+ 每个项目可以使用不同的 CCR 配置:
449
519
 
450
520
  ```bash
451
- # Project A
521
+ # 项目 A
452
522
  cd ~/project-a
453
523
  ais use ccr-account-1
454
524
  claude
455
525
 
456
- # Project B
526
+ # 项目 B
457
527
  cd ~/project-b
458
528
  ais use ccr-account-2
459
529
  claude
460
530
  ```
461
531
 
462
- #### Troubleshooting CCR
532
+ #### CCR 故障排除
463
533
 
464
- **Check CCR Configuration**
534
+ **检查 CCR 配置**
465
535
  ```bash
466
- # View your CCR configuration
536
+ # 查看你的 CCR 配置
467
537
  cat ~/.claude-code-router/config.json
468
538
 
469
- # View Claude configuration
539
+ # 查看 Claude 配置
470
540
  cat .claude/settings.local.json
471
541
 
472
- # Or use the doctor command
542
+ # 或使用 doctor 命令
473
543
  ais doctor
474
544
  ```
475
545
 
476
- **CCR Router not installed**
477
- - Install from npm: `npm install -g @musistudio/claude-code-router`
478
- - Visit the project page: https://github.com/musistudio/claude-code-router
546
+ **CCR Router 未安装**
547
+ - npm 安装:`npm install -g @musistudio/claude-code-router`
548
+ - 访问项目页面:https://github.com/musistudio/claude-code-router
479
549
 
480
- **CCR Router not restarting**
481
- - Make sure CCR CLI is installed and available in your PATH
482
- - Run `ccr restart` manually if automatic restart fails
483
- - Check if CCR Router is running: `ccr status`
550
+ **CCR Router 未重启**
551
+ - 确保 CCR CLI 已安装并在 PATH 中可用
552
+ - 如果自动重启失败,手动运行 `ccr restart`
553
+ - 检查 CCR Router 是否运行:`ccr status`
484
554
 
485
- **Claude not using CCR Router**
486
- - Verify `ANTHROPIC_BASE_URL` in `.claude/settings.local.json` points to correct port
487
- - Check CCR Router is running on the configured port
488
- - Restart Claude Code after configuration changes
555
+ **Claude 未使用 CCR Router**
556
+ - 验证 `.claude/settings.local.json` 中的 `ANTHROPIC_BASE_URL` 指向正确的端口
557
+ - 检查 CCR Router 是否在配置的端口上运行
558
+ - 配置更改后重启 Claude Code
489
559
 
490
- ### Droids Integration
560
+ ### Droids 集成
491
561
 
492
- When you add a **Droids** type account and run `ais use`, the tool automatically creates a configuration file at `.droids/config.json` in your project directory.
562
+ 当你添加 **Droids** 类型账户并运行 `ais use` 时,工具会自动在项目目录中创建 `.droids/config.json` 配置文件。
493
563
 
494
- #### Adding a Droids Account
564
+ #### 添加 Droids 账户
495
565
 
496
- When adding a Droids account, you'll see helpful configuration tips:
566
+ 添加 Droids 账户时,你会看到有用的配置提示:
497
567
 
498
568
  ```bash
499
569
  ais add my-droids-account
@@ -511,15 +581,15 @@ ais add my-droids-account
511
581
  ? Enter model name: droids-model-v1
512
582
  ```
513
583
 
514
- #### Using Droids with Your Project
584
+ #### 在项目中使用 Droids
515
585
 
516
- After running `ais use` with a Droids account:
586
+ 使用 Droids 账户运行 `ais use` 后:
517
587
 
518
588
  ```bash
519
589
  cd ~/my-project
520
590
  ais use my-droids-account
521
591
 
522
- # Output:
592
+ # 输出:
523
593
  # ✓ Switched to account 'my-droids-account' for current project.
524
594
  # ✓ Droids configuration generated at: .droids/config.json
525
595
  #
@@ -529,23 +599,23 @@ ais use my-droids-account
529
599
  # Droids will automatically use the configuration from .droids/config.json
530
600
  ```
531
601
 
532
- The tool creates:
533
- - **Project Configuration**: `.droids/config.json` with your account settings
602
+ 工具会创建:
603
+ - **项目配置**:`.droids/config.json` 包含你的账户设置
534
604
 
535
- #### Running Droids
605
+ #### 运行 Droids
536
606
 
537
- Start Droids interactive session:
607
+ 启动 Droids 交互会话:
538
608
 
539
609
  ```bash
540
- # In your project directory
610
+ # 在项目目录中
541
611
  droid
542
612
 
543
- # Droids will automatically load configuration from .droids/config.json
613
+ # Droids 会自动从 .droids/config.json 加载配置
544
614
  ```
545
615
 
546
- #### Droids Configuration Structure
616
+ #### Droids 配置结构
547
617
 
548
- The generated configuration in `.droids/config.json`:
618
+ `.droids/config.json` 中生成的配置:
549
619
 
550
620
  ```json
551
621
  {
@@ -558,42 +628,42 @@ The generated configuration in `.droids/config.json`:
558
628
  }
559
629
  ```
560
630
 
561
- #### Switching Between Projects
631
+ #### 在不同项目间切换
562
632
 
563
- Each project can use a different Droids account:
633
+ 每个项目可以使用不同的 Droids 账户:
564
634
 
565
635
  ```bash
566
- # Project A
636
+ # 项目 A
567
637
  cd ~/project-a
568
638
  ais use droids-account-1
569
639
  droid
570
640
 
571
- # Project B
641
+ # 项目 B
572
642
  cd ~/project-b
573
643
  ais use droids-account-2
574
644
  droid
575
645
  ```
576
646
 
577
- #### Troubleshooting Droids
647
+ #### Droids 故障排除
578
648
 
579
- **Check Droids Configuration**
649
+ **检查 Droids 配置**
580
650
  ```bash
581
- # View your Droids configuration
651
+ # 查看你的 Droids 配置
582
652
  cat .droids/config.json
583
653
 
584
- # Or use the doctor command
654
+ # 或使用 doctor 命令
585
655
  ais doctor
586
656
  ```
587
657
 
588
- **Droids CLI not found**
589
- - Make sure Droids CLI is installed and available in your PATH
590
- - Run `droid --version` to verify installation
658
+ **Droids CLI 未找到**
659
+ - 确保 Droids CLI 已安装并在 PATH 中可用
660
+ - 运行 `droid --version` 验证安装
591
661
 
592
- #### Custom Environment Variables
662
+ #### 自定义环境变量
593
663
 
594
- You can add custom environment variables when creating an account. When prompted, enter them in `KEY=VALUE` format:
664
+ 在创建账户时可以添加自定义环境变量。在提示时,使用 `KEY=VALUE` 格式输入:
595
665
 
596
- **Input Format:**
666
+ **输入格式:**
597
667
  ```
598
668
  ? Environment variable (KEY=VALUE format): CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1
599
669
  ✓ Added: CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1
@@ -604,350 +674,519 @@ You can add custom environment variables when creating an account. When prompted
604
674
  ? Add another environment variable? (y/N)
605
675
  ```
606
676
 
607
- **Common Examples:**
608
- - `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1` - Disable non-essential network traffic
609
- - `HTTP_PROXY=http://proxy.example.com:8080` - Set HTTP proxy
610
- - `HTTPS_PROXY=https://proxy.example.com:8080` - Set HTTPS proxy
611
- - Any other environment variables needed for your setup
677
+ **常见示例:**
678
+ - `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1` - 禁用非必要网络流量
679
+ - `HTTP_PROXY=http://proxy.example.com:8080` - 设置 HTTP 代理
680
+ - `HTTPS_PROXY=https://proxy.example.com:8080` - 设置 HTTPS 代理
681
+ - 其他你需要的环境变量
612
682
 
613
- **Features:**
614
- - One-line input format (`KEY=VALUE`)
615
- - Real-time display of added variables
616
- - Press Enter without input to finish
617
- - Variables are automatically included in `.claude/settings.local.json`
683
+ **功能特性:**
684
+ - 单行输入格式(`KEY=VALUE`)
685
+ - 实时显示已添加的变量
686
+ - 直接按回车即可完成
687
+ - 变量会自动包含在 `.claude/settings.local.json` 文件中
618
688
 
619
- ## Examples
689
+ ## 使用示例
620
690
 
621
- ### Example 1: Setting Up Multiple Accounts
691
+ ### 示例 1:设置多个账户
622
692
 
623
693
  ```bash
624
- # Add your personal Claude account
694
+ # 添加个人 Claude 账户
625
695
  ais add personal-claude
626
696
 
627
- # Add your work Claude account
697
+ # 添加工作 Claude 账户
628
698
  ais add work-claude
629
699
 
630
- # Add a Codex account
700
+ # 添加 Codex 账户
631
701
  ais add codex-dev
632
702
 
633
- # Add a Droids account
703
+ # 添加 Droids 账户
634
704
  ais add droids-dev
635
705
 
636
- # List all accounts
706
+ # 列出所有账户
637
707
  ais list
638
708
  ```
639
709
 
640
- ### Example 2: Using Different Accounts for Different Projects
710
+ ### 示例 2:为不同项目使用不同账户
641
711
 
642
712
  ```bash
643
- # In your personal project
713
+ # 在个人项目中
644
714
  cd ~/my-personal-project
645
715
  ais use personal-claude
646
716
 
647
- # In your work project
717
+ # 在工作项目中
648
718
  cd ~/work/company-project
649
719
  ais use work-claude
650
720
 
651
- # Check what's active
721
+ # 检查激活的账户
652
722
  ais info
653
723
  ```
654
724
 
655
- ### Example 3: Managing Accounts
725
+ ### 示例 3:管理账户
656
726
 
657
727
  ```bash
658
- # View all accounts
728
+ # 查看所有账户
659
729
  ais list
660
730
 
661
- # Check current account
731
+ # 检查当前账户
662
732
  ais current
663
733
 
664
- # Export an account config
734
+ # 导出账户配置
665
735
  ais export personal-claude
666
736
 
667
- # Remove old accounts
737
+ # 删除旧账户
668
738
  ais remove old-account
669
739
 
670
- # View config locations
740
+ # 查看配置位置
671
741
  ais paths
672
742
  ```
673
743
 
674
- ## Security Notes
744
+ ### 示例 4:诊断问题
675
745
 
676
- - API keys are stored locally on your machine only
677
- - The global configuration file contains sensitive credentials
678
- - Always add `.ais-project-config` to your `.gitignore`
679
- - Never commit account credentials to version control
680
- - API keys are masked when displayed (shows first and last 4 characters only)
746
+ ```bash
747
+ # 如果 Claude Code 使用了错误的账户
748
+ cd ~/your-project
749
+ ais doctor
681
750
 
682
- ## Platform Compatibility
751
+ # 根据诊断建议操作
752
+ # 然后重新设置账户
753
+ ais use correct-account
754
+ ```
683
755
 
684
- | Platform | Status | Notes |
685
- |----------|--------|-------|
686
- | macOS | ✅ Fully Supported | Tested on macOS 10.15+ |
687
- | Linux | ✅ Fully Supported | Tested on Ubuntu 20.04+ |
688
- | Windows | ✅ Fully Supported | Tested on Windows 10+ |
756
+ ## 安全注意事项
689
757
 
690
- ## Requirements
758
+ - API 密钥仅存储在本地机器上
759
+ - 全局配置文件包含敏感凭证
760
+ - `ais use` 命令会自动将配置文件添加到 `.gitignore` (如果项目是 Git 仓库)
761
+ - 始终验证 `.gitignore` 包含以下文件:
762
+ - `.ais-project-config`
763
+ - `.claude/settings.local.json`
764
+ - 切勿将账户凭证提交到版本控制
765
+ - 显示 API 密钥时会进行掩码处理(仅显示前 4 位和后 4 位字符)
766
+
767
+ ## 平台兼容性
768
+
769
+ | 平台 | 状态 | 备注 |
770
+ |------|------|------|
771
+ | macOS | ✅ 完全支持 | 已在 macOS 10.15+ 上测试 |
772
+ | Linux | ✅ 完全支持 | 已在 Ubuntu 20.04+ 上测试 |
773
+ | Windows | ✅ 完全支持 | 已在 Windows 10+ 上测试 |
774
+
775
+ ## 系统要求
691
776
 
692
777
  - **Node.js**: >= 16.0.0
693
778
  - **npm**: >= 7.0.0
694
779
 
695
- **Note**: This tool requires Node.js version 16 or higher (due to commander@11.x dependency). You can check your current version with:
780
+ **注意**: 此工具需要 Node.js 16 或更高版本(因为 commander@11.x 依赖要求)。你可以使用以下命令检查当前版本:
696
781
  ```bash
697
782
  node --version
698
783
  npm --version
699
784
  ```
700
785
 
701
- If you need to upgrade Node.js, visit [nodejs.org](https://nodejs.org/) or use a version manager like [nvm](https://github.com/nvm-sh/nvm).
786
+ 如果需要升级 Node.js,请访问 [nodejs.org](https://nodejs.org/) 或使用版本管理器如 [nvm](https://github.com/nvm-sh/nvm)
702
787
 
703
- ## Project Structure
788
+ ## 项目结构
704
789
 
705
790
  ```
706
791
  ai-agent-user-swith/
707
792
  ├── bin/
708
- │ └── ais.js # Executable entry point
793
+ │ └── ais.js # 可执行入口点
709
794
  ├── src/
710
- │ ├── index.js # Main CLI program
711
- │ ├── commands.js # Command implementations
712
- │ └── config.js # Configuration manager
795
+ │ ├── index.js # CLI 程序
796
+ │ ├── commands.js # 命令实现
797
+ │ └── config.js # 配置管理器
798
+ ├── .github/
799
+ │ └── workflows/
800
+ │ └── release.yml # GitHub Actions 自动发布
713
801
  ├── package.json
714
802
  ├── .gitignore
715
- └── README.md
803
+ ├── .npmignore
804
+ ├── README.md # 英文文档
805
+ ├── README_ZH.md # 中文文档
806
+ ├── NPM_PUBLISH.md # npm 发布指南
807
+ └── RELEASE.md # 发布指南
716
808
  ```
717
809
 
718
- ## Troubleshooting
810
+ ## 故障排除
719
811
 
720
- ### Command not found: ais
812
+ ### 命令未找到:ais
721
813
 
722
- If you get this error after installation, make sure you've linked the package:
814
+ 如果安装后出现此错误,确保已链接包:
723
815
 
724
816
  ```bash
725
817
  npm link
726
818
  ```
727
819
 
728
- ### Permission denied
820
+ ### 权限被拒绝
729
821
 
730
- On Unix systems, ensure the bin file is executable:
822
+ Unix 系统上,确保 bin 文件可执行:
731
823
 
732
824
  ```bash
733
825
  chmod +x bin/ais.js
734
826
  ```
735
827
 
736
- ### No accounts found
828
+ ### 未找到账户
737
829
 
738
- Make sure you've added at least one account:
830
+ 确保你已添加至少一个账户:
739
831
 
740
832
  ```bash
741
833
  ais add
742
834
  ```
743
835
 
744
- ### Claude Code uses wrong account
836
+ ### Claude Code 使用了错误的账户
745
837
 
746
- If Claude Code is using a different account than expected:
838
+ 如果 Claude Code 使用了非预期的账户:
747
839
 
748
- 1. Run diagnostics:
840
+ 1. 运行诊断:
749
841
  ```bash
750
842
  ais doctor
751
843
  ```
752
844
 
753
- 2. Check if global Claude config is overriding project config:
754
- - If `~/.claude/settings.json` contains `env.ANTHROPIC_AUTH_TOKEN`, it may conflict
755
- - **Solution**: Remove the `env` section from global config, or only keep `permissions`
845
+ 2. 检查全局 Claude 配置是否覆盖了项目配置:
846
+ - 如果 `~/.claude/settings.json` 包含 `env.ANTHROPIC_AUTH_TOKEN`,可能会冲突
847
+ - **解决方案**:从全局配置中删除 `env` 部分,或仅保留 `permissions`
756
848
 
757
- 3. Ensure you're starting Claude Code from your project directory or subdirectory
849
+ 3. 确保从项目目录或子目录启动 Claude Code
758
850
 
759
- 4. Regenerate project config:
851
+ 4. 重新生成项目配置:
760
852
  ```bash
761
- ais use <your-account-name>
853
+ ais use <你的账户名>
762
854
  ```
763
855
 
764
- ### Project config not found in subdirectory
856
+ ### 在子目录中未找到项目配置
765
857
 
766
- The tool should work in any subdirectory. If it doesn't:
858
+ 工具应该在任何子目录中工作。如果不行:
767
859
 
768
860
  ```bash
769
- # Make sure you're within a configured project
861
+ # 确保你在已配置的项目中
770
862
  cd /path/to/your/project
771
863
  ais use <account>
772
864
 
773
- # Then try from subdirectory
865
+ # 然后从子目录尝试
774
866
  cd src/
775
- ais current # Should show your account
867
+ ais current # 应该显示你的账户
776
868
  ```
777
869
 
778
- ## Contributing
870
+ ### MCP (Model Context Protocol) 集成
871
+
872
+ AIS 支持全局管理 MCP 服务器并按项目启用。MCP 服务器为 Claude Code 扩展额外的工具和功能。
779
873
 
780
- Contributions are welcome! Feel free to:
781
- - Report bugs
782
- - Suggest new features
783
- - Submit pull requests
874
+ 你可以通过 **CLI 命令**和 **Web UI** 两种方式管理 MCP 服务器。
784
875
 
785
- ## License
876
+ #### Web UI 管理(推荐)
786
877
 
787
- MIT License - feel free to use this tool in your projects!
878
+ 管理 MCP 服务器最简单的方式是通过 Web UI:
879
+
880
+ ```bash
881
+ ais ui
882
+ ```
883
+
884
+ 然后点击 **"MCP 服务器"** 标签页:
885
+
886
+ **功能:**
887
+ - ✅ **添加 MCP 服务器**:点击"+ 添加 MCP 服务器"添加新服务器
888
+ - 选择服务器类型:stdio、sse 或 http
889
+ - 填写配置(命令、URL、环境变量等)
890
+ - 添加描述便于识别
891
+ - ✅ **编辑服务器**:点击"编辑"修改现有服务器配置
892
+ - ✅ **测试连接**:点击"测试连接"验证服务器可用性
893
+ - ✅ **启用/禁用**:一键切换当前项目的服务器状态
894
+ - ✅ **搜索和筛选**:快速按名称或类型查找服务器
895
+ - ✅ **删除服务器**:删除不再需要的服务器
896
+ - ✅ **同步配置**:点击"同步配置"同步到 Claude Code
897
+
898
+ **优势:**
899
+ - 直观的可视化界面
900
+ - 实时验证
901
+ - 无需记忆命令语法
902
+ - 一目了然查看所有服务器
903
+ - 状态指示器(已启用/未启用)
904
+ - 支持中英文
905
+
906
+ **示例工作流程:**
907
+ 1. 启动 Web UI:`ais ui`
908
+ 2. 点击"MCP 服务器"标签页
909
+ 3. 点击"+ 添加 MCP 服务器"
910
+ 4. 选择类型:"stdio"
911
+ 5. 输入命令:"npx"
912
+ 6. 输入参数:"@modelcontextprotocol/server-filesystem,/path"
913
+ 7. 点击"保存"
914
+ 8. 点击"测试连接"验证
915
+ 9. 点击"启用"为当前项目启用
916
+
917
+ #### CLI 管理
918
+
919
+ 你也可以通过 CLI 命令管理 MCP 服务器:
920
+
921
+ ##### 添加 MCP 服务器
922
+
923
+ 交互式添加新的 MCP 服务器:
924
+
925
+ ```bash
926
+ ais mcp add filesystem
927
+ ```
928
+
929
+ 你将被提示配置:
930
+ - **服务器类型**:stdio、sse 或 http
931
+ - **命令和参数**(stdio 类型)
932
+ - **URL**(sse/http 类型)
933
+ - **环境变量**(可选)
934
+ - **请求头**(sse/http 可选)
935
+ - **描述**(可选)
936
+
937
+ **示例:添加 stdio MCP 服务器**
938
+ ```bash
939
+ $ ais mcp add filesystem
940
+ ? 选择 MCP 服务器类型: stdio
941
+ ? 输入命令: npx
942
+ ? 输入参数(逗号分隔): @modelcontextprotocol/server-filesystem,/Users/user/workspace
943
+ ? 添加环境变量? 是
944
+ ? 环境变量 (KEY=VALUE): ALLOWED_PATHS=/Users/user/workspace
945
+ ? 添加另一个? 否
946
+ ? 输入描述: 文件系统访问 MCP 服务器
947
+ ✓ MCP 服务器 'filesystem' 添加成功!
948
+ ```
949
+
950
+ ##### 列出 MCP 服务器
951
+
952
+ 查看所有配置的 MCP 服务器:
953
+
954
+ ```bash
955
+ ais mcp list
956
+ ```
957
+
958
+ 输出显示服务器名称、类型、启用状态和描述。
959
+
960
+ ##### 为项目启用 MCP 服务器
961
+
962
+ 为当前项目启用 MCP 服务器:
963
+
964
+ ```bash
965
+ cd ~/my-project
966
+ ais mcp enable filesystem
967
+ ```
968
+
969
+ 这将:
970
+ 1. 将服务器添加到项目的启用列表
971
+ 2. 更新 `.claude/settings.local.json` 的 MCP 配置
972
+ 3. 使 MCP 服务器在此项目中对 Claude Code 可用
973
+
974
+ ##### 管理 MCP 服务器
975
+
976
+ ```bash
977
+ # 显示 MCP 服务器详情
978
+ ais mcp show filesystem
979
+
980
+ # 更新 MCP 服务器配置
981
+ ais mcp update filesystem
982
+
983
+ # 为当前项目禁用 MCP 服务器
984
+ ais mcp disable filesystem
985
+
986
+ # 显示当前项目已启用的 MCP 服务器
987
+ ais mcp enabled
988
+
989
+ # 同步 MCP 配置到 Claude Code
990
+ ais mcp sync
991
+
992
+ # 删除 MCP 服务器
993
+ ais mcp remove filesystem
994
+ ```
788
995
 
789
- ## Changelog
996
+ ## 贡献
997
+
998
+ 欢迎贡献!你可以:
999
+ - 报告 bug
1000
+ - 建议新功能
1001
+ - 提交 pull request
1002
+
1003
+ ## 许可证
1004
+
1005
+ MIT License - 欢迎在你的项目中使用此工具!
1006
+
1007
+ ## 更新日志
1008
+
1009
+ ### v1.7.0
1010
+ - **MCP Web UI 管理**:
1011
+ - 通过 Web UI 完整管理 MCP 服务器
1012
+ - 标签页导航系统(账号管理 / MCP 服务器)
1013
+ - 直观界面添加、编辑、删除 MCP 服务器
1014
+ - 测试 MCP 服务器连接
1015
+ - 一键启用/禁用项目级服务器
1016
+ - 搜索和筛选功能
1017
+ - 实时验证和状态指示器
1018
+ - 完整的中英文支持
1019
+ - **MCP CLI 集成**:
1020
+ - 使用 `ais mcp` 命令全局管理 MCP 服务器
1021
+ - 项目级 MCP 服务器启用/禁用功能
1022
+ - 支持 stdio、sse 和 http MCP 服务器类型
1023
+ - 自动生成 Claude Code 的 MCP 配置
1024
+ - 命令:`ais mcp add`、`ais mcp list`、`ais mcp show`、`ais mcp update`、`ais mcp remove`
1025
+ - 项目命令:`ais mcp enable`、`ais mcp disable`、`ais mcp enabled`、`ais mcp sync`
1026
+ - 交互式 MCP 服务器配置,带验证
1027
+ - 支持 MCP 服务器的环境变量和请求头
1028
+ - **Bug 修复**:
1029
+ - 修复添加标签页后账号数据不显示的问题
1030
+ - 修复 "switchTab is not defined" 错误
1031
+ - 修复搜索结果提示信息不正确的问题
1032
+ - **改进**:
1033
+ - 更好的用户体验,提示信息更清晰
1034
+ - 现代 JavaScript 实践(事件监听器)
1035
+ - 改进代码质量和可维护性
1036
+ - 32 个自动化测试全部通过
790
1037
 
791
1038
  ### v1.6.0
792
- - **CCR (Claude Code Router) Integration**:
793
- - Added full support for Claude Code Router
794
- - Automatic generation of `~/.claude-code-router/config.json` configuration
795
- - Provider and Router configuration management
796
- - Automatic CCR Router restart after configuration changes
797
- - Claude Code integration with local CCR Router endpoint
798
- - Support for default, background, and think model routing
799
- - **Web UI Enhancements**:
800
- - Added account status checking with color-coded indicators (green: available, orange: unstable, red: unavailable)
801
- - Status results are saved and displayed on page load
802
- - Real-time status checking with "状态检查" button
803
- - Improved account card layout with status in top-right corner
804
- - Enhanced visual feedback during status checks
805
- - **Configuration Improvements**:
806
- - CCR accounts automatically generate both CCR and Claude configurations
807
- - Dynamic port reading from CCR config for Claude integration
808
- - Better error handling and user feedback
809
-
810
- ### v1.5.8
811
- - **Bilingual Support (双语支持)**:
812
- - All CLI commands now display both English and Chinese text (所有 CLI 命令现在同时显示中英文)
813
- - Help messages, prompts, and output messages are bilingual (帮助信息、提示和输出消息都支持双语)
814
- - Better user experience for Chinese-speaking users (为中文用户提供更好的使用体验)
815
- - No configuration needed - works out of the box (无需配置 - 开箱即用)
816
- - Uses parentheses format for better clarity: `English text (中文)` (使用括号格式更清晰)
1039
+ - **CCR (Claude Code Router) 集成**:
1040
+ - 完整支持 Claude Code Router
1041
+ - 自动生成 `~/.claude-code-router/config.json` 配置
1042
+ - Provider Router 配置管理
1043
+ - 配置更改后自动重启 CCR Router
1044
+ - Claude Code 与本地 CCR Router 端点集成
1045
+ - 支持 defaultbackground think 模型路由
1046
+ - **Web UI 增强**:
1047
+ - 添加账户状态检查,带颜色指示器(绿色:可用,橙色:不稳定,红色:不可用)
1048
+ - 状态结果会保存并在页面加载时显示
1049
+ - 实时状态检查,带"状态检查"按钮
1050
+ - 改进账户卡片布局,状态显示在右上角
1051
+ - 状态检查期间增强视觉反馈
1052
+ - **配置改进**:
1053
+ - CCR 账户自动生成 CCR Claude 两种配置
1054
+ - CCR 配置动态读取端口用于 Claude 集成
1055
+ - 更好的错误处理和用户反馈
817
1056
 
818
1057
  ### v1.5.7
819
- - **Droids Integration**:
820
- - Added full support for Droids AI assistant
821
- - Automatic generation of `.droids/config.json` configuration
822
- - Simple model configuration for Droids accounts
823
- - Interactive session command: `droid`
824
- - Enhanced `ais doctor` command with Droids configuration detection
825
- - **UI Enhancements**:
826
- - Added type filter dropdown for quick account filtering
827
- - Color-coded account cards by type (Claude: blue, Codex: purple, Droids: green, Other: orange)
828
- - Left border color indicators on account cards
829
- - Improved visual hierarchy and user experience
830
- - **Model Configuration Improvements**:
831
- - Separated model configuration for different account types
832
- - Claude: Complex model groups with multiple model settings
833
- - Codex/Droids: Simple model field for straightforward configuration
834
- - All model settings moved to collapsible "Advanced Configuration" section
835
- - **Better User Guidance**:
836
- - Enhanced `ais use` command with clear next-step instructions
837
- - Type-specific usage examples for each AI assistant
838
- - Interactive mode prompts instead of one-time command examples
1058
+ - **Droids 集成**:
1059
+ - 完整支持 Droids AI 助手
1060
+ - 自动生成 `.droids/config.json` 配置文件
1061
+ - Droids 账户的简单模型配置
1062
+ - 交互会话命令:`droid`
1063
+ - 增强 `ais doctor` 命令,支持 Droids 配置检测
1064
+ - **UI 增强**:
1065
+ - 添加类型筛选下拉框,快速过滤账户
1066
+ - 按类型为账户卡片着色(Claude: 蓝色,Codex: 紫色,Droids: 绿色,Other: 橙色)
1067
+ - 账户卡片左侧边框颜色指示器
1068
+ - 改进视觉层次和用户体验
1069
+ - **模型配置改进**:
1070
+ - 为不同账户类型分离模型配置
1071
+ - Claude: 复杂的模型组,支持多个模型设置
1072
+ - Codex/Droids: 简单的模型字段,配置更直观
1073
+ - 所有模型设置移至可折叠的"高级配置"区域
1074
+ - **更好的用户指引**:
1075
+ - 增强 `ais use` 命令,提供清晰的下一步操作说明
1076
+ - 为每个 AI 助手提供特定类型的使用示例
1077
+ - 交互模式提示而非一次性命令示例
839
1078
 
840
1079
  ### v1.5.1
841
- - **Codex Integration Enhancements**:
842
- - Added full support for Codex CLI with profile-based configuration
843
- - Automatic generation of `~/.codex/config.toml` profiles for Codex accounts
844
- - Project-level `.codex-profile` file for easy profile reference
845
- - Smart API URL handling: automatically adds `/v1` path if missing
846
- - Uses OpenAI-compatible `wire_api = "chat"` format
847
- - Prevents Cloudflare 400 errors with correct configuration
848
- - **Improved User Experience**:
849
- - Configuration tips displayed when adding Codex accounts
850
- - Usage instructions shown after account creation
851
- - Enhanced `ais doctor` command with Codex configuration detection
852
- - Better duplicate profile cleanup in TOML files
853
- - **Bug Fixes**:
854
- - Fixed duplicate profile key errors in Codex configuration
855
- - Improved profile deletion regex patterns
856
- - Separated Claude and Codex configuration generation logic
857
- - **Documentation**:
858
- - Comprehensive Codex integration guide in README
859
- - Troubleshooting section for common Codex issues
860
- - Examples for multi-project Codex usage
1080
+ - **Codex 集成增强**:
1081
+ - 完整支持 Codex CLI profile 配置
1082
+ - 自动为 Codex 账户生成 `~/.codex/config.toml` profiles
1083
+ - 项目级 `.codex-profile` 文件方便引用 profile
1084
+ - 智能 API URL 处理:自动添加 `/v1` 路径(如果缺少)
1085
+ - 使用 OpenAI 兼容的 `wire_api = "chat"` 格式
1086
+ - 通过正确配置防止 Cloudflare 400 错误
1087
+ - **用户体验改进**:
1088
+ - 添加 Codex 账户时显示配置提示
1089
+ - 账户创建后显示使用说明
1090
+ - 增强 `ais doctor` 命令,支持 Codex 配置检测
1091
+ - 改进 TOML 文件中的重复 profile 清理
1092
+ - **Bug 修复**:
1093
+ - 修复 Codex 配置中的重复 profile key 错误
1094
+ - 改进 profile 删除的正则表达式模式
1095
+ - 分离 Claude Codex 配置生成逻辑
1096
+ - **文档更新**:
1097
+ - README 中添加全面的 Codex 集成指南
1098
+ - 常见 Codex 问题的故障排除部分
1099
+ - 多项目 Codex 使用示例
861
1100
 
862
1101
  ### v1.5.0
863
- - **Model Groups Management System**:
864
- - Refactored model configuration to use flexible Model Groups
865
- - Each account can have multiple model groups with different configurations
866
- - Quick switching between model groups with automatic Claude config updates
867
- - **New CLI Commands**:
868
- - `ais model list/ls` - List all model groups for current account
869
- - `ais model add [name]` - Create a new model group
870
- - `ais model use <name>` - Switch to a different model group
871
- - `ais model remove/rm [name]` - Remove a model group
872
- - `ais model show [name]` - Show model group configuration
873
- - **Enhancements**:
874
- - Enhanced account creation workflow with model group support
875
- - Web UI updated with collapsible model group management
876
- - Fixed model configuration not switching when changing accounts
877
- - Better color consistency in CLI output
878
- - DEFAULT_MODEL auto-fills other model configs when not specified
879
- - **Backward Compatibility**:
880
- - Maintains support for old modelConfig structure
881
- - Existing accounts continue to work without migration
1102
+ - **模型组管理系统**:
1103
+ - 重构模型配置为灵活的模型组(Model Groups)系统
1104
+ - 每个账户可以拥有多个不同配置的模型组
1105
+ - 快速切换模型组,自动更新 Claude 配置
1106
+ - **新增 CLI 命令**:
1107
+ - `ais model list/ls` - 列出当前账户的所有模型组
1108
+ - `ais model add [name]` - 创建新的模型组
1109
+ - `ais model use <name>` - 切换到不同的模型组
1110
+ - `ais model remove/rm [name]` - 删除模型组
1111
+ - `ais model show [name]` - 显示模型组配置详情
1112
+ - **功能增强**:
1113
+ - 增强账户创建流程,支持模型组配置
1114
+ - Web UI 更新,支持可折叠的模型组管理界面
1115
+ - 修复切换账户时模型配置不更新的问题
1116
+ - 优化 CLI 输出颜色一致性
1117
+ - DEFAULT_MODEL 自动填充其他未设置的模型配置
1118
+ - **向后兼容**:
1119
+ - 保持对旧 modelConfig 结构的支持
1120
+ - 现有账户无需迁移即可继续使用
882
1121
 
883
1122
  ### v1.4.0
884
- - **Added Web UI Management Interface**:
885
- - Modern single-page application with dark/light theme support
886
- - Bilingual support (English/Chinese), default English
887
- - Visual account management: CRUD operations at a glance
888
- - Import/Export functionality: batch manage account configurations
889
- - Real-time search and filter accounts
890
- - Custom environment variables configuration
891
- - Theme follows system settings automatically
892
- - iOS-style theme toggle switch
893
- - **Port Optimization**:
894
- - UI server uses random high ports (49152-65535)
895
- - Automatic port conflict detection and retry
896
- - **UI Improvements**:
897
- - Fixed inconsistent button positioning in account cards
898
- - Buttons now consistently fixed at card bottom
899
- - **Removed Organization ID**:
900
- - Simplified account configuration process
901
- - Removed organization ID option from CLI and UI
1123
+ - **添加 Web UI 管理界面**:
1124
+ - 现代化单页面应用,支持深色/浅色主题
1125
+ - 中英文双语支持,默认中文
1126
+ - 可视化账号管理:增删改查一目了然
1127
+ - 导入/导出功能:批量管理账号配置
1128
+ - 实时搜索过滤账号
1129
+ - 自定义环境变量配置
1130
+ - 主题自动跟随系统设置
1131
+ - iOS 风格的主题切换开关
1132
+ - **端口优化**:
1133
+ - UI 服务器使用随机高位端口(49152-65535
1134
+ - 自动检测端口冲突并重试
1135
+ - **界面改进**:
1136
+ - 修复账号卡片按钮位置不一致问题
1137
+ - 按钮始终固定在卡片底部
1138
+ - **移除组织 ID 配置**:
1139
+ - 简化账号配置流程
1140
+ - 移除 CLI UI 中的组织 ID 选项
902
1141
 
903
1142
  ### v1.3.0
904
- - **Improved custom environment variables input**:
905
- - One-line `KEY=VALUE` format input (e.g., `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1`)
906
- - Real-time display of added variables during configuration
907
- - Press Enter without input to finish adding variables
908
- - Better error messages and user guidance
909
- - Enhanced documentation with detailed examples and usage instructions
1143
+ - **改进自定义环境变量输入**:
1144
+ - 支持单行 `KEY=VALUE` 格式输入(例如:`CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1`)
1145
+ - 配置过程中实时显示已添加的变量
1146
+ - 直接按回车即可完成变量添加
1147
+ - 更清晰的错误提示和用户指引
1148
+ - 增强文档,添加详细的示例和使用说明
910
1149
 
911
1150
  ### v1.2.0
912
- - Added custom environment variables support for accounts
913
- - Added `ais doctor` command for configuration diagnostics
914
- - Enhanced `ais help` with all new features
915
- - Updated installation documentation (npm as recommended method)
916
- - Improved PATH configuration instructions
917
- - Display custom env variables in `ais list` and `ais info`
1151
+ - 添加账户自定义环境变量支持
1152
+ - 添加 `ais doctor` 命令用于配置诊断
1153
+ - 增强 `ais help` 显示所有新功能
1154
+ - 更新安装文档(npm 作为推荐安装方式)
1155
+ - 改进 PATH 配置说明
1156
+ - `ais list` `ais info` 中显示自定义环境变量
918
1157
 
919
1158
  ### v1.1.0
920
- - Added smart directory detection (works in any subdirectory)
921
- - Automatic Claude Code `.claude/settings.local.json` generation
922
- - Project root display in `ais info` command
923
- - Improved cross-platform compatibility
1159
+ - 添加智能目录检测(在任何子目录中工作)
1160
+ - 自动生成 Claude Code `.claude/settings.local.json` 配置
1161
+ - `ais info` 命令中显示项目根目录
1162
+ - 改进跨平台兼容性
924
1163
 
925
1164
  ### v1.0.0
926
- - Initial release
927
- - Basic account management (add, list, remove)
928
- - Project-specific account switching
929
- - Cross-platform support
930
- - Interactive CLI prompts
931
- - Account export functionality
932
-
933
- ## Future Enhancements
934
-
935
- Potential features for future versions:
936
- - Account validation
937
- - Bulk import/export
938
- - Account templates
939
- - Environment variable export
940
- - Account sharing (encrypted)
941
- - Cloud sync support
942
- - Account usage statistics
943
-
944
- ## Support
945
-
946
- If you encounter any issues or have questions:
947
- 1. Check the troubleshooting section
948
- 2. Review existing issues
949
- 3. Create a new issue with detailed information
1165
+ - 初始版本
1166
+ - 基本账户管理(添加、列出、删除)
1167
+ - 项目级账户切换
1168
+ - 跨平台支持
1169
+ - 交互式 CLI 提示
1170
+ - 账户导出功能
1171
+
1172
+ ## 未来增强
1173
+
1174
+ 未来版本的潜在功能:
1175
+ - 账户验证
1176
+ - 批量导入/导出
1177
+ - 账户模板
1178
+ - 环境变量导出
1179
+ - 账户共享(加密)
1180
+ - 云同步支持
1181
+ - 账户使用统计
1182
+
1183
+ ## 支持
1184
+
1185
+ 如果遇到任何问题或有疑问:
1186
+ 1. 查看故障排除部分
1187
+ 2. 查看现有 issues
1188
+ 3. 创建新 issue 并提供详细信息
950
1189
 
951
1190
  ---
952
1191
 
953
- **Happy coding with your AI assistants!** 🤖
1192
+ **祝你与 AI 助手编码愉快!** 🤖