Skip to content

fix(coderabbit): update CLI commands to match official docs#124

Merged
marcusquinn merged 1 commit intomainfrom
fix/coderabbit-cli-commands
Jan 18, 2026
Merged

fix(coderabbit): update CLI commands to match official docs#124
marcusquinn merged 1 commit intomainfrom
fix/coderabbit-cli-commands

Conversation

@marcusquinn
Copy link
Copy Markdown
Owner

@marcusquinn marcusquinn commented Jan 18, 2026

Summary

Updates CodeRabbit CLI integration to use correct commands per official documentation.

Changes

coderabbit-cli.sh

Before: Used coderabbit review (incorrect)
After: Uses coderabbit --plain with proper flags

Old Command New Command Purpose
coderabbit review coderabbit --plain Plain text output for scripts/AI
(none) coderabbit --prompt-only Minimal output for AI agents
(none) --type uncommitted Only uncommitted changes
(none) --base <branch> Compare against specific branch
setup (API key) auth (browser OAuth) Authentication method

New functions:

  • review_changes() - Review uncommitted changes with mode selection
  • review_all_changes() - Review all changes (committed + uncommitted)
  • auth_login() - Browser-based OAuth authentication

coderabbit.md

Added comprehensive CLI documentation:

  • Installation instructions
  • Usage examples for local review
  • AI agent integration patterns
  • Helper script usage
  • Troubleshooting guide
  • Links to official docs

Testing

# Syntax check
bash -n .agent/scripts/coderabbit-cli.sh  # OK

# Help output
.agent/scripts/coderabbit-cli.sh help     # Shows updated commands

# Status check
.agent/scripts/coderabbit-cli.sh status   # Works

Related

Summary by CodeRabbit

  • New Features

    • Added browser-based authentication via new auth command
    • Review commands now support multiple modes (plain, prompt-only, interactive) and base branch comparisons
    • New review-all command for comprehensive reviews of all changes
  • Documentation

    • Expanded guides with CLI installation, authentication flows, usage examples, and troubleshooting sections

✏️ Tip: You can customize this high-level summary in your review settings.

- Change 'coderabbit review' to 'coderabbit --plain' (correct command)
- Add --prompt-only mode for AI agent integration
- Add --type flag support (all, uncommitted, committed)
- Add --base flag for branch comparison
- Replace setup_api_key with auth_login (browser-based OAuth)
- Add review_all_changes function for committed + uncommitted
- Update coderabbit.md with comprehensive CLI documentation
- Add installation, usage examples, and troubleshooting sections

Closes #t036
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Jan 18, 2026

Walkthrough

The CodeRabbit CLI script was restructured to introduce browser-based authentication via an auth command, replace static analysis workflow with mode-driven review and review-all commands, and add helper functions for API key management and review operations. Documentation was comprehensively updated to reflect new CLI structure and usage patterns.

Changes

Cohort / File(s) Summary
CLI Script Refactoring
.agent/scripts/coderabbit-cli.sh
Introduced auth_login() for browser-based authentication; replaced static review/analyze calls with review_changes(mode, base) and review_all_changes(mode, base) supporting --plain, --prompt-only, and interactive modes; added helper functions (install_cli, setup_api_key, load_api_key, get_coderabbit_reviews, apply_coderabbit_fixes, check_status, show_help); refactored main() to route new commands and handle mode/base parameters; deprecated setup path in favor of auth_login.
Documentation Update
.agent/tools/code-review/coderabbit.md
Restructured from trigger-focused reference to comprehensive CLI/PR review guide; added CLI Modes, Review Types, Rate Limits, Installation sections; replaced generic goals with concrete commands, usage examples, and local/PR-based workflows; expanded troubleshooting and resource guidance.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

The shell script introduces multiple new functions with conditional logic for mode handling and parameter forwarding, along with refactored control flow for authentication and review operations. Cross-function dependencies require verification, and documentation accuracy against implementation needs confirmation.

Poem

🔐 Auth gates open with a browser's gleam,
Review modes dance—plain, prompt, or dream,
CLI flows now orchestrate with grace,
Each function steps up to take its place,
Shell scripting dreams in DevOps space. ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: updating CLI commands in the CodeRabbit integration to align with official documentation.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello @marcusquinn, 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 refactors the CodeRabbit CLI integration to reflect the latest official documentation, ensuring that the tool's commands and authentication methods are current and functional. It also significantly enhances the accompanying documentation, providing clearer instructions and examples for both manual use and AI agent integration, thereby improving the overall usability and maintainability of the CodeRabbit setup.

Highlights

  • CodeRabbit CLI Integration Update: The CodeRabbit CLI integration has been updated to align with the official documentation, replacing outdated commands and introducing new functionalities.
  • New CLI Commands and Modes: The coderabbit-cli.sh script now uses coderabbit --plain for script/AI output, introduces --prompt-only for minimal AI agent output, and supports --type uncommitted and --base <branch> flags. New commands review, review-all, and auth have been added.
  • Enhanced Documentation: The coderabbit.md documentation has been completely rewritten to provide comprehensive guidance on CLI installation, usage examples for local review and AI agent integration, helper script usage, and troubleshooting.
  • Authentication Method Change: The setup command for API key configuration has been deprecated and replaced with auth for browser-based OAuth authentication.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@sonarqubecloud
Copy link
Copy Markdown

@github-actions
Copy link
Copy Markdown
Contributor

🔍 Code Quality Report

�[0;35m[MONITOR]�[0m Code Review Monitoring Report

�[0;34m[INFO]�[0m Latest Quality Status:
SonarCloud: 0 bugs, 0 vulnerabilities, 272 code smells

�[0;34m[INFO]�[0m Recent monitoring activity:
Sun Jan 18 20:25:59 UTC 2026: Code review monitoring started
Sun Jan 18 20:25:59 UTC 2026: SonarCloud - Bugs: 0, Vulnerabilities: 0, Code Smells: 272
Sun Jan 18 20:25:59 UTC 2026: Qlty - 0 issues found, auto-formatting applied
Sun Jan 18 20:26:01 UTC 2026: Codacy analysis completed with auto-fixes

📈 Current Quality Metrics

  • BUGS: 0
  • CODE SMELLS: 272
  • VULNERABILITIES: 0

Generated on: Sun Jan 18 20:26:44 UTC 2026


Generated by AI DevOps Framework Code Review Monitoring

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a 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 updates the CodeRabbit CLI integration to align with the latest official documentation, which is a great improvement. The shell script is updated with new commands and a browser-based authentication flow, and the documentation in coderabbit.md is now much more comprehensive.

I've found a critical security vulnerability in the shell script related to the use of eval with user-provided input, which could lead to command injection. I've provided suggestions to fix this by using arrays to build commands safely. I've also pointed out some code duplication that could be refactored for better maintainability.

Additionally, I've made a minor suggestion to improve the clarity of the installation instructions in the documentation.

Overall, these are valuable changes. Once the security issue is addressed, this will be a solid contribution.

Comment on lines +302 to 328
# Build command based on mode
local cmd="coderabbit"
case "$mode" in
"plain")
cmd="$cmd --plain --type uncommitted"
;;
"prompt-only")
cmd="$cmd --prompt-only --type uncommitted"
;;
"interactive")
cmd="$cmd --type uncommitted"
;;
esac

# Add base branch if specified
if [[ -n "$base_branch" ]]; then
cmd="$cmd --base $base_branch"
fi

print_info "Analyzing current git changes..."
if coderabbit review; then
print_info "Running: $cmd"
if eval "$cmd"; then
print_success "Code review completed"
return 0
else
print_error "Code review failed"
return 1
fi
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security-critical critical

Using eval with user-provided input can lead to command injection vulnerabilities. If a malicious string is passed as an argument (e.g., for base_branch), it could be executed. It's much safer to build the command and its arguments in an array and execute it directly. This also allows for proper handling of arguments with spaces or special characters.

Additionally, the case statement lacks a default branch to handle invalid mode arguments, which could lead to unexpected behavior. I've added a default case to provide a clear error message.

Here is a safer implementation using an array:

    # Build command based on mode
    local cmd_args=("coderabbit")
    case "$mode" in
        "plain")
            cmd_args+=(--plain --type uncommitted)
            ;;
        "prompt-only")
            cmd_args+=(--prompt-only --type uncommitted)
            ;;
        "interactive")
            cmd_args+=(--type uncommitted)
            ;;
        *)
            print_error "Invalid review mode: '$mode'. Must be 'plain', 'prompt-only', or 'interactive'."
            return 1
            ;;
    esac
    
    # Add base branch if specified
    if [[ -n "$base_branch" ]]; then
        cmd_args+=(--base "$base_branch")
    fi
    
    print_info "Running: ${cmd_args[*]}"
    if "${cmd_args[@]}"; then
        print_success "Code review completed"
        return 0
    else
        print_error "Code review failed"
        return 1
    fi

Comment on lines +345 to +371
# Build command based on mode
local cmd="coderabbit"
case "$mode" in
"plain")
cmd="$cmd --plain --type all"
;;
"prompt-only")
cmd="$cmd --prompt-only --type all"
;;
"interactive")
cmd="$cmd --type all"
;;
esac

# Add base branch if specified
if [[ -n "$base_branch" ]]; then
cmd="$cmd --base $base_branch"
fi

print_info "Running: $cmd"
if eval "$cmd"; then
print_success "Code review completed"
return 0
else
print_error "Code review failed"
return 1
fi
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security-critical critical

Similar to review_changes, this function uses eval with user input, which is a security risk that can lead to command injection. It should be refactored to use an array for command arguments.

I've also noticed that review_changes and review_all_changes are nearly identical. After applying this fix, consider refactoring them into a single helper function that takes the review type (all or uncommitted) as a parameter to reduce code duplication and improve maintainability.

Here is the immediate fix for this function:

    # Build command based on mode
    local cmd_args=("coderabbit")
    case "$mode" in
        "plain")
            cmd_args+=(--plain --type all)
            ;;
        "prompt-only")
            cmd_args+=(--prompt-only --type all)
            ;;
        "interactive")
            cmd_args+=(--type all)
            ;;
        *)
            print_error "Invalid review mode: '$mode'. Must be 'plain', 'prompt-only', or 'interactive'."
            return 1
            ;;
    esac
    
    # Add base branch if specified
    if [[ -n "$base_branch" ]]; then
        cmd_args+=(--base "$base_branch")
    fi
    
    print_info "Running: ${cmd_args[*]}"
    if "${cmd_args[@]}"; then
        print_success "Code review completed"
        return 0
    else
        print_error "Code review failed"
        return 1
    fi


### **Code Quality Improvements**
# Restart shell or reload config
source ~/.zshrc
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The instruction to source ~/.zshrc is specific to the Zsh shell. Users of other shells like Bash would need to source a different file (e.g., ~/.bashrc). To make the documentation more general and helpful for all users, it would be better to provide a more generic instruction or mention alternatives. Making this a commented-out example prevents execution errors for users on different shells.

Suggested change
source ~/.zshrc
# e.g., source ~/.zshrc or source ~/.bashrc

@augmentcode
Copy link
Copy Markdown

augmentcode bot commented Jan 18, 2026

🤖 Augment PR Summary

Summary: Updates the CodeRabbit integration to match the current official CLI behavior and improves local/PR review documentation.

Changes:

  • Update .agent/scripts/coderabbit-cli.sh to use coderabbit --plain/--prompt-only and explicit --type flags instead of the old coderabbit review command.
  • Add an auth/login command for browser-based OAuth and treat legacy setup as deprecated.
  • Add review-all to review committed + uncommitted changes, with optional base-branch comparisons.
  • Refresh help text and examples to reflect the new modes and flags.
  • Expand .agent/tools/code-review/coderabbit.md with install/auth steps, mode/type reference tables, helper script usage, troubleshooting, and links to official docs.

Technical Notes: Review commands are now parameterized by output mode (plain/prompt-only/interactive) and optionally accept a base branch for diff comparisons.

🤖 Was this summary useful? React with 👍 or 👎

Copy link
Copy Markdown

@augmentcode augmentcode bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review completed. 2 suggestions posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.

print_info "Analyzing current git changes..."
if coderabbit review; then
print_info "Running: $cmd"
if eval "$cmd"; then
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Running a dynamically built command via eval can introduce unintended shell interpretation/word-splitting when mode/base_branch contain spaces or shell metacharacters (also applies to review_all_changes). This is especially risky since the inputs come directly from CLI args.

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎

- **Purpose**: AI-powered code review via CLI (local) and PR (GitHub/GitLab)
- **CLI Install**: `curl -fsSL https://cli.coderabbit.ai/install.sh | sh`
- **CLI Auth**: `coderabbit auth login` (browser-based OAuth)
- **Review uncommitted**: `coderabbit --plain` or `coderabbit --prompt-only`
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Quick Reference/Usage sections describe coderabbit --plain as “review uncommitted”, but the “Review Types” table says the default is --type all. Consider clarifying which behavior is correct so readers don’t accidentally review a different scope than intended.

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎

@marcusquinn marcusquinn merged commit 3137da3 into main Jan 18, 2026
20 of 21 checks passed
Copy link
Copy Markdown
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: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
.agent/scripts/coderabbit-cli.sh (2)

106-172: Shell-script auto-fix can change behavior; avoid injecting return 0.
The awk rewrite forces success and can mask failures, which is risky for an automated fixer. As per coding guidelines, avoid logic-altering “fixes” in automation scripts.

🛠️ Safer fixer behavior
-    cp "$file" "$file.coderabbit-backup"
-    print_info "Created backup: $file.coderabbit-backup"
+    if ! cp "$file" "$file.coderabbit-backup"; then
+        print_error "Failed to create backup: $file.coderabbit-backup"
+        return 1
+    fi
+    print_info "Created backup: $file.coderabbit-backup"
@@
-    if [[ "$file" == *.sh ]]; then
-        print_info "Applying shell script fixes..."
-
-        # Add return statements to functions (basic implementation)
-        awk '
-        /^[a-zA-Z_][a-zA-Z0-9_]*\(\)/ { in_function = 1; function_name = $_arg1 }
-        /^}$/ && in_function {
-            print "    return 0"
-            print $0
-            in_function = 0
-            next
-        }
-        { print }
-        ' "$file" > "$file.tmp" && mv "$file.tmp" "$file"
-
-        print_success "Applied shell script fixes"
-    fi
+    if [[ "$file" == *.sh ]]; then
+        print_warning "Shell-script auto-fixes can change behavior; skipping by default."
+        print_info "Review and apply shell fixes manually for $file"
+    fi

56-104: Harden error handling for GitHub CLI and jq dependency checks to maintain automation reliability.

jq is used at lines 75, 79, 89 without availability verification, and gh command failures (lines 72, 87) are not captured. Both tools are documented dependencies (README.md:448-449, setup.sh:398), but following the codebase pattern (mainwp-helper.sh, vaultwarden-helper.sh, etc.), defensive checks align with automation script best practices.

🛠️ Proposed reliability hardening
 get_coderabbit_reviews() {
     print_header "Fetching CodeRabbit Reviews"

     # Check if gh CLI is available
     if ! command -v gh &> /dev/null; then
         print_warning "GitHub CLI (gh) not found. Install it for API access."
         print_info "Visit: https://cli.github.com/"
         return 1
     fi
+    if ! command -v jq &> /dev/null; then
+        print_warning "jq not found. Install it to parse GitHub API output."
+        return 1
+    fi

     # Get recent PRs with CodeRabbit reviews
     print_info "Fetching recent pull requests with CodeRabbit reviews..."

     local prs
-    prs=$(gh pr list --state all --limit 5 --json number,title,state,url)
+    if ! prs=$(gh pr list --state all --limit 5 --json number,title,state,url); then
+        print_error "Failed to fetch pull requests via GitHub CLI"
+        return 1
+    fi
@@
-            reviews=$(gh pr view "$latest_pr" --json reviews)
+            if ! reviews=$(gh pr view "$latest_pr" --json reviews); then
+                print_error "Failed to fetch reviews for PR #$latest_pr"
+                return 1
+            fi
🤖 Fix all issues with AI agents
In @.agent/scripts/coderabbit-cli.sh:
- Around line 288-329: The review_changes function builds a command string and
then uses eval with unvalidated user input (mode and base_branch), which risks
command injection and can drop the required "--type uncommitted" for invalid
modes; fix it by validating the mode (accept only "plain", "prompt-only",
"interactive" and error on unknown), build the command as an array (e.g.,
cmd=(coderabbit) and append safe flags like "--plain" or "--prompt-only" and
always append "--type" "uncommitted"), conditionally append "--base"
"$base_branch" only after validating/quoting base_branch, and invoke the command
without eval using the array (e.g., "${cmd[@]}"); reference review_changes,
mode, base_branch, and cmd when making the changes.

In @.agent/tools/code-review/coderabbit.md:
- Around line 46-50: Update the "## Rate Limits" section: change the static
bullets currently showing "Free: 2 reviews/hour" and "Pro: 8 reviews/hour" to
the verified values "Free: 3 reviews/hour" and "Pro: 5 reviews/hour" (or replace
the bullets with a single line linking to the official CodeRabbit docs for
dynamic reference); locate the "## Rate Limits" header and modify the two bullet
lines beneath it accordingly in the .agent/tools/code-review/coderabbit.md file.
- Around line 21-45: Update the "Review uncommitted" CLI example which currently
lists `coderabbit --plain` to accurately show the flag for uncommitted-only
reviews by changing it to include the `--type uncommitted` option (e.g.,
`coderabbit --plain --type uncommitted`), so locate the "Review uncommitted"
bullet and replace the command text; also ensure any related explanatory line in
the "CLI Modes" or "Review Types" sections consistently references `--type
uncommitted` when describing uncommitted-only behavior.
♻️ Duplicate comments (1)
.agent/scripts/coderabbit-cli.sh (1)

331-372: Same eval/validation risk as review_changes.
Apply the same array-based invocation and mode validation here too.

Comment on lines +288 to 329
# Review uncommitted changes (default mode for local development)
review_changes() {
print_header "Reviewing current changes with CodeRabbit..."
local mode="${1:-plain}"
local base_branch="${2:-}"

print_header "Reviewing uncommitted changes with CodeRabbit..."

if ! check_cli_installed; then
print_error "CodeRabbit CLI not installed. Run: $0 install"
return 1
fi

if ! load_api_key; then
return 1
print_info "Analyzing uncommitted git changes..."

# Build command based on mode
local cmd="coderabbit"
case "$mode" in
"plain")
cmd="$cmd --plain --type uncommitted"
;;
"prompt-only")
cmd="$cmd --prompt-only --type uncommitted"
;;
"interactive")
cmd="$cmd --type uncommitted"
;;
esac

# Add base branch if specified
if [[ -n "$base_branch" ]]; then
cmd="$cmd --base $base_branch"
fi

print_info "Analyzing current git changes..."
if coderabbit review; then
print_info "Running: $cmd"
if eval "$cmd"; then
print_success "Code review completed"
return 0
else
print_error "Code review failed"
return 1
fi
return 0
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Avoid eval and validate mode to prevent injection.
User-provided mode/base are interpolated into eval, which enables command injection and can skip --type uncommitted on invalid modes. As per coding guidelines, prefer safe argument handling in shell automation.

🔒 Proposed safe invocation
-    local cmd="coderabbit"
+    local -a cmd=(coderabbit)
     case "$mode" in
         "plain")
-            cmd="$cmd --plain --type uncommitted"
+            cmd+=(--plain --type uncommitted)
             ;;
         "prompt-only")
-            cmd="$cmd --prompt-only --type uncommitted"
+            cmd+=(--prompt-only --type uncommitted)
             ;;
         "interactive")
-            cmd="$cmd --type uncommitted"
+            cmd+=(--type uncommitted)
             ;;
+        *)
+            print_error "Unknown mode: $mode"
+            return 1
+            ;;
     esac
@@
-        cmd="$cmd --base $base_branch"
+        cmd+=(--base "$base_branch")
     fi
     
-    print_info "Running: $cmd"
-    if eval "$cmd"; then
+    print_info "Running: ${cmd[*]}"
+    if "${cmd[@]}"; then
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
# Review uncommitted changes (default mode for local development)
review_changes() {
print_header "Reviewing current changes with CodeRabbit..."
local mode="${1:-plain}"
local base_branch="${2:-}"
print_header "Reviewing uncommitted changes with CodeRabbit..."
if ! check_cli_installed; then
print_error "CodeRabbit CLI not installed. Run: $0 install"
return 1
fi
if ! load_api_key; then
return 1
print_info "Analyzing uncommitted git changes..."
# Build command based on mode
local cmd="coderabbit"
case "$mode" in
"plain")
cmd="$cmd --plain --type uncommitted"
;;
"prompt-only")
cmd="$cmd --prompt-only --type uncommitted"
;;
"interactive")
cmd="$cmd --type uncommitted"
;;
esac
# Add base branch if specified
if [[ -n "$base_branch" ]]; then
cmd="$cmd --base $base_branch"
fi
print_info "Analyzing current git changes..."
if coderabbit review; then
print_info "Running: $cmd"
if eval "$cmd"; then
print_success "Code review completed"
return 0
else
print_error "Code review failed"
return 1
fi
return 0
}
# Review uncommitted changes (default mode for local development)
review_changes() {
local mode="${1:-plain}"
local base_branch="${2:-}"
print_header "Reviewing uncommitted changes with CodeRabbit..."
if ! check_cli_installed; then
print_error "CodeRabbit CLI not installed. Run: $0 install"
return 1
fi
print_info "Analyzing uncommitted git changes..."
# Build command based on mode
local -a cmd=(coderabbit)
case "$mode" in
"plain")
cmd+=(--plain --type uncommitted)
;;
"prompt-only")
cmd+=(--prompt-only --type uncommitted)
;;
"interactive")
cmd+=(--type uncommitted)
;;
*)
print_error "Unknown mode: $mode"
return 1
;;
esac
# Add base branch if specified
if [[ -n "$base_branch" ]]; then
cmd+=(--base "$base_branch")
fi
print_info "Running: ${cmd[*]}"
if "${cmd[@]}"; then
print_success "Code review completed"
return 0
else
print_error "Code review failed"
return 1
fi
}
🤖 Prompt for AI Agents
In @.agent/scripts/coderabbit-cli.sh around lines 288 - 329, The review_changes
function builds a command string and then uses eval with unvalidated user input
(mode and base_branch), which risks command injection and can drop the required
"--type uncommitted" for invalid modes; fix it by validating the mode (accept
only "plain", "prompt-only", "interactive" and error on unknown), build the
command as an array (e.g., cmd=(coderabbit) and append safe flags like "--plain"
or "--prompt-only" and always append "--type" "uncommitted"), conditionally
append "--base" "$base_branch" only after validating/quoting base_branch, and
invoke the command without eval using the array (e.g., "${cmd[@]}"); reference
review_changes, mode, base_branch, and cmd when making the changes.

Comment on lines +21 to +45
- **Purpose**: AI-powered code review via CLI (local) and PR (GitHub/GitLab)
- **CLI Install**: `curl -fsSL https://cli.coderabbit.ai/install.sh | sh`
- **CLI Auth**: `coderabbit auth login` (browser-based OAuth)
- **Review uncommitted**: `coderabbit --plain` or `coderabbit --prompt-only`
- **Review all changes**: `coderabbit --plain --type all`
- **Compare branch**: `coderabbit --plain --base develop`
- **Helper script**: `~/.aidevops/agents/scripts/coderabbit-cli.sh`
- **Docs**: https://docs.coderabbit.ai/cli/overview

## CLI Modes

| Mode | Command | Use Case |
|------|---------|----------|
| Plain | `coderabbit --plain` | Scripts, AI agents, readable output |
| Prompt-only | `coderabbit --prompt-only` | AI agent integration (minimal) |
| Interactive | `coderabbit` | Manual review with TUI |

## Review Types

| Type | Flag | Description |
|------|------|-------------|
| All | `--type all` | Committed + uncommitted (default) |
| Uncommitted | `--type uncommitted` | Only working directory changes |
| Committed | `--type committed` | Only committed changes |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🌐 Web query:

CodeRabbit CLI default review type --type all --type uncommitted

💡 Result:

The CLI's --type flag accepts all, committed, or uncommitted. The default is "all" (reviews both committed and uncommitted changes). Use --type uncommitted to review only working-directory (uncommitted) changes. [1][2]

Sources:
[1] CodeRabbit CLI docs — Review local changes / CLI flags.
[2] CodeRabbit CLI docs — Review options (shows default = all).


Fix misleading CLI example for reviewing uncommitted changes.
The markdown shows coderabbit --plain as the command to review uncommitted changes, but the default behavior is --type all (both committed and uncommitted). Add the --type uncommitted flag to accurately review only working directory changes.

✏️ Recommended update
-- **Review uncommitted**: `coderabbit --plain` or `coderabbit --prompt-only`
+- **Review uncommitted**: `coderabbit --plain --type uncommitted` or `coderabbit --prompt-only --type uncommitted`
🤖 Prompt for AI Agents
In @.agent/tools/code-review/coderabbit.md around lines 21 - 45, Update the
"Review uncommitted" CLI example which currently lists `coderabbit --plain` to
accurately show the flag for uncommitted-only reviews by changing it to include
the `--type uncommitted` option (e.g., `coderabbit --plain --type uncommitted`),
so locate the "Review uncommitted" bullet and replace the command text; also
ensure any related explanatory line in the "CLI Modes" or "Review Types"
sections consistently references `--type uncommitted` when describing
uncommitted-only behavior.

Comment on lines +46 to +50
## Rate Limits

- Free: 2 reviews/hour
- Pro: 8 reviews/hour
- Paid users get learnings-powered reviews from codebase history
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🌐 Web query:

CodeRabbit CLI rate limits Free Pro plans 2024 2025

💡 Result:

Summary of CodeRabbit CLI rate limits (Free vs Pro)

  • Free / Free-tier CLI: generally limited to 2–3 reviews per hour (CLI-specific entries show 3/hour in FAQ and docs; some older doc text lists 1/hour for a very limited Free CLI mode). Use-case: summary-only or basic static-analysis reviews on Free. [1][2]

  • Pro (paid) CLI: 5 reviews per hour for the CLI. Paid tiers (Pro) also list higher IDE/PR limits and “unlimited” PR reviews on the web pricing page. Contact sales for custom/enterprise limits. [1][2][3]

Sources

  1. CodeRabbit CLI docs — “Pricing and capabilities” / Free & Paid rate limits (CLI rate limits: Free listed; Pro: 5 reviews/hour). [docs.coderabbit.ai/cli]. [1]
  2. CodeRabbit FAQ — “Usage Limits” table showing Reviews per hour (CLI): Free 3/hour, Trial 5/hour, OSS 1/hour, Pro 5/hour, Lite 3/hour. (FAQ reflects recent limits across plans). [docs.coderabbit.ai/faq]. [2]
  3. CodeRabbit Pricing page — plan descriptions (Free, Pro) and higher limits for Pro. [coderabbit.ai/pricing]. [3]

If you’d like, I can fetch the exact page snapshots (with dates) or check whether any rate limits changed between 2024 and 2025.


Rate limit values are outdated and need correction.
Official CodeRabbit docs (CLI and FAQ) show: Free = 3 reviews/hour, Pro = 5 reviews/hour. Current documentation incorrectly lists 2 and 8. To prevent future drift, replace static numbers with a reference to official docs:

Recommended fix
- Free: 2 reviews/hour
- Pro: 8 reviews/hour
+ See [CodeRabbit rate limits](https://docs.coderabbit.ai/cli#pricing-and-capabilities) for current limits by plan

Or if static values are preferred for quick reference, update to the verified current limits (Free: 3, Pro: 5).

🤖 Prompt for AI Agents
In @.agent/tools/code-review/coderabbit.md around lines 46 - 50, Update the "##
Rate Limits" section: change the static bullets currently showing "Free: 2
reviews/hour" and "Pro: 8 reviews/hour" to the verified values "Free: 3
reviews/hour" and "Pro: 5 reviews/hour" (or replace the bullets with a single
line linking to the official CodeRabbit docs for dynamic reference); locate the
"## Rate Limits" header and modify the two bullet lines beneath it accordingly
in the .agent/tools/code-review/coderabbit.md file.

@marcusquinn marcusquinn deleted the fix/coderabbit-cli-commands branch February 21, 2026 01:59
alex-solovyev added a commit that referenced this pull request Mar 13, 2026
… (GH#3520)

The eval vulnerability was already fixed in PR #436 (commit 5d4d96a) by
replacing string-based command building with bash arrays. This commit
completes the remaining Gemini review suggestion from PR #124 by adding
a `*` default case to both review_changes() and review_all_changes()
to reject invalid mode arguments with a clear error message.

Without the default case, an invalid mode silently falls through the
case statement and runs `coderabbit` with no mode flags, which is
unexpected behavior.

Closes #3520
alex-solovyev added a commit that referenced this pull request Mar 13, 2026
… (GH#3520) (#4376)

The eval vulnerability was already fixed in PR #436 (commit 5d4d96a) by
replacing string-based command building with bash arrays. This commit
completes the remaining Gemini review suggestion from PR #124 by adding
a `*` default case to both review_changes() and review_all_changes()
to reject invalid mode arguments with a clear error message.

Without the default case, an invalid mode silently falls through the
case statement and runs `coderabbit` with no mode flags, which is
unexpected behavior.

Closes #3520
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.

1 participant