@austinthesing/magic-shell 0.2.29 → 1.0.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.md +95 -590
- package/dist/cli.js +464 -422
- package/dist/index.js +21 -21
- package/dist/tui.js +464 -422
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,643 +1,148 @@
|
|
|
1
1
|
# Magic Shell
|
|
2
2
|
|
|
3
|
-
> Transform natural language into terminal commands with built-in safety
|
|
3
|
+
> Transform natural language into terminal commands with AI-powered translation, built-in safety, and a polished v1.0 terminal UI.
|
|
4
4
|
|
|
5
|
-
Magic Shell is an open-source CLI
|
|
5
|
+
Magic Shell is an open-source CLI that turns plain English into shell commands. Use `msh` for fast one-shot translations or `mshell` for the interactive TUI with command palettes, slash commands, model switching, themes, safety controls, and command history.
|
|
6
6
|
|
|
7
|
-
##
|
|
7
|
+
## v1.0
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
- **Multiple AI Providers**: OpenCode Zen (with free models!), OpenRouter, Vercel AI Gateway, Cloudflare AI Gateway, Workers AI, and custom models (LM Studio, Ollama, OpenAI-compatible)
|
|
11
|
-
- **Custom Model Support**: Add your own local or remote models with secure API key storage
|
|
12
|
-
- **Project Context Aware**: Opt-in detection of package.json scripts, Makefile targets, etc.
|
|
13
|
-
- **Interactive TUI Mode**: Full-featured terminal interface with themes
|
|
14
|
-
- **Command Safety Analysis**: Multi-level safety checks before executing commands
|
|
15
|
-
- **Auto Updates**: Automatic update checking with one-command upgrades
|
|
16
|
-
- **Cross-Platform**: macOS, Linux, and Windows support
|
|
17
|
-
- **Shell-Aware**: Automatically detects and adapts to your shell (bash, zsh, fish, PowerShell, etc.)
|
|
18
|
-
- **Secure Credential Storage**: Uses system keychain (macOS Keychain, Linux secret-tool, Windows Credential Manager)
|
|
19
|
-
- **Command History**: Context-aware translations based on your recent commands
|
|
20
|
-
- **Beautiful Themes**: 8 built-in themes including Tokyo Night, Catppuccin, Dracula, and more
|
|
9
|
+
Magic Shell 1.0 is focused on day-to-day terminal UX:
|
|
21
10
|
|
|
22
|
-
|
|
11
|
+
- Unified command palettes for commands, slash commands, models, providers, themes, safety, thinking level, onboarding, and API key setup.
|
|
12
|
+
- Slash commands now open the same picker actions as the command palette instead of submitting `/models` or `/providers` as plain text.
|
|
13
|
+
- `Esc` and `Ctrl+C` close active modals before exiting the app.
|
|
14
|
+
- Safety and thinking controls now open explicit pickers instead of blindly cycling values.
|
|
15
|
+
- Model and provider pickers use clearer descriptions and consistent category/cost labels.
|
|
23
16
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
**Prerequisite:** Magic Shell runs on the [Bun](https://bun.sh) runtime. Install Bun first,
|
|
27
|
-
even if you install the package with npm, pnpm, or yarn.
|
|
17
|
+
## Install
|
|
28
18
|
|
|
29
19
|
```bash
|
|
30
|
-
# bun (recommended)
|
|
31
20
|
bun add -g @austinthesing/magic-shell
|
|
21
|
+
```
|
|
32
22
|
|
|
33
|
-
|
|
34
|
-
npm install -g @austinthesing/magic-shell
|
|
23
|
+
Other package managers:
|
|
35
24
|
|
|
36
|
-
|
|
25
|
+
```bash
|
|
26
|
+
npm install -g @austinthesing/magic-shell
|
|
37
27
|
pnpm add -g @austinthesing/magic-shell
|
|
38
|
-
|
|
39
|
-
# yarn
|
|
40
28
|
yarn global add @austinthesing/magic-shell
|
|
41
29
|
```
|
|
42
30
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
**Prerequisite:** [Bun](https://bun.sh) runtime (v1.3.9 or higher)
|
|
31
|
+
From source:
|
|
46
32
|
|
|
47
33
|
```bash
|
|
48
|
-
# Clone the repository
|
|
49
34
|
git clone https://github.com/austin-thesing/magic-shell.git
|
|
50
35
|
cd magic-shell
|
|
51
|
-
|
|
52
|
-
# Install dependencies
|
|
53
36
|
bun install
|
|
54
|
-
|
|
55
|
-
# Build
|
|
56
37
|
bun run build
|
|
57
|
-
|
|
58
|
-
# Link globally (optional)
|
|
59
38
|
bun link
|
|
60
39
|
```
|
|
61
40
|
|
|
62
|
-
|
|
41
|
+
## Quick Start
|
|
63
42
|
|
|
64
43
|
```bash
|
|
65
|
-
# Run setup to configure your API key
|
|
66
44
|
msh --setup
|
|
67
|
-
|
|
68
|
-
# Or set via environment variable
|
|
69
|
-
export OPENCODE_ZEN_API_KEY="your-key-here"
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
## Usage
|
|
73
|
-
|
|
74
|
-
Use `msh` for CLI mode and `mshell` for TUI mode.
|
|
75
|
-
|
|
76
|
-
### Basic Commands
|
|
77
|
-
|
|
78
|
-
```bash
|
|
79
|
-
# Translate a query to a command (prints the command)
|
|
80
|
-
msh "list all javascript files"
|
|
81
|
-
# Output: find . -name "*.js"
|
|
82
|
-
|
|
83
|
-
# Translate and execute
|
|
84
|
-
msh -x "show disk usage"
|
|
85
|
-
|
|
86
|
-
# Dry run - preview with safety analysis
|
|
87
|
-
msh -n "delete all node_modules folders"
|
|
88
|
-
|
|
89
|
-
# Launch interactive TUI mode
|
|
90
45
|
mshell
|
|
91
46
|
```
|
|
92
47
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
| Command | Description |
|
|
96
|
-
| ------------------------- | ------------------------------------------- |
|
|
97
|
-
| `msh <query>` | Translate query to command and print it |
|
|
98
|
-
| `msh -x <query>` | Translate and execute the command |
|
|
99
|
-
| `msh -n <query>` | Dry run - show command with safety analysis |
|
|
100
|
-
| `mshell` | Launch interactive TUI mode |
|
|
101
|
-
| `msh --setup` | Configure API keys and provider |
|
|
102
|
-
| `msh --models` | List available models |
|
|
103
|
-
| `msh --model <id>` | Set default model (including custom models) |
|
|
104
|
-
| `msh --add-model` | Add custom model (LM Studio, Ollama, etc.) |
|
|
105
|
-
| `msh --list-custom` | List custom models |
|
|
106
|
-
| `msh --remove-model <id>` | Remove custom model |
|
|
107
|
-
| `msh --provider <name>` | Set provider (OpenCode Zen, OpenRouter, gateways, Workers AI, or custom) |
|
|
108
|
-
| `msh --thinking <level>` | Set thinking level (off, low, medium, high) |
|
|
109
|
-
| `msh --themes` | List available themes |
|
|
110
|
-
| `msh --theme <name>` | Set color theme |
|
|
111
|
-
| `msh --repo-context` | Enable project context detection |
|
|
112
|
-
| `msh -r <query>` | Use project context for single query |
|
|
113
|
-
| `msh --version` | Show version |
|
|
114
|
-
| `msh --check-update` | Check for updates |
|
|
115
|
-
| `msh --help` | Show help |
|
|
116
|
-
|
|
117
|
-
### Examples
|
|
118
|
-
|
|
119
|
-
```bash
|
|
120
|
-
# File operations
|
|
121
|
-
msh "find all files larger than 100MB"
|
|
122
|
-
msh "count lines of code in this project"
|
|
123
|
-
msh "show the 10 most recently modified files"
|
|
124
|
-
|
|
125
|
-
# Git operations
|
|
126
|
-
msh "undo my last commit but keep changes"
|
|
127
|
-
msh "show commits from the last week"
|
|
128
|
-
msh "create a branch from main called feature-login"
|
|
129
|
-
|
|
130
|
-
# System operations
|
|
131
|
-
msh "check which process is using port 3000"
|
|
132
|
-
msh "show memory usage"
|
|
133
|
-
msh "list all running docker containers"
|
|
134
|
-
|
|
135
|
-
# Execute directly
|
|
136
|
-
msh -x "show current git branch"
|
|
137
|
-
|
|
138
|
-
# Pipe to clipboard (macOS)
|
|
139
|
-
msh "compress this folder to a zip file" | pbcopy
|
|
140
|
-
```
|
|
141
|
-
|
|
142
|
-
## Interactive TUI Mode
|
|
143
|
-
|
|
144
|
-
Launch with `mshell` for a full interactive experience.
|
|
145
|
-
|
|
146
|
-
### Keyboard Shortcuts
|
|
147
|
-
|
|
148
|
-
Magic Shell follows OpenCode-style TUI shortcuts where they fit cleanly:
|
|
149
|
-
|
|
150
|
-
| Shortcut | Action |
|
|
151
|
-
| ---------- | ---------------------- |
|
|
152
|
-
| `Ctrl+P` | Open Commands |
|
|
153
|
-
| `Ctrl+X M` | Change model |
|
|
154
|
-
| `Ctrl+X T` | Change theme |
|
|
155
|
-
| `Ctrl+X Q` | Exit |
|
|
156
|
-
| `Ctrl+T` | Cycle thinking level |
|
|
157
|
-
| `Ctrl+C` | Exit, or cancel/close the active dialog first |
|
|
158
|
-
| `Ctrl+D` | Exit |
|
|
159
|
-
| `Esc` | Close dialogs or cancel pending actions |
|
|
160
|
-
|
|
161
|
-
### Slash Commands in TUI
|
|
162
|
-
|
|
163
|
-
Typing `/` opens a slash command menu under the prompt. Type to filter, use arrow keys to move, `Tab` to complete, and `Enter` to run the selected command.
|
|
164
|
-
|
|
165
|
-
You can also submit slash commands directly:
|
|
166
|
-
|
|
167
|
-
- `!help` or `/help` - Show help
|
|
168
|
-
- `!model` or `/models` - Change model
|
|
169
|
-
- `!provider` or `/providers` - Switch provider
|
|
170
|
-
- `!theme` or `/themes` - Change theme
|
|
171
|
-
- `!dry` or `/dry` - Toggle dry-run mode
|
|
172
|
-
- `!thinking` or `/thinking` - Cycle thinking level
|
|
173
|
-
- `!config` or `/config` - Show current configuration
|
|
174
|
-
- `!history` or `/history` - Show command history
|
|
175
|
-
- `!clear` or `/clear` - Clear output
|
|
176
|
-
- `!exit` or `/exit` - Exit the TUI
|
|
177
|
-
|
|
178
|
-
Both `!` and `/` prefixes work for these commands.
|
|
179
|
-
|
|
180
|
-
## AI Providers
|
|
181
|
-
|
|
182
|
-
### OpenCode Zen (Recommended)
|
|
183
|
-
|
|
184
|
-
OpenCode Zen provides curated models optimized for coding tasks, including **free models**.
|
|
185
|
-
|
|
186
|
-
**Free Models:**
|
|
187
|
-
|
|
188
|
-
- `deepseek-v4-flash-free` - DeepSeek's free fast open-source model (default)
|
|
189
|
-
- `mimo-v2.5-free` - Xiaomi's free long-context MiMo model
|
|
190
|
-
- `north-mini-code-free` - North's free coding model
|
|
191
|
-
- `nemotron-3-ultra-free` - NVIDIA Nemotron free trial model
|
|
192
|
-
- `big-pickle` - OpenCode stealth model
|
|
193
|
-
- `gpt-5-nano` - OpenAI's free lightweight GPT model
|
|
194
|
-
|
|
195
|
-
**Premium Models:**
|
|
196
|
-
|
|
197
|
-
- Claude Sonnet 4.6, Claude Opus 4.8, Claude Haiku 4.5, Claude Fable 5
|
|
198
|
-
- Kimi K2.6
|
|
199
|
-
- DeepSeek V4 Pro, DeepSeek V4 Flash
|
|
200
|
-
- GLM 5.2, GLM 5.1
|
|
201
|
-
- Qwen3.7 Max, Qwen3.7 Plus
|
|
202
|
-
- MiMo V2.5, MiMo V2.5 Pro
|
|
203
|
-
- MiniMax M2.7
|
|
204
|
-
- Gemini 3.5 Flash, Gemini 3.1 Pro, Gemini 3 Flash
|
|
205
|
-
- GPT 5.5, GPT 5.5 Pro, GPT 5.4 Mini/Nano, GPT 5.3 Codex
|
|
206
|
-
- And more...
|
|
207
|
-
|
|
208
|
-
Get your API key at: https://opencode.ai/auth
|
|
209
|
-
|
|
210
|
-
### OpenRouter
|
|
211
|
-
|
|
212
|
-
Access to a wide variety of models from different providers.
|
|
213
|
-
|
|
214
|
-
**Open-source and open-weight highlights:**
|
|
215
|
-
|
|
216
|
-
- Kimi K2.7 Code, Kimi K2.6
|
|
217
|
-
- DeepSeek V4 Pro, DeepSeek V4 Flash
|
|
218
|
-
- GLM 5.2, GLM 5.1, GLM 5 Turbo
|
|
219
|
-
- Qwen3.7 Max, Qwen3.7 Plus
|
|
220
|
-
- MiniMax M3, MiniMax M2.7
|
|
221
|
-
- MiMo V2.5, MiMo V2.5 Pro
|
|
222
|
-
- And many more...
|
|
223
|
-
|
|
224
|
-
Get your API key at: https://openrouter.ai/keys
|
|
225
|
-
|
|
226
|
-
### Custom Models
|
|
227
|
-
|
|
228
|
-
Magic Shell supports custom models for local or remote OpenAI-compatible endpoints, including:
|
|
229
|
-
|
|
230
|
-
- **LM Studio** - Run models locally
|
|
231
|
-
- **Ollama** - Local model management
|
|
232
|
-
- **Any OpenAI-compatible API** - Self-hosted or third-party endpoints
|
|
233
|
-
|
|
234
|
-
**Adding a Custom Model:**
|
|
48
|
+
You can also provide API keys with environment variables:
|
|
235
49
|
|
|
236
50
|
```bash
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
# You'll be prompted for:
|
|
241
|
-
# - Model ID (for referencing, e.g., "my-local-llama")
|
|
242
|
-
# - Display name (e.g., "Local Llama 3.2")
|
|
243
|
-
# - API model ID (sent to server, e.g., "llama-3.2-3b")
|
|
244
|
-
# - Base URL (e.g., "http://localhost:1234/v1")
|
|
245
|
-
# - API key (optional, stored securely in keychain)
|
|
246
|
-
# - Category (fast/smart/reasoning)
|
|
51
|
+
export OPENCODE_ZEN_API_KEY="your-key-here"
|
|
52
|
+
export OPENROUTER_API_KEY="your-key-here"
|
|
247
53
|
```
|
|
248
54
|
|
|
249
|
-
|
|
55
|
+
## CLI Usage
|
|
250
56
|
|
|
251
57
|
```bash
|
|
252
|
-
|
|
253
|
-
msh
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
msh --model my-local-llama
|
|
257
|
-
|
|
258
|
-
# Remove a custom model
|
|
259
|
-
msh --remove-model my-local-llama
|
|
260
|
-
```
|
|
261
|
-
|
|
262
|
-
Custom model API keys are securely stored in your system keychain, just like provider API keys.
|
|
263
|
-
|
|
264
|
-
## Safety System
|
|
265
|
-
|
|
266
|
-
Magic Shell includes a comprehensive safety analysis system that categorizes commands by risk level:
|
|
267
|
-
|
|
268
|
-
### Severity Levels
|
|
269
|
-
|
|
270
|
-
| Level | Description | Examples |
|
|
271
|
-
| ------------ | -------------------------------------- | --------------------------------------- |
|
|
272
|
-
| **Critical** | Could cause irreversible system damage | `rm -rf /`, fork bombs, disk overwrites |
|
|
273
|
-
| **High** | Significant changes or data loss risk | `sudo rm`, `kill -9 -1`, `shutdown` |
|
|
274
|
-
| **Medium** | Requires elevated privileges | `sudo`, `chmod`, package removal |
|
|
275
|
-
| **Low** | Worth reviewing | `git checkout`, `npm install` |
|
|
276
|
-
|
|
277
|
-
### Safety Levels
|
|
278
|
-
|
|
279
|
-
Configure your preferred safety level:
|
|
280
|
-
|
|
281
|
-
- **Strict**: Confirm all potentially risky commands
|
|
282
|
-
- **Moderate** (default): Confirm high and critical severity commands
|
|
283
|
-
- **Relaxed**: Only confirm critical severity commands
|
|
284
|
-
|
|
285
|
-
### Blocked Commands
|
|
286
|
-
|
|
287
|
-
Certain dangerous patterns are always blocked:
|
|
288
|
-
|
|
289
|
-
- Fork bombs
|
|
290
|
-
- Direct disk writes (`> /dev/sda`)
|
|
291
|
-
- Filesystem formatting (`mkfs`)
|
|
292
|
-
- Recursive permission changes on root (`chmod -R 777 /`)
|
|
293
|
-
|
|
294
|
-
## Configuration
|
|
295
|
-
|
|
296
|
-
Configuration is stored in `~/.magic-shell/config.json`.
|
|
297
|
-
|
|
298
|
-
### Config Options
|
|
299
|
-
|
|
300
|
-
```json
|
|
301
|
-
{
|
|
302
|
-
"provider": "opencode-zen",
|
|
303
|
-
"defaultModel": "deepseek-v4-flash-free",
|
|
304
|
-
"thinkingLevel": "low",
|
|
305
|
-
"safetyLevel": "moderate",
|
|
306
|
-
"dryRunByDefault": false,
|
|
307
|
-
"repoContext": false,
|
|
308
|
-
"theme": "opencode",
|
|
309
|
-
"blockedCommands": [...],
|
|
310
|
-
"confirmedDangerousPatterns": [...],
|
|
311
|
-
"customModels": [
|
|
312
|
-
{
|
|
313
|
-
"id": "my-local-llama",
|
|
314
|
-
"name": "Local Llama 3.2",
|
|
315
|
-
"modelId": "llama-3.2-3b",
|
|
316
|
-
"baseUrl": "http://localhost:1234/v1",
|
|
317
|
-
"contextLength": 128000,
|
|
318
|
-
"category": "smart"
|
|
319
|
-
}
|
|
320
|
-
]
|
|
321
|
-
}
|
|
58
|
+
msh "list all javascript files"
|
|
59
|
+
msh -x "show disk usage"
|
|
60
|
+
msh -n "delete all node_modules folders"
|
|
61
|
+
msh -r "run the dev server"
|
|
322
62
|
```
|
|
323
63
|
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
|
327
|
-
|
|
|
328
|
-
| `
|
|
329
|
-
| `
|
|
330
|
-
| `
|
|
331
|
-
| `
|
|
332
|
-
| `
|
|
333
|
-
| `
|
|
334
|
-
| `
|
|
335
|
-
| `
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
- `one-dark` - Atom-inspired
|
|
348
|
-
- `matrix` - Classic green terminal
|
|
349
|
-
|
|
350
|
-
Change themes:
|
|
64
|
+
| Command | Description |
|
|
65
|
+
| --- | --- |
|
|
66
|
+
| `msh <query>` | Translate a natural-language query to a shell command |
|
|
67
|
+
| `msh -x <query>` | Translate and execute immediately |
|
|
68
|
+
| `msh -n <query>` | Dry run with safety analysis |
|
|
69
|
+
| `msh -r <query>` | Include project context for one query |
|
|
70
|
+
| `mshell` | Launch interactive TUI mode |
|
|
71
|
+
| `msh --setup` | Configure provider and API keys |
|
|
72
|
+
| `msh --models` | List available models |
|
|
73
|
+
| `msh --model <id>` | Set the default model |
|
|
74
|
+
| `msh --provider <name>` | Set the active provider |
|
|
75
|
+
| `msh --safety <level>` | Set safety level: `strict`, `moderate`, `relaxed` |
|
|
76
|
+
| `msh --thinking <level>` | Set thinking level: `off`, `low`, `medium`, `high` |
|
|
77
|
+
| `msh --themes` | List themes |
|
|
78
|
+
| `msh --theme <name>` | Set theme |
|
|
79
|
+
| `msh --repo-context` | Enable project context detection |
|
|
80
|
+
| `msh --add-model` | Add a custom OpenAI-compatible model |
|
|
81
|
+
| `msh --list-custom` | List custom models |
|
|
82
|
+
| `msh --remove-model <id>` | Remove a custom model |
|
|
83
|
+
|
|
84
|
+
## TUI Usage
|
|
85
|
+
|
|
86
|
+
Launch the interactive app:
|
|
351
87
|
|
|
352
88
|
```bash
|
|
353
|
-
|
|
354
|
-
msh --theme tokyonight
|
|
355
|
-
|
|
356
|
-
# TUI
|
|
357
|
-
Ctrl+X T
|
|
89
|
+
mshell
|
|
358
90
|
```
|
|
359
91
|
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
|
378
|
-
|
|
|
379
|
-
|
|
|
92
|
+
Core shortcuts:
|
|
93
|
+
|
|
94
|
+
| Shortcut | Action |
|
|
95
|
+
| --- | --- |
|
|
96
|
+
| `Ctrl+P` | Open the command palette |
|
|
97
|
+
| `/` | Open slash commands from the prompt |
|
|
98
|
+
| `Ctrl+X M` | Open model picker |
|
|
99
|
+
| `Ctrl+X T` | Open theme picker |
|
|
100
|
+
| `Ctrl+Y` | Open safety level picker |
|
|
101
|
+
| `Ctrl+T` | Open thinking level picker |
|
|
102
|
+
| `Esc` | Close the active modal |
|
|
103
|
+
| `Ctrl+C` | Close the active modal, then exit when no modal is open |
|
|
104
|
+
| `Ctrl+D` | Exit |
|
|
105
|
+
| `Ctrl+X Q` | Exit |
|
|
106
|
+
|
|
107
|
+
Slash commands expose the same functionality as the command palette:
|
|
108
|
+
|
|
109
|
+
| Command | Action |
|
|
110
|
+
| --- | --- |
|
|
111
|
+
| `/models` | Select model |
|
|
112
|
+
| `/providers` | Switch provider |
|
|
113
|
+
| `/themes` | Select theme |
|
|
114
|
+
| `/safety` | Select safety level |
|
|
115
|
+
| `/thinking` | Select thinking level |
|
|
116
|
+
| `/dry` | Toggle dry-run mode |
|
|
117
|
+
| `/config` | Show config |
|
|
118
|
+
| `/history` | Show history |
|
|
119
|
+
| `/clear` | Clear chat |
|
|
120
|
+
| `/help` | Show help |
|
|
121
|
+
| `/exit` | Exit |
|
|
122
|
+
|
|
123
|
+
Legacy `!` commands still work for compatibility.
|
|
124
|
+
|
|
125
|
+
## Providers
|
|
126
|
+
|
|
127
|
+
Magic Shell supports:
|
|
128
|
+
|
|
129
|
+
- OpenCode Zen
|
|
130
|
+
- OpenRouter
|
|
131
|
+
- Vercel AI Gateway
|
|
132
|
+
- Cloudflare AI Gateway
|
|
133
|
+
- Cloudflare Workers AI
|
|
134
|
+
- Custom OpenAI-compatible endpoints like LM Studio and Ollama
|
|
135
|
+
|
|
136
|
+
OpenCode Zen is the recommended default and includes free models. Get an API key at [opencode.ai/auth](https://opencode.ai/auth).
|
|
380
137
|
|
|
381
138
|
## Development
|
|
382
139
|
|
|
383
140
|
```bash
|
|
384
|
-
|
|
141
|
+
bun install
|
|
385
142
|
bun run dev
|
|
386
|
-
|
|
387
|
-
# Run TUI in development mode
|
|
388
143
|
bun run dev:tui
|
|
389
|
-
|
|
390
|
-
# Type check
|
|
391
144
|
bun run typecheck
|
|
392
|
-
|
|
393
|
-
# Build for distribution
|
|
394
145
|
bun run build
|
|
395
146
|
```
|
|
396
147
|
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
```
|
|
400
|
-
src/
|
|
401
|
-
index.ts # CLI entry point
|
|
402
|
-
cli.ts # TUI mode
|
|
403
|
-
lib/
|
|
404
|
-
types.ts # Type definitions and model configs
|
|
405
|
-
config.ts # Configuration management
|
|
406
|
-
api.ts # AI provider integrations
|
|
407
|
-
safety.ts # Command safety analysis
|
|
408
|
-
theme.ts # Theme system
|
|
409
|
-
keychain.ts # Secure credential storage
|
|
410
|
-
shell.ts # Shell/platform detection
|
|
411
|
-
```
|
|
412
|
-
|
|
413
|
-
## Publishing to npm
|
|
414
|
-
|
|
415
|
-
### Prerequisites
|
|
416
|
-
|
|
417
|
-
1. Create an npm account at https://www.npmjs.com/signup
|
|
418
|
-
2. Login to npm:
|
|
419
|
-
```bash
|
|
420
|
-
npm login
|
|
421
|
-
```
|
|
422
|
-
|
|
423
|
-
### Preparing for Release
|
|
424
|
-
|
|
425
|
-
1. **Update package.json** - Ensure these fields are set correctly:
|
|
426
|
-
|
|
427
|
-
```json
|
|
428
|
-
{
|
|
429
|
-
"name": "@austinthesing/magic-shell",
|
|
430
|
-
"version": "0.2.13",
|
|
431
|
-
"description": "Natural language to terminal commands with safety features",
|
|
432
|
-
"main": "dist/index.js",
|
|
433
|
-
"bin": {
|
|
434
|
-
"msh": "dist/index.js",
|
|
435
|
-
"mshell": "dist/tui.js"
|
|
436
|
-
},
|
|
437
|
-
"files": ["dist", "README.md", "LICENSE"],
|
|
438
|
-
"repository": {
|
|
439
|
-
"type": "git",
|
|
440
|
-
"url": "https://github.com/austin-thesing/magic-shell.git"
|
|
441
|
-
},
|
|
442
|
-
"homepage": "https://github.com/austin-thesing/magic-shell#readme",
|
|
443
|
-
"bugs": {
|
|
444
|
-
"url": "https://github.com/austin-thesing/magic-shell/issues"
|
|
445
|
-
},
|
|
446
|
-
"keywords": ["cli", "terminal", "natural-language", "shell", "ai", "openrouter", "opencode", "command-line"],
|
|
447
|
-
"author": "Your Name <your@email.com>",
|
|
448
|
-
"license": "MIT"
|
|
449
|
-
}
|
|
450
|
-
```
|
|
451
|
-
|
|
452
|
-
2. **Build the project:**
|
|
453
|
-
|
|
454
|
-
```bash
|
|
455
|
-
bun run build
|
|
456
|
-
```
|
|
457
|
-
|
|
458
|
-
3. **Test locally before publishing:**
|
|
459
|
-
|
|
460
|
-
```bash
|
|
461
|
-
# Create a tarball
|
|
462
|
-
npm pack
|
|
463
|
-
|
|
464
|
-
# Install it globally to test
|
|
465
|
-
npm install -g ./magic-shell-0.1.0.tgz
|
|
466
|
-
|
|
467
|
-
# Test it works
|
|
468
|
-
msh --help
|
|
469
|
-
|
|
470
|
-
# Uninstall test version
|
|
471
|
-
npm uninstall -g magic-shell
|
|
472
|
-
```
|
|
473
|
-
|
|
474
|
-
### Publishing
|
|
475
|
-
|
|
476
|
-
```bash
|
|
477
|
-
# Publish to npm (first time)
|
|
478
|
-
npm publish
|
|
479
|
-
|
|
480
|
-
# Publish with public access (for scoped packages like @your-username/magic-shell)
|
|
481
|
-
npm publish --access public
|
|
482
|
-
```
|
|
483
|
-
|
|
484
|
-
### Releasing New Versions
|
|
485
|
-
|
|
486
|
-
1. **Update version** (follows [semver](https://semver.org/)):
|
|
487
|
-
|
|
488
|
-
```bash
|
|
489
|
-
# Patch release (bug fixes): 0.1.0 -> 0.1.1
|
|
490
|
-
npm version patch
|
|
491
|
-
|
|
492
|
-
# Minor release (new features): 0.1.0 -> 0.2.0
|
|
493
|
-
npm version minor
|
|
494
|
-
|
|
495
|
-
# Major release (breaking changes): 0.1.0 -> 1.0.0
|
|
496
|
-
npm version major
|
|
497
|
-
```
|
|
498
|
-
|
|
499
|
-
2. **Push tags to GitHub:**
|
|
500
|
-
|
|
501
|
-
```bash
|
|
502
|
-
git push origin main --tags
|
|
503
|
-
```
|
|
504
|
-
|
|
505
|
-
3. **Publish the new version:**
|
|
506
|
-
```bash
|
|
507
|
-
npm publish
|
|
508
|
-
```
|
|
509
|
-
|
|
510
|
-
### Automated Releases with GitHub Actions
|
|
511
|
-
|
|
512
|
-
Create `.github/workflows/release.yml`:
|
|
513
|
-
|
|
514
|
-
```yaml
|
|
515
|
-
name: Release
|
|
516
|
-
|
|
517
|
-
on:
|
|
518
|
-
push:
|
|
519
|
-
tags:
|
|
520
|
-
- "v*"
|
|
521
|
-
|
|
522
|
-
jobs:
|
|
523
|
-
release:
|
|
524
|
-
runs-on: ubuntu-latest
|
|
525
|
-
steps:
|
|
526
|
-
- uses: actions/checkout@v4
|
|
527
|
-
|
|
528
|
-
- uses: oven-sh/setup-bun@v1
|
|
529
|
-
with:
|
|
530
|
-
bun-version: latest
|
|
531
|
-
|
|
532
|
-
- name: Install dependencies
|
|
533
|
-
run: bun install
|
|
534
|
-
|
|
535
|
-
- name: Build
|
|
536
|
-
run: bun run build
|
|
537
|
-
|
|
538
|
-
- name: Publish to npm
|
|
539
|
-
run: npm publish
|
|
540
|
-
env:
|
|
541
|
-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
542
|
-
|
|
543
|
-
- name: Create GitHub Release
|
|
544
|
-
uses: softprops/action-gh-release@v1
|
|
545
|
-
with:
|
|
546
|
-
generate_release_notes: true
|
|
547
|
-
```
|
|
548
|
-
|
|
549
|
-
Add your npm token to GitHub:
|
|
550
|
-
|
|
551
|
-
1. Generate token at https://www.npmjs.com/settings/tokens (use "Automation" type)
|
|
552
|
-
2. Add to repository secrets as `NPM_TOKEN`
|
|
553
|
-
|
|
554
|
-
### Version Management Tips
|
|
555
|
-
|
|
556
|
-
- Use `npm version` commands - they automatically:
|
|
557
|
-
- Update `package.json` version
|
|
558
|
-
- Create a git commit
|
|
559
|
-
- Create a git tag
|
|
560
|
-
|
|
561
|
-
- Consider using [Changesets](https://github.com/changesets/changesets) for monorepo or complex versioning
|
|
562
|
-
|
|
563
|
-
- Add a `prepublishOnly` script to ensure builds are fresh:
|
|
564
|
-
```json
|
|
565
|
-
{
|
|
566
|
-
"scripts": {
|
|
567
|
-
"prepublishOnly": "bun run build"
|
|
568
|
-
}
|
|
569
|
-
}
|
|
570
|
-
```
|
|
571
|
-
|
|
572
|
-
## Contributing
|
|
573
|
-
|
|
574
|
-
Contributions are welcome! Please feel free to submit a Pull Request.
|
|
575
|
-
|
|
576
|
-
1. Fork the repository
|
|
577
|
-
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
|
|
578
|
-
3. Commit your changes (`git commit -m 'Add some amazing feature'`)
|
|
579
|
-
4. Push to the branch (`git push origin feature/amazing-feature`)
|
|
580
|
-
5. Open a Pull Request
|
|
581
|
-
|
|
582
|
-
## License
|
|
583
|
-
|
|
584
|
-
MIT License - see [LICENSE](LICENSE) for details.
|
|
585
|
-
|
|
586
|
-
## Release Notes
|
|
587
|
-
|
|
588
|
-
### v0.2.22 - Model Catalog and Release Prep
|
|
589
|
-
|
|
590
|
-
- Refreshed OpenCode Zen and OpenRouter model registries with current June 2026 open-source/open-weight entries
|
|
591
|
-
- Updated the default free Zen model to `deepseek-v4-flash-free`
|
|
592
|
-
- Added Zen routing support for Qwen models on the Messages endpoint
|
|
593
|
-
- Updated release docs and website provider surfaces for the refreshed provider/model set
|
|
594
|
-
|
|
595
|
-
### v0.2.20 - Thinking Controls and Zen Free Models
|
|
596
|
-
- Added `--thinking <level>` and `thinkingLevel` config support (`off`, `low`, `medium`, `high`)
|
|
597
|
-
- Added provider-specific reasoning controls for supported OpenRouter, OpenCode Zen, gateway, and custom models
|
|
598
|
-
- Updated OpenCode Zen free models and default model references to `minimax-m2.5-free`
|
|
599
|
-
- Disabled custom thinking parameters when the selected model/provider does not support them
|
|
600
|
-
|
|
601
|
-
### v0.2.19 - AI Gateway Providers
|
|
602
|
-
- Added Vercel AI Gateway, Cloudflare AI Gateway, and Cloudflare Workers AI providers
|
|
603
|
-
- Added gateway provider setup, switching, model listing, API-key handling, and environment variables
|
|
604
|
-
- Refreshed OpenCode Zen and OpenRouter registries with current OpenAI, Anthropic, Kimi, DeepSeek, GLM, MiniMax, and MiMo model IDs
|
|
605
|
-
- Added provider-scoped model helpers so model selection follows the active provider
|
|
606
|
-
|
|
607
|
-
### v0.2.18 - Model Registry Refresh
|
|
608
|
-
- Added latest MiMo V2.5 and MiMo V2.5 Pro entries for OpenCode Zen
|
|
609
|
-
- Added latest Xiaomi MiMo V2.5 and MiMo V2.5 Pro entries for OpenRouter
|
|
610
|
-
- Removed the older OpenRouter MiMo V2 Flash free entry from docs and model listings
|
|
611
|
-
- Updated runtime dependencies for the published CLI package
|
|
612
|
-
|
|
613
|
-
### v0.2.17 - Dependency Maintenance
|
|
614
|
-
- Updated published CLI dependencies to current releases
|
|
615
|
-
- Fixed TUI input typing compatibility after the `@opentui/core` upgrade
|
|
616
|
-
|
|
617
|
-
### v0.2.15 - Slash Command Support
|
|
618
|
-
- Added `/` command support in TUI mode (e.g., `/help`, `/clear`)
|
|
619
|
-
- Both `!` and `/` prefixes now work for all TUI commands
|
|
620
|
-
- Updated help text to show command options
|
|
621
|
-
|
|
622
|
-
### v0.2.14
|
|
623
|
-
- Improved CI/CD workflows
|
|
624
|
-
- Enhanced landing page SEO and structure
|
|
625
|
-
- Fixed bin paths in package.json
|
|
626
|
-
|
|
627
|
-
### v0.2.13
|
|
628
|
-
- Added custom model support (LM Studio, Ollama, OpenAI-compatible)
|
|
629
|
-
- Secure credential storage via system keychain
|
|
630
|
-
- Project context detection for package.json scripts and Makefile
|
|
631
|
-
- Multiple AI providers (OpenCode Zen, OpenRouter)
|
|
632
|
-
- Beautiful TUI with 8 built-in themes
|
|
633
|
-
- Comprehensive safety system with severity levels
|
|
634
|
-
|
|
635
|
-
## Acknowledgments
|
|
636
|
-
|
|
637
|
-
- Built with [Bun](https://bun.sh)
|
|
638
|
-
- TUI powered by [@opentui/core](https://github.com/opentui/core)
|
|
639
|
-
- Theme colors inspired by [OpenCode](https://github.com/anomalyco/opencode)
|
|
640
|
-
|
|
641
|
-
---
|
|
642
|
-
|
|
643
|
-
**Magic Shell** - Type what you mean, execute what you need.
|
|
148
|
+
No test framework is configured yet.
|