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:
@ -17,7 +17,7 @@ Gilt für alle Harnesses (Claude Code, Codex, agy, OpenCode, pi). Dieses Projekt
|
|||||||
1. Erklären und fragen, bevor gebaut wird: Änderung, Empfehlung zuerst, nötige Entscheidungen.
|
1. Erklären und fragen, bevor gebaut wird: Änderung, Empfehlung zuerst, nötige Entscheidungen.
|
||||||
2. Bauen, testen, committen.
|
2. Bauen, testen, committen.
|
||||||
3. Nachziehen: Stand-Zeilen (✓ ◐ ✗ ?), erledigte Todos nach „Erledigt (einzeln)“ (`- [#ID] **Titel** – erledigt am TT.MM.JJJJ. Ergebnis`, je Tag ein Absatz `**Erledigt am TT.MM.JJJJ:** …`), Datum im Kopf, nächste ID.
|
3. Nachziehen: Stand-Zeilen (✓ ◐ ✗ ?), erledigte Todos nach „Erledigt (einzeln)“ (`- [#ID] **Titel** – erledigt am TT.MM.JJJJ. Ergebnis`, je Tag ein Absatz `**Erledigt am TT.MM.JJJJ:** …`), Datum im Kopf, nächste ID.
|
||||||
4. `python3 bestand/plugin-0.2.0/plugins/projekt-steuerung/skills/projekt-steuerung/scripts/check_ids.py ROADMAP.md` ausführen. Erst bei „OK“ gilt das Nachziehen als erledigt. (Sobald #1019 erledigt ist, gilt das erweiterte Prüfskript.)
|
4. `python3 skill/scripts/check_format.py ROADMAP.md` ausführen (prüft nach `FORMAT.md`, auch `KLICKTESTS.md` und `testberichte/`). Erst bei „OK“ gilt das Nachziehen als erledigt. Das alte `check_ids.py` im Bestand prüft nur die IDs.
|
||||||
5. Berichten: was geprüft ist, was nicht, was gemessen und was vermutet ist.
|
5. Berichten: was geprüft ist, was nicht, was gemessen und was vermutet ist.
|
||||||
|
|
||||||
## Format (Viewer und Parser hängen daran, nicht ändern)
|
## Format (Viewer und Parser hängen daran, nicht ändern)
|
||||||
@ -26,7 +26,7 @@ Gilt für alle Harnesses (Claude Code, Codex, agy, OpenCode, pi). Dieses Projekt
|
|||||||
- Todo: Gruppen `**P1 – Name**`, Punkte `- [#ID] **Titel.** Text → #ID`, Block `**Erledigt (einzeln)**`.
|
- Todo: Gruppen `**P1 – Name**`, Punkte `- [#ID] **Titel.** Text → #ID`, Block `**Erledigt (einzeln)**`.
|
||||||
- Entscheidungen: `- [#ID] Frage → #ID`. Entschieden ist, wenn der Text „Entschieden …“ enthält.
|
- Entscheidungen: `- [#ID] Frage → #ID`. Entschieden ist, wenn der Text „Entschieden …“ enthält.
|
||||||
- Roadmap: `**0.2 – Name.** Todo: #1057, #1058. Ziel: …`.
|
- Roadmap: `**0.2 – Name.** Todo: #1057, #1058. Ziel: …`.
|
||||||
- Kopf enthält `Nächste freie ID: #NNNN` und `Projekt-ID: P-0000`.
|
- Kopf enthält `Nächste freie ID: #NNNN`, `Projekt-ID: P-0000` und `Format: 1`. Das genaue Format steht in `FORMAT.md` (Vertrag); im Zweifel gilt dieses Dokument.
|
||||||
- In Tabellenzellen kein senkrechter Strich verwenden. In `ROADMAP.md` keine ID-ähnlichen Beispiele wie `#1234` schreiben, die es nicht gibt, die Prüfung meldet sie als Verweis ins Leere.
|
- In Tabellenzellen kein senkrechter Strich verwenden. In `ROADMAP.md` keine ID-ähnlichen Beispiele wie `#1234` schreiben, die es nicht gibt, die Prüfung meldet sie als Verweis ins Leere.
|
||||||
|
|
||||||
## Klicktests
|
## Klicktests
|
||||||
|
|||||||
65
FORMAT.md
Normal file
65
FORMAT.md
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
# FORMAT.md – Dateiformat der Projektsteuerung, Version 1
|
||||||
|
|
||||||
|
Vertrag zwischen Skill, Prüfskript, Server und Viewer (→ #1005). Das Prüfskript `skill/scripts/check_format.py` prüft genau das, was hier steht. Der Viewer liest nach denselben Regeln, ist aber toleranter: Was er nicht erkennt, zeigt er als einfachen Text.
|
||||||
|
|
||||||
|
**Formatversion.** Eine Datei nennt ihre Version im Kopf der `ROADMAP.md` mit `Format: 1`.
|
||||||
|
- Fehlt die Angabe, gilt **Format 0** (Altformat, vor dieser Spezifikation). Das Prüfskript prüft dann nur die IDs und meldet einen Hinweis; Exit-Code 0, wenn die IDs stimmen.
|
||||||
|
- Format 1: strenge Prüfung nach diesem Dokument.
|
||||||
|
- Eine höhere Version als die, die der Leser versteht: Das Prüfskript meldet „Datei ist neuer als ich verstehe“ und endet mit Exit-Code 2, der Viewer zeigt den Rest als einfachen Text.
|
||||||
|
|
||||||
|
**Exit-Codes des Prüfskripts.** 0 = sauber (auch Format 0 mit Hinweis), 1 = Fehler gefunden, 2 = Formatversion zu neu. Jeder Fehler steht als `Datei:Zeile: FEHLER Grund`.
|
||||||
|
|
||||||
|
## 1. ROADMAP.md
|
||||||
|
|
||||||
|
### Kopf
|
||||||
|
Alles vor dem ersten `## `-Abschnitt (die Zeile `# Titel` zählt nicht dazu). Pflicht in Format 1:
|
||||||
|
- `Nächste freie ID: #NNNN` (auch in Format 0).
|
||||||
|
- `Format: 1`.
|
||||||
|
- `Projekt-ID: P-nnnn` (vier Ziffern). Eine Zeile oder mehrere, die drei Angaben dürfen in derselben Zeile stehen. Die Vergabe der Nummer regelt der Register-Dienst (→ #1020).
|
||||||
|
|
||||||
|
### Abschnitte
|
||||||
|
- `## N. Titel`, mit Nummer. Der Reiter wird über den Anfang des Titels erkannt (Groß-/Kleinschreibung egal): `Todo`, `Stand`, `Offene Entscheidungen`, `Roadmap`, `Risiken`, `Leitplanken`, `Aufträge`.
|
||||||
|
- Pflicht: Leitplanken, Stand, Todo, Offene Entscheidungen. Optional: Roadmap, Risiken, Aufträge. Jeder Reiter höchstens einmal. Weitere Abschnitte sind erlaubt und erscheinen im Viewer ohne besondere Darstellung.
|
||||||
|
|
||||||
|
### IDs
|
||||||
|
- `#nnnn`, vierstellig ab `#1001`, eine Zählung für alles. Definition ist die erste Zelle einer Tabellenzeile (`| #1001 |`) oder der Anfang einer Listenzeile (`- [#1001]`). Jede ID nur einmal definiert.
|
||||||
|
- Jeder Verweis `#nnnn` im Text muss auf eine definierte ID zeigen oder auf die nächste freie ID. Die nächste freie ID ist größer als alle vergebenen.
|
||||||
|
- Verweise auf eine Anforderung stehen am Zeilenende als `→ #ID` oder `→ #ID, #ID`.
|
||||||
|
- Keine ID-ähnlichen Beispiele schreiben, die es nicht gibt (die Prüfung meldet sie als Verweis ins Leere).
|
||||||
|
|
||||||
|
### Stand-Tabelle
|
||||||
|
- Eine Tabelle im Abschnitt „Stand“, Kopf mit den Spalten `ID` und `Stand` (weitere frei, Reihenfolge frei), Trennzeile, jede Zeile hat genau so viele Zellen wie der Kopf. Kein senkrechter Strich in einer Zelle.
|
||||||
|
- ID-Zelle: `#nnnn`. Stand-Zelle beginnt mit `✓`, `◐`, `✗` oder `?`.
|
||||||
|
|
||||||
|
### Todo
|
||||||
|
- Gruppen als eigene Zeile `**P1 – Name**` (auch `P2`, `P3`, mit Buchstabenzusatz wie `P1a`; Gedankenstrich oder Bindestrich).
|
||||||
|
- Punkte als `- [#ID] **Titel.** Text → #ID`. Jeder Punkt steht in einer Gruppe und beginnt mit `[#ID]`. Keine nummerierten Listen (keine Positionsnummern).
|
||||||
|
- Erledigtes steht unter der Zeile `**Erledigt (einzeln)**` als `- [#ID] **Titel** – erledigt am TT.MM.JJJJ. Ergebnis`.
|
||||||
|
- Je Tag ein Absatz `**Erledigt am TT.MM.JJJJ:** Stichworte`. **Das Datum ist TT.MM.JJJJ**, nicht Jahr-Monat-Tag (die Vorlage des Bestands 0.2.0 schreibt es noch falsch → #1054).
|
||||||
|
|
||||||
|
### Offene Entscheidungen und Risiken
|
||||||
|
- Jede Listenzeile `- [#ID] Text → #ID`. Entschieden ist eine Entscheidung, wenn der Text „Entschieden“ enthält (üblich: `Entschieden am TT.MM.JJJJ: …`).
|
||||||
|
|
||||||
|
### Roadmap
|
||||||
|
- Eine Zeile je Paket: `**0.2 – Name.** Todo: #ID, #ID. Ziel: …`. Ausnahme: die Zeile `**Danach.** …`.
|
||||||
|
|
||||||
|
### Leitplanken, Aufträge
|
||||||
|
- Freier Text beziehungsweise Liste/Tabelle. Keine Prüfung über das Allgemeine hinaus.
|
||||||
|
|
||||||
|
## 2. KLICKTESTS.md
|
||||||
|
Wird im Format 1 mitgeprüft, wenn die Datei neben der `ROADMAP.md` liegt.
|
||||||
|
- Je Prozess ein Abschnitt `## quelle2ziel` (Kleinbuchstaben und Ziffern, mit `2` dazwischen). Abschnitte, deren Titel mit `(` beginnt (zum Beispiel „(noch keine Prozesse)“), zählen nicht.
|
||||||
|
- Pflichtzeilen: `**Zweck:**`, `**Deckt ab:**` (IDs müssen in der Stand-Tabelle stehen), `**Voraussetzung:**`.
|
||||||
|
- Tabelle mit Kopf `Test | Schritte | Erwartet | Art`, vier Zellen je Zeile. Test-ID `<prozess>.<nr>`, eindeutig. Art: `manuell` oder `auto`.
|
||||||
|
|
||||||
|
## 3. testberichte/
|
||||||
|
Je Lauf eine Datei `*.md` mit Kopfblock zwischen `---`-Zeilen und Notiz darunter.
|
||||||
|
- Pflicht: `test`, `zeit`, `commit`, `art`, `ergebnis` (`✓` oder `✗`).
|
||||||
|
- `art: auto-lauf`: Pflicht sind `zeit`, `commit`, `art`; darunter je Test eine Zeile `- id: ✓ Notiz`.
|
||||||
|
- Ein Bericht über eine Test-ID, die es in `KLICKTESTS.md` nicht gibt, ergibt einen Hinweis, keinen Fehler.
|
||||||
|
|
||||||
|
## 4. Ableitung und Abweichungen
|
||||||
|
Quellen: Skilltext (`SKILL.md`), Vorlagen, Parser `roadmap.ts` und `check_ids.py` des Bestands 0.2.0. Dabei festgeschrieben:
|
||||||
|
- Verweise sind vierstellig (der Parser nahm auch kürzere, `check_ids.py` nur vierstellige).
|
||||||
|
- Datum im Block „Erledigt am“: TT.MM.JJJJ (Skilltext), nicht die Schreibweise der Vorlage.
|
||||||
|
- Die Testtabellen der Vorlage haben sechs Zellen bei vier Spalten; maßgeblich sind vier.
|
||||||
@ -21,6 +21,7 @@ Klicktests prüfen **Prozesse** (Abläufe von einem Anfang zu einem Ende), nicht
|
|||||||
**Zweck:** Das Dateiformat ist festgeschrieben, versioniert und wird von Prüfskript und Viewer gleich verstanden.
|
**Zweck:** Das Dateiformat ist festgeschrieben, versioniert und wird von Prüfskript und Viewer gleich verstanden.
|
||||||
**Deckt ab:** #1005, #1006
|
**Deckt ab:** #1005, #1006
|
||||||
**Voraussetzung:** `FORMAT.md` v1 und das erweiterte Prüfskript.
|
**Voraussetzung:** `FORMAT.md` v1 und das erweiterte Prüfskript.
|
||||||
|
**Lauf:** `python3 skill/tests/format2lint.py` (Tests .1 und .2), `node viewer/tests/format2lint.3.mjs` (Logik von .3), Anzeige von .3 im Browser gegen `viewer/`.
|
||||||
|
|
||||||
| Test | Schritte | Erwartet | Art |
|
| Test | Schritte | Erwartet | Art |
|
||||||
| --- | --- | --- | --- |
|
| --- | --- | --- | --- |
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
# Projekt-Plattform (Arbeitstitel) – Anforderungen, Todo und Roadmap
|
# Projekt-Plattform (Arbeitstitel) – Anforderungen, Todo und Roadmap
|
||||||
|
|
||||||
Stand: 2026-11-03 (vormittags) · Projekt-ID: P-0000 · noch kein Release; Git-Repo nur lokal, nichts gepusht. Bestand: Plugin 0.2.0 (Skill + Viewer) liegt unter `bestand/plugin-0.2.0/` und ist in einer echten Installation geprüft (→ #1031, Berichte in `testberichte/`). Quellen dieser Liste: Gespräch vom 03.11.2026 (Konzeptentwicklung), Bestand (Skill, Viewer).
|
Stand: 2026-11-03 (vormittags) · Projekt-ID: P-0000 · Format: 1 · noch kein Release; Git-Repo nur lokal, nichts gepusht. Bestand: Plugin 0.2.0 (Skill + Viewer) liegt unter `bestand/plugin-0.2.0/` und ist in einer echten Installation geprüft (→ #1031, Berichte in `testberichte/`). Quellen dieser Liste: Gespräch vom 03.11.2026 (Konzeptentwicklung), Bestand (Skill, Viewer).
|
||||||
Zeichen: ✓ fertig · ◐ teilweise · ✗ offen · ? nicht geprüft.
|
Zeichen: ✓ fertig · ◐ teilweise · ✗ offen · ? nicht geprüft.
|
||||||
**IDs:** Jeder Punkt in Stand-Tabelle, Todo, Entscheidungen und Risiken hat eine feste ID `#1xxx` (eine Zählung für alles, nie wiederverwendet, am Anfang der Zeile). „→ #…“ nennt die Anforderung, die ein Todo voranbringt. Erledigtes wandert mit ID in „Erledigt (einzeln)“. Die IDs gelten nur innerhalb dieses Projekts; global heißt ein Punkt Projekt-ID plus Nummer (Beispiel: P-0000 und die Nummer). Nächste freie ID: #1055.
|
**IDs:** Jeder Punkt in Stand-Tabelle, Todo, Entscheidungen und Risiken hat eine feste ID `#1xxx` (eine Zählung für alles, nie wiederverwendet, am Anfang der Zeile). „→ #…“ nennt die Anforderung, die ein Todo voranbringt. Erledigtes wandert mit ID in „Erledigt (einzeln)“. Die IDs gelten nur innerhalb dieses Projekts; global heißt ein Punkt Projekt-ID plus Nummer (Beispiel: P-0000 und die Nummer). Nächste freie ID: #1055.
|
||||||
**Teil:** Stand-Zeilen und Todos nennen den Teil (Skill, Server, Viewer, Agent oder übergreifend), damit sich Teile später mit ihren Zeilen in ein eigenes Projekt herauslösen lassen (nur in diesem Projekt, keine Regel der Arbeitsweise).
|
**Teil:** Stand-Zeilen und Todos nennen den Teil (Skill, Server, Viewer, Agent oder übergreifend), damit sich Teile später mit ihren Zeilen in ein eigenes Projekt herauslösen lassen (nur in diesem Projekt, keine Regel der Arbeitsweise).
|
||||||
|
|||||||
361
skill/scripts/check_format.py
Normal file
361
skill/scripts/check_format.py
Normal file
@ -0,0 +1,361 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
"""Prüft ROADMAP.md (und daneben KLICKTESTS.md und testberichte/) nach FORMAT.md.
|
||||||
|
|
||||||
|
Aufruf: check_format.py [pfad/zur/ROADMAP.md] (Standard: ./ROADMAP.md)
|
||||||
|
|
||||||
|
Exit-Code 0 = sauber (auch Format 0 mit Hinweis), 1 = Fehler, 2 = Formatversion zu neu.
|
||||||
|
Jeder Fehler steht als `Datei:Zeile: FEHLER Grund`. Nur Standardbibliothek.
|
||||||
|
Ohne Zeile `Format: 1` im Kopf gilt Format 0: es werden nur die IDs geprüft (wie check_ids.py).
|
||||||
|
"""
|
||||||
|
import collections
|
||||||
|
import os
|
||||||
|
import re
|
||||||
|
import sys
|
||||||
|
|
||||||
|
VERSTANDEN = 1
|
||||||
|
STAND_ZEICHEN = "✓◐✗?"
|
||||||
|
KINDS = [
|
||||||
|
("todo", re.compile(r"^todo", re.I)),
|
||||||
|
("stand", re.compile(r"^stand", re.I)),
|
||||||
|
("decide", re.compile(r"^offene entscheid", re.I)),
|
||||||
|
("road", re.compile(r"^roadmap", re.I)),
|
||||||
|
("risk", re.compile(r"^risiken", re.I)),
|
||||||
|
("rules", re.compile(r"^leitplanken", re.I)),
|
||||||
|
("orders", re.compile(r"^auftr", re.I)),
|
||||||
|
]
|
||||||
|
PFLICHT = ["rules", "stand", "todo", "decide"]
|
||||||
|
KIND_NAME = {"todo": "Todo", "stand": "Stand", "decide": "Offene Entscheidungen", "road": "Roadmap",
|
||||||
|
"risk": "Risiken", "rules": "Leitplanken", "orders": "Aufträge"}
|
||||||
|
|
||||||
|
|
||||||
|
class Meldungen:
|
||||||
|
def __init__(self):
|
||||||
|
self.fehler = []
|
||||||
|
self.hinweise = []
|
||||||
|
|
||||||
|
def err(self, datei, zeile, text):
|
||||||
|
self.fehler.append(f"{datei}:{zeile}: FEHLER {text}")
|
||||||
|
|
||||||
|
def hint(self, datei, zeile, text):
|
||||||
|
self.hinweise.append(f"{datei}:{zeile}: HINWEIS {text}" if zeile else f"{datei}: HINWEIS {text}")
|
||||||
|
|
||||||
|
|
||||||
|
def lies(pfad):
|
||||||
|
with open(pfad, encoding="utf-8") as f:
|
||||||
|
return f.read().replace("\r", "").split("\n")
|
||||||
|
|
||||||
|
|
||||||
|
def zellen(zeile):
|
||||||
|
"""Wie der Viewer: äußere Striche weg, an `|` teilen, trimmen"""
|
||||||
|
return [c.strip() for c in re.sub(r"^\||\|$", "", zeile.strip()).split("|")]
|
||||||
|
|
||||||
|
|
||||||
|
def abschnitte(lines):
|
||||||
|
"""[(nr oder None, titel, startzeile (1-basiert), [(zeilennr, text)])]"""
|
||||||
|
out = []
|
||||||
|
for i, l in enumerate(lines, 1):
|
||||||
|
m = re.match(r"^##\s+(?:(\d+)\.\s*)?(.+?)\s*$", l)
|
||||||
|
if m:
|
||||||
|
out.append([m.group(1), m.group(2), i, []])
|
||||||
|
elif out:
|
||||||
|
out[-1][3].append((i, l))
|
||||||
|
return out
|
||||||
|
|
||||||
|
|
||||||
|
def kopf(lines):
|
||||||
|
"""Zeilen vor dem ersten Abschnitt ohne die Titelzeile"""
|
||||||
|
res = []
|
||||||
|
for i, l in enumerate(lines, 1):
|
||||||
|
if re.match(r"^##\s+", l):
|
||||||
|
break
|
||||||
|
if not l.startswith("# "):
|
||||||
|
res.append((i, l))
|
||||||
|
return res
|
||||||
|
|
||||||
|
|
||||||
|
def ids_pruefen(name, lines, m, streng):
|
||||||
|
"""Definitionen, Doppelte, Verweise, nächste freie ID. Gibt (definierte IDs, nächste ID) zurück"""
|
||||||
|
defs = []
|
||||||
|
for i, l in enumerate(lines, 1):
|
||||||
|
d = re.match(r"^\| #(\d+) \|", l) or re.match(r"^- \[#(\d+)\]", l)
|
||||||
|
if d:
|
||||||
|
defs.append((int(d.group(1)), i))
|
||||||
|
nxt = None
|
||||||
|
nxt_zeile = 0
|
||||||
|
for i, l in enumerate(lines, 1):
|
||||||
|
n = re.search(r"Nächste freie ID: #(\d+)", l)
|
||||||
|
if n:
|
||||||
|
nxt, nxt_zeile = int(n.group(1)), i
|
||||||
|
break
|
||||||
|
if nxt is None:
|
||||||
|
m.err(name, 1, "'Nächste freie ID: #…' fehlt im Kopf")
|
||||||
|
erste = {}
|
||||||
|
for i_d, z in defs:
|
||||||
|
if i_d in erste:
|
||||||
|
m.err(name, z, f"doppelte ID #{i_d} (zuerst in Zeile {erste[i_d]})")
|
||||||
|
else:
|
||||||
|
erste[i_d] = z
|
||||||
|
if streng and not (1001 <= i_d <= 9999 and len(str(i_d)) == 4):
|
||||||
|
m.err(name, z, f"ID #{i_d} ist nicht vierstellig ab #1001")
|
||||||
|
gesehen = set()
|
||||||
|
for i, l in enumerate(lines, 1):
|
||||||
|
for r in re.finditer(r"#(\d{4})", l):
|
||||||
|
v = int(r.group(1))
|
||||||
|
if v in erste or v == nxt or v in gesehen:
|
||||||
|
continue
|
||||||
|
gesehen.add(v)
|
||||||
|
m.err(name, i, f"Verweis ins Leere: #{v} ist nirgends definiert")
|
||||||
|
if nxt is not None:
|
||||||
|
for i_d, z in defs:
|
||||||
|
if i_d >= nxt:
|
||||||
|
m.err(name, z, f"nächste freie ID #{nxt} ist nicht größer als die vergebene ID #{i_d}")
|
||||||
|
return set(erste), nxt
|
||||||
|
|
||||||
|
|
||||||
|
def stand_pruefen(name, sec, m):
|
||||||
|
start, zl = sec[2], sec[3]
|
||||||
|
tab = [(n, l) for n, l in zl if l.strip().startswith("|")]
|
||||||
|
if len(tab) < 2:
|
||||||
|
m.err(name, start, "Abschnitt Stand: keine Tabelle (Kopf und Trennzeile) gefunden")
|
||||||
|
return
|
||||||
|
kn, kl = tab[0]
|
||||||
|
kopfz = zellen(kl)
|
||||||
|
if not any(h.lower() == "id" for h in kopfz):
|
||||||
|
m.err(name, kn, "Stand-Tabelle: Spalte 'ID' fehlt im Kopf")
|
||||||
|
if not any(h.lower() == "stand" for h in kopfz):
|
||||||
|
m.err(name, kn, "Stand-Tabelle: Spalte 'Stand' fehlt im Kopf")
|
||||||
|
sn, sl = tab[1]
|
||||||
|
if not re.match(r"^\|?[\s\-:|]+\|?$", sl.strip()) or "-" not in sl:
|
||||||
|
m.err(name, sn, "Stand-Tabelle: Trennzeile unter dem Kopf fehlt")
|
||||||
|
idc = next((i for i, h in enumerate(kopfz) if h.lower() == "id"), None)
|
||||||
|
stc = next((i for i, h in enumerate(kopfz) if h.lower() == "stand"), None)
|
||||||
|
for n, l in tab[2:]:
|
||||||
|
c = zellen(l)
|
||||||
|
if len(c) != len(kopfz):
|
||||||
|
m.err(name, n, f"Stand-Zeile hat {len(c)} Zellen, der Kopf {len(kopfz)} (senkrechter Strich in einer Zelle?)")
|
||||||
|
continue
|
||||||
|
if idc is not None and not re.match(r"^#\d{4}$", c[idc]):
|
||||||
|
m.err(name, n, f"Stand-Zeile: ID-Zelle '{c[idc]}' ist nicht von der Form #nnnn")
|
||||||
|
if stc is not None and (not c[stc] or c[stc][0] not in STAND_ZEICHEN):
|
||||||
|
m.err(name, n, f"Stand-Zeile: Stand '{c[stc][:20]}' beginnt nicht mit ✓, ◐, ✗ oder ?")
|
||||||
|
|
||||||
|
|
||||||
|
def todo_pruefen(name, sec, m):
|
||||||
|
gruppe = ""
|
||||||
|
for n, raw in sec[3]:
|
||||||
|
l = raw.strip()
|
||||||
|
if not l:
|
||||||
|
continue
|
||||||
|
if re.match(r"^\*\*(P\d[a-z]?)\s*[–-]\s*(.+?)\*\*$", l):
|
||||||
|
gruppe = l
|
||||||
|
continue
|
||||||
|
if re.match(r"^\*\*Erledigt \(einzeln\)\*\*$", l):
|
||||||
|
gruppe = "ERLEDIGT"
|
||||||
|
continue
|
||||||
|
d = re.match(r"^\*\*(Erledigt am [^*]+?):?\*\*", l)
|
||||||
|
if d:
|
||||||
|
if not re.match(r"^Erledigt am \d{2}\.\d{2}\.\d{4}$", d.group(1).strip()):
|
||||||
|
m.err(name, n, f"'{d.group(1)}': Datum muss TT.MM.JJJJ sein")
|
||||||
|
gruppe = "ERLEDIGT"
|
||||||
|
continue
|
||||||
|
b = re.match(r"^(?:-\s+|(\d+)\.\s+)(.*)$", l)
|
||||||
|
if not b:
|
||||||
|
continue
|
||||||
|
if b.group(1):
|
||||||
|
m.err(name, n, "nummerierte Liste im Todo (keine Positionsnummern, Punkte beginnen mit [#ID])")
|
||||||
|
continue
|
||||||
|
if not gruppe:
|
||||||
|
m.err(name, n, "Todo-Punkt steht vor jeder Gruppe (**P1 – Name**)")
|
||||||
|
if not re.match(r"^\[#\d{4}\]\s", b.group(2)):
|
||||||
|
m.err(name, n, "Todo-Punkt beginnt nicht mit [#ID]")
|
||||||
|
if gruppe == "ERLEDIGT" and not re.search(r"erledigt am \d{2}\.\d{2}\.\d{4}", b.group(2)):
|
||||||
|
m.err(name, n, "erledigter Punkt ohne 'erledigt am TT.MM.JJJJ'")
|
||||||
|
|
||||||
|
|
||||||
|
def liste_pruefen(name, sec, m, was):
|
||||||
|
for n, raw in sec[3]:
|
||||||
|
l = raw.strip()
|
||||||
|
if l.startswith("- ") and not re.match(r"^- \[#\d{4}\]\s", l):
|
||||||
|
m.err(name, n, f"{was}-Zeile beginnt nicht mit [#ID]")
|
||||||
|
|
||||||
|
|
||||||
|
def roadmap_pruefen(name, sec, m):
|
||||||
|
for n, raw in sec[3]:
|
||||||
|
l = raw.strip()
|
||||||
|
r = re.match(r"^\*\*([^*]+?)\.?\*\*\s*(.*)$", l)
|
||||||
|
if not r:
|
||||||
|
continue
|
||||||
|
if r.group(1).strip().lower().startswith("danach"):
|
||||||
|
continue
|
||||||
|
if "Todo:" not in r.group(2) or "Ziel:" not in r.group(2):
|
||||||
|
m.err(name, n, f"Roadmap-Zeile '{r.group(1)}' braucht 'Todo: …' und 'Ziel: …'")
|
||||||
|
|
||||||
|
|
||||||
|
def roadmap_streng(name, lines, m):
|
||||||
|
k = kopf(lines)
|
||||||
|
ktext = "\n".join(t for _, t in k)
|
||||||
|
if not re.search(r"Projekt-ID:\s*P-\d{4}\b", ktext):
|
||||||
|
# Zeile der Formatangabe, sonst die erste nichtleere Kopfzeile
|
||||||
|
zeile = next((n for n, t in k if re.search(r"\bFormat:", t)), next((n for n, t in k if t.strip()), 1))
|
||||||
|
m.err(name, zeile, "Projekt-ID fehlt im Kopf (Form: 'Projekt-ID: P-nnnn')")
|
||||||
|
secs = abschnitte(lines)
|
||||||
|
gefunden = collections.defaultdict(list)
|
||||||
|
for s in secs:
|
||||||
|
if s[0] is None:
|
||||||
|
m.err(name, s[2], f"Abschnitt '{s[1]}' ohne Nummer (Form: '## N. Titel')")
|
||||||
|
kind = next((k_ for k_, rx in KINDS if rx.match(s[1])), None)
|
||||||
|
if kind:
|
||||||
|
gefunden[kind].append(s)
|
||||||
|
for kind in PFLICHT:
|
||||||
|
if not gefunden[kind]:
|
||||||
|
m.err(name, 1, f"Pflichtabschnitt '{KIND_NAME[kind]}' fehlt")
|
||||||
|
for kind, lst in gefunden.items():
|
||||||
|
for s in lst[1:]:
|
||||||
|
m.err(name, s[2], f"Abschnitt '{KIND_NAME[kind]}' kommt mehrfach vor")
|
||||||
|
if gefunden["stand"]:
|
||||||
|
stand_pruefen(name, gefunden["stand"][0], m)
|
||||||
|
if gefunden["todo"]:
|
||||||
|
todo_pruefen(name, gefunden["todo"][0], m)
|
||||||
|
if gefunden["decide"]:
|
||||||
|
liste_pruefen(name, gefunden["decide"][0], m, "Entscheidungs")
|
||||||
|
if gefunden["risk"]:
|
||||||
|
liste_pruefen(name, gefunden["risk"][0], m, "Risiko")
|
||||||
|
if gefunden["road"]:
|
||||||
|
roadmap_pruefen(name, gefunden["road"][0], m)
|
||||||
|
return gefunden
|
||||||
|
|
||||||
|
|
||||||
|
def stand_ids(gefunden, lines):
|
||||||
|
ids = set()
|
||||||
|
if gefunden["stand"]:
|
||||||
|
for n, l in gefunden["stand"][0][3]:
|
||||||
|
d = re.match(r"^\| #(\d+) \|", l)
|
||||||
|
if d:
|
||||||
|
ids.add(int(d.group(1)))
|
||||||
|
return ids
|
||||||
|
|
||||||
|
|
||||||
|
def klicktests_pruefen(pfad, name, stand, m):
|
||||||
|
lines = lies(pfad)
|
||||||
|
namen = set()
|
||||||
|
tests = set()
|
||||||
|
for nr, titel, start, zl in abschnitte(lines):
|
||||||
|
if titel.startswith("("):
|
||||||
|
continue
|
||||||
|
if not re.match(r"^[a-z0-9]+2[a-z0-9]+$", titel):
|
||||||
|
m.err(name, start, f"Prozessname '{titel}' hat nicht die Form quelle2ziel")
|
||||||
|
if titel in namen:
|
||||||
|
m.err(name, start, f"Prozess '{titel}' kommt mehrfach vor")
|
||||||
|
namen.add(titel)
|
||||||
|
txt = "\n".join(t for _, t in zl)
|
||||||
|
for feld in ("Zweck", "Deckt ab", "Voraussetzung"):
|
||||||
|
if f"**{feld}:**" not in txt:
|
||||||
|
m.err(name, start, f"Prozess '{titel}': Zeile **{feld}:** fehlt")
|
||||||
|
da = re.search(r"\*\*Deckt ab:\*\*(.*)", txt)
|
||||||
|
if da:
|
||||||
|
for v in re.findall(r"#(\d+)", da.group(1)):
|
||||||
|
if int(v) not in stand:
|
||||||
|
m.err(name, start, f"Prozess '{titel}': 'Deckt ab' nennt #{v}, das nicht in der Stand-Tabelle steht")
|
||||||
|
tab = [(n, l) for n, l in zl if l.strip().startswith("|")]
|
||||||
|
if len(tab) < 3:
|
||||||
|
m.err(name, start, f"Prozess '{titel}': keine Testtabelle mit mindestens einem Test")
|
||||||
|
continue
|
||||||
|
kopfz = zellen(tab[0][1])
|
||||||
|
if kopfz != ["Test", "Schritte", "Erwartet", "Art"]:
|
||||||
|
m.err(name, tab[0][0], "Testtabelle: Kopf muss 'Test | Schritte | Erwartet | Art' sein")
|
||||||
|
for n, l in tab[2:]:
|
||||||
|
c = zellen(l)
|
||||||
|
if len(c) != 4:
|
||||||
|
m.err(name, n, f"Testzeile hat {len(c)} Zellen, erwartet 4")
|
||||||
|
continue
|
||||||
|
if not re.match(rf"^{re.escape(titel)}\.\d+$", c[0]):
|
||||||
|
m.err(name, n, f"Test-ID '{c[0]}' passt nicht zum Prozess (erwartet {titel}.<nr>)")
|
||||||
|
if c[0] in tests:
|
||||||
|
m.err(name, n, f"Test-ID '{c[0]}' doppelt")
|
||||||
|
tests.add(c[0])
|
||||||
|
if c[3] not in ("manuell", "auto"):
|
||||||
|
m.err(name, n, f"Art '{c[3]}' ist weder manuell noch auto")
|
||||||
|
return tests
|
||||||
|
|
||||||
|
|
||||||
|
def berichte_pruefen(ordner, tests, m):
|
||||||
|
if not os.path.isdir(ordner):
|
||||||
|
return
|
||||||
|
for fn in sorted(os.listdir(ordner)):
|
||||||
|
if not fn.endswith(".md"):
|
||||||
|
continue
|
||||||
|
name = os.path.join(os.path.basename(ordner), fn)
|
||||||
|
text = "\n".join(lies(os.path.join(ordner, fn)))
|
||||||
|
mm = re.match(r"^---\n([\s\S]*?)\n---\n?([\s\S]*)$", text)
|
||||||
|
if not mm:
|
||||||
|
m.err(name, 1, "Kopfblock zwischen --- fehlt")
|
||||||
|
continue
|
||||||
|
kopfd = {}
|
||||||
|
for line in mm.group(1).split("\n"):
|
||||||
|
i = line.find(":")
|
||||||
|
if i > 0:
|
||||||
|
kopfd[line[:i].strip()] = line[i + 1:].strip()
|
||||||
|
auto = kopfd.get("art") == "auto-lauf"
|
||||||
|
pflicht = ["zeit", "commit", "art"] if auto else ["test", "zeit", "commit", "art", "ergebnis"]
|
||||||
|
for k in pflicht:
|
||||||
|
if not kopfd.get(k):
|
||||||
|
m.err(name, 1, f"Kopffeld '{k}' fehlt")
|
||||||
|
if not auto and kopfd.get("ergebnis") not in (None, "", "✓", "✗"):
|
||||||
|
m.err(name, 1, f"ergebnis '{kopfd['ergebnis']}' ist weder ✓ noch ✗")
|
||||||
|
ids = [kopfd["test"]] if not auto and kopfd.get("test") else re.findall(r"^- ([a-z0-9.\-]+): (?:✓|✗)", mm.group(2), re.M)
|
||||||
|
for t in ids:
|
||||||
|
if tests is not None and t not in tests:
|
||||||
|
m.hint(name, 0, f"Bericht über unbekannten Test '{t}'")
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
pfad = sys.argv[1] if len(sys.argv) > 1 else "ROADMAP.md"
|
||||||
|
name = os.path.basename(pfad)
|
||||||
|
lines = lies(pfad)
|
||||||
|
m = Meldungen()
|
||||||
|
|
||||||
|
ktext = "\n".join(t for _, t in kopf(lines))
|
||||||
|
fm = re.search(r"\bFormat:\s*([^\s·]+)", ktext)
|
||||||
|
projekt = re.search(r"Projekt-ID:\s*(P-\d{4})\b", ktext)
|
||||||
|
|
||||||
|
if fm is None:
|
||||||
|
version = 0
|
||||||
|
elif re.match(r"^\d+$", fm.group(1)):
|
||||||
|
version = int(fm.group(1))
|
||||||
|
else:
|
||||||
|
m.err(name, 1, f"'Format: {fm.group(1)}' ist keine Zahl")
|
||||||
|
version = 0
|
||||||
|
|
||||||
|
ids, nxt = ids_pruefen(name, lines, m, streng=version >= 1)
|
||||||
|
|
||||||
|
if version > VERSTANDEN:
|
||||||
|
print(f"Datei ist neuer als ich verstehe: Format {version}, verstanden bis Format {VERSTANDEN}. Weitere Prüfung entfällt.")
|
||||||
|
sys.exit(2)
|
||||||
|
|
||||||
|
if version == 0:
|
||||||
|
m.hint(name, 0, "keine Zeile 'Format: 1' im Kopf: Altformat (Format 0), nur die IDs wurden geprüft")
|
||||||
|
else:
|
||||||
|
gefunden = roadmap_streng(name, lines, m)
|
||||||
|
stand = stand_ids(gefunden, lines)
|
||||||
|
ordner = os.path.dirname(os.path.abspath(pfad))
|
||||||
|
kt = os.path.join(ordner, "KLICKTESTS.md")
|
||||||
|
tests = None
|
||||||
|
if os.path.isfile(kt):
|
||||||
|
tests = klicktests_pruefen(kt, "KLICKTESTS.md", stand, m)
|
||||||
|
else:
|
||||||
|
m.hint("KLICKTESTS.md", 0, "Datei fehlt neben der ROADMAP.md, nicht geprüft")
|
||||||
|
berichte_pruefen(os.path.join(ordner, "testberichte"), tests, m)
|
||||||
|
|
||||||
|
print(f"IDs: {len(ids)} · nächste freie: #{nxt} · Format: {version}" + (f" · Projekt-ID: {projekt.group(1)}" if projekt else ""))
|
||||||
|
for h in m.hinweise:
|
||||||
|
print(h)
|
||||||
|
for f in m.fehler:
|
||||||
|
print(f)
|
||||||
|
if m.fehler:
|
||||||
|
print(f"{len(m.fehler)} Fehler")
|
||||||
|
sys.exit(1)
|
||||||
|
print("OK")
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
105
skill/tests/format2lint.py
Normal file
105
skill/tests/format2lint.py
Normal file
@ -0,0 +1,105 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
"""Automatische Tests format2lint.1 und .2 (und Zusatzfälle) für skill/scripts/check_format.py.
|
||||||
|
|
||||||
|
Aufruf: python3 skill/tests/format2lint.py (aus dem Projektordner)
|
||||||
|
Die Fehlerfälle entstehen als Kopien der echten ROADMAP.md in einem Temp-Ordner, mit genau einer Änderung.
|
||||||
|
Gibt je Test eine Zeile `- id: ✓|✗ Notiz` aus und endet mit Exit-Code 1, wenn einer ✗ ist.
|
||||||
|
"""
|
||||||
|
import os
|
||||||
|
import re
|
||||||
|
import shutil
|
||||||
|
import subprocess
|
||||||
|
import sys
|
||||||
|
import tempfile
|
||||||
|
|
||||||
|
ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", ".."))
|
||||||
|
LINT = os.path.join(ROOT, "skill", "scripts", "check_format.py")
|
||||||
|
ergebnisse = []
|
||||||
|
|
||||||
|
|
||||||
|
def lint(ordner):
|
||||||
|
p = subprocess.run([sys.executable, "-I", LINT, os.path.join(ordner, "ROADMAP.md")], capture_output=True, text=True)
|
||||||
|
return p.returncode, p.stdout
|
||||||
|
|
||||||
|
|
||||||
|
def kopie():
|
||||||
|
d = tempfile.mkdtemp(prefix="format2lint-")
|
||||||
|
shutil.copy(os.path.join(ROOT, "ROADMAP.md"), d)
|
||||||
|
shutil.copy(os.path.join(ROOT, "KLICKTESTS.md"), d)
|
||||||
|
shutil.copytree(os.path.join(ROOT, "testberichte"), os.path.join(d, "testberichte"))
|
||||||
|
return d
|
||||||
|
|
||||||
|
|
||||||
|
def ersetze(d, datei, alt, neu, anzahl=1):
|
||||||
|
p = os.path.join(d, datei)
|
||||||
|
s = open(p, encoding="utf-8").read()
|
||||||
|
assert s.count(alt) >= 1, f"Testaufbau: '{alt[:40]}' nicht gefunden"
|
||||||
|
open(p, "w", encoding="utf-8").write(s.replace(alt, neu, anzahl))
|
||||||
|
|
||||||
|
|
||||||
|
def zeile_von(d, datei, teil):
|
||||||
|
for i, l in enumerate(open(os.path.join(d, datei), encoding="utf-8").read().split("\n"), 1):
|
||||||
|
if teil in l:
|
||||||
|
return i
|
||||||
|
raise AssertionError(f"Testaufbau: Zeile mit '{teil}' fehlt")
|
||||||
|
|
||||||
|
|
||||||
|
def melde(tid, ok, notiz):
|
||||||
|
ergebnisse.append(ok)
|
||||||
|
print(f"- {tid}: {'✓' if ok else '✗'} {notiz}")
|
||||||
|
|
||||||
|
|
||||||
|
def fehlerfall(tid, beschreibung, aender, datei, suchteil, grund):
|
||||||
|
d = kopie()
|
||||||
|
try:
|
||||||
|
aender(d)
|
||||||
|
z = zeile_von(d, datei, suchteil)
|
||||||
|
code, out = lint(d)
|
||||||
|
erwartet = f"{datei}:{z}: FEHLER"
|
||||||
|
ok = code == 1 and erwartet in out and grund in out
|
||||||
|
melde(tid, ok, f"{beschreibung}: Exit {code}, {'Zeile ' + str(z) + ' und Grund gemeldet' if ok else 'Meldung weicht ab: ' + repr(out[-300:])}")
|
||||||
|
finally:
|
||||||
|
shutil.rmtree(d, ignore_errors=True)
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
# .1 echte Datei
|
||||||
|
d = kopie()
|
||||||
|
code, out = lint(d)
|
||||||
|
melde("format2lint.1", code == 0 and "OK" in out and "Format: 1" in out and "Projekt-ID: P-0000" in out,
|
||||||
|
f"echte ROADMAP.md: Exit {code}, Formatversion und Projekt-ID erkannt" if code == 0 else out[-300:])
|
||||||
|
shutil.rmtree(d, ignore_errors=True)
|
||||||
|
|
||||||
|
# .2 Fehlerfälle
|
||||||
|
fehlerfall("format2lint.2a", "doppelte ID", lambda d: ersetze(d, "ROADMAP.md", "| #1002 |", "| #1001 |"),
|
||||||
|
"ROADMAP.md", "| #1001 | Plugin-Paket", "doppelte ID #1001")
|
||||||
|
fehlerfall("format2lint.2b", "Verweis ins Leere", lambda d: ersetze(d, "ROADMAP.md", "Tests `projekt2sync.1–.3`. → #1015", "Tests `projekt2sync.1–.3`. → #1999"),
|
||||||
|
"ROADMAP.md", "→ #1999", "#1999 ist nirgends definiert")
|
||||||
|
fehlerfall("format2lint.2c", "fehlende Projekt-ID", lambda d: ersetze(d, "ROADMAP.md", "Projekt-ID: P-0000 · ", ""),
|
||||||
|
"ROADMAP.md", "Stand: 2026-11-03", "Projekt-ID fehlt")
|
||||||
|
fehlerfall("format2lint.2d", "kaputte Stand-Zeile", lambda d: ersetze(d, "ROADMAP.md", "| Bestand | ✓ | In echter Installation geprüft (bestand2plugin.1)", "| Bestand | fertig | In echter Installation geprüft (bestand2plugin.1)"),
|
||||||
|
"ROADMAP.md", "| fertig |", "beginnt nicht mit ✓")
|
||||||
|
fehlerfall("format2lint.2e", "falsches Datum im Erledigt-Block", lambda d: ersetze(d, "ROADMAP.md", "**Erledigt am 03.11.2026:**", "**Erledigt am 2026-11-03:**"),
|
||||||
|
"ROADMAP.md", "**Erledigt am 2026-11-03:**", "Datum muss TT.MM.JJJJ sein")
|
||||||
|
fehlerfall("format2lint.2f", "Zelle mit senkrechtem Strich", lambda d: ersetze(d, "ROADMAP.md", "Plugin-Paket (Marketplace,", "Plugin-Paket | (Marketplace,"),
|
||||||
|
"ROADMAP.md", "Plugin-Paket | (Marketplace,", "Zellen")
|
||||||
|
fehlerfall("format2lint.2g", "Klicktest-Zeile mit falscher Art", lambda d: ersetze(d, "KLICKTESTS.md", "| format2lint.1 | Prüfskript auf die `ROADMAP.md` dieses Projekts anwenden | Ausgabe OK, Formatversion und Projekt-ID werden erkannt | auto |", "| format2lint.1 | Prüfskript auf die `ROADMAP.md` dieses Projekts anwenden | Ausgabe OK, Formatversion und Projekt-ID werden erkannt | robot |"),
|
||||||
|
"KLICKTESTS.md", "| robot |", "weder manuell noch auto")
|
||||||
|
|
||||||
|
# Zusatz: Format 0 und zu neue Version
|
||||||
|
d = kopie()
|
||||||
|
ersetze(d, "ROADMAP.md", " · Format: 1", "")
|
||||||
|
code, out = lint(d)
|
||||||
|
melde("format2lint.2h", code == 0 and "Altformat (Format 0)" in out, f"ohne Format-Zeile: Exit {code}, Hinweis auf Format 0")
|
||||||
|
shutil.rmtree(d, ignore_errors=True)
|
||||||
|
d = kopie()
|
||||||
|
ersetze(d, "ROADMAP.md", "Format: 1", "Format: 2")
|
||||||
|
code, out = lint(d)
|
||||||
|
melde("format2lint.2i", code == 2 and "neuer als ich verstehe" in out, f"Format 2: Exit {code}, Hinweis 'neuer als ich verstehe'")
|
||||||
|
shutil.rmtree(d, ignore_errors=True)
|
||||||
|
|
||||||
|
sys.exit(0 if all(ergebnisse) else 1)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
1
viewer/.gitignore
vendored
Normal file
1
viewer/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
node_modules/
|
||||||
25
viewer/README.md
Normal file
25
viewer/README.md
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
# Roadmap-Viewer
|
||||||
|
|
||||||
|
Zeigt `ROADMAP.md`, `KLICKTESTS.md` und `testberichte/` eines oder mehrerer Projekte an. Nur lesend, nichts im Projekt wird geändert.
|
||||||
|
Liest beim Öffnen und beim Zurückkehren ins Fenster neu.
|
||||||
|
|
||||||
|
## Start
|
||||||
|
|
||||||
|
```
|
||||||
|
npm install # nur für Entwicklung am Viewer
|
||||||
|
npm run build # nach Änderungen am Viewer (dist/ ist im Plugin vorgebaut)
|
||||||
|
node server.mjs /pfad/zum/projekt [/pfad/zu/weiterem/projekt …]
|
||||||
|
```
|
||||||
|
|
||||||
|
Dann `http://127.0.0.1:4177` öffnen (Port per `PORT=…`, Adresse per `HOST=…`). Bei mehreren Projekten erscheint oben eine Auswahl.
|
||||||
|
|
||||||
|
Entwicklung am Viewer: `node server.mjs <projekt>` und parallel `npm run dev` (Port 5173, leitet `/api` an den Server).
|
||||||
|
|
||||||
|
## Aufbau
|
||||||
|
|
||||||
|
| Datei | Zweck |
|
||||||
|
| --- | --- |
|
||||||
|
| `server.mjs` | liefert die Projektdateien (`/api/...`) und `dist/`; keine Abhängigkeiten |
|
||||||
|
| `src/lib/roadmap.ts` | Parser, unverändert aus Kanonwerk |
|
||||||
|
| `src/lib/RoadmapView.svelte` | Ansicht aus Kanonwerk, ohne Tauri, Rollen-Simulator und Test-Starter |
|
||||||
|
| `src/lib/api.ts`, `testdata.svelte.ts`, `i18n.svelte.ts` | Ersatz für die Kanonwerk-Anbindung, Testdaten und Texte |
|
||||||
67
viewer/dist/assets/index-B2FvJfcT.js
vendored
Normal file
67
viewer/dist/assets/index-B2FvJfcT.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
viewer/dist/assets/index-Cd54ZlSB.css
vendored
Normal file
1
viewer/dist/assets/index-Cd54ZlSB.css
vendored
Normal file
File diff suppressed because one or more lines are too long
13
viewer/dist/index.html
vendored
Normal file
13
viewer/dist/index.html
vendored
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<html lang="de">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
|
<title>Roadmap-Viewer</title>
|
||||||
|
<script type="module" crossorigin src="/assets/index-B2FvJfcT.js"></script>
|
||||||
|
<link rel="stylesheet" crossorigin href="/assets/index-Cd54ZlSB.css">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="app"></div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
12
viewer/index.html
Normal file
12
viewer/index.html
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<html lang="de">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
|
<title>Roadmap-Viewer</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="app"></div>
|
||||||
|
<script type="module" src="/src/main.ts"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
1487
viewer/package-lock.json
generated
Normal file
1487
viewer/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
21
viewer/package.json
Normal file
21
viewer/package.json
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
{
|
||||||
|
"name": "roadmap-viewer",
|
||||||
|
"version": "0.1.0",
|
||||||
|
"private": true,
|
||||||
|
"type": "module",
|
||||||
|
"scripts": {
|
||||||
|
"dev": "vite",
|
||||||
|
"build": "vite build",
|
||||||
|
"start": "node server.mjs"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"dompurify": "^3.2.0",
|
||||||
|
"marked": "^15.0.0"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@sveltejs/vite-plugin-svelte": "^5.0.0",
|
||||||
|
"svelte": "^5.0.0",
|
||||||
|
"typescript": "^5.6.0",
|
||||||
|
"vite": "^6.0.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
66
viewer/server.mjs
Normal file
66
viewer/server.mjs
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
#!/usr/bin/env node
|
||||||
|
// Roadmap-Viewer: liefert ROADMAP.md, KLICKTESTS.md und testberichte/ der angegebenen Projekte (nur lesend)
|
||||||
|
// und die gebaute Oberfläche aus dist/.
|
||||||
|
//
|
||||||
|
// Aufruf: node server.mjs <projektordner> [weitere Projektordner …] (Port: env PORT, Standard 4177)
|
||||||
|
import { createServer } from "node:http";
|
||||||
|
import { readFile, readdir, stat } from "node:fs/promises";
|
||||||
|
import { basename, extname, join, normalize, resolve } from "node:path";
|
||||||
|
import { fileURLToPath } from "node:url";
|
||||||
|
|
||||||
|
const here = fileURLToPath(new URL(".", import.meta.url));
|
||||||
|
const dist = join(here, "dist");
|
||||||
|
const port = Number(process.env.PORT ?? 4177);
|
||||||
|
const host = process.env.HOST ?? "127.0.0.1";
|
||||||
|
|
||||||
|
const projects = process.argv.slice(2).map((p) => resolve(p));
|
||||||
|
if (!projects.length) {
|
||||||
|
console.error("Aufruf: node server.mjs <projektordner> [weitere …]");
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
const list = () => projects.map((p, i) => ({ id: String(i), name: basename(p), path: p }));
|
||||||
|
const dirOf = (id) => projects[Number(id)];
|
||||||
|
|
||||||
|
const text = async (file) => { try { return await readFile(file, "utf8"); } catch { return null; } };
|
||||||
|
const MIME = { ".html": "text/html; charset=utf-8", ".js": "text/javascript; charset=utf-8", ".css": "text/css; charset=utf-8", ".svg": "image/svg+xml", ".json": "application/json; charset=utf-8" };
|
||||||
|
|
||||||
|
function send(res, code, body, type = "text/plain; charset=utf-8") {
|
||||||
|
res.writeHead(code, { "content-type": type, "cache-control": "no-store" });
|
||||||
|
res.end(body);
|
||||||
|
}
|
||||||
|
|
||||||
|
const server = createServer(async (req, res) => {
|
||||||
|
const url = new URL(req.url ?? "/", "http://x");
|
||||||
|
if (req.method !== "GET") return send(res, 405, "nur GET");
|
||||||
|
|
||||||
|
if (url.pathname === "/api/projects") return send(res, 200, JSON.stringify(list()), MIME[".json"]);
|
||||||
|
|
||||||
|
const m = url.pathname.match(/^\/api\/(roadmap|klicktests|reports)$/);
|
||||||
|
if (m) {
|
||||||
|
const dir = dirOf(url.searchParams.get("project") ?? "0");
|
||||||
|
if (!dir) return send(res, 404, "unbekanntes Projekt");
|
||||||
|
if (m[1] === "roadmap" || m[1] === "klicktests") {
|
||||||
|
const name = m[1] === "roadmap" ? "ROADMAP.md" : "KLICKTESTS.md";
|
||||||
|
const t = await text(join(dir, name));
|
||||||
|
return t === null ? send(res, 404, `${name} fehlt in ${dir}`) : send(res, 200, t);
|
||||||
|
}
|
||||||
|
let files = [];
|
||||||
|
try { files = (await readdir(join(dir, "testberichte"))).filter((f) => f.endsWith(".md")).sort(); } catch { /* kein Ordner: keine Berichte */ }
|
||||||
|
const out = [];
|
||||||
|
for (const file of files) out.push({ file, text: (await text(join(dir, "testberichte", file))) ?? "" });
|
||||||
|
return send(res, 200, JSON.stringify(out), MIME[".json"]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Oberfläche aus dist/ (ohne Ausbruch aus dem Ordner)
|
||||||
|
const rel = normalize(decodeURIComponent(url.pathname)).replace(/^([/\\])+/, "");
|
||||||
|
let file = join(dist, rel || "index.html");
|
||||||
|
if (!file.startsWith(dist)) return send(res, 403, "verboten");
|
||||||
|
try { if ((await stat(file)).isDirectory()) file = join(file, "index.html"); } catch { file = join(dist, "index.html"); }
|
||||||
|
try { send(res, 200, await readFile(file), MIME[extname(file)] ?? "application/octet-stream"); }
|
||||||
|
catch { send(res, 404, "dist/ fehlt: erst `npm run build`"); }
|
||||||
|
});
|
||||||
|
|
||||||
|
server.listen(port, host, () => {
|
||||||
|
console.log(`Roadmap-Viewer auf http://${host}:${port}`);
|
||||||
|
for (const p of list()) console.log(` ${p.name}: ${p.path}`);
|
||||||
|
});
|
||||||
45
viewer/src/App.svelte
Normal file
45
viewer/src/App.svelte
Normal 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
20
viewer/src/app.css
Normal 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); }
|
||||||
478
viewer/src/lib/RoadmapView.svelte
Normal file
478
viewer/src/lib/RoadmapView.svelte
Normal 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
33
viewer/src/lib/api.ts
Normal 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() : [];
|
||||||
|
}
|
||||||
47
viewer/src/lib/i18n.svelte.ts
Normal file
47
viewer/src/lib/i18n.svelte.ts
Normal 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
209
viewer/src/lib/roadmap.ts
Normal 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));
|
||||||
|
}
|
||||||
18
viewer/src/lib/testdata.svelte.ts
Normal file
18
viewer/src/lib/testdata.svelte.ts
Normal 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
5
viewer/src/main.ts
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
import { mount } from "svelte";
|
||||||
|
import "./app.css";
|
||||||
|
import App from "./App.svelte";
|
||||||
|
|
||||||
|
mount(App, { target: document.getElementById("app")! });
|
||||||
3
viewer/start.sh
Executable file
3
viewer/start.sh
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# Startet den Viewer (dist/ ist vorgebaut, keine Abhängigkeiten nötig).
|
||||||
|
exec node "$(dirname "$0")/server.mjs" "$@"
|
||||||
3
viewer/svelte.config.js
Normal file
3
viewer/svelte.config.js
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
import { vitePreprocess } from "@sveltejs/vite-plugin-svelte";
|
||||||
|
|
||||||
|
export default { preprocess: vitePreprocess() };
|
||||||
15
viewer/tests/format2lint.3.mjs
Normal file
15
viewer/tests/format2lint.3.mjs
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
// format2lint.3 (Logikteil): erkennt der Viewer-Parser eine neuere Formatversion?
|
||||||
|
// Aufruf: node viewer/tests/format2lint.3.mjs (Node 24: TypeScript-Quellen laufen direkt)
|
||||||
|
import { readFileSync } from "node:fs";
|
||||||
|
import { formatVersion, isNewerFormat, parseDoc, VIEWER_FORMAT } from "../src/lib/roadmap.ts";
|
||||||
|
|
||||||
|
let ok = true;
|
||||||
|
const prüfe = (name, bed, notiz) => { ok &&= bed; console.log(`- ${name}: ${bed ? "✓" : "✗"} ${notiz}`); };
|
||||||
|
|
||||||
|
const echt = parseDoc(readFileSync(new URL("../../ROADMAP.md", import.meta.url), "utf-8"));
|
||||||
|
prüfe("format2lint.3a", formatVersion(echt.head) === 1 && !isNewerFormat(echt.head), `echte ROADMAP.md: Format ${formatVersion(echt.head)}, nicht neuer (Viewer versteht bis ${VIEWER_FORMAT})`);
|
||||||
|
const neu = parseDoc("# X\n\nStand: 2026-11-03 · Projekt-ID: P-0001 · Format: 2 · Nächste freie ID: #1003\n\n## 1. Todo\n- [#1001] a\n");
|
||||||
|
prüfe("format2lint.3b", isNewerFormat(neu.head) && formatVersion(neu.head) === 2, "Format 2 wird als neuer erkannt");
|
||||||
|
prüfe("format2lint.3c", !isNewerFormat(parseDoc("# X\n\nStand: heute\n\n## 1. Todo\n").head), "ohne Format-Zeile (Format 0): nicht neuer");
|
||||||
|
prüfe("format2lint.3d", !isNewerFormat(parseDoc("# X\n\nFormat: abc\n").head), "Format ohne Zahl: nicht als neuer behandelt");
|
||||||
|
process.exit(ok ? 0 : 1);
|
||||||
12
viewer/tsconfig.json
Normal file
12
viewer/tsconfig.json
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"target": "ES2022",
|
||||||
|
"module": "ESNext",
|
||||||
|
"moduleResolution": "bundler",
|
||||||
|
"strict": true,
|
||||||
|
"skipLibCheck": true,
|
||||||
|
"verbatimModuleSyntax": true,
|
||||||
|
"lib": ["ES2022", "DOM", "DOM.Iterable"]
|
||||||
|
},
|
||||||
|
"include": ["src/**/*"]
|
||||||
|
}
|
||||||
8
viewer/vite.config.js
Normal file
8
viewer/vite.config.js
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
import { defineConfig } from "vite";
|
||||||
|
import { svelte } from "@sveltejs/vite-plugin-svelte";
|
||||||
|
|
||||||
|
// Entwicklung: Vite auf 5173, der Server (server.mjs) auf 4177 liefert die Projektdateien.
|
||||||
|
export default defineConfig({
|
||||||
|
plugins: [svelte()],
|
||||||
|
server: { proxy: { "/api": "http://127.0.0.1:4177" } },
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user