From 5c769c92a0c44f8c17efc476524333473b676d9c Mon Sep 17 00:00:00 2001 From: mirivlad Date: Sun, 7 Jun 2026 15:38:04 +0800 Subject: [PATCH] fix: simplify plugin lifecycle - no install/uninstall = just toggle - Plugins without on_install hook: always 'installed', toggle works directly - Plugins with on_install: must Install first, then toggle, then Uninstall available - No data cleanup on Disable (only on Uninstall via on_uninstall hook) - Old plugins without lifecycle hooks simply don't get install/uninstall UI --- internal/core/plugins/manager.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/internal/core/plugins/manager.go b/internal/core/plugins/manager.go index f9358e7..28ff4e6 100644 --- a/internal/core/plugins/manager.go +++ b/internal/core/plugins/manager.go @@ -354,13 +354,12 @@ type NodeMeta struct { // Enable activates a plugin by name. // If the plugin has on_install hook, it must be installed first. -// Plugins without on_install hook are always considered "installed". func (m *Manager) Enable(name string) error { for i := range m.plugins { if m.plugins[i].Meta.Name == name { p := &m.plugins[i] if p.HasInstall && !p.Installed { - return fmt.Errorf("plugin %q must be installed first (use Install)", name) + return fmt.Errorf("plugin %q must be installed first", name) } p.Active = true return nil