ai-account-switch 1.5.3 → 1.5.5
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 +0 -2
- package/README_ZH.md +0 -2
- package/package.json +1 -1
- package/INSTALL_WINDOWS.md +0 -109
- package/NPM_PUBLISH.md +0 -334
- package/install.bat +0 -103
- package/install.ps1 +0 -128
package/README.md
CHANGED
package/README_ZH.md
CHANGED
package/package.json
CHANGED
package/INSTALL_WINDOWS.md
DELETED
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
# Windows Installation Guide
|
|
2
|
-
|
|
3
|
-
This guide provides detailed instructions for installing AI Account Switch (ais) on Windows.
|
|
4
|
-
|
|
5
|
-
## Quick Install (Recommended)
|
|
6
|
-
|
|
7
|
-
### Method 1: One-Line PowerShell Install
|
|
8
|
-
|
|
9
|
-
Open PowerShell and run:
|
|
10
|
-
|
|
11
|
-
```powershell
|
|
12
|
-
irm https://github.com/yourusername/ai-agent-user-swith/releases/latest/download/install.ps1 | iex
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
This will:
|
|
16
|
-
- Download the latest version
|
|
17
|
-
- Install to `%LOCALAPPDATA%\ais` (no admin rights required)
|
|
18
|
-
- Automatically add to your PATH
|
|
19
|
-
- Verify the installation
|
|
20
|
-
|
|
21
|
-
### Method 2: Download and Run Installer
|
|
22
|
-
|
|
23
|
-
1. Download `install.ps1` or `install.bat` from the [Releases page](https://github.com/yourusername/ai-agent-user-swith/releases)
|
|
24
|
-
2. Right-click `install.ps1` → "Run with PowerShell"
|
|
25
|
-
- Or double-click `install.bat`
|
|
26
|
-
|
|
27
|
-
### System-Wide Installation
|
|
28
|
-
|
|
29
|
-
If you want to install for all users (requires Administrator):
|
|
30
|
-
|
|
31
|
-
```powershell
|
|
32
|
-
# Run PowerShell as Administrator
|
|
33
|
-
irm https://github.com/yourusername/ai-agent-user-swith/releases/latest/download/install.ps1 | iex -SystemWide
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
Or run the downloaded `install.ps1` with the `-SystemWide` parameter:
|
|
37
|
-
|
|
38
|
-
```powershell
|
|
39
|
-
.\install.ps1 -SystemWide
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
This installs to `C:\Program Files\ais` instead of the user directory.
|
|
43
|
-
|
|
44
|
-
## Manual Installation
|
|
45
|
-
|
|
46
|
-
If you prefer to install manually, see the main [README.md](README.md) for detailed instructions.
|
|
47
|
-
|
|
48
|
-
## Verify Installation
|
|
49
|
-
|
|
50
|
-
After installation, open a **new terminal window** and run:
|
|
51
|
-
|
|
52
|
-
```cmd
|
|
53
|
-
ais --version
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
You should see the version number displayed.
|
|
57
|
-
|
|
58
|
-
## Troubleshooting
|
|
59
|
-
|
|
60
|
-
### Command not found
|
|
61
|
-
|
|
62
|
-
If `ais` command is not found after installation:
|
|
63
|
-
|
|
64
|
-
1. Close and reopen your terminal (PATH changes require a new session)
|
|
65
|
-
2. Verify the installation directory is in your PATH:
|
|
66
|
-
```cmd
|
|
67
|
-
echo %PATH%
|
|
68
|
-
```
|
|
69
|
-
3. Re-run the installer
|
|
70
|
-
|
|
71
|
-
### Permission Denied
|
|
72
|
-
|
|
73
|
-
If you get permission errors:
|
|
74
|
-
|
|
75
|
-
1. Run PowerShell as Administrator
|
|
76
|
-
2. Or use the user-local installation (default, no admin required)
|
|
77
|
-
|
|
78
|
-
### Antivirus Blocking
|
|
79
|
-
|
|
80
|
-
Some antivirus software may flag the executable. This is a false positive. You can:
|
|
81
|
-
|
|
82
|
-
1. Add an exception in your antivirus software
|
|
83
|
-
2. Download and verify the file manually from GitHub Releases
|
|
84
|
-
3. Install from npm instead: `npm install -g ai-account-switch`
|
|
85
|
-
|
|
86
|
-
## Uninstallation
|
|
87
|
-
|
|
88
|
-
To uninstall ais:
|
|
89
|
-
|
|
90
|
-
1. Remove the installation directory:
|
|
91
|
-
```cmd
|
|
92
|
-
rmdir /s "%LOCALAPPDATA%\ais"
|
|
93
|
-
```
|
|
94
|
-
Or for system-wide installation:
|
|
95
|
-
```cmd
|
|
96
|
-
rmdir /s "C:\Program Files\ais"
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
2. Remove from PATH:
|
|
100
|
-
- Open "Edit the system environment variables"
|
|
101
|
-
- Click "Environment Variables"
|
|
102
|
-
- Find "Path" and remove the ais directory entry
|
|
103
|
-
|
|
104
|
-
## Alternative Installation Methods
|
|
105
|
-
|
|
106
|
-
- **npm**: `npm install -g ai-account-switch` (requires Node.js)
|
|
107
|
-
- **From source**: Clone the repository and run `npm link`
|
|
108
|
-
|
|
109
|
-
See [README.md](README.md) for more details.
|
package/NPM_PUBLISH.md
DELETED
|
@@ -1,334 +0,0 @@
|
|
|
1
|
-
# NPM Publishing Guide
|
|
2
|
-
|
|
3
|
-
This guide explains how to publish `ai-account-switch` to npm registry.
|
|
4
|
-
|
|
5
|
-
## Prerequisites
|
|
6
|
-
|
|
7
|
-
### 1. Create npm Account
|
|
8
|
-
|
|
9
|
-
If you don't have an npm account:
|
|
10
|
-
|
|
11
|
-
1. Go to https://www.npmjs.com/signup
|
|
12
|
-
2. Create your account
|
|
13
|
-
3. Verify your email
|
|
14
|
-
|
|
15
|
-
### 2. Login to npm
|
|
16
|
-
|
|
17
|
-
Login via command line:
|
|
18
|
-
|
|
19
|
-
```bash
|
|
20
|
-
npm login
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
Enter your:
|
|
24
|
-
- Username
|
|
25
|
-
- Password
|
|
26
|
-
- Email
|
|
27
|
-
- One-time password (if 2FA is enabled)
|
|
28
|
-
|
|
29
|
-
Verify you're logged in:
|
|
30
|
-
|
|
31
|
-
```bash
|
|
32
|
-
npm whoami
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
## Before Publishing
|
|
36
|
-
|
|
37
|
-
### 1. Update Package Information
|
|
38
|
-
|
|
39
|
-
Edit `package.json`:
|
|
40
|
-
|
|
41
|
-
```json
|
|
42
|
-
{
|
|
43
|
-
"name": "ai-account-switch",
|
|
44
|
-
"version": "1.1.0",
|
|
45
|
-
"author": "Your Name <your.email@example.com>",
|
|
46
|
-
"repository": {
|
|
47
|
-
"type": "git",
|
|
48
|
-
"url": "https://github.com/yourusername/ai-agent-user-swith.git"
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
### 2. Check Package Name Availability
|
|
54
|
-
|
|
55
|
-
```bash
|
|
56
|
-
npm view ai-account-switch
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
If it returns an error, the name is available. If not, choose a different name like:
|
|
60
|
-
- `@yourusername/ai-account-switch` (scoped package)
|
|
61
|
-
- `ais-cli`
|
|
62
|
-
- `claude-account-switch`
|
|
63
|
-
|
|
64
|
-
### 3. Test Package Locally
|
|
65
|
-
|
|
66
|
-
```bash
|
|
67
|
-
# Install dependencies
|
|
68
|
-
npm install
|
|
69
|
-
|
|
70
|
-
# Test the CLI works
|
|
71
|
-
npm link
|
|
72
|
-
ais --version
|
|
73
|
-
ais --help
|
|
74
|
-
|
|
75
|
-
# Clean up
|
|
76
|
-
npm unlink
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
### 4. Dry Run
|
|
80
|
-
|
|
81
|
-
Test what will be published:
|
|
82
|
-
|
|
83
|
-
```bash
|
|
84
|
-
npm pack --dry-run
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
Or create a tarball to inspect:
|
|
88
|
-
|
|
89
|
-
```bash
|
|
90
|
-
npm pack
|
|
91
|
-
tar -xzf ai-account-switch-1.1.0.tgz
|
|
92
|
-
ls package/
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
## Publishing
|
|
96
|
-
|
|
97
|
-
### First Time Publication
|
|
98
|
-
|
|
99
|
-
```bash
|
|
100
|
-
# Make sure you're on the main branch
|
|
101
|
-
git checkout main
|
|
102
|
-
|
|
103
|
-
# Make sure everything is committed
|
|
104
|
-
git status
|
|
105
|
-
|
|
106
|
-
# Publish to npm
|
|
107
|
-
npm publish
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
For scoped packages:
|
|
111
|
-
|
|
112
|
-
```bash
|
|
113
|
-
npm publish --access public
|
|
114
|
-
```
|
|
115
|
-
|
|
116
|
-
### Updating a Published Package
|
|
117
|
-
|
|
118
|
-
1. **Update version number** in `package.json`:
|
|
119
|
-
|
|
120
|
-
```bash
|
|
121
|
-
# Patch version (1.1.0 -> 1.1.1)
|
|
122
|
-
npm version patch
|
|
123
|
-
|
|
124
|
-
# Minor version (1.1.0 -> 1.2.0)
|
|
125
|
-
npm version minor
|
|
126
|
-
|
|
127
|
-
# Major version (1.1.0 -> 2.0.0)
|
|
128
|
-
npm version major
|
|
129
|
-
```
|
|
130
|
-
|
|
131
|
-
This command will:
|
|
132
|
-
- Update `package.json`
|
|
133
|
-
- Create a git commit
|
|
134
|
-
- Create a git tag
|
|
135
|
-
|
|
136
|
-
2. **Push changes and tags**:
|
|
137
|
-
|
|
138
|
-
```bash
|
|
139
|
-
git push
|
|
140
|
-
git push --tags
|
|
141
|
-
```
|
|
142
|
-
|
|
143
|
-
3. **Publish to npm**:
|
|
144
|
-
|
|
145
|
-
```bash
|
|
146
|
-
npm publish
|
|
147
|
-
```
|
|
148
|
-
|
|
149
|
-
## After Publishing
|
|
150
|
-
|
|
151
|
-
### 1. Verify Publication
|
|
152
|
-
|
|
153
|
-
Check on npm website:
|
|
154
|
-
```
|
|
155
|
-
https://www.npmjs.com/package/ai-account-switch
|
|
156
|
-
```
|
|
157
|
-
|
|
158
|
-
Or via CLI:
|
|
159
|
-
```bash
|
|
160
|
-
npm view ai-account-switch
|
|
161
|
-
```
|
|
162
|
-
|
|
163
|
-
### 2. Test Installation
|
|
164
|
-
|
|
165
|
-
Test in a clean environment:
|
|
166
|
-
|
|
167
|
-
```bash
|
|
168
|
-
# Install globally
|
|
169
|
-
npm install -g ai-account-switch
|
|
170
|
-
|
|
171
|
-
# Test it works
|
|
172
|
-
ais --version
|
|
173
|
-
ais --help
|
|
174
|
-
|
|
175
|
-
# Uninstall
|
|
176
|
-
npm uninstall -g ai-account-switch
|
|
177
|
-
```
|
|
178
|
-
|
|
179
|
-
### 3. Update README
|
|
180
|
-
|
|
181
|
-
Update installation instructions to reflect the published package:
|
|
182
|
-
|
|
183
|
-
```markdown
|
|
184
|
-
### Option 3: Global npm Installation
|
|
185
|
-
|
|
186
|
-
\`\`\`bash
|
|
187
|
-
npm install -g ai-account-switch
|
|
188
|
-
\`\`\`
|
|
189
|
-
```
|
|
190
|
-
|
|
191
|
-
## Automation with GitHub Actions
|
|
192
|
-
|
|
193
|
-
### Option 1: Automatic NPM Publish on Release
|
|
194
|
-
|
|
195
|
-
Create `.github/workflows/npm-publish.yml`:
|
|
196
|
-
|
|
197
|
-
```yaml
|
|
198
|
-
name: Publish to NPM
|
|
199
|
-
|
|
200
|
-
on:
|
|
201
|
-
release:
|
|
202
|
-
types: [published]
|
|
203
|
-
|
|
204
|
-
jobs:
|
|
205
|
-
publish:
|
|
206
|
-
runs-on: ubuntu-latest
|
|
207
|
-
steps:
|
|
208
|
-
- uses: actions/checkout@v4
|
|
209
|
-
|
|
210
|
-
- uses: actions/setup-node@v4
|
|
211
|
-
with:
|
|
212
|
-
node-version: '18'
|
|
213
|
-
registry-url: 'https://registry.npmjs.org'
|
|
214
|
-
|
|
215
|
-
- run: npm ci
|
|
216
|
-
|
|
217
|
-
- run: npm publish
|
|
218
|
-
env:
|
|
219
|
-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
220
|
-
```
|
|
221
|
-
|
|
222
|
-
### Setup NPM Token in GitHub:
|
|
223
|
-
|
|
224
|
-
1. Generate NPM token:
|
|
225
|
-
```bash
|
|
226
|
-
npm token create
|
|
227
|
-
```
|
|
228
|
-
|
|
229
|
-
2. Add to GitHub:
|
|
230
|
-
- Go to your repository on GitHub
|
|
231
|
-
- Settings → Secrets and variables → Actions
|
|
232
|
-
- New repository secret
|
|
233
|
-
- Name: `NPM_TOKEN`
|
|
234
|
-
- Value: (paste your npm token)
|
|
235
|
-
|
|
236
|
-
## Troubleshooting
|
|
237
|
-
|
|
238
|
-
### Package Name Already Taken
|
|
239
|
-
|
|
240
|
-
Use a scoped package:
|
|
241
|
-
|
|
242
|
-
```json
|
|
243
|
-
{
|
|
244
|
-
"name": "@yourusername/ai-account-switch"
|
|
245
|
-
}
|
|
246
|
-
```
|
|
247
|
-
|
|
248
|
-
### Permission Denied
|
|
249
|
-
|
|
250
|
-
Make sure you're logged in:
|
|
251
|
-
```bash
|
|
252
|
-
npm whoami
|
|
253
|
-
npm login
|
|
254
|
-
```
|
|
255
|
-
|
|
256
|
-
### 2FA Required
|
|
257
|
-
|
|
258
|
-
If you have 2FA enabled, you need to:
|
|
259
|
-
|
|
260
|
-
1. Generate an automation token on npmjs.com
|
|
261
|
-
2. Use it for CI/CD publishing
|
|
262
|
-
|
|
263
|
-
### Version Already Published
|
|
264
|
-
|
|
265
|
-
You cannot republish the same version. Update version:
|
|
266
|
-
|
|
267
|
-
```bash
|
|
268
|
-
npm version patch
|
|
269
|
-
npm publish
|
|
270
|
-
```
|
|
271
|
-
|
|
272
|
-
## Best Practices
|
|
273
|
-
|
|
274
|
-
1. **Semantic Versioning**: Follow semver (MAJOR.MINOR.PATCH)
|
|
275
|
-
2. **Test Before Publishing**: Always test locally first
|
|
276
|
-
3. **Keep README Updated**: Ensure documentation is current
|
|
277
|
-
4. **Changelog**: Maintain a changelog in README.md
|
|
278
|
-
5. **Clean Package**: Use `.npmignore` to exclude unnecessary files
|
|
279
|
-
6. **License**: Include appropriate license (MIT)
|
|
280
|
-
|
|
281
|
-
## Unpublishing (Emergency Only)
|
|
282
|
-
|
|
283
|
-
**Warning**: Only unpublish in emergency situations (security issues, etc.)
|
|
284
|
-
|
|
285
|
-
```bash
|
|
286
|
-
# Unpublish specific version
|
|
287
|
-
npm unpublish ai-account-switch@1.1.0
|
|
288
|
-
|
|
289
|
-
# Unpublish all versions (within 72 hours of publish)
|
|
290
|
-
npm unpublish ai-account-switch --force
|
|
291
|
-
```
|
|
292
|
-
|
|
293
|
-
After 72 hours, you cannot unpublish. Instead, publish a new version.
|
|
294
|
-
|
|
295
|
-
## Package Maintenance
|
|
296
|
-
|
|
297
|
-
### Deprecate a Version
|
|
298
|
-
|
|
299
|
-
```bash
|
|
300
|
-
npm deprecate ai-account-switch@1.0.0 "Please upgrade to 1.1.0"
|
|
301
|
-
```
|
|
302
|
-
|
|
303
|
-
### Add Collaborators
|
|
304
|
-
|
|
305
|
-
```bash
|
|
306
|
-
npm owner add username ai-account-switch
|
|
307
|
-
```
|
|
308
|
-
|
|
309
|
-
### View Package Stats
|
|
310
|
-
|
|
311
|
-
```bash
|
|
312
|
-
npm view ai-account-switch
|
|
313
|
-
|
|
314
|
-
# Download stats
|
|
315
|
-
npm view ai-account-switch time
|
|
316
|
-
```
|
|
317
|
-
|
|
318
|
-
## Checklist Before Publishing
|
|
319
|
-
|
|
320
|
-
- [ ] All tests pass
|
|
321
|
-
- [ ] Version number updated
|
|
322
|
-
- [ ] README.md is current
|
|
323
|
-
- [ ] CHANGELOG updated
|
|
324
|
-
- [ ] `.npmignore` configured
|
|
325
|
-
- [ ] `package.json` has correct info
|
|
326
|
-
- [ ] Tested with `npm pack`
|
|
327
|
-
- [ ] Logged into npm
|
|
328
|
-
- [ ] Git committed and pushed
|
|
329
|
-
|
|
330
|
-
## Resources
|
|
331
|
-
|
|
332
|
-
- [npm Documentation](https://docs.npmjs.com/)
|
|
333
|
-
- [Semantic Versioning](https://semver.org/)
|
|
334
|
-
- [npm Publishing Guide](https://docs.npmjs.com/packages-and-modules/contributing-packages-to-the-registry)
|
package/install.bat
DELETED
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
@echo off
|
|
2
|
-
REM AI Account Switch (ais) - Windows Installer (Batch)
|
|
3
|
-
REM This script downloads and installs ais, automatically adding it to PATH
|
|
4
|
-
|
|
5
|
-
setlocal enabledelayedexpansion
|
|
6
|
-
|
|
7
|
-
echo ==========================================
|
|
8
|
-
echo AI Account Switch (ais) Installer
|
|
9
|
-
echo ==========================================
|
|
10
|
-
echo.
|
|
11
|
-
|
|
12
|
-
REM Determine installation directory (user-local by default)
|
|
13
|
-
set "INSTALL_DIR=%LOCALAPPDATA%\ais"
|
|
14
|
-
set "PATH_SCOPE=User"
|
|
15
|
-
|
|
16
|
-
echo Installing for current user
|
|
17
|
-
echo Installation directory: %INSTALL_DIR%
|
|
18
|
-
echo.
|
|
19
|
-
|
|
20
|
-
REM Create installation directory
|
|
21
|
-
if not exist "%INSTALL_DIR%" (
|
|
22
|
-
echo Creating installation directory...
|
|
23
|
-
mkdir "%INSTALL_DIR%"
|
|
24
|
-
)
|
|
25
|
-
|
|
26
|
-
REM Download using PowerShell (available on all modern Windows)
|
|
27
|
-
set "EXE_PATH=%INSTALL_DIR%\ais.exe"
|
|
28
|
-
set "DOWNLOAD_URL=https://github.com/yourusername/ai-agent-user-swith/releases/latest/download/ais-win.exe"
|
|
29
|
-
|
|
30
|
-
echo Downloading latest release...
|
|
31
|
-
echo From: %DOWNLOAD_URL%
|
|
32
|
-
echo.
|
|
33
|
-
|
|
34
|
-
powershell -Command "& {[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; Invoke-WebRequest -Uri '%DOWNLOAD_URL%' -OutFile '%EXE_PATH%'}"
|
|
35
|
-
|
|
36
|
-
if %errorlevel% neq 0 (
|
|
37
|
-
echo [ERROR] Failed to download ais-win.exe
|
|
38
|
-
echo Please check your internet connection and try again.
|
|
39
|
-
pause
|
|
40
|
-
exit /b 1
|
|
41
|
-
)
|
|
42
|
-
|
|
43
|
-
echo [OK] Downloaded successfully
|
|
44
|
-
echo.
|
|
45
|
-
|
|
46
|
-
REM Add to PATH
|
|
47
|
-
echo Adding to PATH...
|
|
48
|
-
|
|
49
|
-
REM Check if already in PATH
|
|
50
|
-
echo %PATH% | findstr /C:"%INSTALL_DIR%" >nul
|
|
51
|
-
if %errorlevel% equ 0 (
|
|
52
|
-
echo [OK] Already in PATH
|
|
53
|
-
) else (
|
|
54
|
-
REM Use PowerShell to update PATH permanently
|
|
55
|
-
powershell -Command "& {$path = [Environment]::GetEnvironmentVariable('Path', 'User'); if ($path -notlike '*%INSTALL_DIR%*') { [Environment]::SetEnvironmentVariable('Path', $path + ';%INSTALL_DIR%', 'User') }}"
|
|
56
|
-
|
|
57
|
-
if !errorlevel! equ 0 (
|
|
58
|
-
echo [OK] Added to PATH
|
|
59
|
-
REM Update current session PATH
|
|
60
|
-
set "PATH=%PATH%;%INSTALL_DIR%"
|
|
61
|
-
) else (
|
|
62
|
-
echo [WARNING] Could not add to PATH automatically
|
|
63
|
-
echo Please add the following to your PATH manually:
|
|
64
|
-
echo %INSTALL_DIR%
|
|
65
|
-
)
|
|
66
|
-
)
|
|
67
|
-
|
|
68
|
-
echo.
|
|
69
|
-
echo Verifying installation...
|
|
70
|
-
|
|
71
|
-
REM Test the executable
|
|
72
|
-
"%EXE_PATH%" --version >nul 2>&1
|
|
73
|
-
if %errorlevel% equ 0 (
|
|
74
|
-
echo [OK] Installation successful!
|
|
75
|
-
echo.
|
|
76
|
-
echo ==========================================
|
|
77
|
-
echo Installation Complete!
|
|
78
|
-
echo ==========================================
|
|
79
|
-
echo.
|
|
80
|
-
|
|
81
|
-
REM Display version
|
|
82
|
-
"%EXE_PATH%" --version
|
|
83
|
-
|
|
84
|
-
echo.
|
|
85
|
-
echo Installed to: %EXE_PATH%
|
|
86
|
-
echo.
|
|
87
|
-
echo You can now use 'ais' command in a new terminal window.
|
|
88
|
-
echo.
|
|
89
|
-
echo Quick start:
|
|
90
|
-
echo ais add - Add a new account
|
|
91
|
-
echo ais list - List all accounts
|
|
92
|
-
echo ais use - Set account for current project
|
|
93
|
-
echo ais help - Show all commands
|
|
94
|
-
echo.
|
|
95
|
-
echo [NOTE] Please restart your terminal or open a new one for PATH changes to take effect.
|
|
96
|
-
) else (
|
|
97
|
-
echo [WARNING] Installation may have issues
|
|
98
|
-
echo Installed to: %EXE_PATH%
|
|
99
|
-
echo Please verify manually by running: "%EXE_PATH%" --version
|
|
100
|
-
)
|
|
101
|
-
|
|
102
|
-
echo.
|
|
103
|
-
pause
|
package/install.ps1
DELETED
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
# AI Account Switch (ais) - Windows Installer
|
|
2
|
-
# This script downloads and installs ais, automatically adding it to PATH
|
|
3
|
-
|
|
4
|
-
param(
|
|
5
|
-
[string]$InstallDir = "$env:LOCALAPPDATA\ais",
|
|
6
|
-
[switch]$SystemWide = $false
|
|
7
|
-
)
|
|
8
|
-
|
|
9
|
-
$ErrorActionPreference = "Stop"
|
|
10
|
-
|
|
11
|
-
# Colors
|
|
12
|
-
function Write-ColorOutput($ForegroundColor) {
|
|
13
|
-
$fc = $host.UI.RawUI.ForegroundColor
|
|
14
|
-
$host.UI.RawUI.ForegroundColor = $ForegroundColor
|
|
15
|
-
if ($args) {
|
|
16
|
-
Write-Output $args
|
|
17
|
-
}
|
|
18
|
-
$host.UI.RawUI.ForegroundColor = $fc
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
Write-ColorOutput Green "=========================================="
|
|
22
|
-
Write-ColorOutput Green " AI Account Switch (ais) Installer"
|
|
23
|
-
Write-ColorOutput Green "=========================================="
|
|
24
|
-
Write-Output ""
|
|
25
|
-
|
|
26
|
-
# Determine installation directory
|
|
27
|
-
if ($SystemWide) {
|
|
28
|
-
$InstallDir = "$env:ProgramFiles\ais"
|
|
29
|
-
$PathScope = "Machine"
|
|
30
|
-
Write-Output "Installing system-wide (requires administrator privileges)"
|
|
31
|
-
} else {
|
|
32
|
-
$InstallDir = "$env:LOCALAPPDATA\ais"
|
|
33
|
-
$PathScope = "User"
|
|
34
|
-
Write-Output "Installing for current user"
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
Write-Output "Installation directory: $InstallDir"
|
|
38
|
-
Write-Output ""
|
|
39
|
-
|
|
40
|
-
# Create installation directory
|
|
41
|
-
if (!(Test-Path $InstallDir)) {
|
|
42
|
-
Write-Output "Creating installation directory..."
|
|
43
|
-
New-Item -ItemType Directory -Path $InstallDir -Force | Out-Null
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
# Download the latest release
|
|
47
|
-
$LatestReleaseUrl = "https://api.github.com/repos/yourusername/ai-agent-user-swith/releases/latest"
|
|
48
|
-
$ExePath = Join-Path $InstallDir "ais.exe"
|
|
49
|
-
|
|
50
|
-
Write-Output "Downloading latest release..."
|
|
51
|
-
try {
|
|
52
|
-
$release = Invoke-RestMethod -Uri $LatestReleaseUrl
|
|
53
|
-
$asset = $release.assets | Where-Object { $_.name -eq "ais-win.exe" }
|
|
54
|
-
|
|
55
|
-
if (!$asset) {
|
|
56
|
-
throw "Could not find ais-win.exe in the latest release"
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
$downloadUrl = $asset.browser_download_url
|
|
60
|
-
Write-Output "Downloading from: $downloadUrl"
|
|
61
|
-
|
|
62
|
-
# Download with progress
|
|
63
|
-
$ProgressPreference = 'SilentlyContinue'
|
|
64
|
-
Invoke-WebRequest -Uri $downloadUrl -OutFile $ExePath
|
|
65
|
-
$ProgressPreference = 'Continue'
|
|
66
|
-
|
|
67
|
-
Write-ColorOutput Green "✓ Downloaded successfully"
|
|
68
|
-
} catch {
|
|
69
|
-
Write-ColorOutput Red "Failed to download: $_"
|
|
70
|
-
exit 1
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
# Add to PATH if not already there
|
|
74
|
-
Write-Output ""
|
|
75
|
-
Write-Output "Adding to PATH..."
|
|
76
|
-
|
|
77
|
-
$currentPath = [Environment]::GetEnvironmentVariable("Path", $PathScope)
|
|
78
|
-
|
|
79
|
-
if ($currentPath -notlike "*$InstallDir*") {
|
|
80
|
-
try {
|
|
81
|
-
$newPath = $currentPath + ";$InstallDir"
|
|
82
|
-
[Environment]::SetEnvironmentVariable("Path", $newPath, $PathScope)
|
|
83
|
-
Write-ColorOutput Green "✓ Added to PATH"
|
|
84
|
-
|
|
85
|
-
# Update current session PATH
|
|
86
|
-
$env:Path = [System.Environment]::GetEnvironmentVariable("Path", "Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path", "User")
|
|
87
|
-
|
|
88
|
-
} catch {
|
|
89
|
-
Write-ColorOutput Yellow "! Could not add to PATH automatically"
|
|
90
|
-
Write-Output "Please add the following to your PATH manually:"
|
|
91
|
-
Write-Output " $InstallDir"
|
|
92
|
-
}
|
|
93
|
-
} else {
|
|
94
|
-
Write-ColorOutput Green "✓ Already in PATH"
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
# Verify installation
|
|
98
|
-
Write-Output ""
|
|
99
|
-
Write-Output "Verifying installation..."
|
|
100
|
-
|
|
101
|
-
try {
|
|
102
|
-
$version = & $ExePath --version 2>&1
|
|
103
|
-
Write-ColorOutput Green "✓ Installation successful!"
|
|
104
|
-
Write-Output ""
|
|
105
|
-
Write-ColorOutput Green "=========================================="
|
|
106
|
-
Write-ColorOutput Green " Installation Complete!"
|
|
107
|
-
Write-ColorOutput Green "=========================================="
|
|
108
|
-
Write-Output ""
|
|
109
|
-
Write-Output "Version: $version"
|
|
110
|
-
Write-Output "Installed to: $ExePath"
|
|
111
|
-
Write-Output ""
|
|
112
|
-
Write-Output "You can now use 'ais' command in a new terminal window."
|
|
113
|
-
Write-Output ""
|
|
114
|
-
Write-Output "Quick start:"
|
|
115
|
-
Write-Output " ais add - Add a new account"
|
|
116
|
-
Write-Output " ais list - List all accounts"
|
|
117
|
-
Write-Output " ais use - Set account for current project"
|
|
118
|
-
Write-Output " ais help - Show all commands"
|
|
119
|
-
Write-Output ""
|
|
120
|
-
Write-ColorOutput Yellow "Note: Please restart your terminal or open a new one for PATH changes to take effect."
|
|
121
|
-
|
|
122
|
-
} catch {
|
|
123
|
-
Write-ColorOutput Red "Installation may have issues. Error: $_"
|
|
124
|
-
Write-Output ""
|
|
125
|
-
Write-Output "Installed to: $ExePath"
|
|
126
|
-
Write-Output "Please verify manually by running: $ExePath --version"
|
|
127
|
-
exit 1
|
|
128
|
-
}
|