[repo] Workspace: Scaffold Phase 0 with schema, engine, content, ui and the PWA shell

pnpm + turbo workspace with the commands from CLAUDE.md §3. The contracts
from §6 as JSON Schemas with generated types; localDay as the one place a
day is computed; the forbidden-word list shared by lint:copy and the
library validator, with 13 negative fixtures; a Svelte 5 PWA shell built
under /Rosea/ with a meta CSP. E2E and offline suites run against the
built bundle; the offline one closes the server rather than emulating.

Analysis: .agents/features/phase0-workspace.md
This commit is contained in:
2026-11-01 00:27:33 +01:00
parent 1e4c5a06b6
commit 49c8def037
78 changed files with 9015 additions and 0 deletions
@@ -0,0 +1,30 @@
// Generates TypeScript types from the JSON Schemas (CLAUDE.md §7: contract types
// are generated, never hand-written). Output is git-ignored; `build` runs first
// in every turbo task that needs it.
import { mkdirSync, readFileSync, readdirSync, writeFileSync } from 'node:fs';
import { basename, join } from 'node:path';
import { fileURLToPath } from 'node:url';
import { compile } from 'json-schema-to-typescript';
const root = fileURLToPath(new URL('..', import.meta.url));
const schemaDir = join(root, 'schemas');
const outDir = join(root, 'src', 'generated');
mkdirSync(outDir, { recursive: true });
const banner = '/* Generated by packages/schema/scripts/generate-types.mjs. Do not edit. */';
const names = [];
for (const file of readdirSync(schemaDir).filter((f) => f.endsWith('.schema.json')).sort()) {
const schema = JSON.parse(readFileSync(join(schemaDir, file), 'utf8'));
const name = basename(file, '.schema.json');
const ts = await compile(schema, schema.title, { bannerComment: banner, additionalProperties: false });
writeFileSync(join(outDir, `${name}.ts`), ts);
names.push(name);
}
writeFileSync(
join(outDir, 'index.ts'),
`${banner}\n${names.map((n) => `export type * from './${n}.js';`).join('\n')}\n`
);
console.log(`[schema] generated types for ${names.length} schemas: ${names.join(', ')}`);