Clean OpenClaw config on uninstall

This commit is contained in:
2026-03-10 18:27:54 +00:00
parent 00108c357b
commit 220ec85e6f

View File

@@ -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');