swixter 0.0.12 → 0.1.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 +200 -358
- package/dist/cli/index.js +6427 -4246
- package/dist/ui/assets/index-BZfYEnvW.js +64 -0
- package/dist/ui/assets/index-UfMymq91.css +1 -0
- package/dist/ui/index.html +14 -0
- package/dist/ui/vite.svg +4 -0
- package/package.json +13 -6
package/README.md
CHANGED
|
@@ -2,9 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/swixter)
|
|
4
4
|
[](https://github.com/dawnswwwww/swixter/actions/workflows/test.yml)
|
|
5
|
-
[](https://github.com/dawnswwwww/swixter/actions/workflows/
|
|
5
|
+
[](https://github.com/dawnswwwww/swixter/actions/workflows/release.yml)
|
|
6
6
|
[](https://opensource.org/licenses/MIT)
|
|
7
|
-
[](https://nodejs.org)
|
|
8
7
|
|
|
9
8
|
> Make AI coding tools effortlessly switchable
|
|
10
9
|
|
|
@@ -12,58 +11,42 @@ A lightweight CLI tool that makes it easy to switch between AI providers for Cla
|
|
|
12
11
|
|
|
13
12
|
## Why Swixter?
|
|
14
13
|
|
|
15
|
-
Working with AI coding tools shouldn't be complicated. Swixter lets you:
|
|
16
|
-
|
|
17
14
|
- **Switch providers instantly** - Change between Anthropic, Ollama, or custom APIs with one command
|
|
18
|
-
- **
|
|
19
|
-
- **
|
|
20
|
-
- **
|
|
21
|
-
- **
|
|
22
|
-
- **
|
|
23
|
-
- **Web UI** - Browser-based interface for visual configuration management
|
|
15
|
+
- **Automatic failover** - Group profiles by priority, auto-retry on provider failure
|
|
16
|
+
- **Local proxy** - Transparent proxy with circuit breaker, your tools won't even notice a provider goes down
|
|
17
|
+
- **Multiple coders** - Works with Claude Code, Codex, Continue
|
|
18
|
+
- **Web UI** - Browser-based interface for visual management
|
|
19
|
+
- **All local** - No cloud dependencies, your keys stay on your machine
|
|
24
20
|
|
|
25
21
|
## Installation
|
|
26
22
|
|
|
27
|
-
### npm (Recommended)
|
|
28
|
-
|
|
29
23
|
```bash
|
|
24
|
+
# npm (Recommended)
|
|
30
25
|
npm install -g swixter
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
### npx (No Install Needed)
|
|
34
26
|
|
|
35
|
-
|
|
27
|
+
# npx (No Install Needed)
|
|
36
28
|
npx swixter --help
|
|
37
29
|
```
|
|
38
30
|
|
|
39
|
-
### Platform Support
|
|
40
|
-
|
|
41
31
|
| Platform | Status | Notes |
|
|
42
32
|
|----------|--------|-------|
|
|
43
|
-
| **Linux** |
|
|
44
|
-
| **macOS** |
|
|
45
|
-
| **Windows 10/11** |
|
|
33
|
+
| **Linux** | Full | |
|
|
34
|
+
| **macOS** | Full | |
|
|
35
|
+
| **Windows 10/11** | Full | Requires Node.js 18+ |
|
|
46
36
|
|
|
47
37
|
Config stored at:
|
|
48
38
|
- **Linux/macOS**: `~/.config/swixter/`
|
|
49
|
-
- **Windows**: `~/swixter/`
|
|
50
|
-
|
|
51
|
-
See [docs/WINDOWS.md](docs/WINDOWS.md) for detailed Windows guide.
|
|
39
|
+
- **Windows**: `~/swixter/`
|
|
52
40
|
|
|
53
41
|
## Quick Start
|
|
54
42
|
|
|
55
43
|
```bash
|
|
56
|
-
# Interactive mode
|
|
57
|
-
swixter
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
swixter claude
|
|
61
|
-
swixter
|
|
62
|
-
swixter claude switch my-profile # Switch profile
|
|
63
|
-
swixter claude apply # Apply to Claude Code
|
|
64
|
-
|
|
65
|
-
# Launch Web UI (browser-based management)
|
|
66
|
-
swixter ui
|
|
44
|
+
swixter # Interactive mode
|
|
45
|
+
swixter claude create # Create profile
|
|
46
|
+
swixter claude list # List profiles
|
|
47
|
+
swixter claude switch my-profile # Switch profile
|
|
48
|
+
swixter claude apply # Apply to Claude Code
|
|
49
|
+
swixter ui # Launch Web UI
|
|
67
50
|
```
|
|
68
51
|
|
|
69
52
|
## Built-in Providers
|
|
@@ -71,338 +54,257 @@ swixter ui
|
|
|
71
54
|
| Provider | API Type | Description |
|
|
72
55
|
|----------|----------|-------------|
|
|
73
56
|
| **Anthropic** | responses | Official Claude API |
|
|
74
|
-
| **Ollama** | chat | Run
|
|
57
|
+
| **Ollama** | chat | Run models locally |
|
|
75
58
|
| **OpenAI** | chat | OpenAI API |
|
|
76
59
|
| **OpenRouter** | chat | Unified access to 100+ models |
|
|
77
|
-
| **Custom** | chat |
|
|
78
|
-
|
|
79
|
-
## Web UI
|
|
60
|
+
| **Custom** | chat | Any OpenAI-compatible API |
|
|
80
61
|
|
|
81
|
-
|
|
62
|
+
## Profile Management
|
|
82
63
|
|
|
83
|
-
|
|
64
|
+
Profiles are configuration templates containing provider, API key, base URL, and model settings. Each coder maintains its own active profile.
|
|
84
65
|
|
|
85
|
-
|
|
86
|
-
- **Profiles** - Create, edit, delete configuration profiles
|
|
87
|
-
- **Providers** - Manage custom API providers
|
|
88
|
-
- **Settings** - Import/export configurations
|
|
89
|
-
|
|
90
|
-
### Running the Web UI
|
|
66
|
+
### Commands (take Claude Code as example)
|
|
91
67
|
|
|
92
68
|
```bash
|
|
93
|
-
#
|
|
94
|
-
swixter
|
|
95
|
-
|
|
96
|
-
#
|
|
97
|
-
swixter
|
|
69
|
+
swixter claude create # Interactive creation (alias: new)
|
|
70
|
+
swixter claude create --quiet --name my --provider anthropic --api-key sk-ant-xxx # Non-interactive
|
|
71
|
+
swixter claude list # List profiles (alias: ls)
|
|
72
|
+
swixter claude switch <name> # Switch active profile (alias: sw)
|
|
73
|
+
swixter claude apply # Write config to ~/.claude/settings.json
|
|
74
|
+
swixter claude run # Run Claude Code with current profile (alias: r)
|
|
75
|
+
swixter claude edit <name> # Edit profile (alias: update)
|
|
76
|
+
swixter claude current # Show active profile
|
|
77
|
+
swixter claude delete <name> # Delete profile (alias: rm)
|
|
78
|
+
swixter claude install # Install Claude Code CLI
|
|
79
|
+
swixter claude update-cli # Update CLI (alias: upgrade)
|
|
98
80
|
```
|
|
99
81
|
|
|
100
|
-
|
|
82
|
+
Codex and Qwen/Continue have the same command structure: `swixter codex <command>` / `swixter qwen <command>`.
|
|
101
83
|
|
|
102
|
-
###
|
|
84
|
+
### Model Configuration
|
|
103
85
|
|
|
104
|
-
|
|
105
|
-
- All installed coders (Claude Code, Codex, Continue)
|
|
106
|
-
- Current active profile per coder
|
|
107
|
-
- Quick profile switching via dropdown
|
|
108
|
-
- One-click Apply to write config to coder's settings file
|
|
86
|
+
**Claude Code** - set per-profile models:
|
|
109
87
|
|
|
110
|
-
|
|
88
|
+
```bash
|
|
89
|
+
swixter claude create \
|
|
90
|
+
--name production \
|
|
91
|
+
--provider anthropic \
|
|
92
|
+
--api-key sk-ant-xxx \
|
|
93
|
+
--anthropic-model claude-sonnet-4-20250514 \
|
|
94
|
+
--default-haiku-model claude-haiku-4-20250506 \
|
|
95
|
+
--default-opus-model claude-opus-4-20250514
|
|
96
|
+
```
|
|
111
97
|
|
|
112
|
-
|
|
98
|
+
| Flag | Env Variable | Description |
|
|
99
|
+
|------|-------------|-------------|
|
|
100
|
+
| `--anthropic-model` | `ANTHROPIC_MODEL` | Default model |
|
|
101
|
+
| `--default-haiku-model` | `ANTHROPIC_DEFAULT_HAIKU_MODEL` | Haiku model |
|
|
102
|
+
| `--default-opus-model` | `ANTHROPIC_DEFAULT_OPUS_MODEL` | Opus model |
|
|
103
|
+
| `--default-sonnet-model` | `ANTHROPIC_DEFAULT_SONNET_MODEL` | Sonnet model |
|
|
104
|
+
|
|
105
|
+
**Codex/Qwen** - single model field:
|
|
113
106
|
|
|
114
107
|
```bash
|
|
115
|
-
swixter
|
|
116
|
-
swixter claude list # List all profiles (alias: ls)
|
|
117
|
-
swixter claude switch <name> # Switch active profile (alias: sw)
|
|
118
|
-
swixter claude apply # Apply to Claude Code
|
|
119
|
-
swixter claude run # Run Claude Code with current profile (alias: r)
|
|
120
|
-
swixter claude edit <name> # Edit existing profile (alias: update)
|
|
121
|
-
swixter claude current # Show current active profile
|
|
122
|
-
swixter claude delete <name> # Delete profile (alias: rm)
|
|
123
|
-
swixter claude install # Install Claude Code CLI
|
|
124
|
-
swixter claude update-cli # Update Claude Code CLI (alias: upgrade)
|
|
108
|
+
swixter codex create --name local --provider ollama --model qwen3:32b
|
|
125
109
|
```
|
|
126
110
|
|
|
127
|
-
###
|
|
111
|
+
### Custom Providers
|
|
128
112
|
|
|
129
113
|
```bash
|
|
130
|
-
swixter
|
|
131
|
-
swixter
|
|
132
|
-
swixter
|
|
133
|
-
swixter
|
|
134
|
-
swixter codex run # Apply + set env + run codex (alias: r)
|
|
135
|
-
swixter codex edit <name> # Edit existing profile (alias: update)
|
|
136
|
-
swixter codex current # Show current active profile
|
|
137
|
-
swixter codex delete <name> # Delete profile (alias: rm)
|
|
138
|
-
swixter codex install # Install Codex CLI
|
|
139
|
-
swixter codex update-cli # Update Codex CLI (alias: upgrade)
|
|
114
|
+
swixter providers add
|
|
115
|
+
swixter providers list
|
|
116
|
+
swixter providers remove <id>
|
|
117
|
+
swixter providers show <id>
|
|
140
118
|
```
|
|
141
119
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
1. **Quick way** (recommended): `swixter codex r`
|
|
145
|
-
- Automatically applies profile to config.toml
|
|
146
|
-
- Sets environment variables
|
|
147
|
-
- Runs codex in one command
|
|
120
|
+
## Groups (Failover)
|
|
148
121
|
|
|
149
|
-
|
|
150
|
-
- Good for debugging or custom setups
|
|
122
|
+
Groups are ordered lists of profiles used for **automatic failover**. When one provider fails, the next profile in the group is tried automatically.
|
|
151
123
|
|
|
152
|
-
###
|
|
124
|
+
### How It Works
|
|
153
125
|
|
|
154
|
-
```
|
|
155
|
-
|
|
156
|
-
swixter qwen list # List all profiles (alias: ls)
|
|
157
|
-
swixter qwen switch <name> # Switch active profile (alias: sw)
|
|
158
|
-
swixter qwen apply # Apply to Continue
|
|
159
|
-
swixter qwen run # Run Qwen Code with current profile (alias: r)
|
|
160
|
-
swixter qwen edit <name> # Edit existing profile (alias: update)
|
|
161
|
-
swixter qwen current # Show current active profile
|
|
162
|
-
swixter qwen delete <name> # Delete profile (alias: rm)
|
|
163
|
-
swixter qwen install # Install Qwen Code CLI
|
|
164
|
-
swixter qwen update-cli # Update Qwen Code CLI (alias: upgrade)
|
|
126
|
+
```
|
|
127
|
+
Request → Proxy → Profile 1 (Anthropic) → Fail! → Profile 2 (OpenRouter) → Success → Response
|
|
165
128
|
```
|
|
166
129
|
|
|
167
|
-
|
|
130
|
+
Each group defines a priority order. The proxy tries profiles from highest to lowest priority until one succeeds.
|
|
131
|
+
|
|
132
|
+
### Commands
|
|
168
133
|
|
|
169
134
|
```bash
|
|
170
|
-
swixter
|
|
171
|
-
swixter
|
|
172
|
-
swixter
|
|
173
|
-
swixter
|
|
135
|
+
swixter group create # Interactive creation (alias: new)
|
|
136
|
+
swixter group list # List groups (alias: ls)
|
|
137
|
+
swixter group show <name> # Show group details with profile order (alias: info)
|
|
138
|
+
swixter group edit <name> # Edit group name and profiles (alias: update)
|
|
139
|
+
swixter group set-default <name> # Set as default group
|
|
140
|
+
swixter group delete <name> # Delete group (alias: rm)
|
|
174
141
|
```
|
|
175
142
|
|
|
176
|
-
###
|
|
143
|
+
### Example
|
|
177
144
|
|
|
178
145
|
```bash
|
|
179
|
-
|
|
180
|
-
swixter
|
|
181
|
-
swixter
|
|
182
|
-
swixter
|
|
183
|
-
swixter import <file> # Import configs
|
|
184
|
-
swixter import <file> --overwrite # Overwrite existing profiles
|
|
185
|
-
swixter completion bash # Bash completion
|
|
186
|
-
swixter completion zsh # Zsh completion
|
|
187
|
-
swixter completion fish # Fish completion
|
|
188
|
-
```
|
|
146
|
+
# Create profiles for different providers
|
|
147
|
+
swixter claude create --name anthropic-primary --provider anthropic --api-key sk-ant-xxx
|
|
148
|
+
swixter claude create --name openrouter-backup --provider openrouter --api-key sk-or-xxx
|
|
149
|
+
swixter claude create --name ollama-local --provider ollama
|
|
189
150
|
|
|
190
|
-
|
|
151
|
+
# Create a group with failover priority
|
|
152
|
+
swixter group create --name ha-group --profiles anthropic-primary,openrouter-backup,ollama-local
|
|
191
153
|
|
|
192
|
-
|
|
154
|
+
# Set as default
|
|
155
|
+
swixter group set-default ha-group
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
### Web UI
|
|
193
159
|
|
|
194
|
-
|
|
160
|
+
Manage groups visually with drag-and-drop profile reordering:
|
|
195
161
|
|
|
196
162
|
```bash
|
|
197
|
-
swixter
|
|
198
|
-
--name production \
|
|
199
|
-
--provider anthropic \
|
|
200
|
-
--api-key sk-ant-xxx \
|
|
201
|
-
--anthropic-model claude-sonnet-4-20250514 \
|
|
202
|
-
--default-haiku-model claude-haiku-4-20250506 \
|
|
203
|
-
--default-opus-model claude-opus-4-20250514 \
|
|
204
|
-
--default-sonnet-model claude-sonnet-4-20250514
|
|
163
|
+
swixter ui # Open Groups page to create/reorder groups
|
|
205
164
|
```
|
|
206
165
|
|
|
207
|
-
|
|
208
|
-
|------|---------------------|-------------|
|
|
209
|
-
| `--anthropic-model` | `ANTHROPIC_MODEL` | Default model |
|
|
210
|
-
| `--default-haiku-model` | `ANTHROPIC_DEFAULT_HAIKU_MODEL` | Haiku model |
|
|
211
|
-
| `--default-opus-model` | `ANTHROPIC_DEFAULT_OPUS_MODEL` | Opus model |
|
|
212
|
-
| `--default-sonnet-model` | `ANTHROPIC_DEFAULT_SONNET_MODEL` | Sonnet model |
|
|
166
|
+
## Proxy
|
|
213
167
|
|
|
214
|
-
|
|
168
|
+
The local proxy server sits between your AI coding tools and upstream providers, enabling automatic failover, circuit breaking, and unified access.
|
|
215
169
|
|
|
216
|
-
|
|
217
|
-
swixter codex create \
|
|
218
|
-
--name local-ollama \
|
|
219
|
-
--provider ollama \
|
|
220
|
-
--base-url http://localhost:11434 \
|
|
221
|
-
--model qwen3:32b
|
|
222
|
-
```
|
|
170
|
+
### How It Works
|
|
223
171
|
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
```json
|
|
231
|
-
{
|
|
232
|
-
"profiles": {
|
|
233
|
-
"my-profile": {
|
|
234
|
-
"name": "my-profile",
|
|
235
|
-
"providerId": "anthropic",
|
|
236
|
-
"apiKey": "sk-ant-xxx",
|
|
237
|
-
"authToken": "sk-ant-auth-xxx",
|
|
238
|
-
"baseURL": "https://api.anthropic.com",
|
|
239
|
-
"models": {
|
|
240
|
-
"anthropicModel": "claude-sonnet-4-20250514",
|
|
241
|
-
"defaultHaikuModel": "claude-haiku-4-20250506",
|
|
242
|
-
"defaultOpusModel": "claude-opus-4-20250514",
|
|
243
|
-
"defaultSonnetModel": "claude-sonnet-4-20250514"
|
|
244
|
-
},
|
|
245
|
-
"envKey": "CUSTOM_API_KEY",
|
|
246
|
-
"headers": {
|
|
247
|
-
"X-Custom-Header": "value"
|
|
248
|
-
},
|
|
249
|
-
"createdAt": "2024-01-01T00:00:00.000Z",
|
|
250
|
-
"updatedAt": "2024-01-01T00:00:00.000Z"
|
|
251
|
-
},
|
|
252
|
-
"ollama-local": {
|
|
253
|
-
"name": "ollama-local",
|
|
254
|
-
"providerId": "ollama",
|
|
255
|
-
"apiKey": "",
|
|
256
|
-
"baseURL": "http://localhost:11434",
|
|
257
|
-
"model": "qwen3:32b"
|
|
258
|
-
}
|
|
259
|
-
},
|
|
260
|
-
"coders": {
|
|
261
|
-
"claude": {
|
|
262
|
-
"activeProfile": "my-profile"
|
|
263
|
-
},
|
|
264
|
-
"codex": {
|
|
265
|
-
"activeProfile": "ollama-local"
|
|
266
|
-
},
|
|
267
|
-
"qwen": {
|
|
268
|
-
"activeProfile": ""
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
}
|
|
172
|
+
```
|
|
173
|
+
┌─────────────┐ ┌──────────────────┐ ┌──────────────┐
|
|
174
|
+
│ Claude Code │────▶│ Swixter Proxy │────▶│ Anthropic │
|
|
175
|
+
│ Codex │ │ (localhost) │─ ─ ▶│ OpenRouter │
|
|
176
|
+
│ Continue │ │ Circuit Breaker │─ ─ ▶│ Ollama │
|
|
177
|
+
└─────────────┘ └──────────────────┘ └──────────────┘
|
|
272
178
|
```
|
|
273
179
|
|
|
274
|
-
|
|
180
|
+
Key capabilities:
|
|
275
181
|
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
182
|
+
- **Failover** - Tries profiles in group priority order, returns first successful response
|
|
183
|
+
- **Circuit Breaker** - Skips providers that failed 3 consecutive times, auto-recovers after 60s
|
|
184
|
+
- **Streaming** - Transparently forwards SSE/NDJSON streaming responses
|
|
185
|
+
- **Multi-format** - Supports both OpenAI Chat (`/v1/chat/completions`) and Anthropic (`/v1/messages`, `/v1/responses`) APIs
|
|
186
|
+
- **Model Rewriting** - Different providers in a group can use different model names; the proxy rewrites them automatically
|
|
279
187
|
|
|
280
|
-
|
|
281
|
-
swixter providers add \
|
|
282
|
-
--id openrouter \
|
|
283
|
-
--name "OpenRouter" \
|
|
284
|
-
--display-name "OpenRouter" \
|
|
285
|
-
--base-url "https://openrouter.ai/api/v1" \
|
|
286
|
-
--auth-type bearer
|
|
188
|
+
### Commands
|
|
287
189
|
|
|
288
|
-
|
|
289
|
-
|
|
190
|
+
```bash
|
|
191
|
+
# Start proxy as a background service
|
|
192
|
+
swixter proxy start # Start with default group
|
|
193
|
+
swixter proxy start --group ha-group # Start with specific group
|
|
194
|
+
swixter proxy start --port 8080 # Custom port (default: 15721)
|
|
195
|
+
swixter proxy start --daemon # Run in background
|
|
196
|
+
|
|
197
|
+
# Stop proxy
|
|
198
|
+
swixter proxy stop # Stop default instance
|
|
199
|
+
swixter proxy stop run-15722 # Stop specific instance
|
|
200
|
+
|
|
201
|
+
# View status
|
|
202
|
+
swixter proxy status # Show all running instances
|
|
203
|
+
|
|
204
|
+
# One-shot: start proxy + run coder tool
|
|
205
|
+
swixter proxy run -- claude # Proxy + Claude Code
|
|
206
|
+
swixter proxy run -- codex # Proxy + Codex
|
|
207
|
+
swixter proxy run --group ha-group -- claude # With specific group
|
|
290
208
|
```
|
|
291
209
|
|
|
292
|
-
|
|
210
|
+
### The `proxy run` Command
|
|
211
|
+
|
|
212
|
+
The easiest way to use the proxy. It:
|
|
293
213
|
|
|
294
|
-
|
|
214
|
+
1. Starts a temporary proxy instance (on next available port)
|
|
215
|
+
2. Points the coder tool's API URL to the local proxy
|
|
216
|
+
3. Spawns the coder tool
|
|
217
|
+
4. Stops the proxy when the coder exits
|
|
295
218
|
|
|
296
219
|
```bash
|
|
297
|
-
#
|
|
298
|
-
|
|
220
|
+
swixter proxy run -- claude # One command, everything automatic
|
|
221
|
+
```
|
|
299
222
|
|
|
300
|
-
|
|
301
|
-
swixter claude create --name personal --provider anthropic --api-key sk-ant-personal-xxx
|
|
223
|
+
### Circuit Breaker
|
|
302
224
|
|
|
303
|
-
|
|
304
|
-
swixter claude sw work && swixter claude apply
|
|
225
|
+
Per-profile circuit breaker prevents wasting time on failing providers:
|
|
305
226
|
|
|
306
|
-
|
|
307
|
-
|
|
227
|
+
| State | Behavior | Transition |
|
|
228
|
+
|-------|----------|------------|
|
|
229
|
+
| **Closed** | Requests pass through | 3 consecutive failures → Open |
|
|
230
|
+
| **Open** | Requests skipped | After 60s → Half-Open |
|
|
231
|
+
| **Half-Open** | One probe request allowed | Success → Closed, Failure → Open |
|
|
308
232
|
|
|
309
|
-
|
|
310
|
-
swixter claude sw personal && swixter claude apply
|
|
311
|
-
swixter claude r
|
|
312
|
-
```
|
|
313
|
-
|
|
314
|
-
### Example 2: Try Qwen locally
|
|
233
|
+
### Monitoring (Web UI)
|
|
315
234
|
|
|
316
235
|
```bash
|
|
317
|
-
#
|
|
318
|
-
swixter qwen create \
|
|
319
|
-
--name local \
|
|
320
|
-
--provider ollama \
|
|
321
|
-
--base-url http://localhost:11434
|
|
322
|
-
|
|
323
|
-
# Switch and run
|
|
324
|
-
swixter qwen sw local
|
|
325
|
-
swixter qwen r
|
|
236
|
+
swixter ui # Proxy page shows live status, request counts, and real-time logs
|
|
326
237
|
```
|
|
327
238
|
|
|
328
|
-
|
|
239
|
+
## Web UI
|
|
329
240
|
|
|
330
241
|
```bash
|
|
331
|
-
#
|
|
332
|
-
swixter
|
|
333
|
-
|
|
334
|
-
--provider ollama \
|
|
335
|
-
--base-url http://localhost:11434
|
|
242
|
+
swixter ui # Default port 3141
|
|
243
|
+
swixter ui --port 8080 # Custom port
|
|
244
|
+
```
|
|
336
245
|
|
|
337
|
-
|
|
338
|
-
swixter codex r
|
|
246
|
+
### Pages
|
|
339
247
|
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
248
|
+
- **Dashboard** - All coders at a glance, quick switch and apply
|
|
249
|
+
- **Profiles** - CRUD for configuration profiles
|
|
250
|
+
- **Groups** - Manage failover groups with drag-and-drop priority
|
|
251
|
+
- **Proxy** - Start/stop proxy, live logs, status monitoring
|
|
252
|
+
- **Providers** - Manage custom providers
|
|
253
|
+
- **Settings** - Import/export configurations
|
|
345
254
|
|
|
346
|
-
|
|
255
|
+
## Other Commands
|
|
347
256
|
|
|
348
257
|
```bash
|
|
349
|
-
#
|
|
350
|
-
swixter
|
|
351
|
-
|
|
352
|
-
#
|
|
353
|
-
|
|
354
|
-
# 2. Go to Dashboard → Select profile from dropdown
|
|
355
|
-
# 3. Click APPLY to write config
|
|
258
|
+
swixter export <file> # Export configs
|
|
259
|
+
swixter export <file> --sanitize # Export without API keys
|
|
260
|
+
swixter import <file> # Import configs
|
|
261
|
+
swixter import <file> --overwrite # Overwrite existing
|
|
262
|
+
swixter completion bash # Shell completions (zsh/fish supported)
|
|
356
263
|
```
|
|
357
264
|
|
|
358
|
-
##
|
|
265
|
+
## Command Aliases
|
|
359
266
|
|
|
360
|
-
|
|
267
|
+
| Alias | Full Command | Description |
|
|
268
|
+
|-------|-------------|-------------|
|
|
269
|
+
| `r` | `run` | Execute the AI coder |
|
|
270
|
+
| `ls` | `list` | List profiles/groups |
|
|
271
|
+
| `sw` | `switch` | Switch profiles |
|
|
272
|
+
| `rm` | `delete` | Delete profiles/groups |
|
|
273
|
+
| `new` | `create` | Create new |
|
|
274
|
+
| `update` | `edit` | Edit existing |
|
|
275
|
+
| `upgrade` | `update-cli` | Update CLI tool |
|
|
361
276
|
|
|
362
|
-
|
|
277
|
+
## Examples
|
|
363
278
|
|
|
364
|
-
|
|
365
|
-
# Install
|
|
366
|
-
swixter completion bash > ~/.local/share/bash-completion/completions/swixter
|
|
279
|
+
### Switch between work and personal
|
|
367
280
|
|
|
368
|
-
|
|
369
|
-
|
|
281
|
+
```bash
|
|
282
|
+
swixter claude create --name work --provider anthropic --api-key sk-ant-work-xxx
|
|
283
|
+
swixter claude create --name personal --provider anthropic --api-key sk-ant-personal-xxx
|
|
284
|
+
swixter claude sw work && swixter claude apply
|
|
370
285
|
```
|
|
371
286
|
|
|
372
|
-
###
|
|
287
|
+
### Failover setup: Anthropic primary + OpenRouter backup
|
|
373
288
|
|
|
374
289
|
```bash
|
|
375
|
-
#
|
|
376
|
-
swixter
|
|
290
|
+
# Create profiles
|
|
291
|
+
swixter claude create --name primary --provider anthropic --api-key sk-ant-xxx
|
|
292
|
+
swixter claude create --name backup --provider openrouter --api-key sk-or-xxx
|
|
377
293
|
|
|
378
|
-
#
|
|
379
|
-
|
|
294
|
+
# Create failover group
|
|
295
|
+
swixter group create --name failover --profiles primary,backup
|
|
296
|
+
|
|
297
|
+
# Run with proxy (auto-failover)
|
|
298
|
+
swixter proxy run --group failover -- claude
|
|
380
299
|
```
|
|
381
300
|
|
|
382
|
-
###
|
|
301
|
+
### Run Codex with local Ollama
|
|
383
302
|
|
|
384
303
|
```bash
|
|
385
|
-
|
|
386
|
-
swixter
|
|
387
|
-
|
|
388
|
-
# Reload
|
|
389
|
-
fish
|
|
304
|
+
swixter codex create --name local --provider ollama --base-url http://localhost:11434
|
|
305
|
+
swixter codex r
|
|
390
306
|
```
|
|
391
307
|
|
|
392
|
-
## Command Aliases
|
|
393
|
-
|
|
394
|
-
Save keystrokes with short aliases:
|
|
395
|
-
|
|
396
|
-
| Alias | Full Command | Description |
|
|
397
|
-
|-------|-------------|-------------|
|
|
398
|
-
| `r` | `run` | Execute the AI coder |
|
|
399
|
-
| `ls` | `list` | List all profiles |
|
|
400
|
-
| `sw` | `switch` | Switch profiles |
|
|
401
|
-
| `rm` | `delete` | Delete profiles |
|
|
402
|
-
| `new` | `create` | Create new profile |
|
|
403
|
-
| `update` | `edit` | Edit existing profile |
|
|
404
|
-
| `upgrade` | `update-cli` | Update CLI tool |
|
|
405
|
-
|
|
406
308
|
## Architecture
|
|
407
309
|
|
|
408
310
|
```
|
|
@@ -410,45 +312,34 @@ swixter/
|
|
|
410
312
|
├── src/
|
|
411
313
|
│ ├── cli/ # CLI command handlers
|
|
412
314
|
│ ├── config/ # Config file management
|
|
413
|
-
│ ├── adapters/ # Coder
|
|
414
|
-
│ ├── providers/ # Provider presets
|
|
315
|
+
│ ├── adapters/ # Coder adapters (Claude, Codex, Continue)
|
|
316
|
+
│ ├── providers/ # Provider presets + user-defined providers
|
|
317
|
+
│ ├── groups/ # Group management (failover profiles)
|
|
318
|
+
│ ├── proxy/ # Local proxy server (failover, circuit breaker)
|
|
415
319
|
│ ├── server/ # Web UI API server
|
|
416
320
|
│ └── utils/ # Shared utilities
|
|
417
|
-
├── ui/ # Web UI (React + Vite)
|
|
321
|
+
├── ui/ # Web UI (React + Vite + Tailwind)
|
|
418
322
|
└── tests/ # Unit tests
|
|
419
323
|
```
|
|
420
324
|
|
|
421
|
-
**Data Flow**:
|
|
422
|
-
1. `swixter create/switch` → Updates `~/.config/swixter/config.json`
|
|
423
|
-
2. `swixter apply` → Writes to coder config (`~/.claude/settings.json`, etc.)
|
|
424
|
-
3. `swixter run` → Sets env vars + spawns coder CLI
|
|
425
|
-
|
|
426
325
|
## Development
|
|
427
326
|
|
|
428
|
-
Built with modern tools:
|
|
429
|
-
|
|
430
327
|
```bash
|
|
431
|
-
# Clone repo
|
|
432
328
|
git clone https://github.com/dawnswwwww/swixter.git
|
|
433
329
|
cd swixter
|
|
434
|
-
|
|
435
|
-
# Install dependencies
|
|
436
330
|
bun install
|
|
331
|
+
bun run cli:dev # Dev mode with hot reload
|
|
332
|
+
bun test # Run tests
|
|
333
|
+
bun run build # Build all (UI + CLI)
|
|
334
|
+
```
|
|
437
335
|
|
|
438
|
-
|
|
439
|
-
bun run cli:dev
|
|
440
|
-
|
|
441
|
-
# Run tests
|
|
442
|
-
bun test
|
|
443
|
-
|
|
444
|
-
# Run specific test
|
|
445
|
-
bun test tests/adapters/claude.test.ts
|
|
446
|
-
|
|
447
|
-
# E2E tests (requires Docker)
|
|
448
|
-
bun run test:e2e
|
|
336
|
+
### Release
|
|
449
337
|
|
|
450
|
-
|
|
451
|
-
|
|
338
|
+
```bash
|
|
339
|
+
# Update CHANGELOG.md first, then:
|
|
340
|
+
bun run release:patch # Bug fixes (0.1.0 → 0.1.1)
|
|
341
|
+
bun run release:minor # Features (0.1.0 → 0.2.0)
|
|
342
|
+
bun run release:major # Breaking changes (0.1.0 → 1.0.0)
|
|
452
343
|
```
|
|
453
344
|
|
|
454
345
|
## Tech Stack
|
|
@@ -459,7 +350,6 @@ bun run build
|
|
|
459
350
|
| **Language** | TypeScript |
|
|
460
351
|
| **CLI UI** | @clack/prompts |
|
|
461
352
|
| **Validation** | Zod |
|
|
462
|
-
| **Version** | semver |
|
|
463
353
|
| **Web UI** | React + Vite + Tailwind CSS |
|
|
464
354
|
| **Testing** | Bun test, Docker E2E |
|
|
465
355
|
|
|
@@ -467,54 +357,6 @@ bun run build
|
|
|
467
357
|
|
|
468
358
|
See [CHANGELOG.md](CHANGELOG.md) for version history.
|
|
469
359
|
|
|
470
|
-
## Roadmap
|
|
471
|
-
|
|
472
|
-
- [ ] Profile templates for common setups
|
|
473
|
-
- [ ] Configuration validation and migration tools
|
|
474
|
-
- [x] Web UI for profile management (v0.0.9+)
|
|
475
|
-
- [ ] Cloud sync for profiles (optional, planned)
|
|
476
|
-
|
|
477
|
-
## Contributing
|
|
478
|
-
|
|
479
|
-
Contributions welcome!
|
|
480
|
-
|
|
481
|
-
### Development Setup
|
|
482
|
-
|
|
483
|
-
```bash
|
|
484
|
-
git clone https://github.com/dawnswwwww/swixter.git
|
|
485
|
-
cd swixter
|
|
486
|
-
bun install
|
|
487
|
-
bun run cli:dev
|
|
488
|
-
bun test
|
|
489
|
-
bun run build
|
|
490
|
-
```
|
|
491
|
-
|
|
492
|
-
### Release Process
|
|
493
|
-
|
|
494
|
-
1. Update `CHANGELOG.md` under `[Unreleased]`
|
|
495
|
-
2. Run release command:
|
|
496
|
-
```bash
|
|
497
|
-
bun run release:patch # Bug fixes (0.0.10 → 0.0.11)
|
|
498
|
-
bun run release:minor # Features (0.0.10 → 0.1.0)
|
|
499
|
-
bun run release:major # Breaking changes
|
|
500
|
-
```
|
|
501
|
-
3. GitHub Actions automatically:
|
|
502
|
-
- Runs tests on Linux/macOS/Windows
|
|
503
|
-
- Publishes to npm
|
|
504
|
-
- Creates GitHub Release with changelog
|
|
505
|
-
|
|
506
|
-
See [CLAUDE.md](CLAUDE.md) for detailed development documentation.
|
|
507
|
-
|
|
508
360
|
## License
|
|
509
361
|
|
|
510
362
|
MIT License - see [LICENSE](LICENSE)
|
|
511
|
-
|
|
512
|
-
## Links
|
|
513
|
-
|
|
514
|
-
- [GitHub](https://github.com/dawnswwwww/swixter)
|
|
515
|
-
- [npm](https://www.npmjs.com/package/swixter)
|
|
516
|
-
- [Issues](https://github.com/dawnswwwww/swixter/issues)
|
|
517
|
-
|
|
518
|
-
---
|
|
519
|
-
|
|
520
|
-
**Made with ❤️ to make AI coding tools more accessible**
|