granttap-mcp 0.8.133 → 0.8.134

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.
@@ -15,6 +15,7 @@ import { controllerPeerGate } from "../../pairing/controllers";
15
15
  import { applyNetworkRoute } from "../../device-network/settings";
16
16
  import { startEndpointPublisher } from "../../device-network/directory";
17
17
  import { managedAdmissionOptions } from "../../managed-admission";
18
+ import { publishStableNode } from "../../install/stable-node/index";
18
19
 
19
20
  import { startTaskDispatchMonitor } from "../../task-dispatch/worker/monitor";
20
21
  import { startTaskNetworkMonitor } from '../../task-network/runtime';
@@ -30,6 +31,8 @@ let stopEngineRecovery = () => {};
30
31
  let stopRuntimeUpdates = () => {};
31
32
  let stopUpdateReadiness = () => {};
32
33
 
34
+ publishStableNode();
35
+
33
36
  try {
34
37
  const cfg = applyNetworkRoute(loadConfig(machineConfigPath()));
35
38
  client = new RelayClient(cfg, {
@@ -0,0 +1,14 @@
1
+ # Stable Node link
2
+
3
+ Coding apps started from the Dock inherit a PATH without nvm and similar version
4
+ managers, so the Claude Code plugin's `node` command may not resolve there. The
5
+ monitor always runs under a working Node and publishes it at `bin/node` in the
6
+ private GrantTap configuration folder. The plugin appends that folder to the end
7
+ of its PATH, so a Node already on PATH still wins.
8
+
9
+ Public entry: `publishStableNode`. Windows installs Node on PATH and gets no link.
10
+ A storage failure never stops the monitor from starting. Tests run the published
11
+ link and cover replacement, Windows, and an unwritable folder.
12
+
13
+ License: this module is distributed under the GrantTap Commercial Source License
14
+ in the repository-root `LICENSE` file.
@@ -0,0 +1,30 @@
1
+ import { mkdirSync, readlinkSync, renameSync, rmSync, symlinkSync } from "node:fs";
2
+ import { join } from "node:path";
3
+ import { configDir } from "../../config";
4
+
5
+ function currentTarget(link: string): string | undefined {
6
+ try { return readlinkSync(link); } catch { return undefined; }
7
+ }
8
+
9
+ /**
10
+ * Coding apps started from the Dock inherit a PATH without nvm and similar
11
+ * version managers, so a plugin's `node` command may not resolve there. The
12
+ * monitor always runs under a working Node and publishes it at one stable path.
13
+ * Windows installs Node on PATH and needs no link.
14
+ */
15
+ export function publishStableNode(root = configDir(), nodePath = process.execPath,
16
+ platform: NodeJS.Platform = process.platform): void {
17
+ if (platform === "win32") return;
18
+ const bin = join(root, "bin");
19
+ const link = join(bin, "node");
20
+ try {
21
+ mkdirSync(bin, { recursive: true, mode: 0o700 });
22
+ if (currentTarget(link) === nodePath) return;
23
+ const next = `${link}.${process.pid}.tmp`;
24
+ rmSync(next, { force: true });
25
+ symlinkSync(nodePath, next);
26
+ renameSync(next, link);
27
+ } catch {
28
+ // A plugin can still find a Node that is already on PATH.
29
+ }
30
+ }
@@ -10,7 +10,7 @@ keeps each phone response tied to the exact originating chat and prompt.
10
10
  Install the supported CLI on this computer, then run:
11
11
 
12
12
  ```bash
13
- npm install -g granttap-mcp@0.8.133
13
+ npm install -g granttap-mcp@0.8.134
14
14
  granttap setup
15
15
  granttap status
16
16
  ```
@@ -4,7 +4,7 @@
4
4
  "command": "node",
5
5
  "args": [
6
6
  "-e",
7
- "\"use strict\";\n\n// Cursor may start this MCP from any cwd. Execute JavaScript entry points with\n// Node itself: Windows batch shims require shell quoting that differs by host.\nconst { spawn } = require(\"node:child_process\");\nconst { existsSync } = require(\"node:fs\");\nconst { delimiter, dirname, join } = require(\"node:path\");\n\nconst PACKAGE = \"granttap-mcp@0.8.133\";\nconst dryRun = process.env.GRANTTAP_BOOTSTRAP_DRY_RUN === \"1\";\nconst platform = dryRun && process.env.GRANTTAP_BOOTSTRAP_PLATFORM\n ? process.env.GRANTTAP_BOOTSTRAP_PLATFORM : process.platform;\nconst nodeRoot = dryRun && process.env.GRANTTAP_BOOTSTRAP_NODE_ROOT\n ? process.env.GRANTTAP_BOOTSTRAP_NODE_ROOT : dirname(process.execPath);\nconst pathRoots = (process.env.PATH || \"\").split(delimiter).filter(Boolean);\nconst appData = process.env.APPDATA;\nconst roots = [nodeRoot, ...pathRoots, ...(appData ? [join(appData, \"npm\")] : [])];\nconst first = (paths) => paths.find((path) => existsSync(path));\n\nfunction launch() {\n if (platform !== \"win32\") {\n const installed = first(roots.map((root) => join(root, \"granttap-mcp\")));\n if (installed) return { command: installed, args: [] };\n const npx = first(roots.map((root) => join(root, \"npx\"))) || \"npx\";\n return { command: npx, args: [\"-y\", PACKAGE] };\n }\n const installed = first(roots.map((root) =>\n join(root, \"node_modules\", \"granttap-mcp\", \"bin\", \"granttap-mcp.mjs\")));\n if (installed) return { command: process.execPath, args: [installed] };\n const npx = first(roots.map((root) =>\n join(root, \"node_modules\", \"npm\", \"bin\", \"npx-cli.js\")));\n if (npx) return { command: process.execPath, args: [npx, \"-y\", PACKAGE] };\n throw new Error(\"Node.js/npm 22.13.0+ is required on this Windows device. Install npm and retry GrantTap.\");\n}\n\nlet target;\ntry { target = launch(); }\ncatch (error) {\n process.stderr.write(`[granttap] ${error.message}\\n`);\n process.exit(1);\n}\n\nif (dryRun) {\n process.stdout.write(JSON.stringify(target));\n process.exit(0);\n}\n\nconst child = spawn(target.command, target.args, { stdio: \"inherit\", windowsHide: true });\nchild.on(\"error\", (error) => {\n process.stderr.write(`[granttap] ${error.message}\\n`);\n process.exit(1);\n});\nchild.on(\"exit\", (code, signal) => {\n if (signal && platform !== \"win32\") {\n try { process.kill(process.pid, signal); } catch { process.exit(code ?? 1); }\n return;\n }\n process.exit(code ?? 1);\n});\n"
7
+ "\"use strict\";\n\n// Cursor may start this MCP from any cwd. Execute JavaScript entry points with\n// Node itself: Windows batch shims require shell quoting that differs by host.\nconst { spawn } = require(\"node:child_process\");\nconst { existsSync } = require(\"node:fs\");\nconst { delimiter, dirname, join } = require(\"node:path\");\n\nconst PACKAGE = \"granttap-mcp@0.8.134\";\nconst dryRun = process.env.GRANTTAP_BOOTSTRAP_DRY_RUN === \"1\";\nconst platform = dryRun && process.env.GRANTTAP_BOOTSTRAP_PLATFORM\n ? process.env.GRANTTAP_BOOTSTRAP_PLATFORM : process.platform;\nconst nodeRoot = dryRun && process.env.GRANTTAP_BOOTSTRAP_NODE_ROOT\n ? process.env.GRANTTAP_BOOTSTRAP_NODE_ROOT : dirname(process.execPath);\nconst pathRoots = (process.env.PATH || \"\").split(delimiter).filter(Boolean);\nconst appData = process.env.APPDATA;\nconst roots = [nodeRoot, ...pathRoots, ...(appData ? [join(appData, \"npm\")] : [])];\nconst first = (paths) => paths.find((path) => existsSync(path));\n\nfunction launch() {\n if (platform !== \"win32\") {\n const installed = first(roots.map((root) => join(root, \"granttap-mcp\")));\n if (installed) return { command: installed, args: [] };\n const npx = first(roots.map((root) => join(root, \"npx\"))) || \"npx\";\n return { command: npx, args: [\"-y\", PACKAGE] };\n }\n const installed = first(roots.map((root) =>\n join(root, \"node_modules\", \"granttap-mcp\", \"bin\", \"granttap-mcp.mjs\")));\n if (installed) return { command: process.execPath, args: [installed] };\n const npx = first(roots.map((root) =>\n join(root, \"node_modules\", \"npm\", \"bin\", \"npx-cli.js\")));\n if (npx) return { command: process.execPath, args: [npx, \"-y\", PACKAGE] };\n throw new Error(\"Node.js/npm 22.13.0+ is required on this Windows device. Install npm and retry GrantTap.\");\n}\n\nlet target;\ntry { target = launch(); }\ncatch (error) {\n process.stderr.write(`[granttap] ${error.message}\\n`);\n process.exit(1);\n}\n\nif (dryRun) {\n process.stdout.write(JSON.stringify(target));\n process.exit(0);\n}\n\nconst child = spawn(target.command, target.args, { stdio: \"inherit\", windowsHide: true });\nchild.on(\"error\", (error) => {\n process.stderr.write(`[granttap] ${error.message}\\n`);\n process.exit(1);\n});\nchild.on(\"exit\", (code, signal) => {\n if (signal && platform !== \"win32\") {\n try { process.kill(process.pid, signal); } catch { process.exit(code ?? 1); }\n return;\n }\n process.exit(code ?? 1);\n});\n"
8
8
  ]
9
9
  }
10
10
  }
@@ -7,7 +7,7 @@ const { spawn } = require("node:child_process");
7
7
  const { existsSync } = require("node:fs");
8
8
  const { delimiter, dirname, join } = require("node:path");
9
9
 
10
- const PACKAGE = "granttap-mcp@0.8.133";
10
+ const PACKAGE = "granttap-mcp@0.8.134";
11
11
  const dryRun = process.env.GRANTTAP_BOOTSTRAP_DRY_RUN === "1";
12
12
  const platform = dryRun && process.env.GRANTTAP_BOOTSTRAP_PLATFORM
13
13
  ? process.env.GRANTTAP_BOOTSTRAP_PLATFORM : process.platform;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "granttap-mcp",
3
- "version": "0.8.133",
3
+ "version": "0.8.134",
4
4
  "description": "Commercial computer runtime connecting local coding agents to GrantTap on Mac, iPhone, iPad and Apple Watch.",
5
5
  "type": "module",
6
6
  "bin": {