"use strict";
/**
 * Install/Uninstall Command Handlers
 *
 * Handle --install and --uninstall commands for CCS.
 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.handleUninstallCommand = exports.handleInstallCommand = void 0;
const ui_1 = require("../utils/ui");
const websearch_1 = require("../utils/websearch");
const image_analysis_1 = require("../utils/image-analysis");
const hooks_1 = require("../utils/hooks");
const claude_symlink_manager_1 = require("../utils/claude-symlink-manager");
/**
 * Handle install command
 */
async function handleInstallCommand() {
    await (0, ui_1.initUI)();
    console.log('');
    console.log((0, ui_1.info)('Feature not available'));
    console.log('');
    console.log('The --install flag is currently under development.');
    console.log('.claude/ integration testing is not complete.');
    console.log('');
    console.log(`For updates: ${(0, ui_1.color)('https://github.com/kaitranntt/ccs/issues', 'path')}`);
    console.log('');
    process.exit(0);
}
exports.handleInstallCommand = handleInstallCommand;
/**
 * Handle uninstall command
 */
async function handleUninstallCommand() {
    await (0, ui_1.initUI)();
    console.log('');
    console.log((0, ui_1.box)('Uninstalling CCS', { borderColor: 'cyan' }));
    console.log('');
    let removed = 0;
    // 1. Remove WebSearch hook file + migration marker (does NOT touch global settings.json)
    const hookRemoved = (0, websearch_1.uninstallWebSearchHook)();
    if (hookRemoved) {
        console.log((0, ui_1.ok)('Removed WebSearch hook'));
        removed += 1; // Count as 1 item (the hook file)
    }
    // 2. Remove managed WebSearch MCP runtime/config
    const mcpRemoved = (0, websearch_1.uninstallWebSearchMcp)();
    if (mcpRemoved) {
        console.log((0, ui_1.ok)('Removed WebSearch MCP runtime'));
        removed += 1;
    }
    // 3. Remove Image Analysis hook fallback + managed MCP runtime
    const imageHookRemoved = (0, hooks_1.uninstallImageAnalyzerHook)();
    if (imageHookRemoved) {
        console.log((0, ui_1.ok)('Removed Image Analysis hook fallback'));
        removed += 1;
    }
    const imageMcpRemoved = (0, image_analysis_1.uninstallImageAnalysisMcp)();
    if (imageMcpRemoved) {
        console.log((0, ui_1.ok)('Removed Image Analysis MCP runtime'));
        removed += 1;
    }
    // 4. Remove symlinks from ~/.claude/
    const symlinkManager = new claude_symlink_manager_1.ClaudeSymlinkManager();
    const symlinksRemoved = symlinkManager.uninstall();
    removed += symlinksRemoved; // Add actual count of symlinks removed
    // 5. Summary
    console.log('');
    if (removed > 0) {
        console.log((0, ui_1.ok)('Uninstall complete!'));
        console.log('');
        console.log((0, ui_1.info)('~/.ccs/ directory preserved'));
        console.log((0, ui_1.info)('To reinstall: npm install -g @kaitranntt/ccs --force'));
    }
    else {
        console.log((0, ui_1.info)('Nothing to uninstall'));
    }
    console.log('');
    process.exit(0);
}
exports.handleUninstallCommand = handleUninstallCommand;
//# sourceMappingURL=install-command.js.map