Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Feb 8, 2026

When code/cursor CLIs aren't in PATH, extension installation silently fails with a warning. The CLIs are just shell script wrappers over Electron's cli.js — we can call it directly as a fallback.

Changes

  • EditorCliCommand struct (utils.rs) — Encapsulates CLI invocation, handling both PATH binaries and the Electron + cli.js fallback (sets ELECTRON_RUN_AS_NODE=1, passes cli.js as first arg, handles Windows cmd /C wrapping)
  • resolve_editor_cli(name) — Checks PATH first, then searches known OS-specific install locations:
    • macOS: /Applications/{Cursor,Visual Studio Code}.app/Contents/...
    • Linux: /usr/share/, /opt/, ~/.local/share/
    • Windows: %LOCALAPPDATA%\Programs\...
  • is_vsc_editor_extension_installed / install_vsc_editor_extension — Now accept &EditorCliCommand instead of &str, using its command() builder
  • cursor.rs / vscode.rs — Replaced binary_exists() + raw program name with resolve_editor_cli() in both check_hooks() and install_extras()

How the fallback works

The code/cursor shell scripts essentially do:

ELECTRON_RUN_AS_NODE=1 "$APP/Contents/MacOS/Electron" "$APP/Contents/Resources/app/out/cli.js" "$@"

resolve_editor_cli finds these paths directly when the wrapper script isn't in PATH, constructs the equivalent command, and uses it for version checks, extension listing, and extension installation.

Original prompt

This section details on the original issue you should resolve

<issue_title>Harden vscode/cursor install-hooks when the user doesn't have the IDE CLI installed in path</issue_title>
<issue_description>The code and cursor CLIs are just shell script wrappers over the core electron cli.js script. If the CLIs don't exist in the PATH we should try to mimic what the shell scripts do and call cli.js directly. This will ensure we get all extensions/hooked installed even when the CLIs aren't available</issue_description>

Comments on the Issue (you are @copilot in this section)

@svarlamov Image

This is also the root cause of the extension installation warnings for cursor/vscode</comment_new>


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.


Open with Devin

@git-ai-cloud
Copy link

git-ai-cloud bot commented Feb 8, 2026

No AI authorship found for these commits. Please install git-ai to start tracking AI generated code in your commits.

… not in PATH

Add EditorCliCommand struct and resolve_editor_cli() function that first
checks if the editor CLI (code/cursor) is in PATH, and falls back to
finding the Electron binary and cli.js directly in known installation
directories. This mimics what the shell script wrappers do.

Update is_vsc_editor_extension_installed(), install_vsc_editor_extension(),
and version checking in both cursor.rs and vscode.rs to use the new
resolution mechanism.

Co-authored-by: svarlamov <10859025+svarlamov@users.noreply.github.com>
@CLAassistant
Copy link

CLAassistant commented Feb 8, 2026

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ svarlamov
❌ Copilot
You have signed the CLA already but the status is still pending? Let us recheck it.

Co-authored-by: svarlamov <10859025+svarlamov@users.noreply.github.com>
Copilot AI changed the title [WIP] Harden vscode/cursor install-hooks for missing CLI Harden vscode/cursor install-hooks when IDE CLI is not in PATH Feb 8, 2026
Copilot AI requested a review from svarlamov February 8, 2026 03:08
@svarlamov svarlamov marked this pull request as ready for review February 8, 2026 16:16
Copy link
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 5 additional findings.

Open in Devin Review

@svarlamov svarlamov enabled auto-merge February 8, 2026 16:42
@svarlamov svarlamov added this pull request to the merge queue Feb 8, 2026
@svarlamov svarlamov removed this pull request from the merge queue due to a manual request Feb 8, 2026
@svarlamov svarlamov enabled auto-merge February 8, 2026 19:35
@svarlamov svarlamov added this pull request to the merge queue Feb 8, 2026
@svarlamov svarlamov removed this pull request from the merge queue due to a manual request Feb 8, 2026
@svarlamov svarlamov merged commit f96d06c into main Feb 8, 2026
8 checks passed
@svarlamov svarlamov deleted the copilot/harden-vscode-cursor-install-hooks branch February 8, 2026 20:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Harden vscode/cursor install-hooks when the user doesn't have the IDE CLI installed in path

3 participants