Skip to content

fix(cli): improve fuzzy search in selectors and completions - #1498

Merged
BYK merged 2 commits into
mainfrom
bt/cli-fuzzy-search
Oct 14, 2026
Merged

BYK merged 2 commits into
mainfrom
bt/cli-fuzzy-search

Conversation

@betegon

@betegon betegon commented Oct 14, 2026 •

Copy link
Copy Markdown
Member

Follow-up to #1495: use mode: "search" for selectors and autocomplete.

The same matcher serves two cases:

  • resolving names in submitted commands
  • suggesting candidates while typing.

"search" mode separates their matching rules.

Short queries match literal text only; longer queries tolerate typos in unfinished prefixes.

fuzzyMatch("zz", ["UI"], { mode: "search" }); // []
fuzzyMatch("frone", ["frontend-web"], { mode: "search" }); // ["frontend-web"]
fuzzyMatch("frone", ["frontend-web"]); // [] — submitted-command behavior stays unchanged

Selectors let users choose a candidate. Command recovery automatically uses a sole match, with a warning. Applying search rules globally would therefore change which project a command uses, or make an existing recovery ambiguous:

const projects = ["sentry", "sentry-relay"];
fuzzyMatch("senry", projects); // ["sentry"]
fuzzyMatch("senry", projects, { mode: "search" }); // ["sentry", "sentry-relay"]

The mode keeps these policies separate while reusing the same matcher. Regression tests cover both search behavior and unchanged command resolution.

@betegon
betegon marked this pull request as ready for review October 14, 2026 10:30
@github-actions github-actions Bot added the risk: medium PR risk score: medium label Oct 14, 2026
@betegon
betegon requested a review from BYK October 14, 2026 10:37
@BYK
BYK merged commit 098a9b2 into main Oct 14, 2026
28 checks passed
@BYK
BYK deleted the bt/cli-fuzzy-search branch October 14, 2026 21:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: medium PR risk score: medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants