create-ailk 0.37.1 → 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 (230) 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 +18 -11
  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 +14 -1
  36. package/dist/sync-routes.js +86 -5
  37. package/dist/topology.d.ts +15 -1
  38. package/dist/topology.js +20 -4
  39. package/dist/update.d.ts +17 -2
  40. package/dist/update.js +480 -77
  41. package/package.json +3 -3
  42. package/templates/README.md +1 -1
  43. package/templates/apps/mcp/CLAUDE.md +5 -3
  44. package/templates/apps/web/CLAUDE.md +62 -20
  45. package/templates/apps/web/account.config.tsx +101 -0
  46. package/templates/apps/web/app/[locale]/(authed)/account/appointments/[slug]/page.tsx +3 -161
  47. package/templates/apps/web/app/[locale]/(authed)/account/appointments/page.tsx +3 -139
  48. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/[pieceId]/page.tsx +3 -406
  49. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/[pieceId]/versions/[version]/file/route.ts +2 -190
  50. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/page.tsx +3 -182
  51. package/templates/apps/web/app/[locale]/(authed)/account/billing/page.tsx +8 -420
  52. package/templates/apps/web/app/[locale]/(authed)/account/connect/page.tsx +1 -1
  53. package/templates/apps/web/app/[locale]/(authed)/account/general/page.tsx +8 -214
  54. package/templates/apps/web/app/[locale]/(authed)/account/inbox/[kind]/[id]/page.tsx +8 -115
  55. package/templates/apps/web/app/[locale]/(authed)/account/inbox/message/[id]/file/route.ts +2 -80
  56. package/templates/apps/web/app/[locale]/(authed)/account/inbox/thread/page.tsx +8 -121
  57. package/templates/apps/web/app/[locale]/(authed)/account/invitations/[invitationId]/page.tsx +3 -154
  58. package/templates/apps/web/app/[locale]/(authed)/account/layout.tsx +7 -149
  59. package/templates/apps/web/app/[locale]/(authed)/account/notifications/page.tsx +3 -143
  60. package/templates/apps/web/app/[locale]/(authed)/account/onboarding/page.tsx +3 -126
  61. package/templates/apps/web/app/[locale]/(authed)/account/page.tsx +8 -302
  62. package/templates/apps/web/app/[locale]/(authed)/account/privacy/export/route.ts +2 -102
  63. package/templates/apps/web/app/[locale]/(authed)/account/privacy/page.tsx +3 -240
  64. package/templates/apps/web/app/[locale]/(authed)/account/security/page.tsx +3 -131
  65. package/templates/apps/web/app/[locale]/(authed)/account/settings/page.tsx +2 -24
  66. package/templates/apps/web/app/[locale]/(authed)/account/support/page.tsx +3 -60
  67. package/templates/apps/web/app/[locale]/layout.tsx +45 -28
  68. package/templates/apps/web/app/apple-icon.tsx +72 -0
  69. package/templates/apps/web/app/llms.txt/__tests__/site-listing.test.ts +22 -12
  70. package/templates/apps/web/app/og/__tests__/__snapshots__/card.test.tsx.snap +3 -0
  71. package/templates/apps/web/app/og/__tests__/card.test.tsx +129 -0
  72. package/templates/apps/web/app/og/__tests__/route.test.ts +3 -4
  73. package/templates/apps/web/app/og/route.tsx +155 -72
  74. package/templates/apps/web/app/sitemap.xml/__tests__/site-listing.test.ts +12 -0
  75. package/templates/apps/web/i18n/request.ts +44 -1
  76. package/templates/apps/web/jest.config.cjs +13 -1
  77. package/templates/apps/web/lib/__tests__/auth-phone.test.ts +11 -0
  78. package/templates/apps/web/lib/__tests__/fixtures/site-topology.ts +70 -0
  79. package/templates/apps/web/lib/__tests__/nav-label-keys.test.ts +14 -0
  80. package/templates/apps/web/lib/__tests__/profile-back-link.test.ts +148 -61
  81. package/templates/apps/web/lib/__tests__/served-pages.test.ts +77 -0
  82. package/templates/apps/web/lib/__tests__/server-api.test.ts +37 -5
  83. package/templates/apps/web/lib/__tests__/structured-data.test.tsx +26 -13
  84. package/templates/apps/web/lib/listings.tsx +2 -2
  85. package/templates/apps/web/lib/nav-label-keys.ts +16 -2
  86. package/templates/apps/web/lib/paid-section-contracts.ts +35 -6
  87. package/templates/apps/web/lib/paid-sections.generated.ts +8 -0
  88. package/templates/apps/web/lib/profile-back-link.ts +105 -32
  89. package/templates/apps/web/lib/served-pages.ts +95 -0
  90. package/templates/apps/web/lib/site-brand.tsx +3 -5
  91. package/templates/apps/web/messages/en.json +8 -684
  92. package/templates/apps/web/middleware.ts +3 -1
  93. package/templates/apps/web/next.config.mjs +27 -0
  94. package/templates/apps/web/package.json +1 -0
  95. package/templates/customizations.yaml +9 -0
  96. package/templates/package.json +3 -1
  97. package/templates/tools/lint-architecture.ts +164 -11
  98. package/versions.json +48 -47
  99. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/account-frame-sign-out.test.tsx +0 -175
  100. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/agreements-prompt.test.tsx +0 -301
  101. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/billing.test.tsx +0 -515
  102. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/general.test.tsx +0 -883
  103. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/hub-mode.test.tsx +0 -758
  104. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/item.test.tsx +0 -264
  105. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/layout-sign-out.test.tsx +0 -167
  106. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/layout.test.tsx +0 -730
  107. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/new-menu.test.tsx +0 -355
  108. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/new-popups.test.tsx +0 -97
  109. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/notifications.test.tsx +0 -375
  110. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/onboarding.test.tsx +0 -323
  111. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/page.test.tsx +0 -1208
  112. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/popups.test.tsx +0 -418
  113. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/privacy.test.tsx +0 -462
  114. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/rich-translator.ts +0 -63
  115. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/security.test.tsx +0 -406
  116. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/settings.test.tsx +0 -93
  117. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/support.test.tsx +0 -208
  118. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/thread.test.tsx +0 -340
  119. package/templates/apps/web/app/[locale]/(authed)/account/account-data.ts +0 -182
  120. package/templates/apps/web/app/[locale]/(authed)/account/account-frame.tsx +0 -353
  121. package/templates/apps/web/app/[locale]/(authed)/account/actions.ts +0 -57
  122. package/templates/apps/web/app/[locale]/(authed)/account/agreements-actions.ts +0 -58
  123. package/templates/apps/web/app/[locale]/(authed)/account/agreements-gate.ts +0 -61
  124. package/templates/apps/web/app/[locale]/(authed)/account/agreements-prompt.tsx +0 -184
  125. package/templates/apps/web/app/[locale]/(authed)/account/appointments/__tests__/page.test.tsx +0 -426
  126. package/templates/apps/web/app/[locale]/(authed)/account/appointments/appointments-data.ts +0 -76
  127. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/[pieceId]/pay-form.tsx +0 -65
  128. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/[pieceId]/review-form.tsx +0 -172
  129. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/__tests__/file-route.test.ts +0 -333
  130. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/__tests__/page.test.tsx +0 -936
  131. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/__tests__/pay.test.tsx +0 -193
  132. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/__tests__/review.test.tsx +0 -476
  133. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/artifact-actions.ts +0 -184
  134. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/artifact-data.ts +0 -197
  135. package/templates/apps/web/app/[locale]/(authed)/account/billing/__tests__/offerings.test.ts +0 -99
  136. package/templates/apps/web/app/[locale]/(authed)/account/billing/offerings.ts +0 -123
  137. package/templates/apps/web/app/[locale]/(authed)/account/billing-source.ts +0 -303
  138. package/templates/apps/web/app/[locale]/(authed)/account/components/request-quote.tsx +0 -274
  139. package/templates/apps/web/app/[locale]/(authed)/account/error-row.tsx +0 -35
  140. package/templates/apps/web/app/[locale]/(authed)/account/for-you-labels.ts +0 -36
  141. package/templates/apps/web/app/[locale]/(authed)/account/general/__tests__/phone-verification.test.tsx +0 -215
  142. package/templates/apps/web/app/[locale]/(authed)/account/general/__tests__/seam-imports.test.ts +0 -65
  143. package/templates/apps/web/app/[locale]/(authed)/account/general/account-name.ts +0 -36
  144. package/templates/apps/web/app/[locale]/(authed)/account/general/billing-anchor.tsx +0 -27
  145. package/templates/apps/web/app/[locale]/(authed)/account/general/contact-actions.ts +0 -149
  146. package/templates/apps/web/app/[locale]/(authed)/account/general/contact-details.tsx +0 -42
  147. package/templates/apps/web/app/[locale]/(authed)/account/general/deletion-request.tsx +0 -132
  148. package/templates/apps/web/app/[locale]/(authed)/account/general/phone-actions.ts +0 -122
  149. package/templates/apps/web/app/[locale]/(authed)/account/general/phone-verification.tsx +0 -215
  150. package/templates/apps/web/app/[locale]/(authed)/account/general/photo-actions.ts +0 -73
  151. package/templates/apps/web/app/[locale]/(authed)/account/general/profile-form.tsx +0 -107
  152. package/templates/apps/web/app/[locale]/(authed)/account/general/profile-source.ts +0 -87
  153. package/templates/apps/web/app/[locale]/(authed)/account/inbox/message/[id]/file/__tests__/route.test.ts +0 -215
  154. package/templates/apps/web/app/[locale]/(authed)/account/inbox/thread/member-thread-composer.tsx +0 -43
  155. package/templates/apps/web/app/[locale]/(authed)/account/inbox/thread/thread-data.ts +0 -88
  156. package/templates/apps/web/app/[locale]/(authed)/account/inbox/thread/thread-write.ts +0 -31
  157. package/templates/apps/web/app/[locale]/(authed)/account/invitations/[invitationId]/__tests__/invitation-id.test.ts +0 -35
  158. package/templates/apps/web/app/[locale]/(authed)/account/invitations/[invitationId]/__tests__/page.test.tsx +0 -266
  159. package/templates/apps/web/app/[locale]/(authed)/account/invitations/[invitationId]/actions.ts +0 -116
  160. package/templates/apps/web/app/[locale]/(authed)/account/invitations/[invitationId]/invitation-id.ts +0 -12
  161. package/templates/apps/web/app/[locale]/(authed)/account/new-actions.ts +0 -219
  162. package/templates/apps/web/app/[locale]/(authed)/account/new-menu.tsx +0 -365
  163. package/templates/apps/web/app/[locale]/(authed)/account/new-popups.tsx +0 -86
  164. package/templates/apps/web/app/[locale]/(authed)/account/onboarding/actions.ts +0 -120
  165. package/templates/apps/web/app/[locale]/(authed)/account/onboarding/onboarding-form.tsx +0 -322
  166. package/templates/apps/web/app/[locale]/(authed)/account/privacy/__tests__/export-route.test.ts +0 -173
  167. package/templates/apps/web/app/[locale]/(authed)/account/privacy/actions.ts +0 -103
  168. package/templates/apps/web/app/[locale]/(authed)/account/profile-actions.ts +0 -116
  169. package/templates/apps/web/app/[locale]/(authed)/account/retry-button.tsx +0 -27
  170. package/templates/apps/web/app/[locale]/(authed)/account/security/__tests__/hub-variant.test.tsx +0 -258
  171. package/templates/apps/web/app/[locale]/(authed)/account/security/security-panel.tsx +0 -130
  172. package/templates/apps/web/app/[locale]/(authed)/account/security/security-source.ts +0 -92
  173. package/templates/apps/web/app/[locale]/(authed)/account/settings-frame.tsx +0 -121
  174. package/templates/apps/web/app/[locale]/(authed)/account/sign-in-method.ts +0 -37
  175. package/templates/apps/web/app/[locale]/(authed)/account/support/support-form.tsx +0 -98
  176. package/templates/apps/web/app/[locale]/(authed)/account/support-actions.ts +0 -100
  177. package/templates/apps/web/app/[locale]/checkout/__tests__/pages.test.tsx +0 -139
  178. package/templates/apps/web/app/[locale]/checkout/__tests__/thank-you-account.test.tsx +0 -146
  179. package/templates/apps/web/app/[locale]/checkout/thank-you/page.tsx +0 -114
  180. package/templates/apps/web/app/[locale]/checkout/unavailable/page.tsx +0 -51
  181. package/templates/apps/web/app/[locale]/flows/[slug]/FlowStepperClient.tsx +0 -614
  182. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.count.test.tsx +0 -43
  183. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.deliverable.test.tsx +0 -214
  184. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.ending.test.tsx +0 -197
  185. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.invite.test.tsx +0 -286
  186. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.permalink.test.tsx +0 -520
  187. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.test.tsx +0 -376
  188. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.thanks-by-tier.test.tsx +0 -306
  189. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/account-invite.actions.test.ts +0 -69
  190. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/flow.actions.test.ts +0 -398
  191. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/magnet-page.test.tsx +0 -704
  192. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/save.actions.test.ts +0 -173
  193. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/two-route-tool.test.tsx +0 -141
  194. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/verify.test.tsx +0 -249
  195. package/templates/apps/web/app/[locale]/flows/[slug]/account-invite.actions.ts +0 -35
  196. package/templates/apps/web/app/[locale]/flows/[slug]/email-moment.ts +0 -92
  197. package/templates/apps/web/app/[locale]/flows/[slug]/flow.actions.ts +0 -177
  198. package/templates/apps/web/app/[locale]/flows/[slug]/magnet-page.tsx +0 -472
  199. package/templates/apps/web/app/[locale]/flows/[slug]/page.tsx +0 -48
  200. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/LevelChart.tsx +0 -100
  201. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/ResultsCard.tsx +0 -99
  202. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/ResultsClient.tsx +0 -820
  203. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/ResultsEmailStep.tsx +0 -203
  204. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/ResultsClient.no-commerce.test.tsx +0 -194
  205. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/ResultsClient.report.test.tsx +0 -284
  206. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/by-result.test.tsx +0 -302
  207. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/cards.test.tsx +0 -402
  208. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/landing.test.tsx +0 -293
  209. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/page.test.tsx +0 -485
  210. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/score.test.tsx +0 -231
  211. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/checkout-seam.ts +0 -74
  212. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/meeting-seam.ts +0 -36
  213. package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/page.tsx +0 -420
  214. package/templates/apps/web/app/[locale]/flows/[slug]/save.actions.ts +0 -85
  215. package/templates/apps/web/app/[locale]/flows/[slug]/served-flow.ts +0 -91
  216. package/templates/apps/web/app/[locale]/flows/[slug]/start/page.tsx +0 -32
  217. package/templates/apps/web/app/[locale]/flows/[slug]/verify/page.tsx +0 -153
  218. package/templates/apps/web/app/[locale]/flows/[slug]/verify.actions.ts +0 -151
  219. package/templates/apps/web/app/[locale]/meet/confirmed/BookingHandOff.tsx +0 -128
  220. package/templates/apps/web/app/[locale]/meet/confirmed/__tests__/BookingHandOff.test.tsx +0 -126
  221. package/templates/apps/web/app/[locale]/purchase/__tests__/cancel.test.tsx +0 -162
  222. package/templates/apps/web/app/[locale]/purchase/__tests__/module-scope.test.ts +0 -68
  223. package/templates/apps/web/app/[locale]/purchase/__tests__/success.test.tsx +0 -411
  224. package/templates/apps/web/app/[locale]/purchase/cancel/page.tsx +0 -115
  225. package/templates/apps/web/app/[locale]/purchase/success/page.tsx +0 -348
  226. package/templates/apps/web/lib/__tests__/account-config.test.ts +0 -704
  227. package/templates/apps/web/lib/account-config.ts +0 -678
  228. package/templates/apps/web/lib/checkout-config.ts +0 -16
  229. package/templates/apps/web/src/lib/__tests__/commerce-sections.test.ts +0 -57
  230. package/templates/apps/web/src/lib/commerce-sections.ts +0 -55
package/README.md CHANGED
@@ -296,6 +296,24 @@ scaffold's). It never rewrites or deletes an existing file, writes nothing
296
296
  outside `apps/web/app/[locale]/` except the local modules those routes import
297
297
  (below), runs no install, and a second run is a no-op. `--apply` exits 0 on success.
298
298
 
299
+ **A route the site declined stays declined.** A site that drops one template
300
+ route on purpose records it in `customizations.yaml`:
301
+
302
+ ```yaml
303
+ declined_routes:
304
+ - route: "pricing/[slug]" # as it sits under apps/web/app/[locale]/
305
+ reason: "this site sells from /pricing alone"
306
+ decided: "Site Owner, 2026-11-02" # <decider>, <YYYY-MM-DD>
307
+ ```
308
+
309
+ `sync-routes` lists a declined route (and its sub-routes) under **Declined by
310
+ this site**, never as missing, so a check whose only gaps are declined routes
311
+ exits 0; `--apply` never copies it, not even inside an ancestor route's copy.
312
+ `create-ailk update` never writes a file under a declined route's directory and
313
+ lists each one it skips. The scaffold's `pnpm architecture` refuses an entry
314
+ with no `reason`, no `decided` line, or naming no route the template carries
315
+ (#11260).
316
+
299
317
  **What `--apply` copies, it records.** Every file it writes gets a row in
300
318
  `.ailk-template-files.json` — the sha256 of the bytes written and the
301
319
  create-ailk version that copied it — so `create-ailk update` (below) reads it
@@ -369,6 +387,112 @@ the route-surface registry in the same file.
369
387
  `ROUTE_SINCE` entry — `__tests__/sync-routes.test.ts` fails otherwise (and it
370
388
  fails on a stale entry for a route the template no longer ships).
371
389
 
390
+ ### Generate the route files for the pages a site's packages ship
391
+
392
+ A website page ships in a package (ADR 0040): its implementation, data
393
+ loading and server actions live in a `@working-theory/*` package, and the
394
+ site's `apps/web/app/[locale]/` holds **one generated file per route** —
395
+ nothing of the page's implementation. `routes` is the one generator for
396
+ every such package:
397
+
398
+ ```bash
399
+ # write the generated files (run after `pnpm install` — the manifests are read from the installed packages)
400
+ create-ailk routes --write ./my-site
401
+ # check them — exit 1 naming each missing, stale or stray file; the scaffold's preflight runs this as `pnpm routes:check`
402
+ create-ailk routes --check ./my-site
403
+ ```
404
+
405
+ A **page package** is an installed dependency of `apps/web` whose
406
+ `package.json` declares `"ailk": { "routes": "<manifest path>" }`. Its
407
+ manifest names the package's route prefix under `app/[locale]/`, the site's
408
+ config file, and one entry per routing file:
409
+
410
+ ```json
411
+ {
412
+ "schema": 1,
413
+ "prefix": "(authed)/account",
414
+ "config": "account.config",
415
+ "routes": [
416
+ {
417
+ "path": "(authed)/account/general/page.tsx",
418
+ "kind": "page",
419
+ "module": "general/page",
420
+ "exports": ["default", "generateMetadata"],
421
+ "segmentConfig": ["export const dynamic = \"force-dynamic\";"],
422
+ "config": true
423
+ }
424
+ ]
425
+ }
426
+ ```
427
+
428
+ Each generated file carries a header naming the package and its version, one
429
+ re-export per listed export (`default`, `metadata` and `generateMetadata` on
430
+ a page or layout; the HTTP methods on a route handler), the route-segment
431
+ config lines copied literally — Next reads those from the file in `app/`, so
432
+ a re-export would not do — and, when the entry takes config, an import of
433
+ the site's `apps/web/<config>.tsx` passed to the page as its `config` prop
434
+ (the wrapper calls the page and returns its tree, so the route module keeps
435
+ the page's own contract):
436
+
437
+ ```tsx
438
+ // Generated by create-ailk routes from @working-theory/account 0.61.0 — do not edit.
439
+ import Page from "@working-theory/account/general/page";
440
+
441
+ import config from "../../../../../account.config";
442
+
443
+ export { generateMetadata } from "@working-theory/account/general/page";
444
+ export const dynamic = "force-dynamic";
445
+
446
+ export default async function Route(
447
+ props: Omit<Parameters<typeof Page>[0], "config">,
448
+ ) {
449
+ return Page({ ...props, config });
450
+ }
451
+ ```
452
+
453
+ The config file is the **one typed file** through which a site customizes a
454
+ package's pages (options and slots, typed by the package — a misspelled
455
+ option fails `tsc`); there is no context provider, because most pages are
456
+ Server Components. The generated files are prettier-stable and never
457
+ hand-edited: `--check` reports a **stale** file (its content differs from
458
+ what `--write` would write — after a version bump, every header does, until
459
+ `--write` runs), a **missing** one (an entry with no file), and a **stray**
460
+ one (a `page.tsx`, `layout.tsx` or `route.ts` under a package's prefix that
461
+ is neither generated nor recorded; the other Next convention files —
462
+ `loading.tsx`, `error.tsx`, `not-found.tsx` — are the site's own and never
463
+ stray). The prefix is the subtree the package has taken over, and a
464
+ manifest shipping no route owns nothing yet.
465
+
466
+ **Replacing or removing a shipped page is recorded.** A site replaces a
467
+ shipped route by writing its own file at that route, and removes one by
468
+ deleting the generated file — and, either way, by adding an entry to
469
+ `customizations.yaml` whose `paths` match the route file, in the manifest's
470
+ own grammar:
471
+
472
+ ```yaml
473
+ customizations:
474
+ - id: own-security-page
475
+ paths:
476
+ - "apps/web/app/[locale]/(authed)/account/security/**"
477
+ request: "acme/acme-site#12"
478
+ decision: "build-in: site — Sam, 2026-11-09, the site keeps its own Security page"
479
+ ```
480
+
481
+ A recorded route is reported as `replaced` (its file exists) or `removed`
482
+ (it does not) and never fails the check; `--write` never overwrites or
483
+ re-creates it. A replaced page stops receiving upgrades, visibly, as one
484
+ recorded file. There is no command that copies a shipped page's source into
485
+ a site.
486
+
487
+ **Where it runs.** At scaffold time after `--install` (a scaffold without
488
+ `--install` names the command in its next steps), and inside `create-ailk
489
+ update` after the pins move (below). The scaffold's `preflight` script runs
490
+ `--check` as its `routes:check` step, through the `create-ailk` its root
491
+ `devDependencies` pin at the exact version that scaffolded the site — so the
492
+ check re-renders the files with the generator that wrote them; `update` moves
493
+ that pin to its own version along with the files. A bump for a moved slice is
494
+ a pin change plus regenerated route files.
495
+
372
496
  ### Update the copied app code
373
497
 
374
498
  A fresh scaffold records every `apps/web`, `apps/api` and `apps/mcp` file the
@@ -699,6 +823,11 @@ AILK_AGENT_KEY=<agent key> create-ailk migrate-content ./my-site --api-url <api
699
823
  AILK_AGENT_KEY=<agent key> create-ailk migrate-content ./my-site --apply --api-url <api origin> --workspace <wksp_id>
700
824
  ```
701
825
 
826
+ - `--language-seed <file>` also writes a Language seed file's `topics[]`
827
+ (`language/<entity>.json`), each as one Topic holding all its keywords —
828
+ their monthly searches and as-of dates as the keywords' numbers, the
829
+ primary marked, the pillar set. A Topic the workspace already holds keeps
830
+ its spelling, notes and newer numbers. The file's `items[]` are not read.
702
831
  - It is a dry run by default and writes nothing: it reads the workspace,
703
832
  prints what `--apply` would do to each page — `create`, `update`,
704
833
  `unchanged`, `skipped` or `failed` — then a count line. A dry run never sends
@@ -121,7 +121,7 @@
121
121
  "importPath": "@working-theory/ui-commerce",
122
122
  "rootBarrel": "@working-theory/ui-commerce",
123
123
  "sourceRoot": "packages-paid/ui-commerce/src/blocks",
124
- "count": 12
124
+ "count": 13
125
125
  },
126
126
  {
127
127
  "name": "commerce-panels",
@@ -3642,6 +3642,17 @@
3642
3642
  "descriptionGrade": "strong",
3643
3643
  "sectionType": null
3644
3644
  },
3645
+ {
3646
+ "name": "FlowResultsPriceCard",
3647
+ "tier": "commerce-blocks",
3648
+ "sourcePath": "packages-paid/ui-commerce/src/blocks/FlowResultsPriceCard.tsx",
3649
+ "importPath": "@working-theory/ui-commerce",
3650
+ "exported": true,
3651
+ "description": "The flows results page's configurable checkout price card, with its own breakdown toggle and every label passed in.",
3652
+ "descriptionSource": "doc-comment",
3653
+ "descriptionGrade": "strong",
3654
+ "sectionType": null
3655
+ },
3645
3656
  {
3646
3657
  "name": "InvoiceForm",
3647
3658
  "tier": "commerce-blocks",
@@ -6790,6 +6801,21 @@
6790
6801
  "start",
6791
6802
  "center"
6792
6803
  ]
6804
+ },
6805
+ "tags": {
6806
+ "maxItems": 20,
6807
+ "type": "array",
6808
+ "items": {
6809
+ "type": "string",
6810
+ "pattern": "^[A-Za-z0-9][A-Za-z0-9_.:/-]{0,63}$"
6811
+ }
6812
+ },
6813
+ "pinned": {
6814
+ "maxItems": 100,
6815
+ "type": "array",
6816
+ "items": {
6817
+ "type": "string"
6818
+ }
6793
6819
  }
6794
6820
  },
6795
6821
  "required": [
@@ -6915,8 +6941,7 @@
6915
6941
  }
6916
6942
  },
6917
6943
  "required": [
6918
- "quote",
6919
- "author"
6944
+ "quote"
6920
6945
  ]
6921
6946
  }
6922
6947
  },
@@ -6931,6 +6956,21 @@
6931
6956
  "gradient-dark",
6932
6957
  "solid-dark"
6933
6958
  ]
6959
+ },
6960
+ "tags": {
6961
+ "maxItems": 20,
6962
+ "type": "array",
6963
+ "items": {
6964
+ "type": "string",
6965
+ "pattern": "^[A-Za-z0-9][A-Za-z0-9_.:/-]{0,63}$"
6966
+ }
6967
+ },
6968
+ "pinned": {
6969
+ "maxItems": 100,
6970
+ "type": "array",
6971
+ "items": {
6972
+ "type": "string"
6973
+ }
6934
6974
  }
6935
6975
  },
6936
6976
  "required": [
@@ -11976,7 +12016,6 @@
11976
12016
  "minLength": 1
11977
12017
  },
11978
12018
  "blocks": {
11979
- "minItems": 1,
11980
12019
  "type": "array",
11981
12020
  "items": {
11982
12021
  "oneOf": [
@@ -12105,8 +12144,7 @@
12105
12144
  },
12106
12145
  "required": [
12107
12146
  "id",
12108
- "heading",
12109
- "blocks"
12147
+ "heading"
12110
12148
  ]
12111
12149
  }
12112
12150
  },
@@ -15,13 +15,13 @@ The component inventory of `@working-theory/ui` and the shells of `@working-theo
15
15
  3. Check the Primitives, Panels and Shells tables too — a low-level control, a collapsible layout container, or a route-level frame lives there, not under Sections or Blocks.
16
16
  4. Only then build. If you do build, you are declaring the capability is genuinely absent.
17
17
 
18
- Inventory: **330 component files** across 16 tiers — 60 sections, 110 blocks, 19 chrome, 82 primitives, 6 panels, 8 shells, 5 docs-blog-blocks, 1 docs-blog-chrome, 2 docs-blog-shells, 2 scheduling-sections, 6 scheduling-blocks, 5 signal-collectors-sections, 9 signal-collectors-blocks, 2 commerce-sections, 12 commerce-blocks, 1 commerce-panels. 327 distinct names: `SchedulerEmbed`, `Separator`, `Tabs` exist in more than one tier as genuinely different components, listed once per tier with its own source path.
18
+ Inventory: **331 component files** across 16 tiers — 60 sections, 110 blocks, 19 chrome, 82 primitives, 6 panels, 8 shells, 5 docs-blog-blocks, 1 docs-blog-chrome, 2 docs-blog-shells, 2 scheduling-sections, 6 scheduling-blocks, 5 signal-collectors-sections, 9 signal-collectors-blocks, 2 commerce-sections, 13 commerce-blocks, 1 commerce-panels. 328 distinct names: `SchedulerEmbed`, `Separator`, `Tabs` exist in more than one tier as genuinely different components, listed once per tier with its own source path.
19
19
 
20
- Description coverage: **326/330** components carry a capability description derived from source — 45 from the section registry's hand-authored when-to-use text, 246 from the component's own doc-comment header, 35 from its tier barrel's roster line. **4** have none; they are listed under [Undescribed components](#undescribed-components) rather than given a sentence invented from their name.
20
+ Description coverage: **327/331** components carry a capability description derived from source — 45 from the section registry's hand-authored when-to-use text, 247 from the component's own doc-comment header, 35 from its tier barrel's roster line. **4** have none; they are listed under [Undescribed components](#undescribed-components) rather than given a sentence invented from their name.
21
21
 
22
- Of those, **293** are *strong* — a capability sentence you could match a requirement against — and **33** are *weak*: either one short clause, or a long one that spends itself on wiring (client boundaries, class names, which primitives it composes) instead of on what the thing is for. Weak rows are marked `(weak)` and listed in full under [Weak descriptions](#weak-descriptions). Coverage is 99%, but **findable-without-luck coverage is 89%**.
22
+ Of those, **294** are *strong* — a capability sentence you could match a requirement against — and **33** are *weak*: either one short clause, or a long one that spends itself on wiring (client boundaries, class names, which primitives it composes) instead of on what the thing is for. Weak rows are marked `(weak)` and listed in full under [Weak descriptions](#weak-descriptions). Coverage is 99%, but **findable-without-luck coverage is 89%**.
23
23
 
24
- Per tier, strong out of total: **Sections** 59/60 · **Blocks** 102/110 · **Chrome** 10/19 · **Primitives** 67/82 (4 undescribed) · **Panels** 6/6 · **Shells** 7/8 · **Docs + Blog Blocks** 5/5 · **Docs + Blog Chrome** 1/1 · **Docs + Blog Shells** 0/2 · **Scheduling Sections** 2/2 · **Scheduling Blocks** 6/6 · **Signal-Collectors Sections** 5/5 · **Signal-Collectors Blocks** 8/9 · **Commerce Sections** 2/2 · **Commerce Blocks** 12/12 · **Commerce Panels** 1/1. A tier low on this line is a tier where a capability search is most likely to come up empty on something that exists.
24
+ Per tier, strong out of total: **Sections** 59/60 · **Blocks** 102/110 · **Chrome** 10/19 · **Primitives** 67/82 (4 undescribed) · **Panels** 6/6 · **Shells** 7/8 · **Docs + Blog Blocks** 5/5 · **Docs + Blog Chrome** 1/1 · **Docs + Blog Shells** 0/2 · **Scheduling Sections** 2/2 · **Scheduling Blocks** 6/6 · **Signal-Collectors Sections** 5/5 · **Signal-Collectors Blocks** 8/9 · **Commerce Sections** 2/2 · **Commerce Blocks** 13/13 · **Commerce Panels** 1/1. A tier low on this line is a tier where a capability search is most likely to come up empty on something that exists.
25
25
 
26
26
  That grade is **mechanical**. It counts what it can measure — how much a description adds beyond the component's own name, how much of it is spent on wiring, whether the extraction came out damaged — and it cannot tell a fluent paragraph about the wrong subject from a useful one. A person reading these tables will find more rows unusable than the weak count admits. Treat it as a floor on the problem, not a measurement of it, and read the source before concluding a capability is absent.
27
27
 
@@ -524,7 +524,7 @@ Import: `import { X } from "@working-theory/ui-commerce";` (or from the `@workin
524
524
 
525
525
  ---
526
526
 
527
- ## Commerce Blocks (12)
527
+ ## Commerce Blocks (13)
528
528
 
529
529
  Paid — delivered by the `commerce` module bundle, not present in a Free scaffold. Checkout, payment, invoice, subscription and customer-portal tiles. Search here before hand-rolling any Stripe-facing UI.
530
530
 
@@ -534,6 +534,7 @@ Import: `import { X } from "@working-theory/ui-commerce";` (or from the `@workin
534
534
  | --- | --- | --- |
535
535
  | `CheckoutForm` | Product/amount selection + checkout submit for the one-time checkout surface. | internal — compose from `packages-paid/ui-commerce/src/blocks/CheckoutForm.tsx` |
536
536
  | `CheckoutPriceCard` | DESIGN 's checkout price card: the panel's fourth view once it flips to the right and becomes an order summary — eyebrow, offer name + description, seat/credit line items, an optional caller-supplied add-credits row, and the total + due-today. | `import { CheckoutPriceCard } from "@working-theory/ui-commerce"` |
537
+ | `FlowResultsPriceCard` | The flows results page's configurable checkout price card, with its own breakdown toggle and every label passed in. | `import { FlowResultsPriceCard } from "@working-theory/ui-commerce"` |
537
538
  | `InvoiceForm` | Creates a draft invoice (single line item), for the invoice surface (U4). | internal — compose from `packages-paid/ui-commerce/src/blocks/InvoiceForm.tsx` |
538
539
  | `InvoiceList` | A customer's invoice rows, shared by the invoice surface (U4). Capability-bearing: binds a schema.org `Invoice` resource-payload fragment per row (imported from `@working-theory/schema`) — so a co-located `.text.ts` + `.text.test.ts` renderer is required and gated by `scripts/check-ax-parity.sh`. | internal — compose from `packages-paid/ui-commerce/src/blocks/InvoiceList.tsx` |
539
540
  | `PaymentLinkCard` | A single shareable Stripe Payment Link (pay-by-link surface). Renders the link's offer name, active-status chip, optional amount, and the hosted URL with a one-click copy action. | internal — compose from `packages-paid/ui-commerce/src/blocks/PaymentLinkCard.tsx` |
@@ -38,6 +38,7 @@ import { publicTreeRemoved } from "./lib/site-modules.js";
38
38
  import { normalizeModules } from "./module-architecture.js";
39
39
  import { MODULE_FLAGS_PATH, PAID_MCP_TOOLS_PATH, PAID_SECTIONS_PATH, writePaidSections, } from "./paid-sections.js";
40
40
  import { ParseError, parseModules } from "./parse-args.js";
41
+ import { RoutesRefusedError, writeRoutes } from "./routes.js";
41
42
  import { writeSpokeFlowsReadme } from "./seed-flows.js";
42
43
  import { SITE_ROSTER_PATH, moduleRosterRows, planRosterAppend, readSiteRoster, siteRosterProblems, } from "./site-roster.js";
43
44
  import { spokeCheckoutSite, spokeEnvRowOptions, writeSpokeCheckoutSlice, } from "./spoke-checkout.js";
@@ -233,6 +234,20 @@ export async function applyModuleToScaffold(opts) {
233
234
  if (existsSync(abs) && readFileSync(abs, "utf8") !== before)
234
235
  rows.push({ path, action: "written" });
235
236
  }
237
+ // #11251 D8 — a page package's route files, generated from its installed
238
+ // manifest. `add-module` runs no package manager, so on a site that has not
239
+ // installed the module's package yet this writes nothing (the next-steps
240
+ // line names `routes --write`); on one that has, the files land now.
241
+ // A refusal (a malformed manifest, a missing config file) writes nothing
242
+ // here: the site's own `routes --check` names it, as after `update`.
243
+ try {
244
+ for (const path of writeRoutes(targetAbs).written)
245
+ rows.push({ path, action: "written" });
246
+ }
247
+ catch (err) {
248
+ if (!(err instanceof RoutesRefusedError))
249
+ throw err;
250
+ }
236
251
  const navRow = syncNavConfig(targetAbs, current.surfaces, surfaces);
237
252
  if (navRow !== undefined)
238
253
  rows.push(navRow);
@@ -411,7 +426,7 @@ export function formatAddModuleReport(result, moduleName) {
411
426
  lines.push(`architecture.yaml modules: ${result.modules.join(", ")}`);
412
427
  lines.push(...formatRoster(result.roster, moduleName));
413
428
  if (written.length > 0 || patched.length > 0 || routes.applied.length > 0) {
414
- lines.push("Next: pnpm install, then pnpm build.");
429
+ lines.push("Next: pnpm install, then pnpm create-ailk routes --write, then pnpm build.");
415
430
  }
416
431
  return lines.join("\n") + "\n";
417
432
  }
@@ -49,7 +49,7 @@ export declare function formatAddRouteReport(result: AddRouteResult): string;
49
49
  export declare const MAGNET_ROUTE = "magnet";
50
50
  /**
51
51
  * The header-comment marker every standard magnet page carries — the same
52
- * string `flows/[slug]/magnet-page.tsx` exports, which the site's
52
+ * string the package's `flows/[slug]/magnet-page.tsx` exports, which the site's
53
53
  * `structured-data.test.tsx` reads to exempt the pair (#8840 D13).
54
54
  */
55
55
  export declare const MAGNET_PAGE_MARKER = "Standard magnet page (#8840)";
@@ -86,7 +86,7 @@ export interface AddMagnetResult {
86
86
  /**
87
87
  * Write a magnet page pair — `apps/web/app/[locale]/<path>/page.tsx` (the
88
88
  * landing) and `<path>/start/page.tsx` (the walk) — bound to one flow slug.
89
- * Each page is a few lines over the factories in `flows/[slug]/magnet-page`;
89
+ * Each page is a few lines over the factories in the package's `flows/[slug]/magnet-page`;
90
90
  * the copy, consent and ending come from the flow's record.
91
91
  *
92
92
  * Every refusal throws `AddRouteRefusedError` before the first write. A page
package/dist/add-route.js CHANGED
@@ -32,7 +32,8 @@
32
32
  * `create-ailk add-route magnet --path <path> --flow <slug>` (#8840 D12) is
33
33
  * the second mode: it writes a site's own magnet page pair at `<path>` and
34
34
  * `<path>/start`, bound to one flow slug, over the standard renderers in
35
- * `flows/[slug]/magnet-page.tsx` — see `addMagnetToScaffold`.
35
+ * `@working-theory/ui-signal-collectors/pages/flows/[slug]/magnet-page` —
36
+ * see `addMagnetToScaffold`.
36
37
  *
37
38
  * Pure module: no `import.meta.url`, so jest can import it directly — the
38
39
  * package-rooted inputs are supplied by the CLI, the `add-module.ts` split.
@@ -311,7 +312,7 @@ export function formatAddRouteReport(result) {
311
312
  export const MAGNET_ROUTE = "magnet";
312
313
  /**
313
314
  * The header-comment marker every standard magnet page carries — the same
314
- * string `flows/[slug]/magnet-page.tsx` exports, which the site's
315
+ * string the package's `flows/[slug]/magnet-page.tsx` exports, which the site's
315
316
  * `structured-data.test.tsx` reads to exempt the pair (#8840 D13).
316
317
  */
317
318
  export const MAGNET_PAGE_MARKER = "Standard magnet page (#8840)";
@@ -362,7 +363,7 @@ export function isMagnetFlowSlug(slug) {
362
363
  /**
363
364
  * Write a magnet page pair — `apps/web/app/[locale]/<path>/page.tsx` (the
364
365
  * landing) and `<path>/start/page.tsx` (the walk) — bound to one flow slug.
365
- * Each page is a few lines over the factories in `flows/[slug]/magnet-page`;
366
+ * Each page is a few lines over the factories in the package's `flows/[slug]/magnet-page`;
366
367
  * the copy, consent and ending come from the flow's record.
367
368
  *
368
369
  * Every refusal throws `AddRouteRefusedError` before the first write. A page
@@ -414,9 +415,9 @@ export function addMagnetToScaffold(opts) {
414
415
  const pages = [
415
416
  [
416
417
  landing,
417
- renderMagnetPage("landing", opts.path, opts.flow, segments.length),
418
+ renderMagnetPage("landing", opts.path, opts.flow),
418
419
  ],
419
- [walk, renderMagnetPage("walk", opts.path, opts.flow, segments.length + 1)],
420
+ [walk, renderMagnetPage("walk", opts.path, opts.flow)],
420
421
  ];
421
422
  const report = [];
422
423
  for (const [path, text] of pages) {
@@ -524,12 +525,18 @@ function staticPageServing(targetAbs, dirs, { ownPages }) {
524
525
  return walk(root);
525
526
  }
526
527
  /**
527
- * One page of the pair. `depth` is the page directory's segment count under
528
- * `[locale]`, so the import climbs back to `flows/[slug]/magnet-page`. Every
529
- * interpolated value has passed `MAGNET_PATH_RE` or `FLOW_SLUG_RE`, so none
530
- * can leave its string literal (SEC-8840-V5).
528
+ * The renderer's package subpath (#11251 D7), interpolated into the emitted
529
+ * import so create-ailk's own dist carries no `@working-theory/*` import
530
+ * statement (#8412).
531
531
  */
532
- function renderMagnetPage(kind, path, flow, depth) {
532
+ const MAGNET_RENDERER = "@working-theory/ui-signal-collectors/pages/flows/[slug]/magnet-page";
533
+ /**
534
+ * One page of the pair, importing the renderer from its package subpath,
535
+ * `@working-theory/ui-signal-collectors/pages/flows/[slug]/magnet-page`
536
+ * (#11251 D7). Every interpolated value has passed `MAGNET_PATH_RE` or
537
+ * `FLOW_SLUG_RE`, so none can leave its string literal (SEC-8840-V5).
538
+ */
539
+ function renderMagnetPage(kind, path, flow) {
533
540
  const [page, metadata, role] = kind === "landing"
534
541
  ? [
535
542
  "magnetLanding",
@@ -544,7 +551,7 @@ function renderMagnetPage(kind, path, flow, depth) {
544
551
  return [
545
552
  `// Generated by \`create-ailk add-route magnet --path ${path} --flow ${flow}\`.`,
546
553
  `// ${MAGNET_PAGE_MARKER} — ${role}.`,
547
- `import { ${page}, ${metadata} } from "${"../".repeat(depth)}flows/[slug]/magnet-page";`,
554
+ `import { ${page}, ${metadata} } from "${MAGNET_RENDERER}";`,
548
555
  "",
549
556
  `const MAGNET = { slug: "${flow}", path: "${path}" } as const;`,
550
557
  "",
package/dist/cli.js CHANGED
@@ -33,6 +33,10 @@
33
33
  * (#10648)
34
34
  * on a `sync-routes` subcommand: parse its own argv, run syncRoutesSync(),
35
35
  * print the report, exit (1 iff routes are missing in check mode)
36
+ * on a `routes` subcommand: write the generated route files the site's
37
+ * installed page packages declare (--write), or check them (--check:
38
+ * exit 1 naming each missing, stale or stray file; 2 on a refusal)
39
+ * (#11219, ADR 0040)
36
40
  * on a `license set` subcommand: write the key into the scaffold, push it
37
41
  * to a linked Vercel project and redeploy, exit (#6683 D9)
38
42
  * on a `provision-env` subcommand: set MCP_PUBLIC_HTTP_URL (and apps/mcp's
@@ -91,6 +95,7 @@ import { PLUGIN_INSTALL_LINES, ParseError, helpText, parseCliArgs, parseModules,
91
95
  import { addModule, removeModule, formatSurfaceDrift, scaffold, syncArchitectureSync, syncCatalogSync, syncClaudeMdSync, syncRoutesSync, } from "./programmatic.js";
92
96
  import { PROVISION_ENV_HELP, runProvisionEnv } from "./provision-env.js";
93
97
  import { REMOVE_MODULE_HELP, RemoveModuleRefusedError, formatRemoveModuleReport, parseRemoveModuleArgs, } from "./remove-module.js";
98
+ import { ROUTES_HELP, RoutesRefusedError, checkRoutes, formatRoutesReport, parseRoutesArgs, routesFailing, writeRoutes, } from "./routes.js";
94
99
  import { SEED_FLOWS_HELP, SeedFlowsRefusedError, parseSeedFlowsArgs, seedFlows, } from "./seed-flows.js";
95
100
  import { SEED_WORKSPACE_HELP, SeedWorkspaceRefusedError, parseSeedWorkspaceArgs, runScaffoldSeed, seedWorkspace, } from "./seed-workspace.js";
96
101
  import { CORE_SURFACE_PATHS, SURFACE_ALIASES } from "./surfaces.js";
@@ -348,6 +353,7 @@ async function main() {
348
353
  apply: args.apply,
349
354
  apiUrl: args.apiUrl,
350
355
  workspaceId: args.workspaceId,
356
+ languageSeed: args.languageSeed,
351
357
  onLine: (line) => process.stdout.write(`${line}\n`),
352
358
  });
353
359
  process.exit(exitCode);
@@ -450,6 +456,37 @@ async function main() {
450
456
  process.exit(2);
451
457
  }
452
458
  }
459
+ // `routes --write | --check [dir]` (#11219, ADR 0040 rule 3): the one
460
+ // route-file generator, over the manifests of the site's installed page
461
+ // packages. Check mode exits 1 iff a generated file is missing, stale or
462
+ // stray; a recorded replacement or removal is reported, never failed. A
463
+ // refusal it names (a malformed manifest, no config file, neither flag)
464
+ // exits 2 before anything is written.
465
+ if (argv[0] === "routes") {
466
+ try {
467
+ const args = parseRoutesArgs(argv.slice(1));
468
+ if (args.help) {
469
+ process.stdout.write(ROUTES_HELP);
470
+ process.exit(0);
471
+ }
472
+ const targetDir = resolve(args.target ?? process.cwd());
473
+ if (args.write) {
474
+ process.stdout.write(formatRoutesReport(writeRoutes(targetDir), "write"));
475
+ process.exit(0);
476
+ }
477
+ const drift = checkRoutes(targetDir);
478
+ const failing = routesFailing(drift);
479
+ (failing > 0 ? process.stderr : process.stdout).write(formatRoutesReport(drift, "check"));
480
+ process.exit(failing > 0 ? 1 : 0);
481
+ }
482
+ catch (err) {
483
+ const parseError = err.code?.startsWith("ERR_PARSE_ARGS") === true;
484
+ if (!(err instanceof RoutesRefusedError) && !parseError)
485
+ throw err;
486
+ process.stderr.write(`[create-ailk] ${err.message}\n`);
487
+ process.exit(2);
488
+ }
489
+ }
453
490
  // Subcommand dispatch, ahead of the flag parser: `sync-routes` has its own
454
491
  // argv shape (#4986). Check mode exits 1 iff a template route is missing;
455
492
  // locally modified routes are reported but do not fail; --apply exits 0.
@@ -677,6 +714,20 @@ async function main() {
677
714
  if (result.status !== 0) {
678
715
  throw new Error(`pnpm install failed in ${targetAbs} (exit ${result.status}). Run it manually after fixing the issue.`);
679
716
  }
717
+ // #11219 — with the packages installed, the generated route files of
718
+ // every page package are written (ADR 0040 rule 3: the generator runs at
719
+ // scaffold time). Without --install there is nothing to read them from;
720
+ // the next-steps message names the command to run after the install. A
721
+ // refusal is printed, never thrown: the tree is written and valid, and
722
+ // the site's own `routes --check` names what is left (the update idiom).
723
+ try {
724
+ process.stdout.write(formatRoutesReport(writeRoutes(targetAbs), "write"));
725
+ }
726
+ catch (err) {
727
+ if (!(err instanceof RoutesRefusedError))
728
+ throw err;
729
+ process.stderr.write(`[create-ailk] route files not generated: ${err.message}\n`);
730
+ }
680
731
  }
681
732
  // #10204 — on a hub with an Admin, seed the starter's pages into the
682
733
  // workspace, or say why not and how to later. A refusal is printed, never
@@ -760,6 +811,7 @@ async function main() {
760
811
  lines.push(` cd ${targetAbs}`);
761
812
  if (!opts.install) {
762
813
  lines.push(isSpoke ? " pnpm install" : " pnpm install # also generates the Prisma client");
814
+ lines.push(" pnpm create ailk@latest routes --write # the route files of the pages your packages ship");
763
815
  }
764
816
  lines.push(" pnpm dev # http://localhost:3000");
765
817
  lines.push(" pnpm build # production build, when you are ready to deploy");
@@ -0,0 +1,13 @@
1
+ /** The site file the list lives in. */
2
+ export declare const DECLINED_ROUTES_FILE = "customizations.yaml";
3
+ /**
4
+ * The `route` of every `declined_routes` entry in `<siteDir>/customizations.yaml`,
5
+ * sorted and deduplicated, each without a leading or trailing `/`. Empty when
6
+ * the file or the key is absent. Block (`- route: …`) and flow
7
+ * (`declined_routes: []`) forms; quoted or bare values.
8
+ */
9
+ export declare function readDeclinedRoutes(siteDir: string): string[];
10
+ /** The declined entry covering `route` (ROUTE_ROOT-relative) — itself or an ancestor — or undefined. */
11
+ export declare function declinedRouteFor(route: string, declined: readonly string[]): string | undefined;
12
+ /** The declined entry whose directory holds site-relative `path`, or undefined. */
13
+ export declare function declinedRouteOfPath(path: string, declined: readonly string[]): string | undefined;
@@ -0,0 +1,74 @@
1
+ /**
2
+ * The template routes a site has declined (#11260) — `customizations.yaml`'s
3
+ * optional top-level `declined_routes` list.
4
+ *
5
+ * A site may drop one template route on purpose (wendihenry sells from
6
+ * `/pricing` alone, so it carries no `pricing/[slug]`). Without a record the
7
+ * tooling reads, every `sync-routes` check reports the route missing and the
8
+ * next `--apply` copies it back. An entry here is that record:
9
+ *
10
+ * declined_routes:
11
+ * - route: "pricing/[slug]" # a template route, under apps/web/app/[locale]/
12
+ * reason: "this site sells from /pricing alone"
13
+ * decided: "Site Owner, 2026-11-02" # <decider>, <YYYY-MM-DD>
14
+ *
15
+ * A declined route covers its whole directory, sub-routes included:
16
+ * `sync-routes` names it under "Declined by this site" (never missing) and
17
+ * never copies it, and `create-ailk update` never writes a file under it.
18
+ *
19
+ * Read by line, like `routes.ts`'s `readRecorded` — create-ailk carries no
20
+ * YAML parser. Only each entry's `route` is read here; the scaffold's
21
+ * `tools/lint-architecture.ts` owns the file's full validation (a reason, a
22
+ * decider/date line, a known template route) and refuses any layout this
23
+ * reader cannot read: a flow list or map, or a block scalar.
24
+ *
25
+ * Pure module: no `import.meta.url`, so jest imports it directly.
26
+ */
27
+ import { existsSync, readFileSync } from "node:fs";
28
+ import { join } from "node:path";
29
+ import { ROUTE_ROOT } from "./surfaces.js";
30
+ /** The site file the list lives in. */
31
+ export const DECLINED_ROUTES_FILE = "customizations.yaml";
32
+ /**
33
+ * The `route` of every `declined_routes` entry in `<siteDir>/customizations.yaml`,
34
+ * sorted and deduplicated, each without a leading or trailing `/`. Empty when
35
+ * the file or the key is absent. Block (`- route: …`) and flow
36
+ * (`declined_routes: []`) forms; quoted or bare values.
37
+ */
38
+ export function readDeclinedRoutes(siteDir) {
39
+ const path = join(siteDir, DECLINED_ROUTES_FILE);
40
+ if (!existsSync(path))
41
+ return [];
42
+ const out = new Set();
43
+ let inList = false;
44
+ for (const raw of readFileSync(path, "utf8").split(/\r?\n/)) {
45
+ const line = raw.replace(/\s+#.*$/, "");
46
+ if (line.trim() === "" || line.trimStart().startsWith("#"))
47
+ continue;
48
+ // A top-level key ends the list; a column-0 `- ` item is still inside it.
49
+ if (/^\S/.test(line) && !/^-\s/.test(line)) {
50
+ inList = /^declined_routes:/.test(line);
51
+ continue;
52
+ }
53
+ if (!inList)
54
+ continue;
55
+ const route = /^\s*(?:-\s+)?route:\s*(.+)$/.exec(line)?.[1];
56
+ if (route === undefined)
57
+ continue;
58
+ const value = route.trim().replace(/^["']|["']$/g, "").replace(/^\/+|\/+$/g, "");
59
+ if (value !== "")
60
+ out.add(value);
61
+ }
62
+ return [...out].sort();
63
+ }
64
+ /** The declined entry covering `route` (ROUTE_ROOT-relative) — itself or an ancestor — or undefined. */
65
+ export function declinedRouteFor(route, declined) {
66
+ return declined.find((d) => route === d || route.startsWith(`${d}/`));
67
+ }
68
+ /** The declined entry whose directory holds site-relative `path`, or undefined. */
69
+ export function declinedRouteOfPath(path, declined) {
70
+ if (!path.startsWith(`${ROUTE_ROOT}/`))
71
+ return undefined;
72
+ const rel = path.slice(ROUTE_ROOT.length + 1);
73
+ return declined.find((d) => rel.startsWith(`${d}/`));
74
+ }
@@ -31,12 +31,6 @@ export declare const SPOKE_BILLING_ACTION_PATH = "apps/web/app/[locale]/(authed)
31
31
  * (#9142): a spoke sells through its hub's Offerings buy route.
32
32
  */
33
33
  export declare const SPOKE_CHECKOUT_ROUTE_FILES: readonly string[];
34
- /**
35
- * The spoke files that may import @working-theory/spoke-checkout to READ a
36
- * paid session, and nothing else: the thank-you page's `readPaidCheckoutEmail`
37
- * (#8757 D13).
38
- */
39
- export declare const SPOKE_CHECKOUT_READER_FILES: readonly string[];
40
34
  /** The forbidden patterns a spoke's apps/web carries (#7873, brief Part 2 §2; #8748). The fulfilment pattern that guarded `lib/checkout.ts` retired with it (#9142). */
41
35
  export declare const SPOKE_WEB_FORBIDDEN_PATTERNS: readonly ForbiddenPattern[];
42
36
  /** The same three for a spoke's kept apps/mcp — no MCP file may import the package (#7873). */