Skip to content

feat(core)!: split plugins and app configs into a definition and a runtime - #25

Merged
jherr merged 1 commit into
mainfrom
cursor/definition-split-0c86
Nov 6, 2026
Merged

jherr merged 1 commit into
mainfrom
cursor/definition-split-0c86

Conversation

@jherr

@jherr jherr commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Implements cms-refactor-plan.md § Phase 1e(ii) (questions 19b–19d).

Merge chain: step 5 of 24. Base: main. Merge it right after #24. The branch is main 3b4a112, then one commit for each PR before this one in the merge order, then this PR's own commit ebd385b (tree 8fa68a5).

What

  • Plugins split into two parts (19c, breaking). A plugin is now definePlugin({ definition: definePluginDefinition({ name, collections, adminNav, routes, adminRoutes }), runtime: { blockTypes, fieldTypes, ops, eventHandlers, onEvent } }).
    • The flat definePlugin({ name, … }) form throws a TypeError that names the codemod.
    • /definition exports definePluginDefinition; definePlugin is root-only.
  • Server-bound collection parts move to the runtime config (19d, breaking). defineCms(definition, { collections: { post: { hooks, access, storage } } }) attaches them to collections by name. Hooks are typed from that collection's fields.
    • These throw: an unknown name, any other key (such as fields), and a hook or rule that the definition already sets.
  • Codemod. pnpm codemod definition-split [paths], with fixtures.
    • It writes cms.definition.ts containing the collections, admin, the plugin definitions and their dependencies, importing from /definition.
    • It rewrites cms.config.ts to defineCms(definition, runtime).
    • It points Register at the definition.
    • It splits flat definePlugin calls.
  • Apps. 24 of 25 configs now have a cms.definition.ts. starters/runtime-tables stays a single file, which 19b allows.
    • app/base: its audit hooks, its postRead access check and reports.read moved to src/collection-runtime.ts, and model.ts now imports only /definition.
    • examples/db-markdown: its storage adapter moved to the runtime config.
    • cms-connect-atproto is now a runtime-only plugin.
  • Generators.
    • tanstack-cms init writes both files.
    • Code-mode skills append collections to cms.definition.ts.
  • CI. test:definitions is now --strict, so it blocks. It also scaffolds and checks the init output and a code-mode skill app. All 26 definitions load.
  • Docs and skills.
    • The quick start recommends two files and still allows one.
    • docs/api/cms-core.md covers runtime collections and plugins.
    • docs/deployment/upgrading.md has before/after code for plugins and the definition move.
    • The .claude/skills instructions and the examples/*-after docs are updated.
  • Changeset. .changeset/definition-split.md names both breaking changes and gives the codemod command.

Breaking changes

  • Plugins use the two-part definePlugin shown above. To migrate, run pnpm codemod definition-split <app> from a TanStack CMS checkout.
  • /definition exports definePluginDefinition and CmsPluginDefinition instead of definePlugin and CmsPlugin.
  • The runtime config's collections is a name-keyed object of { hooks, access, storage }. Before this PR the runtime config rejected collections.

Divergence from plan

  • Runtime-only plugins. A plugin with no collections or routes can be listed only in the runtime config, because the AT Protocol connector is runtime-only.
  • storage in runtime collections. Runtime collections also accept storage, because db-markdown's adapter imports node:fs.
  • Combined plugins in the definition. A combined plugin is accepted in the definition, so one-file apps list a plugin once.
  • defineInterfaceCollection now joins /definition.
  • The 1b follow-up is deferred to 1d. Having primitives read schemas from the definition needs 1d's createRoutes(definition) wiring.

Assumptions

  • Breaking changes are minor in alpha pre-mode, following the existing changesets.
  • Register points at typeof definition, so RegisteredOps typing is lost. No app uses typed ops.
  • cms-migrate-wp and the per-CMS migration guides keep the one-file form, which is allowed.

How verified

  • pnpm test:pr passes except the cms-api oxlint error that main already has. test:dts, test:dialects, test:definitions (strict, 26 of 26), test:scripts (84), kiira and test:docs pass.
  • The four *-after parity tests and blog-voting pass.
  • node scripts/pack-consumer.mjs fails only on the formsLeadCaptureSkill error that main already has.
  • test:dialects needed one fix: its retired collectionsRecord marker was narrowed so the 19d runtime shape doesn't count as the old Record form. A test covers it.

Merge chain (local verification, CI down)

This PR's commits are squashed into one commit on the linear merge chain. That commit holds this PR's own changes, resolved against every PR before it, with the integration rehearsal's fixes for this PR applied. No conflicts. It was replayed from e126e12, this PR's copy of #24, whose tree is the same as 2850c54's.

The chain tip's tree is exactly the integration rehearsal plus #46 (c4e6d7c), and the tip passes the full local suite. I simulated merging every PR in order, with a merge commit or a fast-forward at each step, and every step is clean. A plain squash of the next PR would conflict, because the squash commit isn't an ancestor of the next branch. To squash instead, first rebase the branch's one commit onto the new main; that rebase is always clean.

Open in Web Open in Cursor 

@changeset-bot

changeset-bot Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 6106a12

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 13 packages
Name Type
@tanstack/cms-core Minor
@tanstack/cms-cli Minor
@tanstack/cms-skills Minor
@tanstack/cms-connect-atproto Minor
@tanstack/cms-api Minor
@tanstack/cms-client Minor
@tanstack/cms-migrate-wp Patch
@tanstack/cms-media-s3 Minor
@tanstack/search-cms Patch
@tanstack/cms-store-libsql Minor
@tanstack/cms-store-postgres Patch
@tanstack/cms-ui-dom Patch
@tanstack/cms-ui-react Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai

coderabbitai Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

Next included review available in 59 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: TanStack/cms
  • Branch: main
  • File: .coderabbit.yaml
  • Commit: 02582ea
  • Layers: Repository YAML
  • Review profile: CHILL
  • Plan: Free
  • Run ID: 6aad9a46-41a3-4fd0-9888-d17a8a224d60
Commits

Reviewing files that changed from the base of the PR and between 02582ea and 6106a12.

Files selected for processing: 150

  • .changeset/definition-split.md
  • .claude/skills/astro-starlight-to-tanstack-cms/SKILL.md
  • .claude/skills/astro-starlight-to-tanstack-cms/scripts/migrate-starlight.mjs
  • .claude/skills/emdash-to-tanstack-cms/SKILL.md
  • .claude/skills/emdash-to-tanstack-cms/scripts/migrate-emdash.mjs
  • .claude/skills/payload-to-tanstack-cms/SKILL.md
  • .claude/skills/payload-to-tanstack-cms/scripts/migrate-data.mjs
  • .claude/skills/voting/SKILL.md
  • .claude/skills/wordpress-to-tanstack-cms/SKILL.md
  • .claude/skills/wordpress-to-tanstack-cms/scripts/migrate-wordpress.mjs
  • .gitignore
  • README.md
  • app/base/src/cms.config.ts
  • app/base/src/cms.definition.ts
  • app/base/src/collection-runtime.ts
  • app/base/src/model.ts
  • app/base/src/schema-registry.ts
  • app/base/tests/base.test.ts
  • app/base/tests/chat.test.ts
  • app/base/tests/schema-registry.test.ts
  • app/base/tests/worker.test.ts
  • app/base/tests/wp-evacuation.test.ts
  • app/prm/src/cms.config.ts
  • app/prm/src/cms.definition.ts
  • docs/api/cli.md
  • docs/api/cms-core.md
  • docs/deployment/upgrading.md
  • docs/getting-started/quick-start.md
  • docs/migration/from-payload.md
  • docs/migration/overview.md
  • examples/astro-starlight-after/MIGRATION.md
  • examples/astro-starlight-after/README.md
  • examples/astro-starlight-after/scripts/migrate-starlight.mjs
  • examples/astro-starlight-after/src/cms.config.ts
  • examples/astro-starlight-after/src/cms.definition.ts
  • examples/blog-voting/src/cms.config.ts
  • examples/blog-voting/src/cms.definition.ts
  • examples/blog/src/cms.config.ts
  • examples/blog/src/cms.definition.ts
  • examples/db-federated/src/cms.config.ts
  • examples/db-federated/src/cms.definition.ts
  • examples/db-markdown/src/cms.config.ts
  • examples/db-markdown/src/cms.definition.ts
  • examples/db-sqlite/src/cms.config.ts
  • examples/db-sqlite/src/cms.definition.ts
  • examples/emdash-after/MIGRATION.md
  • examples/emdash-after/README.md
  • examples/emdash-after/scripts/migrate-emdash.mjs
  • examples/emdash-after/src/cms.config.ts
  • examples/emdash-after/src/cms.definition.ts
  • examples/payload-after/MIGRATION.md
  • examples/payload-after/README.md
  • examples/payload-after/scripts/migrate-from-payload.mjs
  • examples/payload-after/src/cms.config.ts
  • examples/payload-after/src/cms.definition.ts
  • examples/picks/src/cms.config.ts
  • examples/picks/src/cms.definition.ts
  • examples/wordpress-after/MIGRATION.md
  • examples/wordpress-after/README.md
  • examples/wordpress-after/scripts/migrate-wordpress.mjs
  • examples/wordpress-after/src/cms.config.ts
  • examples/wordpress-after/src/cms.definition.ts
  • package.json
  • packages/cli/README.md
  • packages/cli/src/commands/init.ts
  • packages/cli/src/index.ts
  • packages/cli/tests/cli.test.ts
  • packages/cms-connect-atproto/src/connector.ts
  • packages/cms-connect-atproto/src/index.ts
  • packages/cms-connect-atproto/tests/connector.test.ts
  • packages/cms-skills/src/engine/engine.ts
  • packages/cms-skills/src/engine/types.ts
  • packages/cms-skills/tests/skills.test.ts
  • packages/core/src/config.ts
  • packages/core/src/definition.ts
  • packages/core/src/index.ts
  • packages/core/src/interfaces.ts
  • packages/core/src/lib/authoring.ts
  • packages/core/src/lib/definition.ts
  • packages/core/tests/collections-array.test.ts
  • packages/core/tests/definition.test.ts
  • packages/core/tests/plugins.test.ts
  • packages/core/tests/register-definition/register.ts
  • scripts/__fixtures__/definitions/definition-only/cms.definition.ts
  • scripts/codemods/__fixtures__/definition-split/already-split/cms.config.input.ts
  • scripts/codemods/__fixtures__/definition-split/docs.input.md
  • scripts/codemods/__fixtures__/definition-split/docs.output.md
  • scripts/codemods/__fixtures__/definition-split/function/cms.config.input.ts
  • scripts/codemods/__fixtures__/definition-split/function/cms.config.output.ts
  • scripts/codemods/__fixtures__/definition-split/function/cms.definition.created.ts
  • scripts/codemods/__fixtures__/definition-split/local/cms.config.input.ts
  • scripts/codemods/__fixtures__/definition-split/local/cms.config.warnings.json
  • scripts/codemods/__fixtures__/definition-split/plugin.input.ts
  • scripts/codemods/__fixtures__/definition-split/plugin.output.ts
  • scripts/codemods/__fixtures__/definition-split/root-import/cms.config.input.ts
  • scripts/codemods/__fixtures__/definition-split/root-import/cms.config.output.ts
  • scripts/codemods/__fixtures__/definition-split/root-import/cms.config.warnings.json
  • scripts/codemods/__fixtures__/definition-split/root-import/cms.definition.created.ts
  • scripts/codemods/__fixtures__/definition-split/shared/cms.config.input.ts
  • scripts/codemods/__fixtures__/definition-split/shared/cms.config.output.ts
  • scripts/codemods/__fixtures__/definition-split/shared/cms.definition.created.ts
  • scripts/codemods/__fixtures__/definition-split/variable/cms.config.input.ts
  • scripts/codemods/__fixtures__/definition-split/variable/cms.config.output.ts
  • scripts/codemods/__fixtures__/definition-split/variable/cms.definition.created.ts
  • scripts/codemods/definition-split.test.ts
  • scripts/codemods/definition-split.ts
  • scripts/codemods/fixtures.test.ts
  • scripts/codemods/harness.test.ts
  • scripts/codemods/index.ts
  • scripts/codemods/lib/harness.ts
  • scripts/dialect-inventory.test.ts
  • scripts/dialect-inventory.ts
  • scripts/verify-definitions.test.ts
  • scripts/verify-definitions.ts
  • starters/admin-only/CMS-INTEGRATION.md
  • starters/admin-only/src/cms.config.ts
  • starters/admin-only/src/cms.definition.ts
  • starters/contact-cards/CMS-INTEGRATION.md
  • starters/contact-cards/src/cms.config.ts
  • starters/contact-cards/src/cms.definition.ts
  • starters/directory-listings/CMS-INTEGRATION.md
  • starters/directory-listings/src/cms.config.ts
  • starters/directory-listings/src/cms.definition.ts
  • starters/documentation-kb/CMS-INTEGRATION.md
  • starters/documentation-kb/src/cms.config.ts
  • starters/documentation-kb/src/cms.definition.ts
  • starters/ecommerce-storefront/CMS-INTEGRATION.md
  • starters/ecommerce-storefront/src/cms.config.ts
  • starters/ecommerce-storefront/src/cms.definition.ts
  • starters/editorial-publication/CMS-INTEGRATION.md
  • starters/editorial-publication/src/cms.config.ts
  • starters/editorial-publication/src/cms.definition.ts
  • starters/existing-app/CMS-INTEGRATION.md
  • starters/existing-app/src/cms.config.ts
  • starters/existing-app/src/cms.definition.ts
  • starters/headless-api/CMS-INTEGRATION.md
  • starters/headless-api/src/cms.config.ts
  • starters/headless-api/src/cms.definition.ts
  • starters/membership-course/CMS-INTEGRATION.md
  • starters/membership-course/src/cms.config.ts
  • starters/membership-course/src/cms.definition.ts
  • starters/multi-tenant-fleet/CMS-INTEGRATION.md
  • starters/multi-tenant-fleet/src/cms.config.ts
  • starters/multi-tenant-fleet/src/cms.definition.ts
  • starters/team-ops/CMS-INTEGRATION.md
  • starters/team-ops/src/cms.config.ts
  • starters/team-ops/src/cms.definition.ts
  • starters/themed-smb-site/CMS-INTEGRATION.md
  • starters/themed-smb-site/src/cms.config.ts
  • starters/themed-smb-site/src/cms.definition.ts

TanStack is on CodeRabbit Free, which includes PR summaries. Ask your admin to upgrade for code reviews.

  • Ask an admin to upgrade

Open in CodeRabbit

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@cursor
cursor Bot force-pushed the cursor/definition-entry-0c86 branch from c76a818 to e126e12 Compare November 6, 2026 02:57
@cursor
cursor Bot force-pushed the cursor/definition-split-0c86 branch from b29aea0 to d135174 Compare November 6, 2026 02:57
@jherr
jherr force-pushed the cursor/definition-entry-0c86 branch from e126e12 to 2850c54 Compare November 6, 2026 03:17
@cursor
cursor Bot force-pushed the cursor/definition-split-0c86 branch from d135174 to ebd385b Compare November 6, 2026 14:50
@cursor
cursor Bot changed the base branch from cursor/definition-entry-0c86 to main November 6, 2026 14:52
…ntime (#25)

Chain step 5 of the linear merge chain onto main 3b4a112: this PR's own changes, resolved against the PRs before it in the merge order.

Co-authored-by: jherr <jherr@pobox.com>
@jherr
jherr force-pushed the cursor/definition-split-0c86 branch from ebd385b to 6106a12 Compare November 6, 2026 15:06
@jherr
jherr merged commit 5a366bd into main Nov 6, 2026
2 of 9 checks passed
@jherr
jherr deleted the cursor/definition-split-0c86 branch November 8, 2026 01:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants