editprompt 1.2.0 → 1.4.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.
Files changed (3) hide show
  1. package/README.md +77 -5
  2. package/dist/index.js +401 -164
  3. package/package.json +34 -28
package/README.md CHANGED
@@ -19,7 +19,6 @@ A CLI tool that lets you write prompts for CLI tools using your favorite text ed
19
19
  - **💬 Quote and Reply**: Collect multiple text selections and reply to specific parts of AI responses
20
20
  - **📝 Multi-line Commands**: Complex SQL queries, JSON payloads, and structured prompts
21
21
 
22
-
23
22
  ## ✨ Features
24
23
 
25
24
  - 🖊️ **Editor Integration**: Use your preferred text editor to write prompts
@@ -29,7 +28,6 @@ A CLI tool that lets you write prompts for CLI tools using your favorite text ed
29
28
  - 📋 **Quote Buffering**: Collect text selections and send them as quoted replies
30
29
  - 📋 **Clipboard Fallback**: Automatically copies to clipboard if sending fails
31
30
 
32
-
33
31
  ## 📦 Installation
34
32
 
35
33
  ```bash
@@ -97,7 +95,6 @@ For replying to specific parts of AI responses:
97
95
 
98
96
  Perfect for addressing multiple points in long AI responses.
99
97
 
100
-
101
98
  ## ⚙️ Setup & Configuration
102
99
 
103
100
  ### Basic Setup
@@ -127,7 +124,6 @@ bind -n M-q run-shell '\
127
124
  "editprompt open --editor nvim --always-copy --target-pane #{pane_id}"'
128
125
  ```
129
126
 
130
-
131
127
  ### WezTerm Integration
132
128
 
133
129
  ```lua
@@ -173,7 +169,6 @@ bind -n M-q run-shell '\
173
169
 
174
170
  **Note:** The `-lc` flag ensures your shell loads the full login environment, making `editprompt` available in your PATH.
175
171
 
176
-
177
172
  ### Editor Integration (Send Without Closing)
178
173
 
179
174
  While editprompt is running, you can send content to the target pane or clipboard without closing the editor. This allows you to iterate quickly on your prompts.
@@ -197,6 +192,7 @@ editprompt input --auto-send --send-key "C-m" -- "your content here"
197
192
  This sends the content to the target pane (or clipboard) while keeping your editor open, so you can continue editing and send multiple times.
198
193
 
199
194
  **Options:**
195
+
200
196
  - `--auto-send`: Automatically sends the content and returns focus to your editor pane (requires multiplexer)
201
197
  - `--send-key <key>`: Customize the key to send after content (requires `--auto-send`)
202
198
  - tmux format: `Enter` (default), `C-a`, etc.
@@ -206,6 +202,39 @@ This sends the content to the target pane (or clipboard) while keeping your edit
206
202
 
207
203
  For Neovim users, we recommend using [editprompt.nvim](https://github.com/eetann/editprompt.nvim) for easy setup. For manual configuration, see [docs/neovim.md](docs/neovim.md).
208
204
 
205
+ ### Key Sending (press)
206
+
207
+ Send individual key inputs to the target pane without leaving your editor. Useful for responding to AI agent selection prompts (e.g., choosing option 1, 2, 3, 4) without switching panes.
208
+
209
+ ```bash
210
+ # Send a character key
211
+ editprompt press -- 1
212
+
213
+ # Send special keys (tmux format)
214
+ editprompt press -- Tab
215
+ editprompt press -- Up
216
+ editprompt press -- C-m # Enter
217
+ editprompt press -- C-c # Ctrl+C
218
+
219
+ # Send with delay
220
+ editprompt press --delay 500 -- Tab
221
+ ```
222
+
223
+ **Key differences from `input`:**
224
+
225
+ - No Enter key is automatically appended
226
+ - Focus stays on the editor pane (no pane switching)
227
+ - Designed for single key inputs, not text content
228
+
229
+ **Key notation** depends on your multiplexer:
230
+
231
+ | Key | tmux | WezTerm |
232
+ | ------------- | ------------- | ------------------- |
233
+ | Enter | `C-m` | `\r` |
234
+ | Tab | `Tab` | `\t` |
235
+ | Escape | `Escape` | `\x1b` |
236
+ | Arrow Up/Down | `Up` / `Down` | `\x1b[A` / `\x1b[B` |
237
+
209
238
  ### Quote Workflow Setup
210
239
 
211
240
  #### Collecting Quotes in tmux Copy Mode
@@ -217,6 +246,7 @@ bind-key -T copy-mode-vi C-e { send-keys -X pipe "editprompt collect --target-pa
217
246
  ```
218
247
 
219
248
  **Usage:**
249
+
220
250
  1. Enter tmux copy mode (`prefix + [`)
221
251
  2. Select text using vi-mode keybindings
222
252
  3. Press `Ctrl-e` to add the selection as a quote
@@ -257,6 +287,7 @@ return {
257
287
  ```
258
288
 
259
289
  **Usage:**
290
+
260
291
  1. Select text in WezTerm (by dragging with mouse or using copy mode)
261
292
  2. Press `Ctrl-e` to add the selection as a quote
262
293
  3. Repeat to collect multiple quotes
@@ -273,6 +304,7 @@ editprompt dump
273
304
  This copies all collected quotes to the clipboard and clears the buffer, ready for your reply.
274
305
 
275
306
  **Complete workflow:**
307
+
276
308
  1. AI responds with multiple points
277
309
  2. Select each point in copy mode and press `Ctrl-e`
278
310
  3. Open your editor pane and run `editprompt dump`
@@ -280,6 +312,7 @@ This copies all collected quotes to the clipboard and clears the buffer, ready f
280
312
  5. Send to AI
281
313
 
282
314
  **How quote buffering works:**
315
+
283
316
  - **tmux**: Quotes are stored in pane variables, automatically cleaned up when the pane closes
284
317
  - **WezTerm**: Quotes are stored in a configuration file associated with the pane
285
318
  - Text is intelligently processed: removes common indentation, handles line breaks smartly
@@ -358,3 +391,42 @@ editprompt open --env NVIM_CONFIG=minimal
358
391
  #### Target Pane Environment Variable
359
392
 
360
393
  When using the send-without-closing feature or dump, editprompt sets `EDITPROMPT_TARGET_PANE` to the target pane ID. This is automatically used by `editprompt input` and `editprompt dump` commands.
394
+
395
+ ### Logging Options
396
+
397
+ editprompt uses structured logging via [LogTape](https://logtape.org/). The following flags are available on all subcommands:
398
+
399
+ | Flag | Description |
400
+ | ------------------- | ------------------------------------------ |
401
+ | `--quiet` / `-q` | Suppress all log output |
402
+ | `--verbose` / `-v` | Enable debug-level log output |
403
+ | `--log-file <path>` | Write logs to the specified file (appends) |
404
+
405
+ You can also configure logging via environment variables:
406
+
407
+ | Environment Variable | Description |
408
+ | ---------------------- | ---------------------------------------------------- |
409
+ | `EDITPROMPT_LOG_FILE` | Path to log file (same as `--log-file`) |
410
+ | `EDITPROMPT_LOG_LEVEL` | Log level (e.g. `debug`, `info`, `warning`, `error`) |
411
+
412
+ **Log level resolution priority:**
413
+
414
+ 1. `--quiet` → suppresses all logs
415
+ 2. `--verbose` → sets level to `debug`
416
+ 3. `EDITPROMPT_LOG_LEVEL` → uses the specified level
417
+ 4. Default: `info`
418
+
419
+ ### Send-Key Delay
420
+
421
+ When using `--auto-send` with `editprompt input`, a delay is inserted before sending the key to allow the target process to finish processing the content.
422
+
423
+ | Environment Variable | Description | Default |
424
+ | --------------------------- | -------------------------------------------- | ------- |
425
+ | `EDITPROMPT_SEND_KEY_DELAY` | Delay in milliseconds before sending the key | `1000` |
426
+
427
+ **Auto-detection:** editprompt automatically adjusts the delay based on content:
428
+
429
+ - **Content with image paths** → uses `EDITPROMPT_SEND_KEY_DELAY` (default: `1000` ms)
430
+ - **Content without image paths** → uses `200` ms
431
+
432
+ Supported image extensions: `.png`, `.webp`, `.avif`, `.jpg`/`.jpeg`, `.gif` (case-insensitive)