UNPKG

@typecad/kicad-symbols

Version:

Intelligent fuzzy search for KiCad symbols with CLI interface

86 lines 3.1 kB
import { DataManager } from '../data/DataManager.js'; import { ComponentSearchEngine } from '../scoring/SearchEngine.js'; /** * Main application class that orchestrates all components * * The Application class serves as the central coordinator for the KiCad symbols search system. * It manages the initialization and coordination of all major components including data management, * parameter parsing, search engine, and command-line interface. * * Key responsibilities: * - Initialize and configure all system components * - Manage data loading and caching * - Coordinate search operations * - Handle application lifecycle (startup, shutdown) * - Provide error handling and logging * * @class Application * @example * ```typescript * // Create and run application * const app = new Application(); * await app.run(process.argv); * * // Or use the convenience function * await runApplication(process.argv, { * logLevel: LogLevel.INFO, * cacheExpirationHours: 12 * }); * ``` */ export declare class Application { private readonly dataManager; private readonly parameterParser; private readonly fuzzyScorer; private readonly searchEngine; private readonly cli; /** * Creates a new Application instance * @param localCachePath - Path to local cache file (ignored when using shared cache) * @param cacheDir - Directory for cache files (ignored when using shared cache) * @param cacheExpirationHours - Cache expiration time in hours * @param programName - Name of the program for CLI * @param useSharedCache - Whether to use shared temp directory for cache files (default: true) */ constructor(localCachePath?: string, cacheDir?: string, cacheExpirationHours?: number, programName?: string, useSharedCache?: boolean); /** * Runs the application with the provided command-line arguments * @param args - Command-line arguments (process.argv) * @returns Promise that resolves when the application completes */ run(args: string[]): Promise<void>; /** * Performs cleanup operations before shutdown */ shutdown(): Promise<void>; /** * Gets the search engine instance * @returns The search engine instance */ getSearchEngine(): ComponentSearchEngine; /** * Gets the data manager instance * @returns The data manager instance */ /** * Determines the data source type based on the data manager's current mode * @returns DataSourceType for parameter parsing * @private */ private determineDataSourceType; getDataManager(): DataManager; } /** * Creates and runs the application * @param args - Command-line arguments (process.argv) * @param options - Application options * @returns Promise that resolves when the application completes */ export declare function runApplication(args: string[], options?: { localCachePath?: string; cacheDir?: string; cacheExpirationHours?: number; programName?: string; useSharedCache?: boolean; }): Promise<void>; //# sourceMappingURL=index.d.ts.map