bashio 0.4.1 → 0.5.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 CHANGED
@@ -1,8 +1,16 @@
1
1
  # Bashio
2
2
 
3
- > **Natural language to shell commands. Stop Googling, start doing.**
3
+ > Natural language to shell commands. Stop Googling, start doing.
4
4
 
5
- Bashio is an AI-powered CLI tool that translates your everyday language into precise shell commands. Just describe what you want to do, and let AI handle the syntax.
5
+ ```bash
6
+ npm i -g bashio
7
+ ```
8
+
9
+ ---
10
+
11
+ ## What is Bashio?
12
+
13
+ Bashio is an AI-powered CLI tool that converts plain English into shell commands. Instead of searching for the right syntax, just describe what you want to do.
6
14
 
7
15
  ```bash
8
16
  $ b find all files larger than 100mb and delete them
@@ -10,432 +18,215 @@ $ b find all files larger than 100mb and delete them
10
18
  ```
11
19
  > find . -size +100M -type f -delete
12
20
 
13
- ? Execute? (y/n/e/c/edit)
21
+ ? Execute? (y/n/e/c/edit)
14
22
  ```
15
23
 
16
- ---
17
-
18
- ## Features
19
-
20
- - **Natural Language Commands** - Describe tasks in plain English, get executable shell commands
21
- - **Multiple AI Providers** - Choose from Claude, OpenAI, Ollama (local/free), or OpenRouter
22
- - **Custom Shortcuts** - Create reusable command templates with dynamic placeholders
23
- - **Safe Execution** - Review and confirm every command before it runs
24
- - **Dangerous Command Detection** - Extra warnings for potentially destructive operations
25
- - **Explain Mode** - Understand what any command does before executing
26
- - **Command History** - Track all generated commands with usage statistics
27
- - **Smart Suggestions** - Get shortcut recommendations based on your usage patterns
28
- - **Privacy First** - All data stored locally in `~/.bashio/`, never sent to external servers
24
+ You review the command, then choose to execute, edit, or cancel. Simple.
29
25
 
30
26
  ---
31
27
 
32
- ## Installation
33
-
34
- ### Prerequisites
28
+ ## Getting Started
35
29
 
36
- - Node.js 20.12.0 or higher
37
- - pnpm (recommended) or npm
38
-
39
- ### Setup
30
+ ### 1. Install
40
31
 
41
32
  ```bash
42
- # Clone the repository
43
- git clone https://github.com/VrandaaGarg/bashio.git
44
- cd bashio
33
+ npm i -g bashio
34
+ ```
45
35
 
46
- # Install dependencies
47
- pnpm install
36
+ Requires Node.js 20.12.0 or higher.
48
37
 
49
- # Build the project
50
- pnpm build
38
+ ### 2. Setup your AI provider
51
39
 
52
- # Link globally to use 'b' command anywhere
53
- pnpm link --global
40
+ ```bash
41
+ b --auth
54
42
  ```
55
43
 
56
- ### Quick Start
44
+ Choose from Claude, OpenAI, Ollama (free/local), or OpenRouter.
57
45
 
58
- ```bash
59
- # 1. Configure your AI provider
60
- b --auth
46
+ ### 3. Start using it
61
47
 
62
- # 2. Start using natural language commands
63
- b find all png files in current directory
48
+ ```bash
49
+ b show disk usage sorted by size
64
50
  ```
65
51
 
66
- ---
67
-
68
- ## Usage
52
+ That's it. You're ready to go.
69
53
 
70
- ### Natural Language Commands
54
+ ---
71
55
 
72
- Simply prefix your request with `b` and describe what you want:
56
+ ## Examples
73
57
 
74
58
  ```bash
75
59
  # File operations
76
60
  b find all javascript files modified today
77
61
  b delete all node_modules folders recursively
78
- b count lines of code in all typescript files
79
- b compress all images in this folder
62
+ b compress all png images in this folder
80
63
 
81
- # Git operations
82
- b undo the last commit but keep changes
83
- b show commits from last week by author john
84
- b create a new branch called feature/auth
64
+ # Git
65
+ b undo last commit but keep changes
66
+ b show commits from last week by john
85
67
 
86
- # System operations
87
- b show disk usage sorted by size
88
- b what is my public ip address
68
+ # System
89
69
  b kill whatever is running on port 3000
70
+ b what is my public ip address
90
71
  b list all running docker containers
91
72
 
92
- # Network operations
93
- b download this file and save as data.json
94
- b check if google.com is reachable
73
+ # Network
74
+ b download this url and save as data.json
95
75
  ```
96
76
 
97
- ### Confirmation Options
77
+ ---
78
+
79
+ ## Confirmation Options
98
80
 
99
- When a command is generated, you have several options:
81
+ When a command is generated, you can:
100
82
 
101
- | Input | Action |
102
- |-------|--------|
103
- | `y` or `Enter` | Execute the command |
104
- | `n` | Cancel and exit |
105
- | `e` | Explain what the command does (AI-powered) |
106
- | `c` | Copy command to clipboard |
107
- | `edit` | Edit the command before executing |
83
+ | Key | Action |
84
+ |-----|--------|
85
+ | `y` or Enter | Execute the command |
86
+ | `n` | Cancel |
87
+ | `e` | Explain what the command does |
88
+ | `c` | Copy to clipboard |
89
+ | `edit` | Edit the command before running |
108
90
 
109
91
  ---
110
92
 
111
93
  ## Shortcuts
112
94
 
113
- Create reusable command templates for frequently used operations.
95
+ Save commands you use frequently as shortcuts with placeholders.
114
96
 
115
- ### Creating Shortcuts
97
+ ### Create a shortcut
116
98
 
117
99
  ```bash
118
- # Interactive mode
100
+ # Interactive
119
101
  b --add-shortcut
120
102
 
121
- # One-liner with placeholders
103
+ # One-liner
122
104
  b --add-shortcut killport "lsof -ti:{{port}} | xargs kill -9" port
123
-
124
- # Multi-argument shortcut
125
- b --add-shortcut deploy "git push {{remote}} {{branch}}" remote branch
126
105
  ```
127
106
 
128
- ### Using Shortcuts
107
+ ### Use it
129
108
 
130
109
  ```bash
131
- # Single argument - all remaining text becomes the argument
132
110
  b killport 3000
133
-
134
- # Output:
135
- # [shortcut: killport]
136
- # > lsof -ti:3000 | xargs kill -9
137
- # ? Execute? (y/n/e/c/edit)
138
-
139
- # Multi-word single argument (great for commit messages)
140
- b commit "Add user authentication feature"
141
111
  ```
142
-
143
- ### Managing Shortcuts
144
-
145
- ```bash
146
- b --shortcuts # List all shortcuts
147
- b --edit-shortcuts # Edit shortcuts in your default editor
148
- b --remove-shortcut killport # Remove a specific shortcut
149
112
  ```
113
+ [shortcut: killport]
114
+ > lsof -ti:3000 | xargs kill -9
150
115
 
151
- ### Placeholder Syntax
116
+ ? Execute? (y/n/e/c/edit)
117
+ ```
152
118
 
153
- Use `{{name}}` for dynamic arguments:
119
+ ### Manage shortcuts
154
120
 
155
121
  ```bash
156
- # Template: "docker exec -it {{container}} {{cmd}}"
157
- # Args: container, cmd
158
-
159
- b dockerrun myapp bash
160
- # Expands to: docker exec -it myapp bash
122
+ b --shortcuts # List all
123
+ b --edit-shortcuts # Edit in your editor
124
+ b --remove-shortcut name # Delete one
161
125
  ```
162
126
 
163
127
  ---
164
128
 
165
129
  ## AI Providers
166
130
 
167
- Bashio supports multiple AI providers. Configure with `b --auth`:
168
-
169
- | Provider | Auth Method | Cost | Best For |
170
- |----------|-------------|------|----------|
171
- | **Claude** (Anthropic) | API Key | Paid | Best accuracy, complex commands |
172
- | **OpenAI** (ChatGPT) | API Key | Paid | Great all-rounder |
173
- | **Ollama** | Local | Free | Privacy, offline usage |
174
- | **OpenRouter** | API Key | Pay-per-use | Access to multiple models |
175
-
176
- ### Available Models
177
-
178
- #### Claude (Anthropic)
179
- - `claude-sonnet-4-20250514` - Claude Sonnet 4 (recommended)
180
- - `claude-3-5-sonnet-20241022` - Claude 3.5 Sonnet
181
- - `claude-3-5-haiku-20241022` - Claude 3.5 Haiku (fast)
182
-
183
- #### OpenAI
184
- - `gpt-4o` - GPT-4o (recommended)
185
- - `gpt-4o-mini` - GPT-4o Mini (fast)
186
- - `gpt-4-turbo` - GPT-4 Turbo
131
+ Configure with `b --auth`. Supported providers:
187
132
 
188
- #### OpenRouter
189
- - `anthropic/claude-sonnet-4` - Claude Sonnet 4
190
- - `anthropic/claude-3.5-sonnet` - Claude 3.5 Sonnet
191
- - `openai/gpt-4o` - GPT-4o
192
- - `google/gemini-pro-1.5` - Gemini Pro 1.5
193
- - `meta-llama/llama-3.1-70b-instruct` - Llama 3.1 70B
133
+ | Provider | Cost | Notes |
134
+ |----------|------|-------|
135
+ | **Claude** (Anthropic) | Paid | Best accuracy |
136
+ | **OpenAI** (ChatGPT) | Paid | Great all-rounder |
137
+ | **Ollama** | Free | Runs locally, offline |
138
+ | **OpenRouter** | Pay-per-use | Access to multiple models |
194
139
 
195
- #### Ollama (Local)
196
- Any model installed on your machine:
197
- - `llama3.2`, `llama3.1`, `codellama`, `mistral`, `gemma2`, etc.
198
-
199
- ### Switching Models
140
+ Switch models anytime:
200
141
 
201
142
  ```bash
202
- b --model # Interactive model selection
143
+ b --model
203
144
  ```
204
145
 
205
146
  ---
206
147
 
207
- ## History & Statistics
208
-
209
- Bashio tracks your command history for insights and suggestions.
148
+ ## History & Stats
210
149
 
211
- ### View History
150
+ Bashio tracks your command history locally.
212
151
 
213
152
  ```bash
214
- b --history # Show recent command history
215
- b --history --search git # Search history for specific terms
216
- ```
217
-
218
- ### Usage Statistics
219
-
220
- ```bash
221
- b --stats
222
- ```
223
-
224
- ```
225
- Bashio Usage Statistics
226
-
227
- Overview
228
- ┌──────────────────────┬───────────────┐
229
- │ Metric │ Value │
230
- ├──────────────────────┼───────────────┤
231
- │ Commands Generated │ 156 │
232
- │ Executed │ 142 (91%) │
233
- │ Today │ 12 │
234
- │ This Week │ 45 │
235
- └──────────────────────┴───────────────┘
236
-
237
- Most Used Commands
238
- ┌───┬─────────────────────────────────┬──────┬──────────┐
239
- │ # │ Command │ Uses │ Source │
240
- ├───┼─────────────────────────────────┼──────┼──────────┤
241
- │ 1 │ lsof -ti:3000 | xargs kill -9 │ 23 │ shortcut │
242
- │ 2 │ git status │ 18 │ ai │
243
- │ 3 │ docker ps -a │ 15 │ ai │
244
- └───┴─────────────────────────────────┴──────┴──────────┘
245
- ```
246
-
247
- ### Smart Shortcut Suggestions
248
-
249
- Based on your usage patterns, Bashio suggests commands to save as shortcuts:
250
-
251
- ```bash
252
- b --suggest-shortcuts
253
- ```
254
-
255
- ### Clear History
256
-
257
- ```bash
258
- b --clear-history # Clear all history
153
+ b --history # View recent commands
154
+ b --history --search git # Search history
155
+ b --stats # Usage statistics
156
+ b --suggest-shortcuts # Get shortcut suggestions based on usage
157
+ b --clear-history # Clear history
259
158
  ```
260
159
 
261
160
  ---
262
161
 
263
- ## Configuration
264
-
265
- All configuration is stored locally at `~/.bashio/`:
266
-
267
- ```
268
- ~/.bashio/
269
- ├── config.json # Provider settings and preferences
270
- ├── shortcuts.json # Custom shortcuts
271
- └── history.db # Command history (SQLite)
272
- ```
273
-
274
- ### Settings
275
-
276
- The `config.json` file contains customizable settings:
277
-
278
- ```json
279
- {
280
- "version": 1,
281
- "provider": "claude",
282
- "model": "claude-sonnet-4-20250514",
283
- "credentials": {
284
- "type": "api_key",
285
- "apiKey": "sk-ant-..."
286
- },
287
- "settings": {
288
- "confirmBeforeExecute": true,
289
- "historyEnabled": true,
290
- "historyRetentionDays": 30,
291
- "historyMaxEntries": 2000,
292
- "autoConfirmShortcuts": false
293
- }
294
- }
295
- ```
296
-
297
- #### Available Settings
162
+ ## Safety
298
163
 
299
- | Setting | Type | Default | Description |
300
- |---------|------|---------|-------------|
301
- | `confirmBeforeExecute` | boolean | `true` | Require confirmation before running commands |
302
- | `historyEnabled` | boolean | `true` | Track command history |
303
- | `historyRetentionDays` | number | `30` | Days to keep history before auto-cleanup |
304
- | `historyMaxEntries` | number | `2000` | Maximum history entries to retain |
305
- | `autoConfirmShortcuts` | boolean | `false` | Skip confirmation for shortcut commands |
164
+ Bashio detects dangerous commands (like `rm -rf`) and shows extra warnings:
306
165
 
307
- ### View Current Configuration
308
-
309
- ```bash
310
- b --config
311
166
  ```
312
-
313
- ---
314
-
315
- ## CLI Reference
316
-
317
- ### Core Commands
318
-
319
- | Command | Description |
320
- |---------|-------------|
321
- | `b <query>` | Convert natural language to shell command |
322
- | `b <shortcut> [args]` | Execute a saved shortcut |
323
-
324
- ### Configuration
325
-
326
- | Command | Description |
327
- |---------|-------------|
328
- | `b --auth` | Configure AI provider and credentials |
329
- | `b --config` | View current configuration |
330
- | `b --model` | Change the AI model |
331
-
332
- ### Shortcuts Management
333
-
334
- | Command | Description |
335
- |---------|-------------|
336
- | `b --shortcuts` | List all saved shortcuts |
337
- | `b --add-shortcut` | Create a new shortcut (interactive) |
338
- | `b --add-shortcut <name> <template> [args...]` | Create shortcut (one-liner) |
339
- | `b --edit-shortcuts` | Edit shortcuts in default editor |
340
- | `b --remove-shortcut <name>` | Delete a shortcut |
341
-
342
- ### History & Analytics
343
-
344
- | Command | Description |
345
- |---------|-------------|
346
- | `b --history` | View command history |
347
- | `b --stats` | View usage statistics |
348
- | `b --clear-history` | Clear command history |
349
- | `b --suggest-shortcuts` | Get shortcut suggestions based on usage |
350
-
351
- ### Help
352
-
353
- | Command | Description |
354
- |---------|-------------|
355
- | `b --help` | Show help information |
356
- | `b --version` | Show version number |
357
-
358
- ---
359
-
360
- ## Safety Features
361
-
362
- ### Dangerous Command Detection
363
-
364
- Bashio automatically detects potentially dangerous operations and requires explicit confirmation:
365
-
366
- - Recursive deletions (`rm -rf`)
367
- - System-wide operations (`sudo`, root access)
368
- - Force operations (`--force`, `-f` flags)
369
- - Disk operations (formatting, partitioning)
370
-
371
- ```bash
372
- $ b delete everything in the home directory
373
-
374
167
  > rm -rf ~/*
375
168
 
376
169
  WARNING: This command may cause irreversible changes.
377
-
378
170
  Reasons:
379
171
  - Uses recursive force delete (rm -rf)
380
172
  - Targets home directory
381
173
 
382
- ? Proceed with this command? (y/N)
174
+ ? Proceed? (y/N)
383
175
  ```
384
176
 
385
- ### Confirmation by Default
386
-
387
- Every command requires confirmation before execution. You always see exactly what will run.
177
+ Every command requires confirmation before execution.
388
178
 
389
179
  ---
390
180
 
391
- ## Development
181
+ ## All Commands
392
182
 
393
- ```bash
394
- # Install dependencies
395
- pnpm install
396
-
397
- # Development mode (watch for changes)
398
- pnpm dev
183
+ | Command | Description |
184
+ |---------|-------------|
185
+ | `b <query>` | Convert natural language to command |
186
+ | `b <shortcut> [args]` | Run a saved shortcut |
187
+ | `b --auth` | Setup AI provider |
188
+ | `b --model` | Change AI model |
189
+ | `b --config` | View current config |
190
+ | `b --shortcuts` | List shortcuts |
191
+ | `b --add-shortcut` | Create shortcut |
192
+ | `b --remove-shortcut <name>` | Delete shortcut |
193
+ | `b --edit-shortcuts` | Edit shortcuts file |
194
+ | `b --history` | View command history |
195
+ | `b --stats` | Usage statistics |
196
+ | `b --suggest-shortcuts` | Get shortcut suggestions |
197
+ | `b --clear-history` | Clear history |
198
+ | `b --help` | Show help |
199
+ | `b --version` | Show version |
399
200
 
400
- # Build for production
401
- pnpm build
201
+ ---
402
202
 
403
- # Run linter
404
- pnpm lint:check
203
+ ## Configuration
405
204
 
406
- # Fix lint issues
407
- pnpm lint
205
+ All data is stored locally at `~/.bashio/`:
408
206
 
409
- # Type check
410
- pnpm typecheck
207
+ ```
208
+ ~/.bashio/
209
+ ├── config.json # Settings and API keys
210
+ ├── shortcuts.json # Your shortcuts
211
+ └── history.db # Command history
411
212
  ```
412
213
 
413
- ### Tech Stack
214
+ View your config:
414
215
 
415
- - **Runtime**: Node.js 22+, TypeScript 5.9
416
- - **CLI Framework**: Clipanion
417
- - **Database**: better-sqlite3 (SQLite)
418
- - **Validation**: Zod
419
- - **UI**: picocolors, ora, @inquirer/prompts
420
- - **Build**: tsup, Biome
216
+ ```bash
217
+ b --config
218
+ ```
421
219
 
422
220
  ---
423
221
 
424
- ## Privacy & Security
222
+ ## Privacy
425
223
 
426
- - **Local Storage**: All data (config, history, shortcuts) stays on your machine
427
- - **No Telemetry**: No usage data is collected or sent anywhere
428
- - **Secure Credentials**: API keys stored with restricted file permissions (0600)
429
- - **Your Queries**: Only sent to your chosen AI provider for command generation
224
+ - All data stays on your machine
225
+ - No telemetry or tracking
226
+ - Queries only sent to your chosen AI provider
430
227
 
431
228
  ---
432
229
 
433
230
  ## License
434
231
 
435
232
  MIT
436
-
437
- ---
438
-
439
- <p align="center">
440
- <sub>Built with frustration from Googling the same commands over and over.</sub>
441
- </p>
package/dist/index.js CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  // src/cli/index.ts
4
4
  import { Builtins, Cli } from "clipanion";
5
+ import updateNotifier from "update-notifier";
5
6
 
6
7
  // src/core/config.ts
7
8
  import {
@@ -2470,6 +2471,26 @@ var SuggestShortcutsCommand = class extends Command12 {
2470
2471
  };
2471
2472
 
2472
2473
  // src/cli/index.ts
2474
+ var pkg = {
2475
+ name: "bashio",
2476
+ version: "0.5.0"
2477
+ };
2478
+ var notifier = updateNotifier({
2479
+ pkg,
2480
+ updateCheckInterval: 1e3 * 60 * 60 * 24
2481
+ // 1 day
2482
+ });
2483
+ notifier.notify({
2484
+ message: "Bashio update available: {currentVersion} \u2192 {latestVersion}\nRun: {updateCommand}",
2485
+ boxenOptions: {
2486
+ padding: 1,
2487
+ margin: 1,
2488
+ borderStyle: "round",
2489
+ borderColor: "cyan",
2490
+ title: "\u2728 Update Available",
2491
+ titleAlignment: "center"
2492
+ }
2493
+ });
2473
2494
  initDatabase();
2474
2495
  if (shouldRunCleanup()) {
2475
2496
  const config = loadConfig();
@@ -2480,7 +2501,7 @@ if (shouldRunCleanup()) {
2480
2501
  var cli = new Cli({
2481
2502
  binaryLabel: "Bashio",
2482
2503
  binaryName: "b",
2483
- binaryVersion: "0.4.0"
2504
+ binaryVersion: pkg.version
2484
2505
  });
2485
2506
  cli.register(DefaultCommand);
2486
2507
  cli.register(AuthCommand);