create-ailk 0.38.0 → 0.39.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 (135) hide show
  1. package/dist/add-route.js +1 -1
  2. package/dist/derive-architecture.js +3 -1
  3. package/dist/remove-module.js +18 -14
  4. package/dist/routes.d.ts +29 -2
  5. package/dist/routes.js +269 -23
  6. package/dist/site-manifest.js +6 -4
  7. package/dist/site-roster.d.ts +11 -3
  8. package/dist/site-roster.js +42 -22
  9. package/dist/surfaces.d.ts +11 -3
  10. package/dist/surfaces.js +69 -22
  11. package/dist/sync-routes.js +22 -5
  12. package/dist/template-record.js +3 -1
  13. package/dist/topology.d.ts +11 -0
  14. package/dist/topology.js +253 -3
  15. package/package.json +3 -3
  16. package/templates/apps/web/CLAUDE.md +26 -4
  17. package/templates/apps/web/__tests__/__mocks__/next-intl-server.ts +5 -1
  18. package/templates/apps/web/__tests__/__mocks__/next-intl.ts +5 -1
  19. package/templates/apps/web/__tests__/auth/seam.test.ts +34 -0
  20. package/templates/apps/web/account.config.tsx +2 -3
  21. package/templates/apps/web/app/[locale]/(authed)/account/connect/__tests__/page.test.tsx +1 -1
  22. package/templates/apps/web/app/[locale]/(authed)/account/connect/page.tsx +1 -1
  23. package/templates/apps/web/app/[locale]/(authed)/signed-out-gate.generated.tsx +1 -1
  24. package/templates/apps/web/app/[locale]/layout.tsx +1 -1
  25. package/templates/apps/web/auth.config.tsx +107 -0
  26. package/templates/apps/web/auth.ts +2 -1
  27. package/templates/apps/web/i18n/request.ts +9 -2
  28. package/templates/apps/web/jest.config.cjs +4 -0
  29. package/templates/apps/web/lib/__tests__/fixtures/site-topology.ts +3 -0
  30. package/templates/apps/web/lib/__tests__/server-api.test.ts +1 -1
  31. package/templates/apps/web/lib/server-api.ts +1 -1
  32. package/templates/apps/web/lib/topology.generated.ts +5 -0
  33. package/templates/apps/web/messages/en.json +0 -152
  34. package/templates/apps/web/middleware.ts +12 -25
  35. package/templates/apps/web/next.config.mjs +8 -0
  36. package/templates/apps/web/package.json +1 -0
  37. package/templates/apps/web/types/messages.d.ts +6 -1
  38. package/versions.json +49 -48
  39. package/templates/apps/web/app/[locale]/(auth)/__tests__/auth-pages.test.tsx +0 -322
  40. package/templates/apps/web/app/[locale]/(auth)/__tests__/password-reset.test.tsx +0 -554
  41. package/templates/apps/web/app/[locale]/(auth)/consent/__tests__/consent-actions.test.ts +0 -56
  42. package/templates/apps/web/app/[locale]/(auth)/consent/__tests__/page.test.tsx +0 -164
  43. package/templates/apps/web/app/[locale]/(auth)/consent/consent-form.tsx +0 -132
  44. package/templates/apps/web/app/[locale]/(auth)/consent/consent.actions.ts +0 -51
  45. package/templates/apps/web/app/[locale]/(auth)/consent/page.tsx +0 -144
  46. package/templates/apps/web/app/[locale]/(auth)/forgot-password/forgot-password-card.tsx +0 -101
  47. package/templates/apps/web/app/[locale]/(auth)/forgot-password/page.tsx +0 -111
  48. package/templates/apps/web/app/[locale]/(auth)/layout.tsx +0 -81
  49. package/templates/apps/web/app/[locale]/(auth)/legal-footnote.tsx +0 -35
  50. package/templates/apps/web/app/[locale]/(auth)/reset-password/__tests__/return.test.tsx +0 -179
  51. package/templates/apps/web/app/[locale]/(auth)/reset-password/page.tsx +0 -157
  52. package/templates/apps/web/app/[locale]/(auth)/reset-password/reset-password-card.tsx +0 -126
  53. package/templates/apps/web/app/[locale]/(auth)/sign-in/__tests__/next-path.test.ts +0 -54
  54. package/templates/apps/web/app/[locale]/(auth)/sign-in/__tests__/page.test.tsx +0 -628
  55. package/templates/apps/web/app/[locale]/(auth)/sign-in/__tests__/remembered-method.test.ts +0 -43
  56. package/templates/apps/web/app/[locale]/(auth)/sign-in/__tests__/sign-in-card.test.tsx +0 -266
  57. package/templates/apps/web/app/[locale]/(auth)/sign-in/next-path.ts +0 -20
  58. package/templates/apps/web/app/[locale]/(auth)/sign-in/page.tsx +0 -234
  59. package/templates/apps/web/app/[locale]/(auth)/sign-in/remembered-method.ts +0 -37
  60. package/templates/apps/web/app/[locale]/(auth)/sign-in/sign-in-card.tsx +0 -323
  61. package/templates/apps/web/app/[locale]/(auth)/sign-in/sign-in-text.ts +0 -93
  62. package/templates/apps/web/app/[locale]/(auth)/sign-up/__tests__/page.test.tsx +0 -301
  63. package/templates/apps/web/app/[locale]/(auth)/sign-up/__tests__/sign-up-card.test.tsx +0 -309
  64. package/templates/apps/web/app/[locale]/(auth)/sign-up/page.tsx +0 -201
  65. package/templates/apps/web/app/[locale]/(auth)/sign-up/sign-up-card.tsx +0 -366
  66. package/templates/apps/web/app/[locale]/(auth)/use-auth-card-flow.ts +0 -116
  67. package/templates/apps/web/app/[locale]/(auth)/verify-email/__tests__/actions.test.ts +0 -94
  68. package/templates/apps/web/app/[locale]/(auth)/verify-email/actions.ts +0 -77
  69. package/templates/apps/web/app/[locale]/(auth)/verify-email/page.tsx +0 -154
  70. package/templates/apps/web/app/[locale]/(authed)/account/appointments/[slug]/page.tsx +0 -3
  71. package/templates/apps/web/app/[locale]/(authed)/account/appointments/page.tsx +0 -3
  72. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/[pieceId]/page.tsx +0 -3
  73. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/[pieceId]/versions/[version]/file/route.ts +0 -2
  74. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/page.tsx +0 -3
  75. package/templates/apps/web/app/[locale]/(authed)/account/billing/page.tsx +0 -12
  76. package/templates/apps/web/app/[locale]/(authed)/account/general/page.tsx +0 -12
  77. package/templates/apps/web/app/[locale]/(authed)/account/inbox/[kind]/[id]/page.tsx +0 -12
  78. package/templates/apps/web/app/[locale]/(authed)/account/inbox/message/[id]/file/route.ts +0 -2
  79. package/templates/apps/web/app/[locale]/(authed)/account/inbox/thread/page.tsx +0 -12
  80. package/templates/apps/web/app/[locale]/(authed)/account/invitations/[invitationId]/page.tsx +0 -3
  81. package/templates/apps/web/app/[locale]/(authed)/account/layout.tsx +0 -10
  82. package/templates/apps/web/app/[locale]/(authed)/account/notifications/page.tsx +0 -3
  83. package/templates/apps/web/app/[locale]/(authed)/account/onboarding/page.tsx +0 -3
  84. package/templates/apps/web/app/[locale]/(authed)/account/page.tsx +0 -12
  85. package/templates/apps/web/app/[locale]/(authed)/account/privacy/export/route.ts +0 -2
  86. package/templates/apps/web/app/[locale]/(authed)/account/privacy/page.tsx +0 -3
  87. package/templates/apps/web/app/[locale]/(authed)/account/security/page.tsx +0 -3
  88. package/templates/apps/web/app/[locale]/(authed)/account/settings/page.tsx +0 -2
  89. package/templates/apps/web/app/[locale]/(authed)/account/support/page.tsx +0 -3
  90. package/templates/apps/web/app/api/auth/[...all]/route.ts +0 -16
  91. package/templates/apps/web/app/api/auth/hub/__tests__/continuation.test.ts +0 -143
  92. package/templates/apps/web/app/api/auth/hub/__tests__/entry-routes.test.ts +0 -749
  93. package/templates/apps/web/app/api/auth/hub/authorize/__tests__/route.test.ts +0 -964
  94. package/templates/apps/web/app/api/auth/hub/authorize/route.ts +0 -390
  95. package/templates/apps/web/app/api/auth/hub/continuation.ts +0 -127
  96. package/templates/apps/web/app/api/auth/hub/continue/[ref]/__tests__/route.test.ts +0 -188
  97. package/templates/apps/web/app/api/auth/hub/continue/[ref]/route.ts +0 -53
  98. package/templates/apps/web/app/api/auth/hub/email/route.ts +0 -111
  99. package/templates/apps/web/app/api/auth/hub/entry-shared.ts +0 -163
  100. package/templates/apps/web/app/api/auth/hub/password/__tests__/return.test.ts +0 -86
  101. package/templates/apps/web/app/api/auth/hub/password/__tests__/route.test.ts +0 -368
  102. package/templates/apps/web/app/api/auth/hub/password/return.ts +0 -86
  103. package/templates/apps/web/app/api/auth/hub/password/route.ts +0 -171
  104. package/templates/apps/web/app/api/auth/hub/purchase/route.ts +0 -230
  105. package/templates/apps/web/app/api/auth/hub/purchase-link/route.ts +0 -174
  106. package/templates/apps/web/app/api/auth/hub/sign-up/route.ts +0 -60
  107. package/templates/apps/web/app/api/auth/hub/sign-up-evidence.ts +0 -97
  108. package/templates/apps/web/app/api/auth/mcp/__tests__/continuation.test.ts +0 -92
  109. package/templates/apps/web/app/api/auth/mcp/continuation.ts +0 -89
  110. package/templates/apps/web/app/api/auth/mcp/continue/[ref]/__tests__/route.test.ts +0 -59
  111. package/templates/apps/web/app/api/auth/mcp/continue/[ref]/route.ts +0 -41
  112. package/templates/apps/web/app/api/hub-session/__tests__/routes.test.ts +0 -1166
  113. package/templates/apps/web/app/api/hub-session/callback/route.ts +0 -134
  114. package/templates/apps/web/app/api/hub-session/email/route.ts +0 -125
  115. package/templates/apps/web/app/api/hub-session/one-tap/nonce/route.ts +0 -49
  116. package/templates/apps/web/app/api/hub-session/one-tap/route.ts +0 -106
  117. package/templates/apps/web/app/api/hub-session/open/route.ts +0 -111
  118. package/templates/apps/web/app/api/hub-session/password/return/route.ts +0 -69
  119. package/templates/apps/web/app/api/hub-session/password/route.ts +0 -106
  120. package/templates/apps/web/app/api/hub-session/sign-in/route.ts +0 -91
  121. package/templates/apps/web/app/api/hub-session/sign-out/route.ts +0 -54
  122. package/templates/apps/web/components/sign-out-trigger.tsx +0 -62
  123. package/templates/apps/web/lib/__tests__/auth-routes.test.ts +0 -140
  124. package/templates/apps/web/lib/auth-routes.ts +0 -125
  125. package/templates/apps/web/lib/hub-session/__tests__/hub-session.test.ts +0 -433
  126. package/templates/apps/web/lib/hub-session/__tests__/spoke-sign-in.test.tsx +0 -332
  127. package/templates/apps/web/lib/hub-session/config.ts +0 -110
  128. package/templates/apps/web/lib/hub-session/entry.ts +0 -238
  129. package/templates/apps/web/lib/hub-session/index.ts +0 -21
  130. package/templates/apps/web/lib/hub-session/one-tap.tsx +0 -148
  131. package/templates/apps/web/lib/hub-session/reseal.ts +0 -90
  132. package/templates/apps/web/lib/hub-session/seal.ts +0 -86
  133. package/templates/apps/web/lib/hub-session/session.ts +0 -298
  134. package/templates/apps/web/lib/hub-session/spoke-sign-in.tsx +0 -277
  135. package/templates/apps/web/lib/next-path.ts +0 -35
@@ -89,11 +89,13 @@ export function planSiteManifest(opts) {
89
89
  // #10774 D4.2 — the template's own code-route rows a spoke does not serve
90
90
  // (`/sign-in`, `/sign-up`) leave with the files the spoke filter dropped.
91
91
  const planned = plan.next ?? roster.text;
92
- const appended = withoutUnservedRouteRows(parseRosterFile(planned, roster.path), opts.targetDir, opts.topology).next ?? planned;
92
+ const appended = withoutUnservedRouteRows(parseRosterFile(planned, roster.path), opts.targetDir, opts.topology, opts.signIn).next ?? planned;
93
93
  const declared = new Set(JSON.parse(appended).rows.map((row) => row["route"]));
94
94
  const extra = [
95
95
  ...sampleRows(opts, declared),
96
- ...codeRouteRows(opts.targetDir, declared),
96
+ ...codeRouteRows(opts.targetDir, declared, opts.topology === "spoke"
97
+ ? { mcp: true, signIn: opts.signIn ?? "off" }
98
+ : null),
97
99
  ];
98
100
  const withRows = appendRows(appended, extra, roster);
99
101
  return insertRecord(withRows, opts, roster.path);
@@ -225,8 +227,8 @@ function sampleRows(opts, declared) {
225
227
  return out;
226
228
  }
227
229
  /** A code-route row for every page route on disk that `declared` does not name. */
228
- function codeRouteRows(targetDir, declared) {
229
- return servedRoutes(targetDir)
230
+ function codeRouteRows(targetDir, declared, spoke) {
231
+ return servedRoutes(targetDir, spoke)
230
232
  .filter((route) => !declared.has(route))
231
233
  .map((route) => ({ route, ...CODE_ROUTE_ROW }));
232
234
  }
@@ -6,7 +6,7 @@ import type { ModuleName } from "./parse-args.js";
6
6
  import type { ResolvedSiteChrome } from "./site-chrome.js";
7
7
  import { type MarkerMap } from "./substitute.js";
8
8
  import { type TemplateManifest } from "./template-manifest.js";
9
- import { type Topology } from "./topology.js";
9
+ import { type SignInMode, type SpokeShapeOptions, type Topology } from "./topology.js";
10
10
  /** The site-root file that is the roster of record (#6658 D7). */
11
11
  export declare const SITE_ROSTER_PATH = ".ailk-site-manifest.json";
12
12
  /**
@@ -189,14 +189,22 @@ export declare function planRosterAppend(opts: PlanRosterAppendOptions): RosterA
189
189
  * its parent (docs-blog's `/blog/[[...slug]]` serves `/blog`). The root
190
190
  * content renderers (`/[slug]`, `/[slug]/[detail]`) are not routes of their
191
191
  * own — they are how the content rows render — so they are left out.
192
+ *
193
+ * #11259 D6 — a page a carried page package ships (`PAGE_PACKAGE_ROUTES`
194
+ * `pages`) is served too, unless the site is a spoke that does not carry its
195
+ * path: the snapshot holds none of a package's generated route files, which
196
+ * `create-ailk routes --write` writes after the install. `spoke` is the
197
+ * site's spoke shape — `null` on a hub, read from the site when omitted.
192
198
  */
193
- export declare function servedRoutes(targetDir: string): string[];
199
+ export declare function servedRoutes(targetDir: string, spoke?: SpokeShapeOptions | null): string[];
200
+ /** The dependency and devDependency names of the site's `apps/web/package.json`; empty when it has none. */
201
+ export declare function webDependencies(targetDir: string): Set<string>;
194
202
  /**
195
203
  * `file`'s next text with its unserved code-route rows removed — every other
196
204
  * byte verbatim — and the dropped routes in file order; `next` is undefined
197
205
  * when none is dropped.
198
206
  */
199
- export declare function withoutUnservedRouteRows(file: RosterFile, targetDir: string, topology?: Topology): {
207
+ export declare function withoutUnservedRouteRows(file: RosterFile, targetDir: string, topology?: Topology, signIn?: SignInMode): {
200
208
  next: string | undefined;
201
209
  dropped: string[];
202
210
  };
@@ -36,9 +36,9 @@ import { diffTwoStrings } from "./lib/extract-module-bundle.js";
36
36
  import { publicTreeRemoved } from "./lib/site-modules.js";
37
37
  import { MODULE_SLICES, normalizeModules, } from "./module-architecture.js";
38
38
  import { substituteMarkers } from "./substitute.js";
39
- import { isUnservedSurfaceContent, pagePackageOfRoute, resolveSurfaces } from "./surfaces.js";
39
+ import { isUnservedSurfaceContent, PAGE_PACKAGE_ROUTES, pagePackageOfRoute, resolveSurfaces } from "./surfaces.js";
40
40
  import { BASE_LAYER_DIR, SHAPE_STARTERS, TEMPLATE_MANIFESTS, resolveTemplate, rosterDeclares, shippedManifestPath, templateTreeDir, } from "./template-manifest.js";
41
- import { readSiteTopology, SPOKE_REMOVAL_SEEDS } from "./topology.js";
41
+ import { isSpokeExcluded, readSpokeShape, } from "./topology.js";
42
42
  /** The site-root file that is the roster of record (#6658 D7). */
43
43
  export const SITE_ROSTER_PATH = ".ailk-site-manifest.json";
44
44
  /**
@@ -635,29 +635,49 @@ function spliceRows(file, rows) {
635
635
  * its parent (docs-blog's `/blog/[[...slug]]` serves `/blog`). The root
636
636
  * content renderers (`/[slug]`, `/[slug]/[detail]`) are not routes of their
637
637
  * own — they are how the content rows render — so they are left out.
638
+ *
639
+ * #11259 D6 — a page a carried page package ships (`PAGE_PACKAGE_ROUTES`
640
+ * `pages`) is served too, unless the site is a spoke that does not carry its
641
+ * path: the snapshot holds none of a package's generated route files, which
642
+ * `create-ailk routes --write` writes after the install. `spoke` is the
643
+ * site's spoke shape — `null` on a hub, read from the site when omitted.
638
644
  */
639
- export function servedRoutes(targetDir) {
645
+ export function servedRoutes(targetDir, spoke) {
640
646
  const root = join(targetDir, ROUTE_ROOT);
647
+ if (!existsSync(root))
648
+ return [];
641
649
  const routes = new Set();
642
- const stack = existsSync(root) ? [root] : [];
650
+ const add = (dir) => {
651
+ const segments = dir
652
+ .split(/[\\/]/)
653
+ .filter((segment) => segment !== "" && !/^\(.+\)$/.test(segment));
654
+ const last = segments[segments.length - 1];
655
+ if (last !== undefined && /^\[\[\.\.\..+\]\]$/.test(last))
656
+ segments.pop();
657
+ if (segments[0]?.startsWith("["))
658
+ return;
659
+ routes.add(`/${segments.join("/")}`);
660
+ };
661
+ const stack = [root];
643
662
  for (let cur = stack.pop(); cur !== undefined; cur = stack.pop()) {
644
663
  const entries = readdirSync(cur, { withFileTypes: true });
645
664
  for (const entry of entries) {
646
665
  if (entry.isDirectory())
647
666
  stack.push(join(cur, entry.name));
648
667
  }
649
- if (!entries.some((entry) => entry.isFile() && PAGE_FILE.test(entry.name))) {
650
- continue;
668
+ if (entries.some((entry) => entry.isFile() && PAGE_FILE.test(entry.name))) {
669
+ add(relative(root, cur));
651
670
  }
652
- const segments = relative(root, cur)
653
- .split(sep)
654
- .filter((segment) => segment !== "" && !/^\(.+\)$/.test(segment));
655
- const last = segments[segments.length - 1];
656
- if (last !== undefined && /^\[\[\.\.\..+\]\]$/.test(last))
657
- segments.pop();
658
- if (segments[0]?.startsWith("["))
671
+ }
672
+ const carried = webDependencies(targetDir);
673
+ const shape = spoke === undefined ? readSpokeShape(targetDir) : spoke;
674
+ for (const row of PAGE_PACKAGE_ROUTES) {
675
+ if (!carried.has(row.package))
659
676
  continue;
660
- routes.add(`/${segments.join("/")}`);
677
+ for (const page of row.pages) {
678
+ if (!shape || !isSpokeExcluded(`apps/web/app/[locale]/${page}`, shape))
679
+ add(page);
680
+ }
661
681
  }
662
682
  return [...routes].sort();
663
683
  }
@@ -668,11 +688,12 @@ export function servedRoutes(targetDir) {
668
688
  * dynamic is never judged either: the root renderers are not in
669
689
  * `servedRoutes`.
670
690
  */
671
- function unservedRouteRow(targetDir, topology) {
691
+ function unservedRouteRow(targetDir, topology, signIn) {
672
692
  if (!existsSync(join(targetDir, ROUTE_ROOT)))
673
693
  return undefined;
674
- const spoke = (topology ?? readSiteTopology(targetDir)) === "spoke";
675
- const served = new Set(servedRoutes(targetDir));
694
+ // The spoke shape `planSiteManifest` passes `codeRouteRows`, so the two agree.
695
+ const shape = topology === undefined ? readSpokeShape(targetDir) : topology === "spoke" ? { mcp: true, signIn: signIn ?? "off" } : undefined;
696
+ const served = new Set(servedRoutes(targetDir, shape ?? null));
676
697
  const carried = webDependencies(targetDir);
677
698
  return (row) => {
678
699
  const route = row["route"];
@@ -686,12 +707,11 @@ function unservedRouteRow(targetDir, topology) {
686
707
  const pkg = pagePackageOfRoute(route.slice(1));
687
708
  if (pkg === undefined || !carried.has(pkg))
688
709
  return true;
689
- const sitePath = `apps/web/app/[locale]${route}`;
690
- return spoke && SPOKE_REMOVAL_SEEDS.some((seed) => sitePath === seed || sitePath.startsWith(`${seed}/`));
710
+ return shape !== undefined && isSpokeExcluded(`apps/web/app/[locale]${route}`, shape);
691
711
  };
692
712
  }
693
713
  /** The dependency and devDependency names of the site's `apps/web/package.json`; empty when it has none. */
694
- function webDependencies(targetDir) {
714
+ export function webDependencies(targetDir) {
695
715
  try {
696
716
  const pkg = JSON.parse(readFileSync(join(targetDir, "apps", "web", "package.json"), "utf8"));
697
717
  // The route generator's own reading (`readRouteManifests`): both lists.
@@ -706,8 +726,8 @@ function webDependencies(targetDir) {
706
726
  * byte verbatim — and the dropped routes in file order; `next` is undefined
707
727
  * when none is dropped.
708
728
  */
709
- export function withoutUnservedRouteRows(file, targetDir, topology) {
710
- const unserved = unservedRouteRow(targetDir, topology);
729
+ export function withoutUnservedRouteRows(file, targetDir, topology, signIn) {
730
+ const unserved = unservedRouteRow(targetDir, topology, signIn);
711
731
  const dropped = file.rows.filter((row) => unserved?.(row.value) === true);
712
732
  if (dropped.length === 0)
713
733
  return { next: undefined, dropped: [] };
@@ -36,14 +36,20 @@ export declare function isRemovedPublicRoutePath(destRel: string): boolean;
36
36
  * generator writes, checks and records those files, never the route copier.
37
37
  * A `siteOwned` route under the prefix stays the site's own page (one the
38
38
  * package leaves to a later slice) and `sync-routes` keeps it in scope. One
39
- * entry per page package, mirroring its `routes.json` (`prefix`, and each
40
- * `siteOwned` routing file's directory); `sync-routes.test.ts` pins
41
- * `@working-theory/account`'s to the package's manifest.
39
+ * entry per prefix of a page package, mirroring its `routes.json` (`prefix`,
40
+ * each `siteOwned` routing file's directory, and in `pages` each locale-mount
41
+ * page entry's directory under the prefix); `sync-routes.test.ts` pins every
42
+ * row to its package's manifest.
43
+ *
44
+ * `pages` is what a scaffold serves before the package is installed (#11259
45
+ * D6): the snapshot carries none of a page package's generated route files, so
46
+ * the site roster (`servedRoutes`) reads a carried package's pages here.
42
47
  */
43
48
  export declare const PAGE_PACKAGE_ROUTES: readonly {
44
49
  package: string;
45
50
  prefix: string;
46
51
  siteOwned: readonly string[];
52
+ pages: readonly string[];
47
53
  }[];
48
54
  /** The page package that ships `route` (a ROUTE_ROOT-relative dir), or `undefined` when no page package does. */
49
55
  export declare function pagePackageOfRoute(route: string): string | undefined;
@@ -103,6 +109,8 @@ export declare const SURFACE_ALIASES: Readonly<Record<string, string>>;
103
109
  * is copied regardless.
104
110
  */
105
111
  export declare const CORE_PROMOTED_SURFACES: ReadonlySet<string>;
112
+ /** Canonical id for a `--surfaces` value, resolving a retired alias. */
113
+ export declare function canonicalizeSurface(s: string): string;
106
114
  /**
107
115
  * Surfaces each recognized module contributes.
108
116
  *
package/dist/surfaces.js CHANGED
@@ -95,27 +95,78 @@ export function isRemovedPublicRoutePath(destRel) {
95
95
  * generator writes, checks and records those files, never the route copier.
96
96
  * A `siteOwned` route under the prefix stays the site's own page (one the
97
97
  * package leaves to a later slice) and `sync-routes` keeps it in scope. One
98
- * entry per page package, mirroring its `routes.json` (`prefix`, and each
99
- * `siteOwned` routing file's directory); `sync-routes.test.ts` pins
100
- * `@working-theory/account`'s to the package's manifest.
98
+ * entry per prefix of a page package, mirroring its `routes.json` (`prefix`,
99
+ * each `siteOwned` routing file's directory, and in `pages` each locale-mount
100
+ * page entry's directory under the prefix); `sync-routes.test.ts` pins every
101
+ * row to its package's manifest.
102
+ *
103
+ * `pages` is what a scaffold serves before the package is installed (#11259
104
+ * D6): the snapshot carries none of a page package's generated route files, so
105
+ * the site roster (`servedRoutes`) reads a carried package's pages here.
101
106
  */
102
107
  export const PAGE_PACKAGE_ROUTES = [
103
- { package: "@working-theory/account", prefix: "(authed)/account", siteOwned: ["(authed)/account/connect"] },
108
+ {
109
+ package: "@working-theory/account",
110
+ prefix: "(authed)/account",
111
+ siteOwned: ["(authed)/account/connect"],
112
+ pages: [
113
+ "(authed)/account/appointments/[slug]",
114
+ "(authed)/account/appointments",
115
+ "(authed)/account/artifacts/[pieceId]",
116
+ "(authed)/account/artifacts",
117
+ "(authed)/account/billing",
118
+ "(authed)/account/general",
119
+ "(authed)/account/inbox/[kind]/[id]",
120
+ "(authed)/account/inbox/thread",
121
+ "(authed)/account/invitations/[invitationId]",
122
+ "(authed)/account/notifications",
123
+ "(authed)/account/onboarding",
124
+ "(authed)/account",
125
+ "(authed)/account/privacy",
126
+ "(authed)/account/security",
127
+ "(authed)/account/settings",
128
+ "(authed)/account/support",
129
+ ],
130
+ },
131
+ // #11257 — the sign-in pages; the snapshot carries none of them (#11259 D6).
132
+ {
133
+ package: "@working-theory/auth",
134
+ prefix: "(auth)",
135
+ siteOwned: [],
136
+ pages: [
137
+ "(auth)/consent",
138
+ "(auth)/forgot-password",
139
+ "(auth)/reset-password",
140
+ "(auth)/sign-in",
141
+ "(auth)/sign-up",
142
+ "(auth)/verify-email",
143
+ ],
144
+ },
104
145
  // #11251 — the flows pages; the snapshot carries none of the tree, so a
105
146
  // scaffold has its route files only once the package is installed.
106
- { package: "@working-theory/ui-signal-collectors", prefix: "flows", siteOwned: [] },
147
+ {
148
+ package: "@working-theory/ui-signal-collectors",
149
+ prefix: "flows",
150
+ siteOwned: [],
151
+ pages: ["flows/[slug]", "flows/[slug]/start", "flows/[slug]/verify", "flows/[slug]/results/[payload]"],
152
+ },
107
153
  // #11252 — the booking pages; likewise absent from the snapshot. One entry
108
154
  // per prefix of the package's two-prefix manifest.
109
- { package: "@working-theory/ui-scheduling", prefix: "meet", siteOwned: [] },
110
- { package: "@working-theory/ui-scheduling", prefix: "private", siteOwned: [] },
155
+ { package: "@working-theory/ui-scheduling", prefix: "meet", siteOwned: [], pages: ["meet", "meet/[slug]", "meet/confirmed"] },
156
+ { package: "@working-theory/ui-scheduling", prefix: "private", siteOwned: [], pages: ["private"] },
111
157
  // #11253 — the checkout and purchase return pages; likewise absent from the
112
158
  // snapshot, one entry per prefix of the package's two-prefix manifest.
113
- { package: "@working-theory/ui-commerce", prefix: "checkout", siteOwned: [] },
114
- { package: "@working-theory/ui-commerce", prefix: "purchase", siteOwned: [] },
159
+ {
160
+ package: "@working-theory/ui-commerce",
161
+ prefix: "checkout",
162
+ siteOwned: [],
163
+ pages: ["checkout/thank-you", "checkout/unavailable"],
164
+ },
165
+ { package: "@working-theory/ui-commerce", prefix: "purchase", siteOwned: [], pages: ["purchase/success", "purchase/cancel"] },
115
166
  // #11254 — the docs and blog catch-alls; likewise absent from the snapshot,
116
167
  // one entry per prefix of the package's two-prefix manifest.
117
- { package: "@working-theory/ui-docs-blog", prefix: "docs", siteOwned: [] },
118
- { package: "@working-theory/ui-docs-blog", prefix: "blog", siteOwned: [] },
168
+ { package: "@working-theory/ui-docs-blog", prefix: "docs", siteOwned: [], pages: ["docs/[[...slug]]"] },
169
+ { package: "@working-theory/ui-docs-blog", prefix: "blog", siteOwned: [], pages: ["blog/[[...slug]]"] },
119
170
  ];
120
171
  /** The page package that ships `route` (a ROUTE_ROOT-relative dir), or `undefined` when no page package does. */
121
172
  export function pagePackageOfRoute(route) {
@@ -430,7 +481,7 @@ export const SURFACE_ALIASES = {
430
481
  // accept-and-drop read sites stay in place for the next promotion.
431
482
  export const CORE_PROMOTED_SURFACES = new Set([]);
432
483
  /** Canonical id for a `--surfaces` value, resolving a retired alias. */
433
- function canonicalizeSurface(s) {
484
+ export function canonicalizeSurface(s) {
434
485
  return SURFACE_ALIASES[s] ?? s;
435
486
  }
436
487
  /**
@@ -948,15 +999,12 @@ export const ROUTE_DEPENDENCIES = {
948
999
  // `siteLogo()` — which lives in `site-logo.tsx` since #6820 and reads the
949
1000
  // raw mark + name from `site-brand.tsx`, so BOTH files travel with the
950
1001
  // group — and the LOCALE layout above it branches on `isAuthPath()` to drop
951
- // the marketing chrome for these five paths: without `auth-routes.ts` a
952
- // synced group renders inside the Nav + Footer it exists to replace. The
953
- // sign-in page no longer imports `site-brand` — the mark is the shell's
954
- // since #5963 — so its own list is just the env reader.
955
- "(auth)": [
956
- "apps/web/lib/site-brand.tsx",
957
- "apps/web/lib/site-logo.tsx",
958
- "apps/web/lib/auth-routes.ts",
959
- ],
1002
+ // the marketing chrome for these five paths. Since #11257 the predicate is
1003
+ // `@working-theory/auth/edge`'s and the group's files are generated, so no
1004
+ // site lib travels for it. The sign-in page no longer imports `site-brand`
1005
+ // — the mark is the shell's since #5963 — so its own list is just the env
1006
+ // reader.
1007
+ "(auth)": ["apps/web/lib/site-brand.tsx", "apps/web/lib/site-logo.tsx"],
960
1008
  "(auth)/sign-in": ["apps/web/lib/auth-env.ts"],
961
1009
  // #10051 D9 — the /templates hub imports the route-family helper and the
962
1010
  // template-listing mapping, its detail route the mapping; each lists both
@@ -978,7 +1026,6 @@ export const ROUTE_DEPENDENCIES = {
978
1026
  "(authed)": [
979
1027
  "apps/web/auth.ts",
980
1028
  "apps/web/lib/auth-env.ts",
981
- "apps/web/lib/auth-routes.ts",
982
1029
  "apps/web/lib/sign-up-agreements.ts",
983
1030
  ],
984
1031
  "(authed)/admin": [
@@ -56,6 +56,7 @@ import { SPOKE_BILLING_ACTION_PATH } from "./derive-architecture.js";
56
56
  import { appendEnvRows } from "./lib/declared-env.js";
57
57
  import { ENV_CATALOG } from "./lib/env-catalog.js";
58
58
  import { publicTreeRemoved } from "./lib/site-modules.js";
59
+ import { readRouteManifests } from "./routes.js";
59
60
  import { BILLING_ACTION, BILLING_ACTION_MARKER, RETIRED_CHECKOUT_E2E_MARKER, RETIRED_CHECKOUT_E2E_WORKFLOW_PATH, RETIRED_SPOKE_CHECKOUT_PATHS, } from "./spoke-checkout.js";
60
61
  import { GATEABLE_SURFACES, HUB_KEPT_ROUTE_DIRS, NON_ROUTE_DIRS, pagePackageOfRoute, ROUTE_DEPENDENCIES, ROUTE_MESSAGE_NAMESPACES, ROUTE_SINCE, surfaceForRouteDir, } from "./surfaces.js";
61
62
  import { TEMPLATE_RECORD_PATH, parseTemplateRecord, recordCopiedFiles, serializeTemplateRecord, sha256Hex, } from "./template-record.js";
@@ -932,13 +933,29 @@ export function syncRoutes(opts) {
932
933
  };
933
934
  }
934
935
  /**
935
- * Whether `apps/web/messages/en.json` in `targetAbs` already declares
936
- * `namespace` (a dot-path, e.g. `"waitlistDashboard.gate"`). Missing or
937
- * unparseable `messages/en.json` reads as "namespace absent" rather than
938
- * throwing — a sync check should report a gap, not crash on one.
936
+ * Whether `targetAbs` already declares `namespace` (a dot-path, e.g.
937
+ * `"waitlistDashboard.gate"`): in `apps/web/messages/en.json`, or — since a
938
+ * page package ships its own strings (ADR 0040 rule 5; #11257 D12) — in the
939
+ * `en` catalog of an installed page package (`readRouteManifests`). Missing
940
+ * or unparseable catalogs, and an unreadable manifest, read as "namespace
941
+ * absent" rather than throwing — a sync check should report a gap, not crash
942
+ * on one.
939
943
  */
940
944
  function hasMessageNamespace(targetAbs, namespace) {
941
- const messagesPath = join(targetAbs, "apps/web/messages/en.json");
945
+ const catalogs = [join(targetAbs, "apps/web/messages/en.json")];
946
+ try {
947
+ for (const manifest of readRouteManifests(targetAbs)) {
948
+ if (manifest.messages !== undefined && manifest.root !== undefined) {
949
+ catalogs.push(join(manifest.root, manifest.messages.catalog, "en.json"));
950
+ }
951
+ }
952
+ }
953
+ catch {
954
+ // An unreadable manifest is `routes --check`'s to report.
955
+ }
956
+ return catalogs.some((path) => catalogHasNamespace(path, namespace));
957
+ }
958
+ function catalogHasNamespace(messagesPath, namespace) {
942
959
  if (!existsSync(messagesPath))
943
960
  return false;
944
961
  try {
@@ -25,7 +25,7 @@ import { SITE_FONTS_PATH } from "./site-fonts.js";
25
25
  import { SITE_LISTING_PATH } from "./site-listing-path.js";
26
26
  import { SPOKE_CHECKOUT_CONFIG_PATH } from "./spoke-checkout.js";
27
27
  import { NAV_CONFIG_PATH } from "./surfaces.js";
28
- import { SPOKE_SEAM_FILES } from "./topology.js";
28
+ import { AUTH_CONFIG_PATH, SPOKE_SEAM_FILES } from "./topology.js";
29
29
  /** Where the per-file record lives, beside `.ailk-site-manifest.json`. */
30
30
  export const TEMPLATE_RECORD_PATH = ".ailk-template-files.json";
31
31
  /**
@@ -45,6 +45,8 @@ export const REGENERATED_APP_PATHS = [
45
45
  MODULE_FLAGS_PATH,
46
46
  PAID_MCP_TOOLS_PATH,
47
47
  ...SPOKE_SEAM_FILES,
48
+ // #11257 D4 — rewritten in its spoke shape on a spoke, as the seams are.
49
+ AUTH_CONFIG_PATH,
48
50
  SPOKE_CHECKOUT_CONFIG_PATH,
49
51
  SITE_LISTING_PATH,
50
52
  ];
@@ -219,6 +219,17 @@ export declare function transformAppPackageJson(text: string, label: string, req
219
219
  * @throws TopologyError naming the file whose anchor is missing.
220
220
  */
221
221
  export declare function applySpokeTransforms(targetDir: string, opts: SpokeShapeOptions): void;
222
+ /** The page-package config the sign-in package reads its services from (#11257 D4). */
223
+ export declare const AUTH_CONFIG_PATH = "apps/web/auth.config.tsx";
224
+ /**
225
+ * `apps/web/auth.config.tsx` for `topology` (#11257 D4): the hub render is
226
+ * this monorepo's file, byte for byte (`spoke-topology.test.ts` pins the
227
+ * two); the spoke render passes `hub: null` and imports none of the hub-only
228
+ * libs (`lib/auth-email.ts`, `lib/auth-secret.ts`, `lib/consent-policies.ts`).
229
+ * Neither imports `auth.ts`: Better Auth arrives through the topology seam's
230
+ * `loadAuth()`, so a spoke keeps the file and no closure removes it.
231
+ */
232
+ export declare function renderAuthConfig(topology: Topology): string;
222
233
  /** The env var a spoke reaches its hub through. */
223
234
  export declare const HUB_ORIGIN_ENV_VAR = "AILK_API_URL";
224
235
  /**