/** * Backup Manager * * Manages backups of generated context files before overwriting. * Supports both file-copy and git-stash based backup strategies. */ import type { DatabaseClient } from '../../db/client.js'; /** * Backup result */ export interface BackupResult { /** Whether backup was successful */ success: boolean; /** Path to backup file */ backupPath?: string; /** Backup method used */ method: 'file-copy' | 'git-stash' | 'none'; /** Error message if failed */ error?: string; } /** * Backup manager options */ export interface BackupManagerOptions { /** Base directory for backups (default: .k0ntext/backups) */ backupDir?: string; /** Use git stash if available (default: true) */ useGitStash?: boolean; } /** * Backup manager * * Creates and manages backups of generated files. */ export declare class BackupManager { private db; private projectRoot; private backupDir; private useGitStash; constructor(db: DatabaseClient, projectRoot: string, options?: BackupManagerOptions); /** * Create a backup of a file before overwriting * * @param filePath - Path to file to backup (can be relative or absolute) * @param tool - Tool name for organization * @returns Backup result */ createBackup(filePath: string, tool: string): Promise; /** * Restore a file from backup * * @param backupPath - Path to backup file * @param targetPath - Path to restore to (can be relative or absolute) * @returns True if restore was successful */ restoreFromBackup(backupPath: string, targetPath: string): Promise; /** * List all backups for a tool * * @param tool - Tool name * @returns Array of backup paths */ listBackups(tool: string): Promise; /** * Backup using file copy strategy * * @param fullPath - Full path to file * @param tool - Tool name * @returns Backup result */ private backupWithFileCopy; /** * Backup using git stash strategy * * @param fullPath - Full path to file * @param tool - Tool name * @returns Backup result */ private backupWithGitStash; /** * Check if current directory is a git repository * * @returns True if git repository */ private isGitRepository; /** * Clean up old backups * * @param tool - Tool name (optional, if not provided cleans all) * @param keepLast - Number of recent backups to keep (default: 5) */ cleanupOldBackups(tool?: string, keepLast?: number): Promise; } //# sourceMappingURL=backup-manager.d.ts.map