/**
 * Plugin Uninstallation System
 *
 * Comprehensive uninstaller supporting frameworks, add-ons, and extensions
 * with dependency validation, artifact cleanup, and safe removal.
 *
 * Features:
 * - Dependency validation (prevent orphaned add-ons)
 * - Active project detection
 * - Artifact cleanup (directories, registry)
 * - Dry-run mode
 * - Force mode (skip dependency checks)
 * - Project preservation (--keep-projects)
 * - Rollback on failure
 *
 * @module src/plugin/plugin-uninstaller
 */
/**
 * Plugin types
 */
export type PluginType = 'framework' | 'add-on' | 'extension';
/**
 * Uninstall options
 */
export interface UninstallOptions {
    /** Force uninstall (skip dependency checks) */
    force?: boolean;
    /** Dry-run mode (preview without executing) */
    dryRun?: boolean;
    /** Keep projects (archive instead of delete) */
    keepProjects?: boolean;
    /** Skip confirmation prompts */
    skipConfirmation?: boolean;
}
/**
 * Uninstall result
 */
export interface UninstallResult {
    /** Whether uninstall succeeded */
    success: boolean;
    /** Plugin ID */
    pluginId: string;
    /** Actions taken */
    actions: UninstallAction[];
    /** Errors encountered */
    errors: string[];
    /** Warnings */
    warnings: string[];
    /** Statistics */
    stats: UninstallStats;
}
/**
 * Uninstall statistics
 */
export interface UninstallStats {
    /** Files removed */
    filesRemoved: number;
    /** Directories removed */
    dirsRemoved: number;
    /** Bytes freed */
    bytesFreed: number;
    /** Projects archived (if keepProjects) */
    projectsArchived: number;
}
/**
 * Single uninstall action
 */
export interface UninstallAction {
    /** Action type */
    type: 'validate' | 'check-deps' | 'backup' | 'remove-dir' | 'remove-file' | 'update-registry' | 'archive' | 'rollback';
    /** Action description */
    description: string;
    /** Path affected */
    path?: string;
    /** Whether action was executed or just planned (dry-run) */
    executed: boolean;
}
/**
 * Dependent plugin information
 */
export interface DependentPlugin {
    /** Plugin ID */
    id: string;
    /** Plugin type */
    type: PluginType;
    /** How it depends (parentFramework, extends, etc.) */
    relationship: string;
}
/**
 * Registry entry structure
 */
interface RegistryEntry {
    id: string;
    type: PluginType;
    name: string;
    version: string;
    path: string;
    installedAt: string;
    parentFramework?: string;
    projects?: string[];
}
/**
 * PluginUninstaller - Uninstall and cleanup plugins
 *
 * @example
 * ```typescript
 * const uninstaller = new PluginUninstaller('~/.local/share/ai-writing-guide');
 *
 * // Check dependencies before uninstall
 * const deps = await uninstaller.getDependentPlugins('sdlc-complete');
 * if (deps.length > 0) {
 *   console.log('Cannot uninstall - dependent plugins exist');
 * }
 *
 * // Uninstall framework
 * const result = await uninstaller.uninstall('my-framework');
 *
 * // Force uninstall (ignore dependencies)
 * const forceResult = await uninstaller.uninstall('parent-framework', { force: true });
 *
 * // Dry-run preview
 * const preview = await uninstaller.uninstall('plugin', { dryRun: true });
 * ```
 */
export declare class PluginUninstaller {
    private aiwgRoot;
    private registryPath;
    private backupDir;
    private rollbackActions;
    constructor(aiwgRoot: string);
    /**
     * Uninstall a plugin
     *
     * @param pluginId - Plugin identifier
     * @param options - Uninstall options
     * @returns Uninstall result
     */
    uninstall(pluginId: string, options?: UninstallOptions): Promise<UninstallResult>;
    /**
     * Get plugins that depend on the given plugin
     *
     * @param pluginId - Plugin identifier
     * @returns Array of dependent plugins
     */
    getDependentPlugins(pluginId: string): Promise<DependentPlugin[]>;
    /**
     * Get suggested uninstall order for a plugin and its dependents
     *
     * @param pluginId - Plugin identifier
     * @returns Ordered list of plugins to uninstall
     */
    getUninstallOrder(pluginId: string): Promise<string[]>;
    /**
     * Get plugin info from registry
     */
    private getPlugin;
    /**
     * Get active projects for a framework
     */
    private getActiveProjects;
    /**
     * Archive projects before uninstall
     */
    private archiveProjects;
    /**
     * Backup registry for rollback
     */
    private backupRegistry;
    /**
     * Recursively remove directory and track stats
     */
    private removeDirectory;
    /**
     * Calculate directory statistics
     */
    private calculateDirectoryStats;
    /**
     * Remove plugin from registry
     */
    private removeFromRegistry;
    /**
     * Load registry file
     */
    private loadRegistry;
    /**
     * Recursively copy directory
     */
    private copyDirectory;
    /**
     * Rollback changes on failure
     */
    private rollback;
    /**
     * Format bytes as human-readable string
     */
    private formatBytes;
    /**
     * List all installed plugins
     */
    listInstalled(): Promise<RegistryEntry[]>;
    /**
     * Check if a plugin can be safely uninstalled
     *
     * @param pluginId - Plugin identifier
     * @returns Object with canUninstall flag and reason/warnings
     */
    canUninstall(pluginId: string): Promise<{
        canUninstall: boolean;
        reason?: string;
        warnings: string[];
    }>;
}
/**
 * Create a PluginUninstaller with default AIWG root
 */
export declare function createUninstaller(): PluginUninstaller;
export {};
//# sourceMappingURL=plugin-uninstaller.d.ts.map