create-ailk 0.39.0 → 0.40.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/component-catalog.json +1 -1
- package/component-catalog.md +1 -1
- package/dist/add-route.js +15 -0
- package/dist/body-heading.d.ts +2 -1
- package/dist/body-heading.js +31 -3
- package/dist/module-architecture.js +0 -3
- package/dist/remove-module.js +13 -4
- package/dist/routes.d.ts +7 -0
- package/dist/routes.js +1 -1
- package/dist/site-roster.js +7 -1
- package/dist/surfaces.d.ts +2 -0
- package/dist/surfaces.js +59 -172
- package/package.json +3 -3
- package/templates/apps/web/CLAUDE.md +19 -2
- package/templates/apps/web/__tests__/__mocks__/next-intl-server.ts +3 -2
- package/templates/apps/web/__tests__/__mocks__/next-intl.ts +3 -2
- package/templates/apps/web/app/[locale]/layout.tsx +42 -25
- package/templates/apps/web/app/api/revalidate/__tests__/route.test.ts +56 -1
- package/templates/apps/web/app/api/revalidate/route.ts +45 -4
- package/templates/apps/web/app/llms.txt/__tests__/site-listing.test.ts +53 -0
- package/templates/apps/web/app/llms.txt/route.ts +5 -2
- package/templates/apps/web/i18n/request.ts +5 -1
- package/templates/apps/web/jest.config.cjs +6 -0
- package/templates/apps/web/lib/__tests__/deck-page.test.ts +9 -0
- package/templates/apps/web/lib/__tests__/hub-site-config.test.ts +239 -0
- package/templates/apps/web/lib/__tests__/in-page-magnet-self-request.test.ts +1 -1
- package/templates/apps/web/lib/__tests__/in-page-magnet.test.ts +2 -2
- package/templates/apps/web/lib/__tests__/pricing-page.test.ts +1 -1
- package/templates/apps/web/lib/__tests__/profile-back-link.test.ts +58 -0
- package/templates/apps/web/lib/__tests__/served-pages.test.ts +163 -20
- package/templates/apps/web/lib/__tests__/site-brand.test.ts +77 -0
- package/templates/apps/web/{app/[locale]/contact → lib}/__tests__/site-contact-lines.test.ts +64 -0
- package/templates/apps/web/lib/__tests__/site-identity-feature-list.test.ts +115 -3
- package/templates/apps/web/lib/__tests__/structured-data.test.tsx +17 -4
- package/templates/apps/web/lib/hub-site-config.ts +151 -0
- package/templates/apps/web/lib/in-page-magnet.ts +2 -2
- package/templates/apps/web/lib/pricing-page.ts +3 -3
- package/templates/apps/web/lib/profile-back-link.ts +49 -12
- package/templates/apps/web/lib/served-pages.ts +144 -39
- package/templates/apps/web/lib/site-brand.tsx +66 -0
- package/templates/apps/web/{app/[locale]/contact → lib}/site-contact-email.ts +25 -5
- package/templates/apps/web/{app/[locale]/contact → lib}/site-contact-lines.ts +21 -5
- package/templates/apps/web/lib/site-header.ts +1 -1
- package/templates/apps/web/lib/site-identity.ts +38 -2
- package/templates/apps/web/messages/en.json +3 -119
- package/templates/apps/web/next.config.mjs +7 -0
- package/templates/apps/web/package.json +1 -0
- package/templates/apps/web/site-pages.config.tsx +85 -0
- package/templates/tools/body-heading.ts +30 -3
- package/versions.json +50 -49
- package/templates/apps/web/app/[locale]/(authed)/leads/__tests__/page.test.tsx +0 -205
- package/templates/apps/web/app/[locale]/(authed)/leads/components/LeadsTable.tsx +0 -137
- package/templates/apps/web/app/[locale]/(authed)/leads/page.tsx +0 -122
- package/templates/apps/web/app/[locale]/(authed)/waitlist/components/ForbiddenState.tsx +0 -24
- package/templates/apps/web/app/[locale]/(authed)/waitlist/format.ts +0 -111
- package/templates/apps/web/app/[locale]/[slug]/[detail]/__tests__/page.test.tsx +0 -402
- package/templates/apps/web/app/[locale]/[slug]/[detail]/page.tsx +0 -143
- package/templates/apps/web/app/[locale]/[slug]/__tests__/page.test.tsx +0 -148
- package/templates/apps/web/app/[locale]/[slug]/page.tsx +0 -109
- package/templates/apps/web/app/[locale]/about/[slug]/page.tsx +0 -46
- package/templates/apps/web/app/[locale]/about/__tests__/about-routes.test.tsx +0 -353
- package/templates/apps/web/app/[locale]/about/page.tsx +0 -122
- package/templates/apps/web/app/[locale]/alternatives/__tests__/page.test.tsx +0 -161
- package/templates/apps/web/app/[locale]/alternatives/page.tsx +0 -112
- package/templates/apps/web/app/[locale]/careers/[slug]/[action]/page.tsx +0 -244
- package/templates/apps/web/app/[locale]/careers/[slug]/apply.actions.ts +0 -325
- package/templates/apps/web/app/[locale]/careers/[slug]/job-application-form.ts +0 -120
- package/templates/apps/web/app/[locale]/careers/[slug]/page.tsx +0 -73
- package/templates/apps/web/app/[locale]/careers/__tests__/apply.actions.test.ts +0 -497
- package/templates/apps/web/app/[locale]/careers/__tests__/careers-hub.test.tsx +0 -172
- package/templates/apps/web/app/[locale]/careers/__tests__/careers-set.test.tsx +0 -153
- package/templates/apps/web/app/[locale]/careers/__tests__/job-application-form.test.ts +0 -141
- package/templates/apps/web/app/[locale]/careers/__tests__/job-apply-page.test.tsx +0 -546
- package/templates/apps/web/app/[locale]/careers/__tests__/page-renderer-migration.test.tsx +0 -189
- package/templates/apps/web/app/[locale]/careers/page.tsx +0 -165
- package/templates/apps/web/app/[locale]/case-studies/[slug]/page.tsx +0 -49
- package/templates/apps/web/app/[locale]/case-studies/__tests__/hub-children.test.tsx +0 -65
- package/templates/apps/web/app/[locale]/case-studies/__tests__/page-renderer-migration.test.tsx +0 -125
- package/templates/apps/web/app/[locale]/case-studies/page.tsx +0 -49
- package/templates/apps/web/app/[locale]/clients/__tests__/page-renderer-migration.test.tsx +0 -85
- package/templates/apps/web/app/[locale]/clients/page.tsx +0 -47
- package/templates/apps/web/app/[locale]/contact/ConversationalIntakeWrapper.tsx +0 -249
- package/templates/apps/web/app/[locale]/contact/__tests__/ConversationalIntakeWrapper.test.tsx +0 -400
- package/templates/apps/web/app/[locale]/contact/__tests__/contact-form-magnet.test.ts +0 -138
- package/templates/apps/web/app/[locale]/contact/__tests__/contact-form-text.test.ts +0 -49
- package/templates/apps/web/app/[locale]/contact/__tests__/contact-magnet-page.test.tsx +0 -494
- package/templates/apps/web/app/[locale]/contact/__tests__/contact.actions.test.ts +0 -1122
- package/templates/apps/web/app/[locale]/contact/__tests__/intake-analytics.test.ts +0 -51
- package/templates/apps/web/app/[locale]/contact/__tests__/page-renderer-migration.test.tsx +0 -319
- package/templates/apps/web/app/[locale]/contact/contact-form-magnet.ts +0 -77
- package/templates/apps/web/app/[locale]/contact/contact-form-text.ts +0 -52
- package/templates/apps/web/app/[locale]/contact/contact.actions.ts +0 -403
- package/templates/apps/web/app/[locale]/contact/intake-analytics.ts +0 -49
- package/templates/apps/web/app/[locale]/contact/intake-script.ts +0 -92
- package/templates/apps/web/app/[locale]/contact/page.tsx +0 -267
- package/templates/apps/web/app/[locale]/courses/[slug]/page.tsx +0 -50
- package/templates/apps/web/app/[locale]/courses/__tests__/hub-children.test.tsx +0 -32
- package/templates/apps/web/app/[locale]/courses/__tests__/page-renderer-migration.test.tsx +0 -123
- package/templates/apps/web/app/[locale]/courses/page.tsx +0 -49
- package/templates/apps/web/app/[locale]/events/[slug]/page.tsx +0 -57
- package/templates/apps/web/app/[locale]/events/__tests__/hub-children.test.tsx +0 -32
- package/templates/apps/web/app/[locale]/events/__tests__/page-renderer-migration.test.tsx +0 -164
- package/templates/apps/web/app/[locale]/events/__tests__/program-event.test.tsx +0 -120
- package/templates/apps/web/app/[locale]/events/page.tsx +0 -60
- package/templates/apps/web/app/[locale]/faq/page.tsx +0 -54
- package/templates/apps/web/app/[locale]/features/[slug]/page.tsx +0 -54
- package/templates/apps/web/app/[locale]/features/__tests__/hub-children.test.tsx +0 -32
- package/templates/apps/web/app/[locale]/features/page.tsx +0 -50
- package/templates/apps/web/app/[locale]/for/[slug]/page.tsx +0 -54
- package/templates/apps/web/app/[locale]/for/__tests__/hub-children.test.tsx +0 -32
- package/templates/apps/web/app/[locale]/for/__tests__/page-renderer-migration.test.tsx +0 -90
- package/templates/apps/web/app/[locale]/for/page.tsx +0 -51
- package/templates/apps/web/app/[locale]/glossary/page.tsx +0 -53
- package/templates/apps/web/app/[locale]/how-to/[slug]/page.tsx +0 -50
- package/templates/apps/web/app/[locale]/how-to/__tests__/page-renderer-migration.test.tsx +0 -78
- package/templates/apps/web/app/[locale]/how-to/page.tsx +0 -50
- package/templates/apps/web/app/[locale]/integrations/[slug]/page.tsx +0 -54
- package/templates/apps/web/app/[locale]/integrations/__tests__/hub-children.test.tsx +0 -38
- package/templates/apps/web/app/[locale]/integrations/__tests__/page-renderer-migration.test.tsx +0 -141
- package/templates/apps/web/app/[locale]/integrations/page.tsx +0 -49
- package/templates/apps/web/app/[locale]/launch-service/page.tsx +0 -44
- package/templates/apps/web/app/[locale]/newsletter/__tests__/page.test.tsx +0 -236
- package/templates/apps/web/app/[locale]/newsletter/page.tsx +0 -179
- package/templates/apps/web/app/[locale]/page.tsx +0 -147
- package/templates/apps/web/app/[locale]/partners/[slug]/page.tsx +0 -45
- package/templates/apps/web/app/[locale]/partners/__tests__/hub-children.test.tsx +0 -32
- package/templates/apps/web/app/[locale]/partners/__tests__/page-renderer-migration.test.tsx +0 -125
- package/templates/apps/web/app/[locale]/partners/page.tsx +0 -49
- package/templates/apps/web/app/[locale]/portfolio/[slug]/page.tsx +0 -46
- package/templates/apps/web/app/[locale]/portfolio/__tests__/hub-children.test.tsx +0 -38
- package/templates/apps/web/app/[locale]/portfolio/page.tsx +0 -50
- package/templates/apps/web/app/[locale]/pricing/[slug]/__tests__/page.test.tsx +0 -324
- package/templates/apps/web/app/[locale]/pricing/[slug]/page.tsx +0 -87
- package/templates/apps/web/app/[locale]/pricing/__tests__/__snapshots__/unconnected.test.tsx.snap +0 -7
- package/templates/apps/web/app/[locale]/pricing/__tests__/offerings.test.tsx +0 -605
- package/templates/apps/web/app/[locale]/pricing/__tests__/page.test.tsx +0 -219
- package/templates/apps/web/app/[locale]/pricing/__tests__/pricing-pages.test.tsx +0 -215
- package/templates/apps/web/app/[locale]/pricing/__tests__/unconnected.test.tsx +0 -282
- package/templates/apps/web/app/[locale]/pricing/page.tsx +0 -120
- package/templates/apps/web/app/[locale]/privacy/page.tsx +0 -40
- package/templates/apps/web/app/[locale]/products/[slug]/page.tsx +0 -50
- package/templates/apps/web/app/[locale]/products/__tests__/hub-children.test.tsx +0 -32
- package/templates/apps/web/app/[locale]/products/__tests__/page-renderer-migration.test.tsx +0 -141
- package/templates/apps/web/app/[locale]/products/page.tsx +0 -49
- package/templates/apps/web/app/[locale]/projects/[slug]/page.tsx +0 -37
- package/templates/apps/web/app/[locale]/projects/__tests__/hub-children.test.tsx +0 -32
- package/templates/apps/web/app/[locale]/projects/__tests__/page-renderer-migration.test.tsx +0 -157
- package/templates/apps/web/app/[locale]/projects/page.tsx +0 -49
- package/templates/apps/web/app/[locale]/purchase-policy/page.tsx +0 -49
- package/templates/apps/web/app/[locale]/resources/[slug]/page.tsx +0 -54
- package/templates/apps/web/app/[locale]/resources/__tests__/hub-children.test.tsx +0 -38
- package/templates/apps/web/app/[locale]/resources/__tests__/page-renderer-migration.test.tsx +0 -151
- package/templates/apps/web/app/[locale]/resources/page.tsx +0 -49
- package/templates/apps/web/app/[locale]/services/[slug]/[child]/page.tsx +0 -68
- package/templates/apps/web/app/[locale]/services/[slug]/page.tsx +0 -88
- package/templates/apps/web/app/[locale]/services/__tests__/hub-children.test.tsx +0 -158
- package/templates/apps/web/app/[locale]/services/__tests__/page-renderer-migration.test.tsx +0 -187
- package/templates/apps/web/app/[locale]/services/__tests__/service-detail-sections.test.tsx +0 -224
- package/templates/apps/web/app/[locale]/services/__tests__/service-families.test.tsx +0 -368
- package/templates/apps/web/app/[locale]/services/page.tsx +0 -71
- package/templates/apps/web/app/[locale]/software/[slug]/page.tsx +0 -49
- package/templates/apps/web/app/[locale]/software/__tests__/page-renderer-migration.test.tsx +0 -81
- package/templates/apps/web/app/[locale]/software/page.tsx +0 -49
- package/templates/apps/web/app/[locale]/team/[slug]/page.tsx +0 -45
- package/templates/apps/web/app/[locale]/team/__tests__/hub-children.test.tsx +0 -32
- package/templates/apps/web/app/[locale]/team/__tests__/team-routes.test.tsx +0 -161
- package/templates/apps/web/app/[locale]/team/page.tsx +0 -50
- package/templates/apps/web/app/[locale]/tech-articles/[slug]/page.tsx +0 -54
- package/templates/apps/web/app/[locale]/tech-articles/__tests__/page-renderer-migration.test.tsx +0 -82
- package/templates/apps/web/app/[locale]/tech-articles/page.tsx +0 -49
- package/templates/apps/web/app/[locale]/templates/[slug]/__tests__/page.test.tsx +0 -203
- package/templates/apps/web/app/[locale]/templates/[slug]/page.tsx +0 -81
- package/templates/apps/web/app/[locale]/templates/__tests__/page.test.tsx +0 -237
- package/templates/apps/web/app/[locale]/templates/page.tsx +0 -114
- package/templates/apps/web/app/[locale]/terms/page.tsx +0 -40
- package/templates/apps/web/app/[locale]/testimonials/__tests__/page-renderer-migration.test.tsx +0 -85
- package/templates/apps/web/app/[locale]/testimonials/page.tsx +0 -51
- package/templates/apps/web/app/[locale]/thanks/[slug]/__tests__/page.test.tsx +0 -136
- package/templates/apps/web/app/[locale]/thanks/[slug]/page.tsx +0 -39
- package/templates/apps/web/app/[locale]/unsubscribe/__tests__/unsubscribe-rsc-boundary.test.tsx +0 -226
- package/templates/apps/web/app/[locale]/unsubscribe/__tests__/unsubscribe.test.tsx +0 -217
- package/templates/apps/web/app/[locale]/unsubscribe/page.tsx +0 -106
- package/templates/apps/web/app/[locale]/unsubscribe/unsubscribe-button.tsx +0 -94
- package/templates/apps/web/app/[locale]/unsubscribe/unsubscribe.actions.ts +0 -55
- package/templates/apps/web/app/[locale]/vs/[slug]/__tests__/page.test.tsx +0 -100
- package/templates/apps/web/app/[locale]/vs/[slug]/page.tsx +0 -60
- package/templates/apps/web/app/[locale]/whitepapers/[slug]/page.tsx +0 -54
- package/templates/apps/web/app/[locale]/whitepapers/__tests__/page-renderer-migration.test.tsx +0 -82
- package/templates/apps/web/app/[locale]/whitepapers/page.tsx +0 -49
- package/templates/apps/web/app/[locale]/working-agreement/__tests__/page.test.tsx +0 -63
- package/templates/apps/web/app/[locale]/working-agreement/page.tsx +0 -41
- package/templates/apps/web/lib/__tests__/hub-children.fixtures.ts +0 -279
- package/templates/apps/web/lib/__tests__/route-family.test.ts +0 -57
- package/templates/apps/web/lib/__tests__/service-listing.test.ts +0 -111
- package/templates/apps/web/lib/__tests__/template-listing.test.ts +0 -158
- package/templates/apps/web/lib/hub-children.tsx +0 -351
- package/templates/apps/web/lib/meet-placeholder.ts +0 -5
- package/templates/apps/web/lib/posting-title.ts +0 -39
- package/templates/apps/web/lib/route-family.ts +0 -69
- package/templates/apps/web/lib/service-listing.ts +0 -89
- package/templates/apps/web/lib/template-listing.ts +0 -169
- package/templates/apps/web/src/lib/__tests__/lead-write.test.ts +0 -187
- package/templates/apps/web/src/lib/lead-write.ts +0 -90
|
@@ -66,6 +66,10 @@ Don't ship a page after one render. The expected per-page loop:
|
|
|
66
66
|
- Fix mismatches. Be specific in self-review: "heading is 32px, reference shows 24px", not "looks off."
|
|
67
67
|
- Repeat until no visible differences and no responsive issues at any of the four breakpoints.
|
|
68
68
|
|
|
69
|
+
## Where the base pages live
|
|
70
|
+
|
|
71
|
+
**The base website's pages ship in `@working-theory/site-pages` (#11259, ADR 0040 phase 4).** The home page and the 62 pages under the 38 base directories (`[slug]`, `about`, … `working-agreement`, `(authed)/leads`) — with the actions, loaders and libs only they read (`hub-children`, `route-family`, `service-listing`, `template-listing`, `meet-placeholder`, `posting-title`, `lead-write`) and their tests — live in `packages/site-pages/src/{pages,lib}/`, at the paths they had here. This app's `app/[locale]/` holds only the 63 route files `create-ailk routes --write` generates from the package's `routes.json` — never hand-edited, pinned by `routes --check` — plus the module pages still under those directories (`careers/apply`, `careers/[slug]/apply`, `projects/apply`) and `contact/error.tsx`. The package reads the site through one typed file, `site-pages.config.tsx`, whose `site` export answers the `@working-theory/site-pages/site` seam (`next.config.mjs` and `jest.config.cjs` alias it); no page takes a customization option. The ten namespaces those pages read ship in the package (`sitePagesMessages`), merged under this app's catalog by `i18n/request.ts`; a key in `messages/en.json` is an override. `lib/site-contact-email.ts` and `lib/site-contact-lines.ts` (the `_site.mdx` readers the layout and the module pages share) stay the site's. The sections below name the pages by their old `app/[locale]/` place.
|
|
72
|
+
|
|
69
73
|
## The `(auth)` route group — which predicate an affordance keys on
|
|
70
74
|
|
|
71
75
|
**Where it lives (#11257, ADR 0040 phase 2).** The `(auth)` pages and their
|
|
@@ -749,7 +753,16 @@ A list page whose frontmatter sets `navOnly: true` (valid on a registry list typ
|
|
|
749
753
|
- **The seven handlers.** `robots.txt`, `sitemap.xml`, `llms.txt` (both copies — the docs + blog module's `lib/slices/docs-blog/llms-route.ts` too), `.well-known/mcp.json`, `.well-known/ai-plugin.json` and `openapi.json` are `force-dynamic` and read it once per request, after the checks each already makes and before any other work. `createSitemapHandler` and `createLlmsHandler` take a `discoverable` dep (default `siteDiscoverable`); every test caller passes one, so no suite reads a hub.
|
|
750
754
|
- **On** is today, byte for byte. **Off**: robots.txt answers STEALTH's `User-agent: *` / `Disallow: /` with no Sitemap line; the other five answer 404 with no body (mcp.json keeps its CORS headers; its `OPTIONS` is unchanged). Every off answer is `cache-control: no-store`, so a crawler asks again.
|
|
751
755
|
- **Hidden wins.** With `STEALTH` on, or no public page (`PUBLIC_PAGES` false), robots.txt answers as before and makes no read; sitemap.xml and llms.txt 404 before it.
|
|
752
|
-
- **Pages are never hidden.** No page, layout or `middleware.ts` reads the switch, and
|
|
756
|
+
- **Pages are never hidden.** No page, layout or `middleware.ts` reads the switch, and only `STEALTH` sets `X-Robots-Tag`: off is a preference about discovery, not access control. `<meta robots>` has two writers: `STEALTH` (`noindex, nofollow`, which always wins), and on a hub-connected site the workspace's Allow search indexing (`seo.robots.index: false` → the layout's `noindex, follow`, § A hub-connected site's identity). `STEALTH` remains the hard, deploy-time hide.
|
|
757
|
+
|
|
758
|
+
## A hub-connected site's identity
|
|
759
|
+
|
|
760
|
+
**A site connected to its hub reads its name, description, legal name, contact, sameAs and indexing switch from the hub (#11456).** Hub-connected means `CONTENT_ADAPTER=database` (the switch `resolveBlogSource` uses) and a spoke key on the wire (`sendsSpokeKey()`); `lib/hub-site-config.ts`'s `readHubSite()` then reads `GET /v1/content/site-config` through `siteConfig.get()` — the key's own workspace's identity and seo rows, 401 to any other caller — cached by `unstable_cache` under `siteConfigTag()` for at most 300 s. Any other site makes no call and renders from `_site.mdx` exactly as before.
|
|
761
|
+
|
|
762
|
+
- **Who reads it.** `resolveSiteBrand()` (`lib/site-brand.tsx`) gives the locale layout's title, description, og/twitter copy, Nav/Footer `siteName` and copyright holder, and both llms.txt headings; `lib/site-identity.ts` registers a JSON-LD reader (`setSiteIdentityReader`) whose registration keeps the file's `baseUrl`, so no hub value moves an `@id`; the contact email and the closing footer's contact lines read the value the last read resolved (`heldHubSite()`), because their seam is synchronous. `SITE_NAME`'s other readers (og image, icons, auth, mcp.json, ai-plugin.json) keep the file value.
|
|
763
|
+
- **A hub row is the whole identity.** A field the operator cleared is absent, never refilled from the file; only a missing row, an unreadable one or a failed read falls back to `_site.mdx`. The file's top-level `contactEmail` stays the contact email's fallback. Hub values are collapsed to one line.
|
|
764
|
+
- **A save shows without a redeploy.** A 200 PUT of `identity` or `seo` sends the signed `site-config` revalidate event (`notifySiteConfigRevalidate`) to the site and its spokes; `app/api/revalidate/route.ts` answers it by purging `siteConfigTag()`. The 300 s expiry is the net for a spoke with no `revalidateUrl`.
|
|
765
|
+
- **A hub outage never breaks a page**: a failed read writes no cache entry and serves the instance's last good value, else the file. The indexing switch fails open.
|
|
753
766
|
|
|
754
767
|
## AEO & performance
|
|
755
768
|
|
|
@@ -767,7 +780,11 @@ A list page whose frontmatter sets `navOnly: true` (valid on a registry list typ
|
|
|
767
780
|
- Don't reach into `apps/api` or `apps/mcp` from `apps/web`. They're peer apps — talk via HTTP/MCP.
|
|
768
781
|
- Don't commit images to `screenshots/` — only the `.gitkeep` is tracked.
|
|
769
782
|
|
|
770
|
-
Last updated: 2026-11-
|
|
783
|
+
Last updated: 2026-11-11 — § A hub-connected site's identity: the hub read, the brand, JSON-LD reader and contact readers that take it, the `site-config` revalidate event, and `<meta robots>`'s second writer (#11456) — verified against `lib/{hub-site-config.ts,site-brand.tsx,site-identity.ts,site-contact-email.ts,site-contact-lines.ts}`, `app/[locale]/layout.tsx`, `app/llms.txt/route.ts` and `app/api/revalidate/route.ts`.
|
|
784
|
+
|
|
785
|
+
Prior: 2026-11-11 — § Where the base pages live: the 63 base pages, their actions, loaders and libs ship in `@working-theory/site-pages`, this app holds their generated route files and `site-pages.config.tsx`, and the ten namespaces ship in the package (#11259) — verified against `packages/site-pages/{routes.json,src/site.ts,src/index.ts}`, `site-pages.config.tsx` and `i18n/request.ts`.
|
|
786
|
+
|
|
787
|
+
Prior: 2026-11-10 — § The `(auth)` route group: sign-in, the hub session and the auth routes ship in `@working-theory/auth`, this app holds their 25 generated route files and `auth.config.tsx`, Better Auth reaches the package through `loadAuth()`, and the middleware's auth half is the package's edge entry (#11257) — verified against `packages/auth/{routes.json,src/site.ts,src/edge.ts}`, `auth.config.tsx`, `middleware.ts`, `lib/topology.generated.ts` and `i18n/request.ts`.
|
|
771
788
|
|
|
772
789
|
Prior: 2026-11-10 — § Where the docs live: the docs and blog pages and their loaders ship in `@working-theory/ui-docs-blog`, this app holds their two generated route files and `docs-blog.config.tsx`, and the `docs` and `blog` strings ship in the package (#11254) — verified against `packages-paid/ui-docs-blog/{routes.json,src/config.ts,src/pages/}`, `docs-blog.config.tsx`, `lib/source.ts` and `i18n/request.ts`.
|
|
773
790
|
|
|
@@ -16,12 +16,13 @@
|
|
|
16
16
|
// "next-intl/server", …)` overrides still work — jest resolves the specifier
|
|
17
17
|
// through the mapper first, so the override and the consumer agree.
|
|
18
18
|
import authMsgs from "@working-theory/auth/messages/en";
|
|
19
|
+
import sitePagesMsgs from "@working-theory/site-pages/messages/en";
|
|
19
20
|
|
|
20
21
|
import msgs from "../../messages/en.json";
|
|
21
22
|
|
|
22
23
|
// The sign-in package's catalog is merged under this site's, as
|
|
23
|
-
// `i18n/request.ts` merges it (#11257 D12).
|
|
24
|
-
const catalog = { ...authMsgs, ...msgs } as unknown as Record<string, Record<string, string>>;
|
|
24
|
+
// `i18n/request.ts` merges it (#11257 D12), and the base pages' (#11259 D7).
|
|
25
|
+
const catalog = { ...sitePagesMsgs, ...authMsgs, ...msgs } as unknown as Record<string, Record<string, string>>;
|
|
25
26
|
|
|
26
27
|
// Handles both call forms used in apps/web routes:
|
|
27
28
|
// getTranslations("namespace") — pre-migration routes
|
|
@@ -2,12 +2,13 @@
|
|
|
2
2
|
// Mapped rather than only `jest.mock()`d for the same reason as
|
|
3
3
|
// ./next-intl-server.ts — see that file's header.
|
|
4
4
|
import authMsgs from "@working-theory/auth/messages/en";
|
|
5
|
+
import sitePagesMsgs from "@working-theory/site-pages/messages/en";
|
|
5
6
|
|
|
6
7
|
import msgs from "../../messages/en.json";
|
|
7
8
|
|
|
8
9
|
// The sign-in package's catalog is merged under this site's, as
|
|
9
|
-
// `i18n/request.ts` merges it (#11257 D12).
|
|
10
|
-
const catalog = { ...authMsgs, ...msgs } as unknown as Record<string, Record<string, string>>;
|
|
10
|
+
// `i18n/request.ts` merges it (#11257 D12), and the base pages' (#11259 D7).
|
|
11
|
+
const catalog = { ...sitePagesMsgs, ...authMsgs, ...msgs } as unknown as Record<string, Record<string, string>>;
|
|
11
12
|
|
|
12
13
|
export const useTranslations =
|
|
13
14
|
(namespace: string) =>
|
|
@@ -99,6 +99,7 @@ import {
|
|
|
99
99
|
routeFamilyOf,
|
|
100
100
|
} from "../../lib/page-chrome";
|
|
101
101
|
import {
|
|
102
|
+
ancestorPaths,
|
|
102
103
|
backLinkName,
|
|
103
104
|
navLabelsByPath,
|
|
104
105
|
parentHref,
|
|
@@ -109,12 +110,7 @@ import {
|
|
|
109
110
|
withPublicServicesColumns,
|
|
110
111
|
withPublicServicesPaths,
|
|
111
112
|
} from "../../lib/services-path";
|
|
112
|
-
import {
|
|
113
|
-
COPYRIGHT_HOLDER,
|
|
114
|
-
SITE_DESCRIPTION,
|
|
115
|
-
SITE_NAME,
|
|
116
|
-
resolveContentRoot,
|
|
117
|
-
} from "../../lib/site-brand";
|
|
113
|
+
import { resolveContentRoot, resolveSiteBrand } from "../../lib/site-brand";
|
|
118
114
|
import { siteChrome, type SiteChrome } from "../../lib/site-chrome";
|
|
119
115
|
import {
|
|
120
116
|
ACCOUNT_LABEL_KEY,
|
|
@@ -141,7 +137,8 @@ import {
|
|
|
141
137
|
import { pagePathFor, resolveBaseUrl } from "../../src/lib/routes";
|
|
142
138
|
|
|
143
139
|
import { ConsentBanner } from "./consent-banner";
|
|
144
|
-
|
|
140
|
+
|
|
141
|
+
import { readSiteContactLines } from "../../lib/site-contact-lines";
|
|
145
142
|
|
|
146
143
|
/**
|
|
147
144
|
* The generated `siteChrome`, read through a widened type (#7740 D8): a
|
|
@@ -279,6 +276,8 @@ const FLASH_PREVENTION_SCRIPT = `(function(){
|
|
|
279
276
|
// ── Metadata ─────────────────────────────────────────────────────────────────
|
|
280
277
|
|
|
281
278
|
export async function generateMetadata(): Promise<Metadata> {
|
|
279
|
+
// #11456 D4 — the hub's brand on a hub-connected site, else `_site.mdx`'s.
|
|
280
|
+
const brand = await resolveSiteBrand();
|
|
282
281
|
const headerStore = await headers();
|
|
283
282
|
const pathname = headerStore.get("x-pathname") ?? "/";
|
|
284
283
|
|
|
@@ -286,7 +285,7 @@ export async function generateMetadata(): Promise<Metadata> {
|
|
|
286
285
|
const baseUrl = resolveBaseUrl();
|
|
287
286
|
// #11244 — absolute: no layout sets `metadataBase`, so a relative og:image
|
|
288
287
|
// reached crawlers as a path they could not fetch.
|
|
289
|
-
const ogImageUrl = `${baseUrl.replace(/\/+$/, "")}${getOgImageUrl({ title:
|
|
288
|
+
const ogImageUrl = `${baseUrl.replace(/\/+$/, "")}${getOgImageUrl({ title: brand.siteName, schemaType: "WebSite" })}`;
|
|
290
289
|
const languages = buildHreflangAlternates(
|
|
291
290
|
pathname,
|
|
292
291
|
locales,
|
|
@@ -297,23 +296,31 @@ export async function generateMetadata(): Promise<Metadata> {
|
|
|
297
296
|
// none of its own: the request's own URL, never the home page's.
|
|
298
297
|
const requestUrl = pathname === "/" ? baseUrl : `${baseUrl}${pathname}`;
|
|
299
298
|
|
|
299
|
+
// #11456 D6 — `STEALTH` wins; otherwise the hub's Allow search indexing
|
|
300
|
+
// off answers `noindex, follow` on every page that sets no robots of its own.
|
|
301
|
+
const stealthRobots = getStealthRobots();
|
|
302
|
+
|
|
300
303
|
return {
|
|
301
|
-
title:
|
|
302
|
-
description:
|
|
304
|
+
title: brand.siteName,
|
|
305
|
+
description: brand.description,
|
|
303
306
|
openGraph: {
|
|
304
|
-
title:
|
|
305
|
-
description:
|
|
307
|
+
title: brand.siteName,
|
|
308
|
+
description: brand.description,
|
|
306
309
|
type: "website",
|
|
307
310
|
url: requestUrl,
|
|
308
311
|
images: [ogImageUrl],
|
|
309
312
|
},
|
|
310
313
|
twitter: {
|
|
311
314
|
card: "summary_large_image",
|
|
312
|
-
title:
|
|
313
|
-
description:
|
|
315
|
+
title: brand.siteName,
|
|
316
|
+
description: brand.description,
|
|
314
317
|
images: [ogImageUrl],
|
|
315
318
|
},
|
|
316
|
-
...
|
|
319
|
+
...("robots" in stealthRobots
|
|
320
|
+
? stealthRobots
|
|
321
|
+
: brand.indexable
|
|
322
|
+
? {}
|
|
323
|
+
: { robots: { index: false, follow: true } }),
|
|
317
324
|
alternates: {
|
|
318
325
|
canonical: requestUrl,
|
|
319
326
|
languages,
|
|
@@ -376,6 +383,9 @@ export default async function LocaleLayout({
|
|
|
376
383
|
if (moved !== null)
|
|
377
384
|
permanentRedirect(localeHref(locale, moved, DEFAULT_LOCALE));
|
|
378
385
|
const messages = await getMessages();
|
|
386
|
+
// #11456 D4 — awaited before `readSiteContactLines`, so the held hub value
|
|
387
|
+
// the contact lines read is this render's.
|
|
388
|
+
const brand = await resolveSiteBrand();
|
|
379
389
|
// #7742 D2 — `colorMode: "light"` pins the mode: a saved dark cookie is
|
|
380
390
|
// ignored, no flash script runs and no theme switch renders.
|
|
381
391
|
const pinLight = chrome.colorMode === "light";
|
|
@@ -584,7 +594,7 @@ export default async function LocaleLayout({
|
|
|
584
594
|
const brandWordmark = {
|
|
585
595
|
src: "/wordmark.svg",
|
|
586
596
|
darkSrc: "/wordmark-light.svg",
|
|
587
|
-
alt:
|
|
597
|
+
alt: brand.siteName,
|
|
588
598
|
width: 140,
|
|
589
599
|
height: 16,
|
|
590
600
|
};
|
|
@@ -676,7 +686,7 @@ export default async function LocaleLayout({
|
|
|
676
686
|
// snap an unpinned bar scrolls away with slide 1 (#5697). It keeps its
|
|
677
687
|
// own actions, mark and bar style — only `sticky` is added.
|
|
678
688
|
...(isDeckPage ? { sticky: true } : {}),
|
|
679
|
-
siteName:
|
|
689
|
+
siteName: brand.siteName,
|
|
680
690
|
frame: "contained",
|
|
681
691
|
navAlignment: "right",
|
|
682
692
|
showThemeToggle: false,
|
|
@@ -717,7 +727,7 @@ export default async function LocaleLayout({
|
|
|
717
727
|
}));
|
|
718
728
|
|
|
719
729
|
// The bare header's back arrow (operator handoff 2026-11-09): the page's
|
|
720
|
-
// served parent — a content page, a
|
|
730
|
+
// served parent — a content page, a page route the app builds or a nav entry —
|
|
721
731
|
// named in its label; home when no ancestor is served. Read only where
|
|
722
732
|
// the arrow renders. A slide-left arrival is rewritten client-side by
|
|
723
733
|
// NavBackLink (#8644).
|
|
@@ -725,7 +735,7 @@ export default async function LocaleLayout({
|
|
|
725
735
|
// name follows the href NavBackLink resolves to.
|
|
726
736
|
let bareBackLink: { href: string; label: string; returnLabel: string } | undefined;
|
|
727
737
|
if (!isHome && pageChrome.header === "bare") {
|
|
728
|
-
const titles = await servedPages(locale);
|
|
738
|
+
const titles = await servedPages(locale, ancestorPaths(pathname, enabledLocales));
|
|
729
739
|
const navPathLabels = navLabelsByPath([publicNavItems, footerColumnDefs], labelFor);
|
|
730
740
|
const served = (path: string): boolean => titles.has(path) || navPathLabels.has(path);
|
|
731
741
|
const parent = servedParent({ pathname, locales: enabledLocales, served });
|
|
@@ -734,15 +744,22 @@ export default async function LocaleLayout({
|
|
|
734
744
|
label:
|
|
735
745
|
parent === null
|
|
736
746
|
? tNav("home")
|
|
737
|
-
: tNav("backTo", {
|
|
747
|
+
: tNav("backTo", {
|
|
748
|
+
name: backLinkName(parent, {
|
|
749
|
+
navLabels: navPathLabels,
|
|
750
|
+
titles,
|
|
751
|
+
siteName: brand.siteName,
|
|
752
|
+
}),
|
|
753
|
+
}),
|
|
738
754
|
returnLabel: tNav("home"),
|
|
739
755
|
};
|
|
740
756
|
}
|
|
741
757
|
|
|
742
|
-
// The site's own name (#6942) —
|
|
743
|
-
// `siteName
|
|
744
|
-
//
|
|
745
|
-
|
|
758
|
+
// The site's own name (#6942) — the brand's name resolves from `_site.mdx`'s
|
|
759
|
+
// `siteName:` (or the hub's identity, #11456), so a customer's footer never
|
|
760
|
+
// carries the kit vendor's name. The holder is the identity's `legalName`
|
|
761
|
+
// when declared (#7796), else the name.
|
|
762
|
+
const copyrightText = `© ${new Date().getFullYear()} ${brand.copyrightHolder}. All rights reserved.`;
|
|
746
763
|
|
|
747
764
|
// Footer legal links (#5612 D3). The centered variant folds in FAQ — the
|
|
748
765
|
// roster's third always-scaffolded core route (`/faq`, alongside `/privacy`
|
|
@@ -974,7 +991,7 @@ export default async function LocaleLayout({
|
|
|
974
991
|
itemLabels={navLabels.items}
|
|
975
992
|
navItems={publicNavItems}
|
|
976
993
|
columns={footerColumnDefs}
|
|
977
|
-
siteName={
|
|
994
|
+
siteName={brand.siteName}
|
|
978
995
|
logo={brandLogo}
|
|
979
996
|
wordmark={brandWordmark}
|
|
980
997
|
social={[...socialLinks]}
|
|
@@ -50,7 +50,11 @@ import { createHmac } from "node:crypto";
|
|
|
50
50
|
import { readFileSync } from "node:fs";
|
|
51
51
|
import { join } from "node:path";
|
|
52
52
|
|
|
53
|
-
import {
|
|
53
|
+
import {
|
|
54
|
+
contentListTag,
|
|
55
|
+
contentPageTag,
|
|
56
|
+
siteConfigTag,
|
|
57
|
+
} from "@working-theory/page-renderer";
|
|
54
58
|
import { revalidateTag } from "next/cache";
|
|
55
59
|
import * as ts from "typescript";
|
|
56
60
|
|
|
@@ -538,6 +542,57 @@ describe("POST /api/revalidate", () => {
|
|
|
538
542
|
|
|
539
543
|
// --- #5902: replay window, signed event, bounded fields ------------------
|
|
540
544
|
|
|
545
|
+
describe("#11456 D5, AC-3 — the site-config event purges the hub-read tag", () => {
|
|
546
|
+
const SITE_CONFIG_BODY = { workspaceId: "wksp_fixture" };
|
|
547
|
+
|
|
548
|
+
it("a correctly signed site-config delivery purges siteConfigTag() with { expire: 0 } and no content tag", async () => {
|
|
549
|
+
const response = await POST(signedRequest(SITE_CONFIG_BODY, SECRET, "site-config"));
|
|
550
|
+
|
|
551
|
+
expect(response.status).toBe(200);
|
|
552
|
+
await expect(response.json()).resolves.toEqual({ revalidated: true });
|
|
553
|
+
expect(mockRevalidateTag).toHaveBeenCalledTimes(1);
|
|
554
|
+
expect(mockRevalidateTag).toHaveBeenCalledWith(siteConfigTag(), { expire: 0 });
|
|
555
|
+
expect(siteConfigTag()).toBe("site-config:default");
|
|
556
|
+
const info = (console.info as jest.Mock).mock.calls[0][0] as string;
|
|
557
|
+
expect(info).toContain('"event":"site-config"');
|
|
558
|
+
expect(info).toContain('"workspaceId":"wksp_fixture"');
|
|
559
|
+
});
|
|
560
|
+
|
|
561
|
+
it.each([
|
|
562
|
+
["a type key", { workspaceId: "wksp_fixture", type: "Service" }],
|
|
563
|
+
["the publish body", VALID_BODY],
|
|
564
|
+
["no workspaceId", {}],
|
|
565
|
+
["a non-string workspaceId", { workspaceId: 7 }],
|
|
566
|
+
["a workspaceId over 64 characters", { workspaceId: "w".repeat(65) }],
|
|
567
|
+
])("a correctly signed site-config body with %s is 400", async (_label, body) => {
|
|
568
|
+
const response = await POST(signedRequest(body, SECRET, "site-config"));
|
|
569
|
+
expect(response.status).toBe(400);
|
|
570
|
+
await expect(response.json()).resolves.toEqual({ error: "invalid_body" });
|
|
571
|
+
expect(mockRevalidateTag).not.toHaveBeenCalled();
|
|
572
|
+
});
|
|
573
|
+
|
|
574
|
+
it("a site-config delivery with a bad signature is 401", async () => {
|
|
575
|
+
const response = await POST(signedRequest(SITE_CONFIG_BODY, WRONG_SECRET, "site-config"));
|
|
576
|
+
expect(response.status).toBe(401);
|
|
577
|
+
expect(mockRevalidateTag).not.toHaveBeenCalled();
|
|
578
|
+
});
|
|
579
|
+
|
|
580
|
+
it("a site-config body signed as publish is not a site-config purge", async () => {
|
|
581
|
+
const rawBody = JSON.stringify(SITE_CONFIG_BODY);
|
|
582
|
+
const timestamp = String(nowSeconds());
|
|
583
|
+
const response = await POST(
|
|
584
|
+
makeRequest({
|
|
585
|
+
rawBody,
|
|
586
|
+
signature: sign(rawBody, SECRET, timestamp, "publish"),
|
|
587
|
+
event: "site-config",
|
|
588
|
+
timestamp,
|
|
589
|
+
}),
|
|
590
|
+
);
|
|
591
|
+
expect(response.status).toBe(401);
|
|
592
|
+
expect(mockRevalidateTag).not.toHaveBeenCalled();
|
|
593
|
+
});
|
|
594
|
+
});
|
|
595
|
+
|
|
541
596
|
describe("#5902 — the timestamp and event are signed, and the fields are bounded", () => {
|
|
542
597
|
it("accepts a timestamp just inside the 5-minute tolerance, either side", async () => {
|
|
543
598
|
for (const offset of [-(TOLERANCE_SECONDS - 5), TOLERANCE_SECONDS - 5]) {
|
|
@@ -11,9 +11,10 @@
|
|
|
11
11
|
* apps/api (ADR 0002, headless-first).
|
|
12
12
|
*
|
|
13
13
|
* The wire contract is #5851's as amended by #5902 (its spec's D1/D2): POST;
|
|
14
|
-
* body the four-key JSON { workspaceId, type, slug, locale }
|
|
14
|
+
* body the four-key JSON { workspaceId, type, slug, locale } (the one-key
|
|
15
|
+
* { workspaceId } for `site-config`, below); headers
|
|
15
16
|
* `x-ailk-revalidate-timestamp: <unix seconds>`,
|
|
16
|
-
* `x-ailk-revalidate-event: publish | unpublish` and
|
|
17
|
+
* `x-ailk-revalidate-event: publish | unpublish | site-config` and
|
|
17
18
|
* `x-ailk-revalidate-signature: sha256=<lowercase hex>` — HMAC-SHA256 over
|
|
18
19
|
* `v0:{timestamp}:{event}:{rawBody}`.
|
|
19
20
|
*
|
|
@@ -40,6 +41,15 @@
|
|
|
40
41
|
* can forge another page's tag. A page tag over Next's 256-character limit is
|
|
41
42
|
* a 400 too — the read path cannot cache under such a tag either.
|
|
42
43
|
*
|
|
44
|
+
* THE SITE-CONFIG EVENT (#11456, spec
|
|
45
|
+
* docs/specs/11456-a-hub-connected-site-reads-spec.md D5) — a third signed
|
|
46
|
+
* event, sent after the workspace's identity or seo is saved. Same headers
|
|
47
|
+
* and base string; the body is exactly `{ workspaceId }` (a string of at most
|
|
48
|
+
* 64 characters, no other key — else 400). It purges `siteConfigTag()`, the
|
|
49
|
+
* tag `lib/hub-site-config.ts` caches the hub read under, and no content tag.
|
|
50
|
+
* `workspaceId` is logged, never compared or tagged: the signing secret
|
|
51
|
+
* already names the site.
|
|
52
|
+
*
|
|
43
53
|
* PII / secret boundary (FR9): no log line carries the secret, the signature
|
|
44
54
|
* header value, the request body, or page content.
|
|
45
55
|
*/
|
|
@@ -49,7 +59,11 @@ import {
|
|
|
49
59
|
SCHEMA_ORG_TYPES,
|
|
50
60
|
SLUG_PATTERN,
|
|
51
61
|
} from "@working-theory/content-adapters";
|
|
52
|
-
import {
|
|
62
|
+
import {
|
|
63
|
+
contentListTag,
|
|
64
|
+
contentPageTag,
|
|
65
|
+
siteConfigTag,
|
|
66
|
+
} from "@working-theory/page-renderer";
|
|
53
67
|
import { localeSchema } from "@working-theory/validation";
|
|
54
68
|
import { revalidateTag } from "next/cache";
|
|
55
69
|
import { z } from "zod";
|
|
@@ -77,6 +91,11 @@ const bodySchema = z.object({
|
|
|
77
91
|
locale: localeSchema,
|
|
78
92
|
});
|
|
79
93
|
|
|
94
|
+
/** The `site-config` event's body (#11456 D5): its one key, bounded, nothing else. */
|
|
95
|
+
const siteConfigBodySchema = z
|
|
96
|
+
.object({ workspaceId: z.string().max(64) })
|
|
97
|
+
.strict();
|
|
98
|
+
|
|
80
99
|
/** next@16.3.3 `NEXT_CACHE_TAG_MAX_LENGTH` (dist/lib/constants.js). */
|
|
81
100
|
const CACHE_TAG_MAX_LENGTH = 256;
|
|
82
101
|
|
|
@@ -148,7 +167,11 @@ export async function POST(request: Request): Promise<Response> {
|
|
|
148
167
|
|
|
149
168
|
const rawEvent = request.headers.get(EVENT_HEADER);
|
|
150
169
|
const event =
|
|
151
|
-
rawEvent === "publish" ||
|
|
170
|
+
rawEvent === "publish" ||
|
|
171
|
+
rawEvent === "unpublish" ||
|
|
172
|
+
rawEvent === "site-config"
|
|
173
|
+
? rawEvent
|
|
174
|
+
: "unknown";
|
|
152
175
|
|
|
153
176
|
/**
|
|
154
177
|
* The one place a line is emitted (FR8), so the `[revalidate]` prefix, the
|
|
@@ -197,6 +220,24 @@ export async function POST(request: Request): Promise<Response> {
|
|
|
197
220
|
return Response.json({ error: "invalid_signature" }, { status: 401 });
|
|
198
221
|
}
|
|
199
222
|
|
|
223
|
+
if (event === "site-config") {
|
|
224
|
+
let parsed: unknown;
|
|
225
|
+
try {
|
|
226
|
+
parsed = JSON.parse(rawBody);
|
|
227
|
+
} catch {
|
|
228
|
+
parsed = undefined;
|
|
229
|
+
}
|
|
230
|
+
const siteConfig = siteConfigBodySchema.safeParse(parsed);
|
|
231
|
+
if (!siteConfig.success) {
|
|
232
|
+
log("warn", { status: 400 });
|
|
233
|
+
return Response.json({ error: "invalid_body" }, { status: 400 });
|
|
234
|
+
}
|
|
235
|
+
// The tag `lib/hub-site-config.ts` reads under — one builder, one process.
|
|
236
|
+
revalidateTag(siteConfigTag(), { expire: 0 });
|
|
237
|
+
log("info", { status: 200, workspaceId: siteConfig.data.workspaceId });
|
|
238
|
+
return Response.json({ revalidated: true }, { status: 200 });
|
|
239
|
+
}
|
|
240
|
+
|
|
200
241
|
const body = parseBody(rawBody);
|
|
201
242
|
if (body === null) {
|
|
202
243
|
log("warn", { status: 400 });
|
|
@@ -33,6 +33,17 @@ jest.mock("../../../lib/modules.generated", () => ({
|
|
|
33
33
|
// eslint-disable-next-line no-restricted-syntax -- #507: a per-site generated or site-owned file; this suite pins the value it tests (#11246)
|
|
34
34
|
jest.mock("../../../lib/site-listing", () => ({ __esModule: true, SITE_LISTING: {} }));
|
|
35
35
|
|
|
36
|
+
// #11456 — the hub read's HTTP call; the rest of the client stays real, so
|
|
37
|
+
// `sendsSpokeKey` reads the env. `next/cache` runs the read uncached.
|
|
38
|
+
const mockSiteConfigGet = jest.fn();
|
|
39
|
+
jest.mock("@working-theory/api-client", () => ({
|
|
40
|
+
...jest.requireActual("@working-theory/api-client"),
|
|
41
|
+
siteConfig: { get: (...args: unknown[]) => mockSiteConfigGet(...args) },
|
|
42
|
+
}));
|
|
43
|
+
jest.mock("next/cache", () => ({
|
|
44
|
+
unstable_cache: (fn: () => Promise<unknown>) => fn,
|
|
45
|
+
}));
|
|
46
|
+
|
|
36
47
|
type Route = typeof import("../route");
|
|
37
48
|
|
|
38
49
|
const BASE = "https://example.com";
|
|
@@ -130,3 +141,45 @@ describe.each(ROUTES)("GET /llms.txt (%s) — the site listing (#10940)", (path)
|
|
|
130
141
|
expect(text).not.toContain("/thanks/projects-approved");
|
|
131
142
|
});
|
|
132
143
|
});
|
|
144
|
+
|
|
145
|
+
describe("the llms.txt heading — a hub-connected site's name (#11456 D4, AC-2)", () => {
|
|
146
|
+
const KEY = "ailk_spk_TESTKEYxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
|
|
147
|
+
const identity = (name: string) => ({
|
|
148
|
+
ok: true,
|
|
149
|
+
body: { identity: { kind: "Organization", name, url: "https://elsewhere.example" }, seo: null },
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
beforeEach(() => {
|
|
153
|
+
process.env.CONTENT_ADAPTER = "database";
|
|
154
|
+
process.env.NEXT_PUBLIC_BASE_URL = BASE;
|
|
155
|
+
process.env.AILK_API_URL = "https://hub.example";
|
|
156
|
+
mockSiteConfigGet.mockReset();
|
|
157
|
+
});
|
|
158
|
+
afterEach(() => {
|
|
159
|
+
delete process.env.CONTENT_ADAPTER;
|
|
160
|
+
delete process.env.NEXT_PUBLIC_BASE_URL;
|
|
161
|
+
delete process.env.AILK_API_URL;
|
|
162
|
+
delete process.env.AILK_SPOKE_KEY;
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
it("carries the hub name on a hub-connected site", async () => {
|
|
166
|
+
process.env.AILK_SPOKE_KEY = KEY;
|
|
167
|
+
mockSiteConfigGet.mockResolvedValue(identity("Hub Co"));
|
|
168
|
+
expect((await llms("../route", PUBLIC_ROWS)).split("\n")[0]).toBe("# Hub Co — content index");
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
it("a hub name holding a newline heads llms.txt on one line", async () => {
|
|
172
|
+
process.env.AILK_SPOKE_KEY = KEY;
|
|
173
|
+
mockSiteConfigGet.mockResolvedValue(identity("A\nB"));
|
|
174
|
+
const text = await llms("../route", PUBLIC_ROWS);
|
|
175
|
+
expect(text.split("\n")[0]).toBe("# A B — content index");
|
|
176
|
+
expect(text.split("\n")[1]).toBe("");
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
it("carries SITE_NAME on a site that is not hub-connected, and never calls the hub", async () => {
|
|
180
|
+
mockSiteConfigGet.mockResolvedValue(identity("Hub Co"));
|
|
181
|
+
const { SITE_NAME } = jest.requireActual<typeof import("../../../lib/site-brand")>("../../../lib/site-brand");
|
|
182
|
+
expect((await llms("../route", PUBLIC_ROWS)).split("\n")[0]).toBe(`# ${SITE_NAME} — content index`);
|
|
183
|
+
expect(mockSiteConfigGet).not.toHaveBeenCalled();
|
|
184
|
+
});
|
|
185
|
+
});
|
|
@@ -49,7 +49,7 @@ import {
|
|
|
49
49
|
type DocsIndexPage,
|
|
50
50
|
} from "../../lib/docs-index";
|
|
51
51
|
import { PUBLIC_PAGES } from "../../lib/modules.generated";
|
|
52
|
-
import {
|
|
52
|
+
import { resolveSiteBrand } from "../../lib/site-brand";
|
|
53
53
|
import { SITE_LISTING } from "../../lib/site-listing";
|
|
54
54
|
import { pagePathFor, resolveBaseUrl } from "../../src/lib/routes";
|
|
55
55
|
|
|
@@ -97,7 +97,10 @@ export function createLlmsHandler(deps: LlmsHandlerDeps = {}) {
|
|
|
97
97
|
if (!(await isDiscoverable())) return new Response(null, { status: 404, headers: { "cache-control": "no-store" } });
|
|
98
98
|
const adapter = resolveAdapter();
|
|
99
99
|
const baseUrl = resolveBaseUrl();
|
|
100
|
-
const lines: string[] = [
|
|
100
|
+
const lines: string[] = [
|
|
101
|
+
`# ${(await resolveSiteBrand()).siteName} — content index`,
|
|
102
|
+
"",
|
|
103
|
+
];
|
|
101
104
|
|
|
102
105
|
// llms.txt is default-locale-only per Phase 3 roadmap §3 (AEO MVP is
|
|
103
106
|
// default-locale; per-locale AEO grading is deferred). Pass the default
|
|
@@ -25,11 +25,14 @@
|
|
|
25
25
|
// stub answers `null` on a site without the module. `@working-theory/auth`
|
|
26
26
|
// ships the `auth`, `signIn`, `mcpConsent` and `spokeSignIn` keys of the
|
|
27
27
|
// sign-in surfaces (#11257 D12), added after the account catalog.
|
|
28
|
+
// `@working-theory/site-pages` ships the ten namespaces of the base pages
|
|
29
|
+
// (#11259 D7), added beside the account catalog: every site carries it.
|
|
28
30
|
//
|
|
29
31
|
// Spec: docs/internal/specs/i18n-phase1-s2-next-intl-foundation-spec.md
|
|
30
32
|
|
|
31
33
|
import { accountMessages } from "@working-theory/account";
|
|
32
34
|
import { authMessages } from "@working-theory/auth";
|
|
35
|
+
import { sitePagesMessages } from "@working-theory/site-pages";
|
|
33
36
|
import type { AbstractIntlMessages } from "next-intl";
|
|
34
37
|
import { getRequestConfig } from "next-intl/server";
|
|
35
38
|
|
|
@@ -103,6 +106,7 @@ export default getRequestConfig(async ({ requestLocale }) => {
|
|
|
103
106
|
// package; this site's catalog holds overrides only, so the package's keys
|
|
104
107
|
// are added under it and a key the site carries keeps the site's value.
|
|
105
108
|
const packaged = accountMessages(locale) ?? accountMessages(DEFAULT_LOCALE) ?? {};
|
|
109
|
+
const basePages = sitePagesMessages(locale) ?? sitePagesMessages(DEFAULT_LOCALE) ?? {};
|
|
106
110
|
const signIn = authMessages(locale) ?? authMessages(DEFAULT_LOCALE) ?? {};
|
|
107
111
|
const signalCollectors = await loadUiSignalCollectors();
|
|
108
112
|
const flows =
|
|
@@ -118,7 +122,7 @@ export default getRequestConfig(async ({ requestLocale }) => {
|
|
|
118
122
|
const withPackages = mergeAddOnly(
|
|
119
123
|
mergeAddOnly(
|
|
120
124
|
mergeAddOnly(
|
|
121
|
-
mergeAddOnly(mergeAddOnly(mergeAddOnly(messages as Catalog, packaged), signIn), flows),
|
|
125
|
+
mergeAddOnly(mergeAddOnly(mergeAddOnly(mergeAddOnly(messages as Catalog, packaged), basePages), signIn), flows),
|
|
122
126
|
schedule,
|
|
123
127
|
),
|
|
124
128
|
checkout,
|
|
@@ -149,6 +149,12 @@ module.exports = {
|
|
|
149
149
|
// aliases it to auth.config.tsx. The package's own suites run on this
|
|
150
150
|
// config too (packages/auth/jest.config.cjs), against this site.
|
|
151
151
|
"^@working-theory/auth/site$": "<rootDir>/auth.config.tsx",
|
|
152
|
+
// #11259 — the base website pages' seam, the same way: next.config.mjs
|
|
153
|
+
// aliases it to site-pages.config.tsx. The package's own suites run on
|
|
154
|
+
// this config too (packages/site-pages/jest.config.cjs), against this
|
|
155
|
+
// site. Its other subpaths need no mapper: it ships TypeScript source and
|
|
156
|
+
// its `exports` name the files.
|
|
157
|
+
"^@working-theory/site-pages/site$": "<rootDir>/site-pages.config.tsx",
|
|
152
158
|
// The package's modules resolve `next/headers` and `better-auth/react`
|
|
153
159
|
// from their own install, a second physical copy of each (the #5025
|
|
154
160
|
// class above), so a test's `jest.mock()` of either would miss them.
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
* `next/headers` mocked, in `renderPage-extension.test.tsx`'s idiom.
|
|
8
8
|
*/
|
|
9
9
|
import { readFileSync } from "node:fs";
|
|
10
|
+
import { createRequire } from "node:module";
|
|
10
11
|
import path from "node:path";
|
|
11
12
|
|
|
12
13
|
import { ROUTES } from "@working-theory/templates/routes";
|
|
@@ -111,6 +112,14 @@ describe("DECK_ROUTES parity (#8687 D3)", () => {
|
|
|
111
112
|
let pageSource: string;
|
|
112
113
|
try {
|
|
113
114
|
pageSource = readFileSync(path.join(appRoot, dir, "page.tsx"), "utf8");
|
|
115
|
+
// A generated route file is a re-export (#11259 D8): read the
|
|
116
|
+
// package page it re-exports, resolved from apps/web.
|
|
117
|
+
const spec = pageSource.startsWith("// Generated by create-ailk routes from ")
|
|
118
|
+
? /from "(@working-theory\/[^"]+)"/.exec(pageSource)?.[1]
|
|
119
|
+
: undefined;
|
|
120
|
+
if (spec !== undefined) {
|
|
121
|
+
pageSource = readFileSync(createRequire(path.join(__dirname, "..", "..", "package.json")).resolve(spec), "utf8");
|
|
122
|
+
}
|
|
114
123
|
} catch {
|
|
115
124
|
continue;
|
|
116
125
|
}
|