/**
 * Duplicate Detector
 *
 * Detects duplicate external items by scanning living docs for existing external IDs.
 * Prevents re-importing items that have already been imported.
 */
/**
 * External ID reference found in living docs
 * CRITICAL (2025-12-01): Includes parent tracking for re-import hierarchy updates
 */
export interface ExternalIdReference {
    /** User Story ID (e.g., US-001E) */
    usId: string;
    /** File path where external ID was found */
    filePath: string;
    /** External ID value */
    externalId: string;
    /** External platform (github, jira, ado) */
    platform?: string;
    /** Feature ID this item belongs to (e.g., FS-001E) */
    featureId?: string;
    /** Parent work item ID in external tool (e.g., ADO-123) */
    parentId?: string;
    /** Whether this item was imported as orphan (no parent) */
    isOrphan?: boolean;
    /** ADO work item type (e.g., User Story, Bug) */
    adoWorkItemType?: string;
}
/**
 * Options for duplicate detection
 */
export interface DuplicateDetectorOptions {
    /** Living docs specs directory to scan */
    specsDir: string;
    /** Cache scan results (default: true) */
    enableCache?: boolean;
}
/**
 * Duplicate Detector
 *
 * Scans living docs US files for external_id metadata and provides
 * duplicate detection functionality.
 */
export declare class DuplicateDetector {
    private options;
    private cache;
    constructor(options: DuplicateDetectorOptions);
    /**
     * Check if an external ID already exists in living docs
     *
     * @param externalId - External ID to check (e.g., "GH-#638", "JIRA-PROJ-123")
     * @returns True if external ID exists (duplicate), false otherwise
     */
    checkExistingExternalId(externalId: string): Promise<boolean>;
    /**
     * Find the User Story that contains a specific external ID
     *
     * @param externalId - External ID to search for
     * @returns External ID reference if found, null otherwise
     */
    findExternalIdReference(externalId: string): Promise<ExternalIdReference | null>;
    /**
     * Get all external IDs currently in living docs
     *
     * @returns Map of external ID to reference
     */
    getAllExternalIds(): Promise<Map<string, ExternalIdReference>>;
    /**
     * Build map of external IDs to User Story references
     */
    private buildExternalIdMap;
    /**
     * Find all User Story markdown files in specs directory
     *
     * Searches recursively in all subdirectories including:
     * - Root level (legacy)
     * - Feature folders (FS-XXX)
     * - Project folders
     * - Archive folders
     */
    private findUserStoryFiles;
    /**
     * Extract external_id and parent tracking info from a User Story file
     *
     * @param filePath - Path to User Story markdown file
     * @returns External ID reference with parent info if found, null otherwise
     */
    private extractExternalIdFromFile;
    /**
     * Extract US-ID from file name or content
     */
    private extractUsIdFromFile;
    /**
     * Normalize external ID for consistent comparison
     *
     * Examples:
     * - "github#owner/repo#638" → "gh:owner/repo#638" (v0.29+ format with repo)
     * - "GH-#638" → "gh-638" (legacy)
     * - "GITHUB-638" → "gh-638" (legacy)
     * - "JIRA-PROJ-123" → "jira-proj-123"
     *
     * CRITICAL: v0.29+ format includes repo name to prevent cross-repo collisions
     */
    private normalizeExternalId;
    /**
     * Clear the cache (useful for testing or after imports)
     */
    clearCache(): void;
    /**
     * Get cache statistics
     */
    getCacheStats(): {
        enabled: boolean;
        size: number;
    };
}
/**
 * Check if an external ID exists (convenience function)
 *
 * @param externalId - External ID to check
 * @param specsDir - Living docs specs directory
 * @returns True if duplicate exists
 */
export declare function checkExistingExternalId(externalId: string, specsDir: string): Promise<boolean>;
//# sourceMappingURL=duplicate-detector.d.ts.map