/** * memory-journal-mcp — Markdown Importer * * Reads frontmattered `.md` files from a directory and upserts them * into the journal database. Supports create, update, tag reconciliation, * relationship linking, and dry-run mode. */ import type { IDatabaseAdapter } from '../database/core/interfaces.js'; import type { VectorSearchManager } from '../vector/vector-search-manager/index.js'; /** Options for the import operation */ export interface ImportOptions { /** Parse and validate without writing to database */ dry_run?: boolean; /** Maximum files to process */ limit?: number; /** Author name for new entries (team journal) */ author?: string; /** Associate imported entries with a specific GitHub project number */ project_number?: number; /** Workspace isolation identifier */ workspaceId?: string; } /** Result of an import operation */ export interface ImportResult { success: boolean; created: number; updated: number; skipped: number; relationshipsLinked: number; vectorsIndexed: number; errors: { file: string; error: string; }[]; dry_run: boolean; } /** * Import markdown files from a directory into the journal database. * * Upsert semantics: * - If frontmatter has `mj_id` AND entry exists → UPDATE * - If frontmatter has `mj_id` BUT entry not found → CREATE (DB assigns ID) * - If no `mj_id` in frontmatter → CREATE * * Post-import processing: * - Tags included in createEntry/updateEntry calls * - Relationship linking where targets exist * - Vector re-indexing (fire-and-forget) * * @param sourceDir - Directory containing `.md` files * @param db - Database adapter for entry operations * @param options - Import options (dry_run, limit, author) * @param vectorManager - Optional vector search manager for re-indexing * @returns Import result with counts and errors */ export interface ParsedFile { filename: string; body: string; metadata: { mj_id?: number; entry_type?: string; tags?: string[]; significance?: string; relationships?: { type: string; target_id: number; }[]; }; } export declare function importMarkdownEntries(sourceDir: string, db: IDatabaseAdapter, options: ImportOptions | undefined, vectorManager: VectorSearchManager | undefined, allowedRoots: string[]): Promise; /** * Process a batch of parsed markdown files and upsert them into the database. * * @param parsedFiles Files to import * @param db Database adapter * @param options Import options * @param vectorManager Optional vector search manager * @returns Import result with counts and errors */ export declare function processImportBatch(parsedFiles: ParsedFile[], db: IDatabaseAdapter, options: ImportOptions | undefined, vectorManager: VectorSearchManager | undefined): Promise; //# sourceMappingURL=importer.d.ts.map