From 220ec85e6f424298fb3e3dc275a27a51eac416ea Mon Sep 17 00:00:00 2001 From: orion Date: Tue, 10 Mar 2026 18:27:54 +0000 Subject: [PATCH] Clean OpenClaw config on uninstall --- install.mjs | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/install.mjs b/install.mjs index 3eefded..c3970e5 100644 --- a/install.mjs +++ b/install.mjs @@ -158,6 +158,32 @@ function uninstall() { logWarn(`${destDir} not found, nothing to remove`); } + // Clean OpenClaw config + log('Cleaning OpenClaw config...', 'cyan'); + try { + const allow = ensureArray(getConfigValue('plugins.allow')).filter((id) => id !== PLUGIN_NAME); + const loadPaths = ensureArray(getConfigValue('plugins.load.paths')).filter((p) => p !== destDir); + + if (allow.length > 0) { + execSync(`openclaw config set plugins.allow '${JSON.stringify(allow)}'`); + } else { + execSync('openclaw config unset plugins.allow'); + } + + if (loadPaths.length > 0) { + execSync(`openclaw config set plugins.load.paths '${JSON.stringify(loadPaths)}'`); + } else { + execSync('openclaw config unset plugins.load.paths'); + } + + execSync(`openclaw config unset plugins.entries.${PLUGIN_NAME}`); + + logOk('OpenClaw config cleaned'); + } catch (err) { + logErr('Failed to clean OpenClaw config via `openclaw config`'); + throw err; + } + console.log(''); log('✓ Yonexus uninstalled.', 'green'); log('\nNext: openclaw gateway restart', 'yellow');