/** * Give a backlog item a rank and keep every rank unique and gap-free * (triage-sets-priority/AC-1 … triage-sets-priority/AC-12). * * `roadmap next` orders the backlog by `priority`, but until this module nothing * wrote one: every rank was typed by hand, and they drift — an item leaving the * backlog leaves a hole, and a second item typed at the same number ties. The * roadmap skill *proposes* a rank at triage; this is what writes it once the person * has answered, so "the others shift" is true by construction instead of being an * agent's job across several files. * * Every ranked backlog item is renumbered 1…k on each call, not only the ones at or * below the new rank. Shifting only the collisions would keep a hole at the top of * a backlog whose first items had shipped forever. * * Reads and writes the PRIMARY checkout's roadmap (`roadmapRoot`), like every * roadmap lookup that decides status. Unranked items are never written: ranking * one item is not a decision about the others. * * @module */ /** One line of the printed order. `priority` is the rank after the change. */ export interface RankRow { file: string; title: string | null; priority: number | null; target: boolean; } export type RankPlan = { ok: true; /** The ranked item's file name. */ item: string; /** The rank it actually lands at, after clamping (AC-2). */ rank: number; order: RankRow[]; writes: { path: string; raw: string; }[]; } | { ok: false; detail: string; }; /** * Whether the project declares `priority` in `roadmap.item_fields`. * * The new behaviour is opt-in through the same declaration `roadmap next`'s docs * already describe; a project that has not made it is untouched. */ export declare function priorityDeclared(cwd: string): boolean; /** * Set an item's `priority:` line to `rank`, editing the frontmatter as text. * * Text rather than re-serialization, as `writeHistoryEntry` does, so every other * line keeps its quoting, comments and order (AC-4). A trailing `# comment` on the * line itself survives too. With no `priority:` line, one is added as the last * frontmatter line — where the framework's field writer puts extension fields. * * @returns The new contents, or null when there is no frontmatter. */ export declare function setPriorityLine(raw: string, rank: number): string | null; /** * Work out what ranking `itemArg` at `rankArg` would do, refusing before any write. * * Every refusal is decided here, so `applyRank` has nothing left to fail on but the * filesystem. */ export declare function planRank(cwd: string, itemArg: string, rankArg: string): RankPlan; /** * Write a plan's changed files. No history entry: `history` records status moves, * and a rank is not one. */ export declare function applyRank(plan: Extract): void; //# sourceMappingURL=rank.d.ts.map