create-ailk 0.46.6 → 0.47.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.
@@ -457,10 +457,30 @@ export default async function LocaleLayout({
457
457
  // `account` namespace, beside the nav keys.
458
458
  const tAccount = await getTranslations({ locale, namespace: "account" });
459
459
  navItemLabels[ACCOUNT_LABEL_KEY] = tAccount("yourAccount");
460
+ // #12401 D3 — the workspace's navigation record, read with the identity
461
+ // (one hub read per request). With one, the header items, menus, button,
462
+ // footer columns, legal links and closing footer come from it, through the
463
+ // translator only — the record itself never reaches a component. With
464
+ // none, or when the translator refuses it, every line below runs as before
465
+ // from `nav-config.ts` and `_site.mdx` (removed by #12404). The home's
466
+ // chrome resolution (below) answers it, so the record's styles apply
467
+ // exactly when its links render.
468
+ const home = await resolveHomeChrome(locale, chrome);
469
+ const recordNavigation = home.navigation;
470
+ const recordChrome = recordNavigation?.chrome ?? null;
471
+ if (recordChrome) Object.assign(navItemLabels, recordChrome.labels);
460
472
  // The site's own signed-out header button (#10046) — `_site.mdx`'s
461
- // `header.cta`. Its label is site content, written straight into the map;
462
- // the composition is `signedOutHeaderActions` below.
463
- const siteHeader = readSiteHeader();
473
+ // `header.cta`, or the record's button with its Sign in display (the
474
+ // record's where it sets one, else the file's). Its label is site content,
475
+ // written straight into the map; the composition is `signedOutHeaderActions` below.
476
+ const fileHeader = readSiteHeader();
477
+ const recordSignIn = recordChrome?.signIn ?? fileHeader?.signIn;
478
+ const siteHeader = recordChrome
479
+ ? {
480
+ ...(recordChrome.button ? { cta: recordChrome.button } : {}),
481
+ ...(recordSignIn !== undefined ? { signIn: recordSignIn } : {}),
482
+ }
483
+ : fileHeader;
464
484
  if (siteHeader?.cta) {
465
485
  navItemLabels[HEADER_CTA_LABEL_KEY] = siteHeader.cta.label;
466
486
  }
@@ -532,9 +552,8 @@ export default async function LocaleLayout({
532
552
  // design's chrome exactly as before: the deck home and `innerPages: "bare"`
533
553
  // (#7721 D4 — bare header + one-bar footer on every page but the home) are
534
554
  // that resolver's design level. Fail-safe: a missing `x-pathname`
535
- // resolves to the home path.
555
+ // resolves to the home path. `home` is resolved above, with the record.
536
556
  const isHome = pathname === homePath;
537
- const home = await resolveHomeChrome(locale, chrome);
538
557
  const homeLayout = home.layout;
539
558
  const isDeckHome = homeLayout === "deck" && isHome;
540
559
  const pageChrome = isHome
@@ -566,7 +585,18 @@ export default async function LocaleLayout({
566
585
  // on the closing footer in every header state) and its legal bar. The
567
586
  // site's labels ride `itemLabels` under keys no nav key can collide with
568
587
  // (no nav key contains a dot).
569
- const closingFooter = readClosingFooterSettings();
588
+ // #12401 D3 — with a record, its closing footer's location and buttons
589
+ // (none when it has none); the legal bar stays the file's.
590
+ const fileClosingFooter = readClosingFooterSettings();
591
+ const closingFooter = recordChrome
592
+ ? {
593
+ legalBar: fileClosingFooter.legalBar,
594
+ ...(recordChrome.closing?.locality !== undefined
595
+ ? { locality: recordChrome.closing.locality }
596
+ : {}),
597
+ ...(recordChrome.closing ? { actions: recordChrome.closing.actions } : {}),
598
+ }
599
+ : fileClosingFooter;
570
600
  const closingFooterActions = closingFooter.actions?.map(
571
601
  (action, i) => ({
572
602
  labelKey: `closingFooter.action.${i}`,
@@ -729,12 +759,17 @@ export default async function LocaleLayout({
729
759
  // site's docs path; `nav-config.ts` itself is never edited.
730
760
  // #10043 D9 — likewise every path at `/services`, at the services base.
731
761
  // #11385 D8 — a renamed route family's links follow its served segment.
732
- const publicNavItems = withRenamedNavPaths(withPublicServicesPaths(withPublicDocsPaths(navItems)));
733
- const footerColumnDefs = withRenamedColumns(withPublicServicesColumns(withPublicDocsColumns(footerColumns))).map((col) => ({
734
- heading: labelFor(col.headingKey),
735
- headingKey: col.headingKey,
736
- items: col.items.map((item) => ({ ...item, label: labelFor(item.labelKey) })),
737
- }));
762
+ // #12401 D3 — a record's items and columns are already at their public
763
+ // paths (the translator resolves its page targets), so no pass rewrites them.
764
+ const publicNavItems =
765
+ recordChrome?.navItems ?? withRenamedNavPaths(withPublicServicesPaths(withPublicDocsPaths(navItems)));
766
+ const footerColumnDefs =
767
+ recordChrome?.columns ??
768
+ withRenamedColumns(withPublicServicesColumns(withPublicDocsColumns(footerColumns))).map((col) => ({
769
+ heading: labelFor(col.headingKey),
770
+ headingKey: col.headingKey,
771
+ items: col.items.map((item) => ({ ...item, label: labelFor(item.labelKey) })),
772
+ }));
738
773
 
739
774
  // The bare header's back arrow (operator handoff 2026-11-09): the page's
740
775
  // served parent — a content page, a page route the app builds or a nav entry —
@@ -776,17 +811,22 @@ export default async function LocaleLayout({
776
811
  // and `/terms`) — since a mark-only nav (its usual pairing, #5589) has
777
812
  // nowhere else on the page linking it. The default `columns` footer keeps
778
813
  // exactly today's two-entry list, byte-identical.
779
- const legalLinks = [
780
- { label: "Privacy Policy", href: "/privacy" },
781
- { label: "Terms of Service", href: "/terms" },
782
- // #6739 — a link, not the reopen button: the privacy page's
783
- // #cookie-settings anchor explains the choice, and arriving there
784
- // reopens the consent banner (BannerConsentIsland).
785
- { label: tConsent("settingsLabel"), href: "/privacy#cookie-settings" },
786
- ...(siteChrome.footer === "centered"
787
- ? [{ label: tNav("faq"), href: "/faq" }]
788
- : []),
789
- ];
814
+ // #6739 — a link, not the reopen button: the privacy page's
815
+ // #cookie-settings anchor explains the choice, and arriving there
816
+ // reopens the consent banner (BannerConsentIsland).
817
+ const cookieSettingsLink = { label: tConsent("settingsLabel"), href: "/privacy#cookie-settings" };
818
+ // #12401 D3 — with a record, its bottom bar, then the cookie-settings link
819
+ // (the consent banner's reopen point, not navigation); FAQ is not added.
820
+ const legalLinks = recordChrome
821
+ ? [...recordChrome.legalLinks, cookieSettingsLink]
822
+ : [
823
+ { label: "Privacy Policy", href: "/privacy" },
824
+ { label: "Terms of Service", href: "/terms" },
825
+ cookieSettingsLink,
826
+ ...(siteChrome.footer === "centered"
827
+ ? [{ label: tNav("faq"), href: "/faq" }]
828
+ : []),
829
+ ];
790
830
 
791
831
  // The site's own declared colours (`content/_site.mdx` `theme:` + `brand:`)
792
832
  // as a token overlay, the design's web faces (#7720) beneath `brand.fonts`,
@@ -857,6 +897,13 @@ export default async function LocaleLayout({
857
897
  <link rel="manifest" href="/site.webmanifest" />
858
898
  <GoogleAnalytics />
859
899
  <VerificationMeta />
900
+ {/* #12401 (SEC-12403-3, #12404 M3) — which navigation this page
901
+ renders, whatever the header style: one per page. */}
902
+ <meta
903
+ name="ailk-nav-source"
904
+ content={recordNavigation ? "record" : "files"}
905
+ {...(recordNavigation ? { "data-version": String(recordNavigation.version) } : {})}
906
+ />
860
907
  </head>
861
908
  <body>
862
909
  {/* Skip link (operator ruling 2026-09-23): the first Tab stop on every
@@ -978,20 +1025,34 @@ export default async function LocaleLayout({
978
1025
  // people-slide rule.
979
1026
  // #10049 D1 — `none` renders no header; a site-set `full`
980
1027
  // header shows the menus even on a `mark-only` design.
981
- pageChrome.header === "none" ? undefined : bareBackLink ? (
982
- <Nav {...navProps} navItems={[]} bar="bare" backLink={bareBackLink} />
983
- ) : (
984
- <Nav
985
- {...navProps}
986
- navItems={
987
- siteChrome.nav === "mark-only" &&
988
- (session !== null ||
989
- pageChrome.header === "bare" ||
990
- pageChrome.headerFromTemplate)
991
- ? []
992
- : publicNavItems
993
- }
994
- />
1028
+ // #12401 (SEC-12403-3) — the wrapper names the header's
1029
+ // source, `record` with its version or `files`, so the
1030
+ // import (#12403) can prove which one a site renders;
1031
+ // `contents` adds no box.
1032
+ pageChrome.header === "none" ? undefined : (
1033
+ <div
1034
+ className="contents"
1035
+ data-nav-source={recordNavigation ? "record" : "files"}
1036
+ {...(recordNavigation
1037
+ ? { "data-nav-version": String(recordNavigation.version) }
1038
+ : {})}
1039
+ >
1040
+ {bareBackLink ? (
1041
+ <Nav {...navProps} navItems={[]} bar="bare" backLink={bareBackLink} />
1042
+ ) : (
1043
+ <Nav
1044
+ {...navProps}
1045
+ navItems={
1046
+ siteChrome.nav === "mark-only" &&
1047
+ (session !== null ||
1048
+ pageChrome.header === "bare" ||
1049
+ pageChrome.headerFromTemplate)
1050
+ ? []
1051
+ : publicNavItems
1052
+ }
1053
+ />
1054
+ )}
1055
+ </div>
995
1056
  )
996
1057
  }
997
1058
  footer={
@@ -161,8 +161,9 @@ describe("the llms.txt heading — a hub-connected site's name (#11456 D4, AC-2)
161
161
  body: { identity: { kind: "Organization", name, url: "https://elsewhere.example" }, seo: null },
162
162
  });
163
163
 
164
- // #11515 — hub-connected is a spoke key on the wire alone, so these cases
165
- // run a file-content site (CONTENT_ADAPTER unset).
164
+ // #11515 — hub-connected is a spoke key on the wire, or (#12390) an API
165
+ // address with no key, whatever the content adapter, so these cases run a
166
+ // file-content site (CONTENT_ADAPTER unset).
166
167
  beforeEach(() => {
167
168
  delete process.env.CONTENT_ADAPTER;
168
169
  process.env.NEXT_PUBLIC_BASE_URL = BASE;
@@ -191,10 +192,19 @@ describe("the llms.txt heading — a hub-connected site's name (#11456 D4, AC-2)
191
192
  expect(text.split("\n")[1]).toBe("");
192
193
  });
193
194
 
195
+ // #12390 D2, AC-6 — a single-tenant site (its own API's address, no key)
196
+ // reads its workspace's name too.
197
+ it("carries the workspace name on a site with no spoke key and an API address", async () => {
198
+ mockSiteConfigGet.mockResolvedValue(identity("Solo Co"));
199
+ expect((await llms("../route", PUBLIC_ROWS)).split("\n")[0]).toBe("# Solo Co — content index");
200
+ expect(mockSiteConfigGet).toHaveBeenCalled();
201
+ });
202
+
194
203
  it.each([
195
204
  ["CONTENT_ADAPTER unset", () => undefined],
196
205
  ["CONTENT_ADAPTER=database", () => (process.env.CONTENT_ADAPTER = "database")],
197
- ])("carries SITE_NAME with no AILK_SPOKE_KEY (%s), and never calls the hub", async (_label, arrange) => {
206
+ ])("carries SITE_NAME with no AILK_SPOKE_KEY and no API address (%s), and never calls the hub", async (_label, arrange) => {
207
+ delete process.env.AILK_API_URL;
198
208
  arrange();
199
209
  mockSiteConfigGet.mockResolvedValue(identity("Hub Co"));
200
210
  const { SITE_NAME } = jest.requireActual<typeof import("../../../lib/site-brand")>("../../../lib/site-brand");