/** * `slowcook init entities` — 0.18.0-α.6 (entity-first foundation). * * Brownfield path: walks `supabase/migrations/*.sql`, parses the DDL * via the existing refine/mermaid `parseDdl`, and emits one * `src/lib/entities/.ts` per table containing: * - a TypeScript `interface` (compile-time contract) * - a zod schema + inferred type (runtime parse for boundary * validation) * - a JSDoc header naming the source migrations * * Plus an `src/lib/entities/index.ts` barrel that re-exports everything. * * Why this matters (entity-first direction): refine + vibe + testgen * + plate + brew should all import the SAME canonical types when they * reference domain entities. Today every agent invents its own variant * — story-018's `profile`/`owner` drift is a representative case. With * generated entities + agents required to import them, drift becomes a * typecheck error, not a runtime test failure. * * Greenfield is deferred — a separate flow where refine designs entities * first; this command then runs over the resulting migrations. * * Idempotency: existing entity files with identical content are not * rewritten (preserves git mtime; avoids spurious diff churn). Files * with `// @slowcook-entity-protected` marker on the first line are * left alone — the consumer has hand-edited and we respect it. */ import { type ErdEntity } from "../refine/mermaid.js"; interface EmittedFile { path: string; content: string; action: "create" | "update" | "skip-identical" | "skip-protected"; } export declare function initEntities(argv: string[], _cliVersion: string): Promise; declare function decideAction(path: string, content: string): EmittedFile["action"]; /** * Map a normalised Postgres type to a zod schema + TS type fragment. * Returns the raw zod call (without `.nullable()` etc.) and the bare TS * type. The caller layers null + readonly modifiers. */ declare function pgTypeToTsAndZod(type: string): { ts: string; zod: string; }; declare function pascalCase(s: string): string; interface RenderArgs { entity: ErdEntity; sourceMigrations: string[]; fkRefs: Array<{ col: string; refsTable: string; }>; } declare function renderEntityFile(args: RenderArgs): string; declare function renderMockShim(importPath: string): string; declare function renderIndexFile(tableNames: string[]): string; export declare const __internals: { pgTypeToTsAndZod: typeof pgTypeToTsAndZod; pascalCase: typeof pascalCase; renderEntityFile: typeof renderEntityFile; renderIndexFile: typeof renderIndexFile; renderMockShim: typeof renderMockShim; decideAction: typeof decideAction; PROTECTED_MARKER: string; }; export {}; //# sourceMappingURL=entities.d.ts.map