rubber-ducky 1.2.2__tar.gz → 1.4.0__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.
Files changed (37) hide show
  1. rubber_ducky-1.4.0/MANIFEST.in +5 -0
  2. rubber_ducky-1.4.0/PKG-INFO +210 -0
  3. rubber_ducky-1.4.0/README.md +194 -0
  4. rubber_ducky-1.4.0/crumbs/disk-usage/disk-usage.sh +12 -0
  5. rubber_ducky-1.4.0/crumbs/disk-usage/info.txt +3 -0
  6. rubber_ducky-1.4.0/crumbs/git-log/git-log.sh +24 -0
  7. rubber_ducky-1.4.0/crumbs/git-log/info.txt +3 -0
  8. rubber_ducky-1.4.0/crumbs/git-status/git-status.sh +21 -0
  9. rubber_ducky-1.4.0/crumbs/git-status/info.txt +3 -0
  10. rubber_ducky-1.4.0/crumbs/process-list/info.txt +3 -0
  11. rubber_ducky-1.4.0/crumbs/process-list/process-list.sh +20 -0
  12. rubber_ducky-1.4.0/crumbs/recent-files/info.txt +3 -0
  13. rubber_ducky-1.4.0/crumbs/recent-files/recent-files.sh +13 -0
  14. rubber_ducky-1.4.0/crumbs/system-health/info.txt +3 -0
  15. rubber_ducky-1.4.0/crumbs/system-health/system-health.sh +58 -0
  16. rubber_ducky-1.4.0/ducky/__init__.py +3 -0
  17. rubber_ducky-1.4.0/ducky/config.py +60 -0
  18. rubber_ducky-1.4.0/ducky/ducky.py +1366 -0
  19. rubber_ducky-1.4.0/examples/POLLING_USER_GUIDE.md +470 -0
  20. rubber_ducky-1.4.0/examples/mock-logs/info.txt +7 -0
  21. rubber_ducky-1.4.0/examples/mock-logs/mock-logs.sh +39 -0
  22. {rubber_ducky-1.2.2 → rubber_ducky-1.4.0}/pyproject.toml +7 -1
  23. rubber_ducky-1.4.0/rubber_ducky.egg-info/PKG-INFO +210 -0
  24. rubber_ducky-1.4.0/rubber_ducky.egg-info/SOURCES.txt +28 -0
  25. rubber_ducky-1.4.0/rubber_ducky.egg-info/top_level.txt +4 -0
  26. rubber_ducky-1.2.2/PKG-INFO +0 -72
  27. rubber_ducky-1.2.2/README.md +0 -56
  28. rubber_ducky-1.2.2/ducky/__init__.py +0 -1
  29. rubber_ducky-1.2.2/ducky/ducky.py +0 -725
  30. rubber_ducky-1.2.2/rubber_ducky.egg-info/PKG-INFO +0 -72
  31. rubber_ducky-1.2.2/rubber_ducky.egg-info/SOURCES.txt +0 -11
  32. rubber_ducky-1.2.2/rubber_ducky.egg-info/top_level.txt +0 -1
  33. {rubber_ducky-1.2.2 → rubber_ducky-1.4.0}/LICENSE +0 -0
  34. {rubber_ducky-1.2.2 → rubber_ducky-1.4.0}/rubber_ducky.egg-info/dependency_links.txt +0 -0
  35. {rubber_ducky-1.2.2 → rubber_ducky-1.4.0}/rubber_ducky.egg-info/entry_points.txt +0 -0
  36. {rubber_ducky-1.2.2 → rubber_ducky-1.4.0}/rubber_ducky.egg-info/requires.txt +0 -0
  37. {rubber_ducky-1.2.2 → rubber_ducky-1.4.0}/setup.cfg +0 -0
@@ -0,0 +1,5 @@
1
+ include README.md
2
+ include LICENSE
3
+ include pyproject.toml
4
+ recursive-include crumbs *
5
+ recursive-include examples *
@@ -0,0 +1,210 @@
1
+ Metadata-Version: 2.4
2
+ Name: rubber-ducky
3
+ Version: 1.4.0
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
+ Rubber Ducky is an inline terminal companion that turns natural language prompts into runnable shell commands. Paste multi-line context, get a suggested command, and run it without leaving your terminal.
20
+
21
+ ## Quick Start
22
+
23
+ | Action | Command |
24
+ | --- | --- |
25
+ | Install globally | `uv tool install rubber-ducky` |
26
+ | Run once | `uvx rubber-ducky -- --help` |
27
+ | Local install | `uv pip install rubber-ducky` |
28
+
29
+ Requirements:
30
+ - [Ollama](https://ollama.com) running locally
31
+ - Model available via Ollama (default: `qwen3-coder:480b-cloud`, install with `ollama pull qwen3-coder:480b-cloud`)
32
+
33
+ ## Usage
34
+
35
+ ```
36
+ ducky # interactive inline session
37
+ ducky --directory src # preload code from a directory
38
+ ducky --model qwen3 # use a different Ollama model
39
+ ducky --local # use local models with gemma2:9b default
40
+ ducky --poll log-crumb # start polling mode for a crumb
41
+ ```
42
+
43
+ Both `ducky` and `rubber-ducky` executables map to the same CLI, so `uvx rubber-ducky -- <args>` works as well.
44
+
45
+ ### Inline Session (default)
46
+
47
+ Launching `ducky` with no arguments opens the inline interface:
48
+ - **Enter** submits; **Ctrl+J** inserts a newline (helpful when crafting multi-line prompts). Hitting **Enter on an empty prompt** reruns the latest suggested command; if none exists yet, it explains the most recent shell output.
49
+ - **Ctrl+R** re-runs the last suggested command.
50
+ - **Ctrl+S** copies the last suggested command to clipboard.
51
+ - Prefix any line with **`!`** (e.g., `!ls -la`) to run a shell command immediately.
52
+ - Arrow keys browse prompt history, backed by `~/.ducky/prompt_history`.
53
+ - Every prompt, assistant response, and executed command is logged to `~/.ducky/conversation.log`.
54
+ - Press **Ctrl+D** on an empty line to exit.
55
+ - Non-interactive runs such as `cat prompt.txt | ducky` print one response (and suggested command) before exiting; if a TTY is available you'll be asked whether to run the suggested command immediately.
56
+ - If `prompt_toolkit` is unavailable in your environment, Rubber Ducky falls back to a basic input loop (no history or shortcuts); install `prompt-toolkit>=3.0.48` to unlock the richer UI.
57
+
58
+ `ducky --directory <path>` streams the contents of the provided directory to the assistant the next time you submit a prompt (the directory is read once at startup).
59
+
60
+ ### Model Management
61
+
62
+ Rubber Ducky now supports easy switching between local and cloud models:
63
+ - **`/model`** - Interactive model selection between local and cloud models
64
+ - **`/local`** - List and select from local models (localhost:11434)
65
+ - **`/cloud`** - List and select from cloud models (ollama.com)
66
+ - Last used model is automatically saved and loaded on startup
67
+ - Type **`esc`** during model selection to cancel
68
+
69
+ ### Additional Commands
70
+
71
+ - **`/help`** - Show all available commands and shortcuts
72
+ - **`/crumbs`** - List all available crumbs (default and user-created)
73
+ - **`/clear`** or **`/reset`** - Clear conversation history
74
+ - **`/poll <crumb>`** - Start polling session for a crumb
75
+ - **`/poll <crumb> -i <interval>`** - Start polling with custom interval
76
+ - **`/poll <crumb> -p <prompt>`** - Start polling with custom prompt
77
+ - **`/stop-poll`** - Stop current polling session
78
+ - **`/run`** or **`:run`** - Re-run the last suggested command
79
+
80
+ ## Crumbs
81
+
82
+ Crumbs are simple scripts that can be executed within Rubber Ducky. They are stored in `~/.ducky/crumbs/` (for user crumbs) and shipped with the package (default crumbs).
83
+
84
+ Rubber Ducky ships with the following default crumbs:
85
+
86
+ | Crumb | Description |
87
+ |-------|-------------|
88
+ | `git-status` | Show current git status and provide suggestions |
89
+ | `git-log` | Show recent commit history with detailed information |
90
+ | `recent-files` | Show recently modified files in current directory |
91
+ | `disk-usage` | Show disk usage with highlights |
92
+ | `system-health` | Show CPU, memory, and system load metrics |
93
+ | `process-list` | Show running processes with analysis |
94
+
95
+ **Tip:** Run `/crumbs` in interactive mode to see all available crumbs with descriptions and polling status.
96
+
97
+ To use a crumb, simply mention it in your prompt:
98
+ ```
99
+ Can you use the git-status crumb to see what needs to be committed?
100
+ ```
101
+
102
+ **Note:** User-defined crumbs (in `~/.ducky/crumbs/`) override default crumbs with the same name.
103
+
104
+ ### Creating Crumbs
105
+
106
+ To create a new crumb:
107
+
108
+ 1. Create a new directory in `~/.ducky/crumbs/` with your crumb name
109
+ 2. Add an `info.txt` file with metadata:
110
+ ```
111
+ name: your-crumb-name
112
+ type: shell
113
+ description: Brief description of what this crumb does
114
+ ```
115
+ 3. Add your executable script file (e.g., `your-crumb-name.sh`)
116
+ 4. Create a symbolic link in `~/.local/bin` to make it available as a command:
117
+ ```bash
118
+ ln -s ~/.ducky/crumbs/your-crumb-name/your-crumb-name.sh ~/.local/bin/your-crumb-name
119
+ ```
120
+
121
+ ### Polling Mode
122
+
123
+ Crumbs can be configured for background polling, where the crumb script runs at intervals and the AI analyzes the output.
124
+
125
+ **Enabling Polling in a Crumb:**
126
+
127
+ Add polling configuration to your crumb's `info.txt`:
128
+ ```
129
+ name: log-crumb
130
+ type: shell
131
+ description: Fetch and analyze server logs
132
+ poll: true
133
+ poll_type: interval # "interval" (run repeatedly) or "continuous" (run once, tail output)
134
+ poll_interval: 5 # seconds between polls
135
+ poll_prompt: Analyze these logs for errors, warnings, or anomalies. Be concise.
136
+ ```
137
+
138
+ **Polling via CLI:**
139
+
140
+ ```bash
141
+ # Start polling with crumb's default configuration
142
+ ducky --poll log-crumb
143
+
144
+ # Override interval
145
+ ducky --poll log-crumb --interval 10
146
+
147
+ # Override prompt
148
+ ducky --poll log-crumb --prompt "Extract only error messages"
149
+ ```
150
+
151
+ **Polling via Interactive Mode:**
152
+
153
+ ```bash
154
+ ducky
155
+ >> /poll log-crumb # Use crumb defaults
156
+ >> /poll log-crumb -i 10 # Override interval
157
+ >> /poll log-crumb -p "Summarize" # Override prompt
158
+ >> /stop-poll # Stop polling
159
+ ```
160
+
161
+ **Example Crumb with Polling:**
162
+
163
+ Directory: `~/.ducky/crumbs/server-logs/`
164
+
165
+ ```
166
+ info.txt:
167
+ name: server-logs
168
+ type: shell
169
+ description: Fetch and analyze server logs
170
+ poll: true
171
+ poll_type: interval
172
+ poll_interval: 5
173
+ poll_prompt: Analyze these logs for errors, warnings, or anomalies. Be concise.
174
+
175
+ server-logs.sh:
176
+ #!/bin/bash
177
+ curl -s http://localhost:8080/logs | tail -50
178
+ ```
179
+
180
+ **Polling Types:**
181
+
182
+ - **interval**: Run the crumb script at regular intervals (default)
183
+ - **continuous**: Run the crumb once in the background and stream its output, analyzing periodically
184
+
185
+ **Stopping Polling:**
186
+
187
+ Press `Ctrl+C` at any time to stop polling. In interactive mode, you can also use `/stop-poll`.
188
+
189
+ ## Documentation
190
+
191
+ - **Polling Feature Guide**: See [examples/POLLING_USER_GUIDE.md](examples/POLLING_USER_GUIDE.md) for detailed instructions on creating and using polling crumbs
192
+ - **Mock Log Crumb**: See [examples/mock-logs/](examples/mock-logs/) for an example polling crumb
193
+
194
+ ## Development (uv)
195
+
196
+ ```
197
+ uv sync
198
+ uv run ducky --help
199
+ ```
200
+
201
+ `uv sync` creates a virtual environment and installs dependencies defined in `pyproject.toml` / `uv.lock`.
202
+
203
+ ## Telemetry & Storage
204
+
205
+ Rubber Ducky stores:
206
+ - `~/.ducky/prompt_history`: readline-compatible history file.
207
+ - `~/.ducky/conversation.log`: JSON lines with timestamps for prompts, assistant messages, and shell executions.
208
+ - `~/.ducky/config`: User preferences including last selected model.
209
+
210
+ No other telemetry is collected; delete the directory if you want a fresh slate.
@@ -0,0 +1,194 @@
1
+ # Rubber Ducky
2
+
3
+ Rubber Ducky is an inline terminal companion that turns natural language prompts into runnable shell commands. Paste multi-line context, get a suggested command, and run it without leaving your terminal.
4
+
5
+ ## Quick Start
6
+
7
+ | Action | Command |
8
+ | --- | --- |
9
+ | Install globally | `uv tool install rubber-ducky` |
10
+ | Run once | `uvx rubber-ducky -- --help` |
11
+ | Local install | `uv pip install rubber-ducky` |
12
+
13
+ Requirements:
14
+ - [Ollama](https://ollama.com) running locally
15
+ - Model available via Ollama (default: `qwen3-coder:480b-cloud`, install with `ollama pull qwen3-coder:480b-cloud`)
16
+
17
+ ## Usage
18
+
19
+ ```
20
+ ducky # interactive inline session
21
+ ducky --directory src # preload code from a directory
22
+ ducky --model qwen3 # use a different Ollama model
23
+ ducky --local # use local models with gemma2:9b default
24
+ ducky --poll log-crumb # start polling mode for a crumb
25
+ ```
26
+
27
+ Both `ducky` and `rubber-ducky` executables map to the same CLI, so `uvx rubber-ducky -- <args>` works as well.
28
+
29
+ ### Inline Session (default)
30
+
31
+ Launching `ducky` with no arguments opens the inline interface:
32
+ - **Enter** submits; **Ctrl+J** inserts a newline (helpful when crafting multi-line prompts). Hitting **Enter on an empty prompt** reruns the latest suggested command; if none exists yet, it explains the most recent shell output.
33
+ - **Ctrl+R** re-runs the last suggested command.
34
+ - **Ctrl+S** copies the last suggested command to clipboard.
35
+ - Prefix any line with **`!`** (e.g., `!ls -la`) to run a shell command immediately.
36
+ - Arrow keys browse prompt history, backed by `~/.ducky/prompt_history`.
37
+ - Every prompt, assistant response, and executed command is logged to `~/.ducky/conversation.log`.
38
+ - Press **Ctrl+D** on an empty line to exit.
39
+ - Non-interactive runs such as `cat prompt.txt | ducky` print one response (and suggested command) before exiting; if a TTY is available you'll be asked whether to run the suggested command immediately.
40
+ - If `prompt_toolkit` is unavailable in your environment, Rubber Ducky falls back to a basic input loop (no history or shortcuts); install `prompt-toolkit>=3.0.48` to unlock the richer UI.
41
+
42
+ `ducky --directory <path>` streams the contents of the provided directory to the assistant the next time you submit a prompt (the directory is read once at startup).
43
+
44
+ ### Model Management
45
+
46
+ Rubber Ducky now supports easy switching between local and cloud models:
47
+ - **`/model`** - Interactive model selection between local and cloud models
48
+ - **`/local`** - List and select from local models (localhost:11434)
49
+ - **`/cloud`** - List and select from cloud models (ollama.com)
50
+ - Last used model is automatically saved and loaded on startup
51
+ - Type **`esc`** during model selection to cancel
52
+
53
+ ### Additional Commands
54
+
55
+ - **`/help`** - Show all available commands and shortcuts
56
+ - **`/crumbs`** - List all available crumbs (default and user-created)
57
+ - **`/clear`** or **`/reset`** - Clear conversation history
58
+ - **`/poll <crumb>`** - Start polling session for a crumb
59
+ - **`/poll <crumb> -i <interval>`** - Start polling with custom interval
60
+ - **`/poll <crumb> -p <prompt>`** - Start polling with custom prompt
61
+ - **`/stop-poll`** - Stop current polling session
62
+ - **`/run`** or **`:run`** - Re-run the last suggested command
63
+
64
+ ## Crumbs
65
+
66
+ Crumbs are simple scripts that can be executed within Rubber Ducky. They are stored in `~/.ducky/crumbs/` (for user crumbs) and shipped with the package (default crumbs).
67
+
68
+ Rubber Ducky ships with the following default crumbs:
69
+
70
+ | Crumb | Description |
71
+ |-------|-------------|
72
+ | `git-status` | Show current git status and provide suggestions |
73
+ | `git-log` | Show recent commit history with detailed information |
74
+ | `recent-files` | Show recently modified files in current directory |
75
+ | `disk-usage` | Show disk usage with highlights |
76
+ | `system-health` | Show CPU, memory, and system load metrics |
77
+ | `process-list` | Show running processes with analysis |
78
+
79
+ **Tip:** Run `/crumbs` in interactive mode to see all available crumbs with descriptions and polling status.
80
+
81
+ To use a crumb, simply mention it in your prompt:
82
+ ```
83
+ Can you use the git-status crumb to see what needs to be committed?
84
+ ```
85
+
86
+ **Note:** User-defined crumbs (in `~/.ducky/crumbs/`) override default crumbs with the same name.
87
+
88
+ ### Creating Crumbs
89
+
90
+ To create a new crumb:
91
+
92
+ 1. Create a new directory in `~/.ducky/crumbs/` with your crumb name
93
+ 2. Add an `info.txt` file with metadata:
94
+ ```
95
+ name: your-crumb-name
96
+ type: shell
97
+ description: Brief description of what this crumb does
98
+ ```
99
+ 3. Add your executable script file (e.g., `your-crumb-name.sh`)
100
+ 4. Create a symbolic link in `~/.local/bin` to make it available as a command:
101
+ ```bash
102
+ ln -s ~/.ducky/crumbs/your-crumb-name/your-crumb-name.sh ~/.local/bin/your-crumb-name
103
+ ```
104
+
105
+ ### Polling Mode
106
+
107
+ Crumbs can be configured for background polling, where the crumb script runs at intervals and the AI analyzes the output.
108
+
109
+ **Enabling Polling in a Crumb:**
110
+
111
+ Add polling configuration to your crumb's `info.txt`:
112
+ ```
113
+ name: log-crumb
114
+ type: shell
115
+ description: Fetch and analyze server logs
116
+ poll: true
117
+ poll_type: interval # "interval" (run repeatedly) or "continuous" (run once, tail output)
118
+ poll_interval: 5 # seconds between polls
119
+ poll_prompt: Analyze these logs for errors, warnings, or anomalies. Be concise.
120
+ ```
121
+
122
+ **Polling via CLI:**
123
+
124
+ ```bash
125
+ # Start polling with crumb's default configuration
126
+ ducky --poll log-crumb
127
+
128
+ # Override interval
129
+ ducky --poll log-crumb --interval 10
130
+
131
+ # Override prompt
132
+ ducky --poll log-crumb --prompt "Extract only error messages"
133
+ ```
134
+
135
+ **Polling via Interactive Mode:**
136
+
137
+ ```bash
138
+ ducky
139
+ >> /poll log-crumb # Use crumb defaults
140
+ >> /poll log-crumb -i 10 # Override interval
141
+ >> /poll log-crumb -p "Summarize" # Override prompt
142
+ >> /stop-poll # Stop polling
143
+ ```
144
+
145
+ **Example Crumb with Polling:**
146
+
147
+ Directory: `~/.ducky/crumbs/server-logs/`
148
+
149
+ ```
150
+ info.txt:
151
+ name: server-logs
152
+ type: shell
153
+ description: Fetch and analyze server logs
154
+ poll: true
155
+ poll_type: interval
156
+ poll_interval: 5
157
+ poll_prompt: Analyze these logs for errors, warnings, or anomalies. Be concise.
158
+
159
+ server-logs.sh:
160
+ #!/bin/bash
161
+ curl -s http://localhost:8080/logs | tail -50
162
+ ```
163
+
164
+ **Polling Types:**
165
+
166
+ - **interval**: Run the crumb script at regular intervals (default)
167
+ - **continuous**: Run the crumb once in the background and stream its output, analyzing periodically
168
+
169
+ **Stopping Polling:**
170
+
171
+ Press `Ctrl+C` at any time to stop polling. In interactive mode, you can also use `/stop-poll`.
172
+
173
+ ## Documentation
174
+
175
+ - **Polling Feature Guide**: See [examples/POLLING_USER_GUIDE.md](examples/POLLING_USER_GUIDE.md) for detailed instructions on creating and using polling crumbs
176
+ - **Mock Log Crumb**: See [examples/mock-logs/](examples/mock-logs/) for an example polling crumb
177
+
178
+ ## Development (uv)
179
+
180
+ ```
181
+ uv sync
182
+ uv run ducky --help
183
+ ```
184
+
185
+ `uv sync` creates a virtual environment and installs dependencies defined in `pyproject.toml` / `uv.lock`.
186
+
187
+ ## Telemetry & Storage
188
+
189
+ Rubber Ducky stores:
190
+ - `~/.ducky/prompt_history`: readline-compatible history file.
191
+ - `~/.ducky/conversation.log`: JSON lines with timestamps for prompts, assistant messages, and shell executions.
192
+ - `~/.ducky/config`: User preferences including last selected model.
193
+
194
+ No other telemetry is collected; delete the directory if you want a fresh slate.
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env bash
2
+
3
+ # Show disk usage with highlights
4
+
5
+ echo "=== Disk Usage Overview ==="
6
+ df -h 2>/dev/null | grep -E "(/|Filesystem)"
7
+
8
+ echo -e "\n=== Detailed Disk Usage ==="
9
+ du -h -d 2 . 2>/dev/null | sort -hr | head -20
10
+
11
+ echo -e "\n=== Largest Files in Current Directory ==="
12
+ find . -type f -not -path '*/\.git/*' -not -path '*/node_modules/*' -not -path '*/venv/*' -not -path '*/\__pycache__/*' -exec du -h {} + 2>/dev/null | sort -rh | head -10
@@ -0,0 +1,3 @@
1
+ name: disk-usage
2
+ type: shell
3
+ description: Show disk usage with highlights on full drives
@@ -0,0 +1,24 @@
1
+ #!/usr/bin/env bash
2
+
3
+ # Show recent commit history with details
4
+
5
+ if ! git rev-parse --git-dir > /dev/null 2>&1; then
6
+ echo "Not a git repository."
7
+ exit 1
8
+ fi
9
+
10
+ # Default to showing last 10 commits
11
+ COMMIT_COUNT=10
12
+
13
+ if [ -n "$1" ] && [[ "$1" =~ ^[0-9]+$ ]]; then
14
+ COMMIT_COUNT=$1
15
+ fi
16
+
17
+ echo "=== Recent ${COMMIT_COUNT} Commits ==="
18
+ git log --oneline -$COMMIT_COUNT
19
+
20
+ echo -e "\n=== Detailed View of Last ${COMMIT_COUNT} Commits ==="
21
+ git log -${COMMIT_COUNT} --pretty=format:"%h - %an, %ar : %s" --stat
22
+
23
+ echo -e "\n=== Author Statistics ==="
24
+ git shortlog -sn --all -${COMMIT_COUNT} 2>/dev/null
@@ -0,0 +1,3 @@
1
+ name: git-log
2
+ type: shell
3
+ description: Show recent commit history with detailed information
@@ -0,0 +1,21 @@
1
+ #!/usr/bin/env bash
2
+
3
+ # Show comprehensive git status and recent activity
4
+
5
+ echo "=== Git Status ==="
6
+ git status --short 2>/dev/null || echo "Not a git repository."
7
+
8
+ echo -e "\n=== Current Branch ==="
9
+ git branch --show-current 2>/dev/null || echo "Not a git repository."
10
+
11
+ echo -e "\n=== Last 3 Commits ==="
12
+ git log --oneline -3 2>/dev/null || echo "No commits found."
13
+
14
+ echo -e "\n=== Staged Changes (if any) ==="
15
+ git diff --cached --stat 2>/dev/null
16
+
17
+ echo -e "\n=== Unstaged Changes (if any) ==="
18
+ git diff --stat 2>/dev/null
19
+
20
+ echo -e "\n=== Untracked Files (if any) ==="
21
+ git ls-files --others --exclude-standard 2>/dev/null | head -20
@@ -0,0 +1,3 @@
1
+ name: git-status
2
+ type: shell
3
+ description: Show current git branch, uncommitted changes, and provide suggestions for next steps
@@ -0,0 +1,3 @@
1
+ name: process-list
2
+ type: shell
3
+ description: Show running processes with key information
@@ -0,0 +1,20 @@
1
+ #!/usr/bin/env bash
2
+
3
+ # Show running processes with useful information
4
+
5
+ echo "=== Running Processes (Top 20 by CPU) ==="
6
+ ps aux | sort -rk 3,3 | head -21 | awk '{printf "%-8s %-6s %-8s %s\n", $1, $2, $3, $11}' | column -t
7
+
8
+ echo -e "\n=== Running Processes (Top 20 by Memory) ==="
9
+ ps aux | sort -rk 4,4 | head -21 | awk '{printf "%-8s %-6s %-8s %s\n", $1, $2, $4, $11}' | column -t
10
+
11
+ echo -e "\n=== Process Counts by User ==="
12
+ ps aux | awk '{print $1}' | sort | uniq -c | sort -rn | head -10
13
+
14
+ echo -e "\n=== Check for Specific Processes ==="
15
+ for proc in "node" "python" "java" "docker" "npm" "uv"; do
16
+ count=$(pgrep -c "$proc" 2>/dev/null || echo "0")
17
+ if [ "$count" -gt 0 ]; then
18
+ echo "$proc: $count process(es)"
19
+ fi
20
+ done | sort
@@ -0,0 +1,3 @@
1
+ name: recent-files
2
+ type: shell
3
+ description: Show recently modified files in the current directory
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env bash
2
+
3
+ # Show recently modified files in current directory
4
+ # Takes optional argument for number of files to show (default 20)
5
+
6
+ FILE_COUNT=20
7
+
8
+ if [ -n "$1" ] && [[ "$1" =~ ^[0-9]+$ ]]; then
9
+ FILE_COUNT=$1
10
+ fi
11
+
12
+ echo "=== ${FILE_COUNT} Most Recently Modified Files ==="
13
+ find . -type f -not -path '*/\.*' -not -path '*/node_modules/*' -not -path '*/\.git/*' -not -path '*/venv/*' -not -path '*/\__pycache__/*' -printf '%T@ %p\n' 2>/dev/null | sort -rn | head -${FILE_COUNT} | awk '{print strftime("%Y-%m-%d %H:%M:%S", $1), $2}'
@@ -0,0 +1,3 @@
1
+ name: system-health
2
+ type: shell
3
+ description: Show system health metrics including CPU, memory, and load
@@ -0,0 +1,58 @@
1
+ #!/usr/bin/env bash
2
+
3
+ # Show system health metrics
4
+ # Works on macOS and Linux
5
+
6
+ detect_os() {
7
+ if [[ "$OSTYPE" == "darwin"* ]]; then
8
+ echo "macos"
9
+ elif [[ "$OSTYPE" == "linux-gnu"* ]]; then
10
+ echo "linux"
11
+ else
12
+ echo "unknown"
13
+ fi
14
+ }
15
+
16
+ OS=$(detect_os)
17
+
18
+ echo "=== System Health ==="
19
+ echo "Platform: $OS"
20
+ echo "Uptime: $(uptime)" | awk '{print $3, $4}'
21
+ echo "Users logged in: $(who | wc -l | tr -d ' ')"
22
+
23
+ echo -e "\n=== CPU Usage ==="
24
+
25
+ if [ "$OS" == "macos" ]; then
26
+ echo "Load averages (1m, 5m, 15m): $(sysctl -n vm.loadavg)"
27
+ top -l 1 | grep "CPU usage"
28
+ elif [ "$OS" == "linux" ]; then
29
+ echo "Load averages (1m, 5m, 15m): $(uptime | awk -F'load average:' '{print $2}')"
30
+ top -bn1 | grep "Cpu(s)"
31
+ fi
32
+
33
+ echo -e "\n=== Memory Usage ==="
34
+
35
+ if [ "$OS" == "macos" ]; then
36
+ # macOS memory
37
+ echo "Memory Stats:"
38
+ vm_stat | perl -ne '/page size of (\d+)/ and $ps=$1; /Pages\s+([^:]+)[^\d]+(\d+)/ and printf("%-16s % 16.2f MB\n", "$1:", $2 * $ps / 1048576);'
39
+ elif [ "$OS" == "linux" ]; then
40
+ free -h
41
+ fi
42
+
43
+ echo -e "\n=== Disk Space ==="
44
+ df -h | grep -vE '^Filesystem|tmpfs|cdrom|devtmpfs'
45
+
46
+ echo -e "\n=== Network Connections ==="
47
+
48
+ if [ "$OS" == "macos" ]; then
49
+ netstat -an | grep ESTABLISHED | wc -l | xargs echo "Active network connections:"
50
+ elif [ "$OS" == "linux" ]; then
51
+ ss -tun | grep ESTAB | wc -l | xargs echo "Active network connections:"
52
+ fi
53
+
54
+ echo -e "\n=== Top 5 Processes by CPU ==="
55
+ ps aux | sort -rk 3,3 | head -11 | tail -10 | awk '{printf "%-10s %6s %s\n", $1, $3, $11}'
56
+
57
+ echo -e "\n=== Top 5 Processes by Memory ==="
58
+ ps aux | sort -rk 4,4 | head -11 | tail -10 | awk '{printf "%-10s %6s %s\n", $1, $4, $11}'
@@ -0,0 +1,3 @@
1
+ from .ducky import ducky, main
2
+
3
+ __all__ = ["ducky", "main"]
@@ -0,0 +1,60 @@
1
+ import json
2
+ import os
3
+ from pathlib import Path
4
+ from typing import Dict, Any, Optional
5
+
6
+
7
+ class ConfigManager:
8
+ """Manages Ducky configuration including model preferences."""
9
+
10
+ def __init__(self, config_dir: Optional[Path] = None):
11
+ if config_dir is None:
12
+ config_dir = Path.home() / ".ducky"
13
+ self.config_dir = config_dir
14
+ self.config_file = self.config_dir / "config"
15
+ self.config_dir.mkdir(parents=True, exist_ok=True)
16
+
17
+ def load_config(self) -> Dict[str, Any]:
18
+ """Load configuration from file, returning defaults if not found."""
19
+ default_config = {
20
+ "last_model": "qwen3-coder:480b-cloud",
21
+ "last_host": "https://ollama.com"
22
+ }
23
+
24
+ if not self.config_file.exists():
25
+ return default_config
26
+
27
+ try:
28
+ with open(self.config_file, 'r') as f:
29
+ config = json.load(f)
30
+ # Ensure all required keys are present
31
+ for key in default_config:
32
+ if key not in config:
33
+ config[key] = default_config[key]
34
+ return config
35
+ except (json.JSONDecodeError, IOError):
36
+ return default_config
37
+
38
+ def save_config(self, config: Dict[str, Any]) -> None:
39
+ """Save configuration to file."""
40
+ try:
41
+ with open(self.config_file, 'w') as f:
42
+ json.dump(config, f, indent=2)
43
+ except IOError as e:
44
+ print(f"Warning: Could not save config: {e}")
45
+
46
+ def get_last_model(self) -> tuple[str, str]:
47
+ """Get the last used model and host.
48
+
49
+ Returns:
50
+ Tuple of (model_name, host)
51
+ """
52
+ config = self.load_config()
53
+ return config.get("last_model", "qwen3-coder:480b-cloud"), config.get("last_host", "https://ollama.com")
54
+
55
+ def save_last_model(self, model_name: str, host: str) -> None:
56
+ """Save the last used model and host."""
57
+ config = self.load_config()
58
+ config["last_model"] = model_name
59
+ config["last_host"] = host
60
+ self.save_config(config)