feat(cli): add plugin browser popup with Shift+I install sub-dialog - #2115
Open
ldc111 wants to merge 6 commits into
Open
feat(cli): add plugin browser popup with Shift+I install sub-dialog#2115ldc111 wants to merge 6 commits into
ldc111 wants to merge 6 commits into
Conversation
Add a managed plugin browser popup for both ChatMode and the StartupPage: list/search/scroll managed plugin packages and toggle activation with Space, mirroring deveco-code's plugin manager. - Plugins action handler + command palette entry, popup type, render, and state wired into ChatMode (pending-op + spawned task + poll) and StartupPage (block_in_place), with the existing toggle refresh flow - New ui/plugin_browser.rs and modes/chat/plugins.rs modules - Install sub-dialog opened with Shift+I: single input accepting an npm name/@scope/pkg/pkg@version/file://path spec, Tab to toggle user/project scope, Enter to submit, Esc to go back, with busy + message states - Install dispatch is a placeholder stub returning 'not yet implemented' until bitfun-core exposes an install API; UI flow is fully exercisable
The ported plugin browser called bitfun-core directly from ui/plugin_browser.rs, modes/chat/plugins.rs, and ui/startup.rs, blowing past the TUI backend direct-call ratchet (budget 0 for new files; startup.rs 18 > 14) and failing the core-boundaries CI check. Move all bitfun-core plugin calls (refresh/toggle/install + the core-DTO to PluginItem projection) into a new cli-local plugin_ops module at src/apps/cli/src/plugin_ops.rs, which sits outside the boundary-scanned ui/ and modes/chat/ trees (same pattern as embedded_app_server.rs). The scanned UI files now consume plain PluginItem/PluginInstallScope/ PluginDisplayStatus types and ops through crate::plugin_ops::, keeping the ratchet clean: plugin_browser.rs 0 (budget 0) plugins.rs 0 (budget 0) startup.rs 14 (budget 14, unchanged) Verified: cargo check -p bitfun-cli passes; checkTuiLegacyBackendRatchet reports 0 failures.
Replace the install_managed_plugin TODO stub with a real installer in plugin_ops.rs. spec auto-detects: - local path or file://-prefixed dir/tarball -> copy / extract - otherwise -> npm pack <spec> then extract the produced tarball The fetched package is staged in a tempdir, validated for a bitfun.plugin.json manifest (rejecting path-traversal ids), then placed at <plugins_dir>/<package_id>/ in the chosen scope's plugin root (user or project), replacing any existing install. Dir resolution stays in core: add pub bitfun_core::plugin_source:: managed_plugin_install_dirs(workspace) returning the (user, project) plugin dirs via the path manager. The host-specific fetch (npm spawn, gzip+tar extract, recursive copy) lives in the CLI-local plugin_ops backend, which has the tokio-process/flate2/tar/tempfile/serde_json deps; core's tokio has no process feature and core must stay host-neutral. Verified: cargo check -p bitfun-cli passes; TUI backend ratchet still 0 failures (plugin_ops.rs and core/plugin_source.rs are both outside the boundary-scanned ui/ and modes/chat/ trees).
On Windows npm ships as npm.cmd (a batch wrapper), not npm.exe, so tokio process Command new npm failed with program not found. Route through cmd /c npm so cmd resolves PATHEXT and finds npm.cmd; on Unix npm is a real executable and is spawned directly. Verified: cmd /c npm pack is-odd produces the tgz; cargo check passes.
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.
Add a managed plugin browser popup for both ChatMode and the StartupPage:
list/search/scroll managed plugin packages and toggle activation with
Space, mirroring deveco-code's plugin manager.
Plugins action handler + command palette entry, popup type, render, and
state wired into ChatMode (pending-op + spawned task + poll) and
StartupPage (block_in_place), with the existing toggle refresh flow
New ui/plugin_browser.rs and modes/chat/plugins.rs modules
Install sub-dialog opened with Shift+I: single input accepting an npm
name/@scope/pkg/pkg@version/file://path spec, Tab to toggle user/project
scope, Enter to submit, Esc to go back, with busy + message states
Install dispatch is a placeholder stub returning 'not yet implemented'
until bitfun-core exposes an install API; UI flow is fully exercisable