events.generated.ts and schemas.generated.ts. Has --check mode for the drift gate.@orchestkit/hook-contract/events stays stable across codegen evolutions.codegen, codegen:check, and a prebuild hook so any build attempt with stale generated files fails fast.orchestkit-hook-contract — same codegen, Pydantic models, JSON Schema mirrors.payload: unknown with real types per event.
$ npm run codegen:check → OK: events.generated.ts + schemas.generated.ts match spec
$ npm run build → ESM + CJS dual emit (prebuild runs codegen:check first)
$ npm test → 15/15 smoke tests pass
$ node --input-type=module ─e 'import { HOOK_EVENT_NAMES } from "./dist/esm/index.js"; console.log(HOOK_EVENT_NAMES.length)'
→ 19
$ node -e 'console.log(require("./dist/cjs/index.js").HOOK_EVENT_NAMES.length)'
→ 19
If someone edits events.generated.ts directly without updating the spec, the next build fails. The --check mode re-emits in memory and compares against the committed file.
$ vim packages/hook-contract/src/events.generated.ts # add 'FakeEvent' to the list $ npm run codegen:check [codegen --check] FAILED: generated files drift from spec. Run `npm run codegen` and commit. exit 1