UNPKG

@typecad/kicad-symbols

Version:

Intelligent fuzzy search for KiCad symbols with CLI interface

119 lines 3.7 kB
/** * Scanner for finding KiCad symbol files (.kicad_sym) in the local filesystem * Recursively searches through the KiCad symbols directory to locate all symbol files */ /** * Information about a discovered symbol file */ export interface SymbolFileInfo { /** Full path to the symbol file */ filePath: string; /** File name without extension */ fileName: string; /** File name with extension */ fullFileName: string; /** Directory containing the file */ directory: string; /** Relative path from the symbols root directory */ relativePath: string; /** File size in bytes */ size: number; /** Last modified timestamp */ lastModified: Date; } /** * Statistics about the symbol file scanning operation */ export interface ScanStatistics { /** Total number of .kicad_sym files found */ totalFiles: number; /** Total size of all symbol files in bytes */ totalSize: number; /** Number of directories scanned */ directoriesScanned: number; /** Time taken for the scan in milliseconds */ scanDuration: number; /** Any errors encountered during scanning */ errors: string[]; } /** * Options for controlling the symbol file scanning behavior */ export interface ScanOptions { /** Whether to include subdirectories in the scan */ recursive: boolean; /** Maximum depth to scan (0 = no limit) */ maxDepth: number; /** File size limit in bytes (0 = no limit) */ maxFileSize: number; /** Whether to follow symbolic links */ followSymlinks: boolean; /** Patterns to exclude from scanning (directory names) */ excludePatterns: string[]; } /** * Scanner for KiCad symbol files in the local filesystem */ export declare class KiCadSymbolFileScanner { private symbolsRootPath; private options; private statistics; constructor(symbolsRootPath: string, options?: Partial<ScanOptions>); /** * Scan the symbols directory for all .kicad_sym files * @returns Promise resolving to array of symbol file information */ scanForSymbolFiles(): Promise<SymbolFileInfo[]>; /** * Get scanning statistics from the last scan operation * @returns Scan statistics */ getStatistics(): ScanStatistics; /** * Recursively scan a directory for symbol files * @param dirPath - Directory path to scan * @param symbolFiles - Array to collect found symbol files * @param currentDepth - Current scanning depth * @private */ private scanDirectory; /** * Create file information object for a symbol file * @param filePath - Full path to the file * @returns File information or null if file cannot be accessed * @private */ private createFileInfo; /** * Check if a file is a KiCad symbol file * @param fileName - Name of the file * @returns True if it's a .kicad_sym file * @private */ private isSymbolFile; /** * Check if a directory should be excluded from scanning * @param dirName - Directory name * @returns True if directory should be excluded * @private */ private shouldExcludeDirectory; /** * Check if file size is within acceptable limits * @param fileSize - Size of the file in bytes * @returns True if file size is acceptable * @private */ private isValidFileSize; /** * Reset scanning statistics * @private */ private resetStatistics; /** * Get a human-readable summary of the scan results * @returns Formatted summary string */ getScanSummary(): string; } //# sourceMappingURL=KiCadSymbolFileScanner.d.ts.map