import type { DoctorCheck } from "./doctor.js";
/** What one worktree holds that exists nowhere else. */
export interface WorktreeExposure {
    /** Absolute worktree path. */
    readonly path: string;
    /** Checked-out branch, or undefined when detached. */
    readonly branch?: string;
    /** Commits present locally and on no remote. */
    readonly unpushedCommits: number;
    /** Whether the branch has no upstream at all. */
    readonly noUpstream: boolean;
    /** TRACKED files modified, staged, added, deleted, or renamed. */
    readonly dirtyFiles: number;
    /** Untracked files, reported as context rather than as the signal. */
    readonly untrackedFiles: number;
}
/**
 * Whether a worktree holds anything that would be lost if it disappeared.
 *
 * Uncommitted files are the severe half and are deliberately weighted first in
 * the report: a commit survives in the reflog long after a branch is deleted,
 * while a dirty tree is in no object database at all. Nothing recovers it.
 * @param exposure - Facts gathered about one worktree
 * @returns True when the worktree holds unique work
 */
export declare function holdsWorkAtRisk(exposure: WorktreeExposure): boolean;
/**
 * Whether a status line describes a modification to a TRACKED file.
 *
 * Untracked entries are deliberately excluded from the signal. Measured against
 * a real fleet checkout: one worktree reported 1,442 "uncommitted" files, all
 * untracked, overwhelmingly `.watchman-cookie-*` droppings and apply artifacts.
 * Counting those makes every worktree look catastrophic, and a check that cries
 * wolf on ephemera is one nobody reads — which is the failure this check exists
 * to prevent, reproduced inside the check itself.
 *
 * Untracked files are still counted and reported, just not as the trigger. The
 * genuinely at-risk worktree in the incident carried five tracked modifications
 * alongside its one new test file, so keying on tracked changes still catches it.
 * @param line - One `git status --porcelain` line
 * @returns True when the line is a tracked-file change
 */
export declare function isTrackedChange(line: string): boolean;
/**
 * Order exposures worst-first for an operator reading a truncated list.
 *
 * Dirty trees sort ahead of unpushed commits regardless of size, because the
 * recovery story differs in kind rather than degree.
 * @param left - First exposure
 * @param right - Second exposure
 * @returns Comparator result
 */
export declare function compareExposureSeverity(left: WorktreeExposure, right: WorktreeExposure): number;
/**
 * Render one exposure as a line an operator can act on.
 * @param exposure - Facts gathered about one worktree
 * @returns Single-line description
 */
export declare function describeExposure(exposure: WorktreeExposure): string;
/**
 * Report worktrees holding commits or edits that exist nowhere else.
 *
 * Distinct from `checkWorktreeHygiene`, which counts worktrees because each one
 * is a full checkout that every file crawler walks past. That check deliberately
 * stops at the count, on the grounds that "the operator is the only one who
 * knows whether an idle-looking checkout still holds work". This check answers
 * exactly that question, so an idle-looking checkout no longer has to be taken
 * on faith.
 *
 * Measured motivation: on 2026-08-17 seven agent sessions in one fleet reached
 * the same ticket in turn, each finding no remote branch and concluding the
 * previous session had abandoned it. Five worktrees held real work at the time,
 * one of them 1,031 uncommitted lines under `/private/tmp`. Every session ran
 * `git ls-remote`, and every session got a true negative that meant the opposite
 * of what it looked like: unpushed work and abandoned work are byte-identical
 * from outside.
 *
 * Enumeration is `git worktree list`, NOT a scan of the worktree roots, and that
 * is load-bearing. The exposed worktrees in that incident lived under
 * `/private/tmp`, which no root scan reaches. A check that only sees the tidy
 * locations would have reported clean while the work at risk sat elsewhere.
 *
 * Read-only and warn-only. It names what is exposed and the one-line repair; it
 * never pushes, commits, or removes anything, because publishing a branch is
 * outward-facing and belongs to the operator.
 * @param targetPath - Project path to inspect
 * @returns Doctor check result
 */
export declare function checkWorktreeWorkAtRisk(targetPath: string): Promise<DoctorCheck>;
//# sourceMappingURL=doctor-worktree-work-at-risk.d.ts.map