Agents for developpement added + frontend add + backend added. Git viewer created + agent and template creator + layout and project creator
54 lines
1.8 KiB
TypeScript
54 lines
1.8 KiB
TypeScript
/**
|
|
* 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<GitFileStatus[]> {
|
|
return invoke<GitFileStatus[]>("git_status", { projectId });
|
|
}
|
|
|
|
async stage(projectId: string, path: string): Promise<void> {
|
|
await invoke("git_stage", { request: { projectId, path } });
|
|
}
|
|
|
|
async unstage(projectId: string, path: string): Promise<void> {
|
|
await invoke("git_unstage", { request: { projectId, path } });
|
|
}
|
|
|
|
commit(projectId: string, message: string): Promise<GitCommit> {
|
|
return invoke<GitCommit>("git_commit", { request: { projectId, message } });
|
|
}
|
|
|
|
branches(projectId: string): Promise<GitBranches> {
|
|
return invoke<GitBranches>("git_branches", { projectId });
|
|
}
|
|
|
|
async checkout(projectId: string, branch: string): Promise<void> {
|
|
await invoke("git_checkout", { request: { projectId, branch } });
|
|
}
|
|
|
|
log(projectId: string, limit: number): Promise<GitCommit[]> {
|
|
return invoke<GitCommit[]>("git_log", { projectId, limit });
|
|
}
|
|
|
|
async init(projectId: string): Promise<void> {
|
|
await invoke("git_init", { projectId });
|
|
}
|
|
|
|
graph(projectId: string, limit: number): Promise<GraphCommit[]> {
|
|
return invoke<GraphCommit[]>("git_graph", { projectId, limit });
|
|
}
|
|
}
|