-
Notifications
You must be signed in to change notification settings - Fork 70
Harden vscode/cursor install-hooks when IDE CLI is not in PATH #475
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
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>
|
|
Co-authored-by: svarlamov <10859025+svarlamov@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When
code/cursorCLIs aren't inPATH, extension installation silently fails with a warning. The CLIs are just shell script wrappers over Electron'scli.js— we can call it directly as a fallback.Changes
EditorCliCommandstruct (utils.rs) — Encapsulates CLI invocation, handling both PATH binaries and the Electron +cli.jsfallback (setsELECTRON_RUN_AS_NODE=1, passescli.jsas first arg, handles Windowscmd /Cwrapping)resolve_editor_cli(name)— Checks PATH first, then searches known OS-specific install locations:/Applications/{Cursor,Visual Studio Code}.app/Contents/.../usr/share/,/opt/,~/.local/share/%LOCALAPPDATA%\Programs\...is_vsc_editor_extension_installed/install_vsc_editor_extension— Now accept&EditorCliCommandinstead of&str, using itscommand()buildercursor.rs/vscode.rs— Replacedbinary_exists()+ raw program name withresolve_editor_cli()in bothcheck_hooks()andinstall_extras()How the fallback works
The
code/cursorshell scripts essentially do:resolve_editor_clifinds these paths directly when the wrapper script isn't inPATH, constructs the equivalent command, and uses it for version checks, extension listing, and extension installation.Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.