/** * Chapter file to database synchronization * Handles Markdown chapter files → database, and DB → Markdown reverse sync. */ import type { MCPClient } from '../core/database.js'; export interface ChapterSyncOptions { /** When true, overwrite DB data from file even if a conflict is detected. */ forceFile?: boolean; } export declare class ChapterSync { private mcpClient; private projectId; private projectPath?; private readonly syncStateRepo; constructor(mcpClient: MCPClient, projectId: number, projectPath?: string | undefined); /** * Sync a chapter markdown file to the database. * * @param filePath - absolute path to the Markdown chapter file * @param options - optional flags; set `forceFile: true` to suppress conflict errors */ syncChapterFile(filePath: string, options?: ChapterSyncOptions): Promise; /** * Export a chapter from the database back to a Markdown file (reverse sync). * Reconstructs YAML frontmatter from DB data and writes to `/chapters/`. * Does not overwrite existing chapter body content — body defaults to empty if no * file_path is recorded. * * @param chapterId - numeric DB id of the chapter row * @returns absolute path to the written file */ exportToFile(chapterId: number): Promise; /** * Extract chapter number from filename * Supports formats: 01.md, 01-title.md, chapter-01.md, etc. */ private extractChapterNumber; /** * Parse YAML frontmatter from markdown */ private parseChapterMetadata; /** * Count words in text (excluding frontmatter) */ private countWords; /** * Insert or update chapter record */ private upsertChapter; /** * Delete a chapter from database (when file is deleted) */ deleteChapter(chapterNumber: number): Promise; /** * Generate AI summary for a chapter * This would be called after chapter is synced */ generateChapterSummary(chapterId: number): Promise; } //# sourceMappingURL=chapter-sync.d.ts.map