Problem
checkGlobalBinConflicts has a BIN_OWNER_OVERRIDES map that recognizes certain bins as logically owned by a specific package even when the bin name doesn't match the package name (e.g., npx is owned by npm). This is used during global installs to decide whether a new package is allowed to override an existing bin.
However, the link-bins conflict resolution (compareCommandsInConflict in pkg-manager/link-bins/src/index.ts) only checks ownName (cmd.name === manifest.name). It has no awareness of these ownership overrides. This means that in a non-global install, if multiple packages provide the same bin (e.g., npx), the override owner (npm) doesn't get priority — the conflict falls through to alphabetical package name comparison.
Proposal
Consider applying the same ownership override rules in link-bins' compareCommandsInConflict so that conflict resolution is consistent between global conflict checking and actual bin linking.
Context
Introduced during review of #10828.
Problem
checkGlobalBinConflictshas aBIN_OWNER_OVERRIDESmap that recognizes certain bins as logically owned by a specific package even when the bin name doesn't match the package name (e.g.,npxis owned bynpm). This is used during global installs to decide whether a new package is allowed to override an existing bin.However, the
link-binsconflict resolution (compareCommandsInConflictinpkg-manager/link-bins/src/index.ts) only checksownName(cmd.name === manifest.name). It has no awareness of these ownership overrides. This means that in a non-global install, if multiple packages provide the same bin (e.g.,npx), the override owner (npm) doesn't get priority — the conflict falls through to alphabetical package name comparison.Proposal
Consider applying the same ownership override rules in
link-bins'compareCommandsInConflictso that conflict resolution is consistent between global conflict checking and actual bin linking.Context
Introduced during review of #10828.