/** * Self-describing templates. A template repository carries its own * descriptor at farketari/template.json declaring its name, clients, * layout, command catalog, bootstrap rules, and optional per-work-kind * prompt overrides (markdown files in the template). The CLI loads the * descriptor from the --example path, so adding a new template (Vue * instead of Next.js, say) means writing a template repository and its * descriptor — farketari itself never changes and carries no * template-specific knowledge beyond the built-in boilerplate fallback. * * The loader VALIDATES before it trusts: every layout path, every * bootstrap-rule path, every prompt-override file, and every {example} * citation in the merged prompt catalog must exist in the template. * Template CI runs `farketari validate-template .` so a template cannot * drift from its own descriptor. */ import { type BootstrapRules } from "./bootstrap-rules.js"; import type { CommandCatalog } from "./commands.js"; import type { WorkKind } from "./model-roster.js"; import { type PromptCatalog } from "./prompts.js"; import type { RepoLayout } from "./repo-layout.js"; import type { ClientPlatform } from "./types.js"; /** Where a template's descriptor lives, relative to the template root. */ export declare const TEMPLATE_DESCRIPTOR_PATH = "farketari/template.json"; /** The shape of farketari/template.json. */ export interface TemplateDescriptor { /** The template's name, e.g. "nextjs-fastify-example". */ name: string; /** The UI clients this template builds. */ clients: ClientPlatform[]; /** WHERE everything lives — RepoLayout without root (root = the template checkout). */ layout: Omit; /** The commands the algorithm may run in projects of this template. */ commands: CommandCatalog; /** What of the template survives a bootstrap. */ bootstrapRules: BootstrapRules; /** * Optional per-work-kind prompt OVERRIDES: template-relative markdown * files replacing the built-in prompt for that kind. Kinds not listed * inherit farketari's defaults — a template overrides only what its * stack changes (typically the client-side teaching material). */ prompts?: Partial>; } /** A descriptor resolved against its checkout: absolute root, merged prompts. */ export interface LoadedTemplate { name: string; clients: ClientPlatform[]; layout: RepoLayout; commands: CommandCatalog; bootstrapRules: BootstrapRules; prompts: PromptCatalog; } /** * Load and validate a template's descriptor. Returns null when the path * carries no descriptor (the CLI then falls back to the built-in * boilerplate configuration); throws with EVERY problem found when a * descriptor exists but is invalid — a broken descriptor must never * half-configure a run. */ export declare function loadTemplate(examplePath: string): LoadedTemplate | null; /** Every string value in the layout tree is a path that must exist. */ export declare function collectLayoutPaths(layout: Omit): string[];