feat: fuzzy substring search with ranked scoring for slash commands#384
feat: fuzzy substring search with ranked scoring for slash commands#384felipeggv wants to merge 3 commits intoRunMaestro:mainfrom
Conversation
…iption Replace prefix-only filtering (startsWith) with substring matching (includes) on both command name and description fields. Users can now find commands by typing any part of the name or description text (e.g., "synopsis" finds /history). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The previous includes() change still compared "/prd" against "/GLOBAL:...", which never matched. Now both input and command name have the leading / stripped before comparison, so typing "prd" correctly finds "/GLOBAL:agents:prd-creator". Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Results are now sorted by match quality: - Score 3: command name starts with search term (prefix match) - Score 2: command name contains search term (substring match) - Score 1: description contains search term This prevents low-relevance description matches from burying exact name matches. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
@CodeRabbit review |
✅ Actions performedReview triggered.
|
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ✨ Finishing touches🧪 Generate unit tests (beta)
Comment |
Summary
Replaces the prefix-only slash command filter with ranked substring matching. Users can now find commands by typing any part of the command name or description — similar to VS Code's Command Palette.
Problem
The slash command dropdown only matched commands that started with the typed text. With growing numbers of custom commands (Spec-Kit, OpenSpec, user-defined), users had to remember exact command prefixes to find anything.
Example: typing
/prdreturned nothing, even though/GLOBAL:agents:prd-creatorexists.Solution
Three-tier ranked scoring system applied to both
InputArea.tsx(dropdown render) andApp.tsx(keyboard handler):hist)/history→ appears first/command-history-viewer→ appears second/clear(if description mentions "history") → appears lastResults are sorted descending by score. The leading
/is stripped from both input and command name before comparison to avoid false negatives.Before / After
/prd/GLOBAL:agents:prd-creator(score 2)/synopsis/history(description contains "synopsis", score 1)/ard/wizard(name contains "ard", score 2)/hist/historyonly/history(score 3, prefix) + description matches (score 1)/clear/clearonly/clear(score 3, prefix) — same behavior, backwards compatibleHow This Helps Users
Files Changed
src/renderer/components/InputArea.tsxstartsWith→ scoredincludeson name + descriptionsrc/renderer/App.tsxImplementation Details
searchTermstrips the leading/from user inputcmd.descriptionis guarded with&&(some custom commands may not have descriptions)useMemodependency updated frominputValueLowertosearchTermin InputAreaTest Plan
/— all commands appear (empty search term = score 0, all included)/prd—prd-creatorcommand appears/synopsis—/historyappears (description match)/hist—/historyappears first (prefix match before description matches)/s— prefix matches (e.g.,/status) appear above description-only matchesnpm run lint— zero new errorsnpm test -- --run— all tests pass (5 pre-existing failures insymphony.test.ts)npm run build— clean production build🤖 Generated with Claude Code