@agent-chat/mention-watcher 0.0.9 → 0.1.1

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 +18 -31
  2. package/package.json +1 -1
package/dist/watch.js CHANGED
@@ -58,42 +58,29 @@ function syncMcpToken(workspaceDir, mcpServerName) {
58
58
  }
59
59
  }
60
60
  }
61
- function detectWorkspaceDir() {
62
- const markers = [
63
- ".mcp.json",
64
- // Claude Code project MCP config (v2+)
65
- path.join(".claude", "mcp.json"),
66
- // older Claude Code format
67
- path.join(".cursor", "mcp.json"),
68
- // Cursor
69
- ".git"
70
- // git repo root
61
+ function resolveShellPath() {
62
+ const shell = process.env.SHELL || "/bin/zsh";
63
+ const attempts = [
64
+ `${shell} -i -c 'echo $PATH'`,
65
+ // interactive (sources .zshrc, nvm)
66
+ `${shell} -l -c 'echo $PATH'`
67
+ // login (sources .zprofile)
71
68
  ];
72
- const home = os.homedir();
73
- let dir = process.cwd();
74
- while (true) {
75
- for (const marker of markers) {
76
- if (fs.existsSync(path.join(dir, marker))) return dir;
69
+ for (const cmd of attempts) {
70
+ try {
71
+ const raw = execSync(cmd, {
72
+ encoding: "utf8",
73
+ timeout: 4e3,
74
+ stdio: ["ignore", "pipe", "ignore"]
75
+ });
76
+ const pathLine = raw.split("\n").map((l) => l.trim()).find((l) => l.startsWith("/") && l.includes(":"));
77
+ if (pathLine) return pathLine;
78
+ } catch {
77
79
  }
78
- const parent = path.dirname(dir);
79
- if (parent === dir || dir === home) break;
80
- dir = parent;
81
- }
82
- return process.cwd();
83
- }
84
- function resolveShellPath() {
85
- try {
86
- const shell = process.env.SHELL || "/bin/zsh";
87
- const result = execSync(`${shell} -l -c 'echo $PATH'`, {
88
- encoding: "utf8",
89
- timeout: 3e3
90
- }).trim();
91
- if (result) return result;
92
- } catch {
93
80
  }
94
81
  return process.env.PATH || "";
95
82
  }
96
- var _WORKSPACE = process.env.WORKSPACE_DIR ?? detectWorkspaceDir();
83
+ var _WORKSPACE = process.env.WORKSPACE_DIR ?? process.cwd();
97
84
  {
98
85
  const dirsToCheck = [.../* @__PURE__ */ new Set([process.cwd(), _WORKSPACE])];
99
86
  for (const dir of dirsToCheck) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-chat/mention-watcher",
3
- "version": "0.0.9",
3
+ "version": "0.1.1",
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": {