export type CheckStatus = 'pass' | 'warn' | 'fail' | 'skip'; export interface CheckResult { id: string; label: string; status: CheckStatus; detail: string; hint?: string; /** Whether `applySafeFixes` can repair this issue idempotently. */ fixable?: boolean; } export interface DoctorSection { title: string; checks: CheckResult[]; } export interface DoctorReport { sections: DoctorSection[]; counts: { pass: number; warn: number; fail: number; skip: number; }; /** True when no check failed (warnings/skips do not break ok). */ ok: boolean; } export interface DoctorPaths { DATA_DIR: string; CONFIG_DIR: string; STORE_DIR: string; } /** Read-only environment probes — the diagnostic path never writes. */ export interface DoctorDeps { env: Record; paths: DoctorPaths; homeDir: string; nodeVersion: string; requiredNodeMajor: number; fileExists(p: string): boolean; isWritable(p: string): boolean; readText(p: string): string | null; parseDotenv(text: string): Record; commandExists(bin: string): boolean; pidAlive(pid: number): boolean; probeGateway(): Promise; } /** Write actuators used only by `applySafeFixes` (idempotent, non-destructive). */ export interface FixActuators { mkdirp(p: string): void; ensureEnvFile(envPath: string): void; /** Generate any missing auth tokens, persist to envPath; return names generated. */ ensureAuthTokens(envPath: string): string[]; regenerateMcpConfig(): void; } export interface FixOutcome { id: string; label: string; applied: boolean; detail: string; } export declare function runDiagnostics(deps: DoctorDeps): Promise; export declare function applySafeFixes(report: DoctorReport, deps: DoctorDeps, fix: FixActuators): Promise; export declare function createDefaultDoctorDeps(): DoctorDeps; export declare function createDefaultFixActuators(): FixActuators;