/**
 * External Item Sync Service
 *
 * Handles synchronization with external tools (GitHub, JIRA, ADO) while
 * preserving original item format and preventing unintended modifications.
 *
 * Key Features:
 * - Comment-based updates for external items (format preservation)
 * - Full sync for internal items (title, description, ACs)
 * - Format preservation validation
 * - External title immutability
 *
 * Part of increment 0047-us-task-linkage (T-034B)
 */
import type { Logger } from '../utils/logger.js';
/**
 * Task completion data for sync
 */
export interface TaskCompletionData {
    /** Task ID (e.g., "T-034") */
    taskId: string;
    /** Feature ID (e.g., "FS-047") */
    featureId: string;
    /** User Story ID (e.g., "US-009") */
    usId: string;
    /** Acceptance criteria satisfied by this task */
    satisfiesACs: string[];
    /** Completed tasks count */
    completedTasks: number;
    /** Total tasks count */
    totalTasks: number;
    /** Completion percentage */
    percentage: number;
    /** Living docs URL */
    livingDocsUrl?: string;
    /** Task title */
    taskTitle: string;
    /** Task status */
    status: 'completed' | 'in_progress' | 'pending';
}
/**
 * Sync options
 */
export interface SyncOptions {
    /** Project root directory */
    projectRoot: string;
    /** External tool (github, jira, ado) */
    externalTool?: 'github' | 'jira' | 'ado';
    /** Force full sync (ignore format_preservation flag) */
    forceFullSync?: boolean;
    /** Dry run (don't actually sync, just log what would happen) */
    dryRun?: boolean;
    /** Logger instance */
    logger?: Logger;
}
/**
 * Sync result
 */
export interface SyncResult {
    /** Success flag */
    success: boolean;
    /** Sync mode used */
    mode: 'comment-only' | 'full-sync' | 'skipped';
    /** Reason for mode selection */
    reason: string;
    /** Comment posted (if comment-only mode) */
    comment?: string;
    /** Fields updated (if full-sync mode) */
    updatedFields?: string[];
    /** Error message (if failed) */
    error?: string;
}
/**
 * External Item Sync Service
 *
 * Routes sync operations based on format_preservation flag.
 * External items (format_preservation=true) → comment-only sync
 * Internal items (format_preservation=false) → full sync
 */
export declare class ExternalItemSyncService {
    private logger;
    private validator;
    constructor(options?: {
        logger?: Logger;
    });
    /**
     * Sync task completion to external tool
     *
     * Routes to comment-only or full sync based on format_preservation flag
     *
     * @param completionData - Task completion data
     * @param options - Sync options
     * @returns Sync result
     */
    syncTaskCompletion(completionData: TaskCompletionData, options: SyncOptions): Promise<SyncResult>;
    /**
     * Get format_preservation flag from living docs User Story file
     *
     * @param usId - User Story ID (e.g., "US-009")
     * @param featureId - Feature ID (e.g., "FS-047")
     * @param projectRoot - Project root directory
     * @returns True if format preservation enabled
     */
    private getFormatPreservation;
    /**
     * Find User Story file in living docs
     *
     * @param projectRoot - Project root
     * @param featureId - Feature ID (e.g., "FS-047")
     * @param usId - User Story ID (e.g., "US-009")
     * @returns Path to US file or null if not found
     */
    private findUSFile;
    /**
     * Get all project directories in specs
     *
     * @param specsDir - Specs directory
     * @returns Array of project directory paths
     */
    private getProjectDirs;
    /**
     * Get User Story file frontmatter (for external issue links)
     *
     * @param usId - User Story ID (e.g., "US-009")
     * @param featureId - Feature ID (e.g., "FS-047")
     * @param projectRoot - Project root directory
     * @returns Parsed frontmatter or null
     */
    private getUsFileFrontmatter;
    /**
     * Comment-only sync: Post completion update as comment
     *
     * Does NOT modify external item title, description, or acceptance criteria.
     * Only posts a comment with task completion status.
     *
     * @param completionData - Task completion data
     * @param options - Sync options
     * @returns Sync result
     */
    private commentOnlySync;
    /**
     * Full sync: Update external item title, description, ACs
     *
     * Used for internal items or when format preservation disabled.
     *
     * @param completionData - Task completion data
     * @param options - Sync options
     * @returns Sync result
     */
    private fullSync;
    /**
     * Format completion comment for external tool
     *
     * @param data - Task completion data
     * @returns Formatted comment
     */
    private formatCompletionComment;
}
//# sourceMappingURL=external-item-sync-service.d.ts.map