/** * Plot Thread Synchronization * Syncs plot thread YAML files to database, and DB → YAML reverse sync. */ import type { MCPClient } from '../core/database.js'; export interface PlotThreadSyncOptions { /** When true, overwrite DB data from file even if a conflict is detected. */ forceFile?: boolean; } export declare class PlotThreadSync { private mcpClient; private projectId; private projectPath?; private readonly syncStateRepo; constructor(mcpClient: MCPClient, projectId: number, projectPath?: string | undefined); /** * Sync a plot thread YAML file to database. * * @param filePath - absolute path to the YAML plot-thread file * @param options - optional flags; set `forceFile: true` to suppress conflict errors */ syncPlotThreadFile(filePath: string, options?: PlotThreadSyncOptions): Promise; /** * Export a plot thread from the database back to a YAML file (reverse sync). * Writes to `/plots/.yaml`. * * @param threadId - numeric DB id of the plot_thread row (as string) * @returns absolute path to the written file */ exportToYAML(threadId: string): Promise; /** * Upsert plot thread record */ private upsertPlotThread; /** * Resolve a scene reference string to a scene ID. * Parses: "Ch3.Scene2", "Ch3.S2", "Chapter 3 Scene 2", "3.2" * Returns { sceneId, canonicalKey } or null if unresolvable. */ resolveSceneRef(ref: string): Promise<{ sceneId: number; canonicalKey: string; } | null>; /** * Sync plot beats to database. * Attempts to resolve scene_reference strings to scene_id FKs. * Unresolvable references log a warning but don't fail the sync. */ private syncBeats; /** * Get all plot threads for project */ getPlotThreads(statusFilter?: string): Promise; /** * Get beats for a plot thread */ getBeats(threadId: number): Promise[]>; /** * Get unresolved plot threads */ getUnresolvedThreads(): Promise[]>; /** * Get high-priority unresolved threads */ getHighPriorityUnresolved(): Promise; /** * Get plot threads by type */ getThreadsByType(type: 'main' | 'subplot' | 'character' | 'theme'): Promise; /** * Mark plot thread as resolved */ resolveThread(threadId: number, resolvedInSceneId?: number): Promise; /** * Get plot thread statistics */ getStats(): Promise<{ total: number; byType: Record; byStatus: Record; totalBeats: number; unresolved: number; highPriorityUnresolved: number; }>; /** * Sync all plot thread files from a directory */ syncAllFromDirectory(plotDir: string): Promise; } //# sourceMappingURL=plot-thread-sync.d.ts.map