Repository Public
1import { mustParseSheet, type Locale, type Sheet } from "@/schema";2import { AI_TEMPLATES } from "./ai";3import { QUANT_TEMPLATES } from "./quant";4import type { TemplateDef } from "./types";56/** Built-in templates, in display order. They live in code so that they are versioned and tested with the schema. */7export const TEMPLATES: TemplateDef[] = [...AI_TEMPLATES, ...QUANT_TEMPLATES];89export const findTemplate = (id: string) => TEMPLATES.find((t) => t.id === id);1011/** A fresh document from a template, validated. */12export function buildTemplate(id: string, locale: Locale): Sheet {13 const t = findTemplate(id);14 if (!t) throw new Error(`Unknown template ${id}`);15 return mustParseSheet(t.build(locale));16}17export type { TemplateDef };18