/**
 * Status Change Sync Trigger
 *
 * Automatically triggers living docs and GitHub sync when increment status changes.
 *
 * WHY THIS EXISTS:
 * - Users expect GitHub issues to update automatically when work starts/completes
 * - Manual `sw:sync-progress` is friction
 * - Task completion hook only fires on task changes, not status changes
 *
 * SAFETY GUARDS:
 * - Non-blocking: Uses setTimeout to prevent blocking updateStatus()
 * - Circuit breaker: Prevents sync storms when GitHub is down
 * - Error isolation: Sync failures don't crash status updates
 * - Selective: Only syncs for meaningful transitions
 *
 * ARCHITECTURE:
 * ```
 * MetadataManager.updateStatus()
 *   └─> StatusChangeSyncTrigger.triggerIfNeeded()
 *         ├─ Is transition sync-worthy?
 *         ├─ Circuit breaker open?
 *         ├─> Auto-create issues if missing (v1.0.19+)
 *         ├─> LivingDocsSync.syncIncrement()
 *         └─> Auto-close issues on completion (v1.0.19+)
 * ```
 *
 * v1.0.19 ADDITIONS:
 * - Auto-create external issues if config.sync.autoCreateOnIncrement = true
 * - Auto-close external issues when status → completed
 */
import { IncrementStatus } from '../types/increment-metadata.js';
import { Logger } from '../../utils/logger.js';
export declare class StatusChangeSyncTrigger {
    private static circuitBreaker;
    private static logger;
    /**
     * When true, triggerIfNeeded() is a no-op.
     * Set by completeIncrement() to prevent double-sync:
     * onIncrementDone() is the single sync point during completion.
     */
    static suppressForCompletion: boolean;
    /**
     * Trigger sync if status transition warrants it
     *
     * NON-BLOCKING: Spawns async sync, doesn't wait for result
     * SAFE: Errors are caught and logged, never thrown
     *
     * @param incrementId - Increment ID
     * @param oldStatus - Previous status
     * @param newStatus - New status
     */
    static triggerIfNeeded(incrementId: string, oldStatus: IncrementStatus, newStatus: IncrementStatus): Promise<void>;
    /**
     * Check if increment has missing feature_id (living docs not synced)
     * AND spec.md exists (required for sync to work)
     *
     * CRITICAL FIX (2025-11-24): Also check spec.md exists
     * In single-prompt scenarios, feature_id may be null because spec.md
     * doesn't exist yet. We should only force sync if spec.md is ready.
     *
     * @param incrementId - Increment ID
     * @returns true if feature_id is null/undefined AND spec.md exists
     */
    private static hasMissingFeatureId;
    /**
     * Check if status transition needs sync
     *
     * SYNC-WORTHY TRANSITIONS:
     * - planning → active (work started)
     * - active → completed (work finished - legacy direct completion)
     * - active → ready_for_review (all tasks complete, ready for user confirmation)
     * - ready_for_review → completed (work approved - v0.28.63+ user confirmation)
     * - completed → active (work reopened)
     * - backlog → active (backlog item started)
     * - paused → active (work resumed)
     *
     * NOT SYNC-WORTHY:
     * - active → paused (temporary pause)
     * - active → backlog (deprioritized)
     * - Any → abandoned (cancelled)
     *
     * @param oldStatus - Previous status
     * @param newStatus - New status
     * @returns true if sync should be triggered
     */
    private static isSyncWorthy;
    /**
     * Spawn async sync (non-blocking)
     *
     * Uses setTimeout(..., 0) to ensure updateStatus() returns immediately.
     * LivingDocsSync will handle GitHub/JIRA/ADO sync based on config.
     *
     * v1.0.19: Also handles auto-create if issues don't exist
     *
     * @param incrementId - Increment ID
     * @param newStatus - Optional new status (for completion handling)
     */
    private static spawnAsyncSync;
    /**
     * Read sync.mode from config.json.
     * Returns 'queued' (default) or 'immediate' (legacy).
     */
    private static getSyncMode;
    /**
     * Auto-create external issues if:
     * 1. config.sync.autoCreateOnIncrement = true
     * 2. No external issue linked to this increment
     *
     * @since v1.0.19
     */
    /**
     * (0348) GitHub issue creation is handled by LivingDocsSync → GitHubFeatureSync chain
     * (called at line 203 via syncIncrement). This method now only handles JIRA/ADO.
     */
    private static autoCreateIfNeeded;
    /**
     * Auto-close external issues when increment status becomes COMPLETED
     *
     * (0348) GitHub closure is handled by GitHubFeatureSync via LivingDocsSync chain
     * at line 203. SyncCoordinator.syncIncrementClosure() now only handles JIRA/ADO.
     *
     * @since v1.0.19
     */
    private static autoCloseExternalIssues;
    /**
     * Get circuit breaker state (for diagnostics)
     */
    static getCircuitBreakerState(): import("./sync-circuit-breaker.js").CircuitBreakerState;
    /**
     * Reset circuit breaker (for testing/admin)
     */
    static resetCircuitBreaker(): void;
    /**
     * Set custom logger (for testing)
     */
    static setLogger(logger: Logger): void;
}
//# sourceMappingURL=status-change-sync-trigger.d.ts.map