/** * Snapshot Commands * * Commands for creating, listing, restoring, and managing data snapshots. * * @since v1.50.8 * @updated v1.53.0 - Added rename, selection, validation, and edge case handling */ import type { UICommand } from '../../ui/commands/registry.js'; /** * Snapshot options */ export interface SnapshotOptions { /** Include log files */ includeLogs?: boolean; /** Include backup files */ includeBackups?: boolean; /** Include cache files */ includeCache?: boolean; /** Output directory for snapshots */ outputDir?: string; /** Custom snapshot name */ name?: string; /** Description for the snapshot */ description?: string; } /** * Snapshot metadata stored in the archive */ export interface SnapshotMetadata { /** Snapshot ID (timestamp-based) */ id: string; /** User-provided name or auto-generated */ name: string; /** Optional description */ description?: string; /** Creation timestamp */ createdAt: string; /** Pluginator version */ version: string; /** Number of files included */ fileCount: number; /** Total size in bytes */ totalSize: number; /** Options used when creating */ options: SnapshotOptions; /** List of included file paths */ files: string[]; } /** * Validation result */ export interface ValidationResult { valid: boolean; errors: string[]; warnings: string[]; } /** * Rename result */ export interface RenameResult { success: boolean; oldName: string; newName: string; error?: string; } /** * Snapshot info for listing */ export interface SnapshotInfo { id: string; name: string; createdAt: Date; fileCount: number; totalSize: number; archiveSize: number; archivePath: string; } /** * Snapshot command result */ export interface SnapshotResult { success: boolean; output: string; error?: string; snapshotPath?: string; } /** * Create a snapshot archive * * Uses a simple JSON-based archive format since Bun doesn't have built-in tar support. * The archive is a JSON file containing metadata and base64-encoded file contents. */ export declare function createSnapshot(options?: SnapshotOptions): Promise<{ path: string; metadata: SnapshotMetadata; }>; /** * List available snapshots */ export declare function listSnapshots(snapshotDir?: string): Promise; /** * Load a snapshot by ID or name */ export declare function loadSnapshot(idOrName: string, snapshotDir?: string): Promise<{ metadata: SnapshotMetadata; files: Record; } | null>; /** * Restore from a snapshot */ export declare function restoreSnapshot(idOrName: string, snapshotDir?: string): Promise<{ restored: number; skipped: number; errors: string[]; }>; /** * Delete a snapshot */ export declare function deleteSnapshot(idOrName: string, snapshotDir?: string): Promise; /** * Validate a snapshot name */ export declare function validateSnapshotName(name: string): { valid: boolean; error?: string; }; /** * Sanitize a snapshot name to be valid */ export declare function sanitizeSnapshotName(name: string): string; /** * Get a unique name if duplicates exist */ export declare function getUniqueName(baseName: string, snapshotDir?: string): Promise; /** * Validate a snapshot archive for corruption */ export declare function validateSnapshot(idOrName: string, snapshotDir?: string): Promise; /** * Rename a snapshot */ export declare function renameSnapshot(idOrName: string, newName: string, snapshotDir?: string): Promise; /** * Snapshot command handlers */ export interface SnapshotCommandHandlers { createSnapshot: (options?: SnapshotOptions) => Promise; listSnapshots: () => Promise; restoreSnapshot: (idOrName: string) => Promise; deleteSnapshot: (idOrName: string) => Promise; } /** * Create snapshot command handlers */ export declare function createSnapshotCommandHandlers(): SnapshotCommandHandlers; /** * Create snapshot commands for the command palette * * Note: The execute functions intentionally discard the result to match * the UICommand interface (void | Promise). The result is logged * to console in dev mode. */ export declare function createSnapshotCommands(handlers: SnapshotCommandHandlers): UICommand[]; //# sourceMappingURL=snapshot.d.ts.map