fix(model): implement custom lookPath for node package managers#113
fix(model): implement custom lookPath for node package managers#113
Conversation
Replace exec.LookPath with a custom lookPath function that checks common installation locations for bunx and npx executables. This fixes the issue where the daemon service cannot find these executables because the PATH environment variable doesn't include user-specific Node.js installation paths. The custom lookPath function: - First tries standard exec.LookPath (system PATH) - Falls back to checking common locations (npm, pnpm, bun, nvm) - Supports multiple platforms (Windows, macOS, Linux) - Checks for executable permissions on Unix-like systems Fixes #112 Co-authored-by: Le He <AnnatarHe@users.noreply.github.com>
Summary of ChangesHello @AnnatarHe, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request resolves an issue where the daemon service could not locate Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
Codecov Report❌ Patch coverage is
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 1 file with indirect coverage changes 🚀 New features to boost your workflow:
|
|
you also need to support search |
|
Claude finished @AnnatarHe's task —— View job Added fnm support ✓
I've added support for fnm (Fast Node Manager) to the custom
These paths follow the same glob pattern approach used for nvm, allowing the function to find executables across different Node.js versions managed by fnm. |
There was a problem hiding this comment.
Code Review
This pull request introduces a custom lookPath function to locate Node.js package manager executables like bunx and npx beyond the system's PATH. This is a good approach to handle cases where daemon services run with a minimal environment. The implementation is generally solid, but I've identified a few areas for improvement to enhance its correctness and maintainability. My suggestions focus on using filepath.Join consistently for path construction, refining the logic for selecting NVM versions to prefer newer ones, and updating an error message for better clarity.
Add Fast Node Manager (fnm) installation paths to the custom lookPath function. This includes both standard fnm locations (~/.local/share/fnm and ~/.fnm) as well as support for the FNM_DIR environment variable. The implementation mirrors the existing NVM support, searching for executables in fnm's node-versions subdirectories. Co-authored-by: Le He <AnnatarHe@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Replace exec.LookPath with a custom lookPath function that checks common installation locations for bunx and npx executables. This fixes the issue where the daemon service cannot find these executables because the PATH environment variable doesn't include user-specific Node.js installation paths.
Fixes #112
Generated with Claude Code