feat/uninstall-config-cleanup #4

Merged
hzhang merged 2 commits from feat/uninstall-config-cleanup into main 2026-03-10 18:29:26 +00:00
Showing only changes of commit 220ec85e6f - Show all commits

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