/** * What a session changed on disk, and what the change was. * * KONECK has a git-based checkpoint already, and it is the right thing when there is a repository: * `git write-tree` is cheap and exact. But it needs one, and the workspace this was asked for has * no repository of its own — the enclosing directory has one, which is a tree full of other * projects and precisely what the git tools are now withheld from touching. A diff view that only * works in a git repo is a diff view that does not work. * * So the workspace is read directly: a snapshot of the text files before a turn, another after, and * the difference between them. Bounded in every direction, because a workspace can contain a * node_modules and a build output and a database. */ /** A file larger than this is recorded by size alone: no diff is readable at that length. */ export declare const MAX_DIFF_BYTES: number; /** A cap on how many files are held, so a snapshot cannot become the memory problem. */ export declare const MAX_FILES = 4000; export interface FileState { size: number; mtimeMs: number; /** Present only for text files small enough to diff. */ text?: string; } export type Snapshot = Map; /** * Every text file under a workspace, with its contents. * * Content is read rather than hashed because the diff needs it anyway, and a workspace that fits * in the caps above is small enough that reading it is faster than deciding not to. */ export declare function snapshot(cwd: string): Promise; export interface FileChange { path: string; kind: 'added' | 'modified' | 'deleted'; added: number; removed: number; /** A unified diff, or null when the file is binary or too large. */ diff: string | null; size: number; } /** The edit script as a unified diff, with untouched stretches collapsed. */ export declare function unified(before: string, after: string): { diff: string; added: number; removed: number; }; /** What changed between two snapshots, newest interesting first. */ export declare function compare(before: Snapshot, after: Snapshot): FileChange[]; /** Totals for a header line. */ export declare function summarise(changes: readonly FileChange[]): { files: number; added: number; removed: number; }; //# sourceMappingURL=changes.d.ts.map