/**
 * Living Docs Merger - Intelligently merges existing documentation
 *
 * This module scans for existing documentation in a user project and
 * offers to merge/import it into the living docs structure.
 *
 * Smart features:
 * - Detects documentation type (README, API docs, guides, etc.)
 * - Suggests appropriate target folders
 * - Detects similar/duplicate content
 * - Preserves original files (copies, doesn't move)
 *
 * @module core/living-docs/scaffolding/merger
 */
import { Logger } from '../../../utils/logger.js';
/**
 * Detected documentation file
 */
export interface DetectedDoc {
    /** Original file path (relative to project root) */
    sourcePath: string;
    /** Absolute path */
    absolutePath: string;
    /** File name */
    fileName: string;
    /** Detected document type */
    type: DocType;
    /** Confidence score (0-1) */
    confidence: number;
    /** Suggested target folder in living docs */
    suggestedTarget: string;
    /** File size in bytes */
    size: number;
    /** First 500 chars of content (for preview) */
    preview: string;
    /** Detected keywords/themes */
    themes: string[];
}
/**
 * Document types
 */
export type DocType = 'readme' | 'api' | 'guide' | 'architecture' | 'adr' | 'runbook' | 'contributing' | 'changelog' | 'spec' | 'other';
/**
 * Merge options
 */
export interface MergeOptions {
    /** Project root path */
    projectPath: string;
    /** Additional folders to scan (besides common locations) */
    additionalFolders?: string[];
    /** Whether to scan recursively */
    recursive?: boolean;
    /** Maximum depth for recursive scan */
    maxDepth?: number;
    /** Minimum confidence to include in results */
    minConfidence?: number;
    /** Logger instance */
    logger?: Logger;
}
/**
 * Merge result
 */
export interface MergeResult {
    /** Detected documentation files */
    detected: DetectedDoc[];
    /** Files that were merged */
    merged: string[];
    /** Files that were skipped */
    skipped: string[];
    /** Any errors */
    errors: string[];
    /** Suggested merges (grouped by target folder) */
    suggestions: Map<string, DetectedDoc[]>;
}
/**
 * Similarity result
 */
export interface SimilarityResult {
    /** Whether files are similar */
    isSimilar: boolean;
    /** Similarity score (0-1) */
    score: number;
    /** Reason for similarity */
    reason?: string;
}
/**
 * Living Docs Merger class
 */
export declare class LivingDocsMerger {
    private projectPath;
    private logger;
    private recursive;
    private maxDepth;
    private minConfidence;
    private additionalFolders;
    constructor(options: MergeOptions);
    /**
     * Scan for existing documentation
     */
    scan(): Promise<DetectedDoc[]>;
    /**
     * Scan a directory for markdown files
     */
    private scanDirectory;
    /**
     * Check if directory should be skipped
     */
    private shouldSkipDir;
    /**
     * Check if file is a documentation file
     */
    private isDocFile;
    /**
     * Analyze a documentation file
     */
    private analyzeFile;
    /**
     * Detect document type from filename and content
     */
    private detectType;
    /**
     * Extract themes/keywords from content
     */
    private extractThemes;
    /**
     * Check similarity between two files using TF-IDF weighted cosine similarity
     *
     * TF-IDF (Term Frequency-Inverse Document Frequency) weights terms by:
     * - How often they appear in a document (TF - more = more important)
     * - How rare they are across all documents (IDF - rarer = more distinctive)
     */
    checkSimilarity(doc1: DetectedDoc, doc2: DetectedDoc): SimilarityResult;
    /**
     * Compute TF-IDF weighted cosine similarity between two texts
     *
     * This is a simplified but effective TF-IDF implementation:
     * - TF: term frequency in document (normalized)
     * - IDF: inverse document frequency (approximated using both documents as corpus)
     */
    private computeTfIdfSimilarity;
    /**
     * Tokenize text into meaningful terms
     * Filters out common stop words and short tokens
     */
    private tokenize;
    /**
     * Compute normalized term frequency
     */
    private computeTermFrequency;
    /**
     * Compute cosine similarity between two TF-IDF vectors
     */
    private cosineSimilarity;
    /**
     * Compute filename similarity using normalized Levenshtein distance
     */
    private computeFilenameSimilarity;
    /**
     * Compute Levenshtein edit distance between two strings
     */
    private levenshteinDistance;
    /**
     * Generate merge suggestions grouped by target folder
     */
    generateSuggestions(detected: DetectedDoc[]): Map<string, DetectedDoc[]>;
    /**
     * Merge a detected document into living docs
     */
    mergeDoc(doc: DetectedDoc, targetFolder?: string): Promise<{
        success: boolean;
        targetPath: string;
        error?: string;
    }>;
}
/**
 * Scan for existing documentation (convenience function)
 */
export declare function scanExistingDocs(options: MergeOptions): Promise<DetectedDoc[]>;
/**
 * Find similar documentation folders
 */
export declare function findSimilarFolders(projectPath: string, existingDocs: DetectedDoc[]): Map<string, string[]>;
//# sourceMappingURL=merger.d.ts.map