/** * Tauri adapter for {@link GitGateway} (L8). * * Commands use snake_case (Tauri convention); payload keys are camelCase * (matching the backend DTO `#[serde(rename_all = "camelCase")]`), consistent * with the other adapters in this directory. * * NOTE: The Tauri commands wired here are defined in the backend `app-tauri` * crate. The mock gateway covers tests and offline dev today. */ import { invoke } from "@tauri-apps/api/core"; import type { GitBranches, GitCommit, GitFileStatus, GraphCommit } from "@/domain"; import type { GitGateway } from "@/ports"; export class TauriGitGateway implements GitGateway { status(projectId: string): Promise { return invoke("git_status", { projectId }); } async stage(projectId: string, path: string): Promise { await invoke("git_stage", { request: { projectId, path } }); } async unstage(projectId: string, path: string): Promise { await invoke("git_unstage", { request: { projectId, path } }); } commit(projectId: string, message: string): Promise { return invoke("git_commit", { request: { projectId, message } }); } branches(projectId: string): Promise { return invoke("git_branches", { projectId }); } async checkout(projectId: string, branch: string): Promise { await invoke("git_checkout", { request: { projectId, branch } }); } log(projectId: string, limit: number): Promise { return invoke("git_log", { projectId, limit }); } async init(projectId: string): Promise { await invoke("git_init", { projectId }); } graph(projectId: string, limit: number): Promise { return invoke("git_graph", { projectId, limit }); } }