fix(indexer): ensure 99_System and 10_Wiki directories exist before writing index
CI / test (push) Canceled after 0s
CI / webapp (push) Canceled after 0s

This commit is contained in:
Jannik committed 2026-09-08 17:11:21 +02:00
1 parent 430db1f245
commit 465f17f253
1 file changed
+3 -1
+3 -1
View File
@@ -1,7 +1,7 @@
// 1.5 index: Deterministischer Vault-Indexer
// Phase 1.5
import { readdirSync, readFileSync, writeFileSync, statSync, existsSync } from 'node:fs';
import { readdirSync, readFileSync, writeFileSync, statSync, existsSync, mkdirSync } from 'node:fs';
import { createHash } from 'node:crypto';
import { join, sep } from 'node:path';
import matter from 'gray-matter';
@@ -119,12 +119,14 @@ export async function indexCommand(vaultPath: string, _args: string[]): Promise<
// 7. 99_System/Index.md schreiben (Katalog)
const sysIndex = renderSystemIndex(vaultPath, nodes, uniqueEdges);
mkdirSync(join(vaultPath, '99_System'), { recursive: true });
writeFileSync(join(vaultPath, '99_System', 'Index.md'), sysIndex);
console.log(' 99_System/Index.md geschrieben');
// 8. 10_Wiki/Index.md schreiben (nur Wiki-Seiten)
const wikiNodes = nodes.filter((n) => n.type === 'wiki');
const wikiIndex = renderWikiIndex(wikiNodes);
mkdirSync(join(vaultPath, '10_Wiki'), { recursive: true });
writeFileSync(join(vaultPath, '10_Wiki', 'Index.md'), wikiIndex);
console.log(` 10_Wiki/Index.md geschrieben (${wikiNodes.length} Wiki-Seiten)`);