Fix bundled CLI invocation in installed extensions#19
Merged
Conversation
The packaged .vsix never contained npm's `node_modules/.bin/agent-device` shim, so installed extensions hit `ENOENT` on the first run step. Resolve the bundled CLI as `process.execPath` plus the actual `.mjs` entrypoint (`node_modules/agent-device/bin/agent-device.mjs`), with `ELECTRON_RUN_AS_NODE=1` set so the host's Electron binary runs the script as Node. Same pattern works in VS Code and every Electron fork (Cursor, VSCodium, etc.). User-supplied `agentDevice.cliPath` overrides still spawn directly. Bumps to 0.1.2.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The packaged
.vsixnever contained npm'snode_modules/.bin/agent-deviceshim — that's a local symlink layer npm creates at install time, not a real artifact. Result: every installed extension (in VS Code, Cursor, etc.) hitENOENTon the first run step:Fix
Resolve the bundled CLI as
process.execPath(the host Electron binary) plus the actual.mjsentrypoint (node_modules/agent-device/bin/agent-device.mjs), and setELECTRON_RUN_AS_NODE=1in the spawned env so Electron behaves as a plain Node interpreter for the child process. This is the standard VS Code extension pattern for invoking Node scripts and works identically in Cursor / VSCodium / code-server.User-supplied
agentDevice.cliPathoverrides are still spawned directly — assumed to point at an executable.Type changes
BinPathnow accepts the structured{ command, prefixArgs, env }shape in addition to the plain-string shorthand.xcrun,open,adb, andemulatorcall sites inDeviceCatalogkeep their string form unchanged.Verification
npm run lintcleannpm run format:checkcleannpm test(35 specs pass)npm run compilecleannode node_modules/agent-device/bin/agent-device.mjs --helpproduces the agent-device help textnode_modules/agent-device/bin/agent-device.mjsis included in the.vsix(unzip -lcheck)open com.apple.Preferencesstep actually runsBumps to
0.1.2.