/** * Tauri adapter for {@link ProjectGateway} (L2). Together with the sibling * adapters this is the *only* place that calls `invoke()`; components reach it * exclusively through the port. * * Commands and payload keys are camelCase, matching the backend DTO convention. */ import { invoke } from "@tauri-apps/api/core"; import type { Project } from "@/domain"; import type { ProjectGateway } from "@/ports"; export class TauriProjectGateway implements ProjectGateway { listProjects(): Promise { return invoke("list_projects"); } createProject(name: string, root: string): Promise { return invoke("create_project", { request: { name, root } }); } openProject(projectId: string): Promise { return invoke("open_project", { projectId }); } async closeProject(projectId: string): Promise { await invoke("close_project", { projectId }); } readProjectContext(projectId: string): Promise { return invoke("read_project_context", { projectId }); } async updateProjectContext(projectId: string, content: string): Promise { await invoke("update_project_context", { request: { projectId, content }, }); } }