-
Notifications
You must be signed in to change notification settings - Fork 7
[AGENT-684] Check if zsh is installed before adding autocomplete in t… #450
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
Conversation
WalkthroughAdds a presence check for zsh in install.sh before attempting to install shell completions. If zsh exists, proceeds with macOS (/usr/local/share/zsh/site-functions) or Linux (/usr/share/zsh/vendor-completions) completion installation checks; if not, silently skips the zsh completion steps. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor U as User
participant I as install.sh
participant Z as zsh (binary)
participant M as macOS zsh completions (/usr/local/.../site-functions)
participant L as Linux zsh completions (/usr/share/.../vendor-completions)
U->>I: Run installer
I->>I: Check zsh presence (command -v zsh)
alt zsh found
I->>Z: Confirm binary available
alt macOS path exists
I->>M: Install/enable zsh completion
M-->>I: Done
else Linux path exists
I->>L: Install/enable zsh completion
L-->>I: Done
else
I->>I: Skip (no matching zsh completion dir)
end
else zsh not found
I->>I: Skip zsh completion (silent debug)
end
I-->>U: Finish installation
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing touches
🧪 Generate unit tests
Comment |
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.
Actionable comments posted: 0
🧹 Nitpick comments (3)
install.sh (3)
388-401: Handle Apple Silicon/Homebrew zsh completion path and missing-dir fallbackOn macOS, many systems (Apple Silicon) use /opt/homebrew/share/zsh/site-functions. Also, when zsh is present but no system completion dir exists, the current logic silently does nothing. Add broader path detection and a user‑scope fallback.
- # Check if zsh is installed before attempting to install zsh completion - if command -v zsh >/dev/null 2>&1 && [ -d "/usr/local/share/zsh/site-functions" ]; then - ZSH_COMPLETION_DIR="/usr/local/share/zsh/site-functions" - if [ -w "$ZSH_COMPLETION_DIR" ]; then - ohai "Generating zsh completion script..." - "$INSTALL_PATH/agentuity" completion zsh > "$ZSH_COMPLETION_DIR/_agentuity" - ohai "Zsh completion installed to $ZSH_COMPLETION_DIR/_agentuity" - else - warn "No write permission to $ZSH_COMPLETION_DIR. Skipping zsh completion installation." - fi - elif ! command -v zsh >/dev/null 2>&1; then - # Only skip silently if zsh is not installed (avoid unnecessary warnings) - debug "Zsh not found, skipping zsh completion installation" - fi + # Check if zsh is installed before attempting to install zsh completion + if command -v zsh >/dev/null 2>&1; then + # Support Apple Silicon/Homebrew and common locations + ZSH_COMPLETION_DIR="" + for d in "/opt/homebrew/share/zsh/site-functions" "/usr/local/share/zsh/site-functions" "/usr/share/zsh/site-functions"; do + if [ -d "$d" ]; then + ZSH_COMPLETION_DIR="$d" + break + fi + done + if [ -n "$ZSH_COMPLETION_DIR" ]; then + if [ -w "$ZSH_COMPLETION_DIR" ]; then + ohai "Generating zsh completion script..." + "$INSTALL_PATH/agentuity" completion zsh > "$ZSH_COMPLETION_DIR/_agentuity" + ohai "Zsh completion installed to $ZSH_COMPLETION_DIR/_agentuity" + else + warn "No write permission to $ZSH_COMPLETION_DIR. Skipping zsh completion installation." + fi + else + ohai "Zsh detected but no system completion directory found. You can install locally with:" + echo " mkdir -p ~/.zsh/completion" + echo " $INSTALL_PATH/agentuity completion zsh > ~/.zsh/completion/_agentuity" + echo " echo 'fpath=(~/.zsh/completion \$fpath)' >> ~/.zshrc" + echo " echo 'autoload -U compinit && compinit' >> ~/.zshrc" + fi + else + # Only skip silently if zsh is not installed (avoid unnecessary warnings) + debug "Zsh not found, skipping zsh completion installation" + fi
418-436: Linux: add site-functions fallback and handle missing dirs with user-scope instructionsSome distros use /usr/share/zsh/site-functions instead of vendor-completions. Also, if the directory doesn’t exist, we currently do nothing. Add fallback and a local install path when system dirs are absent.
- # Check if zsh is installed before attempting to install zsh completion - if command -v zsh >/dev/null 2>&1 && [ -d "/usr/share/zsh/vendor-completions" ]; then - ZSH_COMPLETION_DIR="/usr/share/zsh/vendor-completions" - if [ -w "$ZSH_COMPLETION_DIR" ]; then - ohai "Generating zsh completion script..." - "$INSTALL_PATH/agentuity" completion zsh > "$ZSH_COMPLETION_DIR/_agentuity" - ohai "Zsh completion installed to $ZSH_COMPLETION_DIR/_agentuity" - else - warn "No write permission to $ZSH_COMPLETION_DIR. Skipping zsh completion installation." - ohai "You can manually install zsh completion with:" - echo " mkdir -p ~/.zsh/completion" - echo " $INSTALL_PATH/agentuity completion zsh > ~/.zsh/completion/_agentuity" - echo " echo 'fpath=(~/.zsh/completion \$fpath)' >> ~/.zshrc" - echo " echo 'autoload -U compinit && compinit' >> ~/.zshrc" - fi - elif ! command -v zsh >/dev/null 2>&1; then - # Only skip silently if zsh is not installed (avoid unnecessary warnings) - debug "Zsh not found, skipping zsh completion installation" - fi + # Check if zsh is installed before attempting to install zsh completion + if command -v zsh >/dev/null 2>&1; then + ZSH_COMPLETION_DIR="" + for d in "/usr/share/zsh/vendor-completions" "/usr/share/zsh/site-functions"; do + if [ -d "$d" ]; then + ZSH_COMPLETION_DIR="$d" + break + fi + done + if [ -n "$ZSH_COMPLETION_DIR" ]; then + if [ -w "$ZSH_COMPLETION_DIR" ]; then + ohai "Generating zsh completion script..." + "$INSTALL_PATH/agentuity" completion zsh > "$ZSH_COMPLETION_DIR/_agentuity" + ohai "Zsh completion installed to $ZSH_COMPLETION_DIR/_agentuity" + else + warn "No write permission to $ZSH_COMPLETION_DIR. Skipping zsh completion installation." + ohai "You can manually install zsh completion with:" + echo " mkdir -p ~/.zsh/completion" + echo " $INSTALL_PATH/agentuity completion zsh > ~/.zsh/completion/_agentuity" + echo " echo 'fpath=(~/.zsh/completion \$fpath)' >> ~/.zshrc" + echo " echo 'autoload -U compinit && compinit' >> ~/.zshrc" + fi + else + ohai "Zsh detected but no system completion directory found. You can manually install with:" + echo " mkdir -p ~/.zsh/completion" + echo " $INSTALL_PATH/agentuity completion zsh > ~/.zsh/completion/_agentuity" + echo " echo 'fpath=(~/.zsh/completion \$fpath)' >> ~/.zshrc" + echo " echo 'autoload -U compinit && compinit' >> ~/.zshrc" + fi + else + # Only skip silently if zsh is not installed (avoid unnecessary warnings) + debug "Zsh not found, skipping zsh completion installation" + fi
375-376: Remove unused variableCOMPLETION_DIR is set but not used.
- COMPLETION_DIR=""
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
install.sh(4 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: Test CLI Upgrade Path (windows-latest)
- GitHub Check: Analyze (go)
- Added: [AGENT-684] Check if zsh is installed before adding autocomplete in the CLI (#450) - Added: [AGENT-628] Unit tests (#441) - Added: feat: automatically add AGENTUITY_SDK_KEY and AGENTUITY_PROJECT_KEY to .env file when running dev command (#442) - Changed: Dont sort releases by commit msg (#447) - Changed: [AGENT-628] prevent local development env files from syncing to production (#440) - Fixed: Fix npm workspaces (#451) - Fixed: Fix 'Press any key to continue' to accept any key, not just Enter (#445) Co-Authored-By: unknown <>
- Added: [AGENT-684] Check if zsh is installed before adding autocomplete in the CLI (#450) - Added: [AGENT-628] Unit tests (#441) - Added: feat: automatically add AGENTUITY_SDK_KEY and AGENTUITY_PROJECT_KEY to .env file when running dev command (#442) - Changed: Dont sort releases by commit msg (#447) - Changed: [AGENT-628] prevent local development env files from syncing to production (#440) - Fixed: Fix npm workspaces (#451) - Fixed: Fix 'Press any key to continue' to accept any key, not just Enter (#445) Co-Authored-By: unknown <> Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…he CLI
Summary by CodeRabbit
Bug Fixes
Chores