Use bun for autoupgrade when CLI installed via bun add -g#7556
Merged
Conversation
bun add -g installs the global binary as a symlink that resolves out of ~/.bun (typically into <HOME>/node_modules), so the resolved real path no longer contains 'bun' and package-manager detection fell through to npm. This made the autoupgrade flow shell out to 'npm install -g @shopify/cli@latest' for users who installed the CLI with bun. Also inspect the unresolved symlink path (argv[1]) when matching the yarn/pnpm/bun signal.
Contributor
Author
This stack of pull requests is managed by Graphite. Learn more about stacking. |
4 tasks
Contributor
Author
|
/snapit |
Contributor
|
🫰✨ Thanks @alfonso-noriega! Your snapshot has been published to npm. Test the snapshot by installing your package globally: pnpm i -g --@shopify:registry=https://registry.npmjs.org @shopify/cli@0.0.0-snapshot-20260515095220Caution After installing, validate the version by running |
isaacroldan
approved these changes
May 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

WHY are these changes introduced?
When the global Shopify CLI is installed via
bun add -g @shopify/cli, the autoupgrade flow incorrectly shells out tonpm install -g @shopify/cli@latestinstead of usingbun. Reproduction:Root cause:
inferPackageManagerForGlobalCLIinpackages/cli-kit/src/public/node/is-global.tsonly looked at the resolvedrealpathSync(argv[1])to decide which package manager to use. Butbun add -gcreates~/.bun/bin/<name>as a symlink whose target is../../node_modules/<pkg>/bin/run.js, which resolves to<HOME>/node_modules/<pkg>/bin/run.js— a path that no longer contains the stringbun. Detection fell through to the defaultnpmbranch, so the autoupgrade and the upgrade-available reminder both suggested the wrong command.WHAT is this pull request doing?
argv[1], e.g.~/.bun/bin/shopify) and the resolved real path when matching theyarn/pnpm/bunsignal. The original symlink under the package manager's bin dir is the most reliable indicator when the real path leaves that directory./cellar/in the resolved path) unchanged.~/.bun/bin/shopifyresolving to<HOME>/node_modules/@shopify/cli/bin/run.js.How to test your changes?
brew install bun).bun add -g @shopify/cliand confirmwhich shopifyreturns a path under~/.bun/bin.cli-kitbuild, runSHOPIFY_CLI_FORCE_AUTO_UPGRADE=1 shopify version.Upgrading Shopify CLI by running: `bun install -g @shopify/cli@latest`...and bun (not npm) performs the install.Unit tests:
Checklist
bun, which holds on all OSes.patch.