P-0000: FORMAT.md v1, Prüfskript check_format.py, Viewer-Kopie mit Hinweis bei neuerer Formatversion, Tests format2lint

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-03 10:26:12 +01:00
parent 2efc164a0a
commit d6406dc13d
28 changed files with 3124 additions and 3 deletions

45
viewer/src/App.svelte Normal file
View File

@ -0,0 +1,45 @@
<script lang="ts">
import { onMount } from "svelte";
import { listProjects, session, type ProjectInfo } from "./lib/api";
import RoadmapView from "./lib/RoadmapView.svelte";
let projects = $state<ProjectInfo[]>([]);
let current = $state("0");
let error = $state("");
onMount(async () => {
try {
projects = await listProjects();
const saved = localStorage.getItem("viewer.project");
if (saved && projects.some((p) => p.id === saved)) current = saved;
session.project = current;
} catch (e) { error = String(e); }
});
function choose(id: string) {
current = id;
session.project = id;
try { localStorage.setItem("viewer.project", id); } catch { /* ohne Speicher weiter */ }
}
const info = $derived(projects.find((p) => p.id === current));
</script>
<main>
{#if error}<p class="err" role="alert">{error}</p>{/if}
{#if projects.length > 1}
<label class="pick">Projekt
<select value={current} onchange={(e) => choose(e.currentTarget.value)}>
{#each projects as p (p.id)}<option value={p.id}>{p.name}</option>{/each}
</select>
</label>
{/if}
{#if info}
{#key current}<RoadmapView title={info.name} path={info.path} />{/key}
{/if}
</main>
<style>
main { padding: 16px 20px 40px; display: grid; gap: 12px; }
.pick { display: flex; align-items: center; gap: 8px; font-size: .88rem; color: var(--muted); }
.err { color: var(--danger); margin: 0; }
</style>

20
viewer/src/app.css Normal file
View File

@ -0,0 +1,20 @@
:root {
--bg: #f6f7f9; --panel: #ffffff; --text: #1d2330; --muted: #667085; --line: #dfe3ea;
--accent: #3b5bdb; --accent-soft: #e8edff; --on-accent: #ffffff;
--ok: #2f9e44; --warn: #e8890c; --danger: #d6336c; --radius: 10px;
color-scheme: light;
}
@media (prefers-color-scheme: dark) {
:root {
--bg: #14171f; --panel: #1b1f2a; --text: #e6e9f0; --muted: #98a1b3; --line: #2c3342;
--accent: #7c93ff; --accent-soft: #232b48; --on-accent: #0f1320;
--ok: #51cf66; --warn: #ffa94d; --danger: #f06595;
color-scheme: dark;
}
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; }
button, select, input { font: inherit; color: var(--text); }
select, input[type="search"] { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 4px 8px; }
code { font-family: ui-monospace, monospace; font-size: .86em; }
a { color: var(--accent); }

View File

@ -0,0 +1,478 @@
<script lang="ts">
// Startseite des Entwicklungsfensters: die ROADMAP.md des Projekts, übersichtlich aufbereitet (Kennzahlen, Reiter, Filter, Karten).
// Wird beim Öffnen und beim Zurückkehren ins Fenster neu gelesen, sodass Änderungen an der Datei ohne Neustart sichtbar sind.
import { onMount, tick } from "svelte";
import DOMPurify from "dompurify";
import { marked } from "marked";
import { devRoadmap } from "./api";
import { loadTestData, lastRun, td } from "./testdata.svelte";
import { t } from "./i18n.svelte";
import { bullets, isNewerFormat, formatVersion, VIEWER_FORMAT, parseDoc, parseTests, prose, statusRows, STATUSES, tableOf, todoItems, versions, type Bullet, type Doc, type Process } from "./roadmap";
let { title = "", path = "" }: { title?: string; path?: string } = $props();
let doc = $state<Doc | null>(null);
let raw = $state("");
let testFilter = $state("");
let processFilter = $state("");
let error = $state("");
let loadedAt = $state("");
let tab = $state("todo");
let filter = $state("");
let query = $state("");
let group = $state("");
/** Entscheidungen: offen oder schon entschieden (der Text trägt dann „Entschieden …“) */
let decFilter = $state<"" | "open" | "done">("");
const isDecided = (b: Bullet) => /entschieden/i.test(b.text);
async function load() {
try {
raw = await devRoadmap();
doc = parseDoc(raw);
await loadTestData();
error = "";
loadedAt = new Date().toLocaleTimeString();
} catch (e) { error = String(e); }
}
onMount(() => {
try { tab = localStorage.getItem("roadmap.tab") ?? "todo"; } catch { /* Standard */ }
void load();
const onVisible = () => { if (document.visibilityState === "visible") void load(); };
document.addEventListener("visibilitychange", onVisible);
window.addEventListener("focus", onVisible);
return () => { document.removeEventListener("visibilitychange", onVisible); window.removeEventListener("focus", onVisible); };
});
function pick(id: string) { tab = id; try { localStorage.setItem("roadmap.tab", id); } catch { /* ohne Speicher weiter */ } }
const inline = (md: string) => DOMPurify.sanitize(marked.parseInline(md, { async: false }) as string);
const block = (md: string) => DOMPurify.sanitize(marked.parse(md, { async: false }) as string);
// Reiter: feste Zuordnung über Stichworte im Abschnittstitel, damit Umbenennungen in der Datei nicht stören
const KINDS: [string, RegExp, string][] = [
["todo", /^todo/i, "📌"], ["stand", /^stand/i, "📊"], ["decide", /^offene entscheid/i, "❓"], ["road", /^roadmap/i, "🗺"],
["risk", /^risiken/i, "⚠"], ["rules", /^leitplanken/i, "🧭"], ["orders", /^auftr/i, "📨"],
];
const SHORT: Record<string, string> = { todo: "Todo", stand: "Stand", decide: "Entscheidungen", road: "Roadmap", risk: "Risiken", rules: "Leitplanken", orders: "Aufträge" };
const ORDER = ["todo", "stand", "decide", "road", "risk", "rules", "orders"];
const sections = $derived((doc?.sections ?? []).map((s) => ({ ...s, kind: KINDS.find(([, re]) => re.test(s.title))?.[0] ?? `s${s.id}`, icon: KINDS.find(([, re]) => re.test(s.title))?.[2] ?? "•" }))
.sort((a, b) => (ORDER.indexOf(a.kind) + 1 || 99) - (ORDER.indexOf(b.kind) + 1 || 99)));
const current = $derived(tab === "tests" ? undefined : (sections.find((s) => s.kind === tab) ?? sections[0]));
const showTests = $derived(tab === "tests");
const allTests = $derived(td.processes.flatMap((p) => p.tests.map((x) => ({ ...x, process: p.name }))));
/** Ergebnis des letzten Laufs aus den Testberichten (leer: nie gelaufen) */
const res = (id: string) => lastRun(id)?.result ?? "";
const testCounts = $derived({ ok: allTests.filter((x) => res(x.id) === "✓").length, bad: allTests.filter((x) => res(x.id) === "✗").length, none: allTests.filter((x) => !res(x.id)).length });
/** Tests je Funktion (Stand-ID): Anzahl und Ergebnisse der Prozesse, die sie abdecken */
const testsFor = (id: number | null) => (id === null ? [] : td.processes.filter((p) => p.covers.includes(id)));
const resultClass = (r: string) => (r.startsWith("✓") ? "ok" : r.startsWith("✗") ? "open" : "unk");
const stand = $derived.by(() => {
const s = sections.find((x) => x.kind === "stand");
return s ? statusRows(s.lines) : { header: [], rows: [] };
});
const counts = $derived(Object.fromEntries(STATUSES.map((s) => [s, stand.rows.filter((r) => r.status === s).length])) as Record<string, number>);
const shown = $derived(stand.rows.filter((r) => (!filter || r.status === filter) && (!query.trim() || r.cells.join(" ").toLowerCase().includes(query.trim().toLowerCase()))));
const todo = $derived.by(() => { const s = sections.find((x) => x.kind === "todo"); return s ? todoItems(s.lines) : { items: [], finished: [], done: [] }; });
/** Erledigte Todo-IDs der Roadmap: die Chips in den Versionspaketen färben sich danach (#1170) */
const doneTodos = $derived(new Set(todo.finished.map((x) => x.id).filter(Boolean)));
/** Paket-Zustand (#1170): veröffentlicht = die im Kopf genannte Release-Version oder alle Tickets erledigt; in Arbeit ≥ 1 erledigtes Ticket; sonst Planung/neu. */
const verBadges = $derived.by(() => {
// Kopfsatz kennt beide Sprechweisen: „installiert ist X" und „Release `vX`" (#1170)
const released = (doc?.head.match(/(?:installiert ist|Release\s+`?)v?([0-9]+(?:\.[0-9]+)*)/)?.[1] ?? "").trim();
const map = new Map<string, { cls: string; text: string }>();
const roadSec = sections.find((x) => x.kind === "road");
for (const v of roadSec ? versions(roadSec.lines) : []) {
const allDone = v.ids.length > 0 && v.ids.every((id) => doneTodos.has(id));
if (v.name === released || allDone) { map.set(v.name, { cls: "ok", text: t("rmVerDone") }); continue; }
const done = v.ids.some((id) => doneTodos.has(id));
map.set(v.name, done ? { cls: "work", text: t("rmVerWork") } : { cls: "plan", text: "" });
}
return map;
});
const decide = $derived.by(() => { const s = sections.find((x) => x.kind === "decide"); return s ? bullets(s.lines) : []; });
const decOpen = $derived(decide.filter((b) => !isDecided(b)).length);
const decDone = $derived(decide.length - decOpen);
const risks = $derived.by(() => { const s = sections.find((x) => x.kind === "risk"); return s ? bullets(s.lines) : []; });
const groups = $derived([...new Set(todo.items.map((i) => i.group))]);
const todoShown = $derived(todo.items.filter((i) => !group || i.group === group));
// Alle IDs mit Art und Titel: für Verweise („→ #1012“) und das Springen dorthin
const plain = (md: string) => md.replace(/\*\*|`|\[|\]/g, "").replace(/\s+/g, " ").trim();
const index = $derived.by(() => {
const m = new Map<number, { kind: string; title: string }>();
for (const r of stand.rows) if (r.id !== null) m.set(r.id, { kind: "stand", title: plain(r.cells[0] ?? "") });
for (const i of [...todo.items, ...todo.finished]) if (i.id !== null) m.set(i.id, { kind: "todo", title: plain(i.title) });
for (const b of decide) if (b.id !== null) m.set(b.id, { kind: "decide", title: plain(b.text).slice(0, 80) });
for (const b of risks) if (b.id !== null) m.set(b.id, { kind: "risk", title: plain(b.text).slice(0, 80) });
return m;
});
/** Todo-Punkte, die eine Anforderung voranbringen */
const todosFor = (id: number | null) => (id === null ? [] : todo.items.filter((i) => i.refs.includes(id)));
let copied = $state<number | null>(null);
async function copyId(id: number) {
try { await navigator.clipboard.writeText(`#${id}`); copied = id; setTimeout(() => { if (copied === id) copied = null; }, 1500); } catch { /* ohne Zwischenablage weiter */ }
}
let flash = $state<number | null>(null);
async function jump(id: number) {
const target = index.get(id);
if (!target) return;
filter = ""; query = ""; group = "";
pick(target.kind);
await tick();
const el = document.querySelector<HTMLElement>(`[data-id="${id}"]`);
if (el instanceof HTMLDetailsElement) el.open = true;
el?.scrollIntoView({ block: "center", behavior: "smooth" });
flash = id;
setTimeout(() => { if (flash === id) flash = null; }, 1800);
}
const statusName: Record<string, string> = { "✓": "rmDone", "◐": "rmPart", "✗": "rmOpen2", "?": "rmUnknown" };
/** ◐ wird in manchen Schriften als Halbmond-Splitter gezeichnet; deshalb ein Bruch als Zeichen */
const sym = (s: string) => (s === "◐" ? "½" : s || "–");
const cls = (s: string) => ({ "✓": "ok", "◐": "part", "✗": "open", "?": "unk" }[s] ?? "");
const stateCol = $derived(stand.header.findIndex((h) => /^stand$/i.test(h)));
const headerOf = (md: string) => md.split("\n").find((l) => l.trim()) ?? "";
</script>
{#snippet idchip(id: number | null)}
{#if id !== null}
<button type="button" class="idchip" class:copied={copied === id} title={t("rmCopyId")} onclick={(e) => { e.preventDefault(); e.stopPropagation(); void copyId(id); }}>#{id}{copied === id ? " ✓" : ""}</button>
{/if}
{/snippet}
{#snippet refchips(ids: number[], label: string, markDone = false)}
{#if ids.length}
<span class="refs"><small>{label}</small>
{#each ids as r}
<button type="button" class="refchip" class:missing={!index.get(r)} class:done={markDone && doneTodos.has(r)} class:open={markDone && !doneTodos.has(r)} title={index.get(r)?.title ?? ""} onclick={(e) => { e.preventDefault(); e.stopPropagation(); void jump(r); }}>#{r}{#if index.get(r)} <span>{index.get(r)?.title}</span>{/if}</button>
{/each}
</span>
{/if}
{/snippet}
<article class="roadmap">
<header class="top">
<div class="titles">
<h1>{title || t("rmTitle")}</h1>
{#if path}<span class="badge" title={path}>{path}</span>{/if}
</div>
<div class="tools">
{#if doc?.nextId}<small title={t("rmNextIdTip")}>{t("rmNextId")} #{doc.nextId}</small>{/if}
{#if loadedAt}<small>{t("rmLoaded")} {loadedAt}</small>{/if}
<button type="button" onclick={load} title={t("rmReload")} aria-label={t("rmReload")}>⟳</button>
</div>
</header>
{#if doc?.head}<p class="stamp">{@html inline(headerOf(doc.head))}</p>{/if}
{#if error}<p class="error" role="alert">{error}</p>{/if}
{#if doc && isNewerFormat(doc.head)}
<div class="newer" role="alert" data-testid="rm-newer">
<strong>{t("rmNewer")}</strong>
<p>{t("rmNewerDetail").replace("{n}", String(formatVersion(doc.head))).replace("{max}", String(VIEWER_FORMAT))}</p>
</div>
<pre class="plain" data-testid="rm-plain">{raw}</pre>
{:else if doc}
<div class="cards" role="group" aria-label={t("rmSummary")}>
{#each STATUSES as s}
<button type="button" class="stat {cls(s)}" class:on={tab === "stand" && filter === s} onclick={() => { pick("stand"); filter = filter === s ? "" : s; }}>
<strong>{counts[s]}</strong><span>{sym(s)} {t(statusName[s])}</span>
</button>
{/each}
{#if allTests.length}
<button type="button" class="stat tests" class:on={showTests} onclick={() => pick("tests")}>
<strong>{testCounts.ok}/{allTests.length}</strong><span>🧪 {t("rmTestsOk")}</span>
</button>
{/if}
<button type="button" class="stat todo" class:on={tab === "todo"} onclick={() => pick("todo")}>
<strong>{todo.items.length}</strong><span>📌 {t("rmTodoCount")}</span>
</button>
</div>
<nav class="tabs" aria-label={t("rmTitle")}>
{#each sections as s (s.id)}
<button type="button" class:on={current?.kind === s.kind} onclick={() => pick(s.kind)}>{s.icon} {SHORT[s.kind] ?? s.title.replace(/\s*\(.*$/, "")}</button>
{/each}
{#if td.processes.length}<button type="button" class:on={showTests} onclick={() => pick("tests")}>🧪 Tests</button>{/if}
</nav>
{#if showTests}
<details class="howto" data-testid="rm-howto" open>
<summary>{t("rmHowTitle")}</summary>
<ol>
<li>{t("rmHow1")}</li>
<li>{t("rmHow2")}</li>
<li>{t("rmHow3")}</li>
<li>{t("rmHow4")}</li>
</ol>
{#if td.intro}<div class="free">{@html block(td.intro)}</div>{/if}
</details>
<div class="filters">
<select class="procselect" data-testid="rm-test-process" aria-label={t("rmProcess")} bind:value={processFilter}>
<option value="">{t("rmAll")} ({allTests.length})</option>
{#each td.processes as p (p.name)}<option value={p.name}>{p.name}</option>{/each}
</select>
<button type="button" class="chip" class:on={!testFilter} onclick={() => (testFilter = "")}>{t("rmAll")} ({allTests.length})</button>
<button type="button" class="chip ok" class:on={testFilter === "ok"} onclick={() => (testFilter = testFilter === "ok" ? "" : "ok")}>✓ {testCounts.ok}</button>
<button type="button" class="chip open" class:on={testFilter === "bad"} onclick={() => (testFilter = testFilter === "bad" ? "" : "bad")}>✗ {testCounts.bad}</button>
<button type="button" class="chip" class:on={testFilter === "none"} onclick={() => (testFilter = testFilter === "none" ? "" : "none")}>– {testCounts.none}</button>
</div>
{#each td.processes as proc (proc.name)}
{@const rows = proc.tests.filter((x) => !testFilter || (testFilter === "ok" ? res(x.id) === "✓" : testFilter === "bad" ? res(x.id) === "✗" : !res(x.id)))}
{#if (!processFilter || proc.name === processFilter) && rows.length}
<section class="proc" data-process={proc.name}>
<header>
<h2>{proc.name}</h2>
<span class="hint">{proc.purpose}</span>
</header>
{@render refchips(proc.covers, t("rmCovers"))}
{#if proc.precondition}<p class="hint">{proc.precondition}</p>{/if}
{#if proc.howto}
<details class="howto" data-testid="rm-proc-howto" open>
<summary>{t("rmHowProc")}</summary>
<div class="free">{@html block(proc.howto)}</div>
</details>
{/if}
<div class="tablewrap">
<table>
<thead><tr><th>Test</th><th>Schritte</th><th>Erwartet</th><th>Art</th><th>Letzter Lauf</th><th>Ergebnis</th></tr></thead>
<tbody>
{#each rows as x (x.id)}
<tr data-test={x.id}>
<td class="idcell"><code>{x.id}</code></td>
<td>{@html inline(x.steps)}</td>
<td>{@html inline(x.expected)}</td>
<td><span class="kind" class:auto={x.kind.startsWith("auto")}>{x.kind}</span></td>
<td class="state">{lastRun(x.id)?.zeit ?? ""}</td>
<td class="state"><span class="pill {resultClass(res(x.id))}" title={lastRun(x.id)?.note ?? ""}>{res(x.id) || "–"}</span></td>
</tr>
{/each}
</tbody>
</table>
</div>
</section>
{/if}
{/each}
{:else if current?.kind === "todo"}
<div class="filters">
<button type="button" class="chip" class:on={!group} onclick={() => (group = "")}>{t("rmAll")}</button>
{#each groups as g}<button type="button" class="chip" class:on={group === g} onclick={() => (group = g)}>{g.split(" – ")[0]}</button>{/each}
{#if !todo.items.some((i) => i.group.startsWith("P1"))}
<button type="button" class="chip primary" data-testid="rm-p1-open" onclick={() => pick("road")} title={t("rmP1Empty")}>→ {t("rmP1Open")}</button>
{/if}
</div>
{#each groups.filter((g) => !group || g === group) as g}
<h2 class="group">{g}</h2>
<div class="list">
{#each todoShown.filter((i) => i.group === g) as item, ti (`${item.id ?? item.title}-${ti}`)}
<details class="card" class:plain={!item.detail && !item.refs.length} class:flash={flash === item.id} data-id={item.id}>
<summary>
{@render idchip(item.id)}
<span class="ttl">{@html inline(item.title)}</span>
{#if item.detail || item.refs.length}<span class="more" aria-hidden="true">▾</span>{/if}
</summary>
{#if item.detail || item.refs.length}
<div class="detail">
{#if item.detail}{@html inline(item.detail)}{/if}
{@render refchips(item.refs, t("rmAdvances"))}
</div>
{/if}
</details>
{/each}
</div>
{/each}
{#if todo.finished.length}
<h2 class="group">{t("rmFinished")}</h2>
<div class="list">
{#each todo.finished as item, fi (`${item.id ?? item.title}-${fi}`)}
<details class="card done" class:flash={flash === item.id} data-id={item.id}>
<summary>{@render idchip(item.id)}<span class="ttl">{@html inline(item.title)}</span>{#if item.detail}<span class="more" aria-hidden="true">▾</span>{/if}</summary>
{#if item.detail || item.refs.length}<div class="detail">{#if item.detail}{@html inline(item.detail)}{/if}{@render refchips(item.refs, t("rmAdvances"))}</div>{/if}
</details>
{/each}
</div>
{/if}
{#if todo.done.length}
<h2 class="group">{t("rmDoneTitle")}</h2>
<div class="list">
{#each todo.done as d}
<details class="card done">
<summary><span class="num">✓</span><span class="ttl">{d.title}</span><span class="more" aria-hidden="true">▾</span></summary>
<div class="detail">{@html inline(d.text)}</div>
</details>
{/each}
</div>
{/if}
{:else if current?.kind === "stand"}
<div class="filters">
<button type="button" class="chip" class:on={!filter} onclick={() => (filter = "")}>{t("rmAll")} ({stand.rows.length})</button>
{#each STATUSES as s}<button type="button" class="chip {cls(s)}" class:on={filter === s} onclick={() => (filter = filter === s ? "" : s)}>{sym(s)} {counts[s]}</button>{/each}
<input type="search" placeholder={t("rmSearch")} bind:value={query} aria-label={t("rmSearch")} />
</div>
<div class="tablewrap">
<table>
<thead><tr><th>ID</th>{#each stand.header as h}<th>{h}</th>{/each}</tr></thead>
<tbody>
{#each shown as r, ri (`${r.id ?? r.cells[0]}-${ri}`)}
<tr data-id={r.id} class:flash={flash === r.id}>
<td class="idcell">{@render idchip(r.id)}</td>
{#each r.cells as c, i}
<td class:state={i === stateCol}>
{#if i === stateCol}<span class="pill {cls(r.status)}" title={t(statusName[r.status] ?? "rmUnknown")}>{sym(r.status)}</span> {@html inline(c.replace(/^\S\s*/, ""))}{:else}{@html inline(c)}{#if i === stand.header.length - 1}{@render refchips(todosFor(r.id).map((x) => x.id ?? 0).filter(Boolean), t("rmOpenTodos"))}{#if testsFor(r.id).length}<span class="refs"><small>{t("rmTests")}</small>{#each testsFor(r.id) as p}<button type="button" class="refchip" onclick={() => pick("tests")} title={p.purpose}>{p.name} {p.tests.filter((x) => res(x.id) === "✓").length}/{p.tests.length}</button>{/each}</span>{/if}{/if}{/if}
</td>
{/each}
</tr>
{/each}
</tbody>
</table>
{#if !shown.length}<p class="hint">{t("rmNone")}</p>{/if}
</div>
{:else if current?.kind === "road"}
{@const vs = versions(current.lines)}
{@const badge = (name: string) => verBadges.get(name)}
<div class="versions">
{#each vs as v, i}
{@const b = badge(v.name)}
<section class="ver">
<header><span class="vname">{v.name}</span><span class="vtitle">{v.title}</span>
{#if b?.text}<span class="pill {b.cls}">{b.text}</span>
{:else}<span class="pill plan">{i === vs.length - 1 ? t("rmVerNew") : t("rmVerPlanning")}</span>{/if}
</header>
<p>{@html inline(v.text.replace(/#\d{3,}(,\s*)?/g, "").replace(/Todo:\s*:?\s*/g, "").trim())}</p>
{@render refchips(v.ids, t("rmTodoShort"), true)}
{#if i < vs.length - 1}<span class="arrow" aria-hidden="true">→</span>{/if}
</section>
{/each}
</div>
{:else if current?.kind === "orders"}
{@const tb = tableOf(current.lines)}
<div class="tablewrap">
<table>
<thead><tr>{#each tb.header as h}<th>{h}</th>{/each}</tr></thead>
<tbody>{#each tb.rows as r}<tr>{#each r as c}<td>{@html inline(c)}</td>{/each}</tr>{/each}</tbody>
</table>
</div>
{:else if current}
{@const all: Bullet[] = bullets(current.lines)}
{@const isDec = current.kind === "decide"}
{@const items = isDec ? all.filter((b) => !decFilter || (decFilter === "open") === !isDecided(b)).sort((a, b) => Number(isDecided(a)) - Number(isDecided(b))) : all}
{#if prose(current.lines)}<p class="hint">{@html inline(prose(current.lines))}</p>{/if}
{#if isDec}
<div class="filters" data-testid="rm-decide-filters">
<button type="button" class="chip" class:on={!decFilter} onclick={() => (decFilter = "")}>{t("rmAll")} {decide.length}</button>
<button type="button" class="chip" class:on={decFilter === "open"} data-testid="rm-decide-open" onclick={() => (decFilter = "open")}>{t("rmDecOpen")} {decOpen}</button>
<button type="button" class="chip" class:on={decFilter === "done"} data-testid="rm-decide-done" onclick={() => (decFilter = "done")}>{t("rmDecDone")} {decDone}</button>
</div>
{/if}
{#if items.length}
<div class="list">
{#each items as it, bi (`${it.id ?? it.text}-${bi}`)}
<div class="card plain" class:done={isDec && isDecided(it)} class:flash={flash === it.id} data-id={it.id}>
{#if it.id !== null}{@render idchip(it.id)}{:else}<span class="num dot">•</span>{/if}
{#if isDec}<span class="pill {isDecided(it) ? 'ok' : 'open'}" data-testid="rm-decide-state">{isDecided(it) ? t("rmDecDone") : t("rmDecOpen")}</span>{/if}
<span class="ttl">{@html inline(it.text)}{@render refchips(it.refs, t("rmAdvances"))}</span>
</div>
{/each}
</div>
{:else}
<div class="free">{@html block(current.lines.join("\n"))}</div>
{/if}
{/if}
{/if}
</article>
<style>
.howto { border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 14px; font-size: .88rem; }
.howto summary { cursor: pointer; font-weight: 600; }
.howto ol { margin: 8px 0; padding-left: 1.3rem; display: grid; gap: 4px; }
.roadmap { max-width: 78rem; display: grid; gap: 12px; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.titles { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
h1 { margin: 0; font-size: 1.5rem; }
.badge { font-size: .72rem; color: var(--warn); border: 1px solid color-mix(in srgb, var(--warn) 50%, var(--line)); border-radius: 999px; padding: 0 8px; }
.tools { display: flex; align-items: center; gap: 8px; }
small, .hint { color: var(--muted); font-size: .82rem; margin: 0; }
.stamp { margin: 0; color: var(--muted); font-size: .86rem; }
.error { color: var(--danger); margin: 0; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr)); gap: 8px; }
.stat { display: grid; gap: 2px; text-align: left; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); cursor: pointer; font: inherit; color: var(--text); border-left-width: 4px; }
.stat strong { font-size: 1.5rem; line-height: 1.1; }
.stat span { font-size: .78rem; color: var(--muted); }
.stat.ok { border-left-color: var(--ok); } .stat.part { border-left-color: var(--warn); } .stat.open { border-left-color: var(--danger); }
.stat.tests { border-left-color: var(--ok); }
.proc { display: grid; gap: 6px; margin-top: 10px; }
.proc header { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.proc h2 { margin: 0; font-size: 1.05rem; font-family: ui-monospace, monospace; }
.kind { font-size: .74rem; border: 1px solid var(--line); border-radius: 999px; padding: 0 8px; color: var(--muted); }
.kind.auto { color: var(--accent); border-color: var(--accent); }
.stat.unk { border-left-color: var(--muted); } .stat.todo { border-left-color: var(--accent); }
.stat.on, .stat:hover { background: var(--accent-soft); }
.tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--line); }
.tabs button { border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: transparent; padding: 8px 12px; color: var(--muted); cursor: pointer; font: inherit; }
.tabs button.on { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.tabs button:hover { color: var(--text); }
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.chip { border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; background: transparent; color: var(--muted); cursor: pointer; font: inherit; font-size: .82rem; }
.chip.on { background: var(--accent-soft); color: var(--text); border-color: var(--accent); }
.chip.ok.on { border-color: var(--ok); } .chip.part.on { border-color: var(--warn); } .chip.open.on { border-color: var(--danger); }
.filters input { margin-left: auto; min-width: 12rem; }
.group { font-size: 1rem; margin: 8px 0 0; color: var(--muted); font-weight: 600; }
.list { display: grid; gap: 6px; }
.card { border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.card summary { display: flex; align-items: flex-start; gap: 10px; padding: 9px 12px; cursor: pointer; list-style: none; }
.card summary::-webkit-details-marker { display: none; }
.card.plain { display: flex; gap: 10px; padding: 9px 12px; }
.card.plain summary { cursor: default; padding: 0; }
.card.done { opacity: .85; }
.idchip { flex: none; font: inherit; font-size: .74rem; font-family: ui-monospace, monospace; padding: 1px 7px; border-radius: 999px; border: 1px solid var(--line); background: var(--accent-soft); color: var(--text); cursor: copy; height: fit-content; }
.idchip:hover { border-color: var(--accent); }
.idchip.copied { border-color: var(--ok); color: var(--ok); }
.idcell { white-space: nowrap; width: 1%; }
.refs { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; margin-top: 8px; }
.refs small { margin-right: 2px; }
.refchip { font: inherit; font-size: .76rem; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--muted); cursor: pointer; max-width: 22rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.refchip:hover { color: var(--text); border-color: var(--accent); }
.refchip span { margin-left: 4px; color: var(--muted); }
.refchip.missing { border-style: dashed; }
/* In Versionspaketen: grün = erledigt (#1168), grau/gemischt = nicht abgeschlossen */
.refchip.done { background: color-mix(in srgb, var(--ok) 18%, transparent); border-color: var(--ok); color: var(--ok); }
.refchip.done span { color: inherit; }
.refchip.open { border-color: color-mix(in srgb, var(--warn) 60%, var(--line)); }
.flash { animation: flash 1.6s ease-out; }
@keyframes flash { 0% { box-shadow: 0 0 0 3px var(--accent); background: var(--accent-soft); } 100% { box-shadow: 0 0 0 0 transparent; } }
@media (prefers-reduced-motion: reduce) { .flash { animation: none; outline: 2px solid var(--accent); } }
.num { flex: none; min-width: 1.7rem; height: 1.7rem; display: inline-grid; place-items: center; border-radius: 999px; background: var(--accent-soft); font-size: .8rem; font-weight: 600; }
.num.dot { background: transparent; color: var(--muted); }
.ttl { flex: 1; line-height: 1.45; }
.more { color: var(--muted); transition: transform .15s; }
.card[open] .more { transform: rotate(180deg); }
.detail { padding: 0 14px 12px calc(12px + 1.7rem + 10px); color: var(--text); font-size: .9rem; line-height: 1.55; border-top: 1px solid var(--line); padding-top: 10px; margin: 0 12px; padding-left: 0; }
.card:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
table { border-collapse: collapse; width: 100%; font-size: .88rem; }
th { text-align: left; background: var(--panel); position: sticky; top: 0; font-weight: 600; }
th, td { padding: 7px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
tbody tr:hover { background: var(--accent-soft); }
td.state { white-space: nowrap; }
.pill { display: inline-grid; place-items: center; min-width: 1.5rem; height: 1.5rem; border-radius: 999px; font-weight: 700; color: var(--on-accent); background: var(--muted); }
.pill.ok { background: var(--ok); } .pill.part { background: var(--warn); } .pill.open { background: var(--danger); }
.versions { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 10px; }
.ver { position: relative; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); padding: 12px 14px; }
.ver header { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.pill.work { background: var(--accent); }
.pill.plan { background: color-mix(in srgb, var(--line) 60%, transparent); color: var(--muted); }
.vname { font-size: 1.2rem; font-weight: 700; color: var(--accent); }
.vtitle { font-weight: 600; }
.ver p { margin: 8px 0 0; font-size: .9rem; line-height: 1.5; }
.arrow { position: absolute; right: -14px; top: 14px; color: var(--muted); }
.free :global(table) { border-collapse: collapse; }
.newer { border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 10px; background: var(--panel); padding: 10px 14px; margin: 10px 0; }
.newer p { margin: 4px 0 0; }
.plain { white-space: pre-wrap; word-break: break-word; font: inherit; line-height: 1.5; }
</style>

33
viewer/src/lib/api.ts Normal file
View File

@ -0,0 +1,33 @@
// 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<Response> {
const r = await fetch(`/api/${path}${path.includes("?") ? "&" : "?"}project=${encodeURIComponent(session.project)}`, { cache: "no-store" });
return r;
}
export async function listProjects(): Promise<ProjectInfo[]> {
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<string> {
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<string> {
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() : [];
}

View File

@ -0,0 +1,47 @@
// Alle Texte der Ansicht an einer Stelle (Deutsch). Unbekannte Schlüssel erscheinen als Schlüssel.
const de: Record<string, string> = {
rmTitle: "Roadmap",
rmNewer: "Datei ist neuer als ich verstehe",
rmNewerDetail: "Die ROADMAP.md hat Format {n}, dieser Viewer versteht bis Format {max}. Sie wird deshalb nur als einfacher Text gezeigt.",
rmNextId: "Nächste freie ID",
rmNextIdTip: "Steht im Kopf der ROADMAP.md",
rmLoaded: "Gelesen um",
rmReload: "Neu lesen",
rmSummary: "Kennzahlen",
rmDone: "fertig",
rmPart: "teilweise",
rmOpen2: "offen",
rmUnknown: "nicht geprüft",
rmTestsOk: "Tests bestanden",
rmTodoCount: "Todo offen",
rmAll: "Alle",
rmSearch: "Suchen …",
rmNone: "Keine Treffer.",
rmCopyId: "ID kopieren",
rmAdvances: "bringt voran",
rmOpenTodos: "offene Todos",
rmTests: "Tests",
rmTodoShort: "Todo",
rmCovers: "deckt ab",
rmFinished: "Erledigt (einzeln)",
rmDoneTitle: "Erledigt je Tag",
rmP1Empty: "Kein P1-Punkt offen",
rmP1Open: "Nächstes Paket in der Roadmap",
rmDecOpen: "offen",
rmDecDone: "entschieden",
rmVerDone: "veröffentlicht",
rmVerWork: "in Arbeit",
rmVerNew: "neu",
rmVerPlanning: "Planung",
rmProcess: "Prozess",
rmHowTitle: "So entstehen die Ergebnisse",
rmHow1: "Jeder Test steht in KLICKTESTS.md mit Schritten und erwartetem Ergebnis.",
rmHow2: "Ein Lauf ist eine Berichtsdatei in testberichte/ (Zeit, Commit, ✓ oder ✗, Notiz).",
rmHow3: "Der letzte Bericht je Test gilt; „–“ heißt nie gelaufen.",
rmHow4: "Diese Ansicht liest nur. Berichte schreibt der Assistent oder ein automatischer Lauf.",
rmHowProc: "So gehst du vor",
};
export function t(key: string): string {
return de[key] ?? key;
}

209
viewer/src/lib/roadmap.ts Normal file
View File

@ -0,0 +1,209 @@
// Zerlegt die ROADMAP.md in Abschnitte, Tabellenzeilen, Todo-Karten und Listen, damit die Startseite des Entwicklungsfensters sie
// übersichtlich darstellen kann. Die Datei bleibt die einzige Quelle; was hier nicht erkannt wird, erscheint als einfacher Text.
export interface Section { id: string; title: string; lines: string[] }
export interface Row { id: number | null; cells: string[]; status: string }
export interface TodoItem { id: number | null; title: string; detail: string; group: string; refs: number[] }
export interface Bullet { id: number | null; text: string; refs: number[] }
export interface Version { name: string; title: string; text: string; ids: number[] }
export interface Doc { head: string; sections: Section[]; nextId: number | null }
/** Formatversion, die dieser Viewer versteht (siehe FORMAT.md im Projekt) */
export const VIEWER_FORMAT = 1;
/** `Format: N` im Kopf der ROADMAP.md. Ohne Angabe: 0 (Altformat). Keine Zahl: NaN */
export function formatVersion(head: string): number {
const m = head.match(/\bFormat:\s*([^\s·]+)/);
if (!m) return 0;
return /^\d+$/.test(m[1]) ? Number(m[1]) : NaN;
}
/** Die Datei ist neuer, als dieser Viewer sie versteht */
export function isNewerFormat(head: string): boolean {
return formatVersion(head) > VIEWER_FORMAT;
}
const STATUS = ["✓", "◐", "✗", "?"] as const;
export const STATUSES = STATUS;
/** `[#1042] Text` am Anfang einer Zeile */
function takeId(text: string): { id: number | null; rest: string } {
const m = text.match(/^\[#(\d+)\]\s*(.*)$/s);
return m ? { id: Number(m[1]), rest: m[2] } : { id: null, rest: text };
}
/** ` → #1012, #1013` am Ende: Anforderungen, die ein Punkt voranbringt */
function takeRefs(text: string): { refs: number[]; rest: string } {
const m = text.match(/\s*→\s*((?:#\d+(?:,\s*)?)+)\s*$/);
return m ? { refs: [...m[1].matchAll(/#(\d+)/g)].map((x) => Number(x[1])), rest: text.slice(0, m.index).trim() } : { refs: [], rest: text };
}
export function parseDoc(text: string): Doc {
const lines = text.replace(/\r/g, "").split("\n");
const sections: Section[] = [];
const head: string[] = [];
let cur: Section | null = null;
for (const line of lines) {
const m = line.match(/^##\s+(?:(\d+)\.\s*)?(.+?)\s*$/);
if (m) {
cur = { id: m[1] ?? String(sections.length + 1), title: m[2], lines: [] };
sections.push(cur);
} else if (cur) cur.lines.push(line);
else if (!line.startsWith("# ")) head.push(line);
}
const headText = head.join("\n").trim();
const next = headText.match(/Nächste freie ID:\s*#(\d+)/);
return { head: headText, sections, nextId: next ? Number(next[1]) : null };
}
/** Tabellenzeilen (ohne Kopf und Trennzeile) als Zellen */
export function tableOf(lines: string[]): { header: string[]; rows: string[][] } {
const rows = lines.filter((l) => l.trim().startsWith("|")).map((l) => l.trim().replace(/^\||\|$/g, "").split("|").map((c) => c.trim()));
if (rows.length < 2) return { header: [], rows: [] };
return { header: rows[0], rows: rows.slice(2) };
}
export function statusOf(cell: string): string {
const first = cell.trim().charAt(0);
return (STATUS as readonly string[]).includes(first) ? first : "";
}
/** Stand-Tabelle: Spalte „ID“ (falls vorhanden) wird herausgelöst, die übrigen Zellen bleiben in Kopf und Zeilen */
export function statusRows(lines: string[]): { header: string[]; rows: Row[] } {
const t = tableOf(lines);
const idCol = t.header.findIndex((h) => /^id$/i.test(h));
const header = t.header.filter((_, i) => i !== idCol);
const col = header.findIndex((h) => /^stand$/i.test(h));
return {
header,
rows: t.rows.map((all) => {
const idText = idCol >= 0 ? (all[idCol] ?? "").replace("#", "").trim() : "";
const cells = all.filter((_, i) => i !== idCol);
return { id: idText ? Number(idText) : null, cells, status: col >= 0 ? statusOf(cells[col] ?? "") : "" };
}),
};
}
/** Titel einer Karte: der fette Anfang, sonst der erste Satz */
function splitTitle(text: string): { title: string; detail: string } {
const t = text.trim();
if (t.startsWith("**")) {
const end = t.indexOf("**", 2);
if (end > 2) {
let title = t.slice(0, end + 2);
let rest = t.slice(end + 2).trim();
// sehr kurze Fettschrift („Du:“) reicht nicht als Titel: den ersten Satz dazunehmen
if (title.length - 4 < 8) {
const dot = rest.search(/[.;] /);
if (dot > 0 && dot < 140) { title = `${title} ${rest.slice(0, dot + 1)}`; rest = rest.slice(dot + 2).trim(); }
else if (rest.length > 110) { const cut = rest.lastIndexOf(" ", 100); title = `${title} ${rest.slice(0, cut)} …`; }
}
return { title, detail: rest };
}
}
if (t.length <= 110) return { title: t, detail: "" };
const dot = t.search(/[.;] /);
if (dot > 0 && dot < 140) return { title: t.slice(0, dot + 1), detail: t.slice(dot + 2).trim() };
return { title: `${t.slice(0, 100)} …`, detail: t };
}
export const FINISHED_GROUP = "Erledigt (einzeln)";
export function todoItems(lines: string[]): { items: TodoItem[]; finished: TodoItem[]; done: { title: string; text: string }[] } {
const items: TodoItem[] = [];
const finished: TodoItem[] = [];
const done: { title: string; text: string }[] = [];
let group = "";
for (const raw of lines) {
const line = raw.trim();
if (!line) continue;
const g = line.match(/^\*\*(P\d[a-z]?)\s*[–-]\s*(.+?)\*\*$/);
if (g) { group = `${g[1]} – ${g[2]}`; continue; }
if (/^\*\*Erledigt \(einzeln\)\*\*$/.test(line)) { group = FINISHED_GROUP; continue; }
const d = line.match(/^\*\*(Erledigt am [^*]+?):?\*\*\s*(.*)$/);
if (d) { done.push({ title: d[1].replace(/:$/, ""), text: d[2] }); group = FINISHED_GROUP; continue; }
const bullet = line.match(/^(?:-\s+|\d+\.\s+)(.*)$/);
if (!bullet) continue;
const { id, rest } = takeId(bullet[1]);
const { refs, rest: body } = takeRefs(rest);
const { title, detail } = splitTitle(body);
const item = { id, title, detail, group, refs };
(group === FINISHED_GROUP ? finished : items).push(item);
}
return { items, finished, done };
}
export function bullets(lines: string[]): Bullet[] {
return lines.map((l) => l.trim()).filter((l) => l.startsWith("- ")).map((l) => {
const { id, rest } = takeId(l.slice(2).trim());
const { refs, rest: text } = takeRefs(rest);
return { id, text, refs };
});
}
export function versions(lines: string[]): Version[] {
const out: Version[] = [];
for (const raw of lines) {
const m = raw.trim().match(/^\*\*([^*]+?)\.?\*\*\s*(.*)$/);
if (m) {
const [name, ...rest] = m[1].split(/\s+[–-]\s+/);
out.push({ name: name.trim(), title: rest.join(" – ").trim(), text: m[2].trim(), ids: [...new Set([...m[2].matchAll(/#(\d{3,})/g)].map((x) => Number(x[1])))] });
}
}
return out;
}
/** Fließtext ohne Listen und Tabellen (zum Beispiel ein einleitender Satz) */
export function prose(lines: string[]): string {
return lines.filter((l) => l.trim() && !l.trim().startsWith("|") && !l.trim().startsWith("- ") && !/^\d+\.\s/.test(l.trim()) && !l.trim().startsWith("**")).join(" ").trim();
}
export interface KlickTest { id: string; steps: string; expected: string; kind: string }
export interface Process { name: string; purpose: string; covers: number[]; precondition: string; /** Ablauf in Worten („So gehst du vor“), Markdown */ howto: string; tests: KlickTest[] }
/** KLICKTESTS.md: je Prozess (`## name`) Zweck, abgedeckte Funktionen, Voraussetzung und Testtabelle */
export function parseTests(text: string): { intro: string; processes: Process[] } {
const doc = parseDoc(text);
const processes: Process[] = doc.sections.map((s) => {
const field = (label: string) => s.lines.find((l) => l.trim().startsWith(`**${label}:**`))?.replace(new RegExp(`^\\s*\\*\\*${label}:\\*\\*\\s*`), "").trim() ?? "";
const t = tableOf(s.lines);
// „So gehst du vor“: alles zwischen dieser Zeile und der Tabelle
const at = s.lines.findIndex((l) => l.trim().startsWith("**So gehst du vor:**"));
const end = s.lines.findIndex((l, i) => i > at && l.trim().startsWith("|"));
const howto = at < 0 ? "" : s.lines.slice(at + 1, end < 0 ? undefined : end).join("\n").trim();
return {
howto,
name: s.title,
purpose: field("Zweck"),
covers: [...field("Deckt ab").matchAll(/#(\d+)/g)].map((m) => Number(m[1])),
precondition: field("Voraussetzung"),
tests: t.rows.map((c) => ({ id: c[0] ?? "", steps: c[1] ?? "", expected: c[2] ?? "", kind: c[3] ?? "" })),
};
}).filter((p) => p.tests.length);
return { intro: doc.head, processes };
}
/** Ein Lauf eines Tests aus einem Bericht in `testberichte/` (ein Testlauf von Hand oder eine Zeile eines automatischen Laufs) */
export interface TestRun { id: string; zeit: string; commit: string; art: string; result: "✓" | "✗"; note: string; file: string }
/** Berichtsdateien (Kopfblock `test`, `zeit`, `commit`, `art`, `ergebnis`; darunter die Notiz). Ein Bericht der Art `auto-lauf` führt je Test eine Zeile „- id: ✓“. */
export function parseReports(files: { file: string; text: string }[]): TestRun[] {
const runs: TestRun[] = [];
for (const f of files) {
const m = f.text.replace(/\r\n/g, "\n").match(/^---\n([\s\S]*?)\n---\n?([\s\S]*)$/);
if (!m) continue;
const head: Record<string, string> = {};
for (const line of m[1].split("\n")) { const i = line.indexOf(":"); if (i > 0) head[line.slice(0, i).trim()] = line.slice(i + 1).trim(); }
const base = { zeit: head.zeit ?? "", commit: head.commit ?? "", art: head.art ?? "manuell", file: f.file };
if (base.art === "auto-lauf") {
for (const l of m[2].split("\n")) {
const r = l.match(/^- ([a-z0-9.\-]+): (✓|✗)(?:\s+(.*))?$/);
if (r) runs.push({ ...base, id: r[1], result: r[2] as "✓" | "✗", note: r[3] ?? "" });
}
} else if (head.test && (head.ergebnis === "✓" || head.ergebnis === "✗")) {
runs.push({ ...base, id: head.test, result: head.ergebnis, note: m[2].trim() });
}
}
// Reihenfolge: älteste zuerst (Zeit, dann Dateiname), der letzte Eintrag je Test gilt
return runs.sort((a, b) => a.zeit.localeCompare(b.zeit) || a.file.localeCompare(b.file));
}

View File

@ -0,0 +1,18 @@
// Testdaten für die Ansicht: Prozesse aus KLICKTESTS.md, Läufe aus testberichte/. Nur lesend.
import { devKlicktests, devReports } from "./api";
import { parseReports, parseTests, type Process, type TestRun } from "./roadmap";
export const td = $state<{ intro: string; processes: Process[]; runs: TestRun[] }>({ intro: "", processes: [], runs: [] });
export async function loadTestData(): Promise<void> {
const parsed = parseTests(await devKlicktests());
td.intro = parsed.intro;
td.processes = parsed.processes;
td.runs = parseReports(await devReports());
}
/** Letzter Lauf eines Tests (die Berichte sind nach Zeit sortiert, der letzte Eintrag gilt) */
export function lastRun(id: string): TestRun | undefined {
for (let i = td.runs.length - 1; i >= 0; i--) if (td.runs[i].id === id) return td.runs[i];
return undefined;
}

5
viewer/src/main.ts Normal file
View File

@ -0,0 +1,5 @@
import { mount } from "svelte";
import "./app.css";
import App from "./App.svelte";
mount(App, { target: document.getElementById("app")! });