create-ailk 0.40.3 → 0.42.0

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.
Files changed (45) hide show
  1. package/README.md +31 -1
  2. package/component-catalog.json +6 -0
  3. package/dist/add-route.d.ts +2 -6
  4. package/dist/add-route.js +2 -43
  5. package/dist/export-content.js +11 -3
  6. package/dist/language-import.js +5 -2
  7. package/dist/lib/env-catalog.js +5 -1
  8. package/dist/lib/import-mdx.js +10 -7
  9. package/dist/magnet-page.d.ts +36 -0
  10. package/dist/magnet-page.js +70 -0
  11. package/dist/module-architecture.js +14 -48
  12. package/dist/routes.d.ts +44 -2
  13. package/dist/routes.js +766 -33
  14. package/dist/surfaces.d.ts +18 -2
  15. package/dist/surfaces.js +85 -21
  16. package/dist/topology.js +0 -1
  17. package/dist/update.d.ts +16 -1
  18. package/dist/update.js +273 -7
  19. package/package.json +3 -3
  20. package/templates/.claude/hooks/template-guard.sh +145 -36
  21. package/templates/CLAUDE.md +1 -1
  22. package/templates/apps/api/.env.example +2 -1
  23. package/templates/apps/api/CLAUDE.md +1 -0
  24. package/templates/apps/mcp/CLAUDE.md +5 -3
  25. package/templates/apps/web/.env.example +5 -6
  26. package/templates/apps/web/CLAUDE.md +41 -7
  27. package/templates/apps/web/app/[locale]/layout.tsx +6 -3
  28. package/templates/apps/web/app/llms.txt/__tests__/site-listing.test.ts +37 -1
  29. package/templates/apps/web/app/sitemap.xml/__tests__/site-listing.test.ts +28 -0
  30. package/templates/apps/web/lib/__tests__/deck-page.test.ts +17 -0
  31. package/templates/apps/web/lib/__tests__/magnet-routes.test.ts +1 -0
  32. package/templates/apps/web/lib/__tests__/page-chrome.test.ts +42 -0
  33. package/templates/apps/web/lib/__tests__/route-paths.test.ts +57 -0
  34. package/templates/apps/web/lib/__tests__/structured-data.test.tsx +22 -7
  35. package/templates/apps/web/lib/deck-page.ts +20 -1
  36. package/templates/apps/web/lib/mcp-oauth.ts +14 -10
  37. package/templates/apps/web/lib/page-chrome.ts +11 -5
  38. package/templates/apps/web/lib/route-paths.ts +22 -0
  39. package/templates/apps/web/lib/services-path.ts +27 -18
  40. package/templates/apps/web/messages/en.json +0 -9
  41. package/templates/apps/web/middleware.ts +2 -1
  42. package/templates/apps/web/next.config.mjs +123 -2
  43. package/templates/apps/web/src/lib/routes.ts +4 -2
  44. package/versions.json +50 -50
  45. package/templates/apps/web/lib/deliverable-grant.ts +0 -18
@@ -131,11 +131,19 @@ describe.each(ROUTES)("GET /llms.txt (%s) — the site listing (#10940)", (path)
131
131
  it("AC-3: the default listing is the empty one — today's convention listing", async () => {
132
132
  const byDefault = await llms(path, PUBLIC_ROWS);
133
133
  expect(byDefault).toBe(await llms(path, PUBLIC_ROWS, {}));
134
- for (const p of ["/projects-apply", "/meet/meet-discovery", "/private-convo"]) {
134
+ for (const p of ["/projects-apply", "/meet/meet-discovery"]) {
135
135
  expect(byDefault).toContain(`URL: ${BASE}${p}`);
136
136
  }
137
137
  });
138
138
 
139
+ it("AC-3: never lists a private page, under either path (#11659 D3)", async () => {
140
+ for (const listing of [undefined, {}, LISTING]) {
141
+ const text = await llms(path, PUBLIC_ROWS, listing);
142
+ expect(text).not.toContain(`${BASE}/private-convo`);
143
+ expect(text).not.toContain(`${BASE}/private/convo`);
144
+ }
145
+ });
146
+
139
147
  it("AC-3: never lists a ThankYouPage, even with an empty listing", async () => {
140
148
  const text = await llms(path, { ...PUBLIC_ROWS, ...THANKS }, {});
141
149
  expect(text).not.toContain("/thanks/projects-approved");
@@ -190,3 +198,31 @@ describe("the llms.txt heading — a hub-connected site's name (#11456 D4, AC-2)
190
198
  expect(mockSiteConfigGet).not.toHaveBeenCalled();
191
199
  });
192
200
  });
201
+
202
+ // #11385 D3, AC-1, AC-3 — one site-config entry renames the portfolio's
203
+ // segment: llms.txt lists every PortfolioItem at /writing-samples with no
204
+ // listing row, and no URL keeps the old segment.
205
+ describe.each(ROUTES)("GET /llms.txt (%s) — a renamed route family (#11385)", (path) => {
206
+ const saved = process.env.NEXT_PUBLIC_AILK_ROUTE_PATHS;
207
+ beforeEach(() => {
208
+ process.env.CONTENT_ADAPTER = "database";
209
+ process.env.NEXT_PUBLIC_ENABLED_LOCALES = "en";
210
+ process.env.NEXT_PUBLIC_BASE_URL = BASE;
211
+ process.env.NEXT_PUBLIC_AILK_ROUTE_PATHS = '{"portfolio":"writing-samples"}';
212
+ });
213
+ afterEach(() => {
214
+ delete process.env.CONTENT_ADAPTER;
215
+ delete process.env.NEXT_PUBLIC_ENABLED_LOCALES;
216
+ delete process.env.NEXT_PUBLIC_BASE_URL;
217
+ if (saved === undefined) delete process.env.NEXT_PUBLIC_AILK_ROUTE_PATHS;
218
+ else process.env.NEXT_PUBLIC_AILK_ROUTE_PATHS = saved;
219
+ });
220
+
221
+ it("lists the PortfolioItem at /writing-samples/acme and nothing under /portfolio", async () => {
222
+ const text = await llms(path, {
223
+ PortfolioItem: [{ type: "PortfolioItem", slug: "acme", title: "Acme" }],
224
+ });
225
+ expect(urls(text)).toContain(`${BASE}/writing-samples/acme`);
226
+ expect(urls(text).filter((url) => url.includes("/portfolio"))).toEqual([]);
227
+ });
228
+ });
@@ -108,3 +108,31 @@ describe("GET /sitemap.xml — the site listing (#10940)", () => {
108
108
  expect(xml).not.toContain("evil.example");
109
109
  });
110
110
  });
111
+
112
+ // #11385 D3, AC-1, AC-3 — one site-config entry renames the portfolio's
113
+ // segment: every PortfolioItem is listed at /writing-samples with no listing
114
+ // row, and no URL keeps the old segment.
115
+ describe("GET /sitemap.xml — a renamed route family (#11385)", () => {
116
+ const saved = process.env.NEXT_PUBLIC_AILK_ROUTE_PATHS;
117
+ beforeEach(() => {
118
+ process.env.CONTENT_ADAPTER = "database";
119
+ process.env.NEXT_PUBLIC_ENABLED_LOCALES = "en";
120
+ process.env.NEXT_PUBLIC_BASE_URL = BASE;
121
+ process.env.NEXT_PUBLIC_AILK_ROUTE_PATHS = '{"portfolio":"writing-samples"}';
122
+ ROWS.PortfolioItem = [{ type: "PortfolioItem", slug: "acme", title: "Acme" }];
123
+ });
124
+ afterEach(() => {
125
+ delete process.env.CONTENT_ADAPTER;
126
+ delete process.env.NEXT_PUBLIC_ENABLED_LOCALES;
127
+ delete process.env.NEXT_PUBLIC_BASE_URL;
128
+ delete ROWS.PortfolioItem;
129
+ if (saved === undefined) delete process.env.NEXT_PUBLIC_AILK_ROUTE_PATHS;
130
+ else process.env.NEXT_PUBLIC_AILK_ROUTE_PATHS = saved;
131
+ });
132
+
133
+ it("lists the PortfolioItem at /writing-samples/acme and nothing under /portfolio", async () => {
134
+ const all = locs(await sitemap({}));
135
+ expect(all.some((loc) => loc.endsWith("/writing-samples/acme"))).toBe(true);
136
+ expect(all.filter((loc) => loc.includes("/portfolio"))).toEqual([]);
137
+ });
138
+ });
@@ -92,6 +92,23 @@ describe("deckCandidates (#8687 D3, AC-2)", () => {
92
92
  );
93
93
  });
94
94
 
95
+ describe("deckCandidates — private pages (#11659)", () => {
96
+ const LOCALES = ["en", "es"];
97
+
98
+ it("/private/<s> resolves the LandingPage private-<s>", () => {
99
+ expect(deckCandidates("/en/private/convo", LOCALES)).toEqual([
100
+ { type: "LandingPage", slug: "private-convo" },
101
+ ]);
102
+ });
103
+
104
+ it("a one-segment /private-<s> stays on the [slug] fallback", () => {
105
+ expect(deckCandidates("/private-convo", LOCALES)).toEqual([
106
+ { type: "LandingPage", slug: "private-convo" },
107
+ { type: "BlogList", slug: "private-convo" },
108
+ ]);
109
+ });
110
+ });
111
+
95
112
  describe("DECK_ROUTES parity (#8687 D3)", () => {
96
113
  it("contains every routes-map row with seed content whose page.tsx renders sections, minus /", () => {
97
114
  // DECK_ROUTES is a fixed superset, not a per-scaffold exact set: a shape
@@ -33,6 +33,7 @@ describe("isMagnetWalkPath (#8840 D10)", () => {
33
33
  "/careers/a/b/apply",
34
34
  "/trial",
35
35
  "/en/trial",
36
+ "/fr/trial",
36
37
  "/request",
37
38
  "/trial/a/request",
38
39
  ])("is not a walk: %j", (path) => {
@@ -18,6 +18,7 @@ import {
18
18
  import { ROUTES } from "@working-theory/templates/routes";
19
19
 
20
20
  import {
21
+ chromePageCandidates,
21
22
  readClosingFooterSettings,
22
23
  readSiteChromeSettings,
23
24
  resolveChromePage,
@@ -503,3 +504,44 @@ describe("services base and categories (#10043 AC-7)", () => {
503
504
  });
504
505
  });
505
506
  });
507
+
508
+ describe("private pages (#11659)", () => {
509
+ const locales = ["en", "es"];
510
+
511
+ it("names the LandingPage private-<s> as the chrome page of /private/<s>", () => {
512
+ expect(chromePageCandidates("/en/private/convo", locales)).toEqual([
513
+ { type: "LandingPage", slug: "private-convo" },
514
+ ]);
515
+ });
516
+
517
+ it("keeps a one-segment /private-<s> on the [slug] fallback", () => {
518
+ expect(chromePageCandidates("/private-convo", locales)).toEqual([
519
+ { type: "LandingPage", slug: "private-convo" },
520
+ { type: "BlogList", slug: "private-convo" },
521
+ ]);
522
+ });
523
+ });
524
+
525
+ // #11385 D8, AC-9 — a renamed family keeps its chrome at its served segment.
526
+ describe("a renamed route family (#11385 AC-9)", () => {
527
+ const saved = process.env.NEXT_PUBLIC_AILK_ROUTE_PATHS;
528
+ beforeEach(() => {
529
+ process.env.NEXT_PUBLIC_AILK_ROUTE_PATHS = '{"portfolio":"writing-samples"}';
530
+ });
531
+ afterEach(() => {
532
+ if (saved === undefined) delete process.env.NEXT_PUBLIC_AILK_ROUTE_PATHS;
533
+ else process.env.NEXT_PUBLIC_AILK_ROUTE_PATHS = saved;
534
+ });
535
+
536
+ it("finds the portfolio family at /writing-samples", () => {
537
+ expect(routeFamilyOf("/writing-samples/acme", ["en"])).toBe("portfolio");
538
+ expect(routeFamilyOf("/writing-samples", ["en"])).toBe("portfolio");
539
+ });
540
+
541
+ it("names the PortfolioItem and the PortfolioList as the chrome pages, never a LandingPage writing-samples", () => {
542
+ expect(chromePageCandidates("/writing-samples/acme", ["en"])[0]).toEqual({ type: "PortfolioItem", slug: "acme" });
543
+ const list = chromePageCandidates("/writing-samples", ["en"]);
544
+ expect(list[0]).toMatchObject({ type: "PortfolioList" });
545
+ expect(list).not.toContainEqual({ type: "LandingPage", slug: "writing-samples" });
546
+ });
547
+ });
@@ -0,0 +1,57 @@
1
+ /**
2
+ * The nav and footer follow a site's route-family renames (#11385 D8, AC-1, AC-9).
3
+ */
4
+ import type { NavItem } from "@working-theory/ui";
5
+ import { ArrowRight } from "lucide-react";
6
+
7
+ import { withRenamedColumns, withRenamedNavPaths } from "../route-paths";
8
+
9
+ const saved = process.env.NEXT_PUBLIC_AILK_ROUTE_PATHS;
10
+ beforeEach(() => {
11
+ process.env.NEXT_PUBLIC_AILK_ROUTE_PATHS = '{"portfolio":"writing-samples"}';
12
+ });
13
+ afterEach(() => {
14
+ if (saved === undefined) delete process.env.NEXT_PUBLIC_AILK_ROUTE_PATHS;
15
+ else process.env.NEXT_PUBLIC_AILK_ROUTE_PATHS = saved;
16
+ });
17
+
18
+ describe("withRenamedNavPaths", () => {
19
+ it("maps a renamed family's item path", () => {
20
+ expect(withRenamedNavPaths([{ labelKey: "work", path: "/portfolio" }])[0]?.path).toBe(
21
+ "/writing-samples",
22
+ );
23
+ });
24
+
25
+ it("maps a flyout feature, a group item and an action, and leaves /about alone", () => {
26
+ const items: NavItem[] = [
27
+ {
28
+ labelKey: "work",
29
+ path: "/about",
30
+ flyout: {
31
+ features: [{ labelKey: "acme", path: "/portfolio/acme" }],
32
+ groups: [{ headingKey: "more", items: [{ labelKey: "beta", path: "/portfolio/beta" }] }],
33
+ actions: [{ labelKey: "all", icon: ArrowRight, path: "/portfolio" }],
34
+ },
35
+ },
36
+ ];
37
+ const [item] = withRenamedNavPaths(items);
38
+ expect(item?.path).toBe("/about");
39
+ expect(item?.flyout?.features[0]?.path).toBe("/writing-samples/acme");
40
+ expect(item?.flyout?.groups?.[0]?.items[0]?.path).toBe("/writing-samples/beta");
41
+ expect(item?.flyout?.actions?.[0]?.path).toBe("/writing-samples");
42
+ });
43
+
44
+ it("is the identity with no rename", () => {
45
+ delete process.env.NEXT_PUBLIC_AILK_ROUTE_PATHS;
46
+ expect(withRenamedNavPaths([{ labelKey: "work", path: "/portfolio" }])[0]?.path).toBe("/portfolio");
47
+ });
48
+ });
49
+
50
+ describe("withRenamedColumns", () => {
51
+ it("maps a column item", () => {
52
+ expect(
53
+ withRenamedColumns([{ heading: "Work", items: [{ label: "Acme", path: "/portfolio/acme" }] }])[0]?.items[0]
54
+ ?.path,
55
+ ).toBe("/writing-samples/acme");
56
+ });
57
+ });
@@ -462,6 +462,8 @@ const GENERATED_CHECKOUT_ROUTE = "// Generated by create-ailk routes from @worki
462
462
  // harness can read, and its landing's JSON-LD comes from the hub's record, so
463
463
  // a page carrying both is exempt at ANY route: `create-ailk add-route magnet`
464
464
  // writes a pair at a path the site picks. Keyed on the file, as #8513 is.
465
+ // #11657 — the generated re-export of a signal-collectors magnet page.
466
+ const GENERATED_SIGNAL_COLLECTORS_ROUTE = "// Generated by create-ailk routes from @working-theory/ui-signal-collectors";
465
467
  const MAGNET_PAGE_MARKER = "Standard magnet page (#8840)";
466
468
  const MAGNET_RENDERER_IMPORT = "flows/[slug]/magnet-page";
467
469
  const MAGNET_PAGE_REASON =
@@ -540,17 +542,20 @@ const NO_STRUCTURED_DATA_ROUTES: ReadonlyArray<{
540
542
  subtree: true,
541
543
  },
542
544
  { route: "private", reason: "private booking index, API-backed and noindex (#8843 D8)" },
545
+ // #11657 — the magnet pages ship in `@working-theory/ui-signal-collectors`;
546
+ // each site file is its generated re-export (keyed on the header, so a
547
+ // site's own replacement is checked like any page). The moved suites cover
548
+ // the reader's and the hub's JSON-LD; the walks are magnet pages.
549
+ ...["reports", "trial", "careers/apply", "careers/[slug]/apply"].map((route) => ({
550
+ route,
551
+ reason: "magnet pages ship in @working-theory/ui-signal-collectors (#11657); its suites check the JSON-LD",
552
+ subtree: true as const,
553
+ requires: [GENERATED_SIGNAL_COLLECTORS_ROUTE],
554
+ })),
543
555
  {
544
556
  route: "unsubscribe",
545
557
  reason: "app-shaped landing, API-backed; no content page behind it",
546
558
  },
547
- // #8848 D12 — `/downloads` and `/downloads/<slug>` are permanent redirects
548
- // into `/reports`; a redirect renders no page.
549
- {
550
- route: "downloads",
551
- reason: "permanent redirect into /reports (#8848 D12); renders no page",
552
- subtree: true,
553
- },
554
559
  // #6084 — both purchase return pages read a Checkout Session (or read
555
560
  // nothing, for cancel) and render via SectionRenderer directly; neither
556
561
  // is a content-adapter page, and the paid render's own schema.org node
@@ -767,6 +772,16 @@ describe("structured data — every route emits a valid JSON-LD script", () => {
767
772
  console.info(`structured-data: ${label} not checked — no marketing module, / redirects to /account (#10040)`);
768
773
  return;
769
774
  }
775
+ // #11659 D5 — a private page renders through renderPage, which emits no
776
+ // JSON-LD for it by design (noindex, nofollow, unlisted), so it is
777
+ // skipped here rather than listed in NO_STRUCTURED_DATA_ROUTES (which
778
+ // refuses a renderPage route). page-renderer's renderPage-private suite
779
+ // pins the absent script.
780
+ if (route === "private/[slug]") {
781
+ expect(routeIdentity(src)?.type).toBe("LandingPage");
782
+ console.info(`structured-data: ${label} not checked — a private page emits no JSON-LD by design (#11659 D5)`);
783
+ return;
784
+ }
770
785
  const exempt = exemption(route, src);
771
786
  // #10552 (merged in #10586) put a program-Event renderPage ahead of the
772
787
  // meet hub's BookCall one in `[slug]/[detail]`. The params this check
@@ -14,7 +14,11 @@ import {
14
14
  type DeckPageInputs,
15
15
  type SchemaOrgType,
16
16
  } from "@working-theory/page-renderer";
17
- import { ROUTES, type RouteRow } from "@working-theory/templates/routes";
17
+ import {
18
+ PRIVATE_PAGE_SLUG_PREFIX,
19
+ ROUTES,
20
+ type RouteRow,
21
+ } from "@working-theory/templates/routes";
18
22
  import { readLocales } from "@working-theory/web-i18n";
19
23
  import { headers } from "next/headers";
20
24
  import { cache } from "react";
@@ -102,6 +106,19 @@ export function isAlwaysScaffolded(path: string): boolean {
102
106
  return row !== undefined && row.gateable !== true && row.module === "marketing";
103
107
  }
104
108
 
109
+ /**
110
+ * The private page `/private/<s>` serves — the LandingPage `private-<s>`
111
+ * (#11659 D2) — else `null`. Its routes-map row names no content directory,
112
+ * so the row walks never reach it.
113
+ */
114
+ export function privatePageCandidate(
115
+ pathSegments: readonly string[],
116
+ ): { type: SchemaOrgType; slug: string } | null {
117
+ const slug = pathSegments[1];
118
+ if (!matchesRoute("/private/:slug", pathSegments) || slug === undefined) return null;
119
+ return { type: "LandingPage", slug: `${PRIVATE_PAGE_SLUG_PREFIX}${slug}` };
120
+ }
121
+
105
122
  /**
106
123
  * The content pages that could serve `pathname`, in the order Next.js tries
107
124
  * them (D3). `/` gives none — the home's deck is its own `layout.home` knob,
@@ -114,6 +131,8 @@ export function deckCandidates(
114
131
  const path = normalizeRoutePath(pathname, locales);
115
132
  if (path === "/") return [];
116
133
  const segments = routeSegments(path);
134
+ const privatePage = privatePageCandidate(segments);
135
+ if (privatePage) return [privatePage];
117
136
  const candidates: Array<{ type: SchemaOrgType; slug: string }> = [];
118
137
 
119
138
  for (const routeDef of DECK_ROUTES) {
@@ -23,10 +23,10 @@
23
23
  * for a server with no tag, as a site's apps/web has;
24
24
  * - one sign-in for every workspace (#11607 D1a): a server given
25
25
  * `allWorkspaces` (the Admin) binds `ailk:all-workspaces` in place of the
26
- * one workspace, after a confirmation naming every workspace it reaches,
27
- * and its token-info answers the person's live memberships at each call
28
- * (D2). A server without it never binds one and treats such a token as
29
- * another server's.
26
+ * one workspace, and its token-info answers the person's live memberships
27
+ * at each call (D2). Its consent offers no choice (#11672 D1): the server
28
+ * binds every requested scope the person's roles hold. A server without
29
+ * it never binds one and treats such a token as another server's.
30
30
  *
31
31
  * Every refusal is code-shaped: no English string reaches a client. No answer
32
32
  * or log line carries a token, code, verifier or client secret.
@@ -648,18 +648,22 @@ export function mcpOAuthPlugin(deps: McpOAuthDeps) {
648
648
  return ctx.json({ redirectURI: redirect.toString() });
649
649
  }
650
650
 
651
- const chosen = ctx.body.scopes ?? [];
651
+ let chosen: readonly string[];
652
652
  let binding: string;
653
653
  if (allWorkspaces) {
654
654
  // The reach is every workspace, so naming one is a client of the
655
- // single-workspace consent (#11607 D1a).
656
- if (ctx.body.workspace_id !== undefined) throw refuse("BAD_REQUEST", "invalid_request");
657
- const reach = await offeredReach(userId, value.scope);
658
- if (reach.workspaces.length === 0 || chosen.some((s) => !(reach.offered as string[]).includes(s))) {
659
- throw refuse("BAD_REQUEST", "invalid_scope");
655
+ // single-workspace consent (#11607 D1a). The server decides the
656
+ // grant (#11672 D1): a body naming scopes is refused, never
657
+ // ignored — a client posting a subset believes it is narrowing.
658
+ if (ctx.body.workspace_id !== undefined || ctx.body.scopes !== undefined) {
659
+ throw refuse("BAD_REQUEST", "invalid_request");
660
660
  }
661
+ const reach = await offeredReach(userId, value.scope);
662
+ if (reach.workspaces.length === 0) throw refuse("BAD_REQUEST", "invalid_scope");
663
+ chosen = reach.offered;
661
664
  binding = ALL_WORKSPACES_SCOPE;
662
665
  } else {
666
+ chosen = ctx.body.scopes ?? [];
663
667
  const workspace = (await offeredWorkspaces(userId, value.scope)).find(
664
668
  (w) => w.id === ctx.body.workspace_id,
665
669
  );
@@ -37,7 +37,7 @@ import {
37
37
  type RouteFamilyKey,
38
38
  type SiteLayout,
39
39
  } from "@working-theory/site-config/schema";
40
- import { ROUTES } from "@working-theory/templates/routes";
40
+ import { conventionPath, ROUTES } from "@working-theory/templates/routes";
41
41
  import { readLocales } from "@working-theory/web-i18n";
42
42
  import { cache } from "react";
43
43
  import { parse as parseYaml } from "yaml";
@@ -47,6 +47,7 @@ import { normalizeRoutePath } from "./closing-footer-path";
47
47
  import {
48
48
  isAlwaysScaffolded,
49
49
  matchesRoute,
50
+ privatePageCandidate,
50
51
  resolveTypeAndSlug,
51
52
  } from "./deck-page";
52
53
  import { toInternalDocsPath } from "./docs-path";
@@ -239,14 +240,16 @@ function matchesPattern(pattern: string, segments: readonly string[]): boolean {
239
240
  * The route family a pathname belongs to, else `null`: the first routes-map
240
241
  * hub whose prefix is the path, prefixes it, or whose detail pattern matches
241
242
  * it. A site's moved docs are mapped back onto `/docs` first, and its moved
242
- * services onto `/services` (#10043 D9).
243
+ * services onto `/services` (#10043 D9), then a renamed family's served
244
+ * segment onto its own (#11385 D8).
243
245
  */
244
246
  export function routeFamilyOf(
245
247
  pathname: string,
246
248
  locales: readonly string[],
247
249
  ): RouteFamilyKey | null {
248
250
  const bare = normalizeRoutePath(pathname, locales);
249
- const path = toInternalDocsPath(bare) ?? toInternalServicesPath(bare) ?? bare;
251
+ // #11385 D8 — a renamed family's served segment maps back onto its own.
252
+ const path = conventionPath(toInternalDocsPath(bare) ?? toInternalServicesPath(bare) ?? bare);
250
253
  const segments = path.split("/").filter((segment) => segment.length > 0);
251
254
  for (const row of ROUTES) {
252
255
  if (!row.hub) continue;
@@ -276,8 +279,9 @@ export function chromePageCandidates(
276
279
  locales: readonly string[],
277
280
  ): Array<{ type: SchemaOrgType; slug: string }> {
278
281
  const normalized = normalizeRoutePath(pathname, locales);
279
- // #10043 D9 — a site's moved services are mapped back onto `/services`.
280
- const path = toInternalServicesPath(normalized) ?? normalized;
282
+ // #10043 D9 — a site's moved services are mapped back onto `/services`,
283
+ // and #11385 D8 a renamed family's served segment onto its own.
284
+ const path = conventionPath(toInternalServicesPath(normalized) ?? normalized);
281
285
  if (path === "/") return [{ type: "HomePage", slug: "home" }];
282
286
  const segments = path.split("/").filter((segment) => segment.length > 0);
283
287
  // A service under its category (`/services/<category>/<slug>`): the nested
@@ -285,6 +289,8 @@ export function chromePageCandidates(
285
289
  if (segments.length === 3 && segments[0] === SERVICES_ROUTE.slice(1)) {
286
290
  return [{ type: "Service", slug: segments[2]! }];
287
291
  }
292
+ const privatePage = privatePageCandidate(segments);
293
+ if (privatePage) return [privatePage];
288
294
  const candidates: Array<{ type: SchemaOrgType; slug: string }> = [];
289
295
 
290
296
  for (const row of ROUTES) {
@@ -0,0 +1,22 @@
1
+ // route-paths.ts — the nav and footer follow a site's route-family renames
2
+ // (#11385 D8).
3
+ //
4
+ // A site writes `<family>: { path: /<segment> }` in `content/_site.mdx`;
5
+ // `next.config.mjs` bakes the renames into `NEXT_PUBLIC_AILK_ROUTE_PATHS`, and
6
+ // `renamedPath` reads them. The generated nav (`lib/nav-config.ts`) names the
7
+ // convention paths (`/portfolio`), so the layout maps them here at render, as
8
+ // it maps the docs and services paths.
9
+ import { renamedPath } from "@working-theory/templates/routes";
10
+ import type { NavItem } from "@working-theory/ui";
11
+
12
+ import { mapColumnPaths, mapNavItemPaths } from "./services-path";
13
+
14
+ /** Copies of the nav items with every renamed family's path at its served segment. */
15
+ export function withRenamedNavPaths(items: NavItem[]): NavItem[] {
16
+ return mapNavItemPaths(items, (path) => renamedPath(path));
17
+ }
18
+
19
+ /** Copies of the footer columns with every renamed family's path at its served segment. */
20
+ export function withRenamedColumns<C extends { items: { path: string }[] }>(columns: C[]): C[] {
21
+ return mapColumnPaths(columns, (path) => renamedPath(path));
22
+ }
@@ -51,12 +51,14 @@ export function toInternalServicesPath(bare: string): string | null {
51
51
 
52
52
  type NavFlyout = NonNullable<NavItem["flyout"]>;
53
53
 
54
- function mapPath<T extends { path: string }>(entry: T): T {
55
- return { ...entry, path: toPublicServicesHref(entry.path) };
56
- }
57
-
58
- function mapFlyout(flyout: NavFlyout): NavFlyout {
59
- return {
54
+ /**
55
+ * Copies of the nav items with every path mapped through `toPublic` — the
56
+ * item's own `path` and each flyout feature, group item and action. Every
57
+ * other field is carried by reference. Shared with `route-paths.ts` (#11385 D8).
58
+ */
59
+ export function mapNavItemPaths(items: NavItem[], toPublic: (path: string) => string): NavItem[] {
60
+ const mapPath = <T extends { path: string }>(entry: T): T => ({ ...entry, path: toPublic(entry.path) });
61
+ const mapFlyout = (flyout: NavFlyout): NavFlyout => ({
60
62
  ...flyout,
61
63
  features: flyout.features.map(mapPath),
62
64
  ...(flyout.groups
@@ -68,7 +70,23 @@ function mapFlyout(flyout: NavFlyout): NavFlyout {
68
70
  }
69
71
  : {}),
70
72
  ...(flyout.actions ? { actions: flyout.actions.map(mapPath) } : {}),
71
- };
73
+ });
74
+ return items.map((item) => ({
75
+ ...item,
76
+ ...(item.path !== undefined ? { path: toPublic(item.path) } : {}),
77
+ ...(item.flyout ? { flyout: mapFlyout(item.flyout) } : {}),
78
+ }));
79
+ }
80
+
81
+ /** Copies of the footer columns with every item's path mapped through `toPublic`. */
82
+ export function mapColumnPaths<C extends { items: { path: string }[] }>(
83
+ columns: C[],
84
+ toPublic: (path: string) => string,
85
+ ): C[] {
86
+ return columns.map((column) => ({
87
+ ...column,
88
+ items: column.items.map((item) => ({ ...item, path: toPublic(item.path) })),
89
+ }));
72
90
  }
73
91
 
74
92
  /**
@@ -77,21 +95,12 @@ function mapFlyout(flyout: NavFlyout): NavFlyout {
77
95
  * and action. Every other field is carried by reference.
78
96
  */
79
97
  export function withPublicServicesPaths(items: NavItem[]): NavItem[] {
80
- return items.map((item) => ({
81
- ...item,
82
- ...(item.path !== undefined
83
- ? { path: toPublicServicesHref(item.path) }
84
- : {}),
85
- ...(item.flyout ? { flyout: mapFlyout(item.flyout) } : {}),
86
- }));
98
+ return mapNavItemPaths(items, toPublicServicesHref);
87
99
  }
88
100
 
89
101
  /** Copies of the footer columns with every item's services path mapped onto `SERVICES_PATH`. */
90
102
  export function withPublicServicesColumns<
91
103
  C extends { items: { path: string }[] },
92
104
  >(columns: C[]): C[] {
93
- return columns.map((column) => ({
94
- ...column,
95
- items: column.items.map(mapPath),
96
- }));
105
+ return mapColumnPaths(columns, toPublicServicesHref);
97
106
  }
@@ -201,15 +201,6 @@
201
201
  "heading": "Alternatives",
202
202
  "emptyState": "Comparisons coming soon."
203
203
  },
204
- "reports": {
205
- "heading": "Reports",
206
- "emptyState": "Reports coming soon.",
207
- "gateIntro": "Tell us where to send it, and the report opens right away.",
208
- "gateCta": "Get the report",
209
- "openFile": "Open the report",
210
- "fileByEmail": "The link is on its way to your email.",
211
- "openExternal": "Open it"
212
- },
213
204
  "waitlistDashboard": {
214
205
  "gate": {
215
206
  "emptyHeadline": "Sign-in is not configured",
@@ -52,6 +52,7 @@ import {
52
52
  isBookingPath,
53
53
  setAuthRequestHeaders,
54
54
  } from "@working-theory/auth/edge";
55
+ import { routeSegment } from "@working-theory/templates/routes";
55
56
  import { NextRequest, NextResponse } from "next/server";
56
57
  import createMiddleware from "next-intl/middleware";
57
58
 
@@ -272,7 +273,7 @@ export function middleware(request: NextRequest): NextResponse {
272
273
  isFileRoutePath(request.nextUrl.pathname)
273
274
  ? FILE_ROUTE_SECURITY_HEADERS
274
275
  : SCHEDULING_PAGES &&
275
- isBookingPath(request.nextUrl.pathname, enabledLocales)
276
+ isBookingPath(request.nextUrl.pathname, enabledLocales, routeSegment("meet"))
276
277
  ? SCHEDULING_SECURITY_HEADERS
277
278
  : auth.oneTap
278
279
  ? ONE_TAP_SECURITY_HEADERS