Skip to content

lark-cli update incorrectly detects pnpm-installed CLI as npm-installed #1681

Description

@ForgottenR

Bug Description

lark-cli update only recognizes two installation sources according to --help:

  • npm install: runs npm install -g @larksuite/cli@<version>
  • manual/other: shows GitHub Releases download URL

When @larksuite/cli is installed globally via pnpm, lark-cli update misdetects it as an npm installation and runs npm install -g @larksuite/cli@<version>. This installs a second copy under npm global (~/.nvm/.../bin/lark-cli) instead of updating the pnpm-managed copy (~/Library/pnpm/bin/lark-cli).

Environment

  • lark-cli version: 1.0.60 (installed via pnpm add -g @larksuite/cli)
  • pnpm version: 11.1.1
  • Node.js version: 26.1.0 (via nvm)
  • OS: macOS

Reproduction

  1. Install globally via pnpm:
pnpm add -g @larksuite/cli@1.0.44
  1. Run the self-updater:
lark-cli update

Actual result

  • A new copy of lark-cli is installed under npm global, e.g. ~/.nvm/versions/node/v26.1.0/bin/lark-cli.
  • The pnpm-managed copy remains at the old version.
  • which -a lark-cli now returns two different paths with potentially different versions.

Expected result

lark-cli update should detect the actual package manager (pnpm) and run the equivalent upgrade command, e.g.:

pnpm add -g @larksuite/cli@<version>

Alternatively, it should at least fall back to manual/other and show the GitHub release URL instead of silently switching package managers.

Root cause analysis

The detection logic appears to check whether the binary path lies under node_modules/@larksuite/cli/bin/. Since both npm and pnpm install the package into a node_modules/@larksuite/cli layout, pnpm installations satisfy the same path pattern and are incorrectly classified as npm installations.

Evidence from the binary strings:

npm install -g %s@%s
Detects the installation method automatically:
  - npm install: runs npm install -g @larksuite/cli@<version>
  - manual/other: shows GitHub Releases download URL

There are no pnpm add -g or pnpm install -g branches.

Impact

  • Users who prefer pnpm end up with duplicate, inconsistent lark-cli installations.
  • The lark-cli update command cannot be trusted to keep the active binary up to date when pnpm is used.
  • PATH order determines which version runs, leading to confusing behavior across shell sessions and VS Code extension host environments.

Workaround

For pnpm users, manually upgrade instead of using lark-cli update:

pnpm add -g @larksuite/cli@<version>

Then sync skills separately if needed:

pnpm dlx skills add larksuite/cli -y -g

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingdomain/coreCLI framework and core libraries

    Type

    No type

    Fields

    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