editprompt 1.1.1 → 1.3.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.
- package/README.md +74 -100
- package/dist/index.js +490 -148
- 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
|
|
@@ -40,6 +38,10 @@ npm install -g editprompt
|
|
|
40
38
|
npx editprompt
|
|
41
39
|
```
|
|
42
40
|
|
|
41
|
+
### Neovim Plugin
|
|
42
|
+
|
|
43
|
+
For Neovim users, [editprompt.nvim](https://github.com/eetann/editprompt.nvim) provides easy integration. For manual configuration, see [docs/neovim.md](docs/neovim.md).
|
|
44
|
+
|
|
43
45
|
## 🚀 Usage
|
|
44
46
|
|
|
45
47
|
editprompt supports three main workflows to fit different use cases:
|
|
@@ -93,7 +95,6 @@ For replying to specific parts of AI responses:
|
|
|
93
95
|
|
|
94
96
|
Perfect for addressing multiple points in long AI responses.
|
|
95
97
|
|
|
96
|
-
|
|
97
98
|
## ⚙️ Setup & Configuration
|
|
98
99
|
|
|
99
100
|
### Basic Setup
|
|
@@ -123,7 +124,6 @@ bind -n M-q run-shell '\
|
|
|
123
124
|
"editprompt open --editor nvim --always-copy --target-pane #{pane_id}"'
|
|
124
125
|
```
|
|
125
126
|
|
|
126
|
-
|
|
127
127
|
### WezTerm Integration
|
|
128
128
|
|
|
129
129
|
```lua
|
|
@@ -169,7 +169,6 @@ bind -n M-q run-shell '\
|
|
|
169
169
|
|
|
170
170
|
**Note:** The `-lc` flag ensures your shell loads the full login environment, making `editprompt` available in your PATH.
|
|
171
171
|
|
|
172
|
-
|
|
173
172
|
### Editor Integration (Send Without Closing)
|
|
174
173
|
|
|
175
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.
|
|
@@ -193,51 +192,15 @@ editprompt input --auto-send --send-key "C-m" -- "your content here"
|
|
|
193
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.
|
|
194
193
|
|
|
195
194
|
**Options:**
|
|
195
|
+
|
|
196
196
|
- `--auto-send`: Automatically sends the content and returns focus to your editor pane (requires multiplexer)
|
|
197
197
|
- `--send-key <key>`: Customize the key to send after content (requires `--auto-send`)
|
|
198
198
|
- tmux format: `Enter` (default), `C-a`, etc.
|
|
199
199
|
- WezTerm format: `\r` (default), `\x01`, etc.
|
|
200
200
|
|
|
201
|
-
#### Neovim Integration
|
|
202
|
-
|
|
203
|
-
You can set up a convenient keybinding to send your buffer content:
|
|
204
|
-
|
|
205
|
-
```lua
|
|
206
|
-
-- Send buffer content while keeping the editor open
|
|
207
|
-
if vim.env.EDITPROMPT then
|
|
208
|
-
vim.keymap.set("n", "<Space>x", function()
|
|
209
|
-
vim.cmd("update")
|
|
210
|
-
-- Get buffer content
|
|
211
|
-
local lines = vim.api.nvim_buf_get_lines(0, 0, -1, false)
|
|
212
|
-
local content = table.concat(lines, "\n")
|
|
213
|
-
|
|
214
|
-
-- Execute editprompt command
|
|
215
|
-
vim.system(
|
|
216
|
-
{ "editprompt", "input", "--", content },
|
|
217
|
-
{ text = true },
|
|
218
|
-
function(obj)
|
|
219
|
-
vim.schedule(function()
|
|
220
|
-
if obj.code == 0 then
|
|
221
|
-
-- Clear buffer on success
|
|
222
|
-
vim.api.nvim_buf_set_lines(0, 0, -1, false, {})
|
|
223
|
-
vim.cmd("silent write")
|
|
224
|
-
else
|
|
225
|
-
-- Show error notification
|
|
226
|
-
vim.notify("editprompt failed: " .. (obj.stderr or "unknown error"), vim.log.levels.ERROR)
|
|
227
|
-
end
|
|
228
|
-
end)
|
|
229
|
-
end
|
|
230
|
-
)
|
|
231
|
-
end, { silent = true, desc = "Send buffer content to editprompt" })
|
|
232
|
-
end
|
|
233
|
-
```
|
|
201
|
+
#### Neovim Integration
|
|
234
202
|
|
|
235
|
-
|
|
236
|
-
1. Open editprompt using the tmux/wezterm keybinding
|
|
237
|
-
2. Write your prompt in the editor
|
|
238
|
-
3. Press `<Space>x` to send the content to the target pane
|
|
239
|
-
4. The buffer is automatically cleared on success
|
|
240
|
-
5. Continue editing to send more content
|
|
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).
|
|
241
204
|
|
|
242
205
|
### Quote Workflow Setup
|
|
243
206
|
|
|
@@ -250,6 +213,7 @@ bind-key -T copy-mode-vi C-e { send-keys -X pipe "editprompt collect --target-pa
|
|
|
250
213
|
```
|
|
251
214
|
|
|
252
215
|
**Usage:**
|
|
216
|
+
|
|
253
217
|
1. Enter tmux copy mode (`prefix + [`)
|
|
254
218
|
2. Select text using vi-mode keybindings
|
|
255
219
|
3. Press `Ctrl-e` to add the selection as a quote
|
|
@@ -290,6 +254,7 @@ return {
|
|
|
290
254
|
```
|
|
291
255
|
|
|
292
256
|
**Usage:**
|
|
257
|
+
|
|
293
258
|
1. Select text in WezTerm (by dragging with mouse or using copy mode)
|
|
294
259
|
2. Press `Ctrl-e` to add the selection as a quote
|
|
295
260
|
3. Repeat to collect multiple quotes
|
|
@@ -306,6 +271,7 @@ editprompt dump
|
|
|
306
271
|
This copies all collected quotes to the clipboard and clears the buffer, ready for your reply.
|
|
307
272
|
|
|
308
273
|
**Complete workflow:**
|
|
274
|
+
|
|
309
275
|
1. AI responds with multiple points
|
|
310
276
|
2. Select each point in copy mode and press `Ctrl-e`
|
|
311
277
|
3. Open your editor pane and run `editprompt dump`
|
|
@@ -313,6 +279,7 @@ This copies all collected quotes to the clipboard and clears the buffer, ready f
|
|
|
313
279
|
5. Send to AI
|
|
314
280
|
|
|
315
281
|
**How quote buffering works:**
|
|
282
|
+
|
|
316
283
|
- **tmux**: Quotes are stored in pane variables, automatically cleaned up when the pane closes
|
|
317
284
|
- **WezTerm**: Quotes are stored in a configuration file associated with the pane
|
|
318
285
|
- Text is intelligently processed: removes common indentation, handles line breaks smartly
|
|
@@ -333,53 +300,32 @@ editprompt register --target-pane %1 --target-pane %2
|
|
|
333
300
|
|
|
334
301
|
The content will be sent sequentially to all specified panes. This is useful when you want to send the same prompt to multiple CLI sessions.
|
|
335
302
|
|
|
336
|
-
|
|
303
|
+
### Prompt Stash
|
|
337
304
|
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
-- If not empty, append to the end
|
|
359
|
-
table.insert(output_lines, 1, "")
|
|
360
|
-
local line_count = vim.api.nvim_buf_line_count(0)
|
|
361
|
-
vim.api.nvim_buf_set_lines(
|
|
362
|
-
0,
|
|
363
|
-
line_count,
|
|
364
|
-
line_count,
|
|
365
|
-
false,
|
|
366
|
-
output_lines
|
|
367
|
-
)
|
|
368
|
-
vim.cmd("normal 4j")
|
|
369
|
-
end
|
|
370
|
-
|
|
371
|
-
vim.cmd("silent write")
|
|
372
|
-
else
|
|
373
|
-
vim.notify(
|
|
374
|
-
"editprompt failed: " .. (obj.stderr or "unknown error"),
|
|
375
|
-
vim.log.levels.ERROR
|
|
376
|
-
)
|
|
377
|
-
end
|
|
378
|
-
end)
|
|
379
|
-
end)
|
|
380
|
-
end, { silent = true, desc = "Capture from editprompt quote mode" })
|
|
305
|
+
Store prompts temporarily for later use, similar to `git stash`. This is useful when you want to save a prompt idea and use it later.
|
|
306
|
+
|
|
307
|
+
```bash
|
|
308
|
+
# Save a prompt to stash (must be run from editor pane)
|
|
309
|
+
editprompt stash push -- "your prompt here"
|
|
310
|
+
|
|
311
|
+
# List all stashed prompts (JSON output)
|
|
312
|
+
editprompt stash list
|
|
313
|
+
|
|
314
|
+
# Get the latest stashed prompt (outputs to stdout)
|
|
315
|
+
editprompt stash apply
|
|
316
|
+
|
|
317
|
+
# Get a specific stashed prompt by key
|
|
318
|
+
editprompt stash apply --key "2025-01-07T12:34:56.789Z"
|
|
319
|
+
|
|
320
|
+
# Remove the latest stashed prompt
|
|
321
|
+
editprompt stash drop
|
|
322
|
+
|
|
323
|
+
# Get and remove the latest stashed prompt (apply + drop)
|
|
324
|
+
editprompt stash pop
|
|
381
325
|
```
|
|
382
326
|
|
|
327
|
+
**Note:** The stash commands must be run from within an editprompt editor session (where `EDITPROMPT=1` is set). Stash data is associated with the target pane and persisted using the Conf library.
|
|
328
|
+
|
|
383
329
|
### Environment Variables
|
|
384
330
|
|
|
385
331
|
#### Editor Selection
|
|
@@ -392,18 +338,7 @@ editprompt respects the following editor priority:
|
|
|
392
338
|
|
|
393
339
|
#### EDITPROMPT Environment Variable
|
|
394
340
|
|
|
395
|
-
editprompt automatically sets `EDITPROMPT=1` when launching your editor. This allows you to detect when your editor is launched by editprompt and enable specific configurations or plugins.
|
|
396
|
-
|
|
397
|
-
**Example: Neovim Configuration**
|
|
398
|
-
|
|
399
|
-
```lua
|
|
400
|
-
-- In your Neovim config (e.g., init.lua)
|
|
401
|
-
if vim.env.EDITPROMPT then
|
|
402
|
-
vim.opt.wrap = true
|
|
403
|
-
-- Load a specific colorscheme
|
|
404
|
-
vim.cmd('colorscheme blue')
|
|
405
|
-
end
|
|
406
|
-
```
|
|
341
|
+
editprompt automatically sets `EDITPROMPT=1` when launching your editor. This allows you to detect when your editor is launched by editprompt and enable specific configurations or plugins. For Neovim integration examples, see [docs/neovim.md](docs/neovim.md).
|
|
407
342
|
|
|
408
343
|
#### Custom Environment Variables
|
|
409
344
|
|
|
@@ -423,3 +358,42 @@ editprompt open --env NVIM_CONFIG=minimal
|
|
|
423
358
|
#### Target Pane Environment Variable
|
|
424
359
|
|
|
425
360
|
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.
|
|
361
|
+
|
|
362
|
+
### Logging Options
|
|
363
|
+
|
|
364
|
+
editprompt uses structured logging via [LogTape](https://logtape.org/). The following flags are available on all subcommands:
|
|
365
|
+
|
|
366
|
+
| Flag | Description |
|
|
367
|
+
| ------------------- | ------------------------------------------ |
|
|
368
|
+
| `--quiet` / `-q` | Suppress all log output |
|
|
369
|
+
| `--verbose` / `-v` | Enable debug-level log output |
|
|
370
|
+
| `--log-file <path>` | Write logs to the specified file (appends) |
|
|
371
|
+
|
|
372
|
+
You can also configure logging via environment variables:
|
|
373
|
+
|
|
374
|
+
| Environment Variable | Description |
|
|
375
|
+
| ---------------------- | ---------------------------------------------------- |
|
|
376
|
+
| `EDITPROMPT_LOG_FILE` | Path to log file (same as `--log-file`) |
|
|
377
|
+
| `EDITPROMPT_LOG_LEVEL` | Log level (e.g. `debug`, `info`, `warning`, `error`) |
|
|
378
|
+
|
|
379
|
+
**Log level resolution priority:**
|
|
380
|
+
|
|
381
|
+
1. `--quiet` → suppresses all logs
|
|
382
|
+
2. `--verbose` → sets level to `debug`
|
|
383
|
+
3. `EDITPROMPT_LOG_LEVEL` → uses the specified level
|
|
384
|
+
4. Default: `info`
|
|
385
|
+
|
|
386
|
+
### Send-Key Delay
|
|
387
|
+
|
|
388
|
+
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.
|
|
389
|
+
|
|
390
|
+
| Environment Variable | Description | Default |
|
|
391
|
+
| --------------------------- | -------------------------------------------- | ------- |
|
|
392
|
+
| `EDITPROMPT_SEND_KEY_DELAY` | Delay in milliseconds before sending the key | `1000` |
|
|
393
|
+
|
|
394
|
+
**Auto-detection:** editprompt automatically adjusts the delay based on content:
|
|
395
|
+
|
|
396
|
+
- **Content with image paths** → uses `EDITPROMPT_SEND_KEY_DELAY` (default: `1000` ms)
|
|
397
|
+
- **Content without image paths** → uses `200` ms
|
|
398
|
+
|
|
399
|
+
Supported image extensions: `.png`, `.webp`, `.avif`, `.jpg`/`.jpeg`, `.gif` (case-insensitive)
|