create-ailk 0.37.0 → 0.38.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 (232) hide show
  1. package/README.md +149 -2
  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 +7 -2
  6. package/dist/add-route.js +28 -13
  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 +9 -15
  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 +67 -0
  26. package/dist/routes.d.ts +103 -0
  27. package/dist/routes.js +708 -0
  28. package/dist/site-manifest.js +1 -1
  29. package/dist/site-roster.d.ts +2 -1
  30. package/dist/site-roster.js +30 -8
  31. package/dist/spoke-checkout.d.ts +28 -27
  32. package/dist/spoke-checkout.js +71 -102
  33. package/dist/surfaces.d.ts +18 -0
  34. package/dist/surfaces.js +47 -282
  35. package/dist/sync-routes.d.ts +28 -1
  36. package/dist/sync-routes.js +144 -11
  37. package/dist/template-record.d.ts +11 -0
  38. package/dist/template-record.js +18 -0
  39. package/dist/topology.d.ts +15 -1
  40. package/dist/topology.js +20 -4
  41. package/dist/update.d.ts +31 -2
  42. package/dist/update.js +627 -99
  43. package/package.json +3 -3
  44. package/templates/README.md +1 -1
  45. package/templates/apps/mcp/CLAUDE.md +5 -3
  46. package/templates/apps/web/CLAUDE.md +62 -20
  47. package/templates/apps/web/account.config.tsx +101 -0
  48. package/templates/apps/web/app/[locale]/(authed)/account/appointments/[slug]/page.tsx +3 -161
  49. package/templates/apps/web/app/[locale]/(authed)/account/appointments/page.tsx +3 -139
  50. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/[pieceId]/page.tsx +3 -406
  51. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/[pieceId]/versions/[version]/file/route.ts +2 -190
  52. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/page.tsx +3 -182
  53. package/templates/apps/web/app/[locale]/(authed)/account/billing/page.tsx +8 -420
  54. package/templates/apps/web/app/[locale]/(authed)/account/connect/page.tsx +1 -1
  55. package/templates/apps/web/app/[locale]/(authed)/account/general/page.tsx +8 -214
  56. package/templates/apps/web/app/[locale]/(authed)/account/inbox/[kind]/[id]/page.tsx +8 -115
  57. package/templates/apps/web/app/[locale]/(authed)/account/inbox/message/[id]/file/route.ts +2 -80
  58. package/templates/apps/web/app/[locale]/(authed)/account/inbox/thread/page.tsx +8 -121
  59. package/templates/apps/web/app/[locale]/(authed)/account/invitations/[invitationId]/page.tsx +3 -154
  60. package/templates/apps/web/app/[locale]/(authed)/account/layout.tsx +7 -149
  61. package/templates/apps/web/app/[locale]/(authed)/account/notifications/page.tsx +3 -143
  62. package/templates/apps/web/app/[locale]/(authed)/account/onboarding/page.tsx +3 -126
  63. package/templates/apps/web/app/[locale]/(authed)/account/page.tsx +8 -302
  64. package/templates/apps/web/app/[locale]/(authed)/account/privacy/export/route.ts +2 -102
  65. package/templates/apps/web/app/[locale]/(authed)/account/privacy/page.tsx +3 -240
  66. package/templates/apps/web/app/[locale]/(authed)/account/security/page.tsx +3 -131
  67. package/templates/apps/web/app/[locale]/(authed)/account/settings/page.tsx +2 -24
  68. package/templates/apps/web/app/[locale]/(authed)/account/support/page.tsx +3 -60
  69. package/templates/apps/web/app/[locale]/layout.tsx +45 -28
  70. package/templates/apps/web/app/apple-icon.tsx +72 -0
  71. package/templates/apps/web/app/llms.txt/__tests__/site-listing.test.ts +22 -12
  72. package/templates/apps/web/app/og/__tests__/__snapshots__/card.test.tsx.snap +3 -0
  73. package/templates/apps/web/app/og/__tests__/card.test.tsx +129 -0
  74. package/templates/apps/web/app/og/__tests__/route.test.ts +3 -4
  75. package/templates/apps/web/app/og/route.tsx +155 -72
  76. package/templates/apps/web/app/sitemap.xml/__tests__/site-listing.test.ts +12 -0
  77. package/templates/apps/web/i18n/request.ts +44 -1
  78. package/templates/apps/web/jest.config.cjs +13 -1
  79. package/templates/apps/web/lib/__tests__/auth-phone.test.ts +11 -0
  80. package/templates/apps/web/lib/__tests__/fixtures/site-topology.ts +70 -0
  81. package/templates/apps/web/lib/__tests__/nav-label-keys.test.ts +14 -0
  82. package/templates/apps/web/lib/__tests__/profile-back-link.test.ts +148 -61
  83. package/templates/apps/web/lib/__tests__/served-pages.test.ts +77 -0
  84. package/templates/apps/web/lib/__tests__/server-api.test.ts +37 -5
  85. package/templates/apps/web/lib/__tests__/structured-data.test.tsx +26 -13
  86. package/templates/apps/web/lib/listings.tsx +2 -2
  87. package/templates/apps/web/lib/nav-label-keys.ts +16 -2
  88. package/templates/apps/web/lib/paid-section-contracts.ts +35 -6
  89. package/templates/apps/web/lib/paid-sections.generated.ts +8 -0
  90. package/templates/apps/web/lib/profile-back-link.ts +105 -32
  91. package/templates/apps/web/lib/served-pages.ts +95 -0
  92. package/templates/apps/web/lib/site-brand.tsx +3 -5
  93. package/templates/apps/web/messages/en.json +8 -684
  94. package/templates/apps/web/middleware.ts +3 -1
  95. package/templates/apps/web/next.config.mjs +27 -0
  96. package/templates/apps/web/package.json +1 -0
  97. package/templates/customizations.yaml +9 -0
  98. package/templates/package.json +3 -1
  99. package/templates/tools/lint-architecture.ts +164 -11
  100. package/versions.json +48 -47
  101. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/account-frame-sign-out.test.tsx +0 -175
  102. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/agreements-prompt.test.tsx +0 -301
  103. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/billing.test.tsx +0 -515
  104. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/general.test.tsx +0 -883
  105. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/hub-mode.test.tsx +0 -758
  106. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/item.test.tsx +0 -264
  107. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/layout-sign-out.test.tsx +0 -167
  108. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/layout.test.tsx +0 -730
  109. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/new-menu.test.tsx +0 -355
  110. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/new-popups.test.tsx +0 -97
  111. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/notifications.test.tsx +0 -375
  112. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/onboarding.test.tsx +0 -323
  113. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/page.test.tsx +0 -1208
  114. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/popups.test.tsx +0 -418
  115. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/privacy.test.tsx +0 -462
  116. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/rich-translator.ts +0 -63
  117. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/security.test.tsx +0 -406
  118. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/settings.test.tsx +0 -93
  119. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/support.test.tsx +0 -208
  120. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/thread.test.tsx +0 -340
  121. package/templates/apps/web/app/[locale]/(authed)/account/account-data.ts +0 -182
  122. package/templates/apps/web/app/[locale]/(authed)/account/account-frame.tsx +0 -353
  123. package/templates/apps/web/app/[locale]/(authed)/account/actions.ts +0 -57
  124. package/templates/apps/web/app/[locale]/(authed)/account/agreements-actions.ts +0 -58
  125. package/templates/apps/web/app/[locale]/(authed)/account/agreements-gate.ts +0 -61
  126. package/templates/apps/web/app/[locale]/(authed)/account/agreements-prompt.tsx +0 -184
  127. package/templates/apps/web/app/[locale]/(authed)/account/appointments/__tests__/page.test.tsx +0 -426
  128. package/templates/apps/web/app/[locale]/(authed)/account/appointments/appointments-data.ts +0 -76
  129. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/[pieceId]/pay-form.tsx +0 -65
  130. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/[pieceId]/review-form.tsx +0 -172
  131. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/__tests__/file-route.test.ts +0 -333
  132. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/__tests__/page.test.tsx +0 -936
  133. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/__tests__/pay.test.tsx +0 -193
  134. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/__tests__/review.test.tsx +0 -476
  135. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/artifact-actions.ts +0 -184
  136. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/artifact-data.ts +0 -197
  137. package/templates/apps/web/app/[locale]/(authed)/account/billing/__tests__/offerings.test.ts +0 -99
  138. package/templates/apps/web/app/[locale]/(authed)/account/billing/offerings.ts +0 -123
  139. package/templates/apps/web/app/[locale]/(authed)/account/billing-source.ts +0 -303
  140. package/templates/apps/web/app/[locale]/(authed)/account/components/request-quote.tsx +0 -274
  141. package/templates/apps/web/app/[locale]/(authed)/account/error-row.tsx +0 -35
  142. package/templates/apps/web/app/[locale]/(authed)/account/for-you-labels.ts +0 -36
  143. package/templates/apps/web/app/[locale]/(authed)/account/general/__tests__/phone-verification.test.tsx +0 -215
  144. package/templates/apps/web/app/[locale]/(authed)/account/general/__tests__/seam-imports.test.ts +0 -65
  145. package/templates/apps/web/app/[locale]/(authed)/account/general/account-name.ts +0 -36
  146. package/templates/apps/web/app/[locale]/(authed)/account/general/billing-anchor.tsx +0 -27
  147. package/templates/apps/web/app/[locale]/(authed)/account/general/contact-actions.ts +0 -149
  148. package/templates/apps/web/app/[locale]/(authed)/account/general/contact-details.tsx +0 -42
  149. package/templates/apps/web/app/[locale]/(authed)/account/general/deletion-request.tsx +0 -132
  150. package/templates/apps/web/app/[locale]/(authed)/account/general/phone-actions.ts +0 -122
  151. package/templates/apps/web/app/[locale]/(authed)/account/general/phone-verification.tsx +0 -215
  152. package/templates/apps/web/app/[locale]/(authed)/account/general/photo-actions.ts +0 -73
  153. package/templates/apps/web/app/[locale]/(authed)/account/general/profile-form.tsx +0 -107
  154. package/templates/apps/web/app/[locale]/(authed)/account/general/profile-source.ts +0 -87
  155. package/templates/apps/web/app/[locale]/(authed)/account/inbox/message/[id]/file/__tests__/route.test.ts +0 -215
  156. package/templates/apps/web/app/[locale]/(authed)/account/inbox/thread/member-thread-composer.tsx +0 -43
  157. package/templates/apps/web/app/[locale]/(authed)/account/inbox/thread/thread-data.ts +0 -88
  158. package/templates/apps/web/app/[locale]/(authed)/account/inbox/thread/thread-write.ts +0 -31
  159. package/templates/apps/web/app/[locale]/(authed)/account/invitations/[invitationId]/__tests__/invitation-id.test.ts +0 -35
  160. package/templates/apps/web/app/[locale]/(authed)/account/invitations/[invitationId]/__tests__/page.test.tsx +0 -266
  161. package/templates/apps/web/app/[locale]/(authed)/account/invitations/[invitationId]/actions.ts +0 -116
  162. package/templates/apps/web/app/[locale]/(authed)/account/invitations/[invitationId]/invitation-id.ts +0 -12
  163. package/templates/apps/web/app/[locale]/(authed)/account/new-actions.ts +0 -219
  164. package/templates/apps/web/app/[locale]/(authed)/account/new-menu.tsx +0 -365
  165. package/templates/apps/web/app/[locale]/(authed)/account/new-popups.tsx +0 -86
  166. package/templates/apps/web/app/[locale]/(authed)/account/onboarding/actions.ts +0 -120
  167. package/templates/apps/web/app/[locale]/(authed)/account/onboarding/onboarding-form.tsx +0 -322
  168. package/templates/apps/web/app/[locale]/(authed)/account/privacy/__tests__/export-route.test.ts +0 -173
  169. package/templates/apps/web/app/[locale]/(authed)/account/privacy/actions.ts +0 -103
  170. package/templates/apps/web/app/[locale]/(authed)/account/profile-actions.ts +0 -116
  171. package/templates/apps/web/app/[locale]/(authed)/account/retry-button.tsx +0 -27
  172. package/templates/apps/web/app/[locale]/(authed)/account/security/__tests__/hub-variant.test.tsx +0 -258
  173. package/templates/apps/web/app/[locale]/(authed)/account/security/security-panel.tsx +0 -130
  174. package/templates/apps/web/app/[locale]/(authed)/account/security/security-source.ts +0 -92
  175. package/templates/apps/web/app/[locale]/(authed)/account/settings-frame.tsx +0 -121
  176. package/templates/apps/web/app/[locale]/(authed)/account/sign-in-method.ts +0 -37
  177. package/templates/apps/web/app/[locale]/(authed)/account/support/support-form.tsx +0 -98
  178. package/templates/apps/web/app/[locale]/(authed)/account/support-actions.ts +0 -100
  179. package/templates/apps/web/app/[locale]/checkout/__tests__/pages.test.tsx +0 -139
  180. package/templates/apps/web/app/[locale]/checkout/__tests__/thank-you-account.test.tsx +0 -146
  181. package/templates/apps/web/app/[locale]/checkout/thank-you/page.tsx +0 -114
  182. package/templates/apps/web/app/[locale]/checkout/unavailable/page.tsx +0 -51
  183. package/templates/apps/web/app/[locale]/flows/[slug]/FlowStepperClient.tsx +0 -614
  184. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.count.test.tsx +0 -43
  185. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.deliverable.test.tsx +0 -214
  186. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.ending.test.tsx +0 -197
  187. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.invite.test.tsx +0 -286
  188. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.permalink.test.tsx +0 -520
  189. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.test.tsx +0 -376
  190. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.thanks-by-tier.test.tsx +0 -306
  191. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/account-invite.actions.test.ts +0 -69
  192. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/flow.actions.test.ts +0 -398
  193. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/magnet-page.test.tsx +0 -704
  194. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/save.actions.test.ts +0 -173
  195. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/two-route-tool.test.tsx +0 -141
  196. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/verify.test.tsx +0 -249
  197. package/templates/apps/web/app/[locale]/flows/[slug]/account-invite.actions.ts +0 -35
  198. package/templates/apps/web/app/[locale]/flows/[slug]/email-moment.ts +0 -92
  199. package/templates/apps/web/app/[locale]/flows/[slug]/flow.actions.ts +0 -177
  200. package/templates/apps/web/app/[locale]/flows/[slug]/magnet-page.tsx +0 -472
  201. package/templates/apps/web/app/[locale]/flows/[slug]/page.tsx +0 -48
  202. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/LevelChart.tsx +0 -100
  203. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/ResultsCard.tsx +0 -99
  204. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/ResultsClient.tsx +0 -820
  205. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/ResultsEmailStep.tsx +0 -203
  206. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/ResultsClient.no-commerce.test.tsx +0 -194
  207. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/ResultsClient.report.test.tsx +0 -284
  208. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/by-result.test.tsx +0 -302
  209. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/cards.test.tsx +0 -402
  210. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/landing.test.tsx +0 -293
  211. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/page.test.tsx +0 -485
  212. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/score.test.tsx +0 -231
  213. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/checkout-seam.ts +0 -74
  214. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/meeting-seam.ts +0 -36
  215. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/page.tsx +0 -420
  216. package/templates/apps/web/app/[locale]/flows/[slug]/save.actions.ts +0 -85
  217. package/templates/apps/web/app/[locale]/flows/[slug]/served-flow.ts +0 -91
  218. package/templates/apps/web/app/[locale]/flows/[slug]/start/page.tsx +0 -32
  219. package/templates/apps/web/app/[locale]/flows/[slug]/verify/page.tsx +0 -153
  220. package/templates/apps/web/app/[locale]/flows/[slug]/verify.actions.ts +0 -151
  221. package/templates/apps/web/app/[locale]/meet/confirmed/BookingHandOff.tsx +0 -128
  222. package/templates/apps/web/app/[locale]/meet/confirmed/__tests__/BookingHandOff.test.tsx +0 -126
  223. package/templates/apps/web/app/[locale]/purchase/__tests__/cancel.test.tsx +0 -162
  224. package/templates/apps/web/app/[locale]/purchase/__tests__/module-scope.test.ts +0 -68
  225. package/templates/apps/web/app/[locale]/purchase/__tests__/success.test.tsx +0 -411
  226. package/templates/apps/web/app/[locale]/purchase/cancel/page.tsx +0 -115
  227. package/templates/apps/web/app/[locale]/purchase/success/page.tsx +0 -348
  228. package/templates/apps/web/lib/__tests__/account-config.test.ts +0 -704
  229. package/templates/apps/web/lib/account-config.ts +0 -678
  230. package/templates/apps/web/lib/checkout-config.ts +0 -16
  231. package/templates/apps/web/src/lib/__tests__/commerce-sections.test.ts +0 -57
  232. package/templates/apps/web/src/lib/commerce-sections.ts +0 -55
@@ -15,6 +15,10 @@
15
15
  * every layer (snapshot transform, module `patches`, `add-module`) already
16
16
  * keeps true. The monorepo's committed copy is the render with every row
17
17
  * present and is pinned byte-equal by `__tests__/paid-sections.test.ts`.
18
+ * Besides section registration, a row can carry a page package's message
19
+ * catalog: `apps/web/i18n/request.ts` merges `loadUiSignalCollectors()`'s
20
+ * flows strings and `loadUiScheduling()`'s `schedule` strings (#11252) under
21
+ * the site's own, and a stub's `null` merges nothing.
18
22
  *
19
23
  * Its sibling, `apps/web/lib/modules.generated.ts` (#8843 D10), is the
20
24
  * module-presence flag: `SCHEDULING_PAGES` is true exactly when the site
@@ -292,14 +296,40 @@ export function writePaidMcpTools(targetDir) {
292
296
  * absent — a scaffold with no web app.
293
297
  */
294
298
  export function writePaidSections(targetDir) {
299
+ if (writePaidSectionsRegistry(targetDir) === undefined)
300
+ return false;
301
+ writeModuleFlags(targetDir);
302
+ writePaidMcpTools(targetDir);
303
+ return true;
304
+ }
305
+ /**
306
+ * The registry rendered from `targetDir`'s own `apps/web/package.json`, or
307
+ * `undefined` for a scaffold with no web app. `create-ailk update` resolves a
308
+ * written file's imports of it against this render, never the site's copy
309
+ * on disk, which a release that added a loader has not yet rewritten (#11394).
310
+ */
311
+ export function renderSitePaidSections(targetDir) {
295
312
  const deps = webDependencies(targetDir, "paid-sections registry");
296
313
  if (deps === undefined)
297
- return false;
314
+ return undefined;
298
315
  const present = new Set(paidSectionRows()
299
316
  .map((row) => row.package)
300
317
  .filter((name) => Object.hasOwn(deps, name)));
301
- writeFileSync(join(targetDir, PAID_SECTIONS_PATH), renderPaidSections(present));
302
- writeModuleFlags(targetDir);
303
- writePaidMcpTools(targetDir);
304
- return true;
318
+ return renderPaidSections(present);
319
+ }
320
+ /**
321
+ * Write the registry alone, from `targetDir`'s own `apps/web/package.json` —
322
+ * `create-ailk update` rewrites it every run (#11394). Answers the
323
+ * `writeModuleFlags` shape.
324
+ */
325
+ export function writePaidSectionsRegistry(targetDir) {
326
+ const next = renderSitePaidSections(targetDir);
327
+ if (next === undefined)
328
+ return undefined;
329
+ const path = join(targetDir, PAID_SECTIONS_PATH);
330
+ const before = existsSync(path) ? readFileSync(path, "utf8") : undefined;
331
+ if (before === next)
332
+ return "unchanged";
333
+ writeFileSync(path, next);
334
+ return before === undefined ? "added" : "updated";
305
335
  }
@@ -45,7 +45,7 @@ import { SITE_CHROME_PATH, renderSiteChrome, resolveSiteChrome, } from "./site-c
45
45
  import { SITE_FONTS_PATH, renderSiteFonts } from "./site-fonts.js";
46
46
  import { planSiteManifest } from "./site-manifest.js";
47
47
  import { SITE_ROSTER_PATH, planHomeRecord, planSiteManifestDesign, readSiteRoster, withMeetPlaceholderSeeds, } from "./site-roster.js";
48
- import { SPOKE_CHECKOUT_TEMPLATE_PATHS, dropSpokeCheckoutDependency, spokeCheckoutSite, spokeEnvRowOptions, writeSpokeCheckoutSlice, } from "./spoke-checkout.js";
48
+ import { dropSpokeCheckoutDependency, spokeCheckoutSite, spokeEnvRowOptions, writeSpokeCheckoutSlice, } from "./spoke-checkout.js";
49
49
  import { GATEABLE_SURFACES, NAV_CONFIG_PATH, excludedRoutePaths, isUnservedSurfaceContent, isUnservedSurfaceRoute, renderNavConfig, resolveSurfaces, surfacesNamedByRoutes, } from "./surfaces.js";
50
50
  import { syncRoutes } from "./sync-routes.js";
51
51
  import { BASE_LAYER_DIR, SHAPE_STARTERS, isOwnTree, shippedManifestPath, TEMPLATE_MANIFESTS, TemplateError, mergeRoster, resolveTemplate, resolveTemplateLineage, rosterDeclares, templateDelivery, templateTreeDir, } from "./template-manifest.js";
@@ -185,9 +185,6 @@ export function scaffoldSync(opts, copied) {
185
185
  ...(spoke !== undefined
186
186
  ? spokeExclusions(TEMPLATES_DIR, spoke)
187
187
  : SPOKE_ONLY_FILES),
188
- // #8748 D3 — the standard spoke checkout lands only through
189
- // `writeSpokeCheckoutSlice`, on a spoke carrying commerce.
190
- ...SPOKE_CHECKOUT_TEMPLATE_PATHS,
191
188
  ],
192
189
  markers: buildScaffoldMarkers(projectName),
193
190
  ...(copied !== undefined
@@ -819,26 +816,19 @@ export async function scaffold(opts) {
819
816
  writeFileSync(rosterPath, manifestText);
820
817
  }
821
818
  }
822
- // #7838 D8 — a commerce spoke's own checkout: the standard spoke checkout
823
- // copied from the template (#8748 D3), its config stamped, once every layer
824
- // has landed (so the spoke filter has already dropped the hub-checkout
825
- // files) and before the manifest, whose code-route rows then record
826
- // /checkout/thank-you and /checkout/unavailable. Each copied file is
827
- // recorded like the base copy's, so `update` keeps it current.
819
+ // #7838 D8 — a commerce spoke's own checkout stamp, once every layer has
820
+ // landed: the commerce bundle delivered `lib/checkout-config.ts` with the
821
+ // placeholder stamp, and this stamps it in place (#11253 D6). The return
822
+ // pages ship in `@working-theory/ui-commerce` and mount through
823
+ // `routes --write` after the install (#11253).
828
824
  // #8217 D8 — a spoke that signs in through its hub also gets the billing
829
825
  // action and the web seam render that reaches it.
830
826
  const spokeCommerce = spoke !== undefined && result.modules.includes("commerce");
831
827
  if (spokeCommerce) {
832
828
  writeSpokeCheckoutSlice(result.targetDir, {
833
829
  site: spokeCheckoutSite(projectName),
834
- projectName,
835
830
  versions,
836
- templatesDir: TEMPLATES_DIR,
837
831
  signIn: spoke.signIn,
838
- onWrite: (relPath, bytes) => {
839
- if (isRecordable(relPath))
840
- copied.set(relPath, sha256Hex(bytes));
841
- },
842
832
  });
843
833
  }
844
834
  // #6944 — the manifest records what this scaffold IS, once every layer has
@@ -42,6 +42,7 @@ import { deriveArchitecture } from "./derive-architecture.js";
42
42
  import { MODULE_SLICES, normalizeModules } from "./module-architecture.js";
43
43
  import { MODULE_FLAGS_PATH, PAID_MCP_TOOLS_PATH, PAID_SECTIONS_PATH, writePaidSections, } from "./paid-sections.js";
44
44
  import { ParseError, parseModules } from "./parse-args.js";
45
+ import { GENERATED_ROUTE_HEADER, isRecordedRoute, OSS_FALSE_MARKER } from "./routes.js";
45
46
  import { SITE_ROSTER_PATH, readSiteRoster } from "./site-roster.js";
46
47
  import { HUB_KEPT_ROUTE_DIRS, MODULE_SURFACES, ROUTE_ROOT, resolveSurfaces, } from "./surfaces.js";
47
48
  import { BASE_LAYER_DIR, templateTreeDir } from "./template-manifest.js";
@@ -187,6 +188,62 @@ export function removalSet(targetDir, moduleName) {
187
188
  .filter((p) => existsSync(join(targetDir, ...p.split("/"))))
188
189
  .sort();
189
190
  }
191
+ // ── Edited-file classification (D5) ─────────────────────────────────────────
192
+ /** The `request` a removed generated route's `customizations.yaml` entry names. */
193
+ const REMOVED_ROUTE_REQUEST = "working-theory-labs/ai-launch-kit-internal#11251";
194
+ /**
195
+ * Whether a file opens with the `create-ailk routes --write` header — on
196
+ * line 1, or on line 2 behind the `// oss: false` marker (#11252).
197
+ */
198
+ function isGeneratedRoute(bytes) {
199
+ const text = Buffer.from(bytes).toString("utf8");
200
+ const marker = `${OSS_FALSE_MARKER}\n`;
201
+ return (text.startsWith(marker) ? text.slice(marker.length) : text).startsWith(GENERATED_ROUTE_HEADER);
202
+ }
203
+ /**
204
+ * Append one `customizations.yaml` entry per removed generated route file
205
+ * (#11251 D12): `id: removed-<route>`, its one path, the decision that the
206
+ * site removed it with `moduleName`. A path the file already names is left
207
+ * as it is; an empty `customizations: []` becomes `customizations:` first.
208
+ */
209
+ function recordRemovedRoutes(targetDir, removed, moduleName) {
210
+ const fresh = removed.filter((p) => !isRecordedRoute(targetDir, p));
211
+ if (fresh.length === 0)
212
+ return;
213
+ const path = join(targetDir, "customizations.yaml");
214
+ const lines = (existsSync(path) ? readFileSync(path, "utf8") : "").replace(/\n*$/, "").split("\n");
215
+ let start = lines.findIndex((line) => /^customizations:/.test(line));
216
+ if (start === -1) {
217
+ if (lines.length === 1 && lines[0] === "")
218
+ lines.length = 0;
219
+ lines.push("customizations:");
220
+ start = lines.length - 1;
221
+ }
222
+ else if (/^customizations:\s*\[\s*\]\s*$/.test(lines[start])) {
223
+ lines[start] = "customizations:";
224
+ }
225
+ // The entries go at the end of the `customizations:` list — before the next
226
+ // top-level key (`declined_routes:`, `undecided_ok_until:`), never after it.
227
+ let end = lines.findIndex((line, i) => i > start && /^\S/.test(line) && !line.startsWith("#"));
228
+ if (end === -1)
229
+ end = lines.length;
230
+ while (end > start + 1 && lines[end - 1].trim() === "")
231
+ end--;
232
+ const today = new Date().toISOString().slice(0, 10);
233
+ const entries = fresh.flatMap((p) => {
234
+ const route = p.slice(`${ROUTE_ROOT}/`.length).replace(/\.[a-z]+$/, "");
235
+ const id = `removed-${route.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "")}`;
236
+ return [
237
+ ` - id: ${JSON.stringify(id)}`,
238
+ " paths:",
239
+ ` - ${JSON.stringify(p)}`,
240
+ ` request: ${JSON.stringify(REMOVED_ROUTE_REQUEST)}`,
241
+ ` decision: ${JSON.stringify(`build-in: site — create-ailk remove-module ${moduleName}, ${today}, the site removed the ${moduleName} module`)}`,
242
+ ];
243
+ });
244
+ lines.splice(end, 0, ...entries);
245
+ writeFileSync(path, `${lines.join("\n")}\n`);
246
+ }
190
247
  /** The template's copy of `path`, rendered as `copyTemplate` wrote it, or undefined when the template lacks it. */
191
248
  function templateCopy(layers, path) {
192
249
  const abs = join(layers.templatesDir, ...path.split("/"));
@@ -225,6 +282,11 @@ function seedMatches(layers, path, disk) {
225
282
  */
226
283
  function isEdited(layers, targetDir, path) {
227
284
  const disk = readFileSync(join(targetDir, ...path.split("/")));
285
+ // #11251 D12 — a route file `create-ailk routes --write` generated is the
286
+ // page package's code, never the site's edit (`routes --check` holds it to
287
+ // the manifest).
288
+ if (isGeneratedRoute(disk))
289
+ return false;
228
290
  // A carried module's own sample seeds are placeholders by contract (the
229
291
  // starter-template contract R2); no shipped layer holds their bytes to
230
292
  // compare, and they are never the site's own page.
@@ -376,8 +438,13 @@ export function removeModuleFromScaffold(opts) {
376
438
  ].join("\n"));
377
439
  }
378
440
  // ── Delete, then prune the directories the deletions emptied ────────────
441
+ const generatedRoutes = paths.filter((p) => isGeneratedRoute(readFileSync(join(targetDir, ...p.split("/")))));
379
442
  for (const p of paths)
380
443
  rmSync(join(targetDir, ...p.split("/")));
444
+ // #11251 D12 (ADR 0040 rule 2) — a deleted generated route is recorded as
445
+ // the site's removal, so the next `routes --write` skips it and
446
+ // `routes --check` reports it removed, never missing.
447
+ recordRemovedRoutes(targetDir, generatedRoutes, moduleName);
381
448
  if (moduleName === "marketing") {
382
449
  pruneEmpty(join(targetDir, ...ROUTE_ROOT.split("/")), false);
383
450
  pruneEmpty(join(targetDir, "content"), false);
@@ -0,0 +1,103 @@
1
+ /** The app a page package's routes mount in, relative to the site root. */
2
+ export declare const ROUTES_APP_DIR = "apps/web";
3
+ export type RouteKind = "page" | "layout" | "route";
4
+ export interface RouteEntry {
5
+ /** The routing file under `app/[locale]/`, POSIX, e.g. `(authed)/account/general/page.tsx`. */
6
+ path: string;
7
+ kind: RouteKind;
8
+ /** The package subpath the file re-exports from, e.g. `general/page` → `@working-theory/account/general/page`. */
9
+ module: string;
10
+ /** The exports to re-export: `default`, `metadata`, `generateMetadata`, or HTTP methods on a handler. */
11
+ exports: string[];
12
+ /** Route-segment-config lines, copied literally. */
13
+ segmentConfig: string[];
14
+ /** Whether the default export takes the site's config as a `config` prop. */
15
+ config: boolean;
16
+ /** Whether `generateMetadata` takes it too (#11253) — only with `config` and a `generateMetadata` export. */
17
+ metadataConfig: boolean;
18
+ }
19
+ export interface RouteManifest {
20
+ package: string;
21
+ version: string;
22
+ /** The package's route prefixes under `app/[locale]/` — the stray check's scope; a manifest's single string is wrapped. */
23
+ prefix: string[];
24
+ /** The site's config file at the app root, without extension (`account.config`). */
25
+ config: string | undefined;
26
+ /** Routing files under the prefix that stay the site's own pages, never generated. */
27
+ siteOwned: string[];
28
+ /** The package's message catalog, when it ships one. */
29
+ messages: ManifestMessages | undefined;
30
+ /** `false` when each generated file carries the `// oss: false` marker; unset otherwise. */
31
+ oss: false | undefined;
32
+ routes: RouteEntry[];
33
+ /** The installed package's directory, which `messages.catalog` is relative to (set by `readRouteManifests`). */
34
+ root?: string;
35
+ }
36
+ export interface ManifestMessages {
37
+ /** The installed package's catalog directory, one `<locale>.json` per locale. */
38
+ catalog: string;
39
+ /** Dotted key prefixes under the package's namespaces that are the site's own strings. */
40
+ siteOwned: string[];
41
+ }
42
+ export declare class RoutesRefusedError extends Error {
43
+ readonly exitCode = 2;
44
+ constructor(message: string);
45
+ }
46
+ /** Parse and validate one manifest; every refusal names the package and the entry. */
47
+ export declare function parseRouteManifest(pkg: string, version: string, raw: unknown): RouteManifest;
48
+ /**
49
+ * The route manifests of the installed page packages, in package-name
50
+ * order: every `@working-theory/*` dependency of `<site>/apps/web` whose
51
+ * installed `package.json` declares one. A dependency not installed yet
52
+ * (before `pnpm install`) declares nothing and is not an error.
53
+ */
54
+ export declare function readRouteManifests(siteDir: string): RouteManifest[];
55
+ /** The header line of every generated route file begins with this; `remove-module` reads it as module code. */
56
+ export declare const GENERATED_ROUTE_HEADER = "// Generated by create-ailk routes from ";
57
+ /** Line 1 of a generated file whose manifest sets `"oss": false` — the public strip's file marker. */
58
+ export declare const OSS_FALSE_MARKER = "// oss: false";
59
+ /** The generated file's text for one entry. Every statement is one line; the config wrapper is in prettier's shape. */
60
+ export declare function renderRouteFile(manifest: RouteManifest, entry: RouteEntry): string;
61
+ /** Whether `<siteDir>/customizations.yaml` records `sitePath` — any entry, any path form or glob (the generator's own reading). */
62
+ export declare function isRecordedRoute(siteDir: string, sitePath: string): boolean;
63
+ export interface RecordedRoute {
64
+ path: string;
65
+ state: "replaced" | "removed";
66
+ id: string;
67
+ }
68
+ export interface RoutesDrift {
69
+ missing: string[];
70
+ stale: string[];
71
+ stray: string[];
72
+ recorded: RecordedRoute[];
73
+ /** The manifest entries the site's topology does not carry (a spoke without the account area). */
74
+ notCarried: string[];
75
+ /** Routing files under a prefix that the package's manifest leaves to the site (`siteOwned`). */
76
+ siteKept: string[];
77
+ /** Site message keys under a package's namespace that its catalog no longer has: `<file>: <key>`. */
78
+ orphanedOverrides: string[];
79
+ /** The manifest entries in force — recorded ones included, not-carried ones not. */
80
+ generated: number;
81
+ }
82
+ /** The count check mode fails on: missing, stale and stray route files and orphaned overrides. */
83
+ export declare function routesFailing(drift: RoutesDrift): number;
84
+ /** How the site's route files and message overrides differ from the installed page packages. `routesFailing` zero means in sync. */
85
+ export declare function checkRoutes(siteDir: string): RoutesDrift;
86
+ export interface WriteRoutesResult {
87
+ written: string[];
88
+ current: string[];
89
+ recorded: RecordedRoute[];
90
+ }
91
+ /** Write every generated file that is missing or stale; a recorded route is left exactly as it is. */
92
+ export declare function writeRoutes(siteDir: string): WriteRoutesResult;
93
+ export interface RoutesArgs {
94
+ target: string | undefined;
95
+ write: boolean;
96
+ check: boolean;
97
+ help: boolean;
98
+ }
99
+ export declare const ROUTES_HELP = "create-ailk routes \u2014 generate the route files for the pages a site's packages ship.\n\nUsage:\n create-ailk routes --write [<target-dir>]\n create-ailk routes --check [<target-dir>]\n\nArguments:\n <target-dir> The site root (holds apps/web). Defaults to the\n current dir.\n\nOptions:\n --write Write one generated file per route the installed\n page packages declare, under apps/web/app/[locale]/.\n A file already current is left alone.\n --check Write nothing; exit 1 naming each generated file\n that is missing, stale (differs from what --write\n would write) or stray (a page.tsx, layout.tsx or\n route.ts under a package's route prefix that is\n neither generated, recorded, nor one the package\n leaves to the site). It also names each orphaned\n override: a key in apps/web/messages/<locale>.json\n under a namespace a package's catalog ships that\n the catalog no longer has.\n --help, -h Print this message.\n\nA page package is an installed @working-theory/* dependency of apps/web whose\npackage.json declares \"ailk\": { \"routes\": \"<manifest>\" }. A generated file\nre-exports the package's page and copies its route-segment config; when the\npage takes the site's config it imports the manifest's config file from the\napp root (apps/web/account.config.tsx, say) and passes it in. Replace or remove a shipped route by recording it in\ncustomizations.yaml (an entry whose paths match the route file): a recorded\nroute is reported as replaced or removed, never failed, and --write never\ntouches it. Run --write after `pnpm install` (the manifests are read from the\ninstalled packages); the scaffold's preflight runs --check as `pnpm routes:check`.\n";
100
+ /** Parse the argv AFTER the `routes` word. Strict `node:util` parseArgs, like `parseSyncRoutesArgs`. */
101
+ export declare function parseRoutesArgs(argv: string[]): RoutesArgs;
102
+ /** The printed report: one line per file, grouped by state; the recorded routes last, under their decision. */
103
+ export declare function formatRoutesReport(result: RoutesDrift | WriteRoutesResult, mode: "check" | "write"): string;