Skip to content

feat(completions): switch to dynamic plugin discovery at tab-press time - #11

Merged
benbenbang merged 1 commit into
mainfrom
feat/cleaner_plugin_sys
Mar 14, 2026
Merged

benbenbang merged 1 commit into
mainfrom
feat/cleaner_plugin_sys

Conversation

@benbenbang

Copy link
Copy Markdown
Owner

This pull request refactors the shell completion system to discover plugins dynamically at tab-press time instead of requiring shell re-evaluation, and simplifies the installation instructions. The main changes improve user experience by eliminating manual reloading steps and reducing setup complexity.

Dynamic plugin discovery:

  • Added a new __complete command in adds-on/src/main.rs that outputs discovered plugins in completion format, called dynamically by the shell at tab-press time.
  • Refactored inject_zsh() to replace the static plugin list with a dynamic lookup that calls uv __complete during tab completion, automatically picking up newly installed plugins without re-evaluation.
  • Updated Zsh completion injection to merge dynamically discovered plugins into the commands array at runtime while keeping sub-command completions statically injected.
  • Modified tests to validate the new dynamic lookup mechanism instead of static plugin injection.

Documentation improvements:

  • Simplified setup instructions in README.md to use a single-line PATH export and one-time completion installation, eliminating the need for eval or manual reloading.
  • Updated completion installation to write directly to completion directories (fpath for zsh, config files for bash/fish) for automatic loading on every new session.
  • Clarified that new plugins are picked up automatically on every tab-press without additional configuration.
  • Made the UV_REAL_PATH optimization optional and moved it to a separate section.

This pull request refactors the shell completion system to discover plugins dynamically at tab-press time instead of requiring shell re-evaluation, and simplifies the installation instructions. The main changes improve user experience by eliminating manual reloading steps and reducing setup complexity.

**Dynamic plugin discovery:**
* Added a new `__complete` command in `adds-on/src/main.rs` that outputs discovered plugins in completion format, called dynamically by the shell at tab-press time.
* Refactored `inject_zsh()` to replace the static plugin list with a dynamic lookup that calls `uv __complete` during tab completion, automatically picking up newly installed plugins without re-evaluation.
* Updated Zsh completion injection to merge dynamically discovered plugins into the commands array at runtime while keeping sub-command completions statically injected.
* Modified tests to validate the new dynamic lookup mechanism instead of static plugin injection.

**Documentation improvements:**
* Simplified setup instructions in `README.md` to use a single-line PATH export and one-time completion installation, eliminating the need for `eval` or manual reloading.
* Updated completion installation to write directly to completion directories (fpath for zsh, config files for bash/fish) for automatic loading on every new session.
* Clarified that new plugins are picked up automatically on every tab-press without additional configuration.
* Made the `UV_REAL_PATH` optimization optional and moved it to a separate section.
@github-actions github-actions Bot added documentation Improvements or additions to documentation enhancement New feature or request triage labels Mar 14, 2026
@benbenbang
benbenbang merged commit 63599ca into main Mar 14, 2026
2 checks passed
@benbenbang
benbenbang deleted the feat/cleaner_plugin_sys branch March 14, 2026 19:28
@ptah-technical-app

Copy link
Copy Markdown

🎉 This PR is included in version 2.2.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation enhancement New feature or request released triage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant