@austinthesing/magic-shell 0.2.13 → 0.2.15

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
@@ -7,7 +7,8 @@ Magic Shell is an open-source CLI tool that translates plain English (or any nat
7
7
  ## Features
8
8
 
9
9
  - **Natural Language Translation**: Describe what you want to do in plain English
10
- - **Multiple AI Providers**: OpenCode Zen (with free models!) and OpenRouter
10
+ - **Multiple AI Providers**: OpenCode Zen (with free models!), OpenRouter, and custom models (LM Studio, Ollama, OpenAI-compatible)
11
+ - **Custom Model Support**: Add your own local or remote models with secure API key storage
11
12
  - **Project Context Aware**: Opt-in detection of package.json scripts, Makefile targets, etc.
12
13
  - **Interactive TUI Mode**: Full-featured terminal interface with themes
13
14
  - **Command Safety Analysis**: Multi-level safety checks before executing commands
@@ -88,23 +89,26 @@ mshell
88
89
 
89
90
  ### Command Reference
90
91
 
91
- | Command | Description |
92
- |---------|-------------|
93
- | `msh <query>` | Translate query to command and print it |
94
- | `msh -x <query>` | Translate and execute the command |
95
- | `msh -n <query>` | Dry run - show command with safety analysis |
96
- | `mshell` | Launch interactive TUI mode |
97
- | `msh --setup` | Configure API keys and provider |
98
- | `msh --models` | List available models |
99
- | `msh --model <id>` | Set default model |
100
- | `msh --provider <name>` | Set provider (opencode-zen or openrouter) |
101
- | `msh --themes` | List available themes |
102
- | `msh --theme <name>` | Set color theme |
103
- | `msh --repo-context` | Enable project context detection |
104
- | `msh -r <query>` | Use project context for single query |
105
- | `msh --version` | Show version |
106
- | `msh --check-update` | Check for updates |
107
- | `msh --help` | Show help |
92
+ | Command | Description |
93
+ | ------------------------- | ------------------------------------------- |
94
+ | `msh <query>` | Translate query to command and print it |
95
+ | `msh -x <query>` | Translate and execute the command |
96
+ | `msh -n <query>` | Dry run - show command with safety analysis |
97
+ | `mshell` | Launch interactive TUI mode |
98
+ | `msh --setup` | Configure API keys and provider |
99
+ | `msh --models` | List available models |
100
+ | `msh --model <id>` | Set default model (including custom models) |
101
+ | `msh --add-model` | Add custom model (LM Studio, Ollama, etc.) |
102
+ | `msh --list-custom` | List custom models |
103
+ | `msh --remove-model <id>` | Remove custom model |
104
+ | `msh --provider <name>` | Set provider (opencode-zen or openrouter) |
105
+ | `msh --themes` | List available themes |
106
+ | `msh --theme <name>` | Set color theme |
107
+ | `msh --repo-context` | Enable project context detection |
108
+ | `msh -r <query>` | Use project context for single query |
109
+ | `msh --version` | Show version |
110
+ | `msh --check-update` | Check for updates |
111
+ | `msh --help` | Show help |
108
112
 
109
113
  ### Examples
110
114
 
@@ -139,33 +143,35 @@ Launch with `mshell` for a full interactive experience.
139
143
 
140
144
  All shortcuts use the `Ctrl+X` chord (press Ctrl+X, then the key):
141
145
 
142
- | Shortcut | Action |
143
- |----------|--------|
144
- | `Ctrl+X P` | Open command palette |
145
- | `Ctrl+X M` | Change model |
146
- | `Ctrl+X S` | Switch provider |
147
- | `Ctrl+X D` | Toggle dry-run mode |
148
- | `Ctrl+X T` | Change theme |
146
+ | Shortcut | Action |
147
+ | ---------- | ---------------------- |
148
+ | `Ctrl+X P` | Open command palette |
149
+ | `Ctrl+X M` | Change model |
150
+ | `Ctrl+X S` | Switch provider |
151
+ | `Ctrl+X D` | Toggle dry-run mode |
152
+ | `Ctrl+X T` | Change theme |
149
153
  | `Ctrl+X R` | Toggle project context |
150
- | `Ctrl+X H` | Show history |
151
- | `Ctrl+X C` | Show config |
152
- | `Ctrl+X L` | Clear output |
153
- | `Ctrl+X ?` | Show help |
154
- | `Ctrl+X Q` | Exit |
155
- | `Ctrl+C` | Exit / Cancel |
156
- | `Esc` | Close dialogs |
154
+ | `Ctrl+X H` | Show history |
155
+ | `Ctrl+X C` | Show config |
156
+ | `Ctrl+X L` | Clear output |
157
+ | `Ctrl+X ?` | Show help |
158
+ | `Ctrl+X Q` | Exit |
159
+ | `Ctrl+C` | Exit / Cancel |
160
+ | `Esc` | Close dialogs |
157
161
 
158
162
  ### Direct Commands in TUI
159
163
 
160
164
  You can also type commands directly in the TUI:
161
165
 
162
- - `!help` - Show help
163
- - `!model` - Change model
164
- - `!provider` - Switch provider
165
- - `!dry` - Toggle dry-run mode
166
- - `!config` - Show current configuration
167
- - `!history` - Show command history
168
- - `!clear` - Clear output
166
+ - `!help` or `/help` - Show help
167
+ - `!model` or `/model` - Change model
168
+ - `!provider` or `/provider` - Switch provider
169
+ - `!dry` or `/dry` - Toggle dry-run mode
170
+ - `!config` or `/config` - Show current configuration
171
+ - `!history` or `/history` - Show command history
172
+ - `!clear` or `/clear` - Clear output
173
+
174
+ > **Note:** Both `!` and `/` prefixes work for all commands. Use whichever feels more natural!
169
175
 
170
176
  ## AI Providers
171
177
 
@@ -174,15 +180,21 @@ You can also type commands directly in the TUI:
174
180
  OpenCode Zen provides curated models optimized for coding tasks, including **free models**.
175
181
 
176
182
  **Free Models:**
183
+
177
184
  - `big-pickle` - Stealth model (default)
178
- - `grok-code` - xAI's Grok Code Fast 1
179
185
  - `glm-4.7` - GLM 4.7
186
+ - `minimax-m2.1` - MiniMax's capable model
187
+ - `kimi-k2.5` - Moonshot's latest model
180
188
 
181
189
  **Premium Models:**
190
+
182
191
  - Claude Sonnet 4.5, Claude Opus 4.5
192
+ - Claude Haiku 4.5
183
193
  - Kimi K2, Kimi K2 Thinking
184
194
  - Qwen3 Coder 480B
185
195
  - GLM 4.6
196
+ - Gemini 3 Pro, Gemini 3 Flash
197
+ - GPT 5.2, GPT 5.2 Codex, GPT 5.1 series
186
198
  - And more...
187
199
 
188
200
  Get your API key at: https://opencode.ai/auth
@@ -192,29 +204,71 @@ Get your API key at: https://opencode.ai/auth
192
204
  Access to a wide variety of models from different providers.
193
205
 
194
206
  **Free Models:**
207
+
195
208
  - MiMo V2 Flash
196
209
  - DeepSeek V3
197
210
 
198
211
  **Premium Models:**
212
+
199
213
  - Claude Sonnet 4.5, Claude Opus 4.5
214
+ - Claude Haiku 4.5
200
215
  - DeepSeek R1
201
216
  - GLM 4.7
217
+ - Gemini 2.5 Pro, Gemini 2.5 Flash (stable until June 2026)
202
218
  - And many more...
203
219
 
204
220
  Get your API key at: https://openrouter.ai/keys
205
221
 
222
+ ### Custom Models
223
+
224
+ Magic Shell supports custom models for local or remote OpenAI-compatible endpoints, including:
225
+
226
+ - **LM Studio** - Run models locally
227
+ - **Ollama** - Local model management
228
+ - **Any OpenAI-compatible API** - Self-hosted or third-party endpoints
229
+
230
+ **Adding a Custom Model:**
231
+
232
+ ```bash
233
+ # Interactive setup
234
+ msh --add-model
235
+
236
+ # You'll be prompted for:
237
+ # - Model ID (for referencing, e.g., "my-local-llama")
238
+ # - Display name (e.g., "Local Llama 3.2")
239
+ # - API model ID (sent to server, e.g., "llama-3.2-3b")
240
+ # - Base URL (e.g., "http://localhost:1234/v1")
241
+ # - API key (optional, stored securely in keychain)
242
+ # - Category (fast/smart/reasoning)
243
+ ```
244
+
245
+ **Managing Custom Models:**
246
+
247
+ ```bash
248
+ # List all custom models
249
+ msh --list-custom
250
+
251
+ # Set a custom model as default
252
+ msh --model my-local-llama
253
+
254
+ # Remove a custom model
255
+ msh --remove-model my-local-llama
256
+ ```
257
+
258
+ Custom model API keys are securely stored in your system keychain, just like provider API keys.
259
+
206
260
  ## Safety System
207
261
 
208
262
  Magic Shell includes a comprehensive safety analysis system that categorizes commands by risk level:
209
263
 
210
264
  ### Severity Levels
211
265
 
212
- | Level | Description | Examples |
213
- |-------|-------------|----------|
266
+ | Level | Description | Examples |
267
+ | ------------ | -------------------------------------- | --------------------------------------- |
214
268
  | **Critical** | Could cause irreversible system damage | `rm -rf /`, fork bombs, disk overwrites |
215
- | **High** | Significant changes or data loss risk | `sudo rm`, `kill -9 -1`, `shutdown` |
216
- | **Medium** | Requires elevated privileges | `sudo`, `chmod`, package removal |
217
- | **Low** | Worth reviewing | `git checkout`, `npm install` |
269
+ | **High** | Significant changes or data loss risk | `sudo rm`, `kill -9 -1`, `shutdown` |
270
+ | **Medium** | Requires elevated privileges | `sudo`, `chmod`, package removal |
271
+ | **Low** | Worth reviewing | `git checkout`, `npm install` |
218
272
 
219
273
  ### Safety Levels
220
274
 
@@ -227,6 +281,7 @@ Configure your preferred safety level:
227
281
  ### Blocked Commands
228
282
 
229
283
  Certain dangerous patterns are always blocked:
284
+
230
285
  - Fork bombs
231
286
  - Direct disk writes (`> /dev/sda`)
232
287
  - Filesystem formatting (`mkfs`)
@@ -247,17 +302,27 @@ Configuration is stored in `~/.magic-shell/config.json`.
247
302
  "repoContext": false,
248
303
  "theme": "opencode",
249
304
  "blockedCommands": [...],
250
- "confirmedDangerousPatterns": [...]
305
+ "confirmedDangerousPatterns": [...],
306
+ "customModels": [
307
+ {
308
+ "id": "my-local-llama",
309
+ "name": "Local Llama 3.2",
310
+ "modelId": "llama-3.2-3b",
311
+ "baseUrl": "http://localhost:1234/v1",
312
+ "contextLength": 128000,
313
+ "category": "smart"
314
+ }
315
+ ]
251
316
  }
252
317
  ```
253
318
 
254
319
  ### Environment Variables
255
320
 
256
- | Variable | Description |
257
- |----------|-------------|
258
- | `OPENCODE_ZEN_API_KEY` | API key for OpenCode Zen |
259
- | `OPENROUTER_API_KEY` | API key for OpenRouter |
260
- | `DEBUG_API=1` | Enable API response debugging |
321
+ | Variable | Description |
322
+ | ---------------------- | ----------------------------- |
323
+ | `OPENCODE_ZEN_API_KEY` | API key for OpenCode Zen |
324
+ | `OPENROUTER_API_KEY` | API key for OpenRouter |
325
+ | `DEBUG_API=1` | Enable API response debugging |
261
326
 
262
327
  ## Themes
263
328
 
@@ -273,6 +338,7 @@ Magic Shell includes 8 beautiful themes:
273
338
  - `matrix` - Classic green terminal
274
339
 
275
340
  Change themes:
341
+
276
342
  ```bash
277
343
  # CLI
278
344
  msh --theme tokyonight
@@ -295,12 +361,12 @@ Magic Shell automatically detects and adapts to your shell:
295
361
 
296
362
  ## Platform Support
297
363
 
298
- | Platform | Shell Detection | Keychain Storage |
299
- |----------|-----------------|------------------|
300
- | macOS | Full | macOS Keychain |
301
- | Linux | Full | libsecret (secret-tool) |
302
- | Windows | Full | Credential Manager |
303
- | WSL | Full (detected) | libsecret |
364
+ | Platform | Shell Detection | Keychain Storage |
365
+ | -------- | --------------- | ----------------------- |
366
+ | macOS | Full | macOS Keychain |
367
+ | Linux | Full | libsecret (secret-tool) |
368
+ | Windows | Full | Credential Manager |
369
+ | WSL | Full (detected) | libsecret |
304
370
 
305
371
  ## Development
306
372
 
@@ -351,18 +417,14 @@ src/
351
417
  ```json
352
418
  {
353
419
  "name": "@austinthesing/magic-shell",
354
- "version": "0.2.2",
420
+ "version": "0.2.13",
355
421
  "description": "Natural language to terminal commands with safety features",
356
422
  "main": "dist/index.js",
357
423
  "bin": {
358
- "msh": "./dist/index.js",
359
- "mshell": "./dist/tui.js"
424
+ "msh": "dist/index.js",
425
+ "mshell": "dist/tui.js"
360
426
  },
361
- "files": [
362
- "dist",
363
- "README.md",
364
- "LICENSE"
365
- ],
427
+ "files": ["dist", "README.md", "LICENSE"],
366
428
  "repository": {
367
429
  "type": "git",
368
430
  "url": "https://github.com/austin-thesing/magic-shell.git"
@@ -371,37 +433,30 @@ src/
371
433
  "bugs": {
372
434
  "url": "https://github.com/austin-thesing/magic-shell/issues"
373
435
  },
374
- "keywords": [
375
- "cli",
376
- "terminal",
377
- "natural-language",
378
- "shell",
379
- "ai",
380
- "openrouter",
381
- "opencode",
382
- "command-line"
383
- ],
436
+ "keywords": ["cli", "terminal", "natural-language", "shell", "ai", "openrouter", "opencode", "command-line"],
384
437
  "author": "Your Name <your@email.com>",
385
438
  "license": "MIT"
386
439
  }
387
440
  ```
388
441
 
389
442
  2. **Build the project:**
443
+
390
444
  ```bash
391
445
  bun run build
392
446
  ```
393
447
 
394
448
  3. **Test locally before publishing:**
449
+
395
450
  ```bash
396
451
  # Create a tarball
397
452
  npm pack
398
-
453
+
399
454
  # Install it globally to test
400
455
  npm install -g ./magic-shell-0.1.0.tgz
401
-
456
+
402
457
  # Test it works
403
458
  msh --help
404
-
459
+
405
460
  # Uninstall test version
406
461
  npm uninstall -g magic-shell
407
462
  ```
@@ -419,18 +474,20 @@ npm publish --access public
419
474
  ### Releasing New Versions
420
475
 
421
476
  1. **Update version** (follows [semver](https://semver.org/)):
477
+
422
478
  ```bash
423
479
  # Patch release (bug fixes): 0.1.0 -> 0.1.1
424
480
  npm version patch
425
-
481
+
426
482
  # Minor release (new features): 0.1.0 -> 0.2.0
427
483
  npm version minor
428
-
484
+
429
485
  # Major release (breaking changes): 0.1.0 -> 1.0.0
430
486
  npm version major
431
487
  ```
432
488
 
433
489
  2. **Push tags to GitHub:**
490
+
434
491
  ```bash
435
492
  git push origin main --tags
436
493
  ```
@@ -450,29 +507,29 @@ name: Release
450
507
  on:
451
508
  push:
452
509
  tags:
453
- - 'v*'
510
+ - "v*"
454
511
 
455
512
  jobs:
456
513
  release:
457
514
  runs-on: ubuntu-latest
458
515
  steps:
459
516
  - uses: actions/checkout@v4
460
-
517
+
461
518
  - uses: oven-sh/setup-bun@v1
462
519
  with:
463
520
  bun-version: latest
464
-
521
+
465
522
  - name: Install dependencies
466
523
  run: bun install
467
-
524
+
468
525
  - name: Build
469
526
  run: bun run build
470
-
527
+
471
528
  - name: Publish to npm
472
529
  run: npm publish
473
530
  env:
474
531
  NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
475
-
532
+
476
533
  - name: Create GitHub Release
477
534
  uses: softprops/action-gh-release@v1
478
535
  with:
@@ -480,6 +537,7 @@ jobs:
480
537
  ```
481
538
 
482
539
  Add your npm token to GitHub:
540
+
483
541
  1. Generate token at https://www.npmjs.com/settings/tokens (use "Automation" type)
484
542
  2. Add to repository secrets as `NPM_TOKEN`
485
543
 
@@ -515,6 +573,26 @@ Contributions are welcome! Please feel free to submit a Pull Request.
515
573
 
516
574
  MIT License - see [LICENSE](LICENSE) for details.
517
575
 
576
+ ## Release Notes
577
+
578
+ ### v0.2.15 - Slash Command Support
579
+ - Added `/` command support in TUI mode (e.g., `/help`, `/clear`)
580
+ - Both `!` and `/` prefixes now work for all TUI commands
581
+ - Updated help text to show command options
582
+
583
+ ### v0.2.14
584
+ - Improved CI/CD workflows
585
+ - Enhanced landing page SEO and structure
586
+ - Fixed bin paths in package.json
587
+
588
+ ### v0.2.13
589
+ - Added custom model support (LM Studio, Ollama, OpenAI-compatible)
590
+ - Secure credential storage via system keychain
591
+ - Project context detection for package.json scripts and Makefile
592
+ - Multiple AI providers (OpenCode Zen, OpenRouter)
593
+ - Beautiful TUI with 8 built-in themes
594
+ - Comprehensive safety system with severity levels
595
+
518
596
  ## Acknowledgments
519
597
 
520
598
  - Built with [Bun](https://bun.sh)
package/dist/cli.js CHANGED
@@ -59466,7 +59466,7 @@ async function handleInput(value) {
59466
59466
  if (!input)
59467
59467
  return;
59468
59468
  inputField.setText("");
59469
- if (input.startsWith("!")) {
59469
+ if (input.startsWith("!") || input.startsWith("/")) {
59470
59470
  await handleSpecialCommand(input);
59471
59471
  return;
59472
59472
  }
@@ -59657,6 +59657,12 @@ T Change theme R Toggle repo context
59657
59657
  H Show history L Clear chat
59658
59658
  C Show config ? This help
59659
59659
 
59660
+ Commands (type ! or / followed by):
59661
+ help Show this help model Change model
59662
+ provider Switch provider dry Toggle dry-run
59663
+ config Show configuration history Show history
59664
+ clear Clear chat
59665
+
59660
59666
  Safety Levels:
59661
59667
  - strict: Confirm ALL potentially dangerous commands
59662
59668
  - moderate: Confirm high/critical severity commands (default)
@@ -59664,6 +59670,7 @@ Safety Levels:
59664
59670
 
59665
59671
  Tips:
59666
59672
  - Type naturally: "list all files" -> ls -la
59673
+ - Use ! or / commands: !help or /help
59667
59674
  - Reference history: "do that again", "undo"
59668
59675
  - Enable repo context to use project scripts (Ctrl+X R)`;
59669
59676
  addSystemMessage(helpText);
package/dist/tui.js CHANGED
@@ -59466,7 +59466,7 @@ async function handleInput(value) {
59466
59466
  if (!input)
59467
59467
  return;
59468
59468
  inputField.setText("");
59469
- if (input.startsWith("!")) {
59469
+ if (input.startsWith("!") || input.startsWith("/")) {
59470
59470
  await handleSpecialCommand(input);
59471
59471
  return;
59472
59472
  }
@@ -59657,6 +59657,12 @@ T Change theme R Toggle repo context
59657
59657
  H Show history L Clear chat
59658
59658
  C Show config ? This help
59659
59659
 
59660
+ Commands (type ! or / followed by):
59661
+ help Show this help model Change model
59662
+ provider Switch provider dry Toggle dry-run
59663
+ config Show configuration history Show history
59664
+ clear Clear chat
59665
+
59660
59666
  Safety Levels:
59661
59667
  - strict: Confirm ALL potentially dangerous commands
59662
59668
  - moderate: Confirm high/critical severity commands (default)
@@ -59664,6 +59670,7 @@ Safety Levels:
59664
59670
 
59665
59671
  Tips:
59666
59672
  - Type naturally: "list all files" -> ls -la
59673
+ - Use ! or / commands: !help or /help
59667
59674
  - Reference history: "do that again", "undo"
59668
59675
  - Enable repo context to use project scripts (Ctrl+X R)`;
59669
59676
  addSystemMessage(helpText);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@austinthesing/magic-shell",
3
- "version": "0.2.13",
3
+ "version": "0.2.15",
4
4
  "description": "Natural language to terminal commands with safety features. Supports OpenCode Zen (with free models) and OpenRouter.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",