Content-types package
What it is
The bridge between the mesh and whatever consumes it.
gtmesh types emits a self-contained TypeScript
workspace package (default packages/content-types/) that your static-site
generator — or any TypeScript consumer — compiles against. It is the
content-types package.
Why it matters
The mesh’s contract is its page schemas and its registry. Hand-writing types to
match them drifts the moment a schema changes. Generating them keeps the
consumer honest: the SSG imports the same shapes the engine guarantees, and
gtmesh types --check fails CI the instant the committed package and the schemas
disagree.
How it works
gtmesh types reads schemas/ and the page types declared in
config.page_types, then writes a buildable package containing:
- per-type page interfaces — one TypeScript interface per page type, derived from its schema;
- a
PageTypeunion — the closed set of page types, derived fromconfig.page_types; - a registry reader — to load
registry/pages.csvin a typed way; - page-bundle loaders — to load a page’s
content/<slug>/index.yamlbundle.
The package is self-contained, so the consumer depends on it like any workspace package — no reaching into the mesh internals.
Wire gtmesh types --check into CI. It writes nothing and exits non-zero on
drift, so the consumer’s types can never fall out of sync with the content
contract.
Key files & flags
| Where | What it controls |
|---|---|
gtmesh types | Generate the package |
gtmesh types --check | Verify the committed package matches the schemas (CI gate) |
gtmesh types --dir <path> | Override the package directory |
schemas/ + config.page_types | The source of the generated interfaces and union |