editprompt 0.2.0 → 0.2.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.
package/README.md CHANGED
@@ -10,6 +10,7 @@ https://github.com/user-attachments/assets/01bcda7c-7771-4b33-bf5c-629812d45cc4
10
10
  - 🔍 **Process Detection**: Automatically detects running CLI processes (configurable)
11
11
  - 🖥️ **Tmux Support**: Send prompts directly to tmux sessions
12
12
  - 📋 **Clipboard Fallback**: Automatically copies to clipboard if sending fails
13
+ - 📋 **Always Copy Option**: Copy to clipboard even after successful tmux delivery (`--always-copy`)
13
14
  - ⚡ **Smart Fallbacks**: Multiple fallback strategies ensure your prompt gets delivered
14
15
 
15
16
  ## Installation
@@ -46,6 +47,9 @@ editprompt -t %45
46
47
  editprompt --env THEME=dark
47
48
  editprompt -E THEME=dark -E LANG=ja_JP.UTF-8
48
49
 
50
+ # Always copy to clipboard after sending to tmux pane
51
+ editprompt --always-copy
52
+
49
53
  # Show help
50
54
  editprompt --help
51
55
 
package/dist/index.js CHANGED
@@ -10,7 +10,7 @@ import find from "find-process";
10
10
  import inquirer from "inquirer";
11
11
 
12
12
  //#region package.json
13
- var version = "0.2.0";
13
+ var version = "0.2.2";
14
14
 
15
15
  //#endregion
16
16
  //#region src/config/constants.ts
@@ -196,20 +196,28 @@ async function sendToTmuxPane(session, window, pane, content) {
196
196
  }
197
197
  async function sendToSpecificPane(paneId, content) {
198
198
  const tempContent = content.replace(/'/g, "'\\''");
199
- await execAsync(`tmux load-buffer -b editprompt - <<< '${tempContent}'`);
199
+ await execAsync(`printf %s '${tempContent}' | tmux load-buffer -b editprompt -`);
200
200
  await execAsync(`tmux paste-buffer -d -t '${paneId}' -b editprompt`);
201
201
  }
202
202
  async function copyToClipboard(content) {
203
203
  await clipboardy.write(content);
204
204
  }
205
- async function sendContentToProcess(process$1, content, targetPaneId) {
205
+ async function sendContentToProcess(process$1, content, targetPaneId, alwaysCopy) {
206
206
  try {
207
207
  if (targetPaneId) {
208
208
  await sendToSpecificPane(targetPaneId, content);
209
+ if (alwaysCopy) {
210
+ await copyToClipboard(content);
211
+ console.log("Copy!");
212
+ }
209
213
  return;
210
214
  }
211
215
  if (process$1.tmuxSession && process$1.tmuxWindow && process$1.tmuxPane) {
212
216
  await sendToTmuxPane(process$1.tmuxSession, process$1.tmuxWindow, process$1.tmuxPane, content);
217
+ if (alwaysCopy) {
218
+ await copyToClipboard(content);
219
+ console.log("Copy!");
220
+ }
213
221
  return;
214
222
  }
215
223
  } catch (error) {
@@ -271,6 +279,10 @@ await cli(argv, {
271
279
  description: "Environment variables to set (e.g., KEY=VALUE)",
272
280
  type: "string",
273
281
  multiple: true
282
+ },
283
+ "always-copy": {
284
+ description: "Always copy content to clipboard, even if tmux pane is available",
285
+ type: "boolean"
274
286
  }
275
287
  },
276
288
  async run(ctx) {
@@ -282,12 +294,13 @@ await cli(argv, {
282
294
  return;
283
295
  }
284
296
  const targetPane = ctx.values["target-pane"];
297
+ const alwaysCopy = ctx.values["always-copy"];
285
298
  if (targetPane) {
286
299
  console.log("Sending content to specified pane...");
287
300
  await sendContentToProcess({
288
301
  pid: 0,
289
302
  name: "direct-pane"
290
- }, content, targetPane);
303
+ }, content, targetPane, alwaysCopy);
291
304
  console.log("Content sent successfully!");
292
305
  } else {
293
306
  const processName = ctx.values.process || DEFAULT_PROCESS_NAME;
@@ -302,7 +315,7 @@ await cli(argv, {
302
315
  if (selectedProcess.cwd) processInfo.push(`Directory: ${selectedProcess.cwd}`);
303
316
  console.log(`Selected process: ${processInfo.join(" | ")}`);
304
317
  console.log(`Sending content to ${processName} process...`);
305
- await sendContentToProcess(selectedProcess, content);
318
+ await sendContentToProcess(selectedProcess, content, void 0, alwaysCopy);
306
319
  console.log("Content sent successfully!");
307
320
  }
308
321
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "editprompt",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "author": "eetann",
5
5
  "description": "A CLI tool that lets you write prompts for CLI tools using your favorite text editor",
6
6
  "license": "MIT",