import type { MicroserviceDefinition } from '../../../lib/runtime-web/types/microservice.types';
/**
 * Common error hints for CDK stack parsing failures.
 */
export declare const CDK_PARSE_ERROR_HINTS: {
    readonly SYNTAX_ERROR: "Check for syntax errors in your CDK entry point file. Ensure all imports are valid and TypeScript syntax is correct.";
    readonly MISSING_ENTRY_POINT: "No CDK entry point found. Create a CDK app file at one of: cdk/bin/app.ts, bin/app.ts, or src/infra/app.ts";
    readonly MISSING_IMPORTS: "Ensure @worktif/runtime/infra is installed and RuntimeWebStack is imported correctly.";
    readonly CIRCULAR_DEPENDENCY: "Circular dependency detected. Check your import statements for circular references.";
    readonly MISSING_REGISTER: "RuntimeWebStack was found but no register prop was provided. Add register: { ... } to your RuntimeWebStack props.";
    readonly EXECUTION_ERROR: "Failed to execute CDK bundle. This may be due to runtime errors in your CDK code or missing dependencies.";
    readonly PERMISSION_ERROR: "Permission denied when accessing CDK files. Check file permissions.";
    readonly INVALID_JSON: "Invalid JSON in microservice definition. Ensure all register values are valid objects.";
};
/**
 * Error class for CDK stack parsing failures.
 *
 * Includes helpful hints for common issues to guide users toward resolution.
 */
export declare class CdkStackParseError extends Error {
    readonly cause?: Error | undefined;
    readonly hint?: string | undefined;
    readonly errorCode?: keyof typeof CDK_PARSE_ERROR_HINTS | undefined;
    constructor(message: string, cause?: Error | undefined, hint?: string | undefined, errorCode?: keyof typeof CDK_PARSE_ERROR_HINTS | undefined);
    /**
     * Create a formatted error message including the hint.
     */
    toFormattedString(): string;
}
/**
 * Configuration for CdkStackParser.
 */
export interface CdkStackParserConfig {
    /** Project root directory */
    readonly projectRoot: string;
    /** CDK directory relative to project root (default: 'cdk') */
    readonly cdkDir?: string;
    /** Enable verbose logging */
    readonly verbose?: boolean;
}
/**
 * Result of extracting microservices from CDK stack.
 */
export interface CdkStackParseResult {
    /** Extracted microservice definitions */
    readonly microservices: Record<string, MicroserviceDefinition>;
    /** Number of microservices extracted */
    readonly microserviceCount: number;
    /** Names of extracted microservices */
    readonly microserviceNames: string[];
    /** Source CDK file path */
    readonly sourcePath: string;
    /** Whether extraction was successful */
    readonly success: boolean;
}
/**
 * CDK Stack Parser for extracting microservice definitions.
 *
 * Parses CDK stack files to extract RuntimeWebStack props containing
 * microservice definitions. This is used as a fallback when loadRuntimeConfig()
 * returns zero microservices.
 *
 * @example
 * ```typescript
 * const parser = new CdkStackParser({
 *   projectRoot: process.cwd(),
 *   cdkDir: 'cdk',
 * });
 *
 * const result = await parser.parse();
 * if (result.success) {
 *   console.log('Extracted microservices:', result.microserviceNames);
 * }
 * ```
 */
export declare class CdkStackParser {
    private readonly config;
    constructor(config: CdkStackParserConfig);
    /**
     * Parse CDK stack files to extract microservice definitions.
     *
     * Searches for CDK entry points in common locations, transpiles them,
     * and extracts RuntimeWebStack props containing register definitions.
     *
     * @returns Extracted microservice definitions or empty result if not found
     */
    parse(): Promise<CdkStackParseResult>;
    /**
     * Find CDK entry point in common locations.
     *
     * Searches through standard CDK entry point locations and returns
     * the first one found. Logs a warning if no entry point is found.
     *
     * @returns Absolute path to CDK entry point, or null if not found
     */
    private findCdkEntryPoint;
    /**
     * Transpile CDK entry point with esbuild.
     *
     * Creates a CommonJS bundle that can be analyzed for RuntimeWebStack props.
     *
     * @param entryPath - Absolute path to the CDK entry point
     * @returns Path to the transpiled bundle
     * @throws CdkStackParseError if transpilation fails
     */
    private transpileCdkEntryPoint;
    /**
     * Extract microservice definitions from transpiled CDK bundle.
     *
     * Uses AST-like analysis to find RuntimeWebStack instantiations
     * and extract their register props.
     *
     * @param bundlePath - Path to the transpiled bundle
     * @returns Extracted microservice definitions
     */
    private extractMicroservicesFromBundle;
    /**
     * Extract register object from bundle content using regex patterns.
     *
     * This is a lightweight approach that doesn't require executing the bundle.
     */
    private extractRegisterFromBundleContent;
    /**
     * Extract microservices by executing the bundle with mocked CDK.
     *
     * Creates mock implementations of CDK constructs that capture
     * RuntimeWebStack props.
     *
     * @param bundlePath - Path to the transpiled bundle
     * @returns Extracted microservice definitions (empty object on failure)
     */
    private extractByExecution;
    /**
     * Create an empty result.
     */
    private emptyResult;
    /**
     * Log message if verbose mode is enabled.
     */
    private log;
    /**
     * Log warning message.
     *
     * Warnings are always logged (not just in verbose mode) because they
     * indicate potential issues that users should be aware of.
     * However, warnings do NOT block deployment - they are informational only.
     */
    private logWarning;
}
/**
 * Extract microservice definitions from CDK stack files.
 *
 * Convenience function for extracting microservices without creating a parser instance.
 * This is the primary entry point for the fallback mechanism in buildMicroserviceBundlesForDeploy().
 *
 * @param projectRoot - Project root directory
 * @param cdkDir - CDK directory relative to project root (default: 'cdk')
 * @param verbose - Enable verbose logging
 * @returns Extracted microservice definitions
 *
 * @example
 * ```typescript
 * const result = await extractMicroservicesFromCdkStack(process.cwd(), 'cdk', false);
 * if (result.success) {
 *   console.log('Found microservices in CDK stack:', result.microserviceNames);
 * }
 * ```
 */
export declare function extractMicroservicesFromCdkStack(projectRoot: string, cdkDir?: string, verbose?: boolean): Promise<CdkStackParseResult>;
