/** * [WHO]: Provides SimplifyController, processFilesParallel(), getContentHash() * [FROM]: Depends on node crypto/fs/path and simplify result types * [TO]: Consumed by extensions/optional/simplify/index.ts for caching and concurrency * [HERE]: extensions/optional/simplify/simplify-controller.ts - simplify state and parallel processing helpers */ import type { SimplifyResult } from "./simplify-types.js"; /** * Generate a short hash for content caching * Uses SHA-256 truncated to 16 hex characters */ export declare function getContentHash(content: string): string; /** * Process items in parallel with a concurrency limit * * @param items - Items to process * @param limit - Maximum concurrent operations * @param processor - Async function to process each item * @param onProgress - Optional progress callback (completed, total) * @returns Array of successful results (nulls filtered out) */ export declare function processFilesParallel(items: T[], limit: number, processor: (item: T) => Promise, onProgress?: (completed: number, total: number) => void): Promise; /** * Controller for managing simplify operation state * * Responsibilities: * - Content hash caching (skip unchanged files) * - Backup management (for rollback on test failure) * - Applied changes tracking (for summary) */ export declare class SimplifyController { private cache; private backups; private applied; /** * Check if a file+hash combination is cached */ getCached(file: string, hash: string): SimplifyResult | undefined; /** * Cache a result for a file+hash combination */ setCached(file: string, hash: string, result: SimplifyResult): void; /** * Backup original file content before modification */ backup(file: string, content: string): void; /** * Record an applied simplification */ recordApply(result: SimplifyResult): void; /** * Rollback all applied changes by restoring backups */ rollback(cwd: string): void; /** * Get summary statistics */ getSummary(): { applied: number; linesSaved: number; rolledBack: number; }; /** * Check if there are any backups (for rollback purposes) */ hasBackups(): boolean; /** * Clear all state (for cleanup) */ clear(): void; }