import { ConfigManager } from './ConfigManager.js'; import { AuditOperation, SyncResult, AuditStatistics } from '../types/index.js'; /** * Audit Logger * * Dual-format audit logging system: * 1. Human-readable log: ~/.workforge/projects//audit.log * 2. Machine-readable JSON: ~/.workforge/projects//sync-history.json * * Features: * - Configurable variable value inclusion * - Auto-cleanup based on retention days * - Project metadata tracking */ export declare class AuditLogger { private configManager; private auditEnabled; private includeValues; private retentionDays; constructor(configManager?: ConfigManager); /** * Load audit configuration */ private loadConfig; /** * Log an audit operation * * @param operation - Audit operation details * @param repoRoot - Repository root path */ log(operation: AuditOperation, repoRoot: string): void; /** * Append operation to human-readable log file */ private appendToLog; /** * Format operation as human-readable log entry */ private formatLogEntry; /** * Add operation to JSON history */ private addToHistory; /** * Move an unparseable file aside instead of overwriting it * * @param filePath - File that could not be read * @returns Path it was preserved at, or null */ private preserveCorruptFile; /** * Write via a temporary file and rename, so a reader never observes a * half-written file and an interrupted write cannot truncate the original. * * @param filePath - Destination path * @param content - Content to write */ private writeAtomically; /** * Take a cross-process lock for a project directory. * * `mkdir` is atomic on every platform we target, so the directory doubles as * the lock. A stale lock left by a killed process is reclaimed after a * timeout rather than deadlocking the CLI. * * @param projectDir - Directory to lock * @returns Lock path if acquired, or null if it had to proceed without one */ private acquireLock; /** * Release a lock taken by acquireLock * * @param lockPath - Lock path, or null when none was held */ private releaseLock; /** * Cleanup old logs based on retention days */ private cleanupOldLogs; /** * Rebuild human-readable log from JSON history */ private rebuildHumanLog; /** * Get audit history for a project * * @param repoRoot - Repository root * @returns Array of audit operations */ getHistory(repoRoot: string): AuditOperation[]; /** * Get recent audit operations * * @param repoRoot - Repository root * @param limit - Maximum number of operations to return * @returns Array of recent audit operations */ getRecentHistory(repoRoot: string, limit?: number): AuditOperation[]; /** * Get audit statistics for a project * * @param repoRoot - Repository root * @returns Statistics object */ getStatistics(repoRoot: string): AuditStatistics; /** * Clear all audit logs for a project * * @param repoRoot - Repository root */ clearHistory(repoRoot: string): void; /** * Create audit operation from sync result * * @param result - Sync result * @param source - Source label * @param target - Target label * @param backupCreated - Whether backup was created * @returns Audit operation */ createAuditOperation(result: SyncResult, source: string, target: string, backupCreated: boolean): AuditOperation; } //# sourceMappingURL=AuditLogger.d.ts.map