feat(ui): suggest nearest slash commands on unknown input#302
Open
zerone0x wants to merge 1 commit intoesengine:mainfrom
Open
feat(ui): suggest nearest slash commands on unknown input#302zerone0x wants to merge 1 commit intoesengine:mainfrom
zerone0x wants to merge 1 commit intoesengine:mainfrom
Conversation
Owner
|
Thanks for picking this up — the implementation matches the spec cleanly. Wagner-Fischer DP, the half-length cap for very short inputs, the alphabetical tiebreak for deterministic output, and all five test cases (typo / missing / extra / transposition / no-match) are covered. Nice work for a first PR. One blocker on CI: typecheck fails because the repo runs next[j + 1] = Math.min(next[j]! + 1, prev[j + 1]! + 1, prev[j]! + cost);The trailing Push that and I'll merge. |
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.
What
Unknown slash-command errors now suggest up to three nearby registered commands instead of always falling back to
/help. Added a small Levenshtein helper and regression coverage for typo, omission, insertion, transposition, and no-match cases.Why
Closes #17. A typo like
/upadtewas a wasted turn even though the command set is already known at dispatch time. Suggesting the nearest commands turns that into a one-step correction.How to verify
npx biome check src/cli/ui/slash/dispatch.ts src/cli/ui/slash/nearest.ts tests/slash-nearest.test.tsnpm test -- --silent tests/slash-nearest.test.ts tests/slash.test.ts/upadteand confirm the error saysdid you mean /update?Checklist
npm run verifypasses locally (lint + typecheck + tests + comment-policy gate)Co-Authored-By: Claudetrailer in commitsCHANGELOG.md— release notes are maintainer-written at release time