From 3bbfd85e630ec325be9688ec418b11e6c540127f Mon Sep 17 00:00:00 2001 From: Jack Herrington Date: Sun, 29 Nov 2026 12:01:22 -0800 Subject: [PATCH 1/3] feat(kody): seed the headless-api starter so a fresh store isn't empty MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds src/seed.ts (one published contentItem) wired into defineCms, for spec §8 ("seeded document readable"). Validated by local-smoke.mts against a fresh Postgres — the seeded doc is present on first registration. Granting public (no-auth) read on contentItem remains a go-day item. Co-Authored-By: Claude Opus 4.8 (1M context) --- kody/headless-api/GO-DAY.md | 7 ++++--- kody/headless-api/scripts/local-smoke.mts | 11 +++++++++++ kody/headless-api/src/cms.config.ts | 2 ++ kody/headless-api/src/seed.ts | 19 +++++++++++++++++++ 4 files changed, 36 insertions(+), 3 deletions(-) create mode 100644 kody/headless-api/src/seed.ts diff --git a/kody/headless-api/GO-DAY.md b/kody/headless-api/GO-DAY.md index 7a56619d..ebe7b4a6 100644 --- a/kody/headless-api/GO-DAY.md +++ b/kody/headless-api/GO-DAY.md @@ -35,6 +35,7 @@ remains is only what requires the external blockers to clear. `x-cms-role` write succeeds and is attributed; MCP tool list answers; a second package importing `@tanstack/cms-client` reads the same document. -> Note: the §8 "seeded document readable with **no auth**" check needs a seed + -> public read access — not yet added here (the smoke uses authenticated writes). -> Add a small `seed` and confirm anonymous read on go-day. +> Note: the §8 "seeded document readable with **no auth**" check — the `seed` is +> now in place (`src/seed.ts`, validated by the smoke). What remains is granting +> **public (anonymous) read access** on `contentItem` so the seeded doc is +> readable over REST with no `x-cms-role` header; confirm on go-day. diff --git a/kody/headless-api/scripts/local-smoke.mts b/kody/headless-api/scripts/local-smoke.mts index 752f84a7..55aa1b64 100644 --- a/kody/headless-api/scripts/local-smoke.mts +++ b/kody/headless-api/scripts/local-smoke.mts @@ -33,6 +33,17 @@ async function post(op: string, role: string, body: unknown) { ) } +// 0. Seed: a fresh store is seeded on first registration (spec §8). +await entry.fetch(new Request(`${ops}/noop`, { method: 'GET' })).catch(() => {}) +const seeded = + (await getAs(systemContext('smoke'), { + collection: 'contentItem', + id: 'welcome', + staged: false, + populate: false, + }))?.doc ?? null +check('seed document present on fresh store', seeded?.title === 'Welcome', seeded) + // 1. Editor stages a write over REST (header-role auth) through the fetch entry. const writeRes = await post('save_document', 'editor', { collection: 'contentItem', diff --git a/kody/headless-api/src/cms.config.ts b/kody/headless-api/src/cms.config.ts index a79b2953..67ba4e3a 100644 --- a/kody/headless-api/src/cms.config.ts +++ b/kody/headless-api/src/cms.config.ts @@ -3,6 +3,7 @@ import type { CmsConfig } from '@tanstack/cms-core' import { createPostgresStorage } from '@tanstack/cms-store-postgres' import { definition } from './cms.definition' import { getDatabaseUrl } from './secrets' +import { seed } from './seed' // Kody variant of starters/headless-api. Differences from the monorepo starter // (spec §3.1): no `dataDir`/embedded storage — external Postgres via the @@ -22,6 +23,7 @@ export function registerHeadlessCms() { return defineCms(definition, { blockTypes: [], auth, + seed, // `connectionString` accepts a resolver, so the secret stays out of the // build and is read at connect time (store-postgres types.ts:85). storage: createPostgresStorage({ connectionString: () => getDatabaseUrl() }), diff --git a/kody/headless-api/src/seed.ts b/kody/headless-api/src/seed.ts new file mode 100644 index 00000000..d745e5a7 --- /dev/null +++ b/kody/headless-api/src/seed.ts @@ -0,0 +1,19 @@ +import type { SeedStore } from '@tanstack/cms-core' + +// Content written on first run against an empty store, so a freshly-published +// app isn't empty (spec §8). Published so it is live immediately. Public (no +// auth) read access is still a go-day item — see GO-DAY.md. +export const seed: SeedStore = { + documents: { + contentItem: { + welcome: { + title: 'Welcome', + slug: 'welcome', + channel: 'web', + priority: 1, + body: 'This headless CMS serves one schema over REST, a typed client, and MCP.', + published: true, + }, + }, + }, +} From ff726a1b9276382e0116a9028baff5575d9957e6 Mon Sep 17 00:00:00 2001 From: Jack Herrington Date: Sun, 29 Nov 2026 16:31:49 -0800 Subject: [PATCH 2/3] fix(kody): correct kody.jobs schedule schema; record kody dev findings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Validated the headless-api package under `kody dev` (local workerd). Results: - The CMS graph bundles + boots under workerd; the `{ fetch }` entry serves (CMS 404 on `/`). Biggest unknown (workerd-compat) resolved. - kody dev validated the `kody.jobs` schema: schedule must be an object `{ type: "interval", every: "5m" }` (or cron), not a bare string. Fixed. - U2 confirmed locally: a DB request fails under workerd with `No such module "pg"` — the stock pg driver doesn't load; Neon's serverless driver behind the store's PgPoolLike interface is the (config-side) fix. - `kody dev` must run from a standalone checkout; nested in the monorepo it fails the snapshot with a misleading "bundle target(s) missing" error. GO-DAY.md and AGENTS.md updated with all of the above. Co-Authored-By: Claude Opus 4.8 (1M context) --- kody/headless-api/AGENTS.md | 17 ++++++--- kody/headless-api/GO-DAY.md | 69 +++++++++++++++++++++------------- kody/headless-api/package.json | 4 +- 3 files changed, 56 insertions(+), 34 deletions(-) diff --git a/kody/headless-api/AGENTS.md b/kody/headless-api/AGENTS.md index 157c246b..5c82718c 100644 --- a/kody/headless-api/AGENTS.md +++ b/kody/headless-api/AGENTS.md @@ -45,11 +45,16 @@ write; `GET` reads it back after approval; `POST /api/mcp` lists tools. `viewer` is denied (403). API-key/token issuance (`createApiKey`) is a separate path. - **Writes stage into governance** — they are invisible until `approve()`. -- **`kody.jobs` field schema is best-effort** (`entry` + cron `schedule`). - Confirm exact field names with `repoRunChecks` / the jobs guide on go-day; - the handlers themselves are verified. -- **`pg` over workerd TCP is unproven (U2).** If egress fails on Kody, swap the - pool for a Neon serverless driver — config-side only, because the store types - `PgPoolLike` as a structural interface (no package change). +- **`kody.jobs` schema is confirmed** (validated by `kody dev`): `entry: + "./src/jobs.ts#"`, `schedule: { "type": "interval", "every": "5m" }` (or + `{ "type": "cron", "expression": "<5-field>" }`). Bare cron strings and + `type: "once"` are rejected. +- **`pg` does NOT load under Kody workerd (U2, confirmed via `kody dev`):** + a DB request fails with `No such module "pg"`. Swap the pool for Neon's + serverless driver behind the store's `PgPoolLike` interface — config-side + only, no store-postgres change. Everything else bundles + runs under workerd. +- **Run `kody dev` from a standalone checkout, not nested in the monorepo** — + nesting fails the snapshot with a misleading `bundle target(s) missing` error. + See GO-DAY.md. - `node_modules/` here is local symlink scaffolding for the smoke only; the real deps resolve from the pkg-pr-new URLs in `package.json` on Kody. diff --git a/kody/headless-api/GO-DAY.md b/kody/headless-api/GO-DAY.md index ebe7b4a6..903d0a9f 100644 --- a/kody/headless-api/GO-DAY.md +++ b/kody/headless-api/GO-DAY.md @@ -1,41 +1,58 @@ # Go-day deltas — headless-api -Everything in this package is built and **locally validated** (real Postgres, -`scripts/local-smoke.mts` → SMOKE PASS) against the workspace packages. What -remains is only what requires the external blockers to clear. +Built and validated two ways: (1) node + real Postgres via +`scripts/local-smoke.mts` → SMOKE PASS (CMS logic, auth, governance, jobs); +(2) **`kody dev` (local workerd)** — see "What kody dev proved" below. + +## What `kody dev` already proved (local workerd, no publish) + +- ✅ **The CMS graph bundles and boots under workerd** (same esbuild path as + publish). The `{ fetch }` entry loads and the CMS API handler serves — `GET /` + returns the CMS's own `404 {"code":"NOT_FOUND"}`. +- ✅ **`kody.jobs` manifest schema confirmed** (kody dev validated it): + `"schedule": { "type": "interval", "every": "5m" }` (or + `{ "type": "cron", "expression": "<5-field>" }`), `entry: + "./src/jobs.ts#"`. A bare cron string and `schedule.type: "once"` are + rejected. +- ⚠️ **U2 answer (local):** the first DB-touching request fails under workerd + with **`Error: No such module "pg"`** during `migrateTo`. The stock `pg` + driver does not load under Kody workerd. Everything upstream of the DB works. + +## Must run `kody dev` from a STANDALONE checkout + +`kody dev` snapshots the package via its git repo. Run inside this monorepo it +fails with `Package bundle target(s) missing from the repo session snapshot: +src/jobs.ts#...` — a **nesting artifact, not a real error**. In a standalone +git repo (how the go-day git lane works) the same files build cleanly. For local +iteration, copy the package to its own dir + `git init` (see the scratch at +`/tmp/kody-standalone` used during the spike), with `node_modules/@tanstack/*` +symlinked to the workspace packages and `node_modules/pg` to the pnpm store. ## Blocked until the Preview builds land 1. **Pin dependency URLs.** Replace `@REF` in `package.json` for the four - `@tanstack/cms-*` deps with the pkg-pr-new refs the Preview CI job reports - (spec §7-1). `pg` stays an npm dep. + `@tanstack/cms-*` deps with the pkg-pr-new refs. `pg` stays declared. ## Blocked on Kody (App install + `package:write` in the tanstack org) -2. **Publish via the git lane** (D3): `packageGetGitRemote({ create: true, - name: '@tanstack/cms-starter-headless-api' })` → clone → copy this package in - → push → `packagePublishExternalPush`. If it returns `locked`, open the - `approval_url`. -3. **Set the `CMS_DATABASE_URL` package secret** to the prod Postgres string. -4. **Resolve U1 (secret accessor).** Fill `src/secrets.ts#getDatabaseUrl` with - the synchronous `kody:runtime` package-secret read. Confirm whether the value - is available synchronously at module scope; if only request-scoped, capture - it into the module cache on the first request (the resolver is sync by - design — store types.ts:85). -5. **Confirm `kody.jobs` field schema** via `repoRunChecks` (the manifest - validator). Current best-effort shape: `{ entry: "./src/jobs.ts#", - schedule: "*/5 * * * *" }`. -6. **Run U2 test** (spec §7-5): the first REST call on the published app is the - pg-over-workerd-TCP test. If egress fails, swap the pool for Neon's serverless - driver — config-side only (`PgPoolLike` is a structural interface). +2. **Resolve U2 — swap `pg` for a workerd-native driver.** Confirmed required + (above). Use Neon's serverless driver behind the store's `PgPoolLike` + interface — config-side only, no store-postgres change (the store types the + pool structurally). Then re-run `kody dev` against a reachable Postgres and + confirm a DB-backed request + a job succeed. +3. **Resolve U1 — secret accessor.** Fill `src/secrets.ts#getDatabaseUrl` with a + synchronous `kody:runtime` package-secret read. NB under `kody dev --target + mock` package secrets are **placeholders** by design, so a real DB URL can't + flow through them locally — test U1 against the published app or with a + `.kody/mocks.ts`-style stand-in. +4. **Publish via the git lane** (D3) and set the `CMS_DATABASE_URL` package + secret. +5. **Public read for §8.** Grant anonymous read on `contentItem` so the seeded + doc is readable over REST with no `x-cms-role` header (the `seed` itself is + in place and validated). ## Post-publish acceptance (spec §8) `appFetch` (`synthetic: true`): seeded doc readable over REST with no auth; `x-cms-role` write succeeds and is attributed; MCP tool list answers; a second package importing `@tanstack/cms-client` reads the same document. - -> Note: the §8 "seeded document readable with **no auth**" check — the `seed` is -> now in place (`src/seed.ts`, validated by the smoke). What remains is granting -> **public (anonymous) read access** on `contentItem` so the seeded doc is -> readable over REST with no `x-cms-role` header; confirm on go-day. diff --git a/kody/headless-api/package.json b/kody/headless-api/package.json index 0135b714..06776d39 100644 --- a/kody/headless-api/package.json +++ b/kody/headless-api/package.json @@ -29,11 +29,11 @@ "jobs": { "cms-outbox-drain": { "entry": "./src/jobs.ts#outboxDrain", - "schedule": "*/5 * * * *" + "schedule": { "type": "interval", "every": "5m" } }, "cms-scheduler-tick": { "entry": "./src/jobs.ts#schedulerTick", - "schedule": "*/5 * * * *" + "schedule": { "type": "interval", "every": "5m" } } } } From 0745f58d6d28b4acf56d381d377c1655b97b2e29 Mon Sep 17 00:00:00 2001 From: "autofix-ci[bot]" <114827586+autofix-ci[bot]@users.noreply.github.com> Date: Mon, 30 Nov 2026 01:41:35 +0000 Subject: [PATCH 3/3] ci: apply automated fixes --- .../skills/wordpress-to-tanstack-cms/SKILL.md | 6 +- README.md | 12 +- app/docs-preview/README.md | 20 +- app/docs-preview/scripts/ingest-docs.mjs | 60 +- app/docs-preview/scripts/preview.mjs | 16 +- app/docs-preview/src/byok.api.ts | 22 +- app/docs-preview/src/byok.server.ts | 5 +- app/docs-preview/src/cms.definition.ts | 18 +- .../src/components/docs-sidebar.tsx | 4 +- .../src/ingest-artifacts.server.ts | 4 +- app/docs-preview/src/lib/links.ts | 3 +- app/docs-preview/src/routes/ask.tsx | 8 +- app/docs-preview/src/routes/docs.$.tsx | 24 +- app/docs-preview/src/routes/report.tsx | 8 +- app/docs-preview/src/routes/search.tsx | 19 +- app/docs-preview/tests/read-only.test.ts | 12 +- app/prm/bakeoff/README.md | 22 +- app/prm/bakeoff/latest.json | 180 ++--- examples/wp-vs-tanstack/ADMIN-GAP-ANALYSIS.md | 107 +-- examples/wp-vs-tanstack/COMPARISON.md | 61 +- examples/wp-vs-tanstack/src/cms.config.ts | 41 +- examples/wp-vs-tanstack/src/cms.definition.ts | 21 +- examples/wp-vs-tanstack/src/cms.renderers.tsx | 123 +++- .../wp-vs-tanstack/src/routes/blog.slug.tsx | 37 +- examples/wp-vs-tanstack/src/routes/blog.tsx | 16 +- .../src/routes/pages.catchall.tsx | 15 +- examples/wp-vs-tanstack/src/seed-data.ts | 32 +- examples/wp-vs-tanstack/src/styles.css | 6 +- .../wordpress/docker-compose.yml | 12 +- .../wordpress/seed/content/about.html | 335 +++++++-- .../wordpress/seed/content/blog.html | 14 +- .../wordpress/seed/content/contact.html | 187 ++++- .../wordpress/seed/content/home.html | 347 ++++++++-- .../wordpress/seed/content/post-cooling.html | 125 +++- .../wordpress/seed/content/post-furnace.html | 115 +++- .../seed/content/post-waterheater.html | 120 +++- .../wordpress/seed/content/reviews.html | 296 ++++++-- .../wordpress/seed/content/services.html | 644 ++++++++++++++---- .../wp-vs-tanstack/wordpress/seed/custom.css | 10 +- kody/headless-api/package.json | 10 +- kody/headless-api/scripts/local-smoke.mts | 64 +- kody/headless-api/src/cms.config.ts | 4 +- onboarding/apps/demo/src/styles.css | 4 +- onboarding/apps/demo/tests/demo.test.ts | 7 +- .../apps/demo/tests/entertainment.test.ts | 1 - .../apps/demo/tests/tanstack-ai.test.ts | 32 +- onboarding/packages/ai/src/tools.ts | 5 +- onboarding/packages/ai/src/turn.ts | 6 +- onboarding/packages/ai/tests/ai.test.ts | 7 +- onboarding/packages/core/src/define.ts | 4 +- onboarding/packages/core/src/machine.ts | 13 +- onboarding/packages/core/tests/core.test.ts | 84 +-- onboarding/packages/react/src/Wizard.tsx | 45 +- onboarding/packages/react/src/chat.tsx | 7 +- onboarding/packages/react/src/controls.tsx | 5 +- onboarding/packages/react/src/onboarding.css | 6 +- onboarding/packages/react/tests/form.test.tsx | 20 +- .../packages/react/tests/react.test.tsx | 16 +- packages/api/src/markdown.ts | 5 +- packages/api/src/ops.ts | 7 +- packages/api/src/start.ts | 4 +- packages/api/tests/health.test.ts | 52 +- packages/api/tests/releases.test.ts | 186 +++-- packages/cli/tests/cli.test.ts | 4 +- packages/cms-compat-wp/README.md | 6 +- packages/cms-compat-wp/src/connector.ts | 6 +- packages/cms-compat-wp/src/definition.ts | 5 +- .../cms-compat-wp/src/features/comments.ts | 18 +- packages/cms-compat-wp/src/index.ts | 6 +- packages/cms-compat-wp/tests/features.test.ts | 5 +- .../cms-compat-wp/tests/summarize.test.ts | 17 +- packages/cms-compat-wp/tsconfig.json | 7 +- packages/cms-connect-atproto/README.md | 16 +- packages/core/README.md | 16 +- packages/core/src/config.ts | 3 +- packages/core/src/server.ts | 5 +- packages/core/src/server/auth.ts | 13 +- .../core/src/server/content-migrations.ts | 6 +- packages/core/src/server/releases.ts | Bin 13976 -> 14064 bytes packages/core/src/server/storage.ts | 5 +- .../core/src/server/store/document-state.ts | 6 +- packages/core/src/storage/conformance.ts | 18 +- packages/core/tests/access-context.test.ts | 8 +- packages/core/tests/readiness.test.ts | 4 +- packages/core/tests/store.test.ts | 7 +- packages/core/tests/transfer.test.ts | 54 +- packages/search-cms/tests/cms.test.ts | 20 +- packages/store-postgres/package.json | 2 +- packages/store-postgres/src/index.ts | 10 +- packages/store-postgres/src/pglite.ts | 4 +- packages/store-postgres/tests/pglite.test.ts | 14 +- packages/ui-react/src/routes/dashboard.tsx | 4 +- packages/ui-react/src/routes/media.tsx | 12 +- packages/ui-react/src/routes/profile.tsx | 4 +- .../ui-react/tests/virtual-routes.test.ts | 3 +- 95 files changed, 2867 insertions(+), 1142 deletions(-) diff --git a/.claude/skills/wordpress-to-tanstack-cms/SKILL.md b/.claude/skills/wordpress-to-tanstack-cms/SKILL.md index d9647258..048ab2a1 100644 --- a/.claude/skills/wordpress-to-tanstack-cms/SKILL.md +++ b/.claude/skills/wordpress-to-tanstack-cms/SKILL.md @@ -241,7 +241,7 @@ letting "migrated" imply completeness. ## 8. Visual parity: reproducing the theme in userland -Migrating content reproduces the markup. Reproducing the *look* is separate work, +Migrating content reproduces the markup. Reproducing the _look_ is separate work, and it follows one firm rule that comes straight from the goal of a faithful port: **reproduce the WordPress design in the TanStack app's userland (theme tokens, block renderers, seed, a little config), and never edit WordPress to make @@ -290,7 +290,7 @@ breakpoint", default **921px** (`min-[921px]:`), not Tailwind's 768px. - **Headings use fixed px, not fluid sizes.** Gutenberg writes an inline `font-size` (for example a 54px hero `

`), and Astra does not scale inline sizes down, so the heading stays 54px at every width. A fluid - `clamp(…, 7vw, 54px)` on the ported side renders *smaller* at tablet widths; + `clamp(…, 7vw, 54px)` on the ported side renders _smaller_ at tablet widths; use the same fixed px. - **Card titles inherit the theme heading weight (about 600); section headings are explicit (often 800).** A card `

`/`

` with no explicit weight in the @@ -333,7 +333,7 @@ renders, and keep the arrays editable for the next site. ### Measure, do not eyeball -Load both sites in one window at the *same* width and diff `getComputedStyle` on +Load both sites in one window at the _same_ width and diff `getComputedStyle` on matching elements (font-family, size, weight, line-height, color, padding, and `grid-template-columns`). A window-width mismatch is the most common false "they don't match", so equalize width first. Browser-automation windows are often diff --git a/README.md b/README.md index e20d4e3a..49f4cbe4 100644 --- a/README.md +++ b/README.md @@ -217,12 +217,12 @@ TanStack CMS ships a 14-row starter catalog (12 application classes and 2 delive ## Examples -| Example | What it shows | -| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------ | -| [`blog`](./examples/blog) | The reference app: posts, pages, blocks, AI editing, and the Playwright suite. | -| [`blog-voting`](./examples/blog-voting) | Extending the CMS with your own collections and routes (votes on posts). | -| [`db-sqlite`](./examples/db-sqlite), [`db-federated`](./examples/db-federated) | TanStack DB as the data layer: a writable CMS collection, and CMS copy joined with other services in one live query. | -| [`payload-after`](./examples/payload-after), [`astro-starlight-after`](./examples/astro-starlight-after), [`emdash-after`](./examples/emdash-after), [`wordpress-after`](./examples/wordpress-after) | Sites migrated from Payload, Astro Starlight, EmDash, and WordPress, each next to its `*-before` source. | +| Example | What it shows | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | +| [`blog`](./examples/blog) | The reference app: posts, pages, blocks, AI editing, and the Playwright suite. | +| [`blog-voting`](./examples/blog-voting) | Extending the CMS with your own collections and routes (votes on posts). | +| [`db-sqlite`](./examples/db-sqlite), [`db-federated`](./examples/db-federated) | TanStack DB as the data layer: a writable CMS collection, and CMS copy joined with other services in one live query. | +| [`payload-after`](./examples/payload-after), [`astro-starlight-after`](./examples/astro-starlight-after), [`emdash-after`](./examples/emdash-after), [`wordpress-after`](./examples/wordpress-after) | Sites migrated from Payload, Astro Starlight, EmDash, and WordPress, each next to its `*-before` source. | ## Migration skills diff --git a/app/docs-preview/README.md b/app/docs-preview/README.md index c55befb8..0a163dbb 100644 --- a/app/docs-preview/README.md +++ b/app/docs-preview/README.md @@ -68,16 +68,16 @@ flagged in the report, not mapped to blocks. ## Configuration -| Env var | Default | Purpose | -| --- | --- | --- | -| `DOCS_DIR` | — | The docs directory to ingest (or pass as the CLI arg). | -| `ANTHROPIC_API_KEY` | — | Enables `/ask`. Else set a key at `/ai-settings`. | -| `DOCS_PREVIEW_MODEL` | `claude-sonnet-4-6` | The Claude model for `/ask`. | -| `DOCS_PREVIEW_TITLE` | source dir name | The site title. | -| `DOCS_PREVIEW_DATA_DIR` | `.data-` | Where the PGlite store lives. | -| `DOCS_PREVIEW_INGEST_DIR` | `.ingest-` | Where ingest artifacts live. | - -**BYOK.** The AI chat takes a key from `ANTHROPIC_API_KEY` *or* one pasted at +| Env var | Default | Purpose | +| ------------------------- | ------------------- | ------------------------------------------------------ | +| `DOCS_DIR` | — | The docs directory to ingest (or pass as the CLI arg). | +| `ANTHROPIC_API_KEY` | — | Enables `/ask`. Else set a key at `/ai-settings`. | +| `DOCS_PREVIEW_MODEL` | `claude-sonnet-4-6` | The Claude model for `/ask`. | +| `DOCS_PREVIEW_TITLE` | source dir name | The site title. | +| `DOCS_PREVIEW_DATA_DIR` | `.data-` | Where the PGlite store lives. | +| `DOCS_PREVIEW_INGEST_DIR` | `.ingest-` | Where ingest artifacts live. | + +**BYOK.** The AI chat takes a key from `ANTHROPIC_API_KEY` _or_ one pasted at `/ai-settings` (stored in the data dir, local use only). With no key, `/ask` is disabled and says so — search and preview still work. diff --git a/app/docs-preview/scripts/ingest-docs.mjs b/app/docs-preview/scripts/ingest-docs.mjs index cceb1cfa..14ee3e4b 100644 --- a/app/docs-preview/scripts/ingest-docs.mjs +++ b/app/docs-preview/scripts/ingest-docs.mjs @@ -39,7 +39,9 @@ const CMS_EXPORT_VERSION = 1 // --------------------------------------------------------------------------- const docsDir = path.resolve(process.argv[2] || process.env.DOCS_DIR || '') const outDir = path.resolve( - process.argv[3] || process.env.DOCS_PREVIEW_OUT || path.join(process.cwd(), '.ingest'), + process.argv[3] || + process.env.DOCS_PREVIEW_OUT || + path.join(process.cwd(), '.ingest'), ) if (!process.argv[2] && !process.env.DOCS_DIR) { console.error('ingest-docs: pass a docs directory (argv or DOCS_DIR).') @@ -53,7 +55,13 @@ if (!existsSync(docsDir) || !statSync(docsDir).isDirectory()) { // --------------------------------------------------------------------------- // fs helpers // --------------------------------------------------------------------------- -const SKIP_DIRS = new Set(['node_modules', '.git', '.vitepress', 'dist', 'build']) +const SKIP_DIRS = new Set([ + 'node_modules', + '.git', + '.vitepress', + 'dist', + 'build', +]) /** Every file under `dir`, recursively, as absolute paths. */ function walk(dir, acc = []) { @@ -88,7 +96,10 @@ function toSlug(relPath) { /** A stable document id from a slug. */ function toId(slug) { if (slug === '/') return 'index' - return slug.replace(/[^a-z0-9]+/gi, '-').replace(/^-+|-+$/g, '').toLowerCase() + return slug + .replace(/[^a-z0-9]+/gi, '-') + .replace(/^-+|-+$/g, '') + .toLowerCase() } /** @@ -149,7 +160,8 @@ function readConfigNav() { const sections = [] // ordered [{ label, slugs: [slug...] }] const targets = [] // every `to` the config references const configFile = path.join(docsDir, 'config.json') - if (!existsSync(configFile)) return { bySlug, sections, targets, present: false } + if (!existsSync(configFile)) + return { bySlug, sections, targets, present: false } let config try { config = JSON.parse(readFileSync(configFile, 'utf8')) @@ -162,7 +174,10 @@ function readConfigNav() { const slugs = [] const addChild = (child) => { if (child.to != null) { - const slug = `/${String(child.to).replace(/^\/+/, '')}`.replace(/^\/\//, '/') + const slug = `/${String(child.to).replace(/^\/+/, '')}`.replace( + /^\/\//, + '/', + ) const norm = slug === '/' ? '/' : slug.replace(/^\//, '') targets.push(norm) if (!bySlug.has(norm)) { @@ -298,7 +313,8 @@ for (const abs of mdFiles) { id: toId(slug), slug, title, - description: typeof data.description === 'string' ? data.description : undefined, + description: + typeof data.description === 'string' ? data.description : undefined, section, sidebarLabel, sidebarOrder, @@ -493,19 +509,32 @@ if (configNav.present) { const pg = pageBySlug.get(slug) if (!pg) continue placed.add(slug) - navPages.push({ slug, title: pg.title, label: pg.sidebarLabel, framework: pg.framework }) + navPages.push({ + slug, + title: pg.title, + label: pg.sidebarLabel, + framework: pg.framework, + }) } if (navPages.length) navSections.push({ label: sec.label, pages: navPages }) } } const leftover = pages.filter((p) => !placed.has(p.slug)) const bySection = new Map() -for (const p of leftover.sort((a, b) => a.sidebarOrder - b.sidebarOrder || a.slug.localeCompare(b.slug))) { +for (const p of leftover.sort( + (a, b) => a.sidebarOrder - b.sidebarOrder || a.slug.localeCompare(b.slug), +)) { const list = bySection.get(p.section) ?? [] - list.push({ slug: p.slug, title: p.title, label: p.sidebarLabel, framework: p.framework }) + list.push({ + slug: p.slug, + title: p.title, + label: p.sidebarLabel, + framework: p.framework, + }) bySection.set(p.section, list) } -for (const [label, navPages] of bySection) navSections.push({ label, pages: navPages }) +for (const [label, navPages] of bySection) + navSections.push({ label, pages: navPages }) writeFileSync( path.join(outDir, 'nav.json'), @@ -518,7 +547,8 @@ for (const i of issues) issuesByKind[i.kind] = (issuesByKind[i.kind] ?? 0) + 1 const issuesBySeverity = { error: 0, warning: 0, info: 0 } for (const i of issues) issuesBySeverity[i.severity] += 1 const navSourceCounts = {} -for (const p of pages) navSourceCounts[p.navSource] = (navSourceCounts[p.navSource] ?? 0) + 1 +for (const p of pages) + navSourceCounts[p.navSource] = (navSourceCounts[p.navSource] ?? 0) + 1 const report = { generatedAt: exportedAt, @@ -548,7 +578,9 @@ writeFileSync( // --------------------------------------------------------------------------- console.log(`ingest-docs: ${docsDir}`) console.log(` pages: ${pages.length} (from ${mdFiles.length} files)`) -console.log(` sections: ${navSections.length}${configNav.present ? ' (config.json)' : ' (derived)'}`) +console.log( + ` sections: ${navSections.length}${configNav.present ? ' (config.json)' : ' (derived)'}`, +) console.log(` links: ${linksChecked} checked`) console.log(` assets: ${assetsReferenced} referenced`) console.log(` nav source: ${JSON.stringify(navSourceCounts)}`) @@ -556,4 +588,6 @@ console.log( ` issues: ${issues.length} — ${issuesBySeverity.error} error, ${issuesBySeverity.warning} warning, ${issuesBySeverity.info} info`, ) console.log(` ${JSON.stringify(issuesByKind)}`) -console.log(` → ${path.relative(process.cwd(), outDir)}/{cms-export,nav,ingest-report}.json`) +console.log( + ` → ${path.relative(process.cwd(), outDir)}/{cms-export,nav,ingest-report}.json`, +) diff --git a/app/docs-preview/scripts/preview.mjs b/app/docs-preview/scripts/preview.mjs index 40709fc1..b168e86b 100644 --- a/app/docs-preview/scripts/preview.mjs +++ b/app/docs-preview/scripts/preview.mjs @@ -16,7 +16,9 @@ import path from 'node:path' const docsDir = path.resolve(process.argv[2] || process.env.DOCS_DIR || '') if (!process.argv[2] && !process.env.DOCS_DIR) { - console.error('Usage: pnpm preview (or DOCS_DIR= pnpm preview)') + console.error( + 'Usage: pnpm preview (or DOCS_DIR= pnpm preview)', + ) process.exit(1) } if (!existsSync(docsDir) || !statSync(docsDir).isDirectory()) { @@ -43,7 +45,10 @@ const env = { function run(step, file, args) { console.log(`\n▸ ${step}`) - const r = spawnSync(process.execPath, [file, ...args], { stdio: 'inherit', env }) + const r = spawnSync(process.execPath, [file, ...args], { + stdio: 'inherit', + env, + }) if (r.status !== 0) { console.error(`\n✗ ${step} failed.`) process.exit(r.status ?? 1) @@ -63,9 +68,10 @@ run('Load into the CMS', 'scripts/load-export.mjs', [ console.log(`\n▸ Serving — http://localhost:3017 (Ctrl-C to stop)`) if (!process.env.ANTHROPIC_API_KEY && !process.env.ANTHROPIC_AUTH_TOKEN) { - console.log(' (no ANTHROPIC_API_KEY — /ask is off; set one or use /ai-settings)') + console.log( + ' (no ANTHROPIC_API_KEY — /ask is off; set one or use /ai-settings)', + ) } const serve = spawn('pnpm', ['dev'], { stdio: 'inherit', env }) serve.on('exit', (code) => process.exit(code ?? 0)) -for (const sig of ['SIGINT', 'SIGTERM']) - process.on(sig, () => serve.kill(sig)) +for (const sig of ['SIGINT', 'SIGTERM']) process.on(sig, () => serve.kill(sig)) diff --git a/app/docs-preview/src/byok.api.ts b/app/docs-preview/src/byok.api.ts index 30ba7f8e..3511439a 100644 --- a/app/docs-preview/src/byok.api.ts +++ b/app/docs-preview/src/byok.api.ts @@ -6,10 +6,12 @@ import { createServerFn } from '@tanstack/react-start' import { z } from 'zod' -export const byokStatus = createServerFn({ method: 'GET' }).handler(async () => { - const m = await import('./byok.server') - return { source: m.keySource(), model: m.resolveModel() } -}) +export const byokStatus = createServerFn({ method: 'GET' }).handler( + async () => { + const m = await import('./byok.server') + return { source: m.keySource(), model: m.resolveModel() } + }, +) export const byokSet = createServerFn({ method: 'POST' }) .validator(z.object({ key: z.string().min(1).max(500) })) @@ -19,8 +21,10 @@ export const byokSet = createServerFn({ method: 'POST' }) return { source: m.keySource(), model: m.resolveModel() } }) -export const byokClear = createServerFn({ method: 'POST' }).handler(async () => { - const m = await import('./byok.server') - m.clearStoredKey() - return { source: m.keySource(), model: m.resolveModel() } -}) +export const byokClear = createServerFn({ method: 'POST' }).handler( + async () => { + const m = await import('./byok.server') + m.clearStoredKey() + return { source: m.keySource(), model: m.resolveModel() } + }, +) diff --git a/app/docs-preview/src/byok.server.ts b/app/docs-preview/src/byok.server.ts index 7d2da06d..8f371916 100644 --- a/app/docs-preview/src/byok.server.ts +++ b/app/docs-preview/src/byok.server.ts @@ -50,7 +50,10 @@ export function getStoredKey(): string | undefined { export function setStoredKey(key: string): void { const dir = resolveDataDir() mkdirSync(dir, { recursive: true }) - writeFileSync(byokFile(), `${JSON.stringify({ anthropicKey: key.trim() }, null, 2)}\n`) + writeFileSync( + byokFile(), + `${JSON.stringify({ anthropicKey: key.trim() }, null, 2)}\n`, + ) } export function clearStoredKey(): void { diff --git a/app/docs-preview/src/cms.definition.ts b/app/docs-preview/src/cms.definition.ts index 3164543d..25077e7b 100644 --- a/app/docs-preview/src/cms.definition.ts +++ b/app/docs-preview/src/cms.definition.ts @@ -28,7 +28,10 @@ * to the source tree. There is no editing surface: this app ingests, renders, * searches, and answers questions about a corpus; it does not change it. */ -import { defineCmsDefinition, defineCollection } from '@tanstack/cms-core/definition' +import { + defineCmsDefinition, + defineCollection, +} from '@tanstack/cms-core/definition' /** The framework variants TanStack docs template with `{$framework}`. */ export const FRAMEWORKS = [ @@ -60,7 +63,8 @@ const collections = [ type: 'slug', nested: true, required: true, - description: 'Docs path, e.g. /guide/data-loading ("/" is the docs home)', + description: + 'Docs path, e.g. /guide/data-loading ("/" is the docs home)', }, { name: 'sidebarLabel', label: 'Sidebar label', type: 'text' }, { name: 'sidebarOrder', label: 'Sidebar order', type: 'number' }, @@ -81,7 +85,8 @@ const collections = [ name: 'sourcePath', label: 'Source path', type: 'text', - description: 'Original file, relative to the docs dir (read-only provenance)', + description: + 'Original file, relative to the docs dir (read-only provenance)', }, { name: 'navSource', @@ -91,7 +96,12 @@ const collections = [ description: 'Where this page’s nav placement came from', }, { name: 'blocks', label: 'Content', type: 'blocks' }, - { name: 'published', label: 'Published', type: 'boolean', defaultValue: true }, + { + name: 'published', + label: 'Published', + type: 'boolean', + defaultValue: true, + }, ], }), ] diff --git a/app/docs-preview/src/components/docs-sidebar.tsx b/app/docs-preview/src/components/docs-sidebar.tsx index 764365a4..c5202aa7 100644 --- a/app/docs-preview/src/components/docs-sidebar.tsx +++ b/app/docs-preview/src/components/docs-sidebar.tsx @@ -51,7 +51,9 @@ export function DocsSidebar({ } /** Flatten the nav into reading order, for prev/next. */ -export function flattenNav(nav: NavData | null): Array<{ slug: string; title: string }> { +export function flattenNav( + nav: NavData | null, +): Array<{ slug: string; title: string }> { if (!nav) return [] return nav.sections.flatMap((s) => s.pages.map((p) => ({ slug: p.slug, title: p.label || p.title })), diff --git a/app/docs-preview/src/ingest-artifacts.server.ts b/app/docs-preview/src/ingest-artifacts.server.ts index 58253738..e67c554c 100644 --- a/app/docs-preview/src/ingest-artifacts.server.ts +++ b/app/docs-preview/src/ingest-artifacts.server.ts @@ -48,7 +48,9 @@ export interface NavData { } export function ingestDir(): string { - return process.env.DOCS_PREVIEW_INGEST_DIR || path.join(process.cwd(), '.ingest') + return ( + process.env.DOCS_PREVIEW_INGEST_DIR || path.join(process.cwd(), '.ingest') + ) } function readJson(name: string): T | null { diff --git a/app/docs-preview/src/lib/links.ts b/app/docs-preview/src/lib/links.ts index d5abbe91..2eab56e3 100644 --- a/app/docs-preview/src/lib/links.ts +++ b/app/docs-preview/src/lib/links.ts @@ -9,8 +9,7 @@ const PREFIX = '/docs' /** Resolve a relative link target against a page's slug into a doc slug. */ export function resolveDocSlug(fromSlug: string, target: string): string { - const fromDir = - fromSlug === '/' ? [] : fromSlug.split('/').slice(0, -1) + const fromDir = fromSlug === '/' ? [] : fromSlug.split('/').slice(0, -1) const clean = target.replace(/\.mdx?$/i, '').replace(/\/index$/i, '') const stack = [...fromDir] for (const part of clean.split('/')) { diff --git a/app/docs-preview/src/routes/ask.tsx b/app/docs-preview/src/routes/ask.tsx index 818e2ab0..d6a0e53c 100644 --- a/app/docs-preview/src/routes/ask.tsx +++ b/app/docs-preview/src/routes/ask.tsx @@ -133,7 +133,9 @@ function AskPage() { {t.sources && t.sources.length ? (
- Sources: + + Sources: + {t.sources.map((slug) => ( Thinking…
+
+ Thinking… +
) : null} {error ? (
diff --git a/app/docs-preview/src/routes/docs.$.tsx b/app/docs-preview/src/routes/docs.$.tsx index 7cd84ce7..9f4904b1 100644 --- a/app/docs-preview/src/routes/docs.$.tsx +++ b/app/docs-preview/src/routes/docs.$.tsx @@ -4,7 +4,12 @@ * `nav.json` (config-first order) and the body renders read-only, with its * relative Markdown links rewritten to `/docs/` so cross-links work. */ -import { createFileRoute, Link, notFound, redirect } from '@tanstack/react-router' +import { + createFileRoute, + Link, + notFound, + redirect, +} from '@tanstack/react-router' import { cmsHead } from '@tanstack/cms-core' import { get, resolveRedirect } from '@tanstack/cms-api/start' import type { Doc } from '@tanstack/cms-core' @@ -38,7 +43,12 @@ export const Route = createFileRoute('/docs/$')({ if (match) throw redirect({ href: match.to, statusCode: match.status }) throw notFound() } - return { id: found.id, doc: found.doc, slug: String(found.doc.slug ?? locator), nav } + return { + id: found.id, + doc: found.doc, + slug: String(found.doc.slug ?? locator), + nav, + } }, head: ({ loaderData }) => { const data = loaderData as DocsPage | undefined @@ -91,14 +101,20 @@ function DocsReader() {
diff --git a/app/docs-preview/src/routes/search.tsx b/app/docs-preview/src/routes/search.tsx index 9f867da0..c9d4d35f 100644 --- a/app/docs-preview/src/routes/search.tsx +++ b/app/docs-preview/src/routes/search.tsx @@ -41,7 +41,9 @@ export const Route = createFileRoute('/search')({ slug: String(i.values?.slug ?? i.id), section: String(i.values?.section ?? 'Docs'), description: - typeof i.values?.description === 'string' ? i.values.description : undefined, + typeof i.values?.description === 'string' + ? i.values.description + : undefined, framework: Array.isArray(i.values?.framework) ? (i.values!.framework as Array) : [], @@ -55,7 +57,9 @@ function countBy(hits: Array, pick: (h: Hit) => Array) { const counts = new Map() for (const h of hits) for (const v of pick(h)) counts.set(v, (counts.get(v) ?? 0) + 1) - return [...counts.entries()].sort((a, b) => b[1] - a[1] || a[0].localeCompare(b[0])) + return [...counts.entries()].sort( + (a, b) => b[1] - a[1] || a[0].localeCompare(b[0]), + ) } function FacetGroup({ @@ -120,14 +124,21 @@ function SearchPage() { [hits], ) - function toggle(set: Set, setter: (s: Set) => void, v: string) { + function toggle( + set: Set, + setter: (s: Set) => void, + v: string, + ) { const next = new Set(set) next.has(v) ? next.delete(v) : next.add(v) setter(next) } return ( - +
{ e.preventDefault() diff --git a/app/docs-preview/tests/read-only.test.ts b/app/docs-preview/tests/read-only.test.ts index b01b7f07..8ce323b2 100644 --- a/app/docs-preview/tests/read-only.test.ts +++ b/app/docs-preview/tests/read-only.test.ts @@ -44,8 +44,12 @@ function runIngest() { encoding: 'utf8', }) expect(res.status, res.stderr).toBe(0) - const report = JSON.parse(readFileSync(path.join(out, 'ingest-report.json'), 'utf8')) - const cmsExport = JSON.parse(readFileSync(path.join(out, 'cms-export.json'), 'utf8')) + const report = JSON.parse( + readFileSync(path.join(out, 'ingest-report.json'), 'utf8'), + ) + const cmsExport = JSON.parse( + readFileSync(path.join(out, 'cms-export.json'), 'utf8'), + ) const nav = JSON.parse(readFileSync(path.join(out, 'nav.json'), 'utf8')) return { report, cmsExport, nav } } @@ -76,7 +80,9 @@ describe('preview-mode contract', () => { it('builds the sidebar from config.json order', () => { const { nav } = runIngest() - const start = nav.sections.find((s: { label: string }) => s.label === 'Start') + const start = nav.sections.find( + (s: { label: string }) => s.label === 'Start', + ) expect(start).toBeTruthy() expect(start.pages.map((p: { slug: string }) => p.slug)).toEqual([ 'overview', diff --git a/app/prm/bakeoff/README.md b/app/prm/bakeoff/README.md index 48f2699a..2ee1e367 100644 --- a/app/prm/bakeoff/README.md +++ b/app/prm/bakeoff/README.md @@ -5,15 +5,15 @@ - **Exa avg fact recall:** 100.0% · **Primary-domain hits:** 11/50 - **Tavily avg fact recall:** 67.5% · **Primary-domain hits:** 11/50 -| Subject | Exa | Tavily | Top Exa Source | -|---|---|---|---| -| Sunil Pai | 100% (2 primary) | 100% (2 primary) | `https://sunilpai.dev/about` | -| Kent C. Dodds | 100% (1 primary) | 75% (1 primary) | `https://github.com/kentcdodds` | +| Subject | Exa | Tavily | Top Exa Source | +| --------------- | ---------------- | ---------------- | ----------------------------------- | +| Sunil Pai | 100% (2 primary) | 100% (2 primary) | `https://sunilpai.dev/about` | +| Kent C. Dodds | 100% (1 primary) | 75% (1 primary) | `https://github.com/kentcdodds` | | David Khourshid | 100% (1 primary) | 100% (1 primary) | `https://github.com/davidkhourshid` | -| Victor Savkin | 100% (1 primary) | 67% (1 primary) | `https://github.com/victorsavkin` | -| Tanner Linsley | 100% (1 primary) | 67% (1 primary) | `https://github.com/tannerlinsley` | -| Eugene Sergueev | 100% (1 primary) | 67% (1 primary) | `https://github.com/eugenesergueev` | -| Dominik Kundel | 100% (1 primary) | 50% (1 primary) | `https://github.com/dominikkundel` | -| Maya Shavin | 100% (1 primary) | 50% (1 primary) | `https://github.com/mayashavin` | -| Kiriti Badam | 100% (1 primary) | 50% (1 primary) | `https://github.com/kiritibadam` | -| Sachin Malhotra | 100% (1 primary) | 50% (1 primary) | `https://github.com/sachinmalhotra` | +| Victor Savkin | 100% (1 primary) | 67% (1 primary) | `https://github.com/victorsavkin` | +| Tanner Linsley | 100% (1 primary) | 67% (1 primary) | `https://github.com/tannerlinsley` | +| Eugene Sergueev | 100% (1 primary) | 67% (1 primary) | `https://github.com/eugenesergueev` | +| Dominik Kundel | 100% (1 primary) | 50% (1 primary) | `https://github.com/dominikkundel` | +| Maya Shavin | 100% (1 primary) | 50% (1 primary) | `https://github.com/mayashavin` | +| Kiriti Badam | 100% (1 primary) | 50% (1 primary) | `https://github.com/kiritibadam` | +| Sachin Malhotra | 100% (1 primary) | 50% (1 primary) | `https://github.com/sachinmalhotra` | diff --git a/app/prm/bakeoff/latest.json b/app/prm/bakeoff/latest.json index 377319f5..bdc0dcea 100644 --- a/app/prm/bakeoff/latest.json +++ b/app/prm/bakeoff/latest.json @@ -20,12 +20,7 @@ "allowedUrlRate": 1, "primaryIdentityHits": 2, "factRecallRate": 1, - "matchedFacts": [ - "cloudflare", - "partykit", - "react", - "glamor" - ], + "matchedFacts": ["cloudflare", "partykit", "react", "glamor"], "sampleUrls": [ "https://sunilpai.dev/about", "https://kentcdodds.com/chats/01/20/sunil-pai" @@ -38,12 +33,7 @@ "allowedUrlRate": 1, "primaryIdentityHits": 2, "factRecallRate": 1, - "matchedFacts": [ - "cloudflare", - "partykit", - "react", - "glamor" - ], + "matchedFacts": ["cloudflare", "partykit", "react", "glamor"], "sampleUrls": [ "https://sunilpai.dev/about", "https://kentcdodds.com/chats/01/20/sunil-pai" @@ -59,15 +49,8 @@ "allowedUrlRate": 1, "primaryIdentityHits": 1, "factRecallRate": 1, - "matchedFacts": [ - "epicweb", - "testing", - "kody", - "react" - ], - "sampleUrls": [ - "https://github.com/kentcdodds" - ] + "matchedFacts": ["epicweb", "testing", "kody", "react"], + "sampleUrls": ["https://github.com/kentcdodds"] }, "tavily": { "name": "Kent C. Dodds", @@ -76,14 +59,8 @@ "allowedUrlRate": 1, "primaryIdentityHits": 1, "factRecallRate": 0.75, - "matchedFacts": [ - "epicweb", - "testing", - "kody" - ], - "sampleUrls": [ - "https://github.com/kentcdodds" - ] + "matchedFacts": ["epicweb", "testing", "kody"], + "sampleUrls": ["https://github.com/kentcdodds"] } }, { @@ -95,14 +72,8 @@ "allowedUrlRate": 1, "primaryIdentityHits": 1, "factRecallRate": 1, - "matchedFacts": [ - "stately", - "xstate", - "state" - ], - "sampleUrls": [ - "https://github.com/davidkhourshid" - ] + "matchedFacts": ["stately", "xstate", "state"], + "sampleUrls": ["https://github.com/davidkhourshid"] }, "tavily": { "name": "David Khourshid", @@ -111,14 +82,8 @@ "allowedUrlRate": 1, "primaryIdentityHits": 1, "factRecallRate": 1, - "matchedFacts": [ - "stately", - "xstate", - "state" - ], - "sampleUrls": [ - "https://github.com/davidkhourshid" - ] + "matchedFacts": ["stately", "xstate", "state"], + "sampleUrls": ["https://github.com/davidkhourshid"] } }, { @@ -130,14 +95,8 @@ "allowedUrlRate": 1, "primaryIdentityHits": 1, "factRecallRate": 1, - "matchedFacts": [ - "nx", - "nrwl", - "monorepo" - ], - "sampleUrls": [ - "https://github.com/victorsavkin" - ] + "matchedFacts": ["nx", "nrwl", "monorepo"], + "sampleUrls": ["https://github.com/victorsavkin"] }, "tavily": { "name": "Victor Savkin", @@ -146,13 +105,8 @@ "allowedUrlRate": 1, "primaryIdentityHits": 1, "factRecallRate": 0.6666666666666666, - "matchedFacts": [ - "nx", - "nrwl" - ], - "sampleUrls": [ - "https://github.com/victorsavkin" - ] + "matchedFacts": ["nx", "nrwl"], + "sampleUrls": ["https://github.com/victorsavkin"] } }, { @@ -164,14 +118,8 @@ "allowedUrlRate": 1, "primaryIdentityHits": 1, "factRecallRate": 1, - "matchedFacts": [ - "tanstack", - "query", - "router" - ], - "sampleUrls": [ - "https://github.com/tannerlinsley" - ] + "matchedFacts": ["tanstack", "query", "router"], + "sampleUrls": ["https://github.com/tannerlinsley"] }, "tavily": { "name": "Tanner Linsley", @@ -180,13 +128,8 @@ "allowedUrlRate": 1, "primaryIdentityHits": 1, "factRecallRate": 0.6666666666666666, - "matchedFacts": [ - "tanstack", - "query" - ], - "sampleUrls": [ - "https://github.com/tannerlinsley" - ] + "matchedFacts": ["tanstack", "query"], + "sampleUrls": ["https://github.com/tannerlinsley"] } }, { @@ -198,14 +141,8 @@ "allowedUrlRate": 1, "primaryIdentityHits": 1, "factRecallRate": 1, - "matchedFacts": [ - "flo", - "ai", - "agent" - ], - "sampleUrls": [ - "https://github.com/eugenesergueev" - ] + "matchedFacts": ["flo", "ai", "agent"], + "sampleUrls": ["https://github.com/eugenesergueev"] }, "tavily": { "name": "Eugene Sergueev", @@ -214,13 +151,8 @@ "allowedUrlRate": 1, "primaryIdentityHits": 1, "factRecallRate": 0.6666666666666666, - "matchedFacts": [ - "flo", - "ai" - ], - "sampleUrls": [ - "https://github.com/eugenesergueev" - ] + "matchedFacts": ["flo", "ai"], + "sampleUrls": ["https://github.com/eugenesergueev"] } }, { @@ -232,13 +164,8 @@ "allowedUrlRate": 1, "primaryIdentityHits": 1, "factRecallRate": 1, - "matchedFacts": [ - "developer", - "experience" - ], - "sampleUrls": [ - "https://github.com/dominikkundel" - ] + "matchedFacts": ["developer", "experience"], + "sampleUrls": ["https://github.com/dominikkundel"] }, "tavily": { "name": "Dominik Kundel", @@ -247,12 +174,8 @@ "allowedUrlRate": 1, "primaryIdentityHits": 1, "factRecallRate": 0.5, - "matchedFacts": [ - "developer" - ], - "sampleUrls": [ - "https://github.com/dominikkundel" - ] + "matchedFacts": ["developer"], + "sampleUrls": ["https://github.com/dominikkundel"] } }, { @@ -264,13 +187,8 @@ "allowedUrlRate": 1, "primaryIdentityHits": 1, "factRecallRate": 1, - "matchedFacts": [ - "frontend", - "accessibility" - ], - "sampleUrls": [ - "https://github.com/mayashavin" - ] + "matchedFacts": ["frontend", "accessibility"], + "sampleUrls": ["https://github.com/mayashavin"] }, "tavily": { "name": "Maya Shavin", @@ -279,12 +197,8 @@ "allowedUrlRate": 1, "primaryIdentityHits": 1, "factRecallRate": 0.5, - "matchedFacts": [ - "frontend" - ], - "sampleUrls": [ - "https://github.com/mayashavin" - ] + "matchedFacts": ["frontend"], + "sampleUrls": ["https://github.com/mayashavin"] } }, { @@ -296,13 +210,8 @@ "allowedUrlRate": 1, "primaryIdentityHits": 1, "factRecallRate": 1, - "matchedFacts": [ - "runtime", - "ai" - ], - "sampleUrls": [ - "https://github.com/kiritibadam" - ] + "matchedFacts": ["runtime", "ai"], + "sampleUrls": ["https://github.com/kiritibadam"] }, "tavily": { "name": "Kiriti Badam", @@ -311,12 +220,8 @@ "allowedUrlRate": 1, "primaryIdentityHits": 1, "factRecallRate": 0.5, - "matchedFacts": [ - "runtime" - ], - "sampleUrls": [ - "https://github.com/kiritibadam" - ] + "matchedFacts": ["runtime"], + "sampleUrls": ["https://github.com/kiritibadam"] } }, { @@ -328,13 +233,8 @@ "allowedUrlRate": 1, "primaryIdentityHits": 1, "factRecallRate": 1, - "matchedFacts": [ - "observability", - "telemetry" - ], - "sampleUrls": [ - "https://github.com/sachinmalhotra" - ] + "matchedFacts": ["observability", "telemetry"], + "sampleUrls": ["https://github.com/sachinmalhotra"] }, "tavily": { "name": "Sachin Malhotra", @@ -343,12 +243,8 @@ "allowedUrlRate": 1, "primaryIdentityHits": 1, "factRecallRate": 0.5, - "matchedFacts": [ - "observability" - ], - "sampleUrls": [ - "https://github.com/sachinmalhotra" - ] + "matchedFacts": ["observability"], + "sampleUrls": ["https://github.com/sachinmalhotra"] } } ] diff --git a/examples/wp-vs-tanstack/ADMIN-GAP-ANALYSIS.md b/examples/wp-vs-tanstack/ADMIN-GAP-ANALYSIS.md index 66fac234..4f072db6 100644 --- a/examples/wp-vs-tanstack/ADMIN-GAP-ANALYSIS.md +++ b/examples/wp-vs-tanstack/ADMIN-GAP-ANALYSIS.md @@ -1,6 +1,6 @@ # Admin feature gaps — wp-admin vs TanStack CMS (Pass 2) -Pass 1 asked whether TanStack CMS can reproduce a fixed WordPress *design* in +Pass 1 asked whether TanStack CMS can reproduce a fixed WordPress _design_ in userland (it can). Pass 2 asks the authoring question: walk the **admin** of both builds of Summit Home Services and answer two things. @@ -35,7 +35,7 @@ Before the matrix, the one structural difference that colors everything else: th Layout and theme are code (`theme.tokens`, renderers), not an admin screen. Neither is strictly richer; they optimize for different things. Gutenberg optimizes -for *see-what-you-get* page building. TanStack optimizes for a *typed content model* +for _see-what-you-get_ page building. TanStack optimizes for a _typed content model_ that the same blocks render on the site, plus governance (review queue), AI/MCP, and per-field access. That trade shows up all through the matrix below. @@ -45,34 +45,34 @@ Status legend: **EXISTS** (shipped admin screen) · **PARTIAL** (present but thi than WP, or config-only) · **UI-GAP** (the engine exists in core, no stock screen surfaces it) · **MISSING** (no engine, no screen). -| wp-admin capability | TanStack CMS | Backing / note | -| --- | --- | --- | -| Dashboard / landing (At a Glance, Activity, Site Health) | **UI-GAP** | Bare `/cms` 404s; no landing. Counts/activity data exist (revisions, events). | -| Posts/Pages list (search, filter, sort, bulk, columns) | **EXISTS** | `/cms/content`; status tabs, search, configurable Columns, per-collection sections. | -| Content editor | **EXISTS** | `/cms/edit/$collection/$id`; field form + block list, 19 field widgets. | -| Scheduling (publish date) | **EXISTS** (ahead) | Inline `publishAt` **and** `unpublishAt` in the sidebar. | -| Revisions / restore | **EXISTS** (ahead) | Revisions panel with restore; WP revisions are per-post only. | -| Draft + review/approval workflow | **EXISTS** (ahead) | Review queue; WP has no native approval step. | -| Categories / Tags (hierarchical, usage counts) | **PARTIAL** | Relation/select fields; no term manager with counts (`schema.ts`). | -| Media Library (grid, upload, bulk, alt text) | **UI-GAP** | Core has an `asset` collection + media adapters + inline picker (`assets.ts`), but no dedicated gallery/manager screen. This example configures no assets, so there's no media route at all. | -| Comments — public + moderation (spam/approve/trash) | **MISSING** | Core comments are **editorial** (on documents, for reviewers), not public. No spam queue (`ops.ts add_comment`). | -| Menus / navigation builder (drag-order, locations) | **MISSING** | No menu primitive or editor; nav is hardcoded in `siteNav` (userland config). | -| Appearance → Customize (logo, colors, fonts, live preview) | **MISSING** | Theme is code (`theme.tokens`, `theme.fontLinks`); no branding screen. | -| Widgets | **N/A** | Block model; no widget areas. | -| Plugins — install/activate UI | **PARTIAL (by design)** | Plugins are code (`plugins: [...]`), no marketplace/installer UI. | -| Users — list, add, roles | **PARTIAL** | Settings maps identity→role and issues API keys; DB-user CRUD exists in core but isn't surfaced here. | -| Roles & permissions | **EXISTS** (ahead) | 4 roles + custom + collection + **field-level** access (`lib/access.ts`). | -| API keys for agents/integrations | **EXISTS** (ahead) | Per-key role + collection scope (Settings); WP has nothing equivalent. | -| Tools → Import / Export | **PARTIAL** | CLI `tanstack-cms import/export` + `@tanstack/cms-migrate-wp` engine; no admin screen. | -| Tools → Site Health / diagnostics | **MISSING** | No diagnostics panel. | -| Settings — General/Reading/Permalinks/Discussion | **PARTIAL** | Site config is code; Settings screen covers keys/access/activity only. | -| Permalinks / slugs / redirects | **EXISTS** (ahead) | `slug` fields, locators, `redirectsCollection`; a Redirects collection ships here. | -| SEO (title/description/OG/JSON-LD) | **EXISTS** (ahead) | Built in: `seoField`, `cmsHead`, `cmsJsonLd` (`lib/seo.ts`); stock WP needs a plugin. | -| Contact form builder | **MISSING** (UI) | No form designer; forms are a public route writing to a collection. | -| Contact form **entries** inbox | **PARTIAL (ahead here)** | This example stores leads in a **Contact Inquiries** collection; the WP install stores **nothing** (CF7 needs Flamingo). No dedicated inbox screen, but entries are browsable. | -| AI authoring agent | **EXISTS** (ahead) | `/cms/agent` + MCP/WebMCP (hidden here, AI not configured); WP has none. | -| Activity / audit log | **EXISTS** | Settings activity log + review audit trail. | -| User profile / preferences | **MISSING** | Only a theme toggle; no profile screen. | +| wp-admin capability | TanStack CMS | Backing / note | +| ---------------------------------------------------------- | ------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| Dashboard / landing (At a Glance, Activity, Site Health) | **UI-GAP** | Bare `/cms` 404s; no landing. Counts/activity data exist (revisions, events). | +| Posts/Pages list (search, filter, sort, bulk, columns) | **EXISTS** | `/cms/content`; status tabs, search, configurable Columns, per-collection sections. | +| Content editor | **EXISTS** | `/cms/edit/$collection/$id`; field form + block list, 19 field widgets. | +| Scheduling (publish date) | **EXISTS** (ahead) | Inline `publishAt` **and** `unpublishAt` in the sidebar. | +| Revisions / restore | **EXISTS** (ahead) | Revisions panel with restore; WP revisions are per-post only. | +| Draft + review/approval workflow | **EXISTS** (ahead) | Review queue; WP has no native approval step. | +| Categories / Tags (hierarchical, usage counts) | **PARTIAL** | Relation/select fields; no term manager with counts (`schema.ts`). | +| Media Library (grid, upload, bulk, alt text) | **UI-GAP** | Core has an `asset` collection + media adapters + inline picker (`assets.ts`), but no dedicated gallery/manager screen. This example configures no assets, so there's no media route at all. | +| Comments — public + moderation (spam/approve/trash) | **MISSING** | Core comments are **editorial** (on documents, for reviewers), not public. No spam queue (`ops.ts add_comment`). | +| Menus / navigation builder (drag-order, locations) | **MISSING** | No menu primitive or editor; nav is hardcoded in `siteNav` (userland config). | +| Appearance → Customize (logo, colors, fonts, live preview) | **MISSING** | Theme is code (`theme.tokens`, `theme.fontLinks`); no branding screen. | +| Widgets | **N/A** | Block model; no widget areas. | +| Plugins — install/activate UI | **PARTIAL (by design)** | Plugins are code (`plugins: [...]`), no marketplace/installer UI. | +| Users — list, add, roles | **PARTIAL** | Settings maps identity→role and issues API keys; DB-user CRUD exists in core but isn't surfaced here. | +| Roles & permissions | **EXISTS** (ahead) | 4 roles + custom + collection + **field-level** access (`lib/access.ts`). | +| API keys for agents/integrations | **EXISTS** (ahead) | Per-key role + collection scope (Settings); WP has nothing equivalent. | +| Tools → Import / Export | **PARTIAL** | CLI `tanstack-cms import/export` + `@tanstack/cms-migrate-wp` engine; no admin screen. | +| Tools → Site Health / diagnostics | **MISSING** | No diagnostics panel. | +| Settings — General/Reading/Permalinks/Discussion | **PARTIAL** | Site config is code; Settings screen covers keys/access/activity only. | +| Permalinks / slugs / redirects | **EXISTS** (ahead) | `slug` fields, locators, `redirectsCollection`; a Redirects collection ships here. | +| SEO (title/description/OG/JSON-LD) | **EXISTS** (ahead) | Built in: `seoField`, `cmsHead`, `cmsJsonLd` (`lib/seo.ts`); stock WP needs a plugin. | +| Contact form builder | **MISSING** (UI) | No form designer; forms are a public route writing to a collection. | +| Contact form **entries** inbox | **PARTIAL (ahead here)** | This example stores leads in a **Contact Inquiries** collection; the WP install stores **nothing** (CF7 needs Flamingo). No dedicated inbox screen, but entries are browsable. | +| AI authoring agent | **EXISTS** (ahead) | `/cms/agent` + MCP/WebMCP (hidden here, AI not configured); WP has none. | +| Activity / audit log | **EXISTS** | Settings activity log + review audit trail. | +| User profile / preferences | **MISSING** | Only a theme toggle; no profile screen. | ## 3. Where TanStack already leads @@ -88,6 +88,7 @@ and automation. ## 4. The gaps, grouped ### A. UI gaps — the engine exists, the stock admin doesn't surface it + 1. **Dashboard / landing.** `/cms` should greet you, not 404. 2. **Media Library browser.** The `asset` collection and media adapters exist; there's no grid-style browse/manage screen with upload and bulk actions. @@ -100,6 +101,7 @@ and automation. config instead of code (optional — many teams are happy leaving this in code). ### B. Genuinely absent — no engine primitive today + 5. **Menus / navigation as editable data.** No menu collection, ordering primitive, or editor. Nav is hardcoded per app. 6. **Public comments + moderation.** Editorial comments only; no public comments, @@ -110,7 +112,8 @@ and automation. 9. **Site Health / diagnostics.** Adapter connectivity, pending migrations, env. 10. **User profile / preferences screen.** -### C. WordPress-flavored compatibility — only relevant when coming *from* WP +### C. WordPress-flavored compatibility — only relevant when coming _from_ WP + 11. **WP import wizard** (admin UI over the existing migrate engine). 12. **CF7/Flamingo-style form builder + entries inbox.** 13. **Shortcode / Gutenberg-block ingestion** (migrate fidelity). @@ -136,25 +139,25 @@ and custom admin screens are built from the public `@tanstack/cms-ui-react/tools So the split is: **core gets the universal admin screens whose engine already exists; a WP-compat library gets the WordPress-shaped features.** -| # | Gap | Where | Why / how | -| --- | --- | --- | --- | -| 1 | Dashboard / landing | **CORE** | Universal; add an index route in `cms-ui-react` over existing counts/events. | -| 2 | Media Library browser | **CORE** | `asset` collection already backs it (`assets.ts`); needs a gallery screen. | -| 3 | Bulk-ops UI | **CORE — ✅ already shipped** | `BulkBar` already wires row selection to `bulkDocuments` (publish/unpublish/delete/restore/purge) in the content list. | -| 4 | Site-settings screen | **CORE (optional)** | A `siteSettings` singleton helper + screen; low priority. | -| 5 | Menus / navigation | **CORE helper + lib UI** | Ship a `navigationCollection()` authoring helper (like `redirectsCollection`); WP menu-location mapping lives in the lib. | -| 6 | Public comments + moderation | **LIBRARY** | Not universal (headless/marketing sites skip it). Plugin: comments collection + moderation `adminRoutes` + spam hook. | -| 7 | Taxonomy manager | **LIBRARY** (core helper optional) | Build on relation collections; counts/hierarchy UI as a plugin screen. | -| 8 | Theme / branding editor | **CORE (optional)** | A theme singleton + screen writing `theme.tokens`; or leave in code. | -| 9 | Site Health / diagnostics | **CORE (optional)** | Reads adapter/env state; low priority. | -| 10 | Profile / preferences | **CORE** | Small screen over the existing session/auth contract. | -| 11 | WP import wizard | **LIBRARY** | Add `adminNav` + `adminRoutes` over `cms-migrate-wp`. | -| 12 | Form builder + entries inbox | **LIBRARY** | Plugin: form-def collection + submissions collection + inbox `adminRoute` + spam `op`. The `forms-lead-capture` skill is the seed. | -| 13 | Shortcode / Gutenberg ingestion | **LIBRARY** | Part of `cms-migrate-wp` (shortcode→block, block-delimiter parse). | -| 14 | Old-WP-URL redirects | **LIBRARY** | Generate into the core `redirectsCollection` from WP permalink structure on import. | -| 15 | WP comment import | **LIBRARY** | Maps into the comments plugin (#6). | - -The core list is short on purpose: it's only the *universal* screens (dashboard, +| # | Gap | Where | Why / how | +| --- | ------------------------------- | ---------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- | +| 1 | Dashboard / landing | **CORE** | Universal; add an index route in `cms-ui-react` over existing counts/events. | +| 2 | Media Library browser | **CORE** | `asset` collection already backs it (`assets.ts`); needs a gallery screen. | +| 3 | Bulk-ops UI | **CORE — ✅ already shipped** | `BulkBar` already wires row selection to `bulkDocuments` (publish/unpublish/delete/restore/purge) in the content list. | +| 4 | Site-settings screen | **CORE (optional)** | A `siteSettings` singleton helper + screen; low priority. | +| 5 | Menus / navigation | **CORE helper + lib UI** | Ship a `navigationCollection()` authoring helper (like `redirectsCollection`); WP menu-location mapping lives in the lib. | +| 6 | Public comments + moderation | **LIBRARY** | Not universal (headless/marketing sites skip it). Plugin: comments collection + moderation `adminRoutes` + spam hook. | +| 7 | Taxonomy manager | **LIBRARY** (core helper optional) | Build on relation collections; counts/hierarchy UI as a plugin screen. | +| 8 | Theme / branding editor | **CORE (optional)** | A theme singleton + screen writing `theme.tokens`; or leave in code. | +| 9 | Site Health / diagnostics | **CORE (optional)** | Reads adapter/env state; low priority. | +| 10 | Profile / preferences | **CORE** | Small screen over the existing session/auth contract. | +| 11 | WP import wizard | **LIBRARY** | Add `adminNav` + `adminRoutes` over `cms-migrate-wp`. | +| 12 | Form builder + entries inbox | **LIBRARY** | Plugin: form-def collection + submissions collection + inbox `adminRoute` + spam `op`. The `forms-lead-capture` skill is the seed. | +| 13 | Shortcode / Gutenberg ingestion | **LIBRARY** | Part of `cms-migrate-wp` (shortcode→block, block-delimiter parse). | +| 14 | Old-WP-URL redirects | **LIBRARY** | Generate into the core `redirectsCollection` from WP permalink structure on import. | +| 15 | WP comment import | **LIBRARY** | Maps into the comments plugin (#6). | + +The core list is short on purpose: it's only the _universal_ screens (dashboard, media, bulk-ops, profile) where the data layer is already built and the stock admin simply doesn't draw the screen yet. Everything WordPress-specific stays a plugin. @@ -189,6 +192,6 @@ WP-compatibility is a plugin problem, not a core problem. --- -*Method: live read-only walkthrough of both admins (WordPress 7.1.4 + Astra + CF7 at +_Method: live read-only walkthrough of both admins (WordPress 7.1.4 + Astra + CF7 at `:8080`, TanStack CMS at `:3020`), cross-checked against `packages/*`. WordPress was -not modified. See [`COMPARISON.md`](./COMPARISON.md) for Pass 1 (design parity).* +not modified. See [`COMPARISON.md`](./COMPARISON.md) for Pass 1 (design parity)._ diff --git a/examples/wp-vs-tanstack/COMPARISON.md b/examples/wp-vs-tanstack/COMPARISON.md index 3b8dfc02..36162262 100644 --- a/examples/wp-vs-tanstack/COMPARISON.md +++ b/examples/wp-vs-tanstack/COMPARISON.md @@ -14,7 +14,7 @@ is outlined at the end and not yet run. ### The question Earlier versions of this comparison were circular: the two sites were tuned to -the *same* hand-picked palette at the same time, so "they match" proved little. +the _same_ hand-picked palette at the same time, so "they match" proved little. This pass fixes that with a cleaner experiment: 1. **WordPress is the fixed reference.** It's a realistic small-business Astra @@ -33,16 +33,16 @@ This pass fixes that with a cleaner experiment: Measured with the browser's computed styles, both sites at the **same desktop width**, element by element: -| Element | WordPress | TanStack CMS | -| --- | --- | --- | -| Body | 16px / 1.65, Inter, `#475569` | 16px / 1.65, Inter, `#475569` | -| Headings | Poppins, `#0f172a` | Poppins, `#0f172a` | -| Logo | 26px / 600, Poppins, `#1e293b` | 26px / 600, Poppins, `#1e293b` | -| Nav link (active) | 16px / 400, Inter, `#045cb4` | 16px / 400, Inter, `#045cb4` | -| Hero H1 | 54px / 800, Poppins, lh 75.6 | 54px / 800, Poppins, lh 75.6 | -| Hero subheading | 20px, Inter, `#c7d2fe` | 20px, Inter, `#c7d2fe` | -| "What We Do" | 36px / 800, Poppins, `#0f172a` | 36px / 800, Poppins, `#0f172a` | -| Hero buttons | orange fill / blue, radius 4px | orange fill / blue, radius 4px | +| Element | WordPress | TanStack CMS | +| ----------------- | ------------------------------ | ------------------------------ | +| Body | 16px / 1.65, Inter, `#475569` | 16px / 1.65, Inter, `#475569` | +| Headings | Poppins, `#0f172a` | Poppins, `#0f172a` | +| Logo | 26px / 600, Poppins, `#1e293b` | 26px / 600, Poppins, `#1e293b` | +| Nav link (active) | 16px / 400, Inter, `#045cb4` | 16px / 400, Inter, `#045cb4` | +| Hero H1 | 54px / 800, Poppins, lh 75.6 | 54px / 800, Poppins, lh 75.6 | +| Hero subheading | 20px, Inter, `#c7d2fe` | 20px, Inter, `#c7d2fe` | +| "What We Do" | 36px / 800, Poppins, `#0f172a` | 36px / 800, Poppins, `#0f172a` | +| Hero buttons | orange fill / blue, radius 4px | orange fill / blue, radius 4px | Every page is reproduced with the same content and structure: Home, Services, About, Reviews, Contact (CF7 lead form on WP, a native form on TanStack), and a @@ -70,12 +70,12 @@ The two stacks have different responsive systems, so matching one width is not enough; the column counts have to switch at the same widths too. WordPress and Tailwind disagree by default: -| Width | Gutenberg columns | Tailwind `sm:`/`lg:` grid | -| --- | --- | --- | -| ≥1024px | all in one row | all in one row | -| 782–1023px | **all in one row** | **2-up** | -| 640–781px | **one column** | **2-up** | -| <640px | one column | one column | +| Width | Gutenberg columns | Tailwind `sm:`/`lg:` grid | +| ---------- | ------------------ | ------------------------- | +| ≥1024px | all in one row | all in one row | +| 782–1023px | **all in one row** | **2-up** | +| 640–781px | **one column** | **2-up** | +| <640px | one column | one column | A `wp-block-columns` stacks at a single breakpoint (`≤781px` → one column, `≥782px` → N across); there is no 2-up middle state. The renderers mirror that @@ -120,12 +120,12 @@ didn't change, so the shape holds, but re-measure after the redesign for exact numbers (both sites now also load the same two Google web fonts, which narrows the first-load-bytes gap). -| Metric | WordPress | TanStack CMS | Winner | -| --- | --- | --- | --- | -| TTFB (server render) | 71 ms | **20 ms** | TanStack | -| First Contentful Paint | 120 ms | **68 ms** | TanStack | -| DOM nodes | 193 | **98** | TanStack (half) | -| First-load transfer | **~44 KB** | ~160–185 KB (gzip/brotli) | WordPress | +| Metric | WordPress | TanStack CMS | Winner | +| ---------------------- | ---------- | ------------------------- | --------------- | +| TTFB (server render) | 71 ms | **20 ms** | TanStack | +| First Contentful Paint | 120 ms | **68 ms** | TanStack | +| DOM nodes | 193 | **98** | TanStack (half) | +| First-load transfer | **~44 KB** | ~160–185 KB (gzip/brotli) | WordPress | Reading it honestly: TanStack wins time-to-first-byte, first paint, and DOM weight; WordPress ships fewer first-load bytes because this is a deliberately @@ -148,9 +148,16 @@ pnpm --filter wp-vs-tanstack dev Measure computed styles in a page's console, both sites at the same width: ```js -const el = [...document.querySelectorAll('*')].find(e => e.textContent.trim() === 'What We Do') +const el = [...document.querySelectorAll('*')].find( + (e) => e.textContent.trim() === 'What We Do', +) const s = getComputedStyle(el) -;({ font: s.fontFamily, size: s.fontSize, weight: s.fontWeight, color: s.color }) +;({ + font: s.fontFamily, + size: s.fontSize, + weight: s.fontWeight, + color: s.color, +}) ``` #### Prod build note @@ -179,7 +186,7 @@ versus a **WordPress-compatibility library**. See [`ADMIN-GAP-ANALYSIS.md`](./ADMIN-GAP-ANALYSIS.md) for the full feature matrix and the core-vs-library recommendation. Short answer: the TanStack admin is ahead on governance (review queue, revisions, field-level roles, scheduling, AI/MCP), and -the wp-admin features it lacks are either a few *universal* screens whose engines -already exist (dashboard, media library, bulk-ops — core) or *WordPress-shaped* +the wp-admin features it lacks are either a few _universal_ screens whose engines +already exist (dashboard, media library, bulk-ops — core) or _WordPress-shaped_ features (menus, public comments, CF7 entries, importer) that fit a companion plugin without touching `packages/*`. diff --git a/examples/wp-vs-tanstack/src/cms.config.ts b/examples/wp-vs-tanstack/src/cms.config.ts index e862e5c0..6f925919 100644 --- a/examples/wp-vs-tanstack/src/cms.config.ts +++ b/examples/wp-vs-tanstack/src/cms.config.ts @@ -18,8 +18,18 @@ const blockTypes = [ { name: 'badge', label: 'Eyebrow / Badge', type: 'text' }, { name: 'heading', label: 'Heading', type: 'text', required: true }, { name: 'subheading', label: 'Subheading', type: 'textarea' }, - { name: 'minHeight', label: 'Min Height (px)', type: 'number', defaultValue: 320 }, - { name: 'headingSize', label: 'Heading Size (px)', type: 'number', defaultValue: 48 }, + { + name: 'minHeight', + label: 'Min Height (px)', + type: 'number', + defaultValue: 320, + }, + { + name: 'headingSize', + label: 'Heading Size (px)', + type: 'number', + defaultValue: 48, + }, { name: 'primaryLabel', label: 'Primary Button Label', type: 'text' }, { name: 'primaryHref', label: 'Primary Button Link', type: 'text' }, { name: 'secondaryLabel', label: 'Secondary Button Label', type: 'text' }, @@ -97,7 +107,12 @@ const blockTypes = [ fields: [ { name: 'heading', label: 'Heading', type: 'text' }, { name: 'intro', label: 'Intro', type: 'textarea' }, - { name: 'bigTitles', label: 'Large card titles (h3)', type: 'boolean', defaultValue: false }, + { + name: 'bigTitles', + label: 'Large card titles (h3)', + type: 'boolean', + defaultValue: false, + }, { name: 'surface', label: 'Background', @@ -152,8 +167,18 @@ const blockTypes = [ ], defaultValue: 'plain', }, - { name: 'card', label: 'Show as cards', type: 'boolean', defaultValue: true }, - { name: 'titleSize', label: 'Card Title Size (px)', type: 'number', defaultValue: 22 }, + { + name: 'card', + label: 'Show as cards', + type: 'boolean', + defaultValue: true, + }, + { + name: 'titleSize', + label: 'Card Title Size (px)', + type: 'number', + defaultValue: 22, + }, { name: 'items', label: 'Items', @@ -322,8 +347,10 @@ export const cms = defineCms(definition, { 'accent-soft': '#ffedd5', 'header-bg': '#ffffff', radius: '0.75rem', - 'font-body': "'Inter', -apple-system, system-ui, 'Segoe UI', Roboto, sans-serif", - 'font-heading': "'Poppins', -apple-system, system-ui, 'Segoe UI', sans-serif", + 'font-body': + "'Inter', -apple-system, system-ui, 'Segoe UI', Roboto, sans-serif", + 'font-heading': + "'Poppins', -apple-system, system-ui, 'Segoe UI', sans-serif", 'page-width': '1240px', 'content-width': '46rem', }, diff --git a/examples/wp-vs-tanstack/src/cms.definition.ts b/examples/wp-vs-tanstack/src/cms.definition.ts index bdb28462..3a42efb8 100644 --- a/examples/wp-vs-tanstack/src/cms.definition.ts +++ b/examples/wp-vs-tanstack/src/cms.definition.ts @@ -43,7 +43,12 @@ export const definition = defineCmsDefinition({ { name: 'title', label: 'Page Title', type: 'text', required: true }, { name: 'slug', label: 'Slug', type: 'slug', from: 'title' }, { name: 'blocks', label: 'Sections', type: 'blocks' }, - { name: 'published', label: 'Published', type: 'boolean', defaultValue: true }, + { + name: 'published', + label: 'Published', + type: 'boolean', + defaultValue: true, + }, seoField(), ], }), @@ -63,7 +68,12 @@ export const definition = defineCmsDefinition({ { name: 'title', label: 'Title', type: 'text', required: true }, { name: 'slug', label: 'Slug', type: 'slug', from: 'title' }, { name: 'excerpt', label: 'Excerpt', type: 'textarea' }, - { name: 'author', label: 'Author', type: 'text', defaultValue: 'Summit Home Services' }, + { + name: 'author', + label: 'Author', + type: 'text', + defaultValue: 'Summit Home Services', + }, { name: 'body', label: 'Body', type: 'markdown' }, { name: 'category', @@ -76,7 +86,12 @@ export const definition = defineCmsDefinition({ ], }, { name: 'publishedAt', label: 'Published Date', type: 'date' }, - { name: 'published', label: 'Published', type: 'boolean', defaultValue: true }, + { + name: 'published', + label: 'Published', + type: 'boolean', + defaultValue: true, + }, ], }), diff --git a/examples/wp-vs-tanstack/src/cms.renderers.tsx b/examples/wp-vs-tanstack/src/cms.renderers.tsx index 874c8e52..d379e7ed 100644 --- a/examples/wp-vs-tanstack/src/cms.renderers.tsx +++ b/examples/wp-vs-tanstack/src/cms.renderers.tsx @@ -157,7 +157,14 @@ export function PageTitleBar({ title }: { title: string }) { {/* WP/Astra prints the page title flush under the header (0px above) with 24px below before the content starts; match that, not a roomier bar. */} -

+

{title}

@@ -175,7 +182,8 @@ function Hero({ block }: BlockRendererProps) { const secondaryLabel = str(b, 'secondaryLabel') // Match the WordPress/Astra cover: a fixed min-height with the content // vertically centered, 48px padding, and a fixed heading size per page. - const minHeight = typeof b.minHeight === 'number' ? (b.minHeight as number) : 320 + const minHeight = + typeof b.minHeight === 'number' ? (b.minHeight as number) : 320 const headingSize = typeof b.headingSize === 'number' ? (b.headingSize as number) : 48 return ( @@ -280,9 +288,14 @@ function StatBar({ block }: BlockRendererProps) {
{list.map((it, i) => ( -

+

{str(it, 'icon') && {str(it, 'icon')}} - {str(it, 'emphasis')}{' '} + + {str(it, 'emphasis')} + {' '} {str(it, 'label')}

))} @@ -296,7 +309,10 @@ function SectionIntro({ block }: BlockRendererProps) { const left = str(b, 'align') === 'left' const soft = str(b, 'surface') === 'soft' return ( -
+
{str(b, 'eyebrow') && (

)} {str(b, 'subheading') && ( -

+

{str(b, 'subheading')}

)} @@ -335,7 +353,10 @@ function ServiceSection({ block }: BlockRendererProps) { // rather than the h4/18px used for sub-service cards. const bigTitles = b.bigTitles === true return ( -
+
{str(b, 'heading') && (

)} {str(b, 'intro') && ( -

{str(b, 'intro')}

+

+ {str(b, 'intro')} +

)}
{cards.map((c, i) => { - const bullets = (Array.isArray(c.bullets) ? c.bullets : []) as Array< - Record - > + const bullets = ( + Array.isArray(c.bullets) ? c.bullets : [] + ) as Array> return (
{str(c, 'title')}

) : (

{str(c, 'title')}

)} {str(c, 'body') && ( -

{str(c, 'body')}

+

+ {str(c, 'body')} +

)} {bullets.length > 0 && (
    @@ -406,7 +439,8 @@ function FeatureGrid({ block }: BlockRendererProps) { ? 'grid-cols-1 min-[782px]:grid-cols-4' : 'grid-cols-1 min-[782px]:grid-cols-3' const ctaLabel = str(b, 'ctaLabel') - const titleSize = typeof b.titleSize === 'number' ? (b.titleSize as number) : 22 + const titleSize = + typeof b.titleSize === 'number' ? (b.titleSize as number) : 22 return (
    @@ -443,7 +477,11 @@ function FeatureGrid({ block }: BlockRendererProps) { >

    {str(it, 'icon') && {str(it, 'icon')}} {str(it, 'title')} @@ -499,7 +537,10 @@ function Testimonials({ block }: BlockRendererProps) {
    “{str(it, 'quote')}”
    -
    +
    {str(it, 'name')} {str(it, 'city') && ( @@ -523,7 +564,10 @@ function CtaBand({ block }: BlockRendererProps) { const label2 = str(b, 'button2Label') const btnBg = navy ? ACCENT : NAVY return ( -
    +

    -
    +
    +
    {str(b, 'heading') && ( -

    +

    {str(b, 'heading')}

    )} @@ -602,10 +654,15 @@ function ContactSplit({ block }: BlockRendererProps) { {str(b, 'formTitle', 'Send Us a Message')}

    {str(b, 'formIntro') && ( -

    {str(b, 'formIntro')}

    +

    + {str(b, 'formIntro')} +

    )} {sent ? ( -

    +

    Thanks! A real local person will get right back to you.

    ) : ( @@ -616,7 +673,10 @@ function ContactSplit({ block }: BlockRendererProps) { setSent(true) }} > -