rubber-ducky 1.5.3__tar.gz → 1.6.1__tar.gz

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.
@@ -0,0 +1,317 @@
1
+ Metadata-Version: 2.4
2
+ Name: rubber-ducky
3
+ Version: 1.6.1
4
+ Summary: Quick CLI do-it-all tool. Use natural language to spit out bash commands
5
+ Requires-Python: >=3.10
6
+ Description-Content-Type: text/markdown
7
+ License-File: LICENSE
8
+ Requires-Dist: colorama>=0.4.6
9
+ Requires-Dist: fastapi>=0.115.11
10
+ Requires-Dist: ollama>=0.6.0
11
+ Requires-Dist: openai>=1.60.2
12
+ Requires-Dist: prompt-toolkit>=3.0.48
13
+ Requires-Dist: rich>=13.9.4
14
+ Requires-Dist: termcolor>=2.5.0
15
+ Dynamic: license-file
16
+
17
+ # Rubber Ducky
18
+
19
+ Turn natural language into bash commands without leaving your terminal.
20
+
21
+ Rubber Ducky is an inline terminal companion that transforms your prompts into runnable shell commands. Paste multi-line context, get smart suggestions, and execute commands instantly.
22
+
23
+ ---
24
+
25
+ ## Quick Start
26
+
27
+ ```bash
28
+ # Install globally (recommended)
29
+ uv tool install rubber-ducky
30
+
31
+ # Run interactively
32
+ ducky
33
+
34
+ # Quick one-shot
35
+ ducky "list all files larger than 10MB in current directory"
36
+
37
+ # From CLI with options
38
+ ducky --model qwen3
39
+ ducky --directory src
40
+ ducky --local
41
+
42
+ # Or use uvx (requires -- separator)
43
+ uvx rubber-ducky -- --model qwen3
44
+ ```
45
+
46
+ Both `ducky` and `rubber-ducky` executables work identically.
47
+
48
+ ### Requirements
49
+
50
+ - [Ollama](https://ollama.com) (running locally or using cloud models)
51
+ - Python 3.10+
52
+
53
+ ---
54
+
55
+ ## Features
56
+
57
+ - **Natural to Shell** - Describe what you want, get the bash command
58
+ - **Model Flexibility** - Switch between local Ollama models and cloud models
59
+ - **Crumbs** - Save and reuse commands with argument substitution
60
+ - **Piped Input** - Pipe output from other commands directly to ducky
61
+ - **Interactive REPL** - Rich terminal experience with history and shortcuts
62
+ - **Code Context** - Preload project code for AI awareness
63
+ - **Clipboard Support** - Copy commands across macOS, Windows, and Linux
64
+
65
+ ---
66
+
67
+ ## Key Concepts
68
+
69
+ ### REPL (Interactive Mode)
70
+
71
+ Launch `ducky` to start an inline session:
72
+
73
+ ```
74
+ ducky
75
+ ```
76
+
77
+ **Key controls:**
78
+ - `Enter` - Submit prompt
79
+ - `Ctrl+J` - Insert newline (for multi-line prompts)
80
+ - `Empty Enter` - Rerun last command or explain shell output
81
+ - `Ctrl+R` - Re-run last suggested command
82
+ - `Ctrl+S` - Copy last command to clipboard
83
+ - `!<cmd>` - Run shell command immediately
84
+ - `Arrow keys` - Browse history
85
+ - `Ctrl+D` - Exit
86
+
87
+ ### Models
88
+
89
+ Rubber Ducky supports both local and cloud models:
90
+
91
+ - `/model` - Interactive model selection
92
+ - `/local` - List local models (localhost:11434)
93
+ - `/cloud` - List cloud models (ollama.com)
94
+ - Last used model is saved automatically
95
+
96
+ **Startup flags:**
97
+ - `--local` / `-l` - Use local Ollama with qwen3 default
98
+ - `--model <name>` / `-m` - Specify model directly
99
+
100
+ ### Crumbs
101
+
102
+ Crumbs are saved command shortcuts. Store frequently-used commands or complex workflows:
103
+
104
+ ```
105
+ >> How do I list all running Python processes?
106
+ ...
107
+ Suggested: ps aux | grep python | grep -v grep
108
+ >> /crumb pyprocs
109
+ Saved crumb 'pyprocs'!
110
+ ```
111
+
112
+ **Invoke crumb:**
113
+ ```
114
+ >> pyprocs
115
+ Crumb: pyprocs
116
+ Command: ps aux | grep python | grep -v grep
117
+ ...
118
+ ```
119
+
120
+ **With argument substitution:**
121
+ ```bash
122
+ # Crumb command: git worktree add "../$var-$other" -b $var3
123
+ ducky at feature backend develop
124
+ # Executes: git worktree add "../feature-backend" -b develop
125
+ ```
126
+
127
+ ---
128
+
129
+ ## Usage Guide
130
+
131
+ ### Interactive Mode
132
+
133
+ Default mode. Perfect for development sessions.
134
+
135
+ ```bash
136
+ ducky
137
+ ```
138
+
139
+ Load code context for better suggestions:
140
+
141
+ ```bash
142
+ ducky --directory src
143
+ ```
144
+
145
+ ### Single-Shot Mode
146
+
147
+ Get one command suggestion and exit.
148
+
149
+ ```bash
150
+ ducky "find all TODO comments in src/"
151
+ ```
152
+
153
+ Copy to clipboard automatically:
154
+
155
+ ```bash
156
+ ducky "build and run tests"
157
+ ```
158
+
159
+ ### Piped Input
160
+
161
+ Process text from other commands:
162
+
163
+ ```bash
164
+ cat error.log | ducky "what's wrong here?"
165
+ git diff | ducky "summarize these changes"
166
+ ```
167
+
168
+ ### Run Without Confirmation
169
+
170
+ Auto-execute suggested commands:
171
+
172
+ ```bash
173
+ ducky --yolo "restart the nginx service"
174
+ ```
175
+
176
+ ---
177
+
178
+ ## Crumbs Quick Reference
179
+
180
+ | Command | Description |
181
+ |---------|-------------|
182
+ | `/crumbs` | List all saved crumbs |
183
+ | `/crumb <name>` | Save last command as crumb |
184
+ | `/crumb add <name> <cmd>` | Manually add crumb |
185
+ | `/crumb del <name>` | Delete crumb |
186
+ | `<name>` | Execute crumb |
187
+ | `/crumb help` | Detailed crumb help |
188
+
189
+ **Argument Substitution:**
190
+
191
+ Crumbs support `${VAR}` and `$var` placeholder styles:
192
+
193
+ ```bash
194
+ # Create crumb with placeholders
195
+ git worktree add "../$var-$other" -b $var3
196
+
197
+ # Invoke with arguments
198
+ ducky at feature backend develop
199
+ ```
200
+
201
+ Both styles are interchangeable.
202
+
203
+ ---
204
+
205
+ ## Command Reference
206
+
207
+ ### Inline Commands
208
+
209
+ | Command | Action |
210
+ |---------|--------|
211
+ | `/help` | Show all commands |
212
+ | `/clear` / `/reset` | Clear conversation history |
213
+ | `/model` | Select model (interactive) |
214
+ | `/local` | List local models |
215
+ | `/cloud` | List cloud models |
216
+ | `/run` / `:run` | Re-run last command |
217
+ | `/expand` | Show full output of last shell command |
218
+
219
+ ### CLI Flags
220
+
221
+ | Flag | Description |
222
+ |------|-------------|
223
+ | `--directory <path>` / `-d` | Preload code from directory |
224
+ | `--model <name>` / `-m` | Specify Ollama model |
225
+ | `--local` / `-l` | Use local Ollama (qwen3 default) |
226
+ | `--yolo` / `-y` | Auto-run without confirmation |
227
+ | `<prompt>` | Single prompt mode (copied to clipboard) |
228
+
229
+ ---
230
+
231
+ ## Tips & Tricks
232
+
233
+ ### Efficient Workflows
234
+
235
+ ```bash
236
+ # Preload project context
237
+ ducky --directory src
238
+
239
+ # Reuse complex commands with crumbs
240
+ docker ps | ducky "kill all containers"
241
+ >> /crumb killall
242
+
243
+ # Chain commands
244
+ !ls -la
245
+ ducksy "find large files"
246
+
247
+ # Use history
248
+ [↑] Recall previous prompts
249
+ [↓] Navigate command history
250
+ ```
251
+
252
+ ### Keyboard Shortcuts Reference
253
+
254
+ | Key | Action |
255
+ |-----|--------|
256
+ | `Enter` | Submit prompt |
257
+ | `Ctrl+J` | Insert newline |
258
+ | `Empty Enter` | Rerun last command or explain |
259
+ | `Ctrl+R` | Re-run last suggested command |
260
+ | `Ctrl+S` | Copy to clipboard |
261
+ | `Ctrl+D` | Exit |
262
+ | `!cmd` | Run shell command directly |
263
+
264
+ ### Crumb Patterns
265
+
266
+ ```bash
267
+ # Save after complex command
268
+ >> docker-compose up -d && wait && docker-compose logs
269
+ >> /crumb start-logs
270
+
271
+ # Manually add with arguments
272
+ >> /crumb add deploy-prod docker build -t app:latest && docker push app:latest
273
+
274
+ # Use for common workflows
275
+ >> ls -la
276
+ find . -type f -name "*.py" | xargs wc -l
277
+ >> /crumb count-py
278
+ ```
279
+
280
+ ---
281
+
282
+ ## Storage
283
+
284
+ Rubber Ducky stores data in `~/.ducky/`:
285
+
286
+ | File | Purpose |
287
+ |------|---------|
288
+ | `prompt_history` | readline-compatible history |
289
+ | `conversation.log` | JSON log of all interactions |
290
+ | `config` | User preferences (last model) |
291
+ | `crumbs.json` | Saved crumb shortcuts |
292
+
293
+ Delete the entire directory for a fresh start.
294
+
295
+ ---
296
+
297
+ ## Development
298
+
299
+ ```bash
300
+ # Clone and setup
301
+ git clone <repo>
302
+ cd ducky
303
+ uv sync
304
+
305
+ # Run
306
+ uv run ducky --help
307
+ uv run ducky
308
+
309
+ # Lint
310
+ uv run ruff check .
311
+ ```
312
+
313
+ ---
314
+
315
+ ## License
316
+
317
+ MIT © 2023 Parth Sareen
@@ -0,0 +1,301 @@
1
+ # Rubber Ducky
2
+
3
+ Turn natural language into bash commands without leaving your terminal.
4
+
5
+ Rubber Ducky is an inline terminal companion that transforms your prompts into runnable shell commands. Paste multi-line context, get smart suggestions, and execute commands instantly.
6
+
7
+ ---
8
+
9
+ ## Quick Start
10
+
11
+ ```bash
12
+ # Install globally (recommended)
13
+ uv tool install rubber-ducky
14
+
15
+ # Run interactively
16
+ ducky
17
+
18
+ # Quick one-shot
19
+ ducky "list all files larger than 10MB in current directory"
20
+
21
+ # From CLI with options
22
+ ducky --model qwen3
23
+ ducky --directory src
24
+ ducky --local
25
+
26
+ # Or use uvx (requires -- separator)
27
+ uvx rubber-ducky -- --model qwen3
28
+ ```
29
+
30
+ Both `ducky` and `rubber-ducky` executables work identically.
31
+
32
+ ### Requirements
33
+
34
+ - [Ollama](https://ollama.com) (running locally or using cloud models)
35
+ - Python 3.10+
36
+
37
+ ---
38
+
39
+ ## Features
40
+
41
+ - **Natural to Shell** - Describe what you want, get the bash command
42
+ - **Model Flexibility** - Switch between local Ollama models and cloud models
43
+ - **Crumbs** - Save and reuse commands with argument substitution
44
+ - **Piped Input** - Pipe output from other commands directly to ducky
45
+ - **Interactive REPL** - Rich terminal experience with history and shortcuts
46
+ - **Code Context** - Preload project code for AI awareness
47
+ - **Clipboard Support** - Copy commands across macOS, Windows, and Linux
48
+
49
+ ---
50
+
51
+ ## Key Concepts
52
+
53
+ ### REPL (Interactive Mode)
54
+
55
+ Launch `ducky` to start an inline session:
56
+
57
+ ```
58
+ ducky
59
+ ```
60
+
61
+ **Key controls:**
62
+ - `Enter` - Submit prompt
63
+ - `Ctrl+J` - Insert newline (for multi-line prompts)
64
+ - `Empty Enter` - Rerun last command or explain shell output
65
+ - `Ctrl+R` - Re-run last suggested command
66
+ - `Ctrl+S` - Copy last command to clipboard
67
+ - `!<cmd>` - Run shell command immediately
68
+ - `Arrow keys` - Browse history
69
+ - `Ctrl+D` - Exit
70
+
71
+ ### Models
72
+
73
+ Rubber Ducky supports both local and cloud models:
74
+
75
+ - `/model` - Interactive model selection
76
+ - `/local` - List local models (localhost:11434)
77
+ - `/cloud` - List cloud models (ollama.com)
78
+ - Last used model is saved automatically
79
+
80
+ **Startup flags:**
81
+ - `--local` / `-l` - Use local Ollama with qwen3 default
82
+ - `--model <name>` / `-m` - Specify model directly
83
+
84
+ ### Crumbs
85
+
86
+ Crumbs are saved command shortcuts. Store frequently-used commands or complex workflows:
87
+
88
+ ```
89
+ >> How do I list all running Python processes?
90
+ ...
91
+ Suggested: ps aux | grep python | grep -v grep
92
+ >> /crumb pyprocs
93
+ Saved crumb 'pyprocs'!
94
+ ```
95
+
96
+ **Invoke crumb:**
97
+ ```
98
+ >> pyprocs
99
+ Crumb: pyprocs
100
+ Command: ps aux | grep python | grep -v grep
101
+ ...
102
+ ```
103
+
104
+ **With argument substitution:**
105
+ ```bash
106
+ # Crumb command: git worktree add "../$var-$other" -b $var3
107
+ ducky at feature backend develop
108
+ # Executes: git worktree add "../feature-backend" -b develop
109
+ ```
110
+
111
+ ---
112
+
113
+ ## Usage Guide
114
+
115
+ ### Interactive Mode
116
+
117
+ Default mode. Perfect for development sessions.
118
+
119
+ ```bash
120
+ ducky
121
+ ```
122
+
123
+ Load code context for better suggestions:
124
+
125
+ ```bash
126
+ ducky --directory src
127
+ ```
128
+
129
+ ### Single-Shot Mode
130
+
131
+ Get one command suggestion and exit.
132
+
133
+ ```bash
134
+ ducky "find all TODO comments in src/"
135
+ ```
136
+
137
+ Copy to clipboard automatically:
138
+
139
+ ```bash
140
+ ducky "build and run tests"
141
+ ```
142
+
143
+ ### Piped Input
144
+
145
+ Process text from other commands:
146
+
147
+ ```bash
148
+ cat error.log | ducky "what's wrong here?"
149
+ git diff | ducky "summarize these changes"
150
+ ```
151
+
152
+ ### Run Without Confirmation
153
+
154
+ Auto-execute suggested commands:
155
+
156
+ ```bash
157
+ ducky --yolo "restart the nginx service"
158
+ ```
159
+
160
+ ---
161
+
162
+ ## Crumbs Quick Reference
163
+
164
+ | Command | Description |
165
+ |---------|-------------|
166
+ | `/crumbs` | List all saved crumbs |
167
+ | `/crumb <name>` | Save last command as crumb |
168
+ | `/crumb add <name> <cmd>` | Manually add crumb |
169
+ | `/crumb del <name>` | Delete crumb |
170
+ | `<name>` | Execute crumb |
171
+ | `/crumb help` | Detailed crumb help |
172
+
173
+ **Argument Substitution:**
174
+
175
+ Crumbs support `${VAR}` and `$var` placeholder styles:
176
+
177
+ ```bash
178
+ # Create crumb with placeholders
179
+ git worktree add "../$var-$other" -b $var3
180
+
181
+ # Invoke with arguments
182
+ ducky at feature backend develop
183
+ ```
184
+
185
+ Both styles are interchangeable.
186
+
187
+ ---
188
+
189
+ ## Command Reference
190
+
191
+ ### Inline Commands
192
+
193
+ | Command | Action |
194
+ |---------|--------|
195
+ | `/help` | Show all commands |
196
+ | `/clear` / `/reset` | Clear conversation history |
197
+ | `/model` | Select model (interactive) |
198
+ | `/local` | List local models |
199
+ | `/cloud` | List cloud models |
200
+ | `/run` / `:run` | Re-run last command |
201
+ | `/expand` | Show full output of last shell command |
202
+
203
+ ### CLI Flags
204
+
205
+ | Flag | Description |
206
+ |------|-------------|
207
+ | `--directory <path>` / `-d` | Preload code from directory |
208
+ | `--model <name>` / `-m` | Specify Ollama model |
209
+ | `--local` / `-l` | Use local Ollama (qwen3 default) |
210
+ | `--yolo` / `-y` | Auto-run without confirmation |
211
+ | `<prompt>` | Single prompt mode (copied to clipboard) |
212
+
213
+ ---
214
+
215
+ ## Tips & Tricks
216
+
217
+ ### Efficient Workflows
218
+
219
+ ```bash
220
+ # Preload project context
221
+ ducky --directory src
222
+
223
+ # Reuse complex commands with crumbs
224
+ docker ps | ducky "kill all containers"
225
+ >> /crumb killall
226
+
227
+ # Chain commands
228
+ !ls -la
229
+ ducksy "find large files"
230
+
231
+ # Use history
232
+ [↑] Recall previous prompts
233
+ [↓] Navigate command history
234
+ ```
235
+
236
+ ### Keyboard Shortcuts Reference
237
+
238
+ | Key | Action |
239
+ |-----|--------|
240
+ | `Enter` | Submit prompt |
241
+ | `Ctrl+J` | Insert newline |
242
+ | `Empty Enter` | Rerun last command or explain |
243
+ | `Ctrl+R` | Re-run last suggested command |
244
+ | `Ctrl+S` | Copy to clipboard |
245
+ | `Ctrl+D` | Exit |
246
+ | `!cmd` | Run shell command directly |
247
+
248
+ ### Crumb Patterns
249
+
250
+ ```bash
251
+ # Save after complex command
252
+ >> docker-compose up -d && wait && docker-compose logs
253
+ >> /crumb start-logs
254
+
255
+ # Manually add with arguments
256
+ >> /crumb add deploy-prod docker build -t app:latest && docker push app:latest
257
+
258
+ # Use for common workflows
259
+ >> ls -la
260
+ find . -type f -name "*.py" | xargs wc -l
261
+ >> /crumb count-py
262
+ ```
263
+
264
+ ---
265
+
266
+ ## Storage
267
+
268
+ Rubber Ducky stores data in `~/.ducky/`:
269
+
270
+ | File | Purpose |
271
+ |------|---------|
272
+ | `prompt_history` | readline-compatible history |
273
+ | `conversation.log` | JSON log of all interactions |
274
+ | `config` | User preferences (last model) |
275
+ | `crumbs.json` | Saved crumb shortcuts |
276
+
277
+ Delete the entire directory for a fresh start.
278
+
279
+ ---
280
+
281
+ ## Development
282
+
283
+ ```bash
284
+ # Clone and setup
285
+ git clone <repo>
286
+ cd ducky
287
+ uv sync
288
+
289
+ # Run
290
+ uv run ducky --help
291
+ uv run ducky
292
+
293
+ # Lint
294
+ uv run ruff check .
295
+ ```
296
+
297
+ ---
298
+
299
+ ## License
300
+
301
+ MIT © 2023 Parth Sareen