feat: add file discovery performance guidance and fd/ripgrep installers#115
feat: add file discovery performance guidance and fd/ripgrep installers#115marcusquinn merged 1 commit intomainfrom
Conversation
- Add file discovery guidance to AGENTS.md with preference order: 1. git ls-files (instant, tracked files) 2. fd (fast, respects .gitignore) 3. rg --files (fast, respects .gitignore) 4. mcp_glob (fallback when bash unavailable) - Add setup_file_discovery_tools() to setup.sh: - Checks for fd and ripgrep installation - Offers to install via detected package manager - Handles Debian/Ubuntu fd-find package naming - Provides manual installation instructions - Update README.md Requirements section: - Add fd and ripgrep to install commands - Add File Discovery Tools section with comparison table - Document preference order for AI agents This addresses CPU overhead from mcp_glob on large codebases by guiding AI agents toward more efficient alternatives.
WalkthroughDocumentation and shell scripting updates introduce file discovery tools (fd and ripgrep) with setup automation. Changes include documentation in AGENTS.md and README.md, and a new setup function in setup.sh to detect and cross-platform-install these utilities. A duplicate function declaration in setup.sh requires attention. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
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. Comment |
Summary of ChangesHello @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 significantly improves the efficiency of file discovery operations for AI agents by integrating and promoting the use of high-performance tools like 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
|
|
🔍 Code Quality Report�[0;35m[MONITOR]�[0m Code Review Monitoring Report �[0;34m[INFO]�[0m Latest Quality Status: �[0;34m[INFO]�[0m Recent monitoring activity: 📈 Current Quality Metrics
Generated on: Sat Jan 17 05:08:20 UTC 2026 Generated by AI DevOps Framework Code Review Monitoring |
🤖 Augment PR SummarySummary: Improves AI-agent guidance and automation around fast file discovery in large repos.
🤖 Was this summary useful? React with 👍 or 👎 |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@setup.sh`:
- Around line 574-582: The check currently looks only for the fd executable
(command -v fd) so on Debian/Ubuntu systems where the package installs fdfind it
will still be reported missing; update the logic around the fd check to also
probe for fdfind, set fd_version by calling whichever binary exists (fd or
fdfind) and call print_success accordingly, and if only fdfind is found ensure
missing_packages/missing_names reflect the apt package name "fd-find" or map
fdfind to the canonical "fd" name in missing_tools; reference the existing
identifiers fd_version, missing_tools, missing_packages, missing_names, and
print_success when making the change.
| if ! command -v fd >/dev/null 2>&1; then | ||
| missing_tools+=("fd") | ||
| missing_packages+=("fd") | ||
| missing_names+=("fd (fast file finder)") | ||
| else | ||
| local fd_version | ||
| fd_version=$(fd --version 2>/dev/null | head -1 || echo "unknown") | ||
| print_success "fd found: $fd_version" | ||
| fi |
There was a problem hiding this comment.
Verify fd command availability after fd-find installation on Debian/Ubuntu.
On Debian/Ubuntu, fd-find installs the binary as fdfind, not fd. The check at line 574 (command -v fd) will still fail after installation since the binary name differs.
Consider checking for fdfind as well on apt-based systems, or updating the success message to be more accurate.
🔧 Suggested improvement
# Check for fd (fd-find)
- if ! command -v fd >/dev/null 2>&1; then
+ if ! command -v fd >/dev/null 2>&1 && ! command -v fdfind >/dev/null 2>&1; then
missing_tools+=("fd")
missing_packages+=("fd")
missing_names+=("fd (fast file finder)")
else
local fd_version
- fd_version=$(fd --version 2>/dev/null | head -1 || echo "unknown")
+ fd_version=$(fd --version 2>/dev/null || fdfind --version 2>/dev/null | head -1 || echo "unknown")
print_success "fd found: $fd_version"
fi🤖 Prompt for AI Agents
In `@setup.sh` around lines 574 - 582, The check currently looks only for the fd
executable (command -v fd) so on Debian/Ubuntu systems where the package
installs fdfind it will still be reported missing; update the logic around the
fd check to also probe for fdfind, set fd_version by calling whichever binary
exists (fd or fdfind) and call print_success accordingly, and if only fdfind is
found ensure missing_packages/missing_names reflect the apt package name
"fd-find" or map fdfind to the canonical "fd" name in missing_tools; reference
the existing identifiers fd_version, missing_tools, missing_packages,
missing_names, and print_success when making the change.
There was a problem hiding this comment.
Code Review
This pull request introduces performance guidance for file discovery and adds installers for fd and ripgrep. The documentation updates in AGENTS.md and README.md are clear and helpful. The new setup_file_discovery_tools function in setup.sh correctly detects and offers to install these tools. I've provided a couple of suggestions to improve the maintainability and scalability of the new shell script logic by reducing code duplication. Overall, this is a valuable addition to improve the performance of AI agents on large codebases.
| # Check for fd (fd-find) | ||
| if ! command -v fd >/dev/null 2>&1; then | ||
| missing_tools+=("fd") | ||
| missing_packages+=("fd") | ||
| missing_names+=("fd (fast file finder)") | ||
| else | ||
| local fd_version | ||
| fd_version=$(fd --version 2>/dev/null | head -1 || echo "unknown") | ||
| print_success "fd found: $fd_version" | ||
| fi | ||
|
|
||
| # Check for ripgrep | ||
| if ! command -v rg >/dev/null 2>&1; then | ||
| missing_tools+=("rg") | ||
| missing_packages+=("ripgrep") | ||
| missing_names+=("ripgrep (fast content search)") | ||
| else | ||
| local rg_version | ||
| rg_version=$(rg --version 2>/dev/null | head -1 || echo "unknown") | ||
| print_success "ripgrep found: $rg_version" | ||
| fi |
There was a problem hiding this comment.
The current implementation checks for fd and ripgrep in separate blocks of code. This can be refactored into a data-driven loop to improve maintainability and make it easier to add more tools in the future. By defining the tools in an array, you can iterate through them, reducing code duplication and making the logic more scalable.
| # Check for fd (fd-find) | |
| if ! command -v fd >/dev/null 2>&1; then | |
| missing_tools+=("fd") | |
| missing_packages+=("fd") | |
| missing_names+=("fd (fast file finder)") | |
| else | |
| local fd_version | |
| fd_version=$(fd --version 2>/dev/null | head -1 || echo "unknown") | |
| print_success "fd found: $fd_version" | |
| fi | |
| # Check for ripgrep | |
| if ! command -v rg >/dev/null 2>&1; then | |
| missing_tools+=("rg") | |
| missing_packages+=("ripgrep") | |
| missing_names+=("ripgrep (fast content search)") | |
| else | |
| local rg_version | |
| rg_version=$(rg --version 2>/dev/null | head -1 || echo "unknown") | |
| print_success "ripgrep found: $rg_version" | |
| fi | |
| local tools_to_check=( | |
| "fd:fd:fd (fast file finder)" | |
| "rg:ripgrep:ripgrep (fast content search)" | |
| ) | |
| for tool_info in "${tools_to_check[@]}"; do | |
| IFS=':' read -r cmd pkg_name friendly_name <<< "$tool_info" | |
| if ! command -v "$cmd" >/dev/null 2>&1; then | |
| missing_tools+=("$cmd") | |
| missing_packages+=("$pkg_name") | |
| missing_names+=("$friendly_name") | |
| else | |
| local version | |
| version=$($cmd --version 2>/dev/null | head -1 || echo "unknown") | |
| print_success "$friendly_name found: $version" | |
| fi | |
| done |
| if [[ "$pkg_manager" != "unknown" ]]; then | ||
| read -r -p "Install file discovery tools (${missing_packages[*]}) using $pkg_manager? (y/n): " install_fd_tools | ||
|
|
||
| if [[ "$install_fd_tools" == "y" ]]; then | ||
| print_info "Installing ${missing_packages[*]}..." | ||
|
|
||
| # Handle package name differences across package managers | ||
| local actual_packages=() | ||
| for pkg in "${missing_packages[@]}"; do | ||
| case "$pkg_manager" in | ||
| apt) | ||
| # Debian/Ubuntu uses fd-find instead of fd | ||
| if [[ "$pkg" == "fd" ]]; then | ||
| actual_packages+=("fd-find") | ||
| else | ||
| actual_packages+=("$pkg") | ||
| fi | ||
| ;; | ||
| *) | ||
| actual_packages+=("$pkg") | ||
| ;; | ||
| esac | ||
| done | ||
|
|
||
| if install_packages "$pkg_manager" "${actual_packages[@]}"; then | ||
| print_success "File discovery tools installed" | ||
|
|
||
| # On Debian/Ubuntu, fd is installed as fdfind - create alias | ||
| if [[ "$pkg_manager" == "apt" ]] && command -v fdfind >/dev/null 2>&1 && ! command -v fd >/dev/null 2>&1; then | ||
| print_info "Note: On Debian/Ubuntu, fd is installed as 'fdfind'" | ||
| echo " Consider adding to your shell config: alias fd=fdfind" | ||
| fi | ||
| else | ||
| print_warning "Failed to install some file discovery tools (non-critical)" | ||
| fi | ||
| else | ||
| print_info "Skipped file discovery tools installation" | ||
| echo "" | ||
| echo " Manual installation:" | ||
| echo " macOS: brew install fd ripgrep" | ||
| echo " Ubuntu/Debian: sudo apt install fd-find ripgrep" | ||
| echo " Fedora: sudo dnf install fd-find ripgrep" | ||
| echo " Arch: sudo pacman -S fd ripgrep" | ||
| fi | ||
| else | ||
| echo "" | ||
| echo " Manual installation:" | ||
| echo " macOS: brew install fd ripgrep" | ||
| echo " Ubuntu/Debian: sudo apt install fd-find ripgrep" | ||
| echo " Fedora: sudo dnf install fd-find ripgrep" | ||
| echo " Arch: sudo pacman -S fd ripgrep" | ||
| fi |
There was a problem hiding this comment.
The code block for printing manual installation instructions is duplicated. This can be refactored to avoid repetition, which improves maintainability. By restructuring the logic, you can have a single block that handles the case where automatic installation is not possible or was skipped by the user.
local attempt_install=false
if [[ "$pkg_manager" != "unknown" ]]; then
read -r -p "Install file discovery tools (${missing_packages[*]}) using $pkg_manager? (y/n): " install_fd_tools
if [[ "$install_fd_tools" == "y" ]]; then
attempt_install=true
fi
fi
if [[ "$attempt_install" == "true" ]]; then
print_info "Installing ${missing_packages[*]}..."
# Handle package name differences across package managers
local actual_packages=()
for pkg in "${missing_packages[@]}"; do
case "$pkg_manager" in
apt)
# Debian/Ubuntu uses fd-find instead of fd
if [[ "$pkg" == "fd" ]]; then
actual_packages+=("fd-find")
else
actual_packages+=("$pkg")
fi
;;
*)
actual_packages+=("$pkg")
;;
esac
done
if install_packages "$pkg_manager" "${actual_packages[@]}"; then
print_success "File discovery tools installed"
# On Debian/Ubuntu, fd is installed as fdfind - create alias
if [[ "$pkg_manager" == "apt" ]] && command -v fdfind >/dev/null 2>&1 && ! command -v fd >/dev/null 2>&1; then
print_info "Note: On Debian/Ubuntu, fd is installed as 'fdfind'"
echo " Consider adding to your shell config: alias fd=fdfind"
fi
else
print_warning "Failed to install some file discovery tools (non-critical)"
fi
else
if [[ "$pkg_manager" != "unknown" ]]; then
print_info "Skipped file discovery tools installation"
fi
echo ""
echo " Manual installation:"
echo " macOS: brew install fd ripgrep"
echo " Ubuntu/Debian: sudo apt install fd-find ripgrep"
echo " Fedora: sudo dnf install fd-find ripgrep"
echo " Arch: sudo pacman -S fd ripgrep"
fi


Summary
setup_file_discovery_tools()to setup.sh for automatic fd/ripgrep installationProblem
The
mcp_globtool (Claude Code's built-in glob) can be CPU-intensive on large codebases because it:.gitignoreefficientlySolution
Guide AI agents toward more efficient alternatives:
git ls-filesfdrg --filesmcp_globChanges
AGENTS.md
setup.sh
setup_file_discovery_tools()functionfd-findpackage namingREADME.md
Testing
Summary by CodeRabbit
Documentation
Chores
✏️ Tip: You can customize this high-level summary in your review settings.