import type { FailureAnalysis } from "@fjall/util/aws"; import { type ResourceEvent, type CloudFormationEventMonitor } from "../../aws/utils/cloudformationEvents.js"; import type { StepOutput } from "../../types/deployment/DeploymentTypes.js"; import type { Result } from "@fjall/generator"; import type { CdkOutput } from "./CdkService.js"; /** * Analyse CDK deploy output and classify the result as success/skip/failure. */ export declare function analyseDeployOutput(cdkOutput: string, result: Result, stackName: string): Result; /** * Compose the returned deploy error from the monitor's settled failure * analysis (Q12: the analysed root cause reaches the RETURNED error, not just * the `onFailureAnalysis` stream). The analysis is already masked at the * monitor boundary (`maskFailureAnalysis`). */ export declare function formatAnalysedDeployFailure(analysis: FailureAnalysis): string; /** * Classify a bootstrap error into a user-friendly message. */ export declare function analyseBootstrapError(errorInfo: string): string; /** * Analyse CDK destroy result and classify it. */ export declare function analyseDestroyResult(result: Result): Result; /** Result of attempting to detect a stack name from a CDK output chunk */ export interface StackDetectionResult { detected: boolean; stackName?: string; } /** * Try to detect the actual CloudFormation stack name from a CDK output chunk. * CDK outputs the stack name in several formats during deployment. */ export declare function detectStackNameFromChunk(chunk: string): StackDetectionResult; /** Mutable state container for deploy monitoring, to avoid closure complexity in CdkService */ export interface DeployMonitoringState { cdkOutput: string; actualStackName: string; /** * True when `actualStackName` came from the caller naming the stack exactly, * false when it is `getFallbackStackName`'s guess. Output detection may * correct a guess; it must never overrule a name the caller knew. */ stackNameIsAuthoritative: boolean; stackDetected: boolean; /** How long the stack's monitor watches: the deploy's own budget. */ monitoringBudgetMs: number; monitoringPromise: Promise<{ success: boolean; status?: string; failureReason?: string; logPath?: string; }> | null; } /** * Create an enhanced output callback that detects the actual stack name from CDK output * and starts CloudFormation monitoring once detected. */ export declare function createEnhancedOutputCallback(state: DeployMonitoringState, originalOutputCallback: ((chunk: string) => void) | undefined, cfnMonitor: CloudFormationEventMonitor | null, onResourceProgress: ((event: ResourceEvent) => void) | undefined): (chunk: string) => void;