From 62a07ebcdd1ffaa181e0ff7ff454477c54fb0bfc Mon Sep 17 00:00:00 2001 From: Proudlock <270015376@geaerospace.com> Date: Mon, 7 Sep 2026 02:42:53 -0400 Subject: [PATCH] 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 --- shopdb/plugins/__init__.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/shopdb/plugins/__init__.py b/shopdb/plugins/__init__.py index 0e35dd73..b96c664d 100644 --- a/shopdb/plugins/__init__.py +++ b/shopdb/plugins/__init__.py @@ -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")