feat: support native installed Claude CLI detection

Add automatic detection for Claude CLI installed via native methods:
- curl https://claude.ai/install.sh | bash -> ~/.local/bin/claude
- brew install --cask claude-code -> /opt/homebrew/bin/claude (Apple Silicon)
- brew install --cask claude-code -> /usr/local/bin/claude (Intel Mac/Linux)

When claude is not found in PATH, the script checks these paths in order
and adds the first found to PATH, with informative log messages.

Closes #303
This commit is contained in:
谢栋梁
2025-12-03 16:07:09 +08:00
parent bcfaccecd4
commit adc6231b98

View File

@@ -1230,6 +1230,26 @@ check_claude_cli_integration() {
local python_cmd="$1"
local server_path="$2"
# Check for native installed Claude CLI (not in PATH by default)
# Native installs:
# - curl https://claude.ai/install.sh | bash -> ~/.local/bin/claude
# - brew install --cask claude-code -> /opt/homebrew/bin/claude (Apple Silicon) or /usr/local/bin/claude (Intel)
if ! command -v claude &> /dev/null; then
local claude_paths=(
"$HOME/.local/bin"
"/opt/homebrew/bin"
"/usr/local/bin"
)
for dir in "${claude_paths[@]}"; do
if [[ -x "$dir/claude" ]]; then
print_info "Found native installed Claude CLI at $dir/claude"
export PATH="$dir:$PATH"
print_success "Added $dir to PATH"
break
fi
done
fi
if ! command -v claude &> /dev/null; then
echo ""
print_warning "Claude CLI not found"