// Anbindung an den kleinen Server (server.mjs). Ersetzt die Tauri-Befehle `dev_roadmap` und `dev_klicktests` aus Kanonwerk. export interface ProjectInfo { id: string; name: string; path: string } /** Aktuell gewähltes Projekt (Index im Server); die App setzt es, bevor die Ansicht neu lädt */ export const session = { project: "0" }; async function get(path: string): Promise { const r = await fetch(`/api/${path}${path.includes("?") ? "&" : "?"}project=${encodeURIComponent(session.project)}`, { cache: "no-store" }); return r; } export async function listProjects(): Promise { const r = await fetch("/api/projects", { cache: "no-store" }); if (!r.ok) throw new Error(await r.text()); return r.json(); } export async function devRoadmap(): Promise { const r = await get("roadmap"); if (!r.ok) throw new Error(await r.text()); return r.text(); } /** KLICKTESTS.md ist optional: fehlt sie, gibt es keinen Tests-Reiter */ export async function devKlicktests(): Promise { const r = await get("klicktests"); return r.ok ? r.text() : ""; } export async function devReports(): Promise<{ file: string; text: string }[]> { const r = await get("reports"); return r.ok ? r.json() : []; }