Open History to see the last commit
1# @modelschemas/codegen
2
3Pull core for [modelschemas](https://modelschemas.com) build-time schema
4and type generation: selection grammar
5(`provider[/endpointGlob][#request|#response]`), conditional fetch
6(ETag/304), the `.manifest.json` lockfile, atomic file writes, offline
7build verification, and content-hash integrity checks.
8
9> Ships as TypeScript source — used by `@modelschemas/vite` and the
10> `modelschemas` CLI; usable directly from Bun or any TS-aware bundler.
11
12```bash
13bun add @modelschemas/codegen
14```
15
16```ts
17import { pull, verify, verifyIntegrity, checkUpdates } from '@modelschemas/codegen'
18
19await pull({
20 outDir: 'src/modelschemas',
21 selections: ['anthropic/v1/messages#request', 'openai/chat/*'],
22})
23
24// offline (production builds): files match the manifest
25const files = await verify({ outDir: 'src/modelschemas', selections: [...] })
26
27// online: re-fetch each pinned ?version=<contentHash>, re-hash locally
28const integrity = await verifyIntegrity({ outDir: 'src/modelschemas', selections: [] })
29```
30
31Docs: [modelschemas.com/docs](https://modelschemas.com/docs) · Source:
32[github.com/modelschemas/modelschemas](https://github.com/modelschemas/modelschemas)