/**
 * Doctor core module — proactive server health analysis.
 *
 * All 7 check functions are pure (no I/O). The orchestrator runServerDoctor
 * handles I/O (SSH, file cache) and delegates to the pure functions.
 */
import type { MetricSnapshot, KastellResult } from "../types/index.js";
import type { AuditHistoryEntry } from "./audit/types.js";
export type DoctorSeverity = "critical" | "warning" | "info";
export declare const DOCTOR_SEVERITY_WEIGHTS: Record<DoctorSeverity, number>;
export interface DoctorFinding {
    id: string;
    severity: DoctorSeverity;
    description: string;
    command: string;
    fixCommand?: string;
    weight: number;
}
export declare function computeDoctorScore(findings: DoctorFinding[]): number;
export interface DoctorResult {
    serverName: string;
    serverIp: string;
    findings: DoctorFinding[];
    ranAt: string;
    usedFreshData: boolean;
    score: number;
}
/** Path to the local per-server metrics history file */
export declare function metricsHistoryPath(serverIp: string): string;
/** Load cached MetricSnapshot history for a server. Returns [] on missing/corrupt file. */
export declare function loadMetricsHistory(serverIp: string): MetricSnapshot[];
/** Append a new snapshot to the local history and persist atomically. */
export declare function saveMetricsHistory(serverIp: string, snapshots: MetricSnapshot[]): void;
/**
 * DOC-02: Disk trend — linear extrapolation from 2+ MetricSnapshot data points.
 * Projects when root filesystem will reach 95% full.
 */
export declare function checkDiskTrend(snapshots: MetricSnapshot[], serverName: string): DoctorFinding | null;
/**
 * DOC-03: High swap usage.
 * Input: output of `free | awk '/Swap:/{if($2>0) printf "%.0f", $3/$2*100; else print "0"}'`
 */
export declare function checkSwapUsage(swapOutput: string): DoctorFinding | null;
/**
 * DOC-03: Stale packages — count of upgradable packages from apt.
 * Input: output of `apt list --upgradable 2>/dev/null` (subtract 1 for header line).
 */
export declare function checkStalePackages(aptOutput: string): DoctorFinding | null;
/**
 * DOC-03: High fail2ban ban rate — total bans across all jails.
 * Input: output of combined fail2ban-client status pipeline.
 */
export declare function checkFail2banBanRate(fail2banOutput: string): DoctorFinding | null;
/**
 * DOC-04: Audit regression streak — 2+ consecutive audit score drops.
 */
export declare function checkAuditRegressionStreak(history: AuditHistoryEntry[], serverName: string): DoctorFinding | null;
/**
 * DOC-04: Backup age — days since last kastell backup log entry.
 * Input: output of `tail -1 /var/log/kastell-backup.log 2>/dev/null` (ISO timestamp).
 */
export declare function checkBackupAge(backupLogOutput: string, serverName: string): DoctorFinding | null;
/**
 * DOC-05: Docker reclaimable disk space.
 * Input: output of `docker system df --format '{{json .}}'` (one JSON object per line).
 * Parses the Reclaimable field from each line and sums total GB.
 */
export declare function checkDockerDisk(dockerDfOutput: string): DoctorFinding | null;
/**
 * DOC-01: Run proactive server health analysis.
 *
 * Default (fresh=false): reads cached metrics + local audit history, no SSH.
 * With fresh=true: SSHes to collect a live MetricSnapshot and live probe data.
 */
export declare function runServerDoctor(ip: string, serverName: string, options: {
    fresh?: boolean;
}): Promise<KastellResult<DoctorResult>>;
//# sourceMappingURL=doctor.d.ts.map