Skip to content

Conversation

@pec1985
Copy link
Contributor

@pec1985 pec1985 commented Sep 23, 2025

…he CLI

Summary by CodeRabbit

  • Bug Fixes

    • Installation now checks for zsh before installing shell completions on macOS and Linux, preventing unnecessary warnings and permission errors when zsh isn’t installed.
    • Skips zsh completion setup gracefully when zsh is absent, resulting in a cleaner install experience.
  • Chores

    • Reduced verbosity during installation by adding quiet debug handling for skipped zsh completion steps.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 23, 2025

Walkthrough

Adds 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

Cohort / File(s) Summary
Zsh completion guard in installer
`install.sh`
Add `command -v zsh` guard around zsh completion setup; conditionally handle macOS and Linux completion directories; introduce no-op path with silent debug when zsh is absent; preserve existing success paths; reduce warnings when zsh is not installed.

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
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

I thump my paw, install goes swish—
“Is zsh here?” I softly wish.
If yes, I drop completions neat,
If not, I bounce—no noisy bleat.
Two burrows: mac and linux lanes,
I hop them both, avoid the pains.
Carrot-shaped tabs for tidy brains. 🥕

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The PR title "[AGENT-684] Check if zsh is installed before adding autocomplete in t…" directly describes the primary change to guard zsh autocomplete installation and references the linked issue, making it concise and relevant to the install.sh modifications.
Linked Issues Check ✅ Passed The install.sh changes add a presence check (command -v zsh) and skip macOS/Linux zsh completion installation when zsh is absent, which directly satisfies AGENT-684's objective to verify zsh before configuring autocomplete.
Out of Scope Changes Check ✅ Passed Based on the provided summary, only install.sh was modified to add zsh presence guards and there are no other file changes or unrelated feature modifications, so no out-of-scope changes are present.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch AGENT-684

Comment @coderabbitai help to get the list of available commands and usage tips.

@pec1985 pec1985 requested a review from jhaynie September 23, 2025 14:09
Copy link
Contributor

@coderabbitai coderabbitai bot left a 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 fallback

On 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 instructions

Some 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 variable

COMPLETION_DIR is set but not used.

-    COMPLETION_DIR=""
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c251d77 and 84ec90a.

📒 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)

@pec1985 pec1985 merged commit 649cec0 into main Sep 24, 2025
14 checks passed
@pec1985 pec1985 deleted the AGENT-684 branch September 24, 2025 11:20
devin-ai-integration bot added a commit that referenced this pull request Sep 24, 2025
- 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 <>
jhaynie pushed a commit that referenced this pull request Sep 24, 2025
- 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants