Repository navigation
Conversation
…eam 1)
Core no longer dynamically imports @tanstack/cms-store-postgres/pglite as an
implicit fallback when a config omits `storage`. Instead `storage` is required
and accepts a `StorageFactory` the engine resolves once with the data dir:
import { createPgliteStorage } from '@tanstack/cms-store-postgres/pglite'
defineCms({ storage: createPgliteStorage })
A missing `storage` now throws a NOT_CONFIGURED CmsError naming the exact
import to add. Because core never references a storage package, a server
bundle that injects e.g. createPostgresStorage no longer drags PGlite+WASM
into its graph — the whole point of the seam.
- config: `storage?: StorageAdapter | StorageFactory`; new StorageFactory /
StorageFactoryContext types.
- storage.ts: replace getDefaultAdapter/requireDefaultAdapter/ensureDefaultAdapter
with a synchronous `baseAdapterFor`; drop the async prime-then-sync-read dance
(simplifies the d6040b5 hazard away). Remove ensureDefaultAdapter call sites
(transfer, content-migrations, base schema-registry).
- new opt-in `setDefaultStorageFactory` escape hatch (null by default, so
production still errors and bundles stay clean) + `@tanstack/cms-store-postgres/testing`
vitest setup that wires it to createPgliteStorage — restores the embedded
engine for tests without editing every defineCms call site.
- migrate all 25 in-repo configs to inject `storage: createPgliteStorage` and
add the dep; wire the test setup into core/api/client/cli/ui-react/base.
Green: core 656, api 226, client 37, ui-react 146, cli 27, base 42. sherif clean.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Interfaces no longer dynamic-import @tanstack/ai-isolate-quickjs or
@tanstack/ai-code-mode from inside the engine. `defineCms({ interfaces })`
now requires a `runtime` (type-enforced), and a new opt-in entry supplies the
default:
import { quickjsInterfaceRuntime } from '@tanstack/cms-core/interfaces-quickjs'
defineCms({ interfaces: { collection: 'interfaces', runtime: quickjsInterfaceRuntime() } })
Only that entry statically imports the QuickJS/code-mode (WASM) packages, so a
build that doesn't enable interfaces never pulls them. Missing runtime throws a
NOT_CONFIGURED CmsError naming the import.
- new InterfaceRuntime / IsolateDriver / IsolateContext / IsolateBinding
structural types in the client-safe interfaces module (no peer imports).
- server/interfaces.ts reads config.interfaces.runtime; dynamic imports gone.
- new ./interfaces-quickjs entry (exports + tsdown); core already devDeps the
two peers.
- api/interface-ops narrows the structural driver to code-mode's own type at
the createCodeMode boundary.
- all 8 interface config sites inject quickjsInterfaceRuntime().
Green: core 656, api 226, ui-react 146, base 42. sherif clean.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…m 3)
`cmsTools` no longer loads @tanstack/ai itself. `defineCms({ ai })` takes a
`runtime` built by `aiRuntime()` from the new `@tanstack/cms-core/ai` entry
(the only place that statically imports @tanstack/ai). Core is now entirely
free of @tanstack/ai — a server bundle without agent tools never pulls it.
Missing runtime → NOT_CONFIGURED CmsError naming the import.
- new CmsAiRuntime type (toolDefinition typed opaquely, narrowed server-side)
+ CmsAiConfig.runtime; new ./ai entry (exports + tsdown).
- the @tanstack/ai loader (chat/image/tools) moves out of core/optional.ts to
@tanstack/cms-api (ai.ts, re-exported from the index); api ops + prm agents
repoint to it. optional.ts keeps only the generic isMissingModule/missingPeer.
- api test helper injects aiRuntime() by default; app/base + app/prm configs
and their agent-tool tests inject it; optional-peers stubs ./ai under the
@tanstack/ai-absent mock.
Green: core 656, api 226, ui-react 146, base 42, prm 10. sherif clean.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Neither the core main entry nor the api main entry references the MCP SDK now.
WebMCP (browser): `startWebMcpServer` moves from the `@tanstack/cms-core`
main entry to its own `@tanstack/cms-core/webmcp` entry (SDK still dynamically
imported inside, so importing the entry stays SSR-safe). ui-react/ui-dom import
from the subpath.
HTTP MCP (server): `cmsMcp` (and `@tanstack/ai-mcp`) move to the
`@tanstack/cms-api/mcp` subpath, out of the api main entry. `/api/mcp` is no
longer auto-served — `handleMcpApi(request, mcp)` takes the server and
`createCmsApiHandler({ mcp: cmsMcp })` mounts it; unmounted → NOT_CONFIGURED
naming the import. A single-file api bundle without MCP never pulls
`@tanstack/ai-mcp`. The ui-react `/api/mcp` virtual route wires `cmsMcp`, so
including that route is the opt-in; the headless-api starter mounts it (and
gains `ai.runtime`, since MCP tools are agent tools).
Green: core 656, api 226, ui-react 146, ui-dom 12, starters (team-ops,
admin-only, headless-api, contact-cards). sherif clean.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
… (seam 5) New packages/core/tests/bundle-seams.test.ts esbuilds each core entry and asserts against the metafile that `core`, `core/server`, and `core/read` pull NO optional capability (PGlite, @tanstack/ai, ai-code-mode, QuickJS, MCP SDK, MCP-B, ai-mcp, store-postgres, sucrase), while `core/ai` and `core/interfaces-quickjs` DO carry theirs. This pins the seams at bundle time — a dynamic import can't sneak a capability back in, since a single-file bundler would inline it. Adds esbuild as a core devDep. AGENTS.md documents the capability-injection rule + the inject/opt-in-entry table for all five capabilities. Also mounts cmsMcp in the prm /api/mcp test. Full sweep green: test:types (37), test:lib (24), test:definitions (27/27), test:starters, all example configs, bundle-seams (5/5), sherif. (Pre-existing unrelated failure: react-onboarding publint styles.css export — untouched.) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
@tanstack/cms-api
@tanstack/cms-cli
@tanstack/cms-client
@tanstack/cms-compat-wp
@tanstack/cms-connect-atproto
@tanstack/cms-migrate-wp
@tanstack/cms-skills
@tanstack/cms-core
@tanstack/cms-media-s3
@tanstack/search-ai
@tanstack/search-cms
@tanstack/search-core
@tanstack/search-headless
@tanstack/search-ui-react
@tanstack/cms-store-postgres
@tanstack/cms-ui-dom
@tanstack/cms-ui-react
commit: |
…follow-up) The Packed Consumer check builds a fresh app from the packed tarballs; its generated cms.config and smoke-test defineCms relied on the removed implicit PGlite default and hit MISSING_STORAGE at boot. Inject `storage: createPgliteStorage` (the fixture already installs store-postgres). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- cms-tools: the agent-tool cast uses a type-only `import('@tanstack/ai')` to
keep the precise type without a value import (bundle seam); annotate it with
an oxlint-disable for consistent-type-imports.
- api: merge the new `loadTanstackAi` imports into the existing `./ai` import
lines (import/no-duplicates).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Superseded by #68, which flattens this stack into a single PR against |
What
Cracks four tight couplings in
@tanstack/cms-coreso AI, code-mode, MCP, and the embedded PGlite storage default are opt-in capabilities the app injects — the engine never imports them. Enforced at bundle time, which is the whole point: a dynamicimport()isn't enough (a single-file bundler inlines it), so these are the seams that actually keep an edge/worker bundle from dragging in PGlite+WASM, QuickJS,@tanstack/ai, the MCP SDK, zod-v3, and sucrase.Motivated by the Kody deploy that ballooned to 1.7 MB and ~40% cold-start crashes (see
AGENTS.md, refs #63).The seams
defineCmsstorage: createPgliteStorage(aStorageFactory)@tanstack/cms-store-postgres/pgliteai: { runtime: aiRuntime() }@tanstack/cms-core/aiinterfaces: { collection, runtime: quickjsInterfaceRuntime() }@tanstack/cms-core/interfaces-quickjsstartWebMcpServer@tanstack/cms-core/webmcpcreateCmsApiHandler({ mcp: cmsMcp })@tanstack/cms-api/mcpEach missing capability throws a
NOT_CONFIGUREDCmsErrornaming the exact import to add — core never silently falls back to a package of its own.Commits (5, each independently green)
storagerequired (factory form); delete the async prime-then-sync-read dance; opt-insetDefaultStorageFactory+@tanstack/cms-store-postgres/testingvitest setup restore the embedded engine for tests; migrate all 25 in-repo configs.stripTypeScriptruntime;interfaces.runtimerequired.cmsToolsreadsai.runtime; the@tanstack/ailoader moves out of core to@tanstack/cms-api.startWebMcpServer→core/webmcp;cmsMcp→api/mcp;/api/mcpis an explicit mount.bundle-seams.test.tsesbuilds each entry and asserts capability presence/absence via the metafile; AGENTS.md rule.Verification
test:types(37),test:lib(24 projects — core 656, api 226, ui-react 146, base 42, prm 10, …),test:definitions(27/27),test:starters, all 10 example configs, bundle-seams 5/5, sherif clean. One pre-existing unrelated failure:react-onboarding:test:build(publintstyles.cssexport — untouched here).Notes
feat/edge-read-entry(feat: edge read entry (@tanstack/cms-core/read) + blog read worker #65); retarget tomainonce that merges.AGENTS.md).🤖 Generated with Claude Code