# API Contract The frontend calls Tauri commands with `@tauri-apps/api/core.invoke`. ## Shared payloads ```ts type FileStatusKind = "modified" | "added" | "deleted" | "renamed" | "untracked" | "conflicted" | "unknown"; interface GitStatus { repo_path: string; current_branch: string | null; upstream: string | null; ahead: number; behind: number; files: GitFileStatus[]; clean: boolean; } interface GitFileStatus { path: string; old_path: string | null; staged: FileStatusKind | null; unstaged: FileStatusKind | null; } interface GitBranch { name: string; current: boolean; remote: boolean; } interface GitCommit { hash: string; short_hash: string; summary: string; author_name: string; author_email: string; date: string; refs: string[]; files: GitCommitFile[]; } interface GitCommitFile { path: string; old_path: string | null; status: FileStatusKind; } interface GitRepositoryFile { path: string; tracked: boolean; status: FileStatusKind | null; } ``` ## Commands - `open_repository(path: string): Promise` - `get_status(path: string): Promise` - `list_branches(path: string): Promise` - `checkout_branch(path: string, branch: string): Promise` - `stage_files(path: string, files: string[]): Promise` - `unstage_files(path: string, files: string[]): Promise` - `restore_files(path: string, files: string[], staged: boolean): Promise` - `commit(path: string, message: string): Promise` - `pull(path: string): Promise` - `push(path: string): Promise` - `list_commits(path: string, limit?: number): Promise` - `restore_to_commit(path: string, commit: string): Promise` - `restore_file_from_commit(path: string, commit: string, file: string): Promise` (the `file` argument can also be a folder path) - `merge_branch(path: string, branch: string): Promise` - `list_repository_files(path: string): Promise` - `list_file_history(path: string, file: string, limit?: number): Promise` (the `file` argument can also be a folder path)