/** * Abstraction over terminal I/O for pagination prompts. * * Injected into {@link paginateOutput} to decouple from process.stdin/stdout, * enabling deterministic testing without raw mode manipulation. */ export type PaginationIO = { /** Whether the I/O streams are connected to an interactive terminal. */ isTTY: boolean; /** Write text to the output stream. */ write(text: string): void; /** Read a single keypress and return the character. */ readKey(): Promise; }; /** * Configuration options for {@link paginateOutput}. */ export type PaginateOptions = { /** Number of records per page. Defaults to 25. */ pageSize?: number; /** Skip interactive prompts — render all records at once. */ noPrompt?: boolean; /** Skip pagination when JSON output mode is active. */ jsonEnabled?: boolean; /** Injected I/O for testing. Falls back to default terminal IO when omitted. */ io?: PaginationIO; }; /** * Result metadata returned after pagination completes. */ export type PaginateResult = { /** Number of records actually rendered. */ displayed: number; /** Total number of pages (may exceed pages displayed if user quit early). */ totalPages: number; /** Terminal action: how pagination ended. */ action: 'all' | 'paged' | 'quit' | 'no-pagination'; }; /** * Paginate a record set with interactive terminal prompts. * * @typeParam T - The record type being paginated. * @param records - Full array of records to paginate. * @param renderPage - Callback invoked for each page (or all records). Receives the slice and its start index. * @param options - Pagination configuration. * @returns Result metadata describing what was displayed and how pagination ended. */ export declare function paginateOutput(records: T[], renderPage: (items: T[], startIndex: number) => void, options?: PaginateOptions): Promise;