/** * Backup utilities for MCP document CRUD operations. * Creates timestamped backups before destructive operations and handles pruning. */ /** * Backup directory name (relative to repo root). */ export declare const BACKUP_DIR = ".backups"; /** * Result of a backup operation. */ export interface BackupResult { /** Original file path */ path: string; /** Path to the backup file */ backupPath: string; /** ISO timestamp of the backup */ timestamp: string; } /** * Options for backup operations. */ export interface BackupOptions { /** Number of days to retain backups (default: 7) */ retentionDays?: number; /** Minimum backups to keep regardless of age (default: 3) */ minBackups?: number; } /** * Format a date for use in backup/trash filenames. * Uses ISO format with colons replaced by dashes for Windows compatibility. * * @param date - Date to format * @returns Formatted timestamp string (e.g., "2026-01-20T12-30-45") * @example * formatTimestamp(new Date('2026-01-20T12:30:45Z')); * // Returns: "2026-01-20T12-30-45" */ export declare function formatTimestamp(date: Date): string; /** * Get the backup path for a file. * * @param filePath - Absolute path to the original file * @param repoRoot - Absolute path to repository root * @param timestamp - Optional timestamp (defaults to now) * @returns Absolute path for the backup file */ export declare function getBackupPath(filePath: string, repoRoot: string, timestamp?: Date): string; /** * Create a backup of a file. * * @param filePath - Absolute path to the file to backup * @param repoRoot - Absolute path to repository root * @returns Backup result with paths and timestamp * @throws DocumentError if file doesn't exist */ export declare function createBackup(filePath: string, repoRoot: string): Promise; /** * List all backups for a file, sorted by timestamp (newest first). * * @param filePath - Absolute path to the original file * @param repoRoot - Absolute path to repository root * @returns Array of backup results */ export declare function listBackups(filePath: string, repoRoot: string): Promise; /** * Prune old backups for a file. * Keeps backups newer than retention period OR minimum count, whichever keeps more. * * @param filePath - Absolute path to the original file * @param repoRoot - Absolute path to repository root * @param options - Pruning options * @returns Number of backups pruned */ export declare function pruneBackups(filePath: string, repoRoot: string, options?: BackupOptions): Promise; //# sourceMappingURL=backup.d.ts.map