Uh oh!
There was an error while loading. Please reload this page.
feat(cli): add autocomplete module - #644
Conversation
jaredbroad
commented
Mar 30, 2026
Interesting thank you @shreejaykurhade , we'll review and get back to you next week when MM's back. |
shreejaykurhade
commented
Mar 30, 2026
Sure |
Martin-Molinero
left a comment
There was a problem hiding this comment.
Hey @shreejaykurhade!
Thanks for the contribution 🙌
Overall I think it's promising, I'm not convinced installing files on the users machine is a good pattern for the autocomplete though, seems click has a dynamic way of doing this? Think we should double check what does click suggest as autocomplete approach and what are other popular libraries doing. Should a nice test suite too, there are no tests 😱 .
Also I think ideally it's enabled by default? Again would double check what click and popular libraries suggest, finally I would double check performance implications though, what's the overhead cost we might determine not worth enabling by default
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
@Martin-Molinero create and delete the cmd profile using "lean completion on" and "lean completion off"
The completion flow now follows Click’s native _LEAN_COMPLETE mechanism instead of installing scripts directly into profile files. Users can opt in by running lean completion --shell and evaluating the generated script in their shell. Changes
Examples
Tests Added test coverage for:
Verified with: |
shreejaykurhade
left a comment
There was a problem hiding this comment.
please check
shreejaykurhade
commented
Apr 26, 2026
@Martin-Molinero please review |
Thanks @Martin-Molinero, addressed these points. I checked Click’s recommended autocomplete flow. Click uses the On installing files: agreed, silently modifying user profile files is not a good default. Autocomplete now works through:
so users can evaluate/source the generated script themselves. For the common case, users can simply run:
and later:
The shell is auto-detected, so Legacy On other CLIs: the common pattern is similar: CLIs expose an autocomplete/completion command that prints the script, and users either source it or save it into their shell profile/completion location. This is also what Click documents. On enabled by default: command prefix matching is enabled by default inside Lean, so shorthand like On performance: PowerShell autocomplete registration is lazy. Normal Lean commands do not import/register the PowerShell autocomplete helper unless autocomplete is being generated or I also removed the PowerShell Tests added/updated cover:
Verified with: |
@Martin-Molinero@jaredbroad please review. |
GitHub Pull Request: Advanced Autocomplete & Shorthand Command Execution
Summary
This Pull Request introduces significant usability improvements to the Lean CLI. It implements Prefix-based Command Matching (allowing shorthand like
lean clinstead oflean cloud) and a Native Autocomplete Management Module that supports interactive, visual predictions in PowerShell and traditional completion in Bash/Zsh/Fish.