ai-account-switch 1.3.0 → 1.4.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_ZH.md CHANGED
@@ -11,7 +11,15 @@
11
11
  - **项目级配置**:每个项目可以使用不同的账户
12
12
  - **智能目录检测**:在项目的任何子目录中都能工作(类似 git)
13
13
  - **Claude Code 集成**:自动生成 `.claude/settings.local.json` 配置文件
14
- - **安全存储**:账户凭证仅存储在本地
14
+ - **Web UI 管理界面**:
15
+ - 🎨 现代化单页面应用,支持深色/浅色主题
16
+ - 🌍 中英文双语支持,一键切换
17
+ - ⚙️ 可视化管理账号:增删改查一目了然
18
+ - 📤 导入/导出功能:批量管理账号配置
19
+ - 🔍 实时搜索过滤账号
20
+ - 💾 自定义环境变量配置
21
+ - 🎯 主题自动跟随系统设置
22
+ - **安全存储**:账户凭证仅存储在本地
15
23
  - **交互式命令行**:所有操作都有易用的交互式提示
16
24
  - **多种账户类型**:支持 Claude、Codex 和其他 AI 服务
17
25
 
@@ -214,6 +222,7 @@ npm link
214
222
  | `ais paths` | - | 显示配置文件路径 |
215
223
  | `ais doctor` | - | 诊断 Claude Code 配置问题 |
216
224
  | `ais export <name>` | - | 导出账户为 JSON 格式 |
225
+ | `ais ui` | - | 启动 Web UI 管理界面 |
217
226
  | `ais help` | - | 显示帮助信息 |
218
227
  | `ais --version` | - | 显示版本号 |
219
228
 
@@ -237,7 +246,6 @@ ais add my-claude-account
237
246
  - 账户类型(Claude、Codex、其他)
238
247
  - API Key
239
248
  - API URL(可选)
240
- - Organization ID(可选)
241
249
  - Email(可选)
242
250
  - 描述(可选)
243
251
  - 自定义环境变量(可选)
@@ -290,7 +298,40 @@ ais current
290
298
 
291
299
  **注意**:这些命令可以在项目的任何子目录中使用,类似 git 命令的工作方式。
292
300
 
293
- #### 5. 删除账户
301
+ #### 5. 使用 Web UI 管理界面
302
+
303
+ 启动可视化管理界面:
304
+
305
+ ```bash
306
+ ais ui
307
+ ```
308
+
309
+ 这将在浏览器中打开 Web UI,服务器会自动使用一个随机的高位端口(49152-65535)。如果端口被占用,会自动尝试其他端口,提供以下功能:
310
+
311
+ **界面特性:**
312
+ - **账号管理**: 可视化的卡片界面,显示所有账号信息
313
+ - **添加/编辑账号**: 友好的表单界面,支持所有配置项
314
+ - **删除账号**: 一键删除,带确认提示
315
+ - **搜索过滤**: 实时搜索账号名称、邮箱或类型
316
+ - **批量操作**:
317
+ - 导出所有账号为 JSON 文件
318
+ - 从 JSON 文件导入账号(支持覆盖选项)
319
+ - **主题切换**:
320
+ - iOS 风格的 Switch 开关
321
+ - 支持浅色和深色主题
322
+ - 默认跟随系统主题设置
323
+ - **多语言支持**:
324
+ - 中文/英文一键切换
325
+ - 界面默认使用中文
326
+ - 语言设置自动保存
327
+
328
+ **UI 使用提示:**
329
+ - 所有修改实时同步到本地配置
330
+ - 关闭浏览器窗口不影响数据
331
+ - 按 `Ctrl+C` 停止 Web 服务器
332
+ - 支持在任何浏览器中使用
333
+
334
+ #### 6. 删除账户
294
335
 
295
336
  删除不再需要的账户:
296
337
 
@@ -361,7 +402,6 @@ ais export my-claude-account
361
402
  "env": {
362
403
  "ANTHROPIC_AUTH_TOKEN": "your-api-key",
363
404
  "ANTHROPIC_BASE_URL": "your-api-url",
364
- "ANTHROPIC_ORGANIZATION_ID": "your-org-id",
365
405
  "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1"
366
406
  },
367
407
  "permissions": {
@@ -581,6 +621,26 @@ MIT License - 欢迎在你的项目中使用此工具!
581
621
 
582
622
  ## 更新日志
583
623
 
624
+ ### v1.4.0
625
+ - **添加 Web UI 管理界面**:
626
+ - 现代化单页面应用,支持深色/浅色主题
627
+ - 中英文双语支持,默认中文
628
+ - 可视化账号管理:增删改查一目了然
629
+ - 导入/导出功能:批量管理账号配置
630
+ - 实时搜索过滤账号
631
+ - 自定义环境变量配置
632
+ - 主题自动跟随系统设置
633
+ - iOS 风格的主题切换开关
634
+ - **端口优化**:
635
+ - UI 服务器使用随机高位端口(49152-65535)
636
+ - 自动检测端口冲突并重试
637
+ - **界面改进**:
638
+ - 修复账号卡片按钮位置不一致问题
639
+ - 按钮始终固定在卡片底部
640
+ - **移除组织 ID 配置**:
641
+ - 简化账号配置流程
642
+ - 移除 CLI 和 UI 中的组织 ID 选项
643
+
584
644
  ### v1.3.0
585
645
  - **改进自定义环境变量输入**:
586
646
  - 支持单行 `KEY=VALUE` 格式输入(例如:`CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1`)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai-account-switch",
3
- "version": "1.3.0",
3
+ "version": "1.4.0",
4
4
  "description": "A cross-platform CLI tool to manage and switch Claude/Codex account configurations",
5
5
  "main": "src/index.js",
6
6
  "bin": {
package/src/commands.js CHANGED
@@ -59,12 +59,6 @@ async function addAccount(name, options) {
59
59
  message: 'Enter API URL (optional):',
60
60
  default: ''
61
61
  },
62
- {
63
- type: 'input',
64
- name: 'organizationId',
65
- message: 'Enter Organization ID (optional):',
66
- default: ''
67
- },
68
62
  {
69
63
  type: 'input',
70
64
  name: 'email',
@@ -278,7 +272,6 @@ function showInfo() {
278
272
  console.log(`${chalk.cyan('Type:')} ${projectAccount.type}`);
279
273
  console.log(`${chalk.cyan('API Key:')} ${maskApiKey(projectAccount.apiKey)}`);
280
274
  if (projectAccount.apiUrl) console.log(`${chalk.cyan('API URL:')} ${projectAccount.apiUrl}`);
281
- if (projectAccount.organizationId) console.log(`${chalk.cyan('Organization ID:')} ${projectAccount.organizationId}`);
282
275
  if (projectAccount.email) console.log(`${chalk.cyan('Email:')} ${projectAccount.email}`);
283
276
  if (projectAccount.description) console.log(`${chalk.cyan('Description:')} ${projectAccount.description}`);
284
277
  if (projectAccount.customEnv && Object.keys(projectAccount.customEnv).length > 0) {
@@ -473,10 +466,6 @@ function doctor() {
473
466
  if (claudeConfig.env && claudeConfig.env.ANTHROPIC_BASE_URL) {
474
467
  console.log(` API URL: ${claudeConfig.env.ANTHROPIC_BASE_URL}`);
475
468
  }
476
-
477
- if (claudeConfig.env && claudeConfig.env.ANTHROPIC_ORGANIZATION_ID) {
478
- console.log(` Org ID: ${claudeConfig.env.ANTHROPIC_ORGANIZATION_ID}`);
479
- }
480
469
  } catch (e) {
481
470
  console.log(chalk.red(` ✗ Error reading Claude config: ${e.message}`));
482
471
  }
@@ -532,6 +521,17 @@ function doctor() {
532
521
  console.log('');
533
522
  }
534
523
 
524
+ /**
525
+ * Start Web UI server
526
+ */
527
+ function startUI() {
528
+ const UIServer = require('./ui-server');
529
+ const server = new UIServer();
530
+
531
+ console.log(chalk.cyan('\n🌐 Starting AIS Web UI...\n'));
532
+ server.start();
533
+ }
534
+
535
535
  module.exports = {
536
536
  addAccount,
537
537
  listAccounts,
@@ -541,5 +541,6 @@ module.exports = {
541
541
  showCurrent,
542
542
  showPaths,
543
543
  exportAccount,
544
- doctor
544
+ doctor,
545
+ startUI
545
546
  };
package/src/config.js CHANGED
@@ -186,11 +186,6 @@ class ConfigManager {
186
186
  claudeConfig.env.ANTHROPIC_BASE_URL = account.apiUrl;
187
187
  }
188
188
 
189
- // Add organization ID if specified
190
- if (account.organizationId) {
191
- claudeConfig.env.ANTHROPIC_ORGANIZATION_ID = account.organizationId;
192
- }
193
-
194
189
  // Add custom environment variables if specified
195
190
  if (account.customEnv && typeof account.customEnv === 'object') {
196
191
  Object.keys(account.customEnv).forEach(key => {
package/src/index.js CHANGED
@@ -11,7 +11,8 @@ const {
11
11
  showCurrent,
12
12
  showPaths,
13
13
  exportAccount,
14
- doctor
14
+ doctor,
15
+ startUI
15
16
  } = require('./commands');
16
17
 
17
18
  // Package info
@@ -78,6 +79,12 @@ program
78
79
  .description('Diagnose Claude Code configuration issues')
79
80
  .action(doctor);
80
81
 
82
+ // Web UI command
83
+ program
84
+ .command('ui')
85
+ .description('Start web-based account manager UI')
86
+ .action(startUI);
87
+
81
88
  // Help command
82
89
  program
83
90
  .command('help')
@@ -97,6 +104,7 @@ program
97
104
  console.log(' paths Show configuration file paths');
98
105
  console.log(' doctor Diagnose Claude Code configuration issues');
99
106
  console.log(' export <name> Export account as JSON');
107
+ console.log(' ui Start web-based account manager UI');
100
108
  console.log(' help Display this help message');
101
109
  console.log(' version Show version number\n');
102
110
 
@@ -115,6 +123,8 @@ program
115
123
  console.log(' ais doctor\n');
116
124
  console.log(chalk.gray(' # Remove an account'));
117
125
  console.log(' ais remove my-old-account\n');
126
+ console.log(chalk.gray(' # Start web UI for managing accounts'));
127
+ console.log(' ais ui\n');
118
128
 
119
129
  console.log(chalk.bold('FEATURES:'));
120
130
  console.log(' • Custom environment variables support');