UX: auto-install plugins when enabling from UI

enable_plugin() now auto-installs available plugins before enabling them.
This fixes the UX issue where clicking Enable on an AVAILABLE plugin would
fail with 'Plugin is not installed'. Now it installs automatically (runs
migrations, seeds permissions) then enables it.

Before: User had to manually install via CLI first
After: Enable button works on AVAILABLE plugins (one-click install+enable)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
Proudlock
2026-09-07 02:42:53 -04:00
parent 5767765ada
commit 62a07ebcdd

View File

@@ -468,10 +468,13 @@ class PluginManager:
return True
def enable_plugin(self, name: str) -> bool:
"""Enable a disabled plugin."""
"""Enable a disabled plugin. Auto-installs if available but not installed."""
# Auto-install if available but not installed (UX: enabling should just work)
if not self.registry.is_installed(name):
logger.error(f"Plugin {name} is not installed")
return False
logger.info(f"Plugin {name} not installed, installing first")
if not self.install_plugin(name):
logger.error(f"Failed to install plugin {name}")
return False
if self.registry.is_enabled(name):
logger.info(f"Plugin {name} is already enabled")