feat(cli): implement --uninstall handler

- add handleUninstallCommand() with proper cleanup flow

- remove WebSearch hook (file + settings.json)

- remove symlinks from ~/.claude/

- display summary with removal count

- preserve ~/.ccs/ directory
This commit is contained in:
kaitranntt
2026-01-25 20:05:31 -05:00
parent fc4d987d20
commit c44a5c221f
+29 -5
View File
@@ -4,7 +4,9 @@
* Handle --install and --uninstall commands for CCS.
*/
import { info, color, initUI } from '../utils/ui';
import { info, ok, color, box, initUI } from '../utils/ui';
import { uninstallWebSearchHook } from '../utils/websearch';
import { ClaudeSymlinkManager } from '../utils/claude-symlink-manager';
/**
* Handle install command
@@ -28,12 +30,34 @@ export async function handleInstallCommand(): Promise<void> {
export async function handleUninstallCommand(): Promise<void> {
await initUI();
console.log('');
console.log(info('Feature not available'));
console.log(box('Uninstalling CCS', { borderColor: 'cyan' }));
console.log('');
console.log('The --uninstall flag is currently under development.');
console.log('.claude/ integration testing is not complete.');
let removed = 0;
// 1. Remove WebSearch hook (file + settings.json)
const hookRemoved = uninstallWebSearchHook();
if (hookRemoved) {
console.log(ok('Removed WebSearch hook'));
removed++;
}
// 2. Remove symlinks from ~/.claude/
const symlinkManager = new ClaudeSymlinkManager();
symlinkManager.uninstall();
removed++;
// 3. Summary
console.log('');
console.log(`For updates: ${color('https://github.com/kaitranntt/ccs/issues', 'path')}`);
if (removed > 0) {
console.log(ok('Uninstall complete!'));
console.log('');
console.log(info('~/.ccs/ directory preserved'));
console.log(info('To reinstall: ccs --install'));
} else {
console.log(info('Nothing to uninstall'));
}
console.log('');
process.exit(0);
}