/** * Auto-discovery of existing backup structures. * * Scans the backup directory for existing sampler backup structures and * provides utilities to import them into the unified configuration system. * * @module audiotools-config/discovery */ import type { DiscoveredBackup, BackupSource } from './types.js'; /** * Infer backup type from sampler or device name. * * Uses heuristics to determine if a backup is likely from a remote SSH source * or local media (SD card, USB drive). * * @param samplerName - Name of sampler or device (e.g., 'pi-scsi2.local', 's5k') * @returns Inferred backup type * * @example * ```typescript * inferBackupType('pi-scsi2.local'); // 'remote' * inferBackupType('s5k@192.168.1.10'); // 'remote' * inferBackupType('s5k'); // 'local' * inferBackupType('s3000xl'); // 'local' * inferBackupType('sd-card'); // 'local' * ``` */ export declare function inferBackupType(samplerName: string): 'remote' | 'local'; /** * Discover existing backups in the backup root directory. * * Scans for sampler/device directory structures and analyzes each backup * to provide metadata for import into the configuration system. * * Expected directory structure: * ``` * ~/.audiotools/backup/ * ├── sampler1/ * │ ├── device1/ * │ └── device2/ * └── sampler2/ * └── device1/ * ``` * * @param backupRoot - Optional backup root path (defaults to `~/.audiotools/backup`) * @returns Array of discovered backups (empty if directory doesn't exist) * * @example * ```typescript * const discovered = await discoverExistingBackups(); * for (const backup of discovered) { * console.log(`Found: ${backup.sampler}/${backup.device}`); * console.log(` Files: ${backup.fileCount}`); * console.log(` Size: ${(backup.totalSize / 1024 / 1024).toFixed(2)} MB`); * console.log(` Type: ${backup.inferredType}`); * } * ``` */ export declare function discoverExistingBackups(backupRoot?: string): Promise; /** * Convert discovered backups to BackupSource configurations. * * Transforms auto-discovered backup metadata into BackupSource objects * ready to be added to the unified configuration. All sources are enabled * by default. * * @param discovered - Array of discovered backups * @returns Array of BackupSource configurations * * @example * ```typescript * const discovered = await discoverExistingBackups(); * const sources = await importDiscoveredBackups(discovered); * * // Add to config * let config = await loadConfig(); * for (const source of sources) { * config = addBackupSource(config, source); * } * await saveConfig(config); * ``` */ export declare function importDiscoveredBackups(discovered: DiscoveredBackup[]): Promise;