Skip to content

link-bins: apply bin ownership overrides in conflict resolution #10850

@zkochan

Description

@zkochan

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions