Auto detect pnpm global installation path for macOS and Windows#22748
Auto detect pnpm global installation path for macOS and Windows#22748tisonkun wants to merge 5 commits intogoogle-gemini:mainfrom
Conversation
Summary of ChangesHello, 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 enhances the pnpm global installation detection logic within the CLI. It addresses an issue where the current path prediction failed to recognize the standard global installation location for pnpm on macOS, ensuring better compatibility and user experience for macOS users. Highlights
Changelog
Activity
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
|
There was a problem hiding this comment.
Code Review
This pull request aims to add support for detecting pnpm global installations on macOS. The added check is a bit too broad and could lead to false positives by incorrectly identifying local installations as global ones if the project path contains /pnpm/global. I've suggested a more specific check to prevent this.
|
cc @NTaylorMullen @alisa-alisa How can we move this forward? |
|
I verified the same issue on Windows. For a global pnpm install on my machine, the resolved path is:
Since this PR already moved toward explicit platform-specific path checks, I think it would make sense to include the Windows global pnpm layout as well, e.g.: realPath.includes('/.pnpm/global') ||
realPath.includes('/.local/share/pnpm') ||
realPath.includes('/Library/pnpm/global/') ||
realPath.includes('/AppData/Local/pnpm/global/') |
SGTM. Integrated. Now we need some Google friends to move this forward. @ryanjsalva could you help in review or know who should be in charge here? |
This closes google-gemini#18023. On macOS, the path is `$HOME/Library/pnpm/global/5`, which doesn't match the current prediects.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
|
Hi there! Thank you for your interest in contributing to Gemini CLI. To ensure we maintain high code quality and focus on our prioritized roadmap, we have updated our contribution policy (see Discussion #17383). We only guarantee review and consideration of pull requests for issues that are explicitly labeled as 'help wanted'. All other community pull requests are subject to closure after 14 days if they do not align with our current focus areas. For this reason, we strongly recommend that contributors only submit pull requests against issues explicitly labeled as 'help-wanted'. This pull request is being closed as it has been open for 14 days without a 'help wanted' designation. We encourage you to find and contribute to existing 'help wanted' issues in our backlog! Thank you for your understanding and for being part of our community! |
|
@sejun-run lmao unfortunately Google doesn't seem to like me. |
T.T don't see why this isnt a big issue for them default update setting is messed up guys.. |
|
@tisonkun, apologies for the bot closing this PR! We have reopened it. Please sync your branch to the latest |
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request updates the getInstallationInfo utility to include additional global installation paths for pnpm on macOS and Windows. A review comment highlights that using includes for path validation can lead to false positives and suggests a more robust approach by anchoring checks to the user's home directory or system-specific environment variables like LOCALAPPDATA.
| realPath.includes('/.local/share/pnpm') || | ||
| realPath.includes('/Library/pnpm/global/') || | ||
| realPath.includes('/AppData/Local/pnpm/global/') |
There was a problem hiding this comment.
Using includes for path checks is unreliable and can cause false positives (e.g., /other/project/Library/pnpm/global/). It is recommended to anchor these checks to the user's home directory or system folders like LOCALAPPDATA. Additionally, ensure realPath is resolved using a consistent function like resolveToRealPath to comply with repository standards for path validation.
| realPath.includes('/.local/share/pnpm') || | |
| realPath.includes('/Library/pnpm/global/') || | |
| realPath.includes('/AppData/Local/pnpm/global/') | |
| (process.platform === 'linux' && realPath.startsWith(require('node:os').homedir().replace(/\\/g, '/') + '/.local/share/pnpm')) || | |
| (process.platform === 'darwin' && realPath.startsWith(require('node:os').homedir().replace(/\\/g, '/') + '/Library/pnpm/global/')) || | |
| (process.platform === 'win32' && process.env['LOCALAPPDATA'] && realPath.startsWith(process.env['LOCALAPPDATA'].replace(/\\/g, '/') + '/pnpm/global/')) |
References
- Ensure consistent path resolution by using a single, robust function (e.g., resolveToRealPath) for all related path validations, including internal validations in components like WorkspaceContext.
|
@cocosheng-g OK. I'll rebase the PR today. |
|
@cocosheng-g I can see you merged the main branch, and I did it again. Nothing seems to need to change. Gemini's comment indicates a refactor of the section of logic, and I'd prefer to fix the issue first and investigate the refactor later. |
Summary
On macOS, the path is
$HOME/Library/pnpm/global/5, which doesn't match the current predictions.Related Issues
This closes #18023.
How to Validate
Pre-Merge Checklist