ai-account-switch 1.5.2 → 1.5.3

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
@@ -17,7 +17,7 @@ A cross-platform CLI tool to manage and switch between Claude/Codex account conf
17
17
 
18
18
  ## Installation
19
19
 
20
- ### Option 1: Global npm Installation (Recommended)
20
+ ### npm Installation (Recommended)
21
21
 
22
22
  ```bash
23
23
  npm install -g ai-account-switch
@@ -25,7 +25,7 @@ npm install -g ai-account-switch
25
25
 
26
26
  After installation, the `ais` command will be available globally.
27
27
 
28
- **Note**: If you encounter "command not found" after installation, you may need to add npm's global bin directory to your PATH:
28
+ **Troubleshooting**: If you encounter "command not found" after installation:
29
29
 
30
30
  ```bash
31
31
  # Check npm global bin path
@@ -37,153 +37,7 @@ export PATH="$PATH:$(npm config get prefix)/bin"
37
37
  # On Windows, add to system PATH: %APPDATA%\npm
38
38
  ```
39
39
 
40
- ### Option 2: Download Pre-built Binary
41
-
42
- Download the latest release for your platform from the [Releases page](https://github.com/yourusername/ai-agent-user-swith/releases):
43
-
44
- **Windows (Automatic Installation - Recommended):**
45
-
46
- Use the automated installer that downloads the latest version and adds it to PATH automatically:
47
-
48
- **Method 1: PowerShell (Recommended)**
49
- ```powershell
50
- # Run in PowerShell (Administrator recommended for system-wide install)
51
- irm https://github.com/yourusername/ai-agent-user-swith/releases/latest/download/install.ps1 | iex
52
- ```
53
-
54
- **Method 2: Download and Run Installer Script**
55
- 1. Download `install.ps1` or `install.bat` from the [Releases page](https://github.com/yourusername/ai-agent-user-swith/releases)
56
- 2. Right-click on `install.ps1` and select "Run with PowerShell"
57
- - Or run `install.bat` by double-clicking it
58
-
59
- The installer will:
60
- - Download the latest `ais-win.exe`
61
- - Install to `%LOCALAPPDATA%\ais` (user install) or `C:\Program Files\ais` (system install)
62
- - Automatically add to PATH
63
- - Verify the installation
64
-
65
- After installation, open a **new terminal** and verify:
66
- ```cmd
67
- ais --version
68
- ```
69
-
70
- **Windows (Manual Installation):**
71
-
72
- If you prefer manual installation:
73
-
74
- 1. Download `ais-win.exe` from the [Releases page](https://github.com/yourusername/ai-agent-user-swith/releases)
75
-
76
- 2. Choose an installation location (recommended: `C:\Program Files\ais\`)
77
- ```cmd
78
- mkdir "C:\Program Files\ais"
79
- ```
80
-
81
- 3. Move the downloaded file to the installation directory and rename it:
82
- ```cmd
83
- move "%USERPROFILE%\Downloads\ais-win.exe" "C:\Program Files\ais\ais.exe"
84
- ```
85
-
86
- 4. Add to PATH:
87
-
88
- **Method 1: Using System Settings (Recommended)**
89
- - Open Start Menu and search for "Environment Variables"
90
- - Click "Edit the system environment variables"
91
- - Click "Environment Variables..." button
92
- - Under "System variables" (or "User variables" for current user only), find and select "Path"
93
- - Click "Edit..."
94
- - Click "New"
95
- - Add `C:\Program Files\ais`
96
- - Click "OK" on all dialogs
97
- - **Restart your terminal** for changes to take effect
98
-
99
- **Method 2: Using PowerShell (Administrator)**
100
- ```powershell
101
- # Add to User PATH
102
- [Environment]::SetEnvironmentVariable("Path", $env:Path + ";C:\Program Files\ais", "User")
103
-
104
- # Or add to System PATH (requires admin)
105
- [Environment]::SetEnvironmentVariable("Path", $env:Path + ";C:\Program Files\ais", "Machine")
106
- ```
107
-
108
- **Method 3: Using Command Prompt (Administrator)**
109
- ```cmd
110
- setx PATH "%PATH%;C:\Program Files\ais"
111
- ```
112
-
113
- 5. Verify installation:
114
- ```cmd
115
- # Open a NEW terminal window
116
- ais --version
117
- ```
118
-
119
- **Note**: If you prefer a user-local installation without admin rights, use `%LOCALAPPDATA%\ais` instead:
120
- ```cmd
121
- mkdir "%LOCALAPPDATA%\ais"
122
- move "%USERPROFILE%\Downloads\ais-win.exe" "%LOCALAPPDATA%\ais\ais.exe"
123
- # Then add %LOCALAPPDATA%\ais to your User PATH
124
- ```
125
-
126
- **macOS:**
127
-
128
- 1. Download and install to `/usr/local/bin`:
129
- ```bash
130
- curl -L https://github.com/yourusername/ai-agent-user-swith/releases/latest/download/ais-macos -o /usr/local/bin/ais
131
- chmod +x /usr/local/bin/ais
132
- ```
133
-
134
- 2. If you don't have write permissions for `/usr/local/bin`, use sudo:
135
- ```bash
136
- sudo curl -L https://github.com/yourusername/ai-agent-user-swith/releases/latest/download/ais-macos -o /usr/local/bin/ais
137
- sudo chmod +x /usr/local/bin/ais
138
- ```
139
-
140
- 3. Alternatively, install to your user directory (no sudo required):
141
- ```bash
142
- mkdir -p ~/.local/bin
143
- curl -L https://github.com/yourusername/ai-agent-user-swith/releases/latest/download/ais-macos -o ~/.local/bin/ais
144
- chmod +x ~/.local/bin/ais
145
-
146
- # Add to PATH if not already there
147
- echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc
148
- source ~/.zshrc
149
- ```
150
-
151
- 4. Verify installation:
152
- ```bash
153
- ais --version
154
- ```
155
-
156
- **Linux:**
157
-
158
- 1. Download and install to `/usr/local/bin`:
159
- ```bash
160
- curl -L https://github.com/yourusername/ai-agent-user-swith/releases/latest/download/ais-linux -o /usr/local/bin/ais
161
- chmod +x /usr/local/bin/ais
162
- ```
163
-
164
- 2. If you don't have write permissions for `/usr/local/bin`, use sudo:
165
- ```bash
166
- sudo curl -L https://github.com/yourusername/ai-agent-user-swith/releases/latest/download/ais-linux -o /usr/local/bin/ais
167
- sudo chmod +x /usr/local/bin/ais
168
- ```
169
-
170
- 3. Alternatively, install to your user directory (no sudo required):
171
- ```bash
172
- mkdir -p ~/.local/bin
173
- curl -L https://github.com/yourusername/ai-agent-user-swith/releases/latest/download/ais-linux -o ~/.local/bin/ais
174
- chmod +x ~/.local/bin/ais
175
-
176
- # Add to PATH if not already there
177
- echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
178
- source ~/.bashrc
179
- ```
180
-
181
- 4. Verify installation:
182
- ```bash
183
- ais --version
184
- ```
185
-
186
- ### Option 3: Install from Source
40
+ ### Install from Source
187
41
 
188
42
  ```bash
189
43
  # Clone the repository
package/README_ZH.md CHANGED
@@ -25,7 +25,7 @@
25
25
 
26
26
  ## 安装
27
27
 
28
- ### 方式 1:全局 npm 安装(推荐)
28
+ ### npm 安装(推荐)
29
29
 
30
30
  ```bash
31
31
  npm install -g ai-account-switch
@@ -33,7 +33,7 @@ npm install -g ai-account-switch
33
33
 
34
34
  安装后,`ais` 命令将在全局可用。
35
35
 
36
- **注意**:如果安装后提示"命令未找到",可能需要将 npm 的全局 bin 目录添加到 PATH
36
+ **故障排除**:如果安装后提示"命令未找到":
37
37
 
38
38
  ```bash
39
39
  # 查看 npm 全局 bin 路径
@@ -45,153 +45,7 @@ export PATH="$PATH:$(npm config get prefix)/bin"
45
45
  # Windows 上,添加到系统 PATH:%APPDATA%\npm
46
46
  ```
47
47
 
48
- ### 方式 2:下载预编译二进制文件
49
-
50
- 从 [Releases 页面](https://github.com/yourusername/ai-agent-user-swith/releases) 下载适合你平台的最新版本:
51
-
52
- **Windows(自动安装 - 推荐):**
53
-
54
- 使用自动安装程序,它会下载最新版本并自动添加到 PATH:
55
-
56
- **方法 1:PowerShell(推荐)**
57
- ```powershell
58
- # 在 PowerShell 中运行(建议使用管理员权限进行系统级安装)
59
- irm https://github.com/yourusername/ai-agent-user-swith/releases/latest/download/install.ps1 | iex
60
- ```
61
-
62
- **方法 2:下载并运行安装脚本**
63
- 1. 从 [Releases 页面](https://github.com/yourusername/ai-agent-user-swith/releases) 下载 `install.ps1` 或 `install.bat`
64
- 2. 右键点击 `install.ps1` 并选择"使用 PowerShell 运行"
65
- - 或双击运行 `install.bat`
66
-
67
- 安装程序将:
68
- - 下载最新的 `ais-win.exe`
69
- - 安装到 `%LOCALAPPDATA%\ais`(用户安装)或 `C:\Program Files\ais`(系统安装)
70
- - 自动添加到 PATH
71
- - 验证安装
72
-
73
- 安装完成后,打开**新的终端**并验证:
74
- ```cmd
75
- ais --version
76
- ```
77
-
78
- **Windows(手动安装):**
79
-
80
- 如果你更喜欢手动安装:
81
-
82
- 1. 从 [Releases 页面](https://github.com/yourusername/ai-agent-user-swith/releases) 下载 `ais-win.exe`
83
-
84
- 2. 选择安装位置(推荐:`C:\Program Files\ais\`)
85
- ```cmd
86
- mkdir "C:\Program Files\ais"
87
- ```
88
-
89
- 3. 将下载的文件移动到安装目录并重命名:
90
- ```cmd
91
- move "%USERPROFILE%\Downloads\ais-win.exe" "C:\Program Files\ais\ais.exe"
92
- ```
93
-
94
- 4. 添加到 PATH:
95
-
96
- **方法 1:使用系统设置(推荐)**
97
- - 打开开始菜单,搜索"环境变量"
98
- - 点击"编辑系统环境变量"
99
- - 点击"环境变量..."按钮
100
- - 在"系统变量"(或"用户变量",仅对当前用户有效)下,找到并选择"Path"
101
- - 点击"编辑..."
102
- - 点击"新建"
103
- - 添加 `C:\Program Files\ais`
104
- - 在所有对话框上点击"确定"
105
- - **重启终端**使更改生效
106
-
107
- **方法 2:使用 PowerShell(管理员权限)**
108
- ```powershell
109
- # 添加到用户 PATH
110
- [Environment]::SetEnvironmentVariable("Path", $env:Path + ";C:\Program Files\ais", "User")
111
-
112
- # 或添加到系统 PATH(需要管理员权限)
113
- [Environment]::SetEnvironmentVariable("Path", $env:Path + ";C:\Program Files\ais", "Machine")
114
- ```
115
-
116
- **方法 3:使用命令提示符(管理员权限)**
117
- ```cmd
118
- setx PATH "%PATH%;C:\Program Files\ais"
119
- ```
120
-
121
- 5. 验证安装:
122
- ```cmd
123
- # 打开新的终端窗口
124
- ais --version
125
- ```
126
-
127
- **注意**:如果你希望安装到用户目录而不需要管理员权限,可以使用 `%LOCALAPPDATA%\ais`:
128
- ```cmd
129
- mkdir "%LOCALAPPDATA%\ais"
130
- move "%USERPROFILE%\Downloads\ais-win.exe" "%LOCALAPPDATA%\ais\ais.exe"
131
- # 然后将 %LOCALAPPDATA%\ais 添加到你的用户 PATH
132
- ```
133
-
134
- **macOS:**
135
-
136
- 1. 下载并安装到 `/usr/local/bin`:
137
- ```bash
138
- curl -L https://github.com/yourusername/ai-agent-user-swith/releases/latest/download/ais-macos -o /usr/local/bin/ais
139
- chmod +x /usr/local/bin/ais
140
- ```
141
-
142
- 2. 如果你没有 `/usr/local/bin` 的写入权限,使用 sudo:
143
- ```bash
144
- sudo curl -L https://github.com/yourusername/ai-agent-user-swith/releases/latest/download/ais-macos -o /usr/local/bin/ais
145
- sudo chmod +x /usr/local/bin/ais
146
- ```
147
-
148
- 3. 或者,安装到用户目录(无需 sudo):
149
- ```bash
150
- mkdir -p ~/.local/bin
151
- curl -L https://github.com/yourusername/ai-agent-user-swith/releases/latest/download/ais-macos -o ~/.local/bin/ais
152
- chmod +x ~/.local/bin/ais
153
-
154
- # 如果还未添加到 PATH,请添加
155
- echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc
156
- source ~/.zshrc
157
- ```
158
-
159
- 4. 验证安装:
160
- ```bash
161
- ais --version
162
- ```
163
-
164
- **Linux:**
165
-
166
- 1. 下载并安装到 `/usr/local/bin`:
167
- ```bash
168
- curl -L https://github.com/yourusername/ai-agent-user-swith/releases/latest/download/ais-linux -o /usr/local/bin/ais
169
- chmod +x /usr/local/bin/ais
170
- ```
171
-
172
- 2. 如果你没有 `/usr/local/bin` 的写入权限,使用 sudo:
173
- ```bash
174
- sudo curl -L https://github.com/yourusername/ai-agent-user-swith/releases/latest/download/ais-linux -o /usr/local/bin/ais
175
- sudo chmod +x /usr/local/bin/ais
176
- ```
177
-
178
- 3. 或者,安装到用户目录(无需 sudo):
179
- ```bash
180
- mkdir -p ~/.local/bin
181
- curl -L https://github.com/yourusername/ai-agent-user-swith/releases/latest/download/ais-linux -o ~/.local/bin/ais
182
- chmod +x ~/.local/bin/ais
183
-
184
- # 如果还未添加到 PATH,请添加
185
- echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
186
- source ~/.bashrc
187
- ```
188
-
189
- 4. 验证安装:
190
- ```bash
191
- ais --version
192
- ```
193
-
194
- ### 方式 3:从源码安装
48
+ ### 从源码安装
195
49
 
196
50
  ```bash
197
51
  # 克隆仓库
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai-account-switch",
3
- "version": "1.5.2",
3
+ "version": "1.5.3",
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": {
@@ -8,11 +8,7 @@
8
8
  },
9
9
  "scripts": {
10
10
  "test": "node src/index.js",
11
- "link": "npm link",
12
- "build": "pkg . --targets node18-linux-x64,node18-macos-x64,node18-win-x64 --output dist/ais",
13
- "build:win": "pkg . --targets node18-win-x64 --output dist/ais-win.exe",
14
- "build:installer": "iscc installer\\windows\\ais-setup.iss",
15
- "build:win-installer": "npm run build:win && npm run build:installer"
11
+ "link": "npm link"
16
12
  },
17
13
  "keywords": [
18
14
  "cli",
@@ -1,291 +0,0 @@
1
- # Windows 安装程序优化方案
2
-
3
- ## 概述
4
-
5
- 为了提供更好的 Windows 用户体验,我们使用 **Inno Setup** 创建了一个专业的 Windows 安装程序。
6
-
7
- ## 用户体验对比
8
-
9
- ### 之前(手动安装)
10
- 1. 下载 `ais-win.exe`
11
- 2. 手动创建目录
12
- 3. 移动文件到目录
13
- 4. 手动添加到 PATH(需要打开系统设置)
14
- 5. 重启终端
15
- 6. 验证安装
16
-
17
- ### 现在(一键安装)
18
- 1. 下载 `ais-setup-1.5.1.exe`
19
- 2. 双击运行
20
- 3. 点击"下一步"几次
21
- 4. 完成!
22
-
23
- ## 安装程序特性
24
-
25
- ### ✅ 自动化功能
26
- - **自动 PATH 配置**:安装时自动添加到用户 PATH
27
- - **自动卸载**:完整的卸载程序,包括 PATH 清理
28
- - **无需管理员权限**:安装到用户目录,普通用户即可安装
29
-
30
- ### ✅ 用户友好
31
- - **现代化向导界面**:清晰的安装步骤
32
- - **多语言支持**:英文和中文界面
33
- - **开始菜单集成**:自动创建开始菜单项
34
- - **可选桌面快捷方式**:用户可选择是否创建
35
-
36
- ### ✅ 专业性
37
- - **版本管理**:显示版本号和发布信息
38
- - **许可协议**:显示 MIT 许可证
39
- - **卸载程序**:标准的 Windows 卸载体验
40
-
41
- ## 技术实现
42
-
43
- ### 使用的工具
44
-
45
- **Inno Setup**
46
- - 免费开源的 Windows 安装程序制作工具
47
- - 被广泛使用(Node.js、VS Code 等都使用它)
48
- - 支持脚本化配置
49
- - 生成标准的 Windows 安装程序
50
-
51
- ### 文件结构
52
-
53
- ```
54
- installer/
55
- ├── README.md # 安装程序说明
56
- └── windows/
57
- ├── ais-setup.iss # Inno Setup 配置脚本
58
- ├── ais-icon.ico # 应用图标(可选)
59
- └── build-installer.md # 构建说明文档
60
- ```
61
-
62
- ### 自动化构建
63
-
64
- GitHub Actions 工作流 (`.github/workflows/build-installer.yml`):
65
- - 在创建新 tag 时自动触发
66
- - 构建 Windows 可执行文件
67
- - 使用 Inno Setup 创建安装程序
68
- - 自动上传到 GitHub Releases
69
-
70
- ## 构建安装程序
71
-
72
- ### 前提条件
73
-
74
- 1. **安装 Inno Setup**
75
- - 下载:https://jrsoftware.org/isdl.php
76
- - 版本:6.0 或更高
77
-
78
- 2. **构建可执行文件**
79
- ```bash
80
- npm run build:win
81
- ```
82
-
83
- ### 构建方法
84
-
85
- **方法 1:使用 npm 脚本(推荐)**
86
- ```bash
87
- npm run build:win-installer
88
- ```
89
-
90
- **方法 2:使用 Inno Setup GUI**
91
- 1. 打开 Inno Setup Compiler
92
- 2. 打开 `installer/windows/ais-setup.iss`
93
- 3. 点击 "Build" → "Compile"
94
-
95
- **方法 3:命令行**
96
- ```bash
97
- "C:\Program Files (x86)\Inno Setup 6\ISCC.exe" installer\windows\ais-setup.iss
98
- ```
99
-
100
- ### 输出
101
-
102
- 安装程序将生成在:
103
- ```
104
- dist/installer/ais-setup-1.5.1.exe
105
- ```
106
-
107
- ## 安装程序功能详解
108
-
109
- ### 安装过程
110
-
111
- 1. **欢迎页面**
112
- - 显示应用名称和版本
113
- - 多语言支持
114
-
115
- 2. **许可协议**
116
- - 显示 MIT 许可证
117
- - 用户需要接受才能继续
118
-
119
- 3. **选择安装目录**
120
- - 默认:`C:\Users\<username>\AppData\Local\Programs\AI Account Switch`
121
- - 用户可以自定义
122
-
123
- 4. **选择组件**
124
- - 添加到 PATH(推荐,默认选中)
125
- - 创建桌面快捷方式(可选)
126
-
127
- 5. **安装**
128
- - 复制文件
129
- - 配置 PATH
130
- - 创建快捷方式
131
-
132
- 6. **完成**
133
- - 显示成功消息
134
- - 提示用户可以使用 `ais` 命令
135
-
136
- ### 卸载过程
137
-
138
- 用户可以通过以下方式卸载:
139
- - 开始菜单 → AI Account Switch → Uninstall
140
- - Windows 设置 → 应用 → AI Account Switch → 卸载
141
-
142
- 卸载程序会:
143
- - 删除所有安装的文件
144
- - 从 PATH 中移除
145
- - 删除开始菜单项
146
- - 删除桌面快捷方式(如果有)
147
-
148
- ## PATH 配置原理
149
-
150
- ### 自动添加到 PATH
151
-
152
- 安装程序使用 Pascal 脚本自动修改用户的 PATH 环境变量:
153
-
154
- ```pascal
155
- procedure EnvAddPath(Path: string);
156
- var
157
- Paths: string;
158
- begin
159
- { 读取当前 PATH }
160
- if not RegQueryStringValue(HKEY_CURRENT_USER, 'Environment', 'Path', Paths)
161
- then Paths := '';
162
-
163
- { 检查是否已存在 }
164
- if Pos(';' + Uppercase(Path) + ';', ';' + Uppercase(Paths) + ';') > 0 then exit;
165
-
166
- { 添加到 PATH }
167
- Paths := Paths + ';'+ Path +';'
168
-
169
- { 写入注册表 }
170
- RegWriteStringValue(HKEY_CURRENT_USER, 'Environment', 'Path', Paths);
171
- end;
172
- ```
173
-
174
- ### 自动从 PATH 移除
175
-
176
- 卸载时自动清理:
177
-
178
- ```pascal
179
- procedure EnvRemovePath(Path: string);
180
- var
181
- Paths: string;
182
- P: Integer;
183
- begin
184
- { 读取当前 PATH }
185
- if not RegQueryStringValue(HKEY_CURRENT_USER, 'Environment', 'Path', Paths) then
186
- exit;
187
-
188
- { 查找并删除 }
189
- P := Pos(';' + Uppercase(Path) + ';', ';' + Uppercase(Paths) + ';');
190
- if P = 0 then exit;
191
-
192
- Delete(Paths, P - 1, Length(Path) + 1);
193
-
194
- { 写入注册表 }
195
- RegWriteStringValue(HKEY_CURRENT_USER, 'Environment', 'Path', Paths);
196
- end;
197
- ```
198
-
199
- ## 自定义配置
200
-
201
- ### 修改版本号
202
-
203
- 编辑 `installer/windows/ais-setup.iss`:
204
- ```iss
205
- #define MyAppVersion "1.5.1" ; 修改这里
206
- ```
207
-
208
- ### 修改安装目录
209
-
210
- ```iss
211
- DefaultDirName={autopf}\{#MyAppName} ; 当前:Program Files
212
- ; 或使用:
213
- DefaultDirName={localappdata}\Programs\{#MyAppName} ; 用户目录
214
- ```
215
-
216
- ### 添加更多文件
217
-
218
- 在 `[Files]` 部分添加:
219
- ```iss
220
- [Files]
221
- Source: "path\to\file"; DestDir: "{app}"; Flags: ignoreversion
222
- ```
223
-
224
- ### 添加注册表项
225
-
226
- 在 `[Registry]` 部分添加:
227
- ```iss
228
- [Registry]
229
- Root: HKCU; Subkey: "Software\AIAccountSwitch"; ValueType: string; ValueName: "InstallPath"; ValueData: "{app}"
230
- ```
231
-
232
- ## 发布流程
233
-
234
- ### 手动发布
235
-
236
- 1. 构建安装程序:
237
- ```bash
238
- npm run build:win-installer
239
- ```
240
-
241
- 2. 测试安装程序(在干净的 Windows 机器上)
242
-
243
- 3. 上传到 GitHub Releases
244
-
245
- ### 自动发布
246
-
247
- 1. 创建新 tag:
248
- ```bash
249
- git tag v1.5.1
250
- git push origin v1.5.1
251
- ```
252
-
253
- 2. GitHub Actions 自动:
254
- - 构建可执行文件
255
- - 创建安装程序
256
- - 上传到 Releases
257
-
258
- ## 优势总结
259
-
260
- | 特性 | 手动安装 | 安装程序 |
261
- |------|---------|---------|
262
- | 安装步骤 | 6+ 步 | 3 步 |
263
- | PATH 配置 | 手动 | 自动 |
264
- | 管理员权限 | 有时需要 | 不需要 |
265
- | 卸载 | 手动删除 | 一键卸载 |
266
- | 开始菜单 | 无 | 有 |
267
- | 用户体验 | 复杂 | 简单 |
268
- | 专业性 | 低 | 高 |
269
-
270
- ## 下一步
271
-
272
- 1. ✅ 创建 Inno Setup 脚本
273
- 2. ✅ 添加 GitHub Actions 工作流
274
- 3. ✅ 更新 package.json 脚本
275
- 4. ⏳ 创建应用图标(可选但推荐)
276
- 5. ⏳ 在 Windows 机器上测试
277
- 6. ⏳ 更新 README 安装说明
278
- 7. ⏳ 发布新版本
279
-
280
- ## 参考资源
281
-
282
- - [Inno Setup 官方文档](https://jrsoftware.org/ishelp/)
283
- - [Inno Setup 示例](https://jrsoftware.org/isinfo.php)
284
- - [PATH 环境变量管理](https://jrsoftware.org/ishelp/index.php?topic=setup_changesenvironment)
285
-
286
- ## 支持
287
-
288
- 如有问题,请查看:
289
- - `installer/windows/build-installer.md` - 详细构建说明
290
- - `installer/README.md` - 安装程序概述
291
- - GitHub Issues - 报告问题
@@ -1,83 +0,0 @@
1
- # Windows Installer
2
-
3
- This directory contains the configuration and scripts for building the Windows installer for AI Account Switch.
4
-
5
- ## Quick Start
6
-
7
- ### For Users
8
-
9
- Download `ais-setup-1.5.1.exe` from the [Releases page](https://github.com/DeanWanghewei/ai-agent-user-swith/releases) and run it. The installer will:
10
-
11
- 1. Install the application
12
- 2. Automatically add `ais` to your PATH
13
- 3. Create Start Menu shortcuts
14
- 4. Optionally create a desktop shortcut
15
-
16
- After installation, open a new terminal and run:
17
- ```cmd
18
- ais --version
19
- ```
20
-
21
- ### For Developers
22
-
23
- See [windows/build-installer.md](windows/build-installer.md) for detailed build instructions.
24
-
25
- ## Directory Structure
26
-
27
- ```
28
- installer/
29
- ├── README.md # This file
30
- └── windows/
31
- ├── ais-setup.iss # Inno Setup script
32
- ├── ais-icon.ico # Application icon (optional)
33
- └── build-installer.md # Build instructions
34
- ```
35
-
36
- ## Features
37
-
38
- - ✅ One-click installation
39
- - ✅ Automatic PATH configuration
40
- - ✅ No admin rights required
41
- - ✅ Clean uninstaller
42
- - ✅ Multi-language support (English/Chinese)
43
- - ✅ Modern wizard interface
44
-
45
- ## Building
46
-
47
- ### Prerequisites
48
-
49
- 1. Install [Inno Setup](https://jrsoftware.org/isdl.php)
50
- 2. Build the Windows executable: `npm run build:win`
51
-
52
- ### Build Installer
53
-
54
- ```bash
55
- # Using Inno Setup GUI
56
- # Open installer/windows/ais-setup.iss and click Compile
57
-
58
- # Or using command line
59
- "C:\Program Files (x86)\Inno Setup 6\ISCC.exe" installer\windows\ais-setup.iss
60
- ```
61
-
62
- The installer will be created in `dist/installer/ais-setup-1.5.1.exe`.
63
-
64
- ## Automated Builds
65
-
66
- The installer is automatically built by GitHub Actions when you:
67
- - Push a new tag (e.g., `v1.5.1`)
68
- - Manually trigger the workflow
69
-
70
- See [.github/workflows/build-installer.yml](../.github/workflows/build-installer.yml) for details.
71
-
72
- ## Customization
73
-
74
- Edit `windows/ais-setup.iss` to customize:
75
- - Application name and version
76
- - Installation directory
77
- - File associations
78
- - Registry entries
79
- - Custom actions
80
-
81
- ## Support
82
-
83
- For issues or questions about the installer, please open an issue on GitHub.
@@ -1,85 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <svg width="256" height="256" viewBox="0 0 256 256" xmlns="http://www.w3.org/2000/svg">
3
- <!-- Background gradient -->
4
- <defs>
5
- <linearGradient id="bgGradient" x1="0%" y1="0%" x2="100%" y2="100%">
6
- <stop offset="0%" style="stop-color:#667eea;stop-opacity:1" />
7
- <stop offset="100%" style="stop-color:#764ba2;stop-opacity:1" />
8
- </linearGradient>
9
-
10
- <linearGradient id="switchGradient" x1="0%" y1="0%" x2="100%" y2="0%">
11
- <stop offset="0%" style="stop-color:#48bb78;stop-opacity:1" />
12
- <stop offset="100%" style="stop-color:#38a169;stop-opacity:1" />
13
- </linearGradient>
14
-
15
- <!-- Shadow filter -->
16
- <filter id="shadow" x="-50%" y="-50%" width="200%" height="200%">
17
- <feGaussianBlur in="SourceAlpha" stdDeviation="3"/>
18
- <feOffset dx="0" dy="2" result="offsetblur"/>
19
- <feComponentTransfer>
20
- <feFuncA type="linear" slope="0.3"/>
21
- </feComponentTransfer>
22
- <feMerge>
23
- <feMergeNode/>
24
- <feMergeNode in="SourceGraphic"/>
25
- </feMerge>
26
- </filter>
27
- </defs>
28
-
29
- <!-- Background rounded square -->
30
- <rect width="256" height="256" rx="48" fill="url(#bgGradient)"/>
31
-
32
- <!-- AI Brain/Circuit representation (left side) -->
33
- <g transform="translate(50, 80)" filter="url(#shadow)">
34
- <!-- Brain outline -->
35
- <circle cx="20" cy="20" r="18" fill="none" stroke="white" stroke-width="3" opacity="0.9"/>
36
- <!-- Neural connections -->
37
- <circle cx="20" cy="20" r="4" fill="white" opacity="0.9"/>
38
- <circle cx="10" cy="15" r="3" fill="white" opacity="0.8"/>
39
- <circle cx="30" cy="15" r="3" fill="white" opacity="0.8"/>
40
- <circle cx="15" cy="28" r="3" fill="white" opacity="0.8"/>
41
- <circle cx="25" cy="28" r="3" fill="white" opacity="0.8"/>
42
- <line x1="20" y1="20" x2="10" y2="15" stroke="white" stroke-width="2" opacity="0.7"/>
43
- <line x1="20" y1="20" x2="30" y2="15" stroke="white" stroke-width="2" opacity="0.7"/>
44
- <line x1="20" y1="20" x2="15" y2="28" stroke="white" stroke-width="2" opacity="0.7"/>
45
- <line x1="20" y1="20" x2="25" y2="28" stroke="white" stroke-width="2" opacity="0.7"/>
46
- </g>
47
-
48
- <!-- Switch/Toggle symbol (center) -->
49
- <g transform="translate(128, 128)" filter="url(#shadow)">
50
- <!-- Switch track -->
51
- <rect x="-35" y="-12" width="70" height="24" rx="12" fill="url(#switchGradient)" opacity="0.9"/>
52
- <!-- Switch knob -->
53
- <circle cx="20" cy="0" r="16" fill="white"/>
54
- <!-- Arrow on knob -->
55
- <path d="M 15,-5 L 25,0 L 15,5 Z" fill="url(#bgGradient)"/>
56
- </g>
57
-
58
- <!-- AI Brain/Circuit representation (right side) -->
59
- <g transform="translate(186, 80)" filter="url(#shadow)">
60
- <!-- Brain outline -->
61
- <circle cx="20" cy="20" r="18" fill="none" stroke="white" stroke-width="3" opacity="0.9"/>
62
- <!-- Neural connections -->
63
- <circle cx="20" cy="20" r="4" fill="white" opacity="0.9"/>
64
- <circle cx="10" cy="15" r="3" fill="white" opacity="0.8"/>
65
- <circle cx="30" cy="15" r="3" fill="white" opacity="0.8"/>
66
- <circle cx="15" cy="28" r="3" fill="white" opacity="0.8"/>
67
- <circle cx="25" cy="28" r="3" fill="white" opacity="0.8"/>
68
- <line x1="20" y1="20" x2="10" y2="15" stroke="white" stroke-width="2" opacity="0.7"/>
69
- <line x1="20" y1="20" x2="30" y2="15" stroke="white" stroke-width="2" opacity="0.7"/>
70
- <line x1="20" y1="20" x2="15" y2="28" stroke="white" stroke-width="2" opacity="0.7"/>
71
- <line x1="20" y1="20" x2="25" y2="28" stroke="white" stroke-width="2" opacity="0.7"/>
72
- </g>
73
-
74
- <!-- Connection lines between brains and switch -->
75
- <g opacity="0.6">
76
- <line x1="88" y1="100" x2="93" y2="116" stroke="white" stroke-width="2.5" stroke-dasharray="5,3"/>
77
- <line x1="168" y1="100" x2="163" y2="116" stroke="white" stroke-width="2.5" stroke-dasharray="5,3"/>
78
- </g>
79
-
80
- <!-- Text label -->
81
- <text x="128" y="200" font-family="Arial, sans-serif" font-size="24" font-weight="bold"
82
- text-anchor="middle" fill="white" opacity="0.95">AIS</text>
83
- <text x="128" y="220" font-family="Arial, sans-serif" font-size="12"
84
- text-anchor="middle" fill="white" opacity="0.8">Account Switch</text>
85
- </svg>
@@ -1,114 +0,0 @@
1
- ; AI Account Switch (ais) - Windows Installer Script
2
- ; Inno Setup Script for creating Windows installer
3
-
4
- #define MyAppName "AI Account Switch"
5
- #define MyAppVersion "1.5.1"
6
- #define MyAppPublisher "AI Account Switch Team"
7
- #define MyAppURL "https://github.com/DeanWanghewei/ai-agent-user-swith"
8
- #define MyAppExeName "ais.exe"
9
-
10
- [Setup]
11
- ; NOTE: The value of AppId uniquely identifies this application.
12
- AppId={{8F9A7B2C-3D4E-5F6A-7B8C-9D0E1F2A3B4C}
13
- AppName={#MyAppName}
14
- AppVersion={#MyAppVersion}
15
- AppPublisher={#MyAppPublisher}
16
- AppPublisherURL={#MyAppURL}
17
- AppSupportURL={#MyAppURL}/issues
18
- AppUpdatesURL={#MyAppURL}/releases
19
- DefaultDirName={autopf}\{#MyAppName}
20
- DefaultGroupName={#MyAppName}
21
- AllowNoIcons=yes
22
- LicenseFile=..\..\LICENSE
23
- OutputDir=..\..\dist\installer
24
- OutputBaseFilename=ais-setup-{#MyAppVersion}
25
- SetupIconFile=ais-icon.ico
26
- Compression=lzma
27
- SolidCompression=yes
28
- WizardStyle=modern
29
- PrivilegesRequired=lowest
30
- PrivilegesRequiredOverridesAllowed=dialog
31
- ChangesEnvironment=yes
32
- UninstallDisplayIcon={app}\{#MyAppExeName}
33
-
34
- [Languages]
35
- Name: "english"; MessagesFile: "compiler:Default.isl"
36
- Name: "chinesesimplified"; MessagesFile: "compiler:Languages\ChineseSimplified.isl"
37
-
38
- [Tasks]
39
- Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
40
- Name: "addtopath"; Description: "Add to PATH environment variable (Recommended)"; GroupDescription: "System Integration:"; Flags: checkedonce
41
-
42
- [Files]
43
- Source: "..\..\dist\ais-win.exe"; DestDir: "{app}"; DestName: "{#MyAppExeName}"; Flags: ignoreversion
44
- Source: "..\..\README.md"; DestDir: "{app}"; Flags: ignoreversion
45
- Source: "..\..\README_ZH.md"; DestDir: "{app}"; Flags: ignoreversion
46
- Source: "..\..\LICENSE"; DestDir: "{app}"; Flags: ignoreversion
47
-
48
- [Icons]
49
- Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
50
- Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"
51
- Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
52
-
53
- [Code]
54
- const EnvironmentKey = 'Environment';
55
-
56
- procedure EnvAddPath(Path: string);
57
- var
58
- Paths: string;
59
- begin
60
- { Retrieve current path (use empty string if entry not exists) }
61
- if not RegQueryStringValue(HKEY_CURRENT_USER, EnvironmentKey, 'Path', Paths)
62
- then Paths := '';
63
-
64
- { Skip if string already found in path }
65
- if Pos(';' + Uppercase(Path) + ';', ';' + Uppercase(Paths) + ';') > 0 then exit;
66
-
67
- { App string to the end of the path variable }
68
- Paths := Paths + ';'+ Path +';'
69
-
70
- { Overwrite (or create if missing) path environment variable }
71
- if RegWriteStringValue(HKEY_CURRENT_USER, EnvironmentKey, 'Path', Paths)
72
- then Log(Format('The [%s] added to PATH: [%s]', [Path, Paths]))
73
- else Log(Format('Error while adding the [%s] to PATH: [%s]', [Path, Paths]));
74
- end;
75
-
76
- procedure EnvRemovePath(Path: string);
77
- var
78
- Paths: string;
79
- P: Integer;
80
- begin
81
- { Skip if registry entry not exists }
82
- if not RegQueryStringValue(HKEY_CURRENT_USER, EnvironmentKey, 'Path', Paths) then
83
- exit;
84
-
85
- { Skip if string not found in path }
86
- P := Pos(';' + Uppercase(Path) + ';', ';' + Uppercase(Paths) + ';');
87
- if P = 0 then exit;
88
-
89
- { Update path variable }
90
- Delete(Paths, P - 1, Length(Path) + 1);
91
-
92
- { Overwrite path environment variable }
93
- if RegWriteStringValue(HKEY_CURRENT_USER, EnvironmentKey, 'Path', Paths)
94
- then Log(Format('The [%s] removed from PATH: [%s]', [Path, Paths]))
95
- else Log(Format('Error while removing the [%s] from PATH: [%s]', [Path, Paths]));
96
- end;
97
-
98
- procedure CurStepChanged(CurStep: TSetupStep);
99
- begin
100
- if (CurStep = ssPostInstall) and WizardIsTaskSelected('addtopath')
101
- then EnvAddPath(ExpandConstant('{app}'));
102
- end;
103
-
104
- procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
105
- begin
106
- if CurUninstallStep = usPostUninstall
107
- then EnvRemovePath(ExpandConstant('{app}'));
108
- end;
109
-
110
- [Run]
111
- Filename: "{cmd}"; Parameters: "/C ""echo Installation completed successfully! && echo. && echo You can now use 'ais' command in any new terminal window. && echo. && pause"""; Flags: postinstall runhidden; Description: "Show installation success message"
112
-
113
- [UninstallRun]
114
- Filename: "{cmd}"; Parameters: "/C ""echo {#MyAppName} has been uninstalled. && pause"""; Flags: runhidden
@@ -1,182 +0,0 @@
1
- # Building Windows Installer
2
-
3
- This guide explains how to build the Windows installer for AI Account Switch.
4
-
5
- ## Prerequisites
6
-
7
- 1. **Inno Setup**: Download and install from https://jrsoftware.org/isdl.php
8
- - Version 6.0 or later recommended
9
- - Free and open source
10
-
11
- 2. **Node.js and npm**: Required to build the executable
12
- - Node.js 14.0 or later
13
-
14
- ## Build Steps
15
-
16
- ### Step 1: Build the Windows Executable
17
-
18
- ```bash
19
- # Install dependencies
20
- npm install
21
-
22
- # Build Windows executable using pkg
23
- npm run build:win
24
- # Or manually:
25
- npx pkg . --targets node18-win-x64 --output dist/ais-win.exe
26
- ```
27
-
28
- This will create `dist/ais-win.exe`.
29
-
30
- ### Step 2: Create Application Icon (Optional)
31
-
32
- If you want a custom icon:
33
-
34
- 1. Create or obtain a `.ico` file (256x256 recommended)
35
- 2. Save it as `installer/windows/ais-icon.ico`
36
- 3. If no icon is provided, the installer will use the default Windows icon
37
-
38
- ### Step 3: Build the Installer
39
-
40
- **Option A: Using Inno Setup GUI (Recommended for first-time)**
41
-
42
- 1. Open Inno Setup Compiler
43
- 2. Click "File" → "Open"
44
- 3. Navigate to `installer/windows/ais-setup.iss`
45
- 4. Click "Build" → "Compile"
46
- 5. The installer will be created in `dist/installer/ais-setup-1.5.1.exe`
47
-
48
- **Option B: Using Command Line**
49
-
50
- ```bash
51
- # On Windows with Inno Setup installed
52
- "C:\Program Files (x86)\Inno Setup 6\ISCC.exe" installer\windows\ais-setup.iss
53
- ```
54
-
55
- **Option C: Using npm script (Add to package.json)**
56
-
57
- Add this to your `package.json` scripts:
58
-
59
- ```json
60
- {
61
- "scripts": {
62
- "build:win": "pkg . --targets node18-win-x64 --output dist/ais-win.exe",
63
- "build:installer": "iscc installer\\windows\\ais-setup.iss",
64
- "build:win-installer": "npm run build:win && npm run build:installer"
65
- }
66
- }
67
- ```
68
-
69
- Then run:
70
- ```bash
71
- npm run build:win-installer
72
- ```
73
-
74
- ## Installer Features
75
-
76
- The generated installer includes:
77
-
78
- - ✅ **Automatic PATH Configuration**: Adds `ais` to system PATH
79
- - ✅ **Modern Wizard Interface**: Clean, professional installation experience
80
- - ✅ **Uninstaller**: Complete removal including PATH cleanup
81
- - ✅ **Multi-language Support**: English and Chinese
82
- - ✅ **User-level Installation**: No admin rights required (installs to user directory)
83
- - ✅ **Desktop Shortcut**: Optional desktop icon
84
- - ✅ **Start Menu Entry**: Adds program to Start Menu
85
-
86
- ## Installation Process for Users
87
-
88
- 1. Download `ais-setup-1.5.1.exe`
89
- 2. Double-click to run
90
- 3. Follow the installation wizard:
91
- - Choose installation directory (default: `C:\Users\<username>\AppData\Local\Programs\AI Account Switch`)
92
- - Select "Add to PATH" option (recommended, checked by default)
93
- - Optionally create desktop shortcut
94
- 4. Click "Install"
95
- 5. Done! Open a new terminal and type `ais --version` to verify
96
-
97
- ## Uninstallation
98
-
99
- Users can uninstall via:
100
- - Start Menu → AI Account Switch → Uninstall
101
- - Windows Settings → Apps → AI Account Switch → Uninstall
102
-
103
- The uninstaller will:
104
- - Remove all installed files
105
- - Remove PATH entry
106
- - Clean up Start Menu entries
107
-
108
- ## Customization
109
-
110
- ### Change App Version
111
-
112
- Edit `ais-setup.iss`:
113
- ```iss
114
- #define MyAppVersion "1.5.1" ; Change this
115
- ```
116
-
117
- ### Change Installation Directory
118
-
119
- Edit `ais-setup.iss`:
120
- ```iss
121
- DefaultDirName={autopf}\{#MyAppName} ; Current: Program Files
122
- ; Or use:
123
- DefaultDirName={localappdata}\Programs\{#MyAppName} ; User directory
124
- ```
125
-
126
- ### Add More Files
127
-
128
- Edit the `[Files]` section in `ais-setup.iss`:
129
- ```iss
130
- [Files]
131
- Source: "path\to\file"; DestDir: "{app}"; Flags: ignoreversion
132
- ```
133
-
134
- ## Troubleshooting
135
-
136
- ### "ISCC.exe not found"
137
-
138
- Make sure Inno Setup is installed and added to PATH, or use the full path:
139
- ```bash
140
- "C:\Program Files (x86)\Inno Setup 6\ISCC.exe" installer\windows\ais-setup.iss
141
- ```
142
-
143
- ### "Source file not found"
144
-
145
- Ensure you've built the executable first:
146
- ```bash
147
- npm run build:win
148
- ```
149
-
150
- ### Icon file missing
151
-
152
- If you don't have an icon file, comment out this line in `ais-setup.iss`:
153
- ```iss
154
- ; SetupIconFile=ais-icon.ico
155
- ```
156
-
157
- ## Distribution
158
-
159
- After building, distribute the installer:
160
-
161
- 1. Upload `dist/installer/ais-setup-1.5.1.exe` to GitHub Releases
162
- 2. Users download and run the installer
163
- 3. No manual PATH configuration needed!
164
-
165
- ## Advantages Over Current Method
166
-
167
- | Feature | Current (Manual) | With Installer |
168
- |---------|-----------------|----------------|
169
- | PATH Setup | Manual | Automatic |
170
- | Uninstall | Manual file deletion | Clean uninstaller |
171
- | User Experience | Complex | One-click install |
172
- | Admin Rights | Sometimes needed | Not required |
173
- | Start Menu Entry | No | Yes |
174
- | Version Management | Manual | Automatic |
175
-
176
- ## Next Steps
177
-
178
- 1. Create an icon file (optional but recommended)
179
- 2. Build the installer
180
- 3. Test on a clean Windows machine
181
- 4. Add to GitHub Actions for automated builds
182
- 5. Update README with new installation instructions