Mental model
Typra starts from a root TypeSpec model, resolves the contract graph, lowers it to an internal contract AST, then emits configured targets.
When root-namespace is set, Typra can include additional models from that namespace, so review metadata before accepting a generated baseline.
Mental model
Section titled “Mental model”Think of Typra as a compiler extension with a review trail:
- TypeSpec declares the contract.
- Typra lowers the selected model graph.
- Targets emit runtime surfaces and tests.
- Metadata records what changed.
typra-verifydecides whether the generated drift is safe to accept.
Emitter boundary
Section titled “Emitter boundary”Typra owns reusable generation behavior. Product-specific TypeSpec contracts, service behavior, and hand-authored adapters stay in the consuming product.
- Type graph discovery and lowering.
- Scalar coercion and factory expansion.
- Polymorphic dispatch.
- Provider-specific wire names.
- Generated-file markers and manifest metadata.
- Generated tests, protocol scaffolds, reference docs, and JSON AST output.
Generated output path
Section titled “Generated output path”Each generation can include target source, target tests, JSON AST metadata, generated-file manifests, and verifier reports. See Generated output for the file-level shape.
Review boundary
Section titled “Review boundary”Generated files include Typra markers, and the emitter records generated ownership metadata. typra-verify compares a committed baseline with current generated output and reports drift. It does not replace product tests or review.
Trust boundary
Section titled “Trust boundary”Generated output is not a substitute for product tests. Typra gives teams repeatable surfaces, target tests, and metadata evidence; consuming products still own integration tests, adapter behavior, release review, and runtime observability.