/**
 * Sync Coordinator (T-034E)
 *
 * High-level coordinator that integrates FormatPreservationSyncService
 * with living docs sync workflow. Called by post-task-completion hook.
 */
import { Logger } from '../utils/logger.js';
import { ResolvedAdoProfile } from '../integrations/ado/ado-client-factory.js';
import { ClosureMetrics } from './closure-metrics.js';
import type { SpecWeaveConfig } from '../core/config/types.js';
export { isProviderEnabled } from './status-mapper.js';
export interface SyncCoordinatorOptions {
    projectRoot: string;
    incrementId: string;
    logger?: Logger;
    /**
     * Resolved ADO profile for multi-project sync support
     * If provided, used for ADO sync operations instead of global credentials
     */
    adoProfile?: ResolvedAdoProfile;
}
export interface SyncResult {
    success: boolean;
    userStoriesSynced: number;
    syncMode: 'comment-only' | 'full-sync' | 'read-only' | 'manual-only' | 'living-docs-only' | 'external-disabled';
    errors: string[];
}
export declare class SyncCoordinator {
    private projectRoot;
    private incrementId;
    private logger;
    private frontmatterUpdater;
    private projectId;
    private adoProfile?;
    private metrics;
    private providerRouter;
    private retryQueue?;
    constructor(options: SyncCoordinatorOptions);
    /**
     * Get closure sync metrics summary
     *
     * Returns aggregated metrics for all external tool closure operations.
     * Useful for monitoring and alerting on sync health.
     */
    getClosureMetrics(): ReturnType<ClosureMetrics['getSummary']>;
    /**
     * Get formatted closure metrics for display
     */
    getFormattedClosureMetrics(): string;
    /**
     * @deprecated (0348) GitHub issue creation now handled by GitHubFeatureSync via LivingDocsSync chain.
     */
    createGitHubIssuesForUserStories(_config: SpecWeaveConfig): Promise<any[]>;
    /**
     * @deprecated (0348) GitHub closure now handled by GitHubFeatureSync via LivingDocsSync chain.
     */
    closeGitHubIssuesForUserStories(_config: SpecWeaveConfig): Promise<number[]>;
    /**
     * Close JIRA issues for completed user stories
     *
     * Transitions JIRA issues to "Done" status when increment is completed.
     * Reads issue references from four fallback sources (0696 hotfix):
     *   1. per-US frontmatter `external_tools.jira.key`
     *   2. per-US `external_id`
     *   3. `metadata.jira.issue` (legacy)
     *   4. `metadata.externalLinks.jira.epicKey` (current standard)
     *
     * @param config - Project config with JIRA settings
     * @param errorsOut - Optional sink for per-issue error messages (0696)
     * @returns Number of closed JIRA issues
     */
    closeJiraIssuesForUserStories(config: SpecWeaveConfig, errorsOut?: string[]): Promise<number>;
    /**
     * Close ADO work items for completed user stories
     *
     * Transitions ADO work items to "Closed" state when increment is completed.
     * Reads work item references from four fallback sources (0696 hotfix):
     *   1. per-US frontmatter `external_tools.ado.id`
     *   2. per-US `external_id`
     *   3. `metadata.external_tools.ado.id` / `metadata.ado.work_item_id` (legacy)
     *   4. `metadata.externalLinks.ado.workItemId` / `.featureId` (current standard)
     *
     * @param config - Project config with ADO settings
     * @param errorsOut - Optional sink for per-item error messages (0696)
     * @returns Number of closed ADO work items
     */
    closeAdoWorkItemsForUserStories(config: SpecWeaveConfig, errorsOut?: string[]): Promise<number>;
    /**
     * Sync increment closure to external tools (NEW in v0.28.1)
     *
     * This method is called when an increment is marked as "completed".
     * It handles the complete closure flow including:
     * - Creating any missing GitHub issues (idempotent)
     * - Closing all User Story GitHub issues
     * - Syncing final status to external tools
     *
     * CRITICAL: This was the missing piece causing issues to stay open!
     *
     * @returns SyncResult with closure details
     */
    syncIncrementClosure(): Promise<SyncResult & {
        closedIssues: number[];
    }>;
    /**
     * Sync increment completion to external tools using format preservation
     */
    syncIncrementCompletion(): Promise<SyncResult>;
    /**
     * Sync individual user story
     */
    private syncUserStory;
    /**
     * Load completion data for user story
     */
    private loadCompletionData;
    /**
     * Load user stories affected by this increment
     */
    private loadUserStoriesForIncrement;
    /**
     * Parse user stories from spec.md content when living docs folder is missing
     * FIX (v1.0.302 / 0271): Fallback for when living docs haven't been synced yet
     * Uses the same regex approach as ExternalIssueAutoCreator.parseUserStories()
     */
    private parseUserStoriesFromSpec;
    /**
     * Shared retry queue for terminal external-write failures during closure.
     * Lazily created so test/no-op paths don't touch the filesystem.
     * (0865 T-007 — the queue used to be structurally always-empty.)
     */
    private getRetryQueue;
    /**
     * Best-effort feature ID for retry-queue jobs (derived from the increment ID).
     */
    private retryFeatureId;
    /**
     * Load config
     */
    private loadConfig;
    /**
     * Detect GitHub repository from config or git
     * Delegates to ProviderRouter
     */
    private detectGitHubRepo;
    /**
     * Format completion comment for ADO work item
     */
    private formatAdoCompletionComment;
    /**
     * Format completion comment for JIRA issue
     *
     * Uses plain text with emoji (not JIRA wiki markup) because JiraClient.addComment()
     * wraps content in ADF paragraph format where wiki syntax doesn't render.
     * Emoji checkmarks work in both plain text and ADF contexts.
     */
    private formatJiraCompletionComment;
}
//# sourceMappingURL=sync-coordinator.d.ts.map