import { type PhrenResult } from "../phren-core.js";
import { type FindingCitation } from "../content/citation.js";
import { type FindingLifecycleStatus } from "./lifecycle.js";
export type FindingTier = "active" | "topic" | "older";
export interface ProjectFinding {
    file: string;
    tier: FindingTier;
    /** 0-based line of the bullet in its file. */
    lineIndex: number;
    /** The bullet as stored, without its line ending. */
    line: string;
    fid?: string;
    /** What readFindings shows: no bullet marker, comments or confidence marker. */
    text: string;
    status: FindingLifecycleStatus;
    /** Inside a legacy <details> / phren:archive block, which nothing writes (store-format §5.2). */
    archived: boolean;
    /** The phren:cite comment on the line under the bullet. */
    citation?: FindingCitation;
}
/** What a writer needs to find a located finding again. */
export type FindingHandle = Pick<ProjectFinding, "file" | "lineIndex" | "line">;
/** A string selector is a fid when written `fid:xxxxxxxx`, finding text otherwise. */
export type FindingSelector = {
    fid: string;
} | {
    text: string;
};
export type LocateResult = {
    kind: "found";
    finding: ProjectFinding;
} | {
    kind: "not_found";
} | {
    kind: "ambiguous";
    candidates: ProjectFinding[];
};
export interface RewrittenFinding {
    file: string;
    lineIndex: number;
    before: string;
    /** The new line, or null when the finding was removed. */
    after: string | null;
}
/** Every finding bullet of a project: FINDINGS.md, each topic archive and each .older.md half. */
export declare function iterateProjectFindings(phrenPath: string, project: string, scope?: {
    projectDir: string;
    onSkipped: (file: string, reason: string) => void;
}): Generator<ProjectFinding>;
/**
 * Exactly one finding by fid or by text, or why not. Text matches after
 * normalizeFindingText, falling back to ignoring a type tag one side lacks;
 * it never matches part of a finding.
 */
export declare function locateFinding(phrenPath: string, project: string, selector: FindingSelector | string): LocateResult;
/**
 * Rewrite one finding's line under the file's lock: re-read the file, find the
 * bullet again by its handle, and write back only `transform(line)`. Returning
 * null removes the bullet and its phren:cite line. Refuses when the bullet
 * vanished, changed, or moved to more than one candidate line since it was
 * located, and when it sits in a read-only legacy archive block.
 */
export declare function rewriteFindingLine(phrenPath: string, project: string, handle: FindingHandle, transform: (line: string) => string | null): PhrenResult<RewrittenFinding>;
