Initial: Tibi-Doku auf Starlight-Basis (Nova-Theme, Docker-Stack, Sync-Skripte)

This commit is contained in:
apairon committed 2026-10-16 11:43:04 +00:00
commit 58502aa3c8
78 files changed
+22860

No files matched your search

+28
View File
@@ -0,0 +1,28 @@
#!/usr/bin/env node
/**
* sync-openapi.mjs — holt die OpenAPI-Spec vom laufenden Tibi-Server
* und legt sie als Referenz-Seite ab. Ohne laufenden Server: Platzhalter.
* Aufruf: npm run sync:openapi
* Env: TIBI_API_URL (default http://localhost:8080/api), TIBI_NAMESPACE
*/
import { mkdirSync, writeFileSync } from 'node:fs';
import { dirname, join } from 'node:path';
import { fileURLToPath } from 'node:url';
const root = join(dirname(fileURLToPath(import.meta.url)), '..');
const base = process.env.TIBI_API_URL ?? 'http://localhost:8080/api';
const out = join(root, 'src', 'content', 'docs', 'reference', 'openapi.md');
try {
const res = await fetch(`${base}/openapi.json`);
if (!res.ok) throw new Error(`HTTP ${res.status}`);
const spec = await res.text();
mkdirSync(dirname(out), { recursive: true });
writeFileSync(
out,
`---\ntitle: 'OpenAPI (generiert)'\n---\n\n> Stand: ${new Date().toISOString()} · Quelle: \`${base}/openapi.json\` — nicht von Hand editieren.\n\n\`\`\`json\n${spec.slice(0, 20000)}\n\`\`\`\n\n_Volle Spec: \`${base}/openapi.json\`_\n`,
);
console.log(`[sync:openapi] geschrieben: ${out}`);
} catch (err) {
console.warn(`[sync:openapi] Server nicht erreichbar (${base}): ${err.message} — Platzhalter bleibt.`);
}