import type { DoctorReport } from './model.js'; /** * `cadence doctor --fix` repair planning + application (phase 131). The planner * is pure (report → classified actions); the applier is the only part that * touches the repo, and each repair is best-effort. Safety comes from this * classification — only deterministic, low-blast-radius repairs are `auto`. */ export type FixKind = 'auto' | 'wire-host' | 'manual'; export interface FixAction { /** The doctor check this action addresses. */ check: string; kind: FixKind; /** The check's repair id, or null for a manual action. */ fixId: string | null; title: string; detail: string; } export interface FixPlan { actions: FixAction[]; } /** * Pure: classify every *failing* check into a fix action. A check with a known * repair `fixId` becomes an `auto`/`wire-host` action; anything else (no fixId, * or an unknown id) becomes a `manual` action carrying the check's remediation. * Report order is preserved. * * `resolve-state-conflict` (T5, phase 196, issue #177) is special-cased ahead * of the generic lookup: it is ALWAYS classified `manual` here — never `auto` * — because picking the wrong side of a state.json conflict is actively * harmful, unlike every other repair in this file. `fixId` is still * preserved (unlike a normal manual/unknown-fixId action, which nulls it * out), so `applyFixes` can recognize this specific action and, only when * the caller's `opts.resolveStateConflict` supplies a side, actually run the * repair — driven by the CLI flag, never by the blanket "run every auto * action" path `untrack-state` uses. */ export declare function planFixes(report: DoctorReport): FixPlan; export type FixStatus = 'applied' | 'failed' | 'skipped'; export interface FixOutcome { check: string; fixId: string | null; kind: FixKind; status: FixStatus; message: string; } /** Injectable side-effects, so the applier is deterministic + offline in tests. */ export interface ApplyDeps { /** Run the Claude Code host install in `root`; resolves with its exit code. */ hostInstall?: (root: string) => Promise; /** Run the Codex host install in `root`; resolves with its exit code. */ codexHostInstall?: (root: string) => Promise; } export interface ConflictRepairResult { status: FixStatus; message: string; } /** * Apply a fix plan, best-effort. `auto` actions always run; `wire-host` actions * run only when `opts.wireHost`; `manual` actions are never executed (reported as * guidance) — EXCEPT the `resolve-state-conflict` fixId (classified `manual` in * the plan on purpose, see `planFixes`), which this loop intercepts before the * generic manual handling: it runs only when `opts.resolveStateConflict` * supplies a side, and is skipped-with-guidance otherwise — driven by the CLI * flag, never by a check's `kind`. Repairs sharing a `fixId` (e.g. host-install * for both host checks) run at most once — subsequent actions report as * covered/skipped. A repair that throws is reported `failed`; the rest still * run. */ export declare function applyFixes(root: string, plan: FixPlan, opts: { wireHost: boolean; resolveStateConflict?: 'local' | 'incoming'; }, deps?: ApplyDeps): Promise; //# sourceMappingURL=fix.d.ts.map