chkit codegen
Shortcut for chkit plugin codegen codegen. Generates TypeScript row types, optional Zod schemas (in Python: Pydantic models), typed insert helpers, and runtime migration modules from schema definitions.
Synopsis
Section titled “Synopsis”chkit codegen [flags]| Flag | Type | Default | Description |
|---|---|---|---|
--check | boolean | false | Validate generated artifacts are up-to-date without writing |
--out-file <path> | string | — | Override output file path |
--emit-zod | boolean | — | Enable Zod validator generation |
--no-emit-zod | boolean | — | Disable Zod validator generation |
--emit-ingest | boolean | — | Enable typed insert helper generation |
--no-emit-ingest | boolean | — | Disable typed insert helper generation |
--ingest-out-file <path> | string | — | Override the generated insert helper file path |
--emit-migrations | boolean | — | Enable runtime migration module generation |
--no-emit-migrations | boolean | — | Disable runtime migration module generation |
--migrations-out-file <path> | string | — | Override migrations output file path |
--bigint-mode <mode> | string | — | Large integer mapping: string or bigint |
--include-views | boolean | false | Include views in generated output |
Global flags documented on CLI Overview.
Behavior
Section titled “Behavior”This command delegates to the codegen plugin’s codegen command. The codegen plugin must be registered in your config’s plugins array with manifest.name equal to "codegen".
If the codegen plugin is not configured, the command fails with: “Codegen plugin is not configured. Add a plugin with manifest.name “codegen” to config.plugins.”
Generated insert helpers, named ingest<TableName>, pass typed rows to the supplied Ingestor.insert implementation. Request-body compression is enabled by default. Pass { compressed: false } as the third argument to opt out for a specific call.
Check mode
Section titled “Check mode”With --check, the command validates that generated artifacts are current without writing files. This is useful in CI to detect stale types. Failure codes include:
codegen_missing_output— types file missingcodegen_stale_output— types content has driftedcodegen_missing_ingest_output— generated insert helper file missing (whenemitIngestis enabled)codegen_stale_ingest_output— generated insert helper content has driftedcodegen_missing_migrations_output— migrations file missing (whenemitMigrationsis enabled)codegen_stale_migrations_output— migrations content has drifted
Examples
Section titled “Examples”chkit codegenchkit codegen --checkchkit codegen --emit-zod --include-viewsExit codes
Section titled “Exit codes”| Code | Meaning |
|---|---|
| 0 | Success |
| 1 | Error (including stale check) |
| 2 | Invalid plugin options |
Related
Section titled “Related”- Codegen plugin reference — full documentation for configuration, options, and CI integration
chkit generate— automatically runs codegen whenrunOnGenerateis enabledchkit plugin— list and run plugin commands directly