Files
Claude a2f723ca2d Start the rebuild: note schema, vault kit and data migration
Phase 1 of the functional design plan.

- Move the old site into legacy/, unchanged, for reference. It still
  builds from there until cutover.
- Add packages/schema: the one definition of all 20 note types, with
  field titles and descriptions, note and vault checks, and JSON Schema
  export so later editing tools and the MCP server share it.
- Add vault-kit: Obsidian templates generated from the schema, and the
  Site guide for 24.01_PersonalWebsite.
- Add tools/migrate: turns the legacy JSON, collections, store data and
  page text into 545 Site folder notes and 84 images, and checks the
  result with the schema.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012aSbo2D1qP8cMFQCykf7kx
2026-10-11 18:40:55 +00:00

25 lines
949 B
TypeScript

/**
* Writes one JSON Schema per note type to json/, with every field's title and
* description. The MCP server and future editors can read these without
* importing TypeScript.
*/
import { mkdirSync, writeFileSync } from "node:fs";
import { z } from "zod";
import { noteTypes } from "../src/types.ts";
const out = new URL("../json/", import.meta.url);
mkdirSync(out, { recursive: true });
for (const def of Object.values(noteTypes)) {
const schema = z.toJSONSchema(def.schema, { io: "input", unrepresentable: "any" });
const doc = {
...schema,
title: def.label,
description: def.description,
"x-folder": typeof def.folder === "string" ? def.folder : "depends on the note",
"x-body": def.body,
"x-singleton": def.singleton?.fileName ?? null,
};
writeFileSync(new URL(`${def.type}.schema.json`, out), `${JSON.stringify(doc, null, 2)}\n`);
}
console.log(`Wrote ${Object.keys(noteTypes).length} schemas to json/`);