UNPKG

@typecad/kicad-symbols

Version:

Intelligent fuzzy search for KiCad symbols with CLI interface

162 lines 5.21 kB
/** * Local data processor for KiCad symbol files * Orchestrates the complete pipeline from symbol discovery to data extraction */ import { ScanOptions } from './KiCadSymbolFileScanner.js'; import { ExtractedSymbol, ExtractionOptions } from './KiCadSymbolExtractor.js'; /** * Progress information for the processing operation */ export interface ProcessingProgress { /** Current phase of processing */ phase: 'initializing' | 'scanning' | 'extracting' | 'converting' | 'completed' | 'error'; /** Current step within the phase */ step: string; /** Progress percentage (0-100) */ percentage: number; /** Number of files processed so far */ filesProcessed: number; /** Total number of files to process */ totalFiles: number; /** Number of symbols extracted so far */ symbolsExtracted: number; /** Estimated time remaining in milliseconds */ estimatedTimeRemaining?: number; } /** * Overall processing statistics */ export interface ProcessingStatistics { /** Total processing time in milliseconds */ totalProcessingTime: number; /** KiCad installation path found */ kicadPath?: string; /** Symbols directory path used */ symbolsPath?: string; /** File scanning statistics */ scanStats: { filesFound: number; directoriesScanned: number; scanTime: number; errors: string[]; }; /** Symbol extraction statistics */ extractionStats: { filesProcessed: number; filesWithErrors: number; symbolsExtracted: number; symbolsWithDescriptions: number; symbolsWithKeywords: number; extractionTime: number; errors: string[]; }; } /** * Configuration for local data processing */ export interface ProcessingConfig { /** Custom KiCad symbols path (overrides auto-detection) */ customSymbolsPath?: string; /** Scan options for file discovery */ scanOptions?: Partial<ScanOptions>; /** Extraction options for symbol processing */ extractionOptions?: Partial<ExtractionOptions>; /** Whether to enable progress callbacks */ enableProgress: boolean; /** Progress callback interval in milliseconds */ progressInterval: number; } /** * Progress callback function type */ export type ProgressCallback = (progress: ProcessingProgress) => void; /** * Local data processor for KiCad symbols */ export declare class KiCadLocalDataProcessor { private kicad; private config; private progressCallback?; private statistics; private startTime; constructor(config?: Partial<ProcessingConfig>); /** * Process all local KiCad symbol files and extract symbol data * @param progressCallback - Optional callback for progress updates * @returns Promise resolving to array of extracted symbols */ processLocalSymbols(progressCallback?: ProgressCallback): Promise<ExtractedSymbol[]>; /** * Get processing statistics from the last operation * @returns Processing statistics */ getStatistics(): ProcessingStatistics; /** * Check if local KiCad symbols are available * @returns Promise resolving to true if symbols are available */ areLocalSymbolsAvailable(): Promise<boolean>; /** * Get the path to KiCad symbols directory * @returns Promise resolving to symbols path */ getSymbolsPath(): Promise<string>; /** * Find the KiCad symbols directory path * @returns Promise resolving to symbols directory path * @private */ private findSymbolsPath; /** * Scan for symbol files in the symbols directory * @param symbolsPath - Path to symbols directory * @returns Promise resolving to array of symbol file information * @private */ private scanForSymbolFiles; /** * Extract symbols from symbol files with progress reporting * @param symbolFiles - Array of symbol files to process * @returns Promise resolving to array of extracted symbols * @private */ private extractSymbols; /** * Calculate extraction progress information * @param filesProcessed - Number of files processed * @param totalFiles - Total number of files * @param symbolsExtracted - Number of symbols extracted * @returns Progress information * @private */ private calculateExtractionProgress; /** * Report progress to callback if available * @param progress - Progress information * @private */ private reportProgress; /** * Update scan statistics from scanner results * @param symbolFiles - Symbol files found * @private */ private updateScanStatistics; /** * Update extraction statistics from extractor results * @private */ private updateExtractionStatistics; /** * Initialize processing statistics * @returns Initial statistics object * @private */ private initializeStatistics; /** * Get a human-readable summary of the processing results * @returns Formatted summary string */ getProcessingSummary(): string; } //# sourceMappingURL=KiCadLocalDataProcessor.d.ts.map