You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(extension): Windows works without Node installed — bundle Node.exe in .vsix + sidebar path fix
v0.1.1 release. Two failed Windows attempts (PR #136 attempt 1 used
"node" on PATH; attempt 2 used Cursor.exe + ELECTRON_RUN_AS_NODE) both
left users with a non-functional extension on Windows. Deep review
2026-05-19 produced two concrete findings + one strategy change.
Finding 1 (concrete bug) — sidebar empty on Windows:
extension/src/sidebar-webview.ts:326-328 computed the per-project
header via `workspaceRoot.split("/").filter(Boolean).pop()`. Windows
paths use backslashes (`C:\Users\...\repo`), so split returns the
entire path as a single element and the header renders as the literal
full path. This corrupts downstream HTML layout — almost certainly
the root cause user reported as "монитор пустой экран". Fix: use
path.basename(), which is platform-aware.
Finding 2 (unverified assumption) — MCP env pass-through unreliable:
Cursor's `cursor.mcp.registerServer({command, args, env})` API is
undocumented, and there's no confirmation Cursor merges the `env`
field into the spawn call. ELECTRON_RUN_AS_NODE was almost certainly
never reaching the spawned MCP process. Forum threads document
inconsistent Cursor behaviour around this env var.
Strategy change — self-contained bundle:
Per user requirement, the extension must work on any Windows machine
without Node.js installed AND without depending on Cursor's internal
Node-as-Electron behaviour. The .vsix now ships an actual node.exe
inside extension/bin/node-windows-x64.exe, downloaded from official
nodejs.org during CI build (v20.20.2, SHA256-pinned). The extension
invokes that bundled Node directly with the bundled JS payload —
plain process spawn, no env tricks, no system-Node dependency.
Files:
- .github/workflows/publish-extension.yml — new Windows-only step
downloads node-v20.20.2-win-x64.zip, verifies SHA256, extracts
node.exe into extension/bin/node-windows-x64.exe. Runs before the
existing "Bundle core CLI" step so the win32-x64 .vsix packages
both files (the shebang-shim text payload AND the real Node
interpreter).
- extension/src/binary-detect.ts — new findBundledNode() helper
resolves the bundled-Node path on Windows; returns undefined on
Linux/macOS (those execute the shebang shim natively).
- extension/src/spawn-binary.ts — Windows branch rewritten: uses the
module-cached bundled-Node path instead of process.execPath +
ELECTRON_RUN_AS_NODE. Adds setBundledNode() / getBundledNode()
so the cache is set once at activation and read everywhere.
- extension/src/mcp-register.ts — Windows branch rewritten: registers
Cursor MCP with command = bundled-node.exe path, args = [binary,
serve, ...]. No env-field dependency. Drops ELECTRON_RUN_AS_NODE.
- extension/src/hooks-install.ts — `.cmd` wrapper template rewritten:
invokes bundled Node directly with the bundled binary as argv. No
env var set; cleaner cmd.exe semantics.
- extension/src/extension.ts — activate() now caches the
bundled-Node path via setBundledNode() after findAxmeBinary()
succeeds, before MCP register / hook install run. Logs the path
for diagnostics. Non-Windows is a no-op (cached value is
undefined and never read).
- extension/src/sidebar-webview.ts — projectName uses
path.basename(), import added.
- extension/package.json — version 0.1.0 → 0.1.1.
VSIX size impact:
- linux-x64, linux-arm64, darwin-x64, darwin-arm64: unchanged (~580 KB)
- win32-x64: ~580 KB → ~30 MB (bundled node.exe)
Verification plan (separate from CI):
Real Windows machine without Node installed; install the artifact
.vsix; verify (1) Output channel shows "MCP: registered 'axme'
(command=...\node-windows-x64.exe, ...)", (2) sidebar renders project
name correctly, (3) chat agent can call axme_context successfully,
(4) self-test passes all 6 checks, (5) force-push is blocked by hook.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
0 commit comments