refactor(uninstall): stop modifying global settings.json

- remove removeHookConfig() call from uninstallWebSearchHook()

- add removeMigrationMarker() cleanup

- update postuninstall.js to only clean CCS files

- global ~/.claude/settings.json is never touched
This commit is contained in:
kaitranntt
2026-01-25 20:26:27 -05:00
parent 0099ab5a1c
commit ba1fb7eeb3
2 changed files with 28 additions and 41 deletions
+10 -3
View File
@@ -11,7 +11,8 @@ import * as path from 'path';
import * as os from 'os';
import { info, warn } from '../ui';
import { getWebSearchConfig } from '../../config/unified-config-loader';
import { getHookPath, ensureHookConfig, removeHookConfig } from './hook-config';
import { getHookPath, ensureHookConfig } from './hook-config';
import { removeMigrationMarker } from './profile-hook-injector';
// Re-export from hook-config for backward compatibility
export { getHookPath, getWebSearchHookConfig } from './hook-config';
@@ -102,6 +103,9 @@ export function installWebSearchHook(): boolean {
/**
* Uninstall WebSearch hook from ~/.ccs/hooks/
*
* Note: Does NOT touch global ~/.claude/settings.json.
* Profile-specific hooks are removed when ~/.ccs/ is deleted.
*
* @returns true if hook uninstalled successfully
*/
export function uninstallWebSearchHook(): boolean {
@@ -115,8 +119,11 @@ export function uninstallWebSearchHook(): boolean {
}
}
// Remove from settings.json
removeHookConfig();
// Remove migration marker (so fresh install re-runs migration)
removeMigrationMarker();
// Note: Do NOT call removeHookConfig() - global settings should not be touched.
// Per-profile hooks in ~/.ccs/*.settings.json are cleaned up when ~/.ccs/ is deleted.
return true;
} catch (error) {