mirror of
https://github.com/bitbaum/ai-kit.git
synced 2026-12-04 05:30:38 +01:00
The first app to adopt the merged package broke on it, which is the fastest
possible feedback and worth acting on rather than patching around.
`ai-forms` is ESM-only. Re-exporting it from this root meant that importing the
CHAIN pulled the forms package in behind it, so AOZ — which wanted `freeChain`
and nothing else — had its Jest run die on `Unexpected token 'export'` inside a
module it never asked for. Three suites, seven tests.
The available remedy was a `transformIgnorePatterns` entry in AOZ. Then the same
entry in the next adopter, and the one after: a single class of breakage, paid
once per repo, forever. That is precisely the shape this fleet has a rule
against, so the fix goes here instead.
One install was always the promise, and it is untouched. Same package, same
version, nothing new to install — only the import path moves:
import { freeChain } from "ai-kit"; // the chain
import { defineFields } from "ai-kit/forms"; // form filling
import { useAssist } from "ai-kit/react"; // the React hook
Which is what the exports map was for. Collapsing it into the root threw away
the one thing it buys: a server that wants a provider chain no longer pays for
a form library, or for a UI peer behind it.
BREAKING for anyone importing form symbols from the root. Measured before
changing rather than assumed: across both consumers — FleetCrown (5 files) and
AOZ (2) — every root import is chain, limits or fair-share. Zero form symbols.
Nothing in the fleet has to change.
The absence is now a test, not a convention. `test/exports.test.js` asserts both
that `ai-kit/forms` resolves and that the root does NOT carry those symbols,
because a convenience re-export added back at the root would read as harmless in
review and break the next consumer in exactly this way.
verify: lint, typecheck, build, 48/48 tests.
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>