- design_book takes a brief (energy, decoration, collages, theme), a cover archetype and a cover lockup, and pages.overrides that give single pages of the plan another beat or layout. Directives written before parse as they did, and a design asked for none of it is composed exactly as before. - The engine composes the seven cover archetypes from the book's own photos, words, theme faces and colours, lockups, shapes and stickers, varied by the seed: spine band, poster pop, cut-out, illustrated postcard, grid and badge, minimal serif and stamp collage. A title the directives give a display tier is held to it, and the notes say when a band, a badge or a stamp holds it smaller or a cover leaves a layout out. - A lively or loud book turns two in five hero and grid spreads into collages, script overlays, badge grids, stamp rows or two-tone splits, the first of them always, turns and frames the prints of its other pages, sets its cover title larger and takes one or two, or three to six, stickers of its theme's motifs a spread, never over words, a photo's detail or the fold. A calm book asked for collages gets them and nothing else. - Every turn the engine gives a print or a sticker stays within what the brief's energy takes, a calm book's within its theme's own, so a design is never judged against its own brief. - New checks name a flat cover, a page without a lead, colours or faces off the theme and, for a design made with a brief, a book livelier or calmer than it asked, on the pages the design made and on a page revised in the draft. Page edits answer with the art checks too, and the assistant's cards name them in every language. - list_book_assets lists the shapes, faces, lockups, themes and patterns beside the stickers, and the Studio's shape groups and photo frames are one list the assistant reads too. - The Studio prompt gains an index of themes, archetypes and faces and JSON recipes of the elements to add and style for each cover and three lively spreads, and a turn that designs the book may preview sixteen pages, still three images a request; a viewer is told of none of it.
@trek/shared
Single source of truth for TREK's API contracts, expressed as Zod schemas and consumed by both the server (request validation + inferred DTO types) and the client (typed requests/responses).
This package is part of the incremental NestJS + React 19 migration (see the "Brownfield Rewrite" board). It is intentionally dormant until modules start importing it — adding it changes nothing for users.
Rules
- One folder per domain:
src/<domain>/<domain>.schema.ts(+.spec.ts). - Domain-agnostic building blocks live in
src/common/. - A route is only considered migrated once its contract lives here.
- Schemas are the source of truth; server DTOs and client types are inferred from them
(
z.infer<typeof schema>), never hand-duplicated.
Consumption (dev)
Both apps resolve @trek/shared to this package's TypeScript source:
- Server (
tsx): viapathsinserver/tsconfig.json. - Client (
vite): viaresolve.aliasinclient/vite.config.ts(+pathsfor the type-checker).
Production packaging (Docker / workspace wiring) is introduced in card F2, when the server first depends on this package at runtime. Until then prod builds are untouched.
Not yet here
The canonical error envelope is finalised in card F5 (it must match TREK's current Express error responses byte-for-byte), so it is deliberately not invented in F1.