feat: suggest commands for mistyped CLI input#322
Conversation
There was a problem hiding this comment.
No issues found across 3 files
Auto-approved: This PR adds a CLI command suggestion feature with comprehensive tests; its impact is limited to user-facing error messages and does not affect core business logic or data integrity, making it safe to auto-approve.
Re-trigger cubic
|
I don't think we need this cast |
|
we also don't need this type |
|
imo this function should also be inlined, otherwise it's harder to read |
| .map((match) => match.command); | ||
| } | ||
|
|
||
| function editDistance(a: string, b: string): number { |
There was a problem hiding this comment.
can we use some library for this? otherwise we should have some very strong unit testing for this algorithm
There was a problem hiding this comment.
1 issue found across 2 files (changes from recent commits).
Reply with feedback, questions, or to request a fix.
Fix all with cubic | Re-trigger cubic
There was a problem hiding this comment.
0 issues found across 2 files (changes from recent commits).
Requires human review: This PR adds 306 lines of new library code implementing a 'did you mean' command suggestion system with Levenshtein distance matching, which, despite passing tests and having no detected issues, is a non-trivial feature in a CLI tool that could affect user interaction and debugging paths,...
Re-trigger cubic
Summary
Closes discussion #294
pnpm dev template→ suggestsresend templatespnpm dev contact→ suggestsresend contactspnpm dev telemetri→ no suggestion (hidden command)Summary by cubic
Adds Git-style “Did you mean?” suggestions for mistyped CLI commands and subcommands. Installed via
installCommandSuggestions(program)to guide users without revealing hidden commands.New Features
configureOutputand suggests candidates using a Damerau–Levenshtein score.Bug Fixes
--profile "") as present so they’re consumed before matching commands.Written for commit 10b4197. Summary will update on new commits.