Skip to content

fix: broaden Claude CLI discovery paths for pnpm and compatibility wrappers #432

@WhiskyChoy

Description

@WhiskyChoy

Summary / 概述

CodePilot's Claude CLI lookup currently misses several real-world install locations, which causes false "Claude CLI not installed" results even when the claude command works in a normal shell.

目前 CodePilot 对 Claude CLI 的查找路径不够全面。在一些真实安装方式下,系统里明明已经可以正常执行 claude,但 CodePilot 仍会误判为未安装。

Affected cases / 受影响场景

  • macOS installs exposed through pnpm, especially wrappers under ~/Library/pnpm/claude

  • compatibility wrappers placed under ~/.claude/local/claude

  • other package-manager shim directories such as Yarn / Volta / fnm / asdf

  • macOS 上通过 pnpm 暴露出来的 claude,尤其是 ~/Library/pnpm/claude

  • 放在 ~/.claude/local/claude 下的兼容包装脚本

  • Yarn / Volta / fnm / asdf 等常见 Node 管理器提供的 shim 目录

Why this happens / 原因

The current search logic only covers a limited subset of native, bun, homebrew, and npm paths. It does not scan several common PATH directories that users rely on today.

现有逻辑只覆盖了部分 native、bun、homebrew 和 npm 路径,没有扫描现在用户实际常用的一些 PATH 目录。

Proposed direction / 建议方向

  • expand the shared Claude candidate path list for macOS, Linux, and Windows

  • include ~/.claude/local, pnpm home directories, Yarn global bins, and common Node manager shims

  • keep the existing native > homebrew > npm style classification, while treating pnpm/yarn/manager shims as the npm-family channel

  • add focused unit tests for the new path helpers

  • 扩展 macOS、Linux、Windows 的 Claude 候选路径集合

  • 增加 ~/.claude/local、pnpm 目录、Yarn 全局 bin,以及常见 Node 管理器 shim

  • 保持现有 native > homebrew > npm 的分类思路,同时把 pnpm/yarn/管理器 shim 视为 npm-family

  • 增加聚焦这部分逻辑的单元测试

References / 参考

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions