@agent-chat/mention-watcher 0.1.5 → 0.1.8

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/watch.js +3 -34
  2. package/package.json +1 -1
package/dist/watch.js CHANGED
@@ -4,7 +4,6 @@
4
4
  import * as fs from "fs";
5
5
  import * as path from "path";
6
6
  import * as os from "os";
7
- import { execSync } from "child_process";
8
7
  import * as pty from "node-pty";
9
8
  import { WebSocket } from "ws";
10
9
  function loadEnvFile(filePath) {
@@ -58,34 +57,6 @@ function syncMcpToken(workspaceDir, mcpServerName) {
58
57
  }
59
58
  }
60
59
  }
61
- function resolveShellPath() {
62
- const parts = new Set((process.env.PATH || "").split(":").filter(Boolean));
63
- const nvmDir = process.env.NVM_DIR || path.join(os.homedir(), ".nvm");
64
- const nvmNodeDir = path.join(nvmDir, "versions", "node");
65
- if (fs.existsSync(nvmNodeDir)) {
66
- try {
67
- for (const v of fs.readdirSync(nvmNodeDir)) {
68
- const bin = path.join(nvmNodeDir, v, "bin");
69
- if (fs.existsSync(bin)) parts.add(bin);
70
- }
71
- } catch {
72
- }
73
- }
74
- try {
75
- const shell = process.env.SHELL || "/bin/zsh";
76
- const nvmSh = path.join(nvmDir, "nvm.sh");
77
- const raw = execSync(
78
- `${shell} -c 'source "${nvmSh}" 2>/dev/null; echo $PATH'`,
79
- { encoding: "utf8", timeout: 4e3 }
80
- ).trim();
81
- for (const p of raw.split(":").filter(Boolean)) parts.add(p);
82
- } catch {
83
- }
84
- for (const p of ["/opt/homebrew/bin", "/usr/local/bin", "/usr/bin", "/bin"]) {
85
- parts.add(p);
86
- }
87
- return [...parts].join(":");
88
- }
89
60
  var _WORKSPACE = process.env.WORKSPACE_DIR ?? process.cwd();
90
61
  {
91
62
  const dirsToCheck = [.../* @__PURE__ */ new Set([process.cwd(), _WORKSPACE])];
@@ -227,21 +198,19 @@ async function main() {
227
198
  `);
228
199
  process.stderr.write(`[mention-watcher] Spawning: ${COMMAND} ${CMD_ARGS.join(" ")}
229
200
  `);
230
- const shellPath = resolveShellPath();
231
- const spawnEnv = { ...process.env, PATH: shellPath };
232
201
  const userShell = process.env.SHELL || "/bin/zsh";
233
202
  const quotedArgs = [COMMAND, ...CMD_ARGS].map((a) => `'${a.replace(/'/g, "'\\''")}'`).join(" ");
234
203
  const shellCmd = `exec ${quotedArgs}`;
235
- process.stderr.write(`[mention-watcher] Shell: ${userShell} -c "${shellCmd}"
204
+ process.stderr.write(`[mention-watcher] Spawning via: ${userShell} -l -c "${shellCmd}"
236
205
  `);
237
206
  let proc;
238
207
  try {
239
- proc = pty.spawn(userShell, ["-c", shellCmd], {
208
+ proc = pty.spawn(userShell, ["-l", "-c", shellCmd], {
240
209
  name: "xterm-256color",
241
210
  cols,
242
211
  rows,
243
212
  cwd: WORKSPACE_DIR,
244
- env: spawnEnv
213
+ env: process.env
245
214
  });
246
215
  } catch (err) {
247
216
  process.stderr.write(`[mention-watcher] Failed to spawn "${COMMAND}": ${err.message}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-chat/mention-watcher",
3
- "version": "0.1.5",
3
+ "version": "0.1.8",
4
4
  "description": "PTY wrapper that pushes @mentions from agent-chat into Claude Code (or any LLM CLI)",
5
5
  "type": "module",
6
6
  "bin": {