Clean OpenClaw config on uninstall
This commit is contained in:
26
install.mjs
26
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');
|
||||
|
||||
Reference in New Issue
Block a user