feat(cli): fuzzy command completer with alias + substring match#195
Merged
emal-avala merged 1 commit intomainfrom Apr 23, 2026
Merged
feat(cli): fuzzy command completer with alias + substring match#195emal-avala merged 1 commit intomainfrom
emal-avala merged 1 commit intomainfrom
Conversation
The completer was prefix-only and name-only — typing `/rvw` or a command's alias returned nothing. Replaced with a scored match: tier 1 (score 1000) name has the partial as a prefix tier 2 (score 500) name contains the partial as a substring tier 3 (score 150) an alias has the partial as a prefix tier 4 (score 100) an alias contains the partial tier 5 (score ~100) name fuzzy-matches (each char in order) Case-insensitive throughout. Stable-sorted by score desc, then alphabetically by command name for deterministic ordering at ties. Display now includes aliases when present: /output-style — Set response style: ... (alias: /style) Completion examples that now work: /github → /install-github-app (substring) /style → /output-style (alias prefix) /rvw → /review (fuzzy subsequence) /gh- → /install-github-app (alias prefix) Hint-on-type behaviour (grey inline autocomplete) is unchanged — still prefix-only, because hints must be literal continuations of what the user typed. Tests: 8 unit tests in `completer_tests` covering every tier, case insensitivity, non-matches, and prefix-beats-substring ordering.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
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.
Summary
The slash-command tab-completer was prefix-only and name-only — typing
/rvw,/github, or a command's alias returned nothing. Replaced with a scored match that surfaces the right command even when the user half-remembers the name.Scoring
Case-insensitive throughout. Stable-sorted by score desc, then alphabetically by command name for deterministic ordering at ties.
Display
Completions now include aliases when present:
New behaviours
What's unchanged
The inline-hint (grey autocomplete) behaviour is still prefix-only. Hints have to be literal continuations of what the user typed — you can't suffix a substring match mid-word without rearranging characters already on screen.
Test plan
cargo fmt --all— cleancargo clippy --workspace --all-targets -- -D warnings— cleancargo test -p agent-code --bin agent completer_tests— 8/8 passempty_partial_matches_everything_at_top_scoreprefix_beats_substringsubstring_match_worksalias_match_is_recognisedfuzzy_subsequence_basiccase_insensitive_matchingno_match_returns_noneprefix_scores_higher_than_alias_prefix/gh<TAB>now lists/install-github-app;/STYLE<TAB>(uppercase) finds/output-style;/rvw<TAB>finds/review