diff.ts

 1export interface FileChange {
 2	path: string;
 3	oldPath?: string;
 4	status: 'added' | 'modified' | 'deleted' | 'renamed';
 5	staged: boolean;
 6	approved: boolean;
 7	additions: number;
 8	deletions: number;
 9}
10
11export interface DiffFile {
12	path: string;
13	oldPath?: string;
14	hunks: DiffHunk[];
15	language: string;
16	totalLines?: number;
17	truncated?: boolean;
18}
19
20export interface DiffHunk {
21	header: string;
22	oldStart: number;
23	oldLines: number;
24	newStart: number;
25	newLines: number;
26	lines: DiffLine[];
27}
28
29export interface DiffLine {
30	type: 'add' | 'del' | 'context';
31	content: string;
32	html?: string;
33	oldNumber?: number;
34	newNumber?: number;
35}
36
37export type DiffScope = 'uncommitted' | 'worktree';
38
39export type DiffMode = 'full' | 'unstaged';
40
41export interface ChangeInfo {
42	changeId: string;
43	commitId: string;
44	description: string;
45	bookmarks: string[];
46	isWorkingCopy: boolean;
47	parents: string[];
48}
49
50export interface ChangeStack {
51	main: { changeId: string; commitId: string; description: string } | null;
52	/** Effective change being viewed (selected change, or the working copy). */
53	current: string | null;
54	/** Explicitly selected change, or null when viewing the working copy. */
55	selected: string | null;
56	workingCopy: string | null;
57	changes: ChangeInfo[];
58}