import { type ExtensionContext } from "@earendil-works/pi-coding-agent"; /** A single commit entry in the picker list. */ export interface CommitItem { sha: string; subject: string; isCheckpoint: boolean; /** Owning pi session (`Checkpoint-Session` trailer), when present. */ session?: string | null; /** Origin branch (`Checkpoint-Branch` trailer), when present. */ branch?: string | null; } /** Index range the user selected, 0-based from HEAD. */ export interface PickerResult { /** Start index (inclusive) — closer to HEAD. */ startIndex: number; /** End index (inclusive) — further from HEAD. */ endIndex: number; } /** * Parse `git log --pretty=format:"%H%x00%s%x00%(trailers...)"` output into * CommitItem[]. The trailing session/branch fields are optional: legacy log * formats (and old commits) simply leave them undefined. */ export declare function buildCommitItems(rawGitLog: string): CommitItem[]; /** * Readable origin label for a checkpoint item: the origin branch when * recorded (`Checkpoint-Branch`), else a short form of the owning session * id. Returns `null` for non-checkpoints and unknown origins. */ export declare function formatOrigin(item: CommitItem): string | null; /** * Compute the default range: [1] at HEAD, [2] at the bottom of the * contiguous checkpoint run at HEAD. Falls back to both at HEAD when HEAD * is not a checkpoint. * * Stops at the first non-checkpoint commit so scattered historical * checkpoints (possibly already pushed) are never included by default. */ export declare function defaultRange(items: CommitItem[]): { startIndex: number; endIndex: number; }; /** * Compute a readable label for a commit item. * Strips the `wip(checkpoint): ` prefix from checkpoint commits. */ export declare function formatSubject(subject: string): string; /** * Interactive commit range picker. * * Renders as a centered popup listing recent commits. The user sets * range markers [1] (start) and [2] (end) by pressing `1` / `2` at the * cursor position. The highlighted region shows the selected range. * * On Enter the picker validates that at least one checkpoint commit falls * inside the range, then calls `onConfirm` with the result. */ export declare class CommitPicker { private items; private cursorIndex; private startIndex; private endIndex; private scrollOffset; private maxVisible; private errorMessage; /** SHA of the upstream tip; rendered as a boundary marker in the list. */ private remoteTipSha; /** Stored theme reference for render(). */ private theme; onConfirm?: (result: PickerResult) => void; onCancel?: () => void; onLoadMore?: (count: number) => Promise; private loadingMore; private requestRender?; setRequestRender(fn: () => void): void; constructor(items: CommitItem[], defaultStart: number, defaultEnd: number, theme: { fg: (color: any, text: string) => string; bg: (color: any, text: string) => string; }, maxVisible?: number, remoteTipSha?: string | null); private ensureCursorVisible; private get visibleSlice(); /** The inclusive lower index of the range. */ private get lo(); /** The inclusive upper index of the range. */ private get hi(); /** Whether the cursor is on the start marker. */ private isAtStart; /** Whether the cursor is on the end marker. */ private isAtEnd; /** Build the display text for one item with markers. */ private formatLine; handleInput(data: string): void; render(width: number): string[]; invalidate(): void; } /** * Show the commit range picker popup and return the user's selection. * * In TUI mode, renders a centered overlay popup. In non-TUI mode, * falls back to `ctx.ui.select()` with simplified options. * * @returns The selected range, or `null` if cancelled. */ export declare function showCommitPicker(ctx: ExtensionContext, items: CommitItem[], loadMore?: (count: number) => Promise, remoteTipSha?: string | null): Promise; //# sourceMappingURL=commit-picker.d.ts.map