/**
 * Provider-Agnostic AC Progress Sync
 *
 * Routes AC completion events to all enabled providers (GitHub, JIRA, ADO)
 * using a simple function-map pattern. No adapter classes, no orchestrator.
 *
 * GitHub: delegates to existing 0193 modules (postACProgressComments + autoCloseCompletedUserStories)
 * JIRA: calls JiraStatusSync for comments and transitions
 * ADO: calls AdoClient for comments, AdoStatusSync for state transitions
 *
 * @module ac-progress-sync
 */
import { type ACState } from './ac-checkbox-formatter.js';
import type { SyncProvider } from './types/sync-profile.js';
export interface ACProgressSyncConfig {
    sync: {
        github?: {
            enabled?: boolean;
        };
        jira?: {
            enabled?: boolean;
        };
        ado?: {
            enabled?: boolean;
        };
    };
    github?: {
        owner?: string;
        repo?: string;
        token?: string;
    };
    jira?: {
        domain?: string;
        email?: string;
        apiToken?: string;
        projectKey?: string;
    };
    ado?: {
        organization?: string;
        project?: string;
        pat?: string;
    };
    externalLinks?: {
        github?: {
            issues?: Record<string, {
                issueNumber: number;
                issueUrl: string;
                status?: string;
            }>;
        };
        jira?: {
            userStories?: Record<string, {
                issueKey: string;
                issueUrl: string;
                syncedAt?: string;
            }>;
        };
        ado?: {
            userStories?: Record<string, {
                workItemId: number;
                workItemUrl: string;
                syncedAt?: string;
            }>;
        };
    };
}
export interface ProviderSyncResult {
    posted: Array<{
        usId: string;
        ref: string;
    }>;
    closed: Array<{
        usId: string;
        ref: string;
    }>;
    skipped: Array<{
        usId: string;
        reason: string;
    }>;
    errors: Array<{
        usId: string;
        error: string;
    }>;
}
export type ACProgressSyncResult = Partial<Record<SyncProvider, ProviderSyncResult>>;
export interface ACProgressContext {
    specPath: string;
    specContent: string;
    userStories: Map<string, {
        acStates: ACState[];
    }>;
}
/**
 * Sync AC progress to all enabled providers.
 *
 * Reads config to determine which providers are enabled, then calls each
 * provider's sync function. Errors are isolated per provider.
 *
 * @param incrementId - The increment ID
 * @param affectedUSIds - User story IDs that have AC changes
 * @param specPath - Path to spec.md
 * @param config - Sync configuration with provider settings and external links
 * @returns Per-provider results with posted, closed, skipped, and errors
 */
export declare function syncACProgressToProviders(incrementId: string, affectedUSIds: string[], specPath: string, config: ACProgressSyncConfig): Promise<ACProgressSyncResult>;
/**
 * Close all external tool issues for a completed increment.
 *
 * Unlike syncACProgressToProviders (which operates on recently-changed US IDs),
 * this function parses ALL user story IDs from spec.md and attempts to close
 * their corresponding external issues. Used when increment status -> "completed".
 */
export declare function closeIncrementIssues(incrementId: string, specPath: string, config: ACProgressSyncConfig): Promise<ACProgressSyncResult>;
/**
 * Parse all user story IDs from spec.md content.
 * Matches patterns like "### US-001:", "### US-002:" etc.
 */
export declare function parseAllUserStoryIds(content: string): string[];
/**
 * Reset all circuit breakers (for testing only).
 */
export declare function resetCircuitBreakers(): void;
/**
 * Build AC progress context by parsing spec.md.
 *
 * Extracts AC states (id, description, completed) for each affected user story.
 */
export declare function buildACProgressContext(specPath: string, affectedUSIds: string[]): Promise<ACProgressContext>;
/**
 * Parse a US ID into its parts for AC matching.
 * Handles both simple (US-001) and compound (US-SPE-001) formats.
 *
 * US-001 → { prefix: undefined, num: 1 }
 * US-SPE-001 → { prefix: 'SPE', num: 1 }
 */
export declare function parseUSIdParts(usId: string): {
    prefix?: string;
    num: number;
};
/**
 * Build the AC ID prefix for a given US ID.
 * US-001 → "AC-US1-"
 * US-SPE-001 → "AC-SPE-US1-"
 */
export declare function buildACPrefix(usId: string): string;
//# sourceMappingURL=ac-progress-sync.d.ts.map