copa-cli 0.8.0__tar.gz → 0.9.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.
- {copa_cli-0.8.0 → copa_cli-0.9.0}/PKG-INFO +244 -164
- {copa_cli-0.8.0 → copa_cli-0.9.0}/README.md +243 -163
- {copa_cli-0.8.0 → copa_cli-0.9.0}/copa/cli.py +2 -1
- {copa_cli-0.8.0 → copa_cli-0.9.0}/copa/cli_internal.py +52 -5
- copa_cli-0.9.0/copa/cli_recipe.py +196 -0
- {copa_cli-0.8.0 → copa_cli-0.9.0}/copa/config.py +38 -58
- {copa_cli-0.8.0 → copa_cli-0.9.0}/copa/copa.zsh +140 -51
- {copa_cli-0.8.0 → copa_cli-0.9.0}/copa/db.py +152 -10
- {copa_cli-0.8.0 → copa_cli-0.9.0}/copa/fzf.py +39 -1
- {copa_cli-0.8.0 → copa_cli-0.9.0}/copa/mcp_server.py +57 -0
- {copa_cli-0.8.0 → copa_cli-0.9.0}/copa/models.py +72 -1
- copa_cli-0.9.0/copa/scoring.py +73 -0
- {copa_cli-0.8.0 → copa_cli-0.9.0}/copa/sharing.py +23 -1
- {copa_cli-0.8.0 → copa_cli-0.9.0}/copa_cli.egg-info/PKG-INFO +244 -164
- {copa_cli-0.8.0 → copa_cli-0.9.0}/copa_cli.egg-info/SOURCES.txt +1 -0
- {copa_cli-0.8.0 → copa_cli-0.9.0}/pyproject.toml +1 -1
- {copa_cli-0.8.0 → copa_cli-0.9.0}/tests/test_modal.py +34 -88
- copa_cli-0.8.0/copa/scoring.py +0 -45
- {copa_cli-0.8.0 → copa_cli-0.9.0}/LICENSE +0 -0
- {copa_cli-0.8.0 → copa_cli-0.9.0}/copa/__init__.py +0 -0
- {copa_cli-0.8.0 → copa_cli-0.9.0}/copa/__main__.py +0 -0
- {copa_cli-0.8.0 → copa_cli-0.9.0}/copa/cli_common.py +0 -0
- {copa_cli-0.8.0 → copa_cli-0.9.0}/copa/cli_llm.py +0 -0
- {copa_cli-0.8.0 → copa_cli-0.9.0}/copa/cli_share.py +0 -0
- {copa_cli-0.8.0 → copa_cli-0.9.0}/copa/evolve.py +0 -0
- {copa_cli-0.8.0 → copa_cli-0.9.0}/copa/history.py +0 -0
- {copa_cli-0.8.0 → copa_cli-0.9.0}/copa/llm.py +0 -0
- {copa_cli-0.8.0 → copa_cli-0.9.0}/copa/scanner.py +0 -0
- {copa_cli-0.8.0 → copa_cli-0.9.0}/copa_cli.egg-info/dependency_links.txt +0 -0
- {copa_cli-0.8.0 → copa_cli-0.9.0}/copa_cli.egg-info/entry_points.txt +0 -0
- {copa_cli-0.8.0 → copa_cli-0.9.0}/copa_cli.egg-info/requires.txt +0 -0
- {copa_cli-0.8.0 → copa_cli-0.9.0}/copa_cli.egg-info/top_level.txt +0 -0
- {copa_cli-0.8.0 → copa_cli-0.9.0}/setup.cfg +0 -0
- {copa_cli-0.8.0 → copa_cli-0.9.0}/tests/test_cli_and_sharing.py +0 -0
- {copa_cli-0.8.0 → copa_cli-0.9.0}/tests/test_db.py +0 -0
- {copa_cli-0.8.0 → copa_cli-0.9.0}/tests/test_fzf.py +0 -0
- {copa_cli-0.8.0 → copa_cli-0.9.0}/tests/test_models.py +0 -0
- {copa_cli-0.8.0 → copa_cli-0.9.0}/tests/test_polish.py +0 -0
- {copa_cli-0.8.0 → copa_cli-0.9.0}/tests/test_scanner.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: copa-cli
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.9.0
|
|
4
4
|
Summary: Command Palette — smart command tracking, ranking, and sharing for your shell
|
|
5
5
|
Author: Mark Stanford
|
|
6
6
|
License-Expression: MIT
|
|
@@ -36,14 +36,14 @@ Dynamic: license-file
|
|
|
36
36
|
|
|
37
37
|
Copa tracks the commands you run, ranks them by frequency and recency, and gives you instant fuzzy search via fzf. Think of it as a smart, searchable, shareable upgrade to shell history.
|
|
38
38
|
|
|
39
|
-

|
|
40
40
|
|
|
41
41
|
## Features
|
|
42
42
|
|
|
43
|
-
- **Smart ranking** — commands scored by `2*log(1+freq) + 8*0.5^(age/3d)`, so frequent
|
|
43
|
+
- **Smart ranking** — commands scored by `2*log(1+freq) + 8*0.5^(age/3d)`, so frequent _and_ recent commands float to the top
|
|
44
44
|
- **FTS search** — full-text search across commands and their descriptions
|
|
45
|
-
- **fzf integration** — Ctrl+R opens a fuzzy-searchable command palette with preview pane; searches across commands
|
|
46
|
-
- **Tab completion** — Copa supplements zsh's tab completion for
|
|
45
|
+
- **fzf integration** — Ctrl+R opens a fuzzy-searchable command palette with preview pane; searches across commands _and_ their descriptions
|
|
46
|
+
- **Tab completion** — Copa supplements zsh's tab completion for _any_ command using your command history database
|
|
47
47
|
- **Auto-evolution** — `copa evolve` finds your most-used commands from zsh history and promotes them
|
|
48
48
|
- **LLM descriptions** — `copa fix --auto` uses Claude or ollama to generate descriptions for undescribed commands
|
|
49
49
|
- **Script protocol** — `#@ Description:` / `#@ Usage:` / `#@ Purpose:` / `#@ Flag:` headers in your scripts are auto-detected by `copa scan` across all `$PATH` directories
|
|
@@ -51,6 +51,8 @@ Copa tracks the commands you run, ranks them by frequency and recency, and gives
|
|
|
51
51
|
- **Inline suggestions** — ghost text appears as you type; Tab accepts or opens a completion menu with the suggestion highlighted
|
|
52
52
|
- **Groups & Ctrl+G** — organize commands by project, device, or workflow; assign groups inline from the fzf palette with Ctrl+G
|
|
53
53
|
- **Bulk operations** — Ctrl+B enters select mode for batch group assignment, batch deletion, or batch LLM description
|
|
54
|
+
- **Recipes** — save multi-step command sequences as named recipes; `copa recipe run deploy` executes steps sequentially; share recipes via `.copa` files
|
|
55
|
+
- **Directory-aware suggestions** — commands used in the current directory are boosted in suggestions; automatic, configurable, zero-effort
|
|
54
56
|
- **Sharing & `copa create`** — export/import command sets as `.copa` JSON files; `copa create` scaffolds a `.copa` file from an existing group
|
|
55
57
|
- **Set filtering** — scope list, search, and fzf to a specific shared set with `--set`
|
|
56
58
|
- **MCP server** — expose your commands to Claude Code (or any MCP client)
|
|
@@ -98,6 +100,7 @@ copa setup
|
|
|
98
100
|
```
|
|
99
101
|
|
|
100
102
|
This walks you through everything:
|
|
103
|
+
|
|
101
104
|
1. Checks that **fzf** is installed (tells you how to install if missing)
|
|
102
105
|
2. Creates the Copa database (`~/.copa/copa.db`)
|
|
103
106
|
3. Adds shell integration to your `~/.zshrc` (prompts for confirmation)
|
|
@@ -156,35 +159,34 @@ This is the key difference from plain zsh Ctrl+R: you're not just searching raw
|
|
|
156
159
|
|
|
157
160
|
The header shows available modes. Press **Ctrl+R** again while fzf is open to cycle:
|
|
158
161
|
|
|
159
|
-
| Mode
|
|
160
|
-
|
|
161
|
-
| `all`
|
|
162
|
-
| `frequent` | Frequency only
|
|
163
|
-
| `recent`
|
|
162
|
+
| Mode | Sort order | Use case |
|
|
163
|
+
| ---------- | --------------------------- | ------------------------------------ |
|
|
164
|
+
| `all` | Score (frequency + recency) | Default — best commands float to top |
|
|
165
|
+
| `frequent` | Frequency only | Find your most-used commands |
|
|
166
|
+
| `recent` | Last used time | Find commands you ran recently |
|
|
167
|
+
| `recipes` | Run count | Browse and run multi-step recipes |
|
|
164
168
|
|
|
165
169
|
### Keybindings
|
|
166
170
|
|
|
167
171
|
While the fzf palette is open, these keys are available:
|
|
168
172
|
|
|
169
|
-
| Key
|
|
170
|
-
|
|
171
|
-
| **Ctrl+R** | Cycle mode
|
|
172
|
-
| **Ctrl+
|
|
173
|
-
| **Ctrl+
|
|
174
|
-
| **Ctrl+
|
|
175
|
-
| **Ctrl+T** | Append `>` | Redirect output |
|
|
176
|
-
| **Ctrl+A** | Append `&&` | Chain with next command |
|
|
177
|
-
| **Ctrl+/** | Append `2>/dev/null` | Suppress stderr |
|
|
178
|
-
| **Ctrl+S** | Scope by group | Opens inline group list — Enter filters to that group, ESC returns to all |
|
|
179
|
-
| **Ctrl+G** | Assign group | Opens inline group list — Enter assigns the group to the highlighted command |
|
|
173
|
+
| Key | Action | Effect |
|
|
174
|
+
| ---------- | -------------------- | ---------------------------------------------------------------------------- |
|
|
175
|
+
| **Ctrl+R** | Cycle mode | all → frequent → recent → recipes → all |
|
|
176
|
+
| **Ctrl+X** | Compose | Opens a numbered menu to append shell operators (`\|`, `&&`, `>`, `&`, etc.) |
|
|
177
|
+
| **Ctrl+S** | Scope by group | Opens inline group list — Enter filters to that group, ESC returns to all |
|
|
178
|
+
| **Ctrl+G** | Assign group | Opens inline group list — Enter assigns the group to the highlighted command |
|
|
180
179
|
|
|
181
180
|

|
|
182
|
-
|
|
183
|
-
|
|
|
184
|
-
|
|
|
185
|
-
| **Ctrl+
|
|
186
|
-
| **Ctrl+
|
|
187
|
-
| **
|
|
181
|
+
|
|
182
|
+
| Key | Action | Effect |
|
|
183
|
+
| ---------- | ------------- | ------------------------------------------------------------------- |
|
|
184
|
+
| **Ctrl+N** | Cycle group | Cycles through groups: (all) → group1 → group2 → ... → (all) |
|
|
185
|
+
| **Ctrl+D** | Describe | Generate/edit a description using LLM (with tty-aware input) |
|
|
186
|
+
| **Ctrl+F** | Edit flags | Add flag documentation to the highlighted command |
|
|
187
|
+
| **Ctrl+B** | Select mode | Enter multi-select for bulk operations (see below) |
|
|
188
|
+
| **Ctrl+H** | Toggle header | Show/hide the key hints for more screen space |
|
|
189
|
+
| **ESC** | Cancel/back | In scope/group mode: returns to command list. Otherwise: closes fzf |
|
|
188
190
|
|
|
189
191
|
Keybindings are configurable via `~/.copa/config.toml`. See [Configuration](#configuration).
|
|
190
192
|
|
|
@@ -210,11 +212,11 @@ Selected 5 command(s).
|
|
|
210
212
|
Action:
|
|
211
213
|
```
|
|
212
214
|
|
|
213
|
-
| Action | What it does
|
|
214
|
-
|
|
215
|
-
| **g**
|
|
216
|
-
| **d**
|
|
217
|
-
| **a**
|
|
215
|
+
| Action | What it does |
|
|
216
|
+
| ------ | -------------------------------------------------------------------------------------- |
|
|
217
|
+
| **g** | Assign all selected commands to a group (or clear their group) |
|
|
218
|
+
| **d** | Delete all selected commands (with confirmation) |
|
|
219
|
+
| **a** | Auto-generate descriptions for all selected commands using your configured LLM backend |
|
|
218
220
|
|
|
219
221
|
This is useful for organizing large command sets — select 20 undescribed commands and batch-describe them, or move a set of related commands into a group in one step.
|
|
220
222
|
|
|
@@ -238,12 +240,12 @@ Copa supplements zsh's built-in tab completion for **any** command — not just
|
|
|
238
240
|
|
|
239
241
|
Copa supports four completion modes, configured via `~/.copa/config.toml`:
|
|
240
242
|
|
|
241
|
-
| Mode
|
|
242
|
-
|
|
243
|
+
| Mode | Behavior |
|
|
244
|
+
| ---------- | ----------------------------------------------------------------------------- |
|
|
243
245
|
| `fallback` | **(default)** Only show Copa completions when native completers found nothing |
|
|
244
|
-
| `hybrid`
|
|
245
|
-
| `always`
|
|
246
|
-
| `never`
|
|
246
|
+
| `hybrid` | Show Copa completions alongside native completions (in a separate group) |
|
|
247
|
+
| `always` | Copa completions replace native completions |
|
|
248
|
+
| `never` | Disable Copa tab completion entirely |
|
|
247
249
|
|
|
248
250
|
```toml
|
|
249
251
|
# ~/.copa/config.toml
|
|
@@ -281,8 +283,8 @@ Copa's own CLI completions (`copa li<TAB>` → `list`) continue to work as befor
|
|
|
281
283
|
|
|
282
284
|
## Inline Suggestions (Ghost Text)
|
|
283
285
|
|
|
284
|
-
| Tab Mode 1 (direct accept)
|
|
285
|
-
|
|
286
|
+
| Tab Mode 1 (direct accept) | Tab Mode 2 (menu select, default) |
|
|
287
|
+
| -------------------------------------------------- | -------------------------------------------------- |
|
|
286
288
|
|  |  |
|
|
287
289
|
|
|
288
290
|
Copa shows grey ghost text after your cursor as you type — the best matching command from your database, ranked by frequency and recency. This works like fish shell's autosuggestions or zsh-autosuggestions, with zero plugin dependencies.
|
|
@@ -297,44 +299,49 @@ $ git pu█sh origin main ← grey ghost text
|
|
|
297
299
|
|
|
298
300
|
### Keybindings
|
|
299
301
|
|
|
300
|
-
| Key
|
|
301
|
-
|
|
302
|
-
| Type chars
|
|
303
|
-
| Backspace
|
|
304
|
-
| **Tab**
|
|
305
|
-
| **Down**
|
|
306
|
-
| **Right arrow**
|
|
307
|
-
| **Cmd+Right / End** | Accept full suggestion
|
|
308
|
-
| Enter
|
|
309
|
-
| Esc
|
|
310
|
-
| Up
|
|
311
|
-
| Ctrl+R
|
|
302
|
+
| Key | Suggestion showing | No suggestion |
|
|
303
|
+
| ------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------- |
|
|
304
|
+
| Type chars | Insert char, re-fetch suggestion | Insert char, fetch suggestion |
|
|
305
|
+
| Backspace | Delete char, **latch** (suppress suggestions) | Delete char normally |
|
|
306
|
+
| **Tab** | `tab_accept=1`: accept full suggestion. `tab_accept=2` (default): open completion menu with suggestion highlighted at top, native completions below | If latched: unlatch + re-fetch suggestion. Else: normal tab completion |
|
|
307
|
+
| **Down** | Open completion menu with suggestion highlighted at top | History navigation |
|
|
308
|
+
| **Right arrow** | Accept one word, re-fetch | Move cursor right |
|
|
309
|
+
| **Cmd+Right / End** | Accept full suggestion | Move to end of line |
|
|
310
|
+
| Enter | Clear suggestion, execute | Execute |
|
|
311
|
+
| Esc | Dismiss suggestion | Normal Esc |
|
|
312
|
+
| Up | Clear suggestion, navigate history | History navigation |
|
|
313
|
+
| Ctrl+R | Clear suggestion, open fzf | Open fzf |
|
|
312
314
|
|
|
313
315
|
### Tab accept mode
|
|
314
316
|
|
|
315
317
|
Copa supports two Tab behaviors when a suggestion is showing:
|
|
316
318
|
|
|
317
319
|
**Menu select** (`tab_accept = 2`, default):
|
|
320
|
+
|
|
318
321
|
1. Press **Tab** — ghost text clears, a completion menu opens with the Copa suggestion highlighted at the top, alongside native completions below
|
|
319
|
-
2. Press **Tab**
|
|
320
|
-
3. Press **
|
|
321
|
-
4.
|
|
322
|
+
2. Press **Tab** to cycle through options, **Shift+Tab** to cycle backward
|
|
323
|
+
3. Press **Enter** or **Space** — accepts the highlighted item
|
|
324
|
+
4. Press **Escape** — cancels the menu, restores your original text
|
|
325
|
+
5. Use **arrow keys** to navigate if you want a different completion
|
|
322
326
|
|
|
323
327
|
This gives you a chance to see alternatives before committing. The Copa suggestion is always the first item in the menu.
|
|
324
328
|
|
|
325
329
|
**Inline accept** (`tab_accept = 1`):
|
|
330
|
+
|
|
326
331
|
- Press **Tab** — the suggestion is accepted directly into your command line. One keystroke, done.
|
|
327
332
|
|
|
328
333
|
### Completion menu navigation
|
|
329
334
|
|
|
330
335
|
When the completion menu is open (from Tab in `tab_accept = 2` mode or from normal tab completion):
|
|
331
336
|
|
|
332
|
-
| Key
|
|
333
|
-
|
|
334
|
-
| **Tab**
|
|
335
|
-
| **
|
|
336
|
-
| **
|
|
337
|
-
| **
|
|
337
|
+
| Key | Action |
|
|
338
|
+
| -------------- | -------------------------------------------- |
|
|
339
|
+
| **Tab** | Cycle forward through completions |
|
|
340
|
+
| **Shift+Tab** | Cycle backward through completions |
|
|
341
|
+
| **Enter** | Accept the highlighted completion (no trailing space added) |
|
|
342
|
+
| **Space** | Accept the highlighted completion and add a space |
|
|
343
|
+
| **Escape** | Cancel — dismiss menu, restore original text |
|
|
344
|
+
| **Arrow keys** | Navigate between completions |
|
|
338
345
|
|
|
339
346
|
### Backspace latch
|
|
340
347
|
|
|
@@ -489,12 +496,12 @@ Flags:
|
|
|
489
496
|
|
|
490
497
|
### Supported headers
|
|
491
498
|
|
|
492
|
-
| Header
|
|
493
|
-
|
|
494
|
-
| `#@ Description: <text>`
|
|
495
|
-
| `#@ Usage: <text>`
|
|
496
|
-
| `#@ Purpose: <text>`
|
|
497
|
-
| `#@ Flag: <flag>: <description>` | Document a flag/option (repeatable)
|
|
499
|
+
| Header | Effect |
|
|
500
|
+
| -------------------------------- | ----------------------------------------------- |
|
|
501
|
+
| `#@ Description: <text>` | Sets the command description (highest priority) |
|
|
502
|
+
| `#@ Usage: <text>` | Usage / invocation syntax |
|
|
503
|
+
| `#@ Purpose: <text>` | Why the script exists / when to use it |
|
|
504
|
+
| `#@ Flag: <flag>: <description>` | Document a flag/option (repeatable) |
|
|
498
505
|
|
|
499
506
|
Scripts without `#@` headers still work — Copa falls back to legacy patterns (`# Description:`, `# Purpose:`, Python docstrings, generic comments).
|
|
500
507
|
|
|
@@ -531,25 +538,25 @@ copa share sync /path/to/team/copa-files/
|
|
|
531
538
|
|
|
532
539
|
Copa ships with ready-to-use `.copa` files in the [`examples/`](examples/) directory:
|
|
533
540
|
|
|
534
|
-
| File
|
|
535
|
-
|
|
536
|
-
| [`git.copa`](examples/git.copa)
|
|
537
|
-
| [`docker.copa`](examples/docker.copa)
|
|
538
|
-
| [`python-dev.copa`](examples/python-dev.copa)
|
|
539
|
-
| [`npm.copa`](examples/npm.copa)
|
|
540
|
-
| [`network.copa`](examples/network.copa)
|
|
541
|
-
| [`curl-http.copa`](examples/curl-http.copa)
|
|
542
|
-
| [`ssh-remote.copa`](examples/ssh-remote.copa)
|
|
543
|
-
| [`adb.copa`](examples/adb.copa)
|
|
544
|
-
| [`aws.copa`](examples/aws.copa)
|
|
545
|
-
| [`terraform.copa`](examples/terraform.copa)
|
|
546
|
-
| [`k8s.copa`](examples/k8s.copa)
|
|
547
|
-
| [`systemd.copa`](examples/systemd.copa)
|
|
548
|
-
| [`sysadmin.copa`](examples/sysadmin.copa)
|
|
549
|
-
| [`process-monitoring.copa`](examples/process-monitoring.copa) | Process management and debugging
|
|
550
|
-
| [`disk-files.copa`](examples/disk-files.copa)
|
|
551
|
-
| [`tmux.copa`](examples/tmux.copa)
|
|
552
|
-
| [`homebrew.copa`](examples/homebrew.copa)
|
|
541
|
+
| File | Description |
|
|
542
|
+
| ------------------------------------------------------------- | -------------------------------------- |
|
|
543
|
+
| [`git.copa`](examples/git.copa) | Essential Git commands |
|
|
544
|
+
| [`docker.copa`](examples/docker.copa) | Docker container management |
|
|
545
|
+
| [`python-dev.copa`](examples/python-dev.copa) | Python development workflow |
|
|
546
|
+
| [`npm.copa`](examples/npm.copa) | Node.js package management |
|
|
547
|
+
| [`network.copa`](examples/network.copa) | Network diagnostics |
|
|
548
|
+
| [`curl-http.copa`](examples/curl-http.copa) | HTTP requests and API testing |
|
|
549
|
+
| [`ssh-remote.copa`](examples/ssh-remote.copa) | SSH, SCP, and remote server management |
|
|
550
|
+
| [`adb.copa`](examples/adb.copa) | Android Debug Bridge |
|
|
551
|
+
| [`aws.copa`](examples/aws.copa) | AWS CLI cloud infrastructure |
|
|
552
|
+
| [`terraform.copa`](examples/terraform.copa) | Terraform infrastructure-as-code |
|
|
553
|
+
| [`k8s.copa`](examples/k8s.copa) | Kubernetes cluster management |
|
|
554
|
+
| [`systemd.copa`](examples/systemd.copa) | Linux service management |
|
|
555
|
+
| [`sysadmin.copa`](examples/sysadmin.copa) | System administration |
|
|
556
|
+
| [`process-monitoring.copa`](examples/process-monitoring.copa) | Process management and debugging |
|
|
557
|
+
| [`disk-files.copa`](examples/disk-files.copa) | Disk usage and file management |
|
|
558
|
+
| [`tmux.copa`](examples/tmux.copa) | Terminal multiplexer sessions |
|
|
559
|
+
| [`homebrew.copa`](examples/homebrew.copa) | Homebrew package manager (macOS) |
|
|
553
560
|
|
|
554
561
|
Load any of them:
|
|
555
562
|
|
|
@@ -590,29 +597,96 @@ alias copa-bt='copa fzf-list --set bluetooth | fzf'
|
|
|
590
597
|
|
|
591
598
|
```json
|
|
592
599
|
{
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
600
|
+
"copa_version": "1.0",
|
|
601
|
+
"name": "bluetooth",
|
|
602
|
+
"description": "Bluetooth commands for Android devices",
|
|
603
|
+
"author": "markstanford",
|
|
604
|
+
"commands": [
|
|
605
|
+
{
|
|
606
|
+
"command": "adb shell cmd bluetooth_manager enable",
|
|
607
|
+
"description": "Enable Bluetooth",
|
|
608
|
+
"tags": ["bt", "android"]
|
|
609
|
+
},
|
|
610
|
+
{
|
|
611
|
+
"command": "flash_all",
|
|
612
|
+
"description": "Flash AOSP build to device",
|
|
613
|
+
"tags": ["aosp"],
|
|
614
|
+
"flags": {
|
|
615
|
+
"-w, --wipe": "Wipe userdata before flashing",
|
|
616
|
+
"--skip <parts>": "Skip specific partitions"
|
|
617
|
+
}
|
|
618
|
+
}
|
|
619
|
+
],
|
|
620
|
+
"recipes": [
|
|
621
|
+
{
|
|
622
|
+
"name": "bt-debug",
|
|
623
|
+
"description": "Enable BT and start logging",
|
|
624
|
+
"steps": [
|
|
625
|
+
{"command": "adb shell cmd bluetooth_manager enable", "description": "Enable BT"},
|
|
626
|
+
{"command": "adb logcat -s bt_btif | tee bt.log", "description": "Start BT logging"}
|
|
627
|
+
]
|
|
628
|
+
}
|
|
629
|
+
]
|
|
613
630
|
}
|
|
614
631
|
```
|
|
615
632
|
|
|
633
|
+
## Recipes
|
|
634
|
+
|
|
635
|
+

|
|
636
|
+
|
|
637
|
+
Recipes are named, ordered sequences of commands — like a script, but tracked and shareable through Copa.
|
|
638
|
+
|
|
639
|
+
### Creating recipes
|
|
640
|
+
|
|
641
|
+
```bash
|
|
642
|
+
# Simple recipe
|
|
643
|
+
copa recipe add deploy \
|
|
644
|
+
-s 'npm run build' \
|
|
645
|
+
-s 'docker build -t app .' \
|
|
646
|
+
-s 'docker push app'
|
|
647
|
+
|
|
648
|
+
# With descriptions (use :: separator)
|
|
649
|
+
copa recipe add deploy \
|
|
650
|
+
-d "Full production deploy" \
|
|
651
|
+
-g devops \
|
|
652
|
+
-s 'npm run build :: Build the project' \
|
|
653
|
+
-s 'npm run test :: Run test suite' \
|
|
654
|
+
-s 'docker push app :: Push to registry'
|
|
655
|
+
```
|
|
656
|
+
|
|
657
|
+
### Running recipes
|
|
658
|
+
|
|
659
|
+
```bash
|
|
660
|
+
# Run all steps sequentially
|
|
661
|
+
copa recipe run deploy
|
|
662
|
+
|
|
663
|
+
# Preview without executing
|
|
664
|
+
copa recipe run deploy --dry-run
|
|
665
|
+
|
|
666
|
+
# Continue past failures
|
|
667
|
+
copa recipe run deploy --no-stop-on-error
|
|
668
|
+
```
|
|
669
|
+
|
|
670
|
+
### Managing recipes
|
|
671
|
+
|
|
672
|
+
```bash
|
|
673
|
+
copa recipe list # List all recipes
|
|
674
|
+
copa recipe list --json # JSON output
|
|
675
|
+
copa recipe show deploy # Show steps
|
|
676
|
+
copa recipe remove deploy # Delete a recipe
|
|
677
|
+
```
|
|
678
|
+
|
|
679
|
+
### Sharing recipes
|
|
680
|
+
|
|
681
|
+
Recipes are included in `.copa` files automatically — when you export a group, its recipes come along:
|
|
682
|
+
|
|
683
|
+
```bash
|
|
684
|
+
copa share export devops -o devops.copa # includes recipes in that group
|
|
685
|
+
copa share load devops.copa # imports commands AND recipes
|
|
686
|
+
```
|
|
687
|
+
|
|
688
|
+
See `examples/docker.copa` and `examples/deploy.copa` for recipe examples.
|
|
689
|
+
|
|
616
690
|
## MCP Server (Claude Code integration)
|
|
617
691
|
|
|
618
692
|
Copa includes an MCP server so Claude Code can search and add commands.
|
|
@@ -627,16 +701,17 @@ Add to your Claude Code MCP config (`.mcp.json` in your project or home dir):
|
|
|
627
701
|
|
|
628
702
|
```json
|
|
629
703
|
{
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
}
|
|
704
|
+
"mcpServers": {
|
|
705
|
+
"copa": {
|
|
706
|
+
"command": "python3",
|
|
707
|
+
"args": ["-m", "copa.mcp_server"]
|
|
635
708
|
}
|
|
709
|
+
}
|
|
636
710
|
}
|
|
637
711
|
```
|
|
638
712
|
|
|
639
713
|
Available MCP tools:
|
|
714
|
+
|
|
640
715
|
- `copa_search` — search commands by keyword
|
|
641
716
|
- `copa_list_commands` — list commands ranked by score
|
|
642
717
|
- `copa_list_groups` — list all groups
|
|
@@ -653,6 +728,10 @@ Available MCP tools:
|
|
|
653
728
|
- `copa_share_list` — list all loaded shared sets
|
|
654
729
|
- `copa_share_remove` — remove a shared set
|
|
655
730
|
- `copa_export_group` — export a group as a .copa file
|
|
731
|
+
- `copa_recipe_list` — list all recipes
|
|
732
|
+
- `copa_recipe_show` — show a recipe's steps
|
|
733
|
+
- `copa_recipe_add` — create a recipe from ordered steps
|
|
734
|
+
- `copa_recipe_remove` — remove a recipe
|
|
656
735
|
|
|
657
736
|
## Configuration
|
|
658
737
|
|
|
@@ -665,12 +744,7 @@ Copa is configured via `~/.copa/config.toml`. All settings are optional — Copa
|
|
|
665
744
|
# Values are fzf key names: ctrl-<letter>, alt-<letter>, ctrl-/
|
|
666
745
|
# ctrl-r and enter are reserved and cannot be reassigned
|
|
667
746
|
[keys]
|
|
668
|
-
|
|
669
|
-
merge_output = "ctrl-o" # append 2>&1
|
|
670
|
-
pipe = "ctrl-x" # append |
|
|
671
|
-
redirect = "ctrl-t" # append >
|
|
672
|
-
chain = "ctrl-a" # append &&
|
|
673
|
-
suppress = "ctrl-/" # append 2>/dev/null
|
|
747
|
+
compose = "ctrl-x" # open compose submenu (|, &&, >, &, 2>&1, 2>/dev/null)
|
|
674
748
|
describe = "ctrl-d" # LLM describe
|
|
675
749
|
group = "ctrl-g" # assign group (inline modal)
|
|
676
750
|
flags = "ctrl-f" # edit flags
|
|
@@ -690,38 +764,37 @@ enabled = true # set to false to disable
|
|
|
690
764
|
min_length = 2 # minimum chars before querying
|
|
691
765
|
tab_accept = 2 # 1 = accept directly, 2 = open menu first
|
|
692
766
|
color = 242 # ghost text color (256-color palette)
|
|
767
|
+
directory_aware = true # boost suggestions from the current directory
|
|
693
768
|
|
|
694
|
-
#
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
continue = ["pipe", "chain", "redirect"] # default: |, &&, > re-open fzf
|
|
769
|
+
# Fzf layout
|
|
770
|
+
[layout]
|
|
771
|
+
height = "80%" # fzf height (default: 80%)
|
|
772
|
+
preview_size = "40%" # preview pane width (default: 40%)
|
|
699
773
|
```
|
|
700
774
|
|
|
701
|
-
###
|
|
775
|
+
### Compose submenu
|
|
702
776
|
|
|
703
777
|

|
|
704
778
|
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
By default, "connector" operators re-open fzf:
|
|
708
|
-
- `pipe` (`|`) — continue
|
|
709
|
-
- `chain` (`&&`) — continue
|
|
710
|
-
- `redirect` (`>`) — continue
|
|
779
|
+
Press **Ctrl+X** while a command is highlighted to open the compose submenu — a numbered menu of shell operators:
|
|
711
780
|
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
781
|
+
```
|
|
782
|
+
Compose: 1)| 2)&& 3)> 4)& 5)2>&1 6)2>/dev/null
|
|
783
|
+
Select [1-6]:
|
|
784
|
+
```
|
|
716
785
|
|
|
717
|
-
|
|
786
|
+
| # | Operator | Behavior | What happens |
|
|
787
|
+
|---|---------------|------------|-------------------------------------------------------------|
|
|
788
|
+
| 1 | `\|` | continue | Appends `\|` and re-opens fzf to select the next command |
|
|
789
|
+
| 2 | `&&` | continue | Appends `&&` and re-opens fzf to chain another command |
|
|
790
|
+
| 3 | `>` | continue | Appends `>` and re-opens fzf for the target |
|
|
791
|
+
| 4 | `&` | close | Appends `&` and closes — run in background |
|
|
792
|
+
| 5 | `2>&1` | close | Appends `2>&1` and closes — merge stderr |
|
|
793
|
+
| 6 | `2>/dev/null` | close | Appends `2>/dev/null` and closes — suppress stderr |
|
|
718
794
|
|
|
719
|
-
|
|
795
|
+
"Continue" operators re-open fzf so you can build multi-command pipelines. "Close" operators place the final command in your prompt.
|
|
720
796
|
|
|
721
|
-
|
|
722
|
-
[composition]
|
|
723
|
-
continue = []
|
|
724
|
-
```
|
|
797
|
+
When chaining, the prompt shows your accumulated command: `copa [git pull && ]>`.
|
|
725
798
|
|
|
726
799
|
## End-to-End Workflow
|
|
727
800
|
|
|
@@ -729,32 +802,37 @@ continue = []
|
|
|
729
802
|
|
|
730
803
|
## CLI Reference
|
|
731
804
|
|
|
732
|
-
| Command
|
|
733
|
-
|
|
734
|
-
| `copa setup`
|
|
735
|
-
| `copa add "cmd" -d "desc" -g group -f "flag: desc"`
|
|
736
|
-
| `copa edit ID [-d desc] [-g group] [-f flags] [--pin]`
|
|
737
|
-
| `copa remove ID`
|
|
738
|
-
| `copa pin ID`
|
|
739
|
-
| `copa unpin ID`
|
|
740
|
-
| `copa list [-g group] [-s source] [--set name] [--json]` | List by score
|
|
741
|
-
| `copa search "query" [-g group] [--set name] [--json]`
|
|
742
|
-
| `copa create -g group [-o file]`
|
|
743
|
-
| `copa stats`
|
|
744
|
-
| `copa doctor`
|
|
745
|
-
| `copa sync`
|
|
746
|
-
| `copa scan [--dir path]`
|
|
747
|
-
| `copa evolve [-k 20] [--auto]`
|
|
748
|
-
| `copa fix [--auto]`
|
|
749
|
-
| `copa describe ID`
|
|
750
|
-
| `copa configure`
|
|
751
|
-
| `copa share export GROUP -o file`
|
|
752
|
-
| `copa share load SOURCE`
|
|
753
|
-
| `copa share list`
|
|
754
|
-
| `copa share sync DIR`
|
|
755
|
-
| `copa import FILE [-g group]`
|
|
756
|
-
| `copa
|
|
757
|
-
| `copa
|
|
805
|
+
| Command | Purpose |
|
|
806
|
+
| -------------------------------------------------------- | ----------------------------------------------------------- |
|
|
807
|
+
| `copa setup` | Interactive setup wizard |
|
|
808
|
+
| `copa add "cmd" -d "desc" -g group -f "flag: desc"` | Save a command (with optional flags) |
|
|
809
|
+
| `copa edit ID [-d desc] [-g group] [-f flags] [--pin]` | Edit a command's metadata |
|
|
810
|
+
| `copa remove ID` | Remove a command |
|
|
811
|
+
| `copa pin ID` | Pin a command to the top |
|
|
812
|
+
| `copa unpin ID` | Unpin a command |
|
|
813
|
+
| `copa list [-g group] [-s source] [--set name] [--json]` | List by score |
|
|
814
|
+
| `copa search "query" [-g group] [--set name] [--json]` | FTS search |
|
|
815
|
+
| `copa create -g group [-o file]` | Create a .copa file from a group |
|
|
816
|
+
| `copa stats` | Usage statistics |
|
|
817
|
+
| `copa doctor` | Check setup and diagnose issues |
|
|
818
|
+
| `copa sync` | Import from zsh history |
|
|
819
|
+
| `copa scan [--dir path]` | Import script metadata from $PATH |
|
|
820
|
+
| `copa evolve [-k 20] [--auto]` | Auto-add frequent commands (with optional LLM descriptions) |
|
|
821
|
+
| `copa fix [--auto]` | Add missing descriptions (with optional LLM) |
|
|
822
|
+
| `copa describe ID` | Generate description for one command |
|
|
823
|
+
| `copa configure` | Set LLM backend (claude/ollama) |
|
|
824
|
+
| `copa share export GROUP -o file` | Export group |
|
|
825
|
+
| `copa share load SOURCE` | Load shared set |
|
|
826
|
+
| `copa share list` | List shared sets |
|
|
827
|
+
| `copa share sync DIR` | Sync .copa files from dir |
|
|
828
|
+
| `copa import FILE [-g group]` | Import commands from markdown |
|
|
829
|
+
| `copa recipe add NAME -s 'cmd' [-s 'cmd' ...]` | Create a multi-step recipe |
|
|
830
|
+
| `copa recipe list [--json]` | List all recipes |
|
|
831
|
+
| `copa recipe show NAME` | Show a recipe's steps |
|
|
832
|
+
| `copa recipe run NAME [--dry-run]` | Run a recipe's steps sequentially |
|
|
833
|
+
| `copa recipe remove NAME` | Remove a recipe |
|
|
834
|
+
| `copa reset` | Wipe database and start fresh (keeps config) |
|
|
835
|
+
| `copa uninstall` | Remove Copa data and show cleanup steps |
|
|
758
836
|
|
|
759
837
|
## How Scoring Works
|
|
760
838
|
|
|
@@ -764,6 +842,8 @@ score = 2.0 * log(1 + frequency) + 8.0 * 0.5^(age_seconds / 3_days)
|
|
|
764
842
|
|
|
765
843
|
Pinned commands get a +1000 bonus. The 3-day half-life means commands used in the last few days are strongly favored — a command used today scores ~8.0 recency, after 3 days ~4.0, after a week ~1.6.
|
|
766
844
|
|
|
845
|
+
When `directory_aware = true` (default), commands get a bonus based on where you are: +5.0 for the same directory, +2.0 for a parent or child directory. This means `git push` suggests your project's branch, not another repo's.
|
|
846
|
+
|
|
767
847
|
## License
|
|
768
848
|
|
|
769
849
|
MIT
|