Skip to content

v0.4.2 — zod@4 compat, tree-sitter fix, contract API

Latest

Choose a tag to compare

@BenGardiner123 BenGardiner123 released this 26 Apr 11:00

What changed

Bug fixes from dogfooding

  • zod@4 compatibility@specferret/core now depends on zod@4. Previously, consumers on zod@4 got type errors (_ZodBoolean is not assignable to ZodTypeAny) because the library was bound to zod@3 types. Upgrade your project to zod@4 to match.

  • tree-sitter instance dedup — Fixed TypeError: SyntaxNode must belong to a Tree caused by Bun workspace loading two separate native instances of tree-sitter. All 18 TypeScript extractor tests now pass.

  • Contract composition APIdefineContract now returns schema: ZodObject<T> on every contract. Use contract.schema for safe composition (e.g. z.array(contract.schema)) instead of the raw contract.output shape object.

  • consumes/dependsOn variance — Introduced ContractRef type. consumes and dependsOn arrays now accept contracts with different output shapes without casting.

  • CLI version no longer hardcodedferret --version reads from package.json so it can't drift.

Upgrading

bun add @specferret/core@0.4.2
# or
bun add -g @specferret/cli@0.4.2

If you were on zod@3, upgrade zod alongside:

bun add zod@4