editprompt 0.4.0 → 0.4.4

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/dist/index.js +8 -5
  2. package/package.json +1 -2
package/dist/index.js CHANGED
@@ -8,7 +8,7 @@ import { promisify } from "node:util";
8
8
  import clipboardy from "clipboardy";
9
9
 
10
10
  //#region package.json
11
- var version = "0.4.0";
11
+ var version = "0.4.4";
12
12
 
13
13
  //#endregion
14
14
  //#region src/config/constants.ts
@@ -84,8 +84,10 @@ async function launchEditor(editor, filePath, envVars) {
84
84
  }
85
85
  async function readFileContent(filePath) {
86
86
  try {
87
- const content = await readFile(filePath, "utf-8");
88
- return content.trim();
87
+ let content = await readFile(filePath, "utf-8");
88
+ content = content.replace(/\n$/, "");
89
+ if (/@[^\n]*$/.test(content)) content += " ";
90
+ return content;
89
91
  } catch (error) {
90
92
  throw new Error(`Failed to read file: ${error instanceof Error ? error.message : "Unknown error"}`);
91
93
  }
@@ -112,11 +114,12 @@ function isMuxType(value) {
112
114
  }
113
115
  async function sendToTmuxPane(paneId, content) {
114
116
  await execAsync(`tmux if-shell -t '${paneId}' '[ "#{pane_in_mode}" = "1" ]' "copy-mode -q -t '${paneId}'"`);
115
- await execAsync(`tmux send-keys -t '${paneId}' '${content.replace(/'/g, "'\\''")}'`);
117
+ await execAsync(`tmux send-keys -t '${paneId}' -- '${content.replace(/'/g, "'\\''")}'`);
116
118
  console.log(`Content sent to tmux pane: ${paneId}`);
119
+ await execAsync(`tmux select-pane -t '${paneId}'`);
117
120
  }
118
121
  async function sendToWeztermPane(paneId, content) {
119
- await execAsync(`wezterm cli send-text --no-paste --pane-id '${paneId}' '${content.replace(/'/g, "'\\''")}'`);
122
+ await execAsync(`wezterm cli send-text --no-paste --pane-id '${paneId}' -- '${content.replace(/'/g, "'\\''")}'`);
120
123
  console.log(`Content sent to wezterm pane: ${paneId}`);
121
124
  }
122
125
  async function copyToClipboard(content) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "editprompt",
3
- "version": "0.4.0",
3
+ "version": "0.4.4",
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",
@@ -54,7 +54,6 @@
54
54
  "bumpp": "^10.2.0",
55
55
  "tsdown": "latest"
56
56
  },
57
- "packageManager": "pnpm@10.8.1+sha512.c50088ba998c67b8ca8c99df8a5e02fd2ae2e2b29aaf238feaa9e124248d3f48f9fb6db2424949ff901cffbb5e0f0cc1ad6aedb602cd29450751d11c35023677",
58
57
  "dependencies": {
59
58
  "clipboardy": "^4.0.0",
60
59
  "gunshi": "^0.26.3"