/** * SyncEngine - Core sync logic for registry synchronization * * Implements differential sync by comparing local database state with * the live Skillsmith registry API. Fetches only changed skills based * on updated_at timestamps. */ import type { SkillsmithApiClient } from '../api/client.js'; import type { SkillRepository } from '../repositories/SkillRepository.js'; import type { SyncConfigRepository } from '../repositories/SyncConfigRepository.js'; import type { SyncHistoryRepository } from '../repositories/SyncHistoryRepository.js'; import type { SkillVersionRepository } from '../repositories/SkillVersionRepository.js'; import type { AdvisoryRepository } from '../repositories/AdvisoryRepository.js'; /** * Sync options */ export interface SyncOptions { /** Force full sync (ignore lastSyncAt) */ force?: boolean; /** Don't write changes, just report what would sync */ dryRun?: boolean; /** API pagination size (default: 100) */ pageSize?: number; /** Progress callback */ onProgress?: (progress: SyncProgress) => void; /** * Abort signal (SMI-5649). Checked at loop and pre-write boundaries so a * shutdown quiesce can stop an in-flight sync before it writes against a * db that is about to be closed. Every driver write is synchronous, so * once the signal is aborted, no new write ever begins — this is what * makes it safe for the coordinator to proceed to `db.close()` once its * bounded quiesce timeout elapses, even if this method hasn't returned yet. */ signal?: AbortSignal; } /** * Sync progress info */ export interface SyncProgress { phase: 'connecting' | 'fetching' | 'comparing' | 'upserting' | 'complete'; current: number; total: number; skillsProcessed: number; skillsChanged: number; message?: string; } /** * Sync result */ export interface SyncResult { success: boolean; skillsAdded: number; skillsUpdated: number; skillsUnchanged: number; totalProcessed: number; errors: string[]; durationMs: number; dryRun: boolean; } /** * Sync engine for registry synchronization */ export declare class SyncEngine { private apiClient; private skillRepo; private syncConfigRepo; private syncHistoryRepo; private skillVersionRepo; private advisoryRepo; constructor(apiClient: SkillsmithApiClient, skillRepo: SkillRepository, syncConfigRepo: SyncConfigRepository, syncHistoryRepo: SyncHistoryRepository, skillVersionRepo: SkillVersionRepository, advisoryRepo?: AdvisoryRepository | null); /** * Stub: sync advisories from the registry. * * The server-side advisory endpoint does not exist yet. This method logs * a diagnostic message and returns immediately. It will be wired to the * actual endpoint in a future wave when the registry ships advisory data. */ private syncAdvisories; /** * Run sync operation */ sync(options?: SyncOptions): Promise; /** * Upsert skills into local database */ private upsertSkills; /** * Get sync status summary */ getStatus(): { config: ReturnType; lastRun: ReturnType; isRunning: boolean; isDue: boolean; }; } //# sourceMappingURL=SyncEngine.d.ts.map