Skip to content

Auto detect pnpm global installation path for macOS and Windows#22748

Open
tisonkun wants to merge 5 commits intogoogle-gemini:mainfrom
tisonkun:patch-1
Open

Auto detect pnpm global installation path for macOS and Windows#22748
tisonkun wants to merge 5 commits intogoogle-gemini:mainfrom
tisonkun:patch-1

Conversation

@tisonkun
Copy link
Copy Markdown

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

  • Updated relevant documentation and README (if needed)
  • Added/updated tests (if needed)
  • Noted breaking changes (if any)
  • Validated on required platforms/methods:
    • MacOS
      • npm run
      • npx
      • Docker
      • Podman
      • Seatbelt
    • Windows
      • npm run
      • npx
      • Docker
    • Linux
      • npm run
      • npx
      • Docker

@tisonkun tisonkun requested a review from a team as a code owner March 16, 2026 23:49
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, 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

  • Pnpm Global Path Detection: Added a new path pattern to correctly detect pnpm global installations on macOS, specifically $HOME/Library/pnpm/global/5.
Changelog
  • packages/cli/src/utils/installationInfo.ts
    • Updated the pnpm global installation path detection logic to include a new pattern relevant to macOS.
Activity
  • No review activity or comments have been recorded yet for this pull request.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

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.

@tisonkun
Copy link
Copy Markdown
Author

cc @NTaylorMullen @alisa-alisa

How can we move this forward?

@sejun-run
Copy link
Copy Markdown

I verified the same issue on Windows.

For a global pnpm install on my machine, the resolved path is:

C:/Users/<user>/AppData/Local/pnpm/global/5/...

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/')

@tisonkun
Copy link
Copy Markdown
Author

I verified the same issue on Windows.

For a global pnpm install on my machine, the resolved path is:

C:/Users/<user>/AppData/Local/pnpm/global/5/...

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?

tisonkun and others added 3 commits March 28, 2026 11:50
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>
@tisonkun tisonkun changed the title Auto detect pnpm global installation path for macOS Auto detect pnpm global installation path for macOS and Windows Mar 28, 2026
@gemini-cli
Copy link
Copy Markdown
Contributor

gemini-cli bot commented Mar 31, 2026

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!

@gemini-cli gemini-cli bot closed this Mar 31, 2026
@tisonkun tisonkun deleted the patch-1 branch March 31, 2026 11:29
@tisonkun tisonkun restored the patch-1 branch March 31, 2026 11:29
@tisonkun
Copy link
Copy Markdown
Author

@sejun-run lmao unfortunately Google doesn't seem to like me.

@sejun-run
Copy link
Copy Markdown

@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..

@cocosheng-g
Copy link
Copy Markdown
Contributor

@tisonkun, apologies for the bot closing this PR! We have reopened it. Please sync your branch to the latest main and we will have someone review it shortly.

@gemini-cli gemini-cli bot added the help wanted We will accept PRs from all issues marked as "help wanted". Thanks for your support! label Apr 8, 2026
@cocosheng-g
Copy link
Copy Markdown
Contributor

/gemini review

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

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.

Comment on lines +122 to +124
realPath.includes('/.local/share/pnpm') ||
realPath.includes('/Library/pnpm/global/') ||
realPath.includes('/AppData/Local/pnpm/global/')
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

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.

Suggested change
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
  1. 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.

@tisonkun
Copy link
Copy Markdown
Author

tisonkun commented Apr 9, 2026

@cocosheng-g OK. I'll rebase the PR today.

@tisonkun
Copy link
Copy Markdown
Author

tisonkun commented Apr 9, 2026

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/core Issues related to User Interface, OS Support, Core Functionality help wanted We will accept PRs from all issues marked as "help wanted". Thanks for your support!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Auto update with pnpm installation doesn't work well

3 participants