UNPKG

@struktoai/mirage-core

Version:

A Unified Virtual Filesystem For AI Agents

51 lines • 2.34 kB
import type { ByteSource } from '../../../../io/types.ts'; import type { PathSpec } from '../../../../types.ts'; import type { TreeEntry } from './tree.ts'; import type { RepoLocation } from './types.ts'; /** One comparison: the old side's entries, then the new side's. */ export type Side = readonly [Map<string, TreeEntry>, Map<string, TreeEntry>]; /** * One path a comparison changed, as the row git hands over. * * Unpaired: a rename is the delete of its source and the add of its * destination, two rows each naming its own path, so a hide drops either side * alone and the renderer pairs only what is left. Mirrors Python's `Delta`. */ export interface Delta { /** Where the entry sits in the session's tree. */ readonly path: PathSpec; /** Git's repository-relative name. */ readonly name: string; /** The entry before; null when added. */ readonly old: TreeEntry | null; /** The entry after; null when deleted. */ readonly new: TreeEntry | null; /** Which of the command's comparisons it belongs to. */ readonly side: number; } /** Where a repository entry sits in the session's tree. */ export declare function entryPath(location: RepoLocation, name: string): PathSpec; /** * The paths each comparison changed, one row per path and side. * * A path both sides hold alike is no row: no format prints it, and a rename * is only ever found among changed paths. `first` is the number the first * comparison takes, for a command that makes its comparisons in batches. */ export declare function deltas(location: RepoLocation, sides: readonly Side[], first?: number): Delta[]; /** * The comparisons again, holding only the rows the session sees. A * comparison whose every row was dropped comes back empty, which the formats * read as "does not differ". */ export declare function shownSides(shown: readonly Delta[], count: number): Side[]; /** One line a listing prints, and the entry it names. Mirrors Python's `Line`. */ export interface Line { /** Where the entry sits in the session's tree. */ readonly path: PathSpec; /** The line as printed, terminator included. */ readonly text: string; } /** A listing's lines, those the session sees, in order. */ export declare function printed(shown: Line[]): Promise<ByteSource | null>; //# sourceMappingURL=rows.d.ts.map