UNPKG

@iyulab/oops

Version:

Core SDK for Oops - Safe text file editing with automatic backup

71 lines 1.98 kB
/** * Simple Backup System - Core Purpose Implementation * * Purpose: Safe text file editing with automatic backup and simple undo * Features: One backup per file, atomic operations, simple workflow */ export interface TrackedFileInfo { filePath: string; hasChanges: boolean; backupPath: string; trackedAt: Date; } export interface BackupStatus { trackedFiles: TrackedFileInfo[]; totalFiles: number; } export declare class SimpleBackup { private workspacePath; private backupDir; private stateFile; constructor(workspacePath?: string); /** * Start tracking a file with automatic backup * Equivalent to: oops <file> */ startTracking(filePath: string): Promise<void>; /** * Check if a file is currently being tracked */ isTracked(filePath: string): Promise<boolean>; /** * Check if backup exists for a file */ hasBackup(filePath: string): Promise<boolean>; /** * Get backup content for a file */ getBackupContent(filePath: string): Promise<string>; /** * Check if file has changes compared to backup */ hasChanges(filePath: string): Promise<boolean>; /** * Keep changes and stop tracking * Equivalent to: oops keep <file> */ keep(filePath: string): Promise<void>; /** * Undo changes and restore from backup * Equivalent to: oops undo <file> */ undo(filePath: string): Promise<void>; /** * Get status of all tracked files * Equivalent to: oops status */ getStatus(): Promise<BackupStatus>; /** * Get diff between backup and current file * Equivalent to: oops diff <file> */ getDiff(filePath: string): Promise<string>; private ensureDirectories; private createBackup; private addToState; private removeFromState; private loadState; private saveState; private generateSimpleDiff; } //# sourceMappingURL=simple-backup.d.ts.map