The domain contracts of Cloudhal. schemas/*.schema.json is the only hand-edited source; everything else is generated by pnpm gen and drift-checked in CI (ADR-0001):
| Generated | From | Used by |
|---|---|---|
src/generated/*.ts |
json-schema-to-typescript 16 | every TypeScript package |
src/generated/schemas.ts |
bundler | tooling, docs, MCP outputSchema |
src/generated/validators.js |
ajv standalone (pure ESM, no eval) |
runtime validation on Node and Workers (ADR-0008) |
crates/cloudhal-schema/src/generated/*.rs |
cargo-typify 0.8 | Rust |
import { assertValid, isValid, type Page } from "@cloudhal/core-contracts";
if (isValid("page", data)) data.sections; // narrowed to Page
assertValid("snapshot", snapshot); // throws ContractValidationErrorFixtures under fixtures/{valid,invalid}/<contract>/ are validated in both languages and round-tripped through the Rust types. To change a contract follow .agents/skills/contract-change.