Skip to content

feat: add fuzzy file search for PRD file path input#253

Merged
subsy merged 6 commits intosubsy:mainfrom
bigs:bigs/path-autocomplete
Feb 3, 2026
Merged

feat: add fuzzy file search for PRD file path input#253
subsy merged 6 commits intosubsy:mainfrom
bigs:bigs/path-autocomplete

Conversation

@bigs
Copy link
Copy Markdown
Contributor

@bigs bigs commented Feb 2, 2026

Summary

  • Add fuzzy autocomplete suggestions when entering PRD file paths in the EpicLoaderOverlay
  • Discovers JSON files on mount (up to depth 5, excluding node_modules/.git/dist/etc.) and filters them as the user types using a scoring-based fuzzy matcher
  • Arrow keys navigate suggestions, Tab completes, Enter selects
  • Fix cursor display bug where the underscore cursor was rendered as a separate element, causing the first character to appear masked

Test plan

  • Run bun run dev run --tracker json without a --prd flag
  • Press e to open the epic loader overlay
  • Verify cursor displays correctly (no character masking)
  • Verify JSON files in the project appear as suggestions
  • Type to filter suggestions with fuzzy matching
  • Use arrow keys to navigate suggestions
  • Press Tab to autocomplete with selected suggestion
  • Press Enter to select and load the file

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Fuzzy search in the file browser with relevance-ranked results, match counts and improved ordering; navigation and selection adapt to filtered results and parent entry is hidden while searching.
    • Keyboard-driven search mode with dedicated shortcuts, clear-search action and an empty-results message; search state shown in the UI.
  • Documentation

    • Quick Start and JSON tracker docs updated with interactive file browser and fuzzy-search guidance.
  • Tests

    • Comprehensive unit and integration tests for fuzzy search and file-browser search behaviour.

Add fuzzy autocomplete suggestions when entering PRD file paths in the
EpicLoaderOverlay. Discovers JSON files on mount (up to depth 5, excluding
node_modules/.git/dist/etc) and filters them as the user types using a
scoring-based fuzzy matcher. Arrow keys navigate suggestions, Tab completes,
Enter selects.

Also fixes cursor display bug where the underscore cursor was rendered as a
separate element, causing the first character to appear masked.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel bot commented Feb 2, 2026

@bigs is attempting to deploy a commit to the plgeek Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Feb 2, 2026

Walkthrough

Adds a new fuzzy-search utility for scoring and filtering file paths and integrates it into the FileBrowser component to provide keyboard-driven fuzzy search, filtered navigation, UI indicators, plus documentation and tests for the interactive file browser and fuzzy search behaviour.

Changes

Cohort / File(s) Summary
Fuzzy Search Utility
src/utils/fuzzy-search.ts
New module exporting FuzzyMatch, fuzzySearch(items, query, limit) and fuzzyFilter(items, query). Implements scoring combining exact matches, filename heuristics, containment, and sequential (fzf-style) matching; sorts and limits results.
FileBrowser Integration
src/tui/components/FileBrowser.tsx
Integrates fuzzy search: adds searchQuery state, computes filteredEntries via fuzzySearch, adapts navigation/selection and keyboard handling for search mode (hides parent .., Enter selects filtered item, Esc clears), shows search indicator and match count, clears search on path change.
Documentation
website/content/docs/getting-started/quick-start.mdx, website/content/docs/plugins/trackers/json.mdx
Adds File Browser and Fuzzy Search docs: keyboard navigation table, fuzzy search behaviour (match ranking, clearing), and tips for interactive selection of .json / PRD files. Note: similar content was inserted in two places in quick-start.
Tests
tests/utils/fuzzy-search.test.ts, tests/tui/file-browser.test.ts
Adds unit tests for fuzzySearch/fuzzyFilter (scoring, ranking, limits, edge cases) and updates FileBrowser tests to cover search-mode behaviour and indexing logic.

Sequence Diagram

sequenceDiagram
    actor User
    participant FB as FileBrowser Component
    participant FS as fuzzySearch Utility
    participant UI as UI Display

    User->>FB: Type search query
    activate FB
    FB->>FB: update searchQuery state
    FB->>FS: fuzzySearch(entries, query)
    activate FS
    FS->>FS: calculate scores (exact, filename, containment, sequential)
    FS-->>FB: FuzzyMatch[] (sorted)
    deactivate FS
    FB->>FB: compute filteredEntries
    FB->>UI: render filtered results + search indicator
    deactivate FB
    UI-->>User: show matches and count

    User->>FB: navigate / select
    activate FB
    FB->>FB: apply navigation on filteredEntries
    FB->>UI: update selection
    deactivate FB
    UI-->>User: display selected entry
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

🚥 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 summarizes the main change: introducing fuzzy file search functionality for PRD file path input, which is the primary objective across the new fuzzy-search utility, FileBrowser integration, and documentation updates.
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
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

@bigs
Copy link
Copy Markdown
Contributor Author

bigs commented Feb 2, 2026

Heya @subsy totally understand if you wanna close this in favor of something else. I was checking out ralph-tui and found that the prompt dialog for locating the prd.json file (when working in that modality) was a little rough. The "cursor" underscore was always fixed at the first position, so you couldn't see what the first letter you typed was. It didn't advance. So I updated it so that:

  • The cursor shifts as you type
  • It fuzzily searches for what you type within your current directory tree

I've tested it locally, it's looking good to me :)

Edit: I had Claude implement a simple fuzzy matching algo to avoid bringing in another dependency, but would happily factor that out as well.

@subsy
Copy link
Copy Markdown
Owner

subsy commented Feb 2, 2026

This is great @bigs - thanks - will take a look - hopefully can combine it with the file tree browser from another contributor in PR #236

@bigs
Copy link
Copy Markdown
Contributor Author

bigs commented Feb 2, 2026

Ah, interesting. Yeah, that should be doable. Probably easiest to let that land first, then rebase this onto that. I'd be happy to when that's ready.

@subsy
Copy link
Copy Markdown
Owner

subsy commented Feb 2, 2026 via email

@bigs
Copy link
Copy Markdown
Contributor Author

bigs commented Feb 2, 2026

Miscellaneous question—how are you liking CodeRabbit? My team has been using BugBot, but we're getting frustrated with the latency (even though the quality is fairly high). Feels like CodeRabbit is a fair bit quicker, but curious what you think of the quality.

@subsy
Copy link
Copy Markdown
Owner

subsy commented Feb 2, 2026

Miscellaneous question—how are you liking CodeRabbit? My team has been using BugBot, but we're getting frustrated with the latency (even though the quality is fairly high). Feels like CodeRabbit is a fair bit quicker, but curious what you think of the quality.

@bigs I really like CR - especially if you put in a bit of work to tune the config (though OOTB its pretty good). I still get frustrated with the latency - less so in private repos - but OSS repos are rate limited - but free

AI Agent added 2 commits February 3, 2026 17:35
Resolves conflicts by keeping FileBrowser component from main while
preserving fuzzy-search utility from this branch for future integration.
Add real-time fuzzy filtering to the file browser:
- Type any alphanumeric character to start filtering
- Results ranked by fuzzy match score (exact > starts with > contains > sequential)
- Search clears when changing directories or pressing Escape
- ".." entry hidden during search for cleaner results
- Footer shows contextual keybindings for search mode
@vercel
Copy link
Copy Markdown

vercel bot commented Feb 3, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
ralph-tui Ready Ready Preview, Comment Feb 3, 2026 6:08pm

Request Review

@codecov
Copy link
Copy Markdown

codecov bot commented Feb 3, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 43.49%. Comparing base (6173307) to head (f6ec254).
⚠️ Report is 7 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #253      +/-   ##
==========================================
+ Coverage   43.35%   43.49%   +0.13%     
==========================================
  Files          91       92       +1     
  Lines       28281    28351      +70     
==========================================
+ Hits        12260    12330      +70     
  Misses      16021    16021              
Files with missing lines Coverage Δ
src/utils/fuzzy-search.ts 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Document the keyboard-driven file browser UI:
- quick-start.mdx: Add "File Browser" section with keyboard shortcuts
- json.mdx: Add "Interactive File Browser" section explaining when it
  appears and how fuzzy search works

Covers navigation, fuzzy search, path entry, and hidden files toggle.
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: 1

🤖 Fix all issues with AI agents
In `@website/content/docs/getting-started/quick-start.mdx`:
- Around line 154-168: The key shortcut table in the "File Browser" section is
missing the Tab autocomplete entry; update the table in quick-start.mdx under
the "File Browser" heading to add a row for `Tab` with an appropriate action
like "Autocomplete selected suggestion" (so readers see Tab alongside
`Enter`/`→` and other keys) and ensure any accompanying prose about fuzzy search
also mentions Tab as the autocomplete shortcut.

AI Agent added 2 commits February 3, 2026 18:02
New test file for fuzzy-search.ts utility (100% coverage):
- Empty/basic query handling
- Exact match scoring (1000 points)
- Filename matching tiers (800/600/400 points)
- Path matching (200 points)
- Sequential fzf-style matching with consecutive bonuses
- Ranking and alphabetical tie-breaking
- Real-world file patterns

Extended file-browser.test.ts with integration tests:
- Fuzzy filtering of DirectoryEntry arrays
- Search mode index calculation (no ".." in search)
- Max index bounds for navigation
- Tab now selects the highlighted entry (same as Enter)
- Updated quick-start.mdx and json.mdx docs to include Tab shortcut
- Mentioned Tab in fuzzy search prose sections

Addresses PR feedback about missing Tab autocomplete documentation.
@subsy subsy merged commit b86661d into subsy:main Feb 3, 2026
9 checks passed
@bigs
Copy link
Copy Markdown
Contributor Author

bigs commented Feb 3, 2026

Oh awesome, ty! Excited to use this!

sakaman pushed a commit to sakaman/ralph-tui that referenced this pull request Feb 15, 2026
feat: add fuzzy file search for PRD file path input
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.

2 participants