Skip to content

sf plugins install <tarball-url> overwrites last plugin entry instead of creating new one #1294

@scolladon

Description

@scolladon

Description

When running sf plugins install <tarball-url> (installing a plugin from a GitHub release tarball URL), the command overwrites the last entry in ~/.local/share/sf/package.json's oclif.plugins array instead of creating a new entry with the correct package name.

The npm package files are installed correctly in node_modules/, but the oclif plugin registry entry retains the previous plugin's name, so the installed plugin is never recognized by sf.

Steps to reproduce

  1. Have an sf CLI installation with existing user plugins
  2. Run: sf plugins install https://github.com/scolladon/sfdx-git-delta/releases/download/dev-pr-1266/sfdx-git-delta-dev-pr-1266.tgz
  3. Check ~/.local/share/sf/package.json

Expected behavior

A new entry should be added to oclif.plugins:

{
  "name": "sfdx-git-delta",
  "type": "user",
  "url": "https://github.com/scolladon/sfdx-git-delta/releases/download/dev-pr-1266/sfdx-git-delta-dev-pr-1266.tgz"
}

Actual behavior

The last existing entry in oclif.plugins is overwritten with the URL but retains the old plugin's name:

{
  "name": "@j-schreiber/sf-cli-security-audit",  // <-- wrong name, was the last entry before install
  "type": "user",
  "url": "https://github.com/scolladon/sfdx-git-delta/releases/download/dev-pr-1266/sfdx-git-delta-dev-pr-1266.tgz"
}

The actual package files (sfdx-git-delta) ARE correctly installed in node_modules/, but sf doesn't recognize the plugin because the registry name is wrong.

Notes

  • This does NOT happen in CI with a fresh sf CLI installation (no pre-existing user plugins) — the first entry is created correctly.
  • Reproduced with @salesforce/cli@2.128.5, @oclif/plugin-plugins@5.4.58, Node v22.21.1, macOS arm64.
  • Tested multiple times — consistently overwrites the last entry regardless of which plugin it is.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions