create-ailk 0.37.1 → 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 (318) hide show
  1. package/README.md +129 -0
  2. package/component-catalog.json +44 -6
  3. package/component-catalog.md +6 -5
  4. package/dist/add-module.js +16 -1
  5. package/dist/add-route.d.ts +2 -2
  6. package/dist/add-route.js +19 -12
  7. package/dist/cli.js +52 -0
  8. package/dist/declined-routes.d.ts +13 -0
  9. package/dist/declined-routes.js +74 -0
  10. package/dist/derive-architecture.d.ts +0 -6
  11. package/dist/derive-architecture.js +12 -16
  12. package/dist/index.d.ts +1 -0
  13. package/dist/index.js +3 -0
  14. package/dist/language-import.d.ts +93 -0
  15. package/dist/language-import.js +270 -43
  16. package/dist/lib/import-mdx.js +1 -1
  17. package/dist/lib/scaffold-render-sweep.d.ts +6 -3
  18. package/dist/lib/scaffold-render-sweep.js +8 -4
  19. package/dist/migrate-content.d.ts +6 -2
  20. package/dist/migrate-content.js +62 -5
  21. package/dist/module-architecture.js +139 -103
  22. package/dist/paid-sections.d.ts +13 -0
  23. package/dist/paid-sections.js +35 -5
  24. package/dist/programmatic.js +6 -16
  25. package/dist/remove-module.js +73 -2
  26. package/dist/routes.d.ts +130 -0
  27. package/dist/routes.js +954 -0
  28. package/dist/site-manifest.js +6 -4
  29. package/dist/site-roster.d.ts +11 -2
  30. package/dist/site-roster.js +63 -21
  31. package/dist/spoke-checkout.d.ts +28 -27
  32. package/dist/spoke-checkout.js +71 -102
  33. package/dist/surfaces.d.ts +26 -0
  34. package/dist/surfaces.js +105 -293
  35. package/dist/sync-routes.d.ts +14 -1
  36. package/dist/sync-routes.js +108 -10
  37. package/dist/template-record.js +3 -1
  38. package/dist/topology.d.ts +26 -1
  39. package/dist/topology.js +273 -7
  40. package/dist/update.d.ts +17 -2
  41. package/dist/update.js +480 -77
  42. package/package.json +3 -3
  43. package/templates/README.md +1 -1
  44. package/templates/apps/mcp/CLAUDE.md +5 -3
  45. package/templates/apps/web/CLAUDE.md +87 -23
  46. package/templates/apps/web/__tests__/__mocks__/next-intl-server.ts +5 -1
  47. package/templates/apps/web/__tests__/__mocks__/next-intl.ts +5 -1
  48. package/templates/apps/web/__tests__/auth/seam.test.ts +34 -0
  49. package/templates/apps/web/account.config.tsx +100 -0
  50. package/templates/apps/web/app/[locale]/(authed)/account/connect/__tests__/page.test.tsx +1 -1
  51. package/templates/apps/web/app/[locale]/(authed)/account/connect/page.tsx +2 -2
  52. package/templates/apps/web/app/[locale]/(authed)/signed-out-gate.generated.tsx +1 -1
  53. package/templates/apps/web/app/[locale]/layout.tsx +46 -29
  54. package/templates/apps/web/app/apple-icon.tsx +72 -0
  55. package/templates/apps/web/app/llms.txt/__tests__/site-listing.test.ts +22 -12
  56. package/templates/apps/web/app/og/__tests__/__snapshots__/card.test.tsx.snap +3 -0
  57. package/templates/apps/web/app/og/__tests__/card.test.tsx +129 -0
  58. package/templates/apps/web/app/og/__tests__/route.test.ts +3 -4
  59. package/templates/apps/web/app/og/route.tsx +155 -72
  60. package/templates/apps/web/app/sitemap.xml/__tests__/site-listing.test.ts +12 -0
  61. package/templates/apps/web/auth.config.tsx +107 -0
  62. package/templates/apps/web/auth.ts +2 -1
  63. package/templates/apps/web/i18n/request.ts +51 -1
  64. package/templates/apps/web/jest.config.cjs +17 -1
  65. package/templates/apps/web/lib/__tests__/auth-phone.test.ts +11 -0
  66. package/templates/apps/web/lib/__tests__/fixtures/site-topology.ts +73 -0
  67. package/templates/apps/web/lib/__tests__/nav-label-keys.test.ts +14 -0
  68. package/templates/apps/web/lib/__tests__/profile-back-link.test.ts +148 -61
  69. package/templates/apps/web/lib/__tests__/served-pages.test.ts +77 -0
  70. package/templates/apps/web/lib/__tests__/server-api.test.ts +37 -5
  71. package/templates/apps/web/lib/__tests__/structured-data.test.tsx +26 -13
  72. package/templates/apps/web/lib/listings.tsx +2 -2
  73. package/templates/apps/web/lib/nav-label-keys.ts +16 -2
  74. package/templates/apps/web/lib/paid-section-contracts.ts +35 -6
  75. package/templates/apps/web/lib/paid-sections.generated.ts +8 -0
  76. package/templates/apps/web/lib/profile-back-link.ts +105 -32
  77. package/templates/apps/web/lib/served-pages.ts +95 -0
  78. package/templates/apps/web/lib/server-api.ts +1 -1
  79. package/templates/apps/web/lib/site-brand.tsx +3 -5
  80. package/templates/apps/web/lib/topology.generated.ts +5 -0
  81. package/templates/apps/web/messages/en.json +8 -836
  82. package/templates/apps/web/middleware.ts +15 -26
  83. package/templates/apps/web/next.config.mjs +35 -0
  84. package/templates/apps/web/package.json +2 -0
  85. package/templates/apps/web/types/messages.d.ts +6 -1
  86. package/templates/customizations.yaml +9 -0
  87. package/templates/package.json +3 -1
  88. package/templates/tools/lint-architecture.ts +164 -11
  89. package/versions.json +49 -47
  90. package/templates/apps/web/app/[locale]/(auth)/__tests__/auth-pages.test.tsx +0 -322
  91. package/templates/apps/web/app/[locale]/(auth)/__tests__/password-reset.test.tsx +0 -554
  92. package/templates/apps/web/app/[locale]/(auth)/consent/__tests__/consent-actions.test.ts +0 -56
  93. package/templates/apps/web/app/[locale]/(auth)/consent/__tests__/page.test.tsx +0 -164
  94. package/templates/apps/web/app/[locale]/(auth)/consent/consent-form.tsx +0 -132
  95. package/templates/apps/web/app/[locale]/(auth)/consent/consent.actions.ts +0 -51
  96. package/templates/apps/web/app/[locale]/(auth)/consent/page.tsx +0 -144
  97. package/templates/apps/web/app/[locale]/(auth)/forgot-password/forgot-password-card.tsx +0 -101
  98. package/templates/apps/web/app/[locale]/(auth)/forgot-password/page.tsx +0 -111
  99. package/templates/apps/web/app/[locale]/(auth)/layout.tsx +0 -81
  100. package/templates/apps/web/app/[locale]/(auth)/legal-footnote.tsx +0 -35
  101. package/templates/apps/web/app/[locale]/(auth)/reset-password/__tests__/return.test.tsx +0 -179
  102. package/templates/apps/web/app/[locale]/(auth)/reset-password/page.tsx +0 -157
  103. package/templates/apps/web/app/[locale]/(auth)/reset-password/reset-password-card.tsx +0 -126
  104. package/templates/apps/web/app/[locale]/(auth)/sign-in/__tests__/next-path.test.ts +0 -54
  105. package/templates/apps/web/app/[locale]/(auth)/sign-in/__tests__/page.test.tsx +0 -628
  106. package/templates/apps/web/app/[locale]/(auth)/sign-in/__tests__/remembered-method.test.ts +0 -43
  107. package/templates/apps/web/app/[locale]/(auth)/sign-in/__tests__/sign-in-card.test.tsx +0 -266
  108. package/templates/apps/web/app/[locale]/(auth)/sign-in/next-path.ts +0 -20
  109. package/templates/apps/web/app/[locale]/(auth)/sign-in/page.tsx +0 -234
  110. package/templates/apps/web/app/[locale]/(auth)/sign-in/remembered-method.ts +0 -37
  111. package/templates/apps/web/app/[locale]/(auth)/sign-in/sign-in-card.tsx +0 -323
  112. package/templates/apps/web/app/[locale]/(auth)/sign-in/sign-in-text.ts +0 -93
  113. package/templates/apps/web/app/[locale]/(auth)/sign-up/__tests__/page.test.tsx +0 -301
  114. package/templates/apps/web/app/[locale]/(auth)/sign-up/__tests__/sign-up-card.test.tsx +0 -309
  115. package/templates/apps/web/app/[locale]/(auth)/sign-up/page.tsx +0 -201
  116. package/templates/apps/web/app/[locale]/(auth)/sign-up/sign-up-card.tsx +0 -366
  117. package/templates/apps/web/app/[locale]/(auth)/use-auth-card-flow.ts +0 -116
  118. package/templates/apps/web/app/[locale]/(auth)/verify-email/__tests__/actions.test.ts +0 -94
  119. package/templates/apps/web/app/[locale]/(auth)/verify-email/actions.ts +0 -77
  120. package/templates/apps/web/app/[locale]/(auth)/verify-email/page.tsx +0 -154
  121. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/account-frame-sign-out.test.tsx +0 -175
  122. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/agreements-prompt.test.tsx +0 -301
  123. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/billing.test.tsx +0 -515
  124. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/general.test.tsx +0 -883
  125. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/hub-mode.test.tsx +0 -758
  126. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/item.test.tsx +0 -264
  127. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/layout-sign-out.test.tsx +0 -167
  128. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/layout.test.tsx +0 -730
  129. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/new-menu.test.tsx +0 -355
  130. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/new-popups.test.tsx +0 -97
  131. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/notifications.test.tsx +0 -375
  132. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/onboarding.test.tsx +0 -323
  133. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/page.test.tsx +0 -1208
  134. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/popups.test.tsx +0 -418
  135. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/privacy.test.tsx +0 -462
  136. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/rich-translator.ts +0 -63
  137. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/security.test.tsx +0 -406
  138. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/settings.test.tsx +0 -93
  139. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/support.test.tsx +0 -208
  140. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/thread.test.tsx +0 -340
  141. package/templates/apps/web/app/[locale]/(authed)/account/account-data.ts +0 -182
  142. package/templates/apps/web/app/[locale]/(authed)/account/account-frame.tsx +0 -353
  143. package/templates/apps/web/app/[locale]/(authed)/account/actions.ts +0 -57
  144. package/templates/apps/web/app/[locale]/(authed)/account/agreements-actions.ts +0 -58
  145. package/templates/apps/web/app/[locale]/(authed)/account/agreements-gate.ts +0 -61
  146. package/templates/apps/web/app/[locale]/(authed)/account/agreements-prompt.tsx +0 -184
  147. package/templates/apps/web/app/[locale]/(authed)/account/appointments/[slug]/page.tsx +0 -161
  148. package/templates/apps/web/app/[locale]/(authed)/account/appointments/__tests__/page.test.tsx +0 -426
  149. package/templates/apps/web/app/[locale]/(authed)/account/appointments/appointments-data.ts +0 -76
  150. package/templates/apps/web/app/[locale]/(authed)/account/appointments/page.tsx +0 -139
  151. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/[pieceId]/page.tsx +0 -406
  152. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/[pieceId]/pay-form.tsx +0 -65
  153. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/[pieceId]/review-form.tsx +0 -172
  154. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/[pieceId]/versions/[version]/file/route.ts +0 -190
  155. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/__tests__/file-route.test.ts +0 -333
  156. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/__tests__/page.test.tsx +0 -936
  157. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/__tests__/pay.test.tsx +0 -193
  158. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/__tests__/review.test.tsx +0 -476
  159. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/artifact-actions.ts +0 -184
  160. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/artifact-data.ts +0 -197
  161. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/page.tsx +0 -182
  162. package/templates/apps/web/app/[locale]/(authed)/account/billing/__tests__/offerings.test.ts +0 -99
  163. package/templates/apps/web/app/[locale]/(authed)/account/billing/offerings.ts +0 -123
  164. package/templates/apps/web/app/[locale]/(authed)/account/billing/page.tsx +0 -424
  165. package/templates/apps/web/app/[locale]/(authed)/account/billing-source.ts +0 -303
  166. package/templates/apps/web/app/[locale]/(authed)/account/components/request-quote.tsx +0 -274
  167. package/templates/apps/web/app/[locale]/(authed)/account/error-row.tsx +0 -35
  168. package/templates/apps/web/app/[locale]/(authed)/account/for-you-labels.ts +0 -36
  169. package/templates/apps/web/app/[locale]/(authed)/account/general/__tests__/phone-verification.test.tsx +0 -215
  170. package/templates/apps/web/app/[locale]/(authed)/account/general/__tests__/seam-imports.test.ts +0 -65
  171. package/templates/apps/web/app/[locale]/(authed)/account/general/account-name.ts +0 -36
  172. package/templates/apps/web/app/[locale]/(authed)/account/general/billing-anchor.tsx +0 -27
  173. package/templates/apps/web/app/[locale]/(authed)/account/general/contact-actions.ts +0 -149
  174. package/templates/apps/web/app/[locale]/(authed)/account/general/contact-details.tsx +0 -42
  175. package/templates/apps/web/app/[locale]/(authed)/account/general/deletion-request.tsx +0 -132
  176. package/templates/apps/web/app/[locale]/(authed)/account/general/page.tsx +0 -218
  177. package/templates/apps/web/app/[locale]/(authed)/account/general/phone-actions.ts +0 -122
  178. package/templates/apps/web/app/[locale]/(authed)/account/general/phone-verification.tsx +0 -215
  179. package/templates/apps/web/app/[locale]/(authed)/account/general/photo-actions.ts +0 -73
  180. package/templates/apps/web/app/[locale]/(authed)/account/general/profile-form.tsx +0 -107
  181. package/templates/apps/web/app/[locale]/(authed)/account/general/profile-source.ts +0 -87
  182. package/templates/apps/web/app/[locale]/(authed)/account/inbox/[kind]/[id]/page.tsx +0 -119
  183. package/templates/apps/web/app/[locale]/(authed)/account/inbox/message/[id]/file/__tests__/route.test.ts +0 -215
  184. package/templates/apps/web/app/[locale]/(authed)/account/inbox/message/[id]/file/route.ts +0 -80
  185. package/templates/apps/web/app/[locale]/(authed)/account/inbox/thread/member-thread-composer.tsx +0 -43
  186. package/templates/apps/web/app/[locale]/(authed)/account/inbox/thread/page.tsx +0 -125
  187. package/templates/apps/web/app/[locale]/(authed)/account/inbox/thread/thread-data.ts +0 -88
  188. package/templates/apps/web/app/[locale]/(authed)/account/inbox/thread/thread-write.ts +0 -31
  189. package/templates/apps/web/app/[locale]/(authed)/account/invitations/[invitationId]/__tests__/invitation-id.test.ts +0 -35
  190. package/templates/apps/web/app/[locale]/(authed)/account/invitations/[invitationId]/__tests__/page.test.tsx +0 -266
  191. package/templates/apps/web/app/[locale]/(authed)/account/invitations/[invitationId]/actions.ts +0 -116
  192. package/templates/apps/web/app/[locale]/(authed)/account/invitations/[invitationId]/invitation-id.ts +0 -12
  193. package/templates/apps/web/app/[locale]/(authed)/account/invitations/[invitationId]/page.tsx +0 -154
  194. package/templates/apps/web/app/[locale]/(authed)/account/layout.tsx +0 -152
  195. package/templates/apps/web/app/[locale]/(authed)/account/new-actions.ts +0 -219
  196. package/templates/apps/web/app/[locale]/(authed)/account/new-menu.tsx +0 -365
  197. package/templates/apps/web/app/[locale]/(authed)/account/new-popups.tsx +0 -86
  198. package/templates/apps/web/app/[locale]/(authed)/account/notifications/page.tsx +0 -143
  199. package/templates/apps/web/app/[locale]/(authed)/account/onboarding/actions.ts +0 -120
  200. package/templates/apps/web/app/[locale]/(authed)/account/onboarding/onboarding-form.tsx +0 -322
  201. package/templates/apps/web/app/[locale]/(authed)/account/onboarding/page.tsx +0 -126
  202. package/templates/apps/web/app/[locale]/(authed)/account/page.tsx +0 -306
  203. package/templates/apps/web/app/[locale]/(authed)/account/privacy/__tests__/export-route.test.ts +0 -173
  204. package/templates/apps/web/app/[locale]/(authed)/account/privacy/actions.ts +0 -103
  205. package/templates/apps/web/app/[locale]/(authed)/account/privacy/export/route.ts +0 -102
  206. package/templates/apps/web/app/[locale]/(authed)/account/privacy/page.tsx +0 -240
  207. package/templates/apps/web/app/[locale]/(authed)/account/profile-actions.ts +0 -116
  208. package/templates/apps/web/app/[locale]/(authed)/account/retry-button.tsx +0 -27
  209. package/templates/apps/web/app/[locale]/(authed)/account/security/__tests__/hub-variant.test.tsx +0 -258
  210. package/templates/apps/web/app/[locale]/(authed)/account/security/page.tsx +0 -131
  211. package/templates/apps/web/app/[locale]/(authed)/account/security/security-panel.tsx +0 -130
  212. package/templates/apps/web/app/[locale]/(authed)/account/security/security-source.ts +0 -92
  213. package/templates/apps/web/app/[locale]/(authed)/account/settings/page.tsx +0 -24
  214. package/templates/apps/web/app/[locale]/(authed)/account/settings-frame.tsx +0 -121
  215. package/templates/apps/web/app/[locale]/(authed)/account/sign-in-method.ts +0 -37
  216. package/templates/apps/web/app/[locale]/(authed)/account/support/page.tsx +0 -60
  217. package/templates/apps/web/app/[locale]/(authed)/account/support/support-form.tsx +0 -98
  218. package/templates/apps/web/app/[locale]/(authed)/account/support-actions.ts +0 -100
  219. package/templates/apps/web/app/[locale]/checkout/__tests__/pages.test.tsx +0 -139
  220. package/templates/apps/web/app/[locale]/checkout/__tests__/thank-you-account.test.tsx +0 -146
  221. package/templates/apps/web/app/[locale]/checkout/thank-you/page.tsx +0 -114
  222. package/templates/apps/web/app/[locale]/checkout/unavailable/page.tsx +0 -51
  223. package/templates/apps/web/app/[locale]/flows/[slug]/FlowStepperClient.tsx +0 -614
  224. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.count.test.tsx +0 -43
  225. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.deliverable.test.tsx +0 -214
  226. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.ending.test.tsx +0 -197
  227. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.invite.test.tsx +0 -286
  228. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.permalink.test.tsx +0 -520
  229. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.test.tsx +0 -376
  230. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.thanks-by-tier.test.tsx +0 -306
  231. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/account-invite.actions.test.ts +0 -69
  232. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/flow.actions.test.ts +0 -398
  233. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/magnet-page.test.tsx +0 -704
  234. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/save.actions.test.ts +0 -173
  235. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/two-route-tool.test.tsx +0 -141
  236. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/verify.test.tsx +0 -249
  237. package/templates/apps/web/app/[locale]/flows/[slug]/account-invite.actions.ts +0 -35
  238. package/templates/apps/web/app/[locale]/flows/[slug]/email-moment.ts +0 -92
  239. package/templates/apps/web/app/[locale]/flows/[slug]/flow.actions.ts +0 -177
  240. package/templates/apps/web/app/[locale]/flows/[slug]/magnet-page.tsx +0 -472
  241. package/templates/apps/web/app/[locale]/flows/[slug]/page.tsx +0 -48
  242. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/LevelChart.tsx +0 -100
  243. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/ResultsCard.tsx +0 -99
  244. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/ResultsClient.tsx +0 -820
  245. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/ResultsEmailStep.tsx +0 -203
  246. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/ResultsClient.no-commerce.test.tsx +0 -194
  247. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/ResultsClient.report.test.tsx +0 -284
  248. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/by-result.test.tsx +0 -302
  249. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/cards.test.tsx +0 -402
  250. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/landing.test.tsx +0 -293
  251. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/page.test.tsx +0 -485
  252. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/score.test.tsx +0 -231
  253. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/checkout-seam.ts +0 -74
  254. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/meeting-seam.ts +0 -36
  255. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/page.tsx +0 -420
  256. package/templates/apps/web/app/[locale]/flows/[slug]/save.actions.ts +0 -85
  257. package/templates/apps/web/app/[locale]/flows/[slug]/served-flow.ts +0 -91
  258. package/templates/apps/web/app/[locale]/flows/[slug]/start/page.tsx +0 -32
  259. package/templates/apps/web/app/[locale]/flows/[slug]/verify/page.tsx +0 -153
  260. package/templates/apps/web/app/[locale]/flows/[slug]/verify.actions.ts +0 -151
  261. package/templates/apps/web/app/[locale]/meet/confirmed/BookingHandOff.tsx +0 -128
  262. package/templates/apps/web/app/[locale]/meet/confirmed/__tests__/BookingHandOff.test.tsx +0 -126
  263. package/templates/apps/web/app/[locale]/purchase/__tests__/cancel.test.tsx +0 -162
  264. package/templates/apps/web/app/[locale]/purchase/__tests__/module-scope.test.ts +0 -68
  265. package/templates/apps/web/app/[locale]/purchase/__tests__/success.test.tsx +0 -411
  266. package/templates/apps/web/app/[locale]/purchase/cancel/page.tsx +0 -115
  267. package/templates/apps/web/app/[locale]/purchase/success/page.tsx +0 -348
  268. package/templates/apps/web/app/api/auth/[...all]/route.ts +0 -16
  269. package/templates/apps/web/app/api/auth/hub/__tests__/continuation.test.ts +0 -143
  270. package/templates/apps/web/app/api/auth/hub/__tests__/entry-routes.test.ts +0 -749
  271. package/templates/apps/web/app/api/auth/hub/authorize/__tests__/route.test.ts +0 -964
  272. package/templates/apps/web/app/api/auth/hub/authorize/route.ts +0 -390
  273. package/templates/apps/web/app/api/auth/hub/continuation.ts +0 -127
  274. package/templates/apps/web/app/api/auth/hub/continue/[ref]/__tests__/route.test.ts +0 -188
  275. package/templates/apps/web/app/api/auth/hub/continue/[ref]/route.ts +0 -53
  276. package/templates/apps/web/app/api/auth/hub/email/route.ts +0 -111
  277. package/templates/apps/web/app/api/auth/hub/entry-shared.ts +0 -163
  278. package/templates/apps/web/app/api/auth/hub/password/__tests__/return.test.ts +0 -86
  279. package/templates/apps/web/app/api/auth/hub/password/__tests__/route.test.ts +0 -368
  280. package/templates/apps/web/app/api/auth/hub/password/return.ts +0 -86
  281. package/templates/apps/web/app/api/auth/hub/password/route.ts +0 -171
  282. package/templates/apps/web/app/api/auth/hub/purchase/route.ts +0 -230
  283. package/templates/apps/web/app/api/auth/hub/purchase-link/route.ts +0 -174
  284. package/templates/apps/web/app/api/auth/hub/sign-up/route.ts +0 -60
  285. package/templates/apps/web/app/api/auth/hub/sign-up-evidence.ts +0 -97
  286. package/templates/apps/web/app/api/auth/mcp/__tests__/continuation.test.ts +0 -92
  287. package/templates/apps/web/app/api/auth/mcp/continuation.ts +0 -89
  288. package/templates/apps/web/app/api/auth/mcp/continue/[ref]/__tests__/route.test.ts +0 -59
  289. package/templates/apps/web/app/api/auth/mcp/continue/[ref]/route.ts +0 -41
  290. package/templates/apps/web/app/api/hub-session/__tests__/routes.test.ts +0 -1166
  291. package/templates/apps/web/app/api/hub-session/callback/route.ts +0 -134
  292. package/templates/apps/web/app/api/hub-session/email/route.ts +0 -125
  293. package/templates/apps/web/app/api/hub-session/one-tap/nonce/route.ts +0 -49
  294. package/templates/apps/web/app/api/hub-session/one-tap/route.ts +0 -106
  295. package/templates/apps/web/app/api/hub-session/open/route.ts +0 -111
  296. package/templates/apps/web/app/api/hub-session/password/return/route.ts +0 -69
  297. package/templates/apps/web/app/api/hub-session/password/route.ts +0 -106
  298. package/templates/apps/web/app/api/hub-session/sign-in/route.ts +0 -91
  299. package/templates/apps/web/app/api/hub-session/sign-out/route.ts +0 -54
  300. package/templates/apps/web/components/sign-out-trigger.tsx +0 -62
  301. package/templates/apps/web/lib/__tests__/account-config.test.ts +0 -704
  302. package/templates/apps/web/lib/__tests__/auth-routes.test.ts +0 -140
  303. package/templates/apps/web/lib/account-config.ts +0 -678
  304. package/templates/apps/web/lib/auth-routes.ts +0 -125
  305. package/templates/apps/web/lib/checkout-config.ts +0 -16
  306. package/templates/apps/web/lib/hub-session/__tests__/hub-session.test.ts +0 -433
  307. package/templates/apps/web/lib/hub-session/__tests__/spoke-sign-in.test.tsx +0 -332
  308. package/templates/apps/web/lib/hub-session/config.ts +0 -110
  309. package/templates/apps/web/lib/hub-session/entry.ts +0 -238
  310. package/templates/apps/web/lib/hub-session/index.ts +0 -21
  311. package/templates/apps/web/lib/hub-session/one-tap.tsx +0 -148
  312. package/templates/apps/web/lib/hub-session/reseal.ts +0 -90
  313. package/templates/apps/web/lib/hub-session/seal.ts +0 -86
  314. package/templates/apps/web/lib/hub-session/session.ts +0 -298
  315. package/templates/apps/web/lib/hub-session/spoke-sign-in.tsx +0 -277
  316. package/templates/apps/web/lib/next-path.ts +0 -35
  317. package/templates/apps/web/src/lib/__tests__/commerce-sections.test.ts +0 -57
  318. package/templates/apps/web/src/lib/commerce-sections.ts +0 -55
@@ -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).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,6 +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 SignInMode, type SpokeShapeOptions, type Topology } from "./topology.js";
9
10
  /** The site-root file that is the roster of record (#6658 D7). */
10
11
  export declare const SITE_ROSTER_PATH = ".ailk-site-manifest.json";
11
12
  /**
@@ -188,14 +189,22 @@ export declare function planRosterAppend(opts: PlanRosterAppendOptions): RosterA
188
189
  * its parent (docs-blog's `/blog/[[...slug]]` serves `/blog`). The root
189
190
  * content renderers (`/[slug]`, `/[slug]/[detail]`) are not routes of their
190
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.
191
198
  */
192
- 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>;
193
202
  /**
194
203
  * `file`'s next text with its unserved code-route rows removed — every other
195
204
  * byte verbatim — and the dropped routes in file order; `next` is undefined
196
205
  * when none is dropped.
197
206
  */
198
- export declare function withoutUnservedRouteRows(file: RosterFile, targetDir: string): {
207
+ export declare function withoutUnservedRouteRows(file: RosterFile, targetDir: string, topology?: Topology, signIn?: SignInMode): {
199
208
  next: string | undefined;
200
209
  dropped: string[];
201
210
  };
@@ -36,8 +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, 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 { isSpokeExcluded, readSpokeShape, } from "./topology.js";
41
42
  /** The site-root file that is the roster of record (#6658 D7). */
42
43
  export const SITE_ROSTER_PATH = ".ailk-site-manifest.json";
43
44
  /**
@@ -634,29 +635,49 @@ function spliceRows(file, rows) {
634
635
  * its parent (docs-blog's `/blog/[[...slug]]` serves `/blog`). The root
635
636
  * content renderers (`/[slug]`, `/[slug]/[detail]`) are not routes of their
636
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.
637
644
  */
638
- export function servedRoutes(targetDir) {
645
+ export function servedRoutes(targetDir, spoke) {
639
646
  const root = join(targetDir, ROUTE_ROOT);
647
+ if (!existsSync(root))
648
+ return [];
640
649
  const routes = new Set();
641
- 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];
642
662
  for (let cur = stack.pop(); cur !== undefined; cur = stack.pop()) {
643
663
  const entries = readdirSync(cur, { withFileTypes: true });
644
664
  for (const entry of entries) {
645
665
  if (entry.isDirectory())
646
666
  stack.push(join(cur, entry.name));
647
667
  }
648
- if (!entries.some((entry) => entry.isFile() && PAGE_FILE.test(entry.name))) {
649
- continue;
668
+ if (entries.some((entry) => entry.isFile() && PAGE_FILE.test(entry.name))) {
669
+ add(relative(root, cur));
650
670
  }
651
- const segments = relative(root, cur)
652
- .split(sep)
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("["))
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))
658
676
  continue;
659
- 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
+ }
660
681
  }
661
682
  return [...routes].sort();
662
683
  }
@@ -667,25 +688,46 @@ export function servedRoutes(targetDir) {
667
688
  * dynamic is never judged either: the root renderers are not in
668
689
  * `servedRoutes`.
669
690
  */
670
- function unservedRouteRow(targetDir) {
691
+ function unservedRouteRow(targetDir, topology, signIn) {
671
692
  if (!existsSync(join(targetDir, ROUTE_ROOT)))
672
693
  return undefined;
673
- 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));
697
+ const carried = webDependencies(targetDir);
674
698
  return (row) => {
675
699
  const route = row["route"];
676
- return (row["kind"] === "route" &&
677
- typeof route === "string" &&
678
- !route.split("/").filter(Boolean)[0]?.startsWith("[") &&
679
- !served.has(route));
700
+ if (row["kind"] !== "route" || typeof route !== "string")
701
+ return false;
702
+ if (route.split("/").filter(Boolean)[0]?.startsWith("[") || served.has(route))
703
+ return false;
704
+ // #11251 — a route a carried page package ships is served once
705
+ // `create-ailk routes --write` writes its file after the install, unless
706
+ // the spoke removal registry drops it (the generator's `not carried`).
707
+ const pkg = pagePackageOfRoute(route.slice(1));
708
+ if (pkg === undefined || !carried.has(pkg))
709
+ return true;
710
+ return shape !== undefined && isSpokeExcluded(`apps/web/app/[locale]${route}`, shape);
680
711
  };
681
712
  }
713
+ /** The dependency and devDependency names of the site's `apps/web/package.json`; empty when it has none. */
714
+ export function webDependencies(targetDir) {
715
+ try {
716
+ const pkg = JSON.parse(readFileSync(join(targetDir, "apps", "web", "package.json"), "utf8"));
717
+ // The route generator's own reading (`readRouteManifests`): both lists.
718
+ return new Set([...Object.keys(pkg.dependencies ?? {}), ...Object.keys(pkg.devDependencies ?? {})]);
719
+ }
720
+ catch {
721
+ return new Set();
722
+ }
723
+ }
682
724
  /**
683
725
  * `file`'s next text with its unserved code-route rows removed — every other
684
726
  * byte verbatim — and the dropped routes in file order; `next` is undefined
685
727
  * when none is dropped.
686
728
  */
687
- export function withoutUnservedRouteRows(file, targetDir) {
688
- const unserved = unservedRouteRow(targetDir);
729
+ export function withoutUnservedRouteRows(file, targetDir, topology, signIn) {
730
+ const unserved = unservedRouteRow(targetDir, topology, signIn);
689
731
  const dropped = file.rows.filter((row) => unserved?.(row.value) === true);
690
732
  if (dropped.length === 0)
691
733
  return { next: undefined, dropped: [] };
@@ -4,17 +4,15 @@ import { type WorkspaceVersionMap } from "./substitute.js";
4
4
  import { type SignInMode } from "./topology.js";
5
5
  /** The checkout package a spoke's billing action and thank-you page import. */
6
6
  export declare const SPOKE_CHECKOUT_PACKAGE = "@working-theory/spoke-checkout";
7
- /** The site's checkout stamp — written once, the site's from then on (#8748 D2). */
7
+ /** The site's checkout stamp — stamped once, the site's from then on (#8748 D2). */
8
8
  export declare const SPOKE_CHECKOUT_CONFIG_PATH = "apps/web/lib/checkout-config.ts";
9
- /** The two return pages a commerce spoke still carries (#8748 D5). */
10
- export declare const SPOKE_CHECKOUT_PAGE_FILES: readonly string[];
11
9
  /**
12
- * The spoke checkout's template paths, scaffold-relative (#8748 D3). A
13
- * directory entry covers every file under it, so the tests that sit beside
14
- * the pages travel with them. `copyTemplate` skips all of them for every
15
- * scaffold; `writeSpokeCheckoutSlice` copies them into a commerce spoke.
10
+ * The stamp the bundled `lib/checkout-config.ts` carries until a spoke's is
11
+ * stamped (#11253 D6). This monorepo's copy is that file, and
12
+ * `spoke-checkout.test.ts` pins it to this value, so an edited bundled stamp
13
+ * fails CI rather than stamping every new spoke alike (SEC-11253-2).
16
14
  */
17
- export declare const SPOKE_CHECKOUT_TEMPLATE_PATHS: readonly string[];
15
+ export declare const SPOKE_CHECKOUT_PLACEHOLDER_SITE = "example-site";
18
16
  /** The variables a commerce spoke depends on (D9): the package reads both. */
19
17
  export declare const SPOKE_CHECKOUT_ENV_CATALOG: Readonly<Record<string, EnvCatalogEntry>>;
20
18
  /** The names a commerce spoke declares although only the package reads them (D9). */
@@ -45,7 +43,7 @@ export declare const BILLING_ACTION: string;
45
43
  /**
46
44
  * The rendered part of the slice for `site` (#8748 D3): with `signIn: "hub"`
47
45
  * the billing action (#8217 D8), else nothing. It does not depend on `site`.
48
- * The rest of the slice is template source, copied by
46
+ * The rest of the slice is the config's stamp, written in place by
49
47
  * `writeSpokeCheckoutSlice`. Throws `TopologyError` for an invalid stamp
50
48
  * (SEC-7838-10).
51
49
  */
@@ -53,35 +51,38 @@ export declare function renderSpokeCheckoutFiles(site: string, opts?: {
53
51
  signIn?: SignInMode | undefined;
54
52
  }): [string, string][];
55
53
  /**
56
- * Write the slice into `targetDir` (#7838 D3, #8748 D3). The standard's
57
- * template files (`SPOKE_CHECKOUT_TEMPLATE_PATHS`) are copied from
58
- * `templatesDir`, each rendered with `copyTemplate`'s own renderer and
59
- * markers, so a recorded hash equals what `create-ailk update` renders; the
60
- * config's one `const SITE` line is stamped with `site`. `onWrite` is called
61
- * once per template file written, as `copyTemplate` calls it. Then come the
62
- * rendered files (`renderSpokeCheckoutFiles`). A file that already exists is
63
- * left byte-for-byte and reported `skipped` — the config is the site's once
64
- * written. With `signIn: "hub"` (#8217 D8) the slice carries the billing
65
- * action, and the web seam — generated, so always rewritten — becomes the
66
- * billing render: reported `patched` when it changed, not at all when equal.
54
+ * Write the slice into `targetDir` (#7838 D3, #8748 D3, #11253 D6). The
55
+ * site's `lib/checkout-config.ts` — delivered by the commerce bundle, which
56
+ * lands first — is stamped in place: its one `const SITE` line is set to
57
+ * `site` while it still reads the placeholder
58
+ * (`SPOKE_CHECKOUT_PLACEHOLDER_SITE`), reported `patched`; any other value is
59
+ * the site's and is left byte-for-byte, unreported, but only when it is a
60
+ * stamp this writer would itself write (`assertSite`, SEC-11253-1). Then come
61
+ * the rendered files (`renderSpokeCheckoutFiles`); one that already exists is
62
+ * left byte-for-byte and reported `skipped`. With `signIn: "hub"` (#8217 D8)
63
+ * the slice carries the billing action, and the web seam — generated, so
64
+ * always rewritten — becomes the billing render: reported `patched` when it
65
+ * changed, not at all when equal.
67
66
  * Adds the package to `apps/web/package.json` when absent, and raises a plain
68
67
  * pin older than the one it writes (#7839): the rendered billing action
69
68
  * calls the package's current `createSpokeCheckout` shape, which an older
70
69
  * pin does not take (#9142). Any other range — newer, `workspace:`, a tag —
71
70
  * is the site's and is kept.
72
71
  * Every refusal (an invalid stamp, a version map without the package, a
73
- * missing or malformed `apps/web/package.json`, a template missing any
74
- * `SPOKE_CHECKOUT_TEMPLATE_PATHS` entry, a template config without exactly
75
- * one `const SITE` line, a destination to write that resolves outside
76
- * `targetDir`) throws before the first write.
72
+ * missing or malformed `apps/web/package.json`, no config, a config without
73
+ * exactly one `const SITE` line, a kept value `assertSite` refuses, a
74
+ * destination to write that resolves outside `targetDir`) throws before the
75
+ * first write.
76
+ *
77
+ * `projectName` and `templatesDir` are no longer read (nothing is copied from
78
+ * the template since #11253); they stay accepted for `add-module.ts`'s call.
77
79
  */
78
80
  export declare function writeSpokeCheckoutSlice(targetDir: string, opts: {
79
81
  site: string;
80
- projectName: string;
82
+ projectName?: string;
81
83
  versions: WorkspaceVersionMap;
82
- templatesDir: string;
84
+ templatesDir?: string;
83
85
  signIn?: SignInMode | undefined;
84
- onWrite?: (relPath: string, bytes: Uint8Array) => void;
85
86
  }): InstallReportRow[];
86
87
  /**
87
88
  * Drop the checkout package from a scaffold that does not get the slice — a
@@ -1,11 +1,14 @@
1
1
  /**
2
2
  * The spoke checkout slice (#7838, #8748) — what a spoke carrying `commerce`
3
- * gets in `apps/web`, copied from the template tree: the site's own
4
- * `lib/checkout-config.ts` (its stamp) and the thank-you and unavailable
5
- * return pages with their tests (`SPOKE_CHECKOUT_TEMPLATE_PATHS`). A spoke
3
+ * gets in `apps/web` beyond the commerce bundle: its `lib/checkout-config.ts`
4
+ * stamped in place. The thank-you and unavailable return pages ship in
5
+ * `@working-theory/ui-commerce` (#11253) and mount through the route files
6
+ * `create-ailk routes` generates; the config is a commerce `ownedFiles`
7
+ * entry, so the bundle delivers it to every commerce site with the
8
+ * template's placeholder stamp, and this writer stamps it on a spoke. A spoke
6
9
  * that signs in through its hub also gets the billing action, the one file
7
- * allowed to import the package besides the thank-you page, and the web seam
8
- * render that reaches it (#8217 D6–D8); that action is rendered here.
10
+ * in its `apps/web` allowed to import the package, and the web seam render
11
+ * that reaches it (#8217 D6–D8); that action is rendered here.
9
12
  *
10
13
  * A spoke sells through its hub's Offerings buy route
11
14
  * (`apps/web/app/api/offerings/checkout/[lookupKey]/route.ts`), never its own
@@ -15,24 +18,22 @@
15
18
  * (`RETIRED_SPOKE_CHECKOUT_PATHS`, sync-routes.ts).
16
19
  *
17
20
  * Every guarantee lives in `@working-theory/spoke-checkout` and arrives by a
18
- * package bump; the copied files are `apps/web` source, tested in the
19
- * monorepo and kept current by `create-ailk update`, and apart from the
20
- * config's one stamp line they are byte-identical across spokes at one
21
- * create-ailk version (roadmap D3, AC-SPOKE-02). A hub never gets them.
21
+ * package bump; the pages arrive with `@working-theory/ui-commerce`'s, and
22
+ * the config differs across spokes in its one stamp line alone (roadmap D3,
23
+ * AC-SPOKE-02). A hub carries the config with its placeholder unread: both
24
+ * checkout pages answer `notFound()` there first.
22
25
  *
23
26
  * Spec: docs/specs/7838-spoke-web-checkout-slice-spec.md (D3–D7, D9);
24
27
  * docs/specs/8748-a-standard-spoke-checkout-route-spec.md (D2, D3).
25
28
  *
26
- * Pure module: no `import.meta.url`, so jest imports it directly — the caller
27
- * passes `templatesDir`. Every package specifier in a rendered file is
29
+ * Pure module: no `import.meta.url`, so jest imports it directly. Every package specifier in a rendered file is
28
30
  * interpolated from a constant, so the monorepo's own architecture lint never
29
31
  * reads a rendered line as an import create-ailk makes (the
30
32
  * `CONTENT_ADAPTERS_PACKAGE` idiom in topology.ts).
31
33
  */
32
34
  import { createHash } from "node:crypto";
33
- import { existsSync, lstatSync, mkdirSync, readFileSync, readdirSync, realpathSync, writeFileSync, } from "node:fs";
35
+ import { existsSync, lstatSync, mkdirSync, readFileSync, realpathSync, writeFileSync, } from "node:fs";
34
36
  import { dirname, join, resolve, sep } from "node:path";
35
- import { buildScaffoldMarkers, renderTemplateFile, templateDestination } from "./copy.js";
36
37
  import { SPOKE_BILLING_ACTION_PATH } from "./derive-architecture.js";
37
38
  import { ENV_CATALOG } from "./lib/env-catalog.js";
38
39
  import { diffTwoStrings, } from "./lib/extract-module-bundle.js";
@@ -41,23 +42,15 @@ import { TopologyError, WEB_SEAM_PATH, renderWebSeam, } from "./topology.js";
41
42
  /** The checkout package a spoke's billing action and thank-you page import. */
42
43
  export const SPOKE_CHECKOUT_PACKAGE = "@working-theory/spoke-checkout";
43
44
  const API_CLIENT_PACKAGE = "@working-theory/api-client";
44
- /** The site's checkout stamp — written once, the site's from then on (#8748 D2). */
45
+ /** The site's checkout stamp — stamped once, the site's from then on (#8748 D2). */
45
46
  export const SPOKE_CHECKOUT_CONFIG_PATH = "apps/web/lib/checkout-config.ts";
46
- /** The two return pages a commerce spoke still carries (#8748 D5). */
47
- export const SPOKE_CHECKOUT_PAGE_FILES = Object.freeze([
48
- "apps/web/app/[locale]/checkout/thank-you/page.tsx",
49
- "apps/web/app/[locale]/checkout/unavailable/page.tsx",
50
- ]);
51
47
  /**
52
- * The spoke checkout's template paths, scaffold-relative (#8748 D3). A
53
- * directory entry covers every file under it, so the tests that sit beside
54
- * the pages travel with them. `copyTemplate` skips all of them for every
55
- * scaffold; `writeSpokeCheckoutSlice` copies them into a commerce spoke.
48
+ * The stamp the bundled `lib/checkout-config.ts` carries until a spoke's is
49
+ * stamped (#11253 D6). This monorepo's copy is that file, and
50
+ * `spoke-checkout.test.ts` pins it to this value, so an edited bundled stamp
51
+ * fails CI rather than stamping every new spoke alike (SEC-11253-2).
56
52
  */
57
- export const SPOKE_CHECKOUT_TEMPLATE_PATHS = Object.freeze([
58
- "apps/web/app/[locale]/checkout",
59
- SPOKE_CHECKOUT_CONFIG_PATH,
60
- ]);
53
+ export const SPOKE_CHECKOUT_PLACEHOLDER_SITE = "example-site";
61
54
  /** The variables a commerce spoke depends on (D9): the package reads both. */
62
55
  export const SPOKE_CHECKOUT_ENV_CATALOG = Object.freeze({
63
56
  STRIPE_SECRET_KEY: {
@@ -151,7 +144,7 @@ export const BILLING_ACTION = [
151
144
  /**
152
145
  * The rendered part of the slice for `site` (#8748 D3): with `signIn: "hub"`
153
146
  * the billing action (#8217 D8), else nothing. It does not depend on `site`.
154
- * The rest of the slice is template source, copied by
147
+ * The rest of the slice is the config's stamp, written in place by
155
148
  * `writeSpokeCheckoutSlice`. Throws `TopologyError` for an invalid stamp
156
149
  * (SEC-7838-10).
157
150
  */
@@ -159,35 +152,8 @@ export function renderSpokeCheckoutFiles(site, opts = {}) {
159
152
  assertSite(site);
160
153
  return opts.signIn === "hub" ? [[SPOKE_BILLING_ACTION_PATH, BILLING_ACTION]] : [];
161
154
  }
162
- /** The one line of the template's config the writer stamps (#8748 D2). */
163
- const SITE_LINE = /^const SITE = "[a-z0-9-]+";$/gm;
164
- /**
165
- * Every template file under `SPOKE_CHECKOUT_TEMPLATE_PATHS`, sorted, as its
166
- * destination path and its source. A symlink is skipped, never followed, as
167
- * `copyTemplate` skips one; a `.gitkeep` has no destination.
168
- */
169
- function templateCheckoutFiles(templatesDir) {
170
- const out = [];
171
- const visit = (rel) => {
172
- const abs = join(templatesDir, ...rel.split("/"));
173
- if (!existsSync(abs))
174
- return;
175
- const stat = lstatSync(abs);
176
- if (stat.isSymbolicLink())
177
- return;
178
- if (stat.isDirectory()) {
179
- for (const name of readdirSync(abs))
180
- visit(`${rel}/${name}`);
181
- return;
182
- }
183
- const dest = templateDestination(rel);
184
- if (dest !== undefined)
185
- out.push([dest, abs]);
186
- };
187
- for (const entry of SPOKE_CHECKOUT_TEMPLATE_PATHS)
188
- visit(entry);
189
- return out.sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0));
190
- }
155
+ /** The one line of the config the writer stamps (#8748 D2); its value is group 1. */
156
+ const SITE_LINE = /^const SITE = "([^"\n]*)";$/gm;
191
157
  /** Whether anything — a dangling symlink included — sits at `abs`. */
192
158
  function lstatExists(abs) {
193
159
  try {
@@ -243,27 +209,31 @@ function isOlderPin(current, wanted) {
243
209
  return false;
244
210
  }
245
211
  /**
246
- * Write the slice into `targetDir` (#7838 D3, #8748 D3). The standard's
247
- * template files (`SPOKE_CHECKOUT_TEMPLATE_PATHS`) are copied from
248
- * `templatesDir`, each rendered with `copyTemplate`'s own renderer and
249
- * markers, so a recorded hash equals what `create-ailk update` renders; the
250
- * config's one `const SITE` line is stamped with `site`. `onWrite` is called
251
- * once per template file written, as `copyTemplate` calls it. Then come the
252
- * rendered files (`renderSpokeCheckoutFiles`). A file that already exists is
253
- * left byte-for-byte and reported `skipped` — the config is the site's once
254
- * written. With `signIn: "hub"` (#8217 D8) the slice carries the billing
255
- * action, and the web seam — generated, so always rewritten — becomes the
256
- * billing render: reported `patched` when it changed, not at all when equal.
212
+ * Write the slice into `targetDir` (#7838 D3, #8748 D3, #11253 D6). The
213
+ * site's `lib/checkout-config.ts` — delivered by the commerce bundle, which
214
+ * lands first — is stamped in place: its one `const SITE` line is set to
215
+ * `site` while it still reads the placeholder
216
+ * (`SPOKE_CHECKOUT_PLACEHOLDER_SITE`), reported `patched`; any other value is
217
+ * the site's and is left byte-for-byte, unreported, but only when it is a
218
+ * stamp this writer would itself write (`assertSite`, SEC-11253-1). Then come
219
+ * the rendered files (`renderSpokeCheckoutFiles`); one that already exists is
220
+ * left byte-for-byte and reported `skipped`. With `signIn: "hub"` (#8217 D8)
221
+ * the slice carries the billing action, and the web seam — generated, so
222
+ * always rewritten — becomes the billing render: reported `patched` when it
223
+ * changed, not at all when equal.
257
224
  * Adds the package to `apps/web/package.json` when absent, and raises a plain
258
225
  * pin older than the one it writes (#7839): the rendered billing action
259
226
  * calls the package's current `createSpokeCheckout` shape, which an older
260
227
  * pin does not take (#9142). Any other range — newer, `workspace:`, a tag —
261
228
  * is the site's and is kept.
262
229
  * Every refusal (an invalid stamp, a version map without the package, a
263
- * missing or malformed `apps/web/package.json`, a template missing any
264
- * `SPOKE_CHECKOUT_TEMPLATE_PATHS` entry, a template config without exactly
265
- * one `const SITE` line, a destination to write that resolves outside
266
- * `targetDir`) throws before the first write.
230
+ * missing or malformed `apps/web/package.json`, no config, a config without
231
+ * exactly one `const SITE` line, a kept value `assertSite` refuses, a
232
+ * destination to write that resolves outside `targetDir`) throws before the
233
+ * first write.
234
+ *
235
+ * `projectName` and `templatesDir` are no longer read (nothing is copied from
236
+ * the template since #11253); they stay accepted for `add-module.ts`'s call.
267
237
  */
268
238
  export function writeSpokeCheckoutSlice(targetDir, opts) {
269
239
  const rendered = renderSpokeCheckoutFiles(opts.site, { signIn: opts.signIn });
@@ -272,28 +242,30 @@ export function writeSpokeCheckoutSlice(targetDir, opts) {
272
242
  const pkgPath = join(targetDir, WEB_PACKAGE_JSON);
273
243
  const before = readFileSync(pkgPath, "utf8");
274
244
  const pkg = JSON.parse(before);
275
- const markers = buildScaffoldMarkers(opts.projectName);
276
- const copied = [];
277
- for (const [path, source] of templateCheckoutFiles(opts.templatesDir)) {
278
- let bytes = Buffer.from(renderTemplateFile(readFileSync(source), path, opts.versions, markers));
279
- if (path === SPOKE_CHECKOUT_CONFIG_PATH) {
280
- const text = bytes.toString("utf8");
281
- const lines = text.match(SITE_LINE) ?? [];
282
- if (lines.length !== 1) {
283
- throw new TopologyError(`spoke checkout: the template's ${SPOKE_CHECKOUT_CONFIG_PATH} must hold exactly one const SITE line, found ${lines.length}`);
284
- }
285
- bytes = Buffer.from(text.replace(SITE_LINE, `const SITE = "${opts.site}";`), "utf8");
286
- }
287
- copied.push([path, bytes]);
245
+ const targetReal = realpathSync(targetDir);
246
+ const configPath = join(targetDir, SPOKE_CHECKOUT_CONFIG_PATH);
247
+ if (!existsSync(configPath)) {
248
+ throw new TopologyError(`spoke checkout: the site has no ${SPOKE_CHECKOUT_CONFIG_PATH} (the commerce bundle delivers it)`);
288
249
  }
289
- const missing = SPOKE_CHECKOUT_TEMPLATE_PATHS.filter((entry) => !copied.some(([path]) => path === entry || path.startsWith(`${entry}/`)));
290
- if (missing.length > 0) {
291
- throw new TopologyError(`spoke checkout: the template has no ${missing.join(", ")}`);
250
+ // The config is rewritten in place, so it must be the site's own file: a
251
+ // symlink, or a path that resolves outside the site, is refused.
252
+ if (lstatSync(configPath).isSymbolicLink() || !resolvesInside(targetReal, configPath)) {
253
+ throw new TopologyError(`spoke checkout: refusing to write outside the site: ${SPOKE_CHECKOUT_CONFIG_PATH}`);
292
254
  }
293
- // A file already there is skipped below, never written, so only a path
294
- // that will be written must resolve inside the site.
295
- const targetReal = realpathSync(targetDir);
296
- for (const [path] of [...copied, ...rendered]) {
255
+ const config = readFileSync(configPath, "utf8");
256
+ const siteLines = [...config.matchAll(SITE_LINE)];
257
+ if (siteLines.length !== 1) {
258
+ throw new TopologyError(`spoke checkout: ${SPOKE_CHECKOUT_CONFIG_PATH} must hold exactly one const SITE line, found ${siteLines.length}`);
259
+ }
260
+ const kept = siteLines[0][1];
261
+ if (kept !== SPOKE_CHECKOUT_PLACEHOLDER_SITE)
262
+ assertSite(kept);
263
+ const stamped = kept === SPOKE_CHECKOUT_PLACEHOLDER_SITE
264
+ ? config.replace(SITE_LINE, `const SITE = "${opts.site}";`)
265
+ : undefined;
266
+ // A rendered file already there is skipped below, never written, so only a
267
+ // path that will be written must resolve inside the site.
268
+ for (const [path] of rendered) {
297
269
  const abs = resolve(targetDir, path);
298
270
  if (lstatExists(abs))
299
271
  continue;
@@ -302,16 +274,13 @@ export function writeSpokeCheckoutSlice(targetDir, opts) {
302
274
  }
303
275
  }
304
276
  const rows = [];
305
- for (const [path, bytes] of copied) {
306
- const abs = join(targetDir, path);
307
- if (lstatExists(abs)) {
308
- rows.push({ path, action: "skipped", wanted: bytes.toString("utf8") });
309
- continue;
310
- }
311
- mkdirSync(dirname(abs), { recursive: true });
312
- writeFileSync(abs, bytes);
313
- opts.onWrite?.(path, bytes);
314
- rows.push({ path, action: "written" });
277
+ if (stamped !== undefined) {
278
+ writeFileSync(configPath, stamped);
279
+ rows.push({
280
+ path: SPOKE_CHECKOUT_CONFIG_PATH,
281
+ action: "patched",
282
+ change: diffTwoStrings(SPOKE_CHECKOUT_CONFIG_PATH, config, stamped, true),
283
+ });
315
284
  }
316
285
  for (const [path, text] of rendered) {
317
286
  const abs = join(targetDir, path);
@@ -29,6 +29,30 @@ export declare const HUB_KEPT_ROUTE_DIRS: readonly string[];
29
29
  * site whose manifest lists no `marketing` (`lib/site-modules.ts`, spec 10040 D10).
30
30
  */
31
31
  export declare function isRemovedPublicRoutePath(destRel: string): boolean;
32
+ /**
33
+ * The route trees a page package ships (ADR 0040): the package's pages
34
+ * mount through the route files `create-ailk routes` generates from its
35
+ * manifest, so `sync-routes` has nothing to sync under the prefix — the
36
+ * generator writes, checks and records those files, never the route copier.
37
+ * A `siteOwned` route under the prefix stays the site's own page (one the
38
+ * package leaves to a later slice) and `sync-routes` keeps it in scope. One
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.
47
+ */
48
+ export declare const PAGE_PACKAGE_ROUTES: readonly {
49
+ package: string;
50
+ prefix: string;
51
+ siteOwned: readonly string[];
52
+ pages: readonly string[];
53
+ }[];
54
+ /** The page package that ships `route` (a ROUTE_ROOT-relative dir), or `undefined` when no page package does. */
55
+ export declare function pagePackageOfRoute(route: string): string | undefined;
32
56
  /** Template-relative route directories that are always copied. */
33
57
  export declare const CORE_ROUTE_DIRS: readonly string[];
34
58
  /**
@@ -85,6 +109,8 @@ export declare const SURFACE_ALIASES: Readonly<Record<string, string>>;
85
109
  * is copied regardless.
86
110
  */
87
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;
88
114
  /**
89
115
  * Surfaces each recognized module contributes.
90
116
  *