@pi-unipi/input-shortcuts 0.1.1 → 0.1.2

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 (2) hide show
  1. package/README.md +29 -66
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,41 +1,49 @@
1
1
  # @pi-unipi/input-shortcuts
2
2
 
3
- Keyboard shortcuts for Pi's input box stash/restore, undo/redo, clipboard operations, thinking toggle, and tab insertion. All accessible via a vim-style chord overlay triggered by `ALT+S`.
3
+ Keyboard shortcuts for Pi's input box. Stash and restore text, undo/redo, clipboard operations, thinking level toggle, and tab insertion all via a vim-style chord overlay triggered by `ALT+S`.
4
4
 
5
- ## Features
5
+ Press `ALT+S`, a small overlay appears with key hints. Press a key, the action runs. The overlay closes automatically after 300ms or on `ESC`.
6
+
7
+ ## Shortcuts
6
8
 
7
9
  | Chord | Action | Description |
8
10
  |-------|--------|-------------|
9
- | `ALT+S → S` | Stash/Restore | Save input text to stash register, or restore it |
10
- | `ALT+S → U` | Undo | Pop from undo buffer (1s throttle) |
11
+ | `ALT+S → S` | Stash/Restore | Save input to stash register, or restore it |
12
+ | `ALT+S → U` | Undo | Pop from undo buffer |
11
13
  | `ALT+S → R` | Redo | Push current text forward, restore previous |
12
14
  | `ALT+S → Y` | Copy | Copy input to system clipboard |
13
15
  | `ALT+S → D` | Cut | Copy to clipboard, then clear input |
14
16
  | `ALT+S → T` | Toggle Thinking | Cycle: off → low → medium → high → xhigh → off |
15
17
  | `ALT+S → A → [0-9]` | Append Register | Append from numbered register 0-9 |
16
18
  | `ALT+S → A → S` | Append Stash | Append from stash register |
17
- | `ALT+I` | Tab Insert | Insert literal tab character into input |
19
+ | `ALT+I` | Tab Insert | Insert literal tab character |
18
20
 
19
- ## How It Works
21
+ ## Commands
20
22
 
21
- ### Chord Overlay
23
+ | Command | Description |
24
+ |---------|-------------|
25
+ | `/unipi:stash-settings` | Open settings TUI for keybinding customization |
22
26
 
23
- Press `ALT+S` to open a small overlay showing available actions with key hints. Press a single key within the overlay to execute the action. The overlay auto-closes after 300ms of inactivity or on `ESC`.
27
+ ## Special Triggers
24
28
 
25
- For the **Append** sub-chord, pressing `A` transitions to a second overlay showing numbered registers `[0-9]` and the stash register `[S]`.
29
+ Input-shortcuts is a standalone package. It doesn't register with other packages or trigger coexists behavior.
30
+
31
+ Every action shows a brief success or error message in the status bar via `ctx.ui.setStatus()`.
32
+
33
+ ## How It Works
26
34
 
27
35
  ### Registers
28
36
 
29
- - **Stash register**: 1 register for quick save/restore of input text
30
- - **Numbered registers**: 10 registers (0-9) for appending stored text snippets
31
- - **Persistence**: All registers saved to `.unipi/config/input-shortcuts.json` (per-project, atomic writes)
37
+ - **Stash register**: 1 register for quick save/restore
38
+ - **Numbered registers**: 10 registers (0-9) for stored text snippets
39
+ - **Persistence**: Saved to `.unipi/config/input-shortcuts.json` (per-project, atomic writes)
32
40
 
33
41
  ### Undo/Redo
34
42
 
35
43
  - In-memory ring buffer, max 50 snapshots per session
36
- - **500ms debounce** on snapshot creation (prevents noise from rapid typing)
37
- - **1s throttle** on undo (prevents rapid-fire undo)
38
- - Redo buffer cleared on new snapshot (standard undo/redo semantics)
44
+ - 500ms debounce on snapshot creation (prevents noise from rapid typing)
45
+ - 1s throttle on undo (prevents rapid-fire undo)
46
+ - Redo buffer cleared on new snapshot
39
47
  - Not persisted across sessions
40
48
 
41
49
  ### Clipboard
@@ -53,15 +61,11 @@ Detected tool is cached after first use. Returns graceful error if no clipboard
53
61
 
54
62
  ### Thinking Toggle
55
63
 
56
- Cycles through Pi's thinking levels in order:
57
-
58
- ```
59
- off → low → medium → high → xhigh → off
60
- ```
64
+ Cycles through Pi's thinking levels: off → low → medium → high → xhigh → off.
61
65
 
62
- ## Settings
66
+ ## Configurables
63
67
 
64
- Run `/unipi:stash-settings` to open a TUI overlay for customizing keybindings:
68
+ Run `/unipi:stash-settings` to customize keybindings:
65
69
 
66
70
  - **Chord trigger key** — default `alt+s`
67
71
  - **Tab insert key** — default `alt+i`
@@ -70,47 +74,6 @@ Both cycle through available ALT key combinations, excluding known conflicts (`a
70
74
 
71
75
  Config persisted to `~/.unipi/config/input-shortcuts-config.json` (global).
72
76
 
73
- ## Architecture
74
-
75
- ```
76
- input-shortcuts/
77
- ├── index.ts # Re-exports
78
- ├── src/
79
- │ ├── index.ts # Extension entry — registers shortcuts + command
80
- │ ├── types.ts # Shared types and constants
81
- │ ├── registers.ts # RegisterStore — JSON persistence with atomic writes
82
- │ ├── undo-redo.ts # UndoRedoBuffer — ring buffer with debounce/throttle
83
- │ ├── clipboard.ts # Cross-platform clipboard detection + read/write
84
- │ ├── status.ts # Status bar feedback with auto-clear
85
- │ ├── chord-overlay.ts # ChordOverlay — TUI overlay component (root + register sub-chord)
86
- │ └── settings-overlay.ts # SettingsOverlay — SettingsList-based config UI
87
- ├── tests/
88
- │ ├── clipboard.test.ts
89
- │ ├── registers.test.ts
90
- │ └── undo-redo.test.ts
91
- └── package.json
92
- ```
93
-
94
- ### Key Patterns
95
-
96
- - **TUI overlay**: Uses `ctx.ui.custom()` from pi-coding-agent (proven pattern from btw, compactor, footer)
97
- - **SettingsList**: Uses `SettingsList` from pi-tui for the settings overlay
98
- - **Atomic writes**: All file persistence uses write-to-tmp-then-rename pattern
99
- - **Status feedback**: Every action shows a brief success/error message in the status bar via `ctx.ui.setStatus()`
100
-
101
- ## Testing
102
-
103
- ```bash
104
- npm test --workspace=packages/input-shortcuts
105
- ```
106
-
107
- 19 tests across 3 suites:
108
- - **clipboard** (4 tests): detection fallback, copy/paste roundtrip, graceful errors
109
- - **RegisterStore** (8 tests): load/create, read/write stash/registers, corruption handling, atomic writes
110
- - **UndoRedoBuffer** (7 tests): undo/redo roundtrip, debounce, throttle, max size eviction, clear
111
-
112
- ## Dependencies
113
-
114
- - `@pi-unipi/core` — shared constants and utilities
115
- - `@mariozechner/pi-coding-agent` — ExtensionAPI, ExtensionContext
116
- - `@mariozechner/pi-tui` — Key, Container, Text, SettingsList, Focusable
77
+ ## License
78
+
79
+ MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-unipi/input-shortcuts",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Keyboard shortcuts for stash/restore, undo/redo, clipboard, and thinking toggle — chord-based overlay system",
5
5
  "type": "module",
6
6
  "license": "MIT",