/**
 * Quality Gate Service
 *
 * Executes quality gates (typecheck, tests, build, lint) to verify
 * code quality before task completion.
 *
 * @module services/quality/quality-gate.service
 */
import { QualityGate, GateConfig, GateResult, GateRunResults } from '../../types/quality-gate.types.js';
/**
 * Options for running gates
 */
export interface RunOptions {
    /** Run only specific gates by name */
    gateNames?: string[];
    /** Skip optional gates */
    skipOptional?: boolean;
    /** Override parallel execution setting */
    parallel?: boolean;
    /** Override overall timeout */
    timeout?: number;
}
/**
 * Interface for the QualityGateService
 */
export interface IQualityGateService {
    /**
     * Load gate configuration from project or use defaults
     *
     * @param projectPath - Path to project directory
     * @returns Gate configuration
     */
    loadConfig(projectPath: string): Promise<GateConfig>;
    /**
     * Run all gates according to configuration
     *
     * @param projectPath - Path to project directory
     * @param options - Run options
     * @returns Complete run results
     */
    runAllGates(projectPath: string, options?: RunOptions): Promise<GateRunResults>;
    /**
     * Run a single gate
     *
     * @param gate - Gate definition
     * @param projectPath - Path to project directory
     * @returns Gate result
     */
    runGate(gate: QualityGate, projectPath: string): Promise<GateResult>;
    /**
     * Run typecheck gate
     *
     * @param projectPath - Path to project directory
     * @returns Gate result
     */
    runTypecheck(projectPath: string): Promise<GateResult>;
    /**
     * Run tests gate
     *
     * @param projectPath - Path to project directory
     * @returns Gate result
     */
    runTests(projectPath: string): Promise<GateResult>;
    /**
     * Run lint gate
     *
     * @param projectPath - Path to project directory
     * @returns Gate result
     */
    runLint(projectPath: string): Promise<GateResult>;
    /**
     * Run build gate
     *
     * @param projectPath - Path to project directory
     * @returns Gate result
     */
    runBuild(projectPath: string): Promise<GateResult>;
    /**
     * Get the default gate configuration
     *
     * @returns Default gate config
     */
    getDefaultConfig(): GateConfig;
    /**
     * Check if project has custom gate configuration
     *
     * @param projectPath - Path to project directory
     * @returns True if custom config exists
     */
    hasProjectConfig(projectPath: string): Promise<boolean>;
}
/**
 * Service for running quality gates on code changes
 *
 * @example
 * ```typescript
 * const service = QualityGateService.getInstance();
 * const results = await service.runAllGates('/path/to/project');
 * if (results.allRequiredPassed) {
 *   console.log('All gates passed!');
 * }
 * ```
 */
export declare class QualityGateService implements IQualityGateService {
    private static instance;
    private readonly logger;
    /**
     * Private constructor for singleton pattern
     */
    private constructor();
    /**
     * Gets the singleton instance
     *
     * @returns The QualityGateService instance
     */
    static getInstance(): QualityGateService;
    /**
     * Clears the singleton instance (for testing)
     */
    static clearInstance(): void;
    /**
     * Load gate configuration from project or use defaults
     *
     * @param projectPath - Path to project directory
     * @returns Gate configuration
     */
    loadConfig(projectPath: string): Promise<GateConfig>;
    /**
     * Run all gates according to configuration
     *
     * @param projectPath - Path to project directory
     * @param options - Run options
     * @returns Complete run results
     */
    runAllGates(projectPath: string, options?: RunOptions): Promise<GateRunResults>;
    /**
     * Run a single gate
     *
     * @param gate - Gate definition
     * @param projectPath - Path to project directory
     * @returns Gate result
     */
    runGate(gate: QualityGate, projectPath: string): Promise<GateResult>;
    /**
     * Spawn a command in a new process group so the entire process tree
     * (including vitest workers) can be killed on timeout or cancellation.
     *
     * @param command - Shell command to execute
     * @param cwd - Working directory
     * @param env - Environment variables
     * @param timeout - Timeout in milliseconds
     * @returns Exit code, stdout, and stderr
     */
    private spawnWithProcessGroup;
    /**
     * Run typecheck gate with default settings
     *
     * @param projectPath - Path to project directory
     * @returns Gate result
     */
    runTypecheck(projectPath: string): Promise<GateResult>;
    /**
     * Run tests gate with default settings
     *
     * @param projectPath - Path to project directory
     * @returns Gate result
     */
    runTests(projectPath: string): Promise<GateResult>;
    /**
     * Run lint gate with default settings
     *
     * @param projectPath - Path to project directory
     * @returns Gate result
     */
    runLint(projectPath: string): Promise<GateResult>;
    /**
     * Run build gate with default settings
     *
     * @param projectPath - Path to project directory
     * @returns Gate result
     */
    runBuild(projectPath: string): Promise<GateResult>;
    /**
     * Get the default gate configuration
     *
     * @returns Default gate config
     */
    getDefaultConfig(): GateConfig;
    /**
     * Check if project has custom gate configuration
     *
     * @param projectPath - Path to project directory
     * @returns True if custom config exists
     */
    hasProjectConfig(projectPath: string): Promise<boolean>;
    /**
     * Check if a gate should run based on branch patterns
     *
     * @param gate - Gate definition
     * @param currentBranch - Current git branch name
     * @returns Whether the gate should run
     */
    shouldRunGate(gate: QualityGate, currentBranch: string): boolean;
    /**
     * Get the current git branch
     *
     * @param projectPath - Path to project directory
     * @returns Current branch name or 'unknown'
     */
    private getCurrentBranch;
    /**
     * Truncate output to maximum length
     *
     * @param output - Output to truncate
     * @param maxLength - Maximum length (default: MAX_GATE_OUTPUT_LENGTH)
     * @returns Truncated output
     */
    private truncateOutput;
    /**
     * Validate and normalize gate configuration
     *
     * @param config - Raw configuration from YAML
     * @returns Normalized gate configuration
     */
    private validateConfig;
    /**
     * Calculate summary statistics from results
     *
     * @param results - Array of gate results
     * @returns Summary statistics
     */
    private calculateSummary;
}
//# sourceMappingURL=quality-gate.service.d.ts.map