Repository navigation
fix(chat): prioritize slash command name matches and strip skill prefix - #1414
Open
salmanabdurrahman wants to merge 1 commit into
Open
salmanabdurrahman wants to merge 1 commit into
salmanabdurrahman wants to merge 1 commit into
Conversation
- strip skill prefix in getCleanSlashName for prefix and token ranking - rank exact, prefix, token, and substring name matches ahead of descriptions - suppress noisy description-only matches when any command matches by name - retain description matching as fallback when no names match query - guard getSlashDescription against undefined builtin command descriptions - add unit tests for slash command ranking across all command sources
This branch has not been deployed
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.
Fixes #1413
What
Addresses #1413 by refining the slash command palette's search filtering and ranking in
components/ChatInput.tsx(anddemo/components/ChatInput.tsx):/copyreturns solely the built-in/copycommand instead of pulling in unrelated skills that mention "copy" in their prose).skill:prefix for ranking and matching, allowing clean prefix and token-boundary matching on the skill's actual identifier./assistant), the palette smoothly falls back to searching description text across all sources.How
getCleanSlashName(command): strips the"skill:"prefix for skills, allowing clean prefix (startsWith) and token-boundary matching on the actual skill name.slashMatchRank(command, query, t): assigns a deterministic ranking score:0)1)2,-queryor_query)3)4)filterSlashCommands(commands, query, t): checks if any command has a name match (hasNameMatch). If true, discards description-only hits. If false, falls back to description searching.getSlashDescription: guards missing/undefined descriptions on built-in and custom commands before calling.toLowerCase().demo/components/ChatInput.tsx.components/ChatInput.slash-filter.test.mjs(9 tests) covering clean name extraction, ranking hierarchy, description suppression on/copy, description fallback across all command types (builtin, extension, prompt, skill), dormancy partitioning, uppercase handling, and safe handling of regex characters.Checks
node --test components/ChatInput.slash-filter.test.mjs(9/9 pass)node --test components/ChatInput.dormancy.test.mjs(1/1 pass)node --experimental-strip-types --test "components/**/*.test.mjs"(all pass)node_modules/.bin/tsc --noEmit(clean, 0 error)npm run lint(clean, 0 error)npm test(passes)Before
After