-
-
Notifications
You must be signed in to change notification settings - Fork 890
feat: support native installed Claude CLI detection #354
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
feat: support native installed Claude CLI detection #354
Conversation
Summary of ChangesHello @DragonFSKY, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request enhances the 'run-server.sh' script by implementing automatic detection for the Claude CLI when it's installed via its native method. This ensures that users who have installed Claude in the default ' Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request adds support for detecting the Claude CLI when installed via the native installer. The implementation correctly checks for the CLI at ~/.local/bin/claude and adds it to the PATH if found. My review includes a suggestion to refactor the CLI check to improve efficiency and reduce redundant commands, making the script more maintainable.
| if ! command -v claude &> /dev/null; then | ||
| if [[ -x "$HOME/.local/bin/claude" ]]; then | ||
| print_info "Found native installed Claude CLI at ~/.local/bin/claude" | ||
| export PATH="$HOME/.local/bin:$PATH" | ||
| print_success "Added ~/.local/bin to PATH" | ||
| fi | ||
| fi | ||
|
|
||
| if ! command -v claude &> /dev/null; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The logic to check for the Claude CLI is correct, but it could be made more efficient. Currently, command -v claude might be executed multiple times. You can refactor this to check only once by combining the logic for the native install check and the subsequent check for when the CLI is not found.
For example, you could structure it like this:
if ! command -v claude &> /dev/null; then
# Check for native installed Claude CLI if not found in PATH
if [[ -x "$HOME/.local/bin/claude" ]]; then
print_info "Found native installed Claude CLI at ~/.local/bin/claude"
export PATH="$HOME/.local/bin:$PATH"
print_success "Added ~/.local/bin to PATH"
else
echo ""
print_warning "Claude CLI not found"
echo ""
read -p "Would you like to add Zen to Claude Code? (Y/n): " -n 1 -r
echo ""
if [[ $REPLY =~ ^[Nn]$ ]]; then
print_info "Skipping Claude Code integration"
return 0
fi
echo ""
echo "Please install Claude Code first:"
echo " Visit: https://docs.anthropic.com/en/docs/claude-code/cli-usage"
echo ""
echo "Then run this script again to register MCP."
return 1
fi
fi
# Now the rest of the function can assume 'claude' is available.This refactoring would make the code more efficient and easier to follow. Since this change would affect code outside of the current diff, I'm providing it as an example in the comment body rather than a direct suggestion.
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 BeehiveInnovations#303
fcf5dea to
adc6231
Compare
…ns#354) - Auto-detect Claude CLI at ~/.local/bin, /opt/homebrew/bin, /usr/local/bin - Add found path to PATH when claude not in system PATH - Closes BeehiveInnovations#303
Summary
Add automatic detection for Claude CLI installed via native methods that may not be in PATH:
curl https://claude.ai/install.sh | bash→~/.local/bin/claudebrew install --cask claude-code→/opt/homebrew/bin/claude(Apple Silicon) or/usr/local/bin/claude(Intel)When claude is not found in PATH, the script checks these paths in order and adds the first found to PATH.
Changes
check_claude_cli_integration()function~/.local/bin,/opt/homebrew/bin,/usr/local/binTest plan
References
/opt/homebrew/bin/claudeCloses #303