fix: tokenize plugin search queries instead of matching one literal substring - #285
Open
Agnik47 wants to merge 1 commit into
Open
fix: tokenize plugin search queries instead of matching one literal substring#285Agnik47 wants to merge 1 commit into
Agnik47 wants to merge 1 commit into
Conversation
…ubstring searchCatalogPlugins tested the whole query as a single substring of "name description", so multi-word queries like "hacker news" missed a one-word plugin name like hackernews even though "hacker" alone found it. Strip non-alphanumeric separators from both sides and require each query token to match independently, so word order and separators (space, hyphen, concatenation) no longer matter. Fixes agentrhq#282
Contributor
🟢 No documentation gap found — medium confidenceThe automated review found no documentation gap in the supplied changes. This review is advisory and does not block merging. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
searchCatalogPluginstested the whole query as one literal substring of"name description", so multi-word queries missed a one-word plugin name:This matters because
skills/webcmd-usage/SKILL.mdsends agents down registry filter → empty →plugin search <query>→ empty → raw browser fallback, and agents naturally derive multi-word queries from the user's own words ("pull the top 5 stories from Hacker News" →hacker news). A real adapter (hackernews) exists and is invisible to the exact query an agent is most likely to try.Fix
Strip non-alphanumeric separators from both the query and the
"name description"haystack, split the query into independent tokens, and require every token to match (AND semantics) rather than testing the query as one contiguous string. This makeshacker news,hacker-news, andhackernewsall match, and makes token order irrelevant (news hackermatches too), while a query likereddit newsstill correctly finds nothing.I checked
webcmd list -f json(mentioned in the issue as worth checking) — it filters by--tag, not a free-text query, and doesn't callsearchCatalogPluginsat all, so it doesn't share this matcher and needs no change.Fixes #282
Type of Change
Checklist
Screenshots / Output
npm run typecheckandnpm run buildpass, generated artifacts stay byte-identical.Reproduced the exact issue repro against the real bundled catalog, after the fix:
Added a test to
src/plugin-catalog.test.tscoveringhacker news,hacker-news,hackernews,hacker, and reorderednews hackerall matching, plusreddit newscorrectly matching nothing: