From cd0ce6a910a77cdb4c8ec62f6445f3d43986fdc0 Mon Sep 17 00:00:00 2001 From: zhi Date: Tue, 3 Mar 2026 18:23:01 +0000 Subject: [PATCH] fix(install): use unsetPath for plugin entry removal - Use openclaw config unset instead of get-modify-set - Avoids triggering full plugins config validation - Handles both added and replaced entries uniformly --- scripts/install-dirigent-openclaw.mjs | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/scripts/install-dirigent-openclaw.mjs b/scripts/install-dirigent-openclaw.mjs index 149f6fa..64ea4ba 100755 --- a/scripts/install-dirigent-openclaw.mjs +++ b/scripts/install-dirigent-openclaw.mjs @@ -280,11 +280,8 @@ else { try { // ── Handle ADDED entries: remove them ───────────────────────────────── - if (delta.added[PATH_PLUGIN_ENTRY] !== undefined) { - const plugins = getJson("plugins") || {}; - plugins.entries = plugins.entries || {}; - delete plugins.entries.dirigent; - setJson("plugins", plugins); + if (delta.added[PATH_PLUGIN_ENTRY] !== undefined || delta.replaced[PATH_PLUGIN_ENTRY] !== undefined) { + unsetPath(PATH_PLUGIN_ENTRY); console.log("[dirigent] removed plugins.entries.dirigent"); } @@ -318,16 +315,7 @@ else { } } - // ── Handle REPLACED entries: for uninstall, we still delete (not restore) - // because the user wants to remove the plugin, not restore the old broken config - if (delta.replaced[PATH_PLUGIN_ENTRY] !== undefined) { - const plugins = getJson("plugins") || {}; - plugins.entries = plugins.entries || {}; - delete plugins.entries.dirigent; - setJson("plugins", plugins); - console.log("[dirigent] removed plugins.entries.dirigent (had replaced previous config)"); - } - + // ── Handle REPLACED provider: restore old value ─────────────────────── if (delta.replaced[PATH_PROVIDER_ENTRY] !== undefined) { const providers = getJson(PATH_PROVIDERS) || {}; providers[NO_REPLY_PROVIDER_ID] = delta.replaced[PATH_PROVIDER_ENTRY];