/** * Scan Cache Service * * Manages caching of server scan results to persist plugin data between sessions. * This fixes the "0 plugins" on startup issue by preserving scan data. * * Data is stored in ~/.pluginator/cache/scan-cache.json * * @since v1.50.0 */ import type { ScannedPlugin } from '../types/plugin.js'; import type { CacheValidityResult, ScanCache, ScanCacheSummary, ServerScanCache } from '../types/scan-cache.js'; /** * Scan Cache Service * Manages caching of server scan results */ export declare class ScanCacheService { private cache; private path; private prodPath; private testPath; constructor(path?: string, prodPath?: string, testPath?: string); /** * Set server paths (needed for hash validation) */ setServerPaths(prodPath: string, testPath: string): void; /** * Load cache from disk * Returns null if cache doesn't exist or is invalid */ load(): Promise; /** * Save cache to disk */ save(prod: ScannedPlugin[], test: ScannedPlugin[], scanDurationMs?: number): Promise; /** * Save only production server scan */ saveProd(plugins: ScannedPlugin[], scanDurationMs?: number): Promise; /** * Save only test server scan */ saveTest(plugins: ScannedPlugin[], scanDurationMs?: number): Promise; /** * Check if cache is stale (expired) */ isStale(): boolean; /** * Check cache validity with detailed reasons */ checkValidity(): CacheValidityResult; /** * Invalidate the cache (delete file) */ invalidate(): Promise; /** * Get production plugins from cache */ getProdPlugins(): ScannedPlugin[]; /** * Get test plugins from cache */ getTestPlugins(): ScannedPlugin[]; /** * Get production scan cache */ getProdCache(): ServerScanCache | null; /** * Get test scan cache */ getTestCache(): ServerScanCache | null; /** * Get cache timestamp */ getTimestamp(): Date | null; /** * Get cache age in milliseconds */ getAgeMs(): number | null; /** * Get cache summary */ getSummary(): ScanCacheSummary; /** * Generate hash of server paths for change detection */ private generatePathsHash; /** * Find a plugin by name in the cache */ findPlugin(name: string, server?: 'prod' | 'test' | 'both'): ScannedPlugin | undefined; /** * Get plugin counts */ getPluginCounts(): { prod: number; test: number; total: number; }; } /** * Get the singleton scan cache service */ export declare function getScanCacheService(path?: string): ScanCacheService; /** * Create a new scan cache service (for testing) */ export declare function createScanCacheService(path?: string): ScanCacheService; /** * Reset the singleton (for testing) */ export declare function resetScanCacheService(): void; //# sourceMappingURL=scan-cache-service.d.ts.map