P-0000: Projekt-ID und Format 1 in Vorlagen und init.sh, Prüfskript (offen als Hinweis), Viewer-Marke, Tests vorlage2projektid

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-03 10:32:52 +01:00
parent 41354ef448
commit 8c4594fe53
13 changed files with 285 additions and 74 deletions

File diff suppressed because one or more lines are too long

67
viewer/dist/assets/index-DpwYxPe8.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -4,7 +4,7 @@
<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>
<script type="module" crossorigin src="/assets/index-DpwYxPe8.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-Cd54ZlSB.css">
</head>
<body>

View File

@ -7,7 +7,7 @@
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";
import { bullets, isNewerFormat, formatVersion, projectId, 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);
@ -152,6 +152,7 @@
<div class="titles">
<h1>{title || t("rmTitle")}</h1>
{#if path}<span class="badge" title={path}>{path}</span>{/if}
{#if doc && projectId(doc.head)}<span class="badge" title="Projekt-ID" data-testid="rm-pid">{projectId(doc.head) === "offen" ? "Projekt-ID offen" : projectId(doc.head)}</span>{/if}
</div>
<div class="tools">
{#if doc?.nextId}<small title={t("rmNextIdTip")}>{t("rmNextId")} #{doc.nextId}</small>{/if}

View File

@ -18,6 +18,12 @@ export function formatVersion(head: string): number {
return /^\d+$/.test(m[1]) ? Number(m[1]) : NaN;
}
/** `Projekt-ID: P-nnnn` oder `offen` im Kopf; sonst null */
export function projectId(head: string): string | null {
const m = head.match(/Projekt-ID:\s*(P-\d{4}|offen)(?![\w-])/);
return m ? m[1] : null;
}
/** Die Datei ist neuer, als dieser Viewer sie versteht */
export function isNewerFormat(head: string): boolean {
return formatVersion(head) > VIEWER_FORMAT;

View File

@ -0,0 +1,13 @@
// vorlage2projektid.4 (Logikteil): liest der Viewer-Parser die Projekt-ID im Kopf?
// Aufruf: node viewer/tests/vorlage2projektid.4.mjs
import { readFileSync } from "node:fs";
import { parseDoc, projectId } 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("vorlage2projektid.4a", projectId(echt.head) === "P-0000", `echte ROADMAP.md: ${projectId(echt.head)}`);
prüfe("vorlage2projektid.4b", projectId(parseDoc("# X\n\nStand: x · Projekt-ID: offen · Format: 1\n").head) === "offen", "offen wird erkannt");
prüfe("vorlage2projektid.4c", projectId(parseDoc("# X\n\nStand: x\n").head) === null, "ohne Angabe: null");
prüfe("vorlage2projektid.4d", projectId(parseDoc("# X\n\nProjekt-ID: P-12\n").head) === null, "ungültige Form: null");
process.exit(ok ? 0 : 1);