Files
ccs/scripts/postuninstall.js
T
kaitranntt ba1fb7eeb3 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
2026-01-25 20:26:27 -05:00

41 lines
1.1 KiB
JavaScript

#!/usr/bin/env node
/**
* CCS Postuninstall Script
*
* Cleans up CCS-specific files after npm uninstall.
* Does NOT touch global ~/.claude/settings.json (hooks are per-profile now).
*
* Self-contained, no external dependencies.
*/
const fs = require('fs');
const path = require('path');
const os = require('os');
const CCS_DIR = path.join(os.homedir(), '.ccs');
const HOOKS_DIR = path.join(CCS_DIR, 'hooks');
const MIGRATION_MARKER = path.join(CCS_DIR, '.hook-migrated');
function cleanupCcsFiles() {
try {
// Remove WebSearch hook file
const hookPath = path.join(HOOKS_DIR, 'websearch-transformer.cjs');
if (fs.existsSync(hookPath)) {
fs.unlinkSync(hookPath);
}
// Remove migration marker (so fresh install re-runs migration)
if (fs.existsSync(MIGRATION_MARKER)) {
fs.unlinkSync(MIGRATION_MARKER);
}
// Note: Do NOT touch ~/.claude/settings.json
// Per-profile hooks in ~/.ccs/*.settings.json will be cleaned up
// when the user removes ~/.ccs/ directory.
} catch {
// Silent fail - not critical
}
}
cleanupCcsFiles();