/**
 * System health checks core module.
 * @task T4783
 * @task T4795
 */
import type { DependencyReport } from '@cleocode/contracts';
import { type SystemInfo } from '../platform.js';
export interface HealthCheck {
    name: string;
    status: 'pass' | 'warn' | 'fail';
    message?: string;
}
export interface HealthResult {
    overall: 'healthy' | 'warning' | 'error';
    checks: HealthCheck[];
    version: string;
    installation: 'ok' | 'degraded';
}
export interface DiagnosticsCheck {
    name: string;
    status: 'pass' | 'warn' | 'fail';
    details?: string;
    fix?: string;
}
export interface DiagnosticsResult {
    timestamp: string;
    checks: DiagnosticsCheck[];
    summary: {
        total: number;
        passed: number;
        warned: number;
        failed: number;
    };
}
/** Run system health checks (SQLite-first per ADR-006). */
export declare function getSystemHealth(projectRoot: string, opts?: {
    detailed?: boolean;
}): Promise<HealthResult>;
/** Run extended diagnostics with fix suggestions. */
export declare function getSystemDiagnostics(projectRoot: string, opts?: {
    checks?: string[];
}): Promise<DiagnosticsResult>;
export interface DoctorCheck {
    check: string;
    status: 'ok' | 'error' | 'warning';
    message: string;
    details?: Record<string, unknown>;
    fix?: string;
}
export interface DoctorReport {
    healthy: boolean;
    errors: number;
    warnings: number;
    checks: DoctorCheck[];
    /** Dependency registry report — populated by `checkAllDependencies()`. */
    dependencies?: DependencyReport;
}
/**
 * Run comprehensive doctor diagnostics combining dependency checks,
 * directory checks, data file checks, gitignore checks, and environment info.
 * @task T4795
 */
export declare function coreDoctorReport(projectRoot: string): Promise<DoctorReport>;
export interface FixResult {
    check: string;
    action: 'fixed' | 'skipped' | 'failed';
    message: string;
}
/**
 * Run auto-fix for failed doctor checks by calling the corresponding ensure* functions.
 * Returns a list of fix results for each attempted repair.
 */
export declare function runDoctorFixes(projectRoot: string): Promise<FixResult[]>;
/**
 * Outcome of a startup health check. Tells the caller exactly what state
 * the system is in so it can route to init, upgrade, or proceed normally.
 */
export type StartupState = 'healthy' | 'needs_init' | 'needs_upgrade';
export interface StartupHealthCheck {
    check: string;
    status: 'pass' | 'warn' | 'fail';
    message: string;
    repaired?: boolean;
}
export interface StartupHealthResult {
    /** Overall system state after health check + auto-repair. */
    state: StartupState;
    /** True if the global ~/.cleo scaffold is healthy (after auto-repair). */
    globalHealthy: boolean;
    /** True if the project .cleo/ scaffold is present and healthy. */
    projectHealthy: boolean;
    /** Individual check results for logging/diagnostics. */
    checks: StartupHealthCheck[];
    /** Checks that failed and could not be auto-repaired. */
    failures: StartupHealthCheck[];
    /** Host system snapshot for diagnostics, error reports, and logging. */
    system: SystemInfo;
}
/**
 * Unified startup health check for CLI entry points.
 *
 * This is the single entry point for startup diagnostics. It follows a
 * three-phase approach:
 *
 * Phase 1: Global scaffold (~/.cleo/) — always auto-repaired.
 *   The global home is CLEO infrastructure, not project data. It is safe
 *   to create/repair unconditionally on every startup.
 *
 * Phase 2: Project detection — determines if this is an initialized project.
 *   Uses isProjectInitialized() from paths.ts as the SSoT for detection.
 *
 * Phase 3: Project health — lightweight checks on the project scaffold.
 *   If the project is initialized, runs check* functions to detect drift.
 *   Auto-repairs safe items (missing subdirs via ensureCleoStructure).
 *   Flags items requiring full upgrade (missing DB, config issues).
 *
 * Design principles:
 *   - SSoT: All checks delegate to scaffold.ts check* functions
 *   - DRY: No duplicated health-check logic
 *   - SRP: This function only diagnoses and does safe auto-repair
 *   - Graceful: Never throws. All errors are captured as check results.
 *   - Logged: Returns structured results for the caller to log via pino
 *
 * @param projectRoot - Absolute path to the project root (defaults to cwd)
 */
export declare function startupHealthCheck(projectRoot?: string): Promise<StartupHealthResult>;
//# sourceMappingURL=health.d.ts.map