Skip to content

Add smart command suggestions for improved CLI UX - #1956

Closed
Aadhithyavarman-Techan wants to merge 2 commits into
fastapi:masterfrom
Aadhithyavarman-Techan:master
Closed

Add smart command suggestions for improved CLI UX#1956
Aadhithyavarman-Techan wants to merge 2 commits into
fastapi:masterfrom
Aadhithyavarman-Techan:master

Conversation

@Aadhithyavarman-Techan

Copy link
Copy Markdown

Summary

Added intelligent command suggestion system to Typer that detects typos and suggests corrections.

Problem

Users get confusing errors when they mistype commands:
"No such command: 'gret'"

Solution

Using difflib and SequenceMatcher, we detect similar commands:
"No such command: 'gret'. Did you mean 'greet'?"

Implementation

  • CommandSuggester class with comprehensive typo detection
  • Detects missing/extra characters, missing vowels/consonants
  • Substring matching and case-insensitive matching
  • Confidence-based suggestion ranking
  • SmartTyperApp integration
  • 28 comprehensive test cases
  • Real-world tested on Git, Docker, NPM command patterns
  • Zero external dependencies

Testing

  • 28 unit tests covering all scenarios
  • All tests pass
  • Existing tests unaffected

Add unit tests for CommandSuggester and SmartTyperApp functionality, including command registration and typo suggestions.

@svlandeg svlandeg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Violates contribution guidelines, closing.

@svlandeg svlandeg closed this Sep 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants