create-ailk 0.23.0 → 0.25.1

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 (604) hide show
  1. package/README.md +68 -33
  2. package/component-catalog.json +3 -3
  3. package/component-catalog.md +3 -3
  4. package/dist/add-module.js +10 -3
  5. package/dist/add-route.d.ts +12 -1
  6. package/dist/add-route.js +38 -4
  7. package/dist/cli.js +12 -7
  8. package/dist/derive-architecture.d.ts +3 -4
  9. package/dist/derive-architecture.js +75 -22
  10. package/dist/lib/design-checks.d.ts +9 -4
  11. package/dist/lib/design-checks.js +13 -7
  12. package/dist/lib/extract-module-bundle.js +29 -2
  13. package/dist/lib/fetch-template-snapshot.d.ts +1 -1
  14. package/dist/lib/fetch-template-snapshot.js +7 -3
  15. package/dist/lib/import-graph.d.ts +1 -1
  16. package/dist/lib/import-graph.js +4 -4
  17. package/dist/lib/module-license-gate.d.ts +12 -1
  18. package/dist/lib/module-license-gate.js +34 -12
  19. package/dist/lib/scaffold-render-sweep.d.ts +33 -0
  20. package/dist/lib/scaffold-render-sweep.js +45 -0
  21. package/dist/module-architecture.d.ts +20 -3
  22. package/dist/module-architecture.js +122 -538
  23. package/dist/paid-sections.d.ts +25 -1
  24. package/dist/paid-sections.js +88 -3
  25. package/dist/surfaces.js +10 -2
  26. package/dist/sync-routes.d.ts +30 -4
  27. package/dist/sync-routes.js +271 -18
  28. package/dist/template-record.d.ts +14 -4
  29. package/dist/template-record.js +23 -5
  30. package/dist/topology.d.ts +16 -3
  31. package/dist/topology.js +31 -19
  32. package/dist/update.d.ts +10 -1
  33. package/dist/update.js +540 -16
  34. package/package.json +3 -3
  35. package/release-scope.json +1 -1
  36. package/templates/.claude/cloudparity-repo-hooks.json +5 -0
  37. package/templates/.claude/hooks/template-guard.sh +137 -0
  38. package/templates/.claude/rules/extending.md +106 -0
  39. package/templates/.claude/rules/loop-contract.md +2 -2
  40. package/templates/.claude/settings.json +11 -0
  41. package/templates/.env.example +9 -5
  42. package/templates/.github/workflows/ci.yml +7 -4
  43. package/templates/CLAUDE.md +15 -3
  44. package/templates/CONVENTIONS.md +8 -10
  45. package/templates/README.md +14 -13
  46. package/templates/apps/api/.env.example +9 -2
  47. package/templates/apps/api/CLAUDE.md +122 -82
  48. package/templates/apps/api/jest.config.cjs +15 -5
  49. package/templates/apps/api/package.json +16 -20
  50. package/templates/apps/api/src/__tests__/trusted-origins.server.test.ts +2 -2
  51. package/templates/apps/api/src/__tests__/vercel-handler.test.ts +4 -4
  52. package/templates/apps/api/src/index.ts +1 -1
  53. package/templates/apps/api/src/lib/__mocks__/prisma.ts +7 -4
  54. package/templates/apps/api/src/modules/commerce.ts +10 -0
  55. package/templates/apps/api/src/modules/content-write.ts +10 -0
  56. package/templates/apps/api/src/modules/multi-tenant.ts +10 -0
  57. package/templates/apps/api/src/modules/scheduling.ts +10 -0
  58. package/templates/apps/api/src/modules/signal-collectors.ts +10 -0
  59. package/templates/apps/api/src/modules/workspace.ts +10 -0
  60. package/templates/apps/api/src/server.ts +117 -1857
  61. package/templates/apps/api/vercel.json +2 -2
  62. package/templates/apps/mcp/CLAUDE.md +77 -24
  63. package/templates/apps/mcp/__tests__/app-entry.test.ts +4 -254
  64. package/templates/apps/mcp/__tests__/boot-file.test.ts +92 -0
  65. package/templates/apps/mcp/jest.config.cjs +6 -1
  66. package/templates/apps/mcp/package.json +5 -12
  67. package/templates/apps/mcp/src/app.ts +8 -7
  68. package/templates/apps/mcp/src/index.ts +6 -34
  69. package/templates/apps/mcp/src/lib/paid-tools.generated.ts +10 -0
  70. package/templates/apps/mcp/src/lib/topology.generated.ts +2 -2
  71. package/templates/apps/mcp/src/site.ts +12 -0
  72. package/templates/apps/web/.env.example +1 -1
  73. package/templates/apps/web/CLAUDE.md +21 -5
  74. package/templates/apps/web/app/.well-known/mcp.json/route.ts +9 -3
  75. package/templates/apps/web/app/[locale]/contact/__tests__/ConversationalIntakeWrapper.test.tsx +1 -1
  76. package/templates/apps/web/app/[locale]/contact/contact.actions.ts +14 -4
  77. package/templates/apps/web/app/[locale]/contact/intake-analytics.ts +1 -1
  78. package/templates/apps/web/app/[locale]/contact/intake-script.ts +1 -1
  79. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/magnet-page.test.tsx +22 -1
  80. package/templates/apps/web/app/[locale]/flows/[slug]/magnet-page.tsx +28 -7
  81. package/templates/apps/web/app/[locale]/pricing/__tests__/unconnected.test.tsx +43 -0
  82. package/templates/apps/web/app/[locale]/pricing/page.tsx +7 -3
  83. package/templates/apps/web/app/api/offerings/checkout/[lookupKey]/__tests__/route.test.ts +222 -0
  84. package/templates/apps/web/app/api/offerings/checkout/[lookupKey]/route.ts +10 -3
  85. package/templates/apps/web/app/api/revalidate/route.ts +3 -3
  86. package/templates/apps/web/auth.ts +2 -2
  87. package/templates/apps/web/jest.config.cjs +1 -0
  88. package/templates/apps/web/lib/__tests__/magnet-routes.test.ts +7 -0
  89. package/templates/apps/web/lib/auth-email.ts +1 -1
  90. package/templates/apps/web/lib/magnet-routes.ts +3 -1
  91. package/templates/apps/web/lib/newsletter.actions.ts +9 -6
  92. package/templates/apps/web/lib/relay.ts +2 -2
  93. package/templates/apps/web/lib/release-scope.ts +47 -0
  94. package/templates/apps/web/lib/server-api.ts +1 -1
  95. package/templates/apps/web/src/lib/commerce-claim.ts +1 -1
  96. package/templates/customizations.yaml +37 -0
  97. package/templates/database/prisma.config.ts +10 -14
  98. package/templates/database/seed-test.ts +2 -2
  99. package/templates/database/seed.ts +32 -5
  100. package/templates/package.json +12 -6
  101. package/templates/pnpm-workspace.yaml +0 -1
  102. package/templates/project.yaml +16 -8
  103. package/templates/tools/jest/reporters.cjs +65 -0
  104. package/templates/tools/lint-architecture.ts +757 -7
  105. package/templates/tsconfig.json +1 -2
  106. package/versions.json +48 -35
  107. package/templates/apps/api/src/__tests__/commerce-claim-registration.test.ts +0 -409
  108. package/templates/apps/api/src/__tests__/factories/agent-caller.ts +0 -102
  109. package/templates/apps/api/src/__tests__/factories/content-fixture.ts +0 -138
  110. package/templates/apps/api/src/__tests__/factories/in-memory-prisma.ts +0 -441
  111. package/templates/apps/api/src/__tests__/factories/index.ts +0 -70
  112. package/templates/apps/api/src/__tests__/factories/lead-fixture.ts +0 -82
  113. package/templates/apps/api/src/__tests__/leads-forwarded-rate-limit.test.ts +0 -135
  114. package/templates/apps/api/src/__tests__/services/enrichment-shim.test.ts +0 -126
  115. package/templates/apps/api/src/__tests__/stripe-boot.test.ts +0 -132
  116. package/templates/apps/api/src/__tests__/support/hub-sign-in-fake-db.ts +0 -362
  117. package/templates/apps/api/src/bin/__tests__/rate-limit-probe.test.ts +0 -184
  118. package/templates/apps/api/src/bin/abandon-sweep.ts +0 -42
  119. package/templates/apps/api/src/bin/rate-limit-probe.ts +0 -53
  120. package/templates/apps/api/src/bin/spokes.ts +0 -198
  121. package/templates/apps/api/src/bin/stripe-connections-rekey.ts +0 -45
  122. package/templates/apps/api/src/config/__tests__/hub-require-spoke-key.test.ts +0 -196
  123. package/templates/apps/api/src/config/__tests__/index.test.ts +0 -233
  124. package/templates/apps/api/src/config/__tests__/modules.test.ts +0 -76
  125. package/templates/apps/api/src/config/__tests__/stripe-connection-key.test.ts +0 -185
  126. package/templates/apps/api/src/config/__tests__/trusted-origins.test.ts +0 -238
  127. package/templates/apps/api/src/config/index.ts +0 -596
  128. package/templates/apps/api/src/config/modules.ts +0 -83
  129. package/templates/apps/api/src/lib/__tests__/agent-store.test.ts +0 -581
  130. package/templates/apps/api/src/lib/__tests__/auth-email-budget.test.ts +0 -143
  131. package/templates/apps/api/src/lib/__tests__/consent-ledger-double.ts +0 -237
  132. package/templates/apps/api/src/lib/__tests__/consent-store.test.ts +0 -353
  133. package/templates/apps/api/src/lib/__tests__/content-adapter.test.ts +0 -201
  134. package/templates/apps/api/src/lib/__tests__/deliverable-asset-store.test.ts +0 -224
  135. package/templates/apps/api/src/lib/__tests__/error-serializer.test.ts +0 -120
  136. package/templates/apps/api/src/lib/__tests__/errors.test.ts +0 -94
  137. package/templates/apps/api/src/lib/__tests__/file-fallback.test.ts +0 -144
  138. package/templates/apps/api/src/lib/__tests__/fixtures/HomePage/home.mdx +0 -8
  139. package/templates/apps/api/src/lib/__tests__/flow-completion-store.test.ts +0 -149
  140. package/templates/apps/api/src/lib/__tests__/flow-rename-race.db.test.ts +0 -116
  141. package/templates/apps/api/src/lib/__tests__/hub-sign-in-store.test.ts +0 -209
  142. package/templates/apps/api/src/lib/__tests__/lead-capture-store.test.ts +0 -257
  143. package/templates/apps/api/src/lib/__tests__/lead-delivery.test.ts +0 -96
  144. package/templates/apps/api/src/lib/__tests__/outbound-http.test.ts +0 -125
  145. package/templates/apps/api/src/lib/__tests__/prisma.test.ts +0 -165
  146. package/templates/apps/api/src/lib/__tests__/require-commerce-claim.test.ts +0 -317
  147. package/templates/apps/api/src/lib/__tests__/require-paid-tier.test.ts +0 -129
  148. package/templates/apps/api/src/lib/__tests__/site.test.ts +0 -292
  149. package/templates/apps/api/src/lib/__tests__/slice-load.test.ts +0 -89
  150. package/templates/apps/api/src/lib/__tests__/spoke-store.test.ts +0 -202
  151. package/templates/apps/api/src/lib/__tests__/stripe-admission.test.ts +0 -217
  152. package/templates/apps/api/src/lib/__tests__/stripe.test.ts +0 -82
  153. package/templates/apps/api/src/lib/agent-store.ts +0 -613
  154. package/templates/apps/api/src/lib/auth-email-budget.ts +0 -161
  155. package/templates/apps/api/src/lib/consent-store.ts +0 -363
  156. package/templates/apps/api/src/lib/content-adapter.ts +0 -112
  157. package/templates/apps/api/src/lib/deliverable-asset-store.ts +0 -96
  158. package/templates/apps/api/src/lib/error-serializer.ts +0 -164
  159. package/templates/apps/api/src/lib/errors.ts +0 -95
  160. package/templates/apps/api/src/lib/file-fallback.ts +0 -87
  161. package/templates/apps/api/src/lib/flow-completion-store.ts +0 -136
  162. package/templates/apps/api/src/lib/hub-sign-in-store.ts +0 -455
  163. package/templates/apps/api/src/lib/lead-capture-store.ts +0 -122
  164. package/templates/apps/api/src/lib/lead-delivery.ts +0 -52
  165. package/templates/apps/api/src/lib/license-key-store.ts +0 -45
  166. package/templates/apps/api/src/lib/locales.ts +0 -201
  167. package/templates/apps/api/src/lib/outbound-http.ts +0 -127
  168. package/templates/apps/api/src/lib/prisma.ts +0 -21
  169. package/templates/apps/api/src/lib/proposal-paid-store.ts +0 -66
  170. package/templates/apps/api/src/lib/rate-limit-probe.ts +0 -165
  171. package/templates/apps/api/src/lib/rate-limit-store.ts +0 -142
  172. package/templates/apps/api/src/lib/require-commerce-claim.ts +0 -250
  173. package/templates/apps/api/src/lib/require-paid-tier.ts +0 -53
  174. package/templates/apps/api/src/lib/site.ts +0 -254
  175. package/templates/apps/api/src/lib/slice-load.ts +0 -90
  176. package/templates/apps/api/src/lib/spoke-store.ts +0 -180
  177. package/templates/apps/api/src/lib/stripe.ts +0 -318
  178. package/templates/apps/api/src/lib/webhook-idempotency.ts +0 -156
  179. package/templates/apps/api/src/middleware/__tests__/adversarial/bearer-token-format.test.ts +0 -111
  180. package/templates/apps/api/src/middleware/__tests__/adversarial/cookie-or-bearer-precedence.test.ts +0 -172
  181. package/templates/apps/api/src/middleware/__tests__/adversarial/csrf-bearer-skip.test.ts +0 -119
  182. package/templates/apps/api/src/middleware/__tests__/adversarial/csrf-cookie-path.test.ts +0 -138
  183. package/templates/apps/api/src/middleware/__tests__/adversarial/csrf-trusted-origins.test.ts +0 -142
  184. package/templates/apps/api/src/middleware/__tests__/adversarial/session-fixation.test.ts +0 -155
  185. package/templates/apps/api/src/middleware/__tests__/adversarial/session-timeout.test.ts +0 -139
  186. package/templates/apps/api/src/middleware/__tests__/auth.bearer-path.test.ts +0 -562
  187. package/templates/apps/api/src/middleware/__tests__/auth.both-present-precedence.test.ts +0 -76
  188. package/templates/apps/api/src/middleware/__tests__/auth.cookie-path.test.ts +0 -220
  189. package/templates/apps/api/src/middleware/__tests__/auth.database-not-configured.test.ts +0 -97
  190. package/templates/apps/api/src/middleware/__tests__/auth.hub-session-path.test.ts +0 -557
  191. package/templates/apps/api/src/middleware/__tests__/auth.neither-present.test.ts +0 -72
  192. package/templates/apps/api/src/middleware/__tests__/auth.optional-cookie.test.ts +0 -140
  193. package/templates/apps/api/src/middleware/__tests__/default-tenant.test.ts +0 -721
  194. package/templates/apps/api/src/middleware/__tests__/rate-limit-cross-isolate.db.test.ts +0 -220
  195. package/templates/apps/api/src/middleware/__tests__/rate-limit-store.test.ts +0 -430
  196. package/templates/apps/api/src/middleware/__tests__/rate-limit.test.ts +0 -1409
  197. package/templates/apps/api/src/middleware/__tests__/write-budget.test.ts +0 -174
  198. package/templates/apps/api/src/middleware/auth.ts +0 -864
  199. package/templates/apps/api/src/middleware/default-tenant.ts +0 -166
  200. package/templates/apps/api/src/middleware/rate-limit.ts +0 -983
  201. package/templates/apps/api/src/openapi/__tests__/openapi.test.ts +0 -264
  202. package/templates/apps/api/src/openapi/__tests__/spec-identity.test.ts +0 -182
  203. package/templates/apps/api/src/openapi/index.ts +0 -18
  204. package/templates/apps/api/src/openapi/spec.ts +0 -1815
  205. package/templates/apps/api/src/openapi/surface-drift.ts +0 -195
  206. package/templates/apps/api/src/routes/aeo/__tests__/index.test.ts +0 -175
  207. package/templates/apps/api/src/routes/aeo/index.ts +0 -107
  208. package/templates/apps/api/src/routes/auth/__tests__/auth-tokens.functional.test.ts +0 -196
  209. package/templates/apps/api/src/routes/auth/__tests__/auth-user.functional.test.ts +0 -249
  210. package/templates/apps/api/src/routes/auth/__tests__/hub-sign-in.test.ts +0 -532
  211. package/templates/apps/api/src/routes/auth/__tests__/tokens.test.ts +0 -313
  212. package/templates/apps/api/src/routes/auth/__tests__/transactional-email.test.ts +0 -413
  213. package/templates/apps/api/src/routes/auth/__tests__/user.test.ts +0 -609
  214. package/templates/apps/api/src/routes/auth/hub-sign-in.ts +0 -242
  215. package/templates/apps/api/src/routes/auth/tokens.ts +0 -211
  216. package/templates/apps/api/src/routes/auth/transactional-email.ts +0 -301
  217. package/templates/apps/api/src/routes/auth/user.ts +0 -305
  218. package/templates/apps/api/src/routes/billing/plan-checkout.ts +0 -325
  219. package/templates/apps/api/src/routes/checkout/__tests__/live-key.test.ts +0 -178
  220. package/templates/apps/api/src/routes/checkout/__tests__/offerings-authorization.test.ts +0 -1300
  221. package/templates/apps/api/src/routes/checkout/__tests__/session.test.ts +0 -448
  222. package/templates/apps/api/src/routes/checkout/__tests__/sessions.test.ts +0 -1742
  223. package/templates/apps/api/src/routes/checkout/index.ts +0 -34
  224. package/templates/apps/api/src/routes/checkout/session.ts +0 -171
  225. package/templates/apps/api/src/routes/checkout/sessions.ts +0 -540
  226. package/templates/apps/api/src/routes/consent/__tests__/account.test.ts +0 -386
  227. package/templates/apps/api/src/routes/consent/__tests__/sign-up-rate-limit.test.ts +0 -160
  228. package/templates/apps/api/src/routes/consent/account.ts +0 -268
  229. package/templates/apps/api/src/routes/consent/cookie.ts +0 -90
  230. package/templates/apps/api/src/routes/consent/index.ts +0 -26
  231. package/templates/apps/api/src/routes/consent/unsubscribe.ts +0 -127
  232. package/templates/apps/api/src/routes/content/__tests__/get-page.test.ts +0 -853
  233. package/templates/apps/api/src/routes/content/__tests__/list-pages.test.ts +0 -230
  234. package/templates/apps/api/src/routes/content/__tests__/list-types.test.ts +0 -44
  235. package/templates/apps/api/src/routes/content/__tests__/locale.test.ts +0 -118
  236. package/templates/apps/api/src/routes/content/__tests__/offerings.test.ts +0 -731
  237. package/templates/apps/api/src/routes/content/__tests__/pricing.test.ts +0 -753
  238. package/templates/apps/api/src/routes/content/__tests__/rate-limit.test.ts +0 -51
  239. package/templates/apps/api/src/routes/content/__tests__/search.test.ts +0 -450
  240. package/templates/apps/api/src/routes/content/__tests__/shown-offerings.test.ts +0 -762
  241. package/templates/apps/api/src/routes/content/get-page.ts +0 -268
  242. package/templates/apps/api/src/routes/content/index.ts +0 -49
  243. package/templates/apps/api/src/routes/content/list-pages.ts +0 -95
  244. package/templates/apps/api/src/routes/content/list-types.ts +0 -19
  245. package/templates/apps/api/src/routes/content/offerings.ts +0 -184
  246. package/templates/apps/api/src/routes/content/pricing.ts +0 -176
  247. package/templates/apps/api/src/routes/content/rate-limit.ts +0 -22
  248. package/templates/apps/api/src/routes/content/search.ts +0 -129
  249. package/templates/apps/api/src/routes/content/shown-offerings.ts +0 -229
  250. package/templates/apps/api/src/routes/content/slug.ts +0 -9
  251. package/templates/apps/api/src/routes/leads/__tests__/capture.test.ts +0 -88
  252. package/templates/apps/api/src/routes/leads/__tests__/list.test.ts +0 -171
  253. package/templates/apps/api/src/routes/leads/__tests__/magnet-completion.test.ts +0 -515
  254. package/templates/apps/api/src/routes/leads/__tests__/spoke.test.ts +0 -392
  255. package/templates/apps/api/src/routes/leads/__tests__/track.test.ts +0 -165
  256. package/templates/apps/api/src/routes/leads/index.ts +0 -573
  257. package/templates/apps/api/src/routes/leads/list.ts +0 -104
  258. package/templates/apps/api/src/routes/project-listings/__tests__/configured-application.test.ts +0 -626
  259. package/templates/apps/api/src/routes/project-listings/__tests__/drafts.test.ts +0 -1268
  260. package/templates/apps/api/src/routes/project-listings/__tests__/founder-identity.test.ts +0 -847
  261. package/templates/apps/api/src/routes/project-listings/__tests__/me.test.ts +0 -480
  262. package/templates/apps/api/src/routes/project-listings/__tests__/public.test.ts +0 -465
  263. package/templates/apps/api/src/routes/project-listings/__tests__/resume-email.test.ts +0 -872
  264. package/templates/apps/api/src/routes/project-listings/__tests__/site-answers.test.ts +0 -1022
  265. package/templates/apps/api/src/routes/project-listings/__tests__/site-key.test.ts +0 -484
  266. package/templates/apps/api/src/routes/project-listings/__tests__/structured-address.test.ts +0 -535
  267. package/templates/apps/api/src/routes/project-listings/index.ts +0 -164
  268. package/templates/apps/api/src/routes/project-listings/me.ts +0 -87
  269. package/templates/apps/api/src/routes/project-listings/patch-copy.ts +0 -224
  270. package/templates/apps/api/src/routes/project-listings/patch-draft.ts +0 -102
  271. package/templates/apps/api/src/routes/project-listings/public.ts +0 -98
  272. package/templates/apps/api/src/routes/project-listings/respond.ts +0 -48
  273. package/templates/apps/api/src/routes/project-listings/resume-token.ts +0 -27
  274. package/templates/apps/api/src/routes/project-listings/start.ts +0 -140
  275. package/templates/apps/api/src/routes/project-listings/submit.ts +0 -130
  276. package/templates/apps/api/src/routes/project-listings/verify-email.ts +0 -150
  277. package/templates/apps/api/src/routes/requests/__tests__/confirm.test.ts +0 -686
  278. package/templates/apps/api/src/routes/requests/confirm.ts +0 -601
  279. package/templates/apps/api/src/routes/requests/index.ts +0 -54
  280. package/templates/apps/api/src/routes/test/auth/__tests__/session.test.ts +0 -306
  281. package/templates/apps/api/src/routes/test/auth/session.ts +0 -143
  282. package/templates/apps/api/src/routes/webhooks/README.md +0 -398
  283. package/templates/apps/api/src/routes/webhooks/__tests__/stripe-checkout-consent.test.ts +0 -649
  284. package/templates/apps/api/src/routes/webhooks/__tests__/stripe-dunning.test.ts +0 -749
  285. package/templates/apps/api/src/routes/webhooks/__tests__/stripe-flow-checkout.test.ts +0 -448
  286. package/templates/apps/api/src/routes/webhooks/__tests__/stripe-idempotency.test.ts +0 -264
  287. package/templates/apps/api/src/routes/webhooks/__tests__/stripe-livemode-live.test.ts +0 -159
  288. package/templates/apps/api/src/routes/webhooks/__tests__/stripe-livemode.test.ts +0 -158
  289. package/templates/apps/api/src/routes/webhooks/__tests__/stripe-offerings.test.ts +0 -814
  290. package/templates/apps/api/src/routes/webhooks/__tests__/stripe-org-billing.test.ts +0 -301
  291. package/templates/apps/api/src/routes/webhooks/__tests__/stripe-proposal-paid.test.ts +0 -369
  292. package/templates/apps/api/src/routes/webhooks/__tests__/stripe-rate-limit.test.ts +0 -215
  293. package/templates/apps/api/src/routes/webhooks/__tests__/stripe-request-paid.test.ts +0 -301
  294. package/templates/apps/api/src/routes/webhooks/__tests__/stripe-site-filter.test.ts +0 -808
  295. package/templates/apps/api/src/routes/webhooks/__tests__/stripe.test.ts +0 -1155
  296. package/templates/apps/api/src/routes/webhooks/index.ts +0 -141
  297. package/templates/apps/api/src/routes/webhooks/stripe-offerings.ts +0 -384
  298. package/templates/apps/api/src/routes/webhooks/stripe.ts +0 -2026
  299. package/templates/apps/api/src/services/__tests__/abandon-email.test.ts +0 -528
  300. package/templates/apps/api/src/services/__tests__/answer-distributions.test.ts +0 -132
  301. package/templates/apps/api/src/services/__tests__/audit-log.test.ts +0 -1028
  302. package/templates/apps/api/src/services/__tests__/checkout-plan.test.ts +0 -313
  303. package/templates/apps/api/src/services/__tests__/consent-ledger.test.ts +0 -503
  304. package/templates/apps/api/src/services/__tests__/consent-migration.test.ts +0 -65
  305. package/templates/apps/api/src/services/__tests__/consent.test.ts +0 -299
  306. package/templates/apps/api/src/services/__tests__/default-tenant.test.ts +0 -147
  307. package/templates/apps/api/src/services/__tests__/deliverable-fulfillment.test.ts +0 -867
  308. package/templates/apps/api/src/services/__tests__/deliverable-resend.test.ts +0 -379
  309. package/templates/apps/api/src/services/__tests__/dunning-policy.test.ts +0 -368
  310. package/templates/apps/api/src/services/__tests__/entitlements.test.ts +0 -142
  311. package/templates/apps/api/src/services/__tests__/hub-sign-in.test.ts +0 -854
  312. package/templates/apps/api/src/services/__tests__/keyless-workspace-predicate.test.ts +0 -234
  313. package/templates/apps/api/src/services/__tests__/lead-accept-user.test.ts +0 -251
  314. package/templates/apps/api/src/services/__tests__/lead-routing.test.ts +0 -2660
  315. package/templates/apps/api/src/services/__tests__/listing-config.test.ts +0 -166
  316. package/templates/apps/api/src/services/__tests__/magnet-completion.test.ts +0 -389
  317. package/templates/apps/api/src/services/__tests__/person.test.ts +0 -1176
  318. package/templates/apps/api/src/services/__tests__/plan-offerings.test.ts +0 -444
  319. package/templates/apps/api/src/services/__tests__/project-listings.fence.test.ts +0 -154
  320. package/templates/apps/api/src/services/__tests__/public-site-resolver.test.ts +0 -137
  321. package/templates/apps/api/src/services/__tests__/request-confirm.test.ts +0 -531
  322. package/templates/apps/api/src/services/__tests__/revalidation.test.ts +0 -372
  323. package/templates/apps/api/src/services/__tests__/slack-notify.test.ts +0 -348
  324. package/templates/apps/api/src/services/__tests__/spoke-resolution.test.ts +0 -660
  325. package/templates/apps/api/src/services/__tests__/usage-aggregation.test.ts +0 -941
  326. package/templates/apps/api/src/services/__tests__/usage-credits.test.ts +0 -588
  327. package/templates/apps/api/src/services/__tests__/verified-email.test.ts +0 -78
  328. package/templates/apps/api/src/services/abandon-email.ts +0 -313
  329. package/templates/apps/api/src/services/aeo-score.ts +0 -325
  330. package/templates/apps/api/src/services/answer-distributions.ts +0 -138
  331. package/templates/apps/api/src/services/audit-log.ts +0 -961
  332. package/templates/apps/api/src/services/checkout-buyer.ts +0 -168
  333. package/templates/apps/api/src/services/consent.ts +0 -834
  334. package/templates/apps/api/src/services/default-tenant.ts +0 -416
  335. package/templates/apps/api/src/services/deliverable-fulfillment.ts +0 -755
  336. package/templates/apps/api/src/services/dunning-policy.ts +0 -294
  337. package/templates/apps/api/src/services/enrichment-shim.ts +0 -53
  338. package/templates/apps/api/src/services/entitlements.ts +0 -338
  339. package/templates/apps/api/src/services/hub-sign-in.ts +0 -472
  340. package/templates/apps/api/src/services/lead-accept-user.ts +0 -126
  341. package/templates/apps/api/src/services/lead-promotion.ts +0 -160
  342. package/templates/apps/api/src/services/lead-routing.ts +0 -1372
  343. package/templates/apps/api/src/services/leads-inbox.ts +0 -312
  344. package/templates/apps/api/src/services/listing-config.ts +0 -178
  345. package/templates/apps/api/src/services/magnet-completion.ts +0 -242
  346. package/templates/apps/api/src/services/offerings/__tests__/catalog.test.ts +0 -295
  347. package/templates/apps/api/src/services/offerings/__tests__/checkout-session-record.test.ts +0 -268
  348. package/templates/apps/api/src/services/offerings/__tests__/connection.test.ts +0 -868
  349. package/templates/apps/api/src/services/offerings/__tests__/fixtures.ts +0 -416
  350. package/templates/apps/api/src/services/offerings/__tests__/org-products.test.ts +0 -396
  351. package/templates/apps/api/src/services/offerings/__tests__/readers.test.ts +0 -681
  352. package/templates/apps/api/src/services/offerings/__tests__/source.test.ts +0 -231
  353. package/templates/apps/api/src/services/offerings/catalog.ts +0 -308
  354. package/templates/apps/api/src/services/offerings/checkout-authorization.ts +0 -385
  355. package/templates/apps/api/src/services/offerings/checkout-session-record.ts +0 -192
  356. package/templates/apps/api/src/services/offerings/connection.ts +0 -1003
  357. package/templates/apps/api/src/services/offerings/index.ts +0 -614
  358. package/templates/apps/api/src/services/offerings/source.ts +0 -140
  359. package/templates/apps/api/src/services/offerings/store.ts +0 -150
  360. package/templates/apps/api/src/services/owner-workspaces.ts +0 -132
  361. package/templates/apps/api/src/services/person.ts +0 -1188
  362. package/templates/apps/api/src/services/plan-offerings.ts +0 -125
  363. package/templates/apps/api/src/services/project-listing-resume-email.ts +0 -326
  364. package/templates/apps/api/src/services/project-listings.ts +0 -2073
  365. package/templates/apps/api/src/services/public-site-resolver.ts +0 -396
  366. package/templates/apps/api/src/services/request-confirm.ts +0 -698
  367. package/templates/apps/api/src/services/revalidation.ts +0 -235
  368. package/templates/apps/api/src/services/slack-notify.ts +0 -291
  369. package/templates/apps/api/src/services/usage-aggregation.ts +0 -516
  370. package/templates/apps/api/src/services/usage-credits.ts +0 -340
  371. package/templates/apps/api/src/services/verified-email.ts +0 -71
  372. package/templates/apps/mcp/__tests__/abuse/daily-cap.test.ts +0 -52
  373. package/templates/apps/mcp/__tests__/abuse/email-validator.test.ts +0 -46
  374. package/templates/apps/mcp/__tests__/abuse/guard.test.ts +0 -198
  375. package/templates/apps/mcp/__tests__/abuse/honeypot.test.ts +0 -36
  376. package/templates/apps/mcp/__tests__/abuse/user-agent-deny.test.ts +0 -54
  377. package/templates/apps/mcp/__tests__/aeo-cli-parity.test.ts +0 -116
  378. package/templates/apps/mcp/__tests__/audit-single-page.test.ts +0 -299
  379. package/templates/apps/mcp/__tests__/boot.test.ts +0 -280
  380. package/templates/apps/mcp/__tests__/catalog-drift.test.ts +0 -359
  381. package/templates/apps/mcp/__tests__/config/modules.test.ts +0 -78
  382. package/templates/apps/mcp/__tests__/get_business_hours.test.ts +0 -82
  383. package/templates/apps/mcp/__tests__/get_faq.test.ts +0 -80
  384. package/templates/apps/mcp/__tests__/get_locations.test.ts +0 -65
  385. package/templates/apps/mcp/__tests__/get_offerings.test.ts +0 -557
  386. package/templates/apps/mcp/__tests__/get_pricing.test.ts +0 -524
  387. package/templates/apps/mcp/__tests__/get_site_info.test.ts +0 -81
  388. package/templates/apps/mcp/__tests__/http-transport.test.ts +0 -1151
  389. package/templates/apps/mcp/__tests__/index.test.ts +0 -195
  390. package/templates/apps/mcp/__tests__/lib/audit-single-page-readiness-scan.test.ts +0 -191
  391. package/templates/apps/mcp/__tests__/lib/commerce-claim.test.ts +0 -531
  392. package/templates/apps/mcp/__tests__/lib/content-adapter-parity.test.ts +0 -65
  393. package/templates/apps/mcp/__tests__/lib/content-adapter.test.ts +0 -187
  394. package/templates/apps/mcp/__tests__/lib/content-root.test.ts +0 -93
  395. package/templates/apps/mcp/__tests__/lib/errors.test.ts +0 -75
  396. package/templates/apps/mcp/__tests__/lib/fail-closed-tools.test.ts +0 -165
  397. package/templates/apps/mcp/__tests__/lib/public-workspace.test.ts +0 -124
  398. package/templates/apps/mcp/__tests__/list_pages.test.ts +0 -228
  399. package/templates/apps/mcp/__tests__/locale.test.ts +0 -135
  400. package/templates/apps/mcp/__tests__/module-exclusion.test.ts +0 -175
  401. package/templates/apps/mcp/__tests__/purchase-disabled.test.ts +0 -101
  402. package/templates/apps/mcp/__tests__/read_content.test.ts +0 -474
  403. package/templates/apps/mcp/__tests__/request_callback.test.ts +0 -225
  404. package/templates/apps/mcp/__tests__/search_content.test.ts +0 -256
  405. package/templates/apps/mcp/__tests__/server.test.ts +0 -388
  406. package/templates/apps/mcp/__tests__/start_purchase.test.ts +0 -448
  407. package/templates/apps/mcp/__tests__/submit_lead.test.ts +0 -307
  408. package/templates/apps/mcp/__tests__/subscribe_newsletter.test.ts +0 -223
  409. package/templates/apps/mcp/__tests__/tools/create_project.test.ts +0 -243
  410. package/templates/apps/mcp/__tests__/tools/purchase.test.ts +0 -451
  411. package/templates/apps/mcp/src/abuse/daily-cap.ts +0 -47
  412. package/templates/apps/mcp/src/abuse/email-validator.ts +0 -25
  413. package/templates/apps/mcp/src/abuse/honeypot.ts +0 -21
  414. package/templates/apps/mcp/src/abuse/index.ts +0 -342
  415. package/templates/apps/mcp/src/abuse/user-agent-deny.ts +0 -58
  416. package/templates/apps/mcp/src/boot.ts +0 -167
  417. package/templates/apps/mcp/src/config/modules.ts +0 -43
  418. package/templates/apps/mcp/src/http-transport.ts +0 -526
  419. package/templates/apps/mcp/src/lib/audit-single-page.ts +0 -308
  420. package/templates/apps/mcp/src/lib/commerce-claim.ts +0 -263
  421. package/templates/apps/mcp/src/lib/content-adapter.ts +0 -142
  422. package/templates/apps/mcp/src/lib/empty-content-adapter.ts +0 -139
  423. package/templates/apps/mcp/src/lib/errors.ts +0 -61
  424. package/templates/apps/mcp/src/lib/license-key-store.ts +0 -45
  425. package/templates/apps/mcp/src/lib/locales.ts +0 -171
  426. package/templates/apps/mcp/src/lib/prisma.ts +0 -39
  427. package/templates/apps/mcp/src/lib/public-workspace.ts +0 -133
  428. package/templates/apps/mcp/src/lib/resolve-locale.ts +0 -30
  429. package/templates/apps/mcp/src/lib/shown-offerings.ts +0 -105
  430. package/templates/apps/mcp/src/lib/stripe-tax-signal.ts +0 -59
  431. package/templates/apps/mcp/src/request-context.ts +0 -52
  432. package/templates/apps/mcp/src/server.ts +0 -343
  433. package/templates/apps/mcp/src/serverless-app.ts +0 -88
  434. package/templates/apps/mcp/src/tools/audit.ts +0 -127
  435. package/templates/apps/mcp/src/tools/capture_lead.ts +0 -64
  436. package/templates/apps/mcp/src/tools/create_project.ts +0 -134
  437. package/templates/apps/mcp/src/tools/get_business_hours.ts +0 -68
  438. package/templates/apps/mcp/src/tools/get_faq.ts +0 -71
  439. package/templates/apps/mcp/src/tools/get_locations.ts +0 -88
  440. package/templates/apps/mcp/src/tools/get_offerings.ts +0 -96
  441. package/templates/apps/mcp/src/tools/get_pricing.ts +0 -94
  442. package/templates/apps/mcp/src/tools/get_site_info.ts +0 -86
  443. package/templates/apps/mcp/src/tools/index.ts +0 -137
  444. package/templates/apps/mcp/src/tools/list_pages.ts +0 -74
  445. package/templates/apps/mcp/src/tools/person_notes.ts +0 -25
  446. package/templates/apps/mcp/src/tools/proposals.ts +0 -27
  447. package/templates/apps/mcp/src/tools/purchase.ts +0 -205
  448. package/templates/apps/mcp/src/tools/read_content.ts +0 -75
  449. package/templates/apps/mcp/src/tools/request_callback.ts +0 -59
  450. package/templates/apps/mcp/src/tools/search_content.ts +0 -67
  451. package/templates/apps/mcp/src/tools/subscribe_newsletter.ts +0 -57
  452. package/templates/apps/mcp/src/workspace-server.ts +0 -224
  453. package/templates/database/CHANGELOG.md +0 -961
  454. package/templates/database/LICENSE +0 -202
  455. package/templates/database/NOTICE +0 -2
  456. package/templates/database/README.md +0 -243
  457. package/templates/database/__tests__/agents.db.test.ts +0 -320
  458. package/templates/database/__tests__/appointment.db.test.ts +0 -106
  459. package/templates/database/__tests__/artifact-content-store.db.test.ts +0 -316
  460. package/templates/database/__tests__/composite-fence.db.test.ts +0 -206
  461. package/templates/database/__tests__/consent-ledger.db.test.ts +0 -345
  462. package/templates/database/__tests__/consent-source-checkout-migration.test.ts +0 -79
  463. package/templates/database/__tests__/fence-fan-out.db.test.ts +0 -715
  464. package/templates/database/__tests__/fixtures/appointment-create-probe.ts +0 -79
  465. package/templates/database/__tests__/fixtures/person-backfill.json +0 -264
  466. package/templates/database/__tests__/fixtures/person-contact-backfill.json +0 -182
  467. package/templates/database/__tests__/fixtures/project-listing-consent-probe.ts +0 -100
  468. package/templates/database/__tests__/flow-completion-migration.test.ts +0 -115
  469. package/templates/database/__tests__/flow-completion.db.test.ts +0 -136
  470. package/templates/database/__tests__/flow-workspace-key.db.test.ts +0 -263
  471. package/templates/database/__tests__/flows-listing-diagnostic.test.ts +0 -392
  472. package/templates/database/__tests__/flows-presets.test.ts +0 -173
  473. package/templates/database/__tests__/in-page-magnets-migration.test.ts +0 -161
  474. package/templates/database/__tests__/lead-idempotency-key.db.test.ts +0 -92
  475. package/templates/database/__tests__/member-area.db.test.ts +0 -257
  476. package/templates/database/__tests__/member-contract-migration.test.ts +0 -85
  477. package/templates/database/__tests__/member-contract.db.test.ts +0 -413
  478. package/templates/database/__tests__/offerings-checkout-session.db.test.ts +0 -270
  479. package/templates/database/__tests__/offerings-migration.test.ts +0 -197
  480. package/templates/database/__tests__/offerings-shown-price-ids-migration.test.ts +0 -86
  481. package/templates/database/__tests__/offerings.db.test.ts +0 -303
  482. package/templates/database/__tests__/outbound-message-action.db.test.ts +0 -80
  483. package/templates/database/__tests__/person-contact.db.test.ts +0 -563
  484. package/templates/database/__tests__/person-notes.db.test.ts +0 -249
  485. package/templates/database/__tests__/person.db.test.ts +0 -586
  486. package/templates/database/__tests__/piece-kind-migration.test.ts +0 -67
  487. package/templates/database/__tests__/piece-kind.db.test.ts +0 -208
  488. package/templates/database/__tests__/prefixed-ids.db.test.ts +0 -222
  489. package/templates/database/__tests__/project-listing-consent-at.db.test.ts +0 -111
  490. package/templates/database/__tests__/seed.test.ts +0 -240
  491. package/templates/database/__tests__/spoke-registry.db.test.ts +0 -191
  492. package/templates/database/__tests__/tenancy.test.ts +0 -141
  493. package/templates/database/__tests__/user-cascade.test.ts +0 -140
  494. package/templates/database/_gitignore +0 -8
  495. package/templates/database/auth/.gitkeep +0 -0
  496. package/templates/database/auth/schema.prisma +0 -641
  497. package/templates/database/config/.gitkeep +0 -0
  498. package/templates/database/config/schema.prisma +0 -441
  499. package/templates/database/content/.gitkeep +0 -0
  500. package/templates/database/content/schema.prisma +0 -339
  501. package/templates/database/eslint.config.mjs +0 -69
  502. package/templates/database/flows/listing-diagnostic.ts +0 -182
  503. package/templates/database/flows/presets.ts +0 -315
  504. package/templates/database/inbox/.gitkeep +0 -0
  505. package/templates/database/inbox/README.md +0 -3
  506. package/templates/database/inbox/__tests__/schema.test.ts +0 -44
  507. package/templates/database/inbox/schema.prisma +0 -1447
  508. package/templates/database/jest.config.cjs +0 -36
  509. package/templates/database/migrations/20260508000000_add_inbox_namespace/migration.sql +0 -328
  510. package/templates/database/migrations/20260513000000_better_auth_migration/migration.sql +0 -100
  511. package/templates/database/migrations/20260515000000_add_user_billing_fields/migration.sql +0 -28
  512. package/templates/database/migrations/20260516000000_add_user_tier_care_plan_seat/migration.sql +0 -25
  513. package/templates/database/migrations/20260518000000_add_telemetry_records/migration.sql +0 -42
  514. package/templates/database/migrations/20260525000000_theme_wiring/migration.sql +0 -67
  515. package/templates/database/migrations/20260710000000_retire_commercial_tier/migration.sql +0 -21
  516. package/templates/database/migrations/20260712215647_add_multi_tenant_tenancy/migration.sql +0 -201
  517. package/templates/database/migrations/20260713143320_reanchor_site_config_to_workspace/migration.sql +0 -67
  518. package/templates/database/migrations/20260713174000_add_audit_logs/migration.sql +0 -46
  519. package/templates/database/migrations/20260713190000_drop_telemetry_records/migration.sql +0 -25
  520. package/templates/database/migrations/20260713192000_add_uuidv7_function/migration.sql +0 -49
  521. package/templates/database/migrations/20260713192429_prefixed_uuid_entity_ids/migration.sql +0 -197
  522. package/templates/database/migrations/20260713200000_add_org_billing/migration.sql +0 -32
  523. package/templates/database/migrations/20260714000000_add_lead_promotion_fields/migration.sql +0 -22
  524. package/templates/database/migrations/20260714010000_add_usage_billing_content_models/migration.sql +0 -151
  525. package/templates/database/migrations/20260714020000_add_usage_billing_auth_config_models/migration.sql +0 -223
  526. package/templates/database/migrations/20260714030000_credit_balance_non_negative/migration.sql +0 -22
  527. package/templates/database/migrations/20260714030000_widen_usage_billing_report_aggregates/migration.sql +0 -32
  528. package/templates/database/migrations/20260810233516_add_flow_engine_models/migration.sql +0 -40
  529. package/templates/database/migrations/20260811020000_add_flow_session_abandon_email_columns/migration.sql +0 -4
  530. package/templates/database/migrations/20260811030000_add_flow_session_abandon_email_index/migration.sql +0 -2
  531. package/templates/database/migrations/20260811040000_add_flow_session_segment/migration.sql +0 -2
  532. package/templates/database/migrations/20260811050000_add_deliverable_models/migration.sql +0 -29
  533. package/templates/database/migrations/20260812000000_add_deliverable_grant_send_columns/migration.sql +0 -6
  534. package/templates/database/migrations/20260902222948_add_waitlist_experiment_models/migration.sql +0 -39
  535. package/templates/database/migrations/20260902224500_add_waitlist_id_format_checks/migration.sql +0 -24
  536. package/templates/database/migrations/20260903004112_add_flow_session_flags_aeo_score/migration.sql +0 -3
  537. package/templates/database/migrations/20260903010000_add_playbook_instance/migration.sql +0 -33
  538. package/templates/database/migrations/20260904000000_add_waitlist_followup_send/migration.sql +0 -30
  539. package/templates/database/migrations/20260905230000_add_flow_checkout/migration.sql +0 -47
  540. package/templates/database/migrations/20260906000000_add_flow_checkout_idempotency/migration.sql +0 -16
  541. package/templates/database/migrations/20260907120000_add_project_listing/migration.sql +0 -47
  542. package/templates/database/migrations/20260907130000_add_project_listing_slack_columns/migration.sql +0 -10
  543. package/templates/database/migrations/20260907180000_add_listing_csv_send/migration.sql +0 -26
  544. package/templates/database/migrations/20260909120000_project_listings_platform/migration.sql +0 -90
  545. package/templates/database/migrations/20260909180000_listing_draft_and_fields/migration.sql +0 -174
  546. package/templates/database/migrations/20260910120000_listing_public_site_key/migration.sql +0 -14
  547. package/templates/database/migrations/20260911120000_listing_copy_edit_audit/migration.sql +0 -25
  548. package/templates/database/migrations/20260911140000_listing_structured_address/migration.sql +0 -32
  549. package/templates/database/migrations/20260911180000_consent_grants/migration.sql +0 -71
  550. package/templates/database/migrations/20260911200000_listing_site_answers/migration.sql +0 -30
  551. package/templates/database/migrations/20260912120000_listing_owner_link/migration.sql +0 -49
  552. package/templates/database/migrations/20260914120000_listing_founder_identity/migration.sql +0 -123
  553. package/templates/database/migrations/20260915120000_project_listing_solution/migration.sql +0 -15
  554. package/templates/database/migrations/20260916120000_artifact_content_store/migration.sql +0 -158
  555. package/templates/database/migrations/20260917120000_callback_request_confirm/migration.sql +0 -40
  556. package/templates/database/migrations/20260918120000_add_appointment/migration.sql +0 -67
  557. package/templates/database/migrations/20260918120000_asset_metadata_columns/migration.sql +0 -70
  558. package/templates/database/migrations/20260919120000_flow_workspace_key/migration.sql +0 -181
  559. package/templates/database/migrations/20260919130000_flow_definition_admin_columns/migration.sql +0 -172
  560. package/templates/database/migrations/20260919130000_workspace_meetings/migration.sql +0 -41
  561. package/templates/database/migrations/20260919140000_inbox_workspace_key/migration.sql +0 -185
  562. package/templates/database/migrations/20260920120000_lead_handled_at/migration.sql +0 -70
  563. package/templates/database/migrations/20260920130000_lead_workspace_source_index/migration.sql +0 -57
  564. package/templates/database/migrations/20260921120000_deliverable_grant_workspace_key/migration.sql +0 -68
  565. package/templates/database/migrations/20260922120000_tenancy_fence/migration.sql +0 -1067
  566. package/templates/database/migrations/20260923120000_listing_capturing_magnet/migration.sql +0 -210
  567. package/templates/database/migrations/20261003120000_spoke_registry/migration.sql +0 -80
  568. package/templates/database/migrations/20261003130000_scheduling_connection/migration.sql +0 -49
  569. package/templates/database/migrations/20261005120000_agents/migration.sql +0 -84
  570. package/templates/database/migrations/20261008120000_user_last_workspace/migration.sql +0 -35
  571. package/templates/database/migrations/20261008130000_lead_idempotency_key/migration.sql +0 -20
  572. package/templates/database/migrations/20261009120000_agent_grants/migration.sql +0 -33
  573. package/templates/database/migrations/20261010120000_person/migration.sql +0 -106
  574. package/templates/database/migrations/20261010121000_person_backfill/migration.sql +0 -132
  575. package/templates/database/migrations/20261010130000_agent_grants_people_read/migration.sql +0 -20
  576. package/templates/database/migrations/20261011120000_member_area/migration.sql +0 -158
  577. package/templates/database/migrations/20261011130000_agent_grants_member_pieces_manage/migration.sql +0 -21
  578. package/templates/database/migrations/20261012120000_member_contract/migration.sql +0 -192
  579. package/templates/database/migrations/20261013120000_lead_spoke_checkout/migration.sql +0 -20
  580. package/templates/database/migrations/20261014120000_consent_ledger/migration.sql +0 -122
  581. package/templates/database/migrations/20261014120000_person_contact/migration.sql +0 -231
  582. package/templates/database/migrations/20261015120000_person_notes/migration.sql +0 -77
  583. package/templates/database/migrations/20261015120000_rate_limit_counters/migration.sql +0 -43
  584. package/templates/database/migrations/20261016120000_piece_kind/migration.sql +0 -95
  585. package/templates/database/migrations/20261017120000_outbound_message_action/migration.sql +0 -30
  586. package/templates/database/migrations/20261018120000_flow_completion/migration.sql +0 -52
  587. package/templates/database/migrations/20261019120000_consent_source_checkout/migration.sql +0 -27
  588. package/templates/database/migrations/20261020120000_offerings_data_model/migration.sql +0 -146
  589. package/templates/database/migrations/20261021120000_offerings_checkout_session/migration.sql +0 -77
  590. package/templates/database/migrations/20261022120000_in_page_magnets/migration.sql +0 -45
  591. package/templates/database/migrations/20261023120000_offerings_shown_price_ids/migration.sql +0 -47
  592. package/templates/database/migrations/20261024120000_organization_plan_checkout_session/migration.sql +0 -16
  593. package/templates/database/migrations/migration_lock.toml +0 -3
  594. package/templates/database/ops/.gitkeep +0 -0
  595. package/templates/database/ops/schema.prisma +0 -43
  596. package/templates/database/package.json +0 -89
  597. package/templates/database/schema.prisma +0 -71
  598. package/templates/database/scripts/db-generate-locked.sh +0 -80
  599. package/templates/database/scripts/person-backfill.sql +0 -132
  600. package/templates/database/tenancy.ts +0 -183
  601. package/templates/database/tsconfig.build.json +0 -16
  602. package/templates/database/tsconfig.flows.json +0 -15
  603. package/templates/database/tsconfig.json +0 -16
  604. package/templates/database/tsconfig.tenancy.json +0 -14
@@ -2,6 +2,8 @@
2
2
  export declare const PAID_SECTIONS_PATH = "apps/web/lib/paid-sections.generated.ts";
3
3
  /** Scaffold-relative path of the generated module-presence flags (#8843 D10). */
4
4
  export declare const MODULE_FLAGS_PATH = "apps/web/lib/modules.generated.ts";
5
+ /** Scaffold-relative path of the generated paid MCP tool registry (#9460 DD6). */
6
+ export declare const PAID_MCP_TOOLS_PATH = "apps/mcp/src/lib/paid-tools.generated.ts";
5
7
  export interface PaidSectionRow {
6
8
  module: string;
7
9
  package: string;
@@ -33,9 +35,31 @@ export declare function renderModuleFlags(flags: {
33
35
  * `undefined` (writing nothing) for a scaffold with no web app.
34
36
  */
35
37
  export declare function writeModuleFlags(targetDir: string): "added" | "updated" | "unchanged" | undefined;
38
+ /**
39
+ * The paid MCP tool packages, one row each (#9460 DD6): every slice's
40
+ * `paidMcpToolPackages` in `RECOGNIZED_MODULES` order, then first
41
+ * appearance, so a package two modules deliver is one row.
42
+ */
43
+ export declare function paidMcpToolRows(): string[];
44
+ /**
45
+ * Render the MCP registry: one `() => import("<package>")` per carried
46
+ * package, `[]` when none is carried. Line 1 is `// oss: false` exactly when
47
+ * a row is present — #7536's rule, so the public strip drops the file.
48
+ */
49
+ export declare function renderPaidMcpTools(present: ReadonlySet<string>): string;
50
+ /**
51
+ * Write the MCP registry into a scaffold from its own `apps/mcp/package.json`
52
+ * `dependencies` (#9460 DD6), creating `apps/mcp/src/lib/` if need be.
53
+ * Answers whether the file was `added`, `updated` (changed bytes) or
54
+ * `unchanged`, or `undefined` (writing nothing) when that package.json is
55
+ * absent — a `--without-mcp` spoke — the `writeModuleFlags` shape, so
56
+ * `create-ailk update` reports it the same way (#9567).
57
+ */
58
+ export declare function writePaidMcpTools(targetDir: string): "added" | "updated" | "unchanged" | undefined;
36
59
  /**
37
60
  * Write the registry into a scaffold, deriving presence from the scaffold's
38
- * own `apps/web/package.json`, and the module-presence flags beside it.
61
+ * own `apps/web/package.json`, and the module-presence flags beside it,
62
+ * then the MCP registry from `apps/mcp/package.json` (#9460 DD6).
39
63
  * Returns `false` (writing nothing) when that file or `apps/web/lib/` is
40
64
  * absent — a scaffold with no web app.
41
65
  */
@@ -23,14 +23,16 @@
23
23
  * file, importing nothing, because the registry's `import()`s would pull UI
24
24
  * packages into any edge code that reads the flag.
25
25
  */
26
- import { existsSync, readFileSync, writeFileSync } from "node:fs";
27
- import { join } from "node:path";
26
+ import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
27
+ import { dirname, join } from "node:path";
28
28
  import { MODULE_SLICES } from "./module-architecture.js";
29
29
  import { RECOGNIZED_MODULES } from "./parse-args.js";
30
30
  /** Scaffold-relative path of the generated registry. */
31
31
  export const PAID_SECTIONS_PATH = "apps/web/lib/paid-sections.generated.ts";
32
32
  /** Scaffold-relative path of the generated module-presence flags (#8843 D10). */
33
33
  export const MODULE_FLAGS_PATH = "apps/web/lib/modules.generated.ts";
34
+ /** Scaffold-relative path of the generated paid MCP tool registry (#9460 DD6). */
35
+ export const PAID_MCP_TOOLS_PATH = "apps/mcp/src/lib/paid-tools.generated.ts";
34
36
  /** The dependency whose presence means the scheduling module's pages exist. */
35
37
  const SCHEDULING_PAGES_PACKAGE = "@working-theory/ui-scheduling";
36
38
  function pascalCase(shortName) {
@@ -162,9 +164,91 @@ export function writeModuleFlags(targetDir) {
162
164
  writeFileSync(path, next);
163
165
  return before === undefined ? "added" : "updated";
164
166
  }
167
+ /**
168
+ * The paid MCP tool packages, one row each (#9460 DD6): every slice's
169
+ * `paidMcpToolPackages` in `RECOGNIZED_MODULES` order, then first
170
+ * appearance, so a package two modules deliver is one row.
171
+ */
172
+ export function paidMcpToolRows() {
173
+ const rows = [];
174
+ for (const name of RECOGNIZED_MODULES) {
175
+ for (const pkg of MODULE_SLICES[name].paidMcpToolPackages ?? []) {
176
+ if (!rows.includes(pkg))
177
+ rows.push(pkg);
178
+ }
179
+ }
180
+ return rows;
181
+ }
182
+ const PAID_MCP_TOOLS_HEADER = `// paid-tools.generated.ts — the paid MCP tool packages this site carries.
183
+ //
184
+ // GENERATED by create-ailk from MODULE_SLICES (\`paidMcpToolPackages\`) and
185
+ // this app's package.json dependencies (#9460). Do not edit: every scaffold
186
+ // and \`create-ailk add-module\` rewrites it. A carried package is a bundled
187
+ // dynamic import the server resolves its paid tools from at call time; a
188
+ // site that carries none exports an empty list.
189
+ `;
190
+ /**
191
+ * Render the MCP registry: one `() => import("<package>")` per carried
192
+ * package, `[]` when none is carried. Line 1 is `// oss: false` exactly when
193
+ * a row is present — #7536's rule, so the public strip drops the file.
194
+ */
195
+ export function renderPaidMcpTools(present) {
196
+ // Spelled through a constant, not a `from "…"` literal: create-ailk's own
197
+ // dist must carry no `@working-theory/*` import text (#8412), while the
198
+ // scaffold's generated registry still imports the type (#9460 DD6).
199
+ const MCP_SERVER_PACKAGE = "@working-theory/mcp-server";
200
+ const rows = paidMcpToolRows().filter((pkg) => present.has(pkg));
201
+ const lines = [];
202
+ if (rows.length > 0)
203
+ lines.push("// oss: false");
204
+ lines.push(PAID_MCP_TOOLS_HEADER.trimEnd());
205
+ lines.push(`import type { McpToolPackLoader } from ${JSON.stringify(MCP_SERVER_PACKAGE)};`);
206
+ lines.push("");
207
+ if (rows.length === 0) {
208
+ lines.push("export const PAID_TOOL_PACKS: readonly McpToolPackLoader[] = [];");
209
+ }
210
+ else {
211
+ lines.push("export const PAID_TOOL_PACKS: readonly McpToolPackLoader[] = [");
212
+ for (const pkg of rows)
213
+ lines.push(` () => import("${pkg}"),`);
214
+ lines.push("];");
215
+ }
216
+ return `${lines.join("\n")}\n`;
217
+ }
218
+ /**
219
+ * Write the MCP registry into a scaffold from its own `apps/mcp/package.json`
220
+ * `dependencies` (#9460 DD6), creating `apps/mcp/src/lib/` if need be.
221
+ * Answers whether the file was `added`, `updated` (changed bytes) or
222
+ * `unchanged`, or `undefined` (writing nothing) when that package.json is
223
+ * absent — a `--without-mcp` spoke — the `writeModuleFlags` shape, so
224
+ * `create-ailk update` reports it the same way (#9567).
225
+ */
226
+ export function writePaidMcpTools(targetDir) {
227
+ const pkgPath = join(targetDir, "apps/mcp/package.json");
228
+ if (!existsSync(pkgPath))
229
+ return undefined;
230
+ let pkg;
231
+ try {
232
+ pkg = JSON.parse(readFileSync(pkgPath, "utf8"));
233
+ }
234
+ catch (err) {
235
+ throw new Error(`cannot read ${pkgPath} to write the paid MCP tool registry: ${err.message}`, { cause: err });
236
+ }
237
+ const deps = pkg.dependencies ?? {};
238
+ const present = new Set(paidMcpToolRows().filter((name) => Object.hasOwn(deps, name)));
239
+ const path = join(targetDir, PAID_MCP_TOOLS_PATH);
240
+ const before = existsSync(path) ? readFileSync(path, "utf8") : undefined;
241
+ const next = renderPaidMcpTools(present);
242
+ if (before === next)
243
+ return "unchanged";
244
+ mkdirSync(dirname(path), { recursive: true });
245
+ writeFileSync(path, next);
246
+ return before === undefined ? "added" : "updated";
247
+ }
165
248
  /**
166
249
  * Write the registry into a scaffold, deriving presence from the scaffold's
167
- * own `apps/web/package.json`, and the module-presence flags beside it.
250
+ * own `apps/web/package.json`, and the module-presence flags beside it,
251
+ * then the MCP registry from `apps/mcp/package.json` (#9460 DD6).
168
252
  * Returns `false` (writing nothing) when that file or `apps/web/lib/` is
169
253
  * absent — a scaffold with no web app.
170
254
  */
@@ -177,5 +261,6 @@ export function writePaidSections(targetDir) {
177
261
  .filter((name) => Object.hasOwn(deps, name)));
178
262
  writeFileSync(join(targetDir, PAID_SECTIONS_PATH), renderPaidSections(present));
179
263
  writeModuleFlags(targetDir);
264
+ writePaidMcpTools(targetDir);
180
265
  return true;
181
266
  }
package/dist/surfaces.js CHANGED
@@ -713,7 +713,7 @@ export const ROUTE_SINCE = {
713
713
  // is one too. Whether it shows a ROW is a separate question with two
714
714
  // deployment preconditions (a resolvable workspace, and a `siteId` that
715
715
  // equals a workspace id); both fail empty, never wide. See
716
- // `apps/api/src/services/leads-inbox.ts` § "What it takes for this to
716
+ // `packages/api/src/services/leads-inbox.ts` § "What it takes for this to
717
717
  // return anything".
718
718
  "(authed)/leads": "0.24.0",
719
719
  // #5371 — the workspace module's three settings routes. Genuinely new route
@@ -1065,7 +1065,15 @@ export const ROUTE_DEPENDENCIES = {
1065
1065
  "meet/[slug]": ["apps/web/lib/meetings.tsx"],
1066
1066
  private: ["apps/web/lib/meetings.tsx", `${ROUTE_ROOT}/meet/meeting-index.tsx`],
1067
1067
  // #8927 D8 — /pricing maps the Offerings shown set through the mapper.
1068
- pricing: ["apps/web/lib/offerings-pricing.ts"],
1068
+ // #9480 — and reads its browser-facing API origin through the topology seam
1069
+ // (#7874 D12), so a spoke with /pricing reads no refused name. Every
1070
+ // scaffold since #7874 already carries its own render of the seam, and a
1071
+ // dependency copy never overwrites, so this entry admits the import; it
1072
+ // never replaces a spoke's render with the template's hub one.
1073
+ pricing: [
1074
+ "apps/web/lib/offerings-pricing.ts",
1075
+ "apps/web/lib/api-origin.generated.ts",
1076
+ ],
1069
1077
  };
1070
1078
  /**
1071
1079
  * i18n message namespaces (dot-path into `apps/web/messages/<locale>.json`) a
@@ -49,12 +49,23 @@ export interface SyncRoutesResult {
49
49
  missing: RouteReport[];
50
50
  /** Route dirs present but with a direct file absent or changed, sorted. */
51
51
  modified: RouteReport[];
52
- /** Route dirs copied this run (the missing list when applying, else empty). */
52
+ /** Route dirs copied this run (the missing list minus `refused` when applying, else empty). */
53
53
  applied: string[];
54
54
  /**
55
- * `ROUTE_DEPENDENCIES` files, of any route in `missing`, absent from the
56
- * target — copied when `apply` is set (never overwriting), else reported
57
- * only. Sorted, deduplicated.
55
+ * Missing routes `--apply` does not write because an import does not
56
+ * resolve (#9406 DD4) — reported in check mode too. Sorted.
57
+ */
58
+ refused: string[];
59
+ /**
60
+ * Per missing route, the local modules its files import (#9406 DD5): one
61
+ * entry per route with any non-empty list, sorted by route.
62
+ */
63
+ routeImports: RouteImportReport[];
64
+ /**
65
+ * Files, of any route in `missing` not `refused`, absent from the target:
66
+ * its `ROUTE_DEPENDENCIES` entries unioned with the `copies` its imports
67
+ * resolve to (#9406). Copied when `apply` is set (never overwriting), else
68
+ * reported only. Sorted, deduplicated.
58
69
  */
59
70
  missingDependencies: string[];
60
71
  /** Dependency files copied this run. Sorted. */
@@ -96,6 +107,21 @@ export interface RetiredCheckoutReport {
96
107
  /** Generated files rewritten (without `apply`: to rewrite) — the billing action. */
97
108
  rewritten: string[];
98
109
  }
110
+ /** One missing route's site-local imports (#9406 DD5) — see `walkRouteImports`. */
111
+ export interface RouteImportReport {
112
+ /** ROUTE_ROOT-relative, `/`-separated. */
113
+ route: string;
114
+ /** Template files the route reaches that the site lacks — copied with `--apply`. Sorted. */
115
+ copies: string[];
116
+ /** Files the route reaches that the site has, whose bytes differ from the template's — never written. Sorted. */
117
+ differs: string[];
118
+ /** Imports that resolve nowhere this sync can write; any entry refuses the route. Sorted by `from`, then `specifier`. */
119
+ unresolved: Array<{
120
+ specifier: string;
121
+ from: string;
122
+ reason: string;
123
+ }>;
124
+ }
99
125
  /** One `NO_STRUCTURED_DATA_ROUTES` element: its source text, dedented, and the routes it exempts. */
100
126
  interface StructuredDataExemption {
101
127
  route: string;
@@ -36,14 +36,13 @@
36
36
  */
37
37
  import { existsSync, lstatSync, mkdirSync, mkdtempSync, readdirSync, readFileSync, rmdirSync, rmSync, statSync, writeFileSync, } from "node:fs";
38
38
  import { tmpdir } from "node:os";
39
- import { basename, dirname, join, resolve, sep } from "node:path";
39
+ import { basename, dirname, join, posix, resolve, sep } from "node:path";
40
40
  import { parseArgs } from "node:util";
41
- import { copyTemplate } from "./copy.js";
41
+ import { copyTemplate, renderTemplateFile } from "./copy.js";
42
42
  import { SPOKE_BILLING_ACTION_PATH } from "./derive-architecture.js";
43
43
  import { appendEnvRows } from "./lib/declared-env.js";
44
44
  import { ENV_CATALOG } from "./lib/env-catalog.js";
45
45
  import { BILLING_ACTION, BILLING_ACTION_MARKER, RETIRED_CHECKOUT_E2E_MARKER, RETIRED_CHECKOUT_E2E_WORKFLOW_PATH, RETIRED_SPOKE_CHECKOUT_PATHS, } from "./spoke-checkout.js";
46
- import { substituteMarkers } from "./substitute.js";
47
46
  import { GATEABLE_SURFACES, NON_ROUTE_DIRS, ROUTE_DEPENDENCIES, ROUTE_MESSAGE_NAMESPACES, ROUTE_SINCE, surfaceForRouteDir, } from "./surfaces.js";
48
47
  import { TEMPLATE_RECORD_PATH, parseTemplateRecord, serializeTemplateRecord, sha256Hex, } from "./template-record.js";
49
48
  import { SPOKE_SEAM_FILES, isSpokeExcluded, readSpokeShape, } from "./topology.js";
@@ -70,6 +69,171 @@ const NESTED_FOREIGN_MODULE_ENTRIES = new Set([
70
69
  "careers/apply",
71
70
  "careers/[slug]",
72
71
  ]);
72
+ /** Extensions whose files are scanned for import specifiers (#9406 DD1). */
73
+ const SOURCE_FILE = /\.(?:ts|tsx|js|jsx|mjs|mts)$/;
74
+ /**
75
+ * Static import and re-export (`import … from`, `export … from`), side-effect
76
+ * (`import "…"`) and dynamic (`import("…")`) specifiers (#9406 DD1). Matched
77
+ * over the whole text: `[^'"]*?` spans newlines, so a multi-line
78
+ * `import {\n a,\n} from "…"` is caught from its `import` line.
79
+ */
80
+ const IMPORT_PATTERNS = [
81
+ /^\s*(?:import|export)\b[^'"]*?\bfrom\s*['"]([^'"]+)['"]/gm,
82
+ /^\s*import\s*['"]([^'"]+)['"]/gm,
83
+ /\bimport\(\s*['"]([^'"]+)['"]\s*\)/g,
84
+ ];
85
+ /** The site-local (`./`, `../`) import specifiers of a source text, deduplicated. */
86
+ function relativeImportSpecifiers(text) {
87
+ const out = new Set();
88
+ for (const pattern of IMPORT_PATTERNS) {
89
+ for (const match of text.matchAll(pattern)) {
90
+ const specifier = match[1];
91
+ if (specifier !== undefined && (specifier.startsWith("./") || specifier.startsWith("../"))) {
92
+ out.add(specifier);
93
+ }
94
+ }
95
+ }
96
+ return [...out];
97
+ }
98
+ /**
99
+ * The scaffold-relative files `specifier`, imported from `importer`, may name —
100
+ * in #9406 DD2's probe order: a `.js`/`.jsx` specifier's `.ts`/`.tsx` spelling
101
+ * first, then the exact path, the extension probes and the directory index.
102
+ * Empty when the path climbs out of the scaffold root.
103
+ */
104
+ function importCandidates(importer, specifier) {
105
+ const base = posix.normalize(posix.join(posix.dirname(importer), specifier));
106
+ if (base === ".." || base.startsWith("../"))
107
+ return [];
108
+ const out = [];
109
+ const js = /\.(jsx?)$/.exec(base);
110
+ if (js !== null) {
111
+ const stem = base.slice(0, -js[0].length);
112
+ if (js[1] === "js")
113
+ out.push(`${stem}.ts`);
114
+ out.push(`${stem}.tsx`);
115
+ }
116
+ out.push(base);
117
+ for (const ext of [".ts", ".tsx", ".js", ".jsx", ".mjs"])
118
+ out.push(base + ext);
119
+ out.push(`${base}/index.ts`, `${base}/index.tsx`);
120
+ return out;
121
+ }
122
+ /** Whether `root`/`rel` (`/`-separated) is an existing regular file. */
123
+ function isRegularFile(root, rel) {
124
+ try {
125
+ return statSync(join(root, ...rel.split("/"))).isFile();
126
+ }
127
+ catch {
128
+ return false;
129
+ }
130
+ }
131
+ /**
132
+ * The deepest route in `missingRoutes` a scaffold-relative path sits under —
133
+ * the route whose own copy writes it — or undefined.
134
+ */
135
+ function ownerRoute(path, missingRoutes) {
136
+ if (!path.startsWith(`${ROUTE_ROOT}/`))
137
+ return undefined;
138
+ const rel = path.slice(ROUTE_ROOT.length + 1);
139
+ let owner;
140
+ for (const m of missingRoutes) {
141
+ if (rel.startsWith(`${m}/`) && (owner === undefined || m.length > owner.length))
142
+ owner = m;
143
+ }
144
+ return owner;
145
+ }
146
+ /**
147
+ * Resolve the site-local imports of every file `route`'s own copy writes, and
148
+ * transitively of every helper that brings (#9406 DD1–DD3). Each import is
149
+ * resolved against the site first, then the template. A file the site has
150
+ * ends the walk there (the site owns its closure); a file another missing
151
+ * route's copy brings is recorded for DD4's propagation; a file only the
152
+ * template has is a copy — unless the spoke drops it or its surface is not
153
+ * carried, which refuses the route.
154
+ */
155
+ function walkRouteImports(route, ctx) {
156
+ const inScratch = (path) => path.startsWith(`${ROUTE_ROOT}/`) ? path.slice(ROUTE_ROOT.length + 1) : undefined;
157
+ const templateHas = (path) => {
158
+ const rel = inScratch(path);
159
+ return rel !== undefined
160
+ ? isRegularFile(ctx.scratch, rel)
161
+ : isRegularFile(ctx.templatesDir, path);
162
+ };
163
+ // The bytes `copyTemplate` (a route file) or `copyDependencyFile` (any
164
+ // other) would write for `path`.
165
+ const templateBytes = (path) => {
166
+ const rel = inScratch(path);
167
+ if (rel !== undefined)
168
+ return readFileSync(join(ctx.scratch, ...rel.split("/")));
169
+ return Buffer.from(renderTemplateFile(readFileSync(join(ctx.templatesDir, ...path.split("/"))), path, ctx.versions, ctx.markers));
170
+ };
171
+ const copies = new Set();
172
+ const differs = new Set();
173
+ const unresolved = [];
174
+ const reached = [];
175
+ const queue = regularFilesUnder(ctx.scratch, route)
176
+ .map((rel) => `${ROUTE_ROOT}/${rel}`)
177
+ .filter((path) => ownerRoute(path, ctx.missingRoutes) === route);
178
+ const visited = new Set(queue);
179
+ for (let from = queue.shift(); from !== undefined; from = queue.shift()) {
180
+ if (!SOURCE_FILE.test(from))
181
+ continue;
182
+ const importer = from;
183
+ for (const specifier of relativeImportSpecifiers(templateBytes(importer).toString("utf8"))) {
184
+ const candidates = importCandidates(importer, specifier);
185
+ const inSite = candidates.find((c) => isRegularFile(ctx.targetAbs, c));
186
+ const path = inSite ?? candidates.find(templateHas);
187
+ if (path === undefined) {
188
+ unresolved.push({ specifier, from: importer, reason: "not in the template" });
189
+ continue;
190
+ }
191
+ const owner = ownerRoute(path, ctx.missingRoutes);
192
+ if (owner !== undefined) {
193
+ if (owner !== route)
194
+ reached.push({ path, owner, specifier, from: importer });
195
+ continue;
196
+ }
197
+ if (inSite !== undefined) {
198
+ const siteBytes = readFileSync(join(ctx.targetAbs, ...path.split("/")));
199
+ if (templateHas(path) && !templateBytes(path).equals(siteBytes))
200
+ differs.add(path);
201
+ continue;
202
+ }
203
+ if (ctx.spoke !== undefined && isSpokeExcluded(path, ctx.spoke)) {
204
+ unresolved.push({ specifier, from: importer, reason: "the spoke does not carry it" });
205
+ continue;
206
+ }
207
+ const routeRel = inScratch(path);
208
+ const surface = routeRel === undefined ? "core" : surfaceForRouteDir(routeRel);
209
+ if (surface === undefined || !ctx.carried.has(surface)) {
210
+ unresolved.push({
211
+ specifier,
212
+ from: importer,
213
+ reason: `its surface (${surface ?? "none"}) is not carried by this site`,
214
+ });
215
+ continue;
216
+ }
217
+ copies.add(path);
218
+ if (!visited.has(path)) {
219
+ visited.add(path);
220
+ queue.push(path);
221
+ }
222
+ }
223
+ }
224
+ return {
225
+ route,
226
+ copies: [...copies].sort(),
227
+ differs: [...differs].sort(),
228
+ unresolved: sortUnresolved(unresolved),
229
+ reached,
230
+ };
231
+ }
232
+ /** `unresolved` rows sorted by `from`, then `specifier`. */
233
+ function sortUnresolved(rows) {
234
+ const key = (row) => `${row.from}\u0000${row.specifier}`;
235
+ return [...rows].sort((a, b) => (key(a) < key(b) ? -1 : key(a) > key(b) ? 1 : 0));
236
+ }
73
237
  /**
74
238
  * The elements of `source`'s `NO_STRUCTURED_DATA_ROUTES` array literal, by a
75
239
  * brace scan that skips string literals and comments. Empty when the
@@ -462,6 +626,7 @@ export function syncRoutes(opts) {
462
626
  const targetRouteRoot = join(targetAbs, ROUTE_ROOT);
463
627
  const missing = [];
464
628
  const modified = [];
629
+ let walks = [];
465
630
  const scratch = mkdtempSync(join(tmpdir(), "ailk-sync-routes-"));
466
631
  try {
467
632
  copyTemplate({
@@ -479,18 +644,73 @@ export function syncRoutes(opts) {
479
644
  modified.push(report);
480
645
  }
481
646
  }
647
+ // #9406 — resolve each missing route's site-local imports while the
648
+ // scratch render is still on disk.
649
+ walks = missing.map((r) => walkRouteImports(r.route, {
650
+ scratch,
651
+ templatesDir: opts.templatesDir,
652
+ targetAbs,
653
+ missingRoutes: missing.map((m) => m.route),
654
+ versions: opts.versions,
655
+ markers,
656
+ spoke,
657
+ carried: new Set(["core", "authed", ...carried]),
658
+ }));
482
659
  }
483
660
  finally {
484
661
  rmSync(scratch, { recursive: true, force: true });
485
662
  }
663
+ // #9406 DD4 — a route refuses when an import resolves nowhere; refusal
664
+ // inherits to its sub-routes and to any route importing a file only a
665
+ // refused route's copy would write, iterated to a fixpoint. Never upward:
666
+ // an ancestor is still copied without the refused sub-tree.
667
+ const missingRoutes = missing.map((r) => r.route);
668
+ const refusedSet = new Set(walks.filter((w) => w.unresolved.length > 0).map((w) => w.route));
669
+ for (let changed = true; changed;) {
670
+ changed = false;
671
+ for (const walk of walks) {
672
+ if (refusedSet.has(walk.route))
673
+ continue;
674
+ if (missingRoutes.some((a) => refusedSet.has(a) && walk.route.startsWith(`${a}/`))) {
675
+ refusedSet.add(walk.route);
676
+ changed = true;
677
+ continue;
678
+ }
679
+ const dangling = walk.reached.filter((r) => refusedSet.has(r.owner));
680
+ if (dangling.length > 0) {
681
+ walk.unresolved = sortUnresolved([
682
+ ...walk.unresolved,
683
+ ...dangling.map(({ path, owner, specifier, from }) => ({
684
+ specifier,
685
+ from,
686
+ reason: `${path} is brought by ${owner}, which is refused`,
687
+ })),
688
+ ]);
689
+ refusedSet.add(walk.route);
690
+ changed = true;
691
+ }
692
+ }
693
+ }
694
+ const refused = missingRoutes.filter((r) => refusedSet.has(r)).sort();
695
+ const routeImports = walks
696
+ .filter((w) => w.copies.length + w.differs.length + w.unresolved.length > 0)
697
+ .map(({ route, copies, differs, unresolved }) => ({ route, copies, differs, unresolved }))
698
+ .sort((a, b) => (a.route < b.route ? -1 : a.route > b.route ? 1 : 0));
486
699
  // #5014 third clause: a route's ROUTE_DEPENDENCIES files must exist in the
487
700
  // target too, or `--apply` leaves a route that cannot compile. Computed
488
701
  // from `missing` only — a route already present is assumed to already have
489
702
  // brought its own dependencies along (or the site owner has otherwise
490
703
  // satisfied them); re-checking every IN-SCOPE route's dependencies on every
491
704
  // run would report a pre-existing, unrelated gap as if this sync caused it.
705
+ // #9406 — unioned with the copies each route's imports resolve to, and
706
+ // never for a refused route: its helpers are neither required nor copied.
492
707
  const missingDependencies = [
493
- ...new Set(missing.flatMap((r) => r.dependencies.filter((dep) => !existsSync(join(targetAbs, dep))))),
708
+ ...new Set(missing
709
+ .filter((r) => !refusedSet.has(r.route))
710
+ .flatMap((r) => [
711
+ ...r.dependencies.filter((dep) => !existsSync(join(targetAbs, dep))),
712
+ ...(walks.find((w) => w.route === r.route)?.copies ?? []),
713
+ ])),
494
714
  ].sort();
495
715
  const missingMessageNamespaces = [
496
716
  ...new Set(missing.flatMap((r) => r.messageNamespaces.filter((ns) => !hasMessageNamespace(targetAbs, ns)))),
@@ -498,11 +718,11 @@ export function syncRoutes(opts) {
498
718
  const applied = [];
499
719
  const appliedDependencies = [];
500
720
  if (opts.apply === true) {
501
- const missingRoutes = missing.map((r) => r.route);
502
- for (const route of missingRoutes) {
721
+ const writable = missingRoutes.filter((r) => !refusedSet.has(r));
722
+ for (const route of writable) {
503
723
  applied.push(route);
504
724
  // An ancestor route dir's subtree copy already brings this one.
505
- if (missingRoutes.some((m) => route.startsWith(m + "/")))
725
+ if (writable.some((m) => route.startsWith(m + "/")))
506
726
  continue;
507
727
  const dst = resolve(join(targetRouteRoot, route));
508
728
  if (!dst.startsWith(targetAbs + sep)) {
@@ -513,6 +733,10 @@ export function syncRoutes(opts) {
513
733
  targetDir: dst,
514
734
  versions: opts.versions,
515
735
  markers,
736
+ // #9406 DD4 — hold back each refused sub-route from the ancestor's copy.
737
+ excludePaths: refused
738
+ .filter((r) => r.startsWith(route + "/"))
739
+ .map((r) => r.slice(route.length + 1)),
516
740
  });
517
741
  }
518
742
  for (const dep of missingDependencies) {
@@ -520,7 +744,7 @@ export function syncRoutes(opts) {
520
744
  if (!dst.startsWith(targetAbs + sep)) {
521
745
  throw new Error(`refusing to write outside target dir: ${dst}`);
522
746
  }
523
- copyDependencyFile(join(opts.templatesDir, dep), dst, markers);
747
+ copyDependencyFile(opts.templatesDir, dep, dst, opts.versions, markers);
524
748
  appliedDependencies.push(dep);
525
749
  }
526
750
  // #7874 D9 — a spoke declares what the copied routes read, as the last
@@ -536,6 +760,8 @@ export function syncRoutes(opts) {
536
760
  missing,
537
761
  modified,
538
762
  applied,
763
+ refused,
764
+ routeImports,
539
765
  missingDependencies,
540
766
  appliedDependencies,
541
767
  missingMessageNamespaces,
@@ -572,19 +798,20 @@ function hasMessageNamespace(targetAbs, namespace) {
572
798
  }
573
799
  }
574
800
  /**
575
- * Copy one dependency file from the template into the target, applying the
576
- * same marker substitution `copyTemplate` applies to text files — every
577
- * `ROUTE_DEPENDENCIES` entry is `.ts`/`.tsx`, always text. Never overwrites:
578
- * the caller (`syncRoutes`) only calls this for a path already confirmed
579
- * absent from the target, but the check is repeated here so this helper is
580
- * safe to call on its own.
801
+ * Copy one dependency file (`rel`, template-relative) from the template into
802
+ * the target through `renderTemplateFile` — the renderer `copyTemplate` uses,
803
+ * so a text file gets its markers and a non-text asset an import reached
804
+ * (`./logo.png`, #9406) is copied byte-for-byte. Never overwrites: the caller
805
+ * (`syncRoutes`) only calls this for a path already confirmed absent from the
806
+ * target, but the check is repeated here so this helper is safe to call on
807
+ * its own.
581
808
  */
582
- function copyDependencyFile(src, dst, markers) {
809
+ function copyDependencyFile(templatesDir, rel, dst, versions, markers) {
583
810
  if (existsSync(dst))
584
811
  return;
585
812
  mkdirSync(dirname(dst), { recursive: true });
586
- const text = readFileSync(src, "utf8");
587
- writeFileSync(dst, substituteMarkers(text, markers));
813
+ const bytes = readFileSync(join(templatesDir, ...rel.split("/")));
814
+ writeFileSync(dst, renderTemplateFile(bytes, rel, versions, markers));
588
815
  }
589
816
  /** Render the report the CLI prints after a run. Ends with a newline. */
590
817
  export function formatSyncRoutesReport(result, apply) {
@@ -598,7 +825,7 @@ export function formatSyncRoutesReport(result, apply) {
598
825
  }
599
826
  else if (apply) {
600
827
  lines.push(`[create-ailk] Copied ${result.applied.length} route(s):`);
601
- lines.push(...result.missing.map(entry));
828
+ lines.push(...result.missing.filter((r) => result.applied.includes(r.route)).map(entry));
602
829
  }
603
830
  else {
604
831
  lines.push(`[create-ailk] ${result.missing.length} template route(s) missing:`);
@@ -611,6 +838,32 @@ export function formatSyncRoutesReport(result, apply) {
611
838
  if (result.skippedSurfaces.length > 0) {
612
839
  lines.push(`[create-ailk] Surfaces this site does not carry (skipped): ${result.skippedSurfaces.join(", ")}`);
613
840
  }
841
+ // #9406 DD5 — per missing route, what its imports copy, leave, or cannot
842
+ // resolve; then the routes a dangling import holds back.
843
+ if (result.routeImports.length > 0) {
844
+ lines.push("[create-ailk] Local modules the missing route(s) import:");
845
+ for (const { route, copies, differs, unresolved } of result.routeImports) {
846
+ lines.push(` ${route}`);
847
+ if (copies.length > 0) {
848
+ lines.push(" copies:");
849
+ lines.push(...copies.map((path) => ` ${path}`));
850
+ }
851
+ if (differs.length > 0) {
852
+ lines.push(" left as-is (differs from the template):");
853
+ lines.push(...differs.map((path) => ` ${path}`));
854
+ }
855
+ if (unresolved.length > 0) {
856
+ lines.push(" cannot resolve:");
857
+ lines.push(...unresolved.map(({ specifier, from, reason }) => ` ${specifier} (from ${from}): ${reason}`));
858
+ }
859
+ }
860
+ }
861
+ if (result.refused.length > 0) {
862
+ lines.push(apply
863
+ ? `[create-ailk] ${result.refused.length} route(s) not copied — an import does not resolve:`
864
+ : `[create-ailk] ${result.refused.length} route(s) would not be copied — an import does not resolve:`);
865
+ lines.push(...result.refused.map((route) => ` ${route}`));
866
+ }
614
867
  // #5014 third clause: the routes/messages/lib a synced route needs to
615
868
  // compile, reported (and, for lib files, applied) alongside the route.
616
869
  if (result.missingDependencies.length > 0) {
@@ -3,17 +3,27 @@ export declare const TEMPLATE_RECORD_PATH = ".ailk-template-files.json";
3
3
  /**
4
4
  * The app paths a generator rewrites after `copyTemplate` lands its copy
5
5
  * (§1): the nav, the site chrome, the site fonts, the paid-sections
6
- * registry and its module-presence flags (#8843 D10), the four spoke seams, and a commerce spoke's checkout config,
6
+ * registry and its module-presence flags (#8843 D10), the paid MCP tool
7
+ * registry (#9460 DD6; `update` rewrites it every run, #9567), the four spoke seams, and a commerce spoke's checkout config,
7
8
  * which the checkout writer stamps and the site owns from then on (#8748
8
9
  * D2). Composed from each writer's own exported path constant, so a renamed
9
10
  * constant carries its path along here too (#8522 D2).
10
11
  */
11
12
  export declare const REGENERATED_APP_PATHS: readonly string[];
13
+ /**
14
+ * A hub's thin `database/` (#9569 DD1/DD8): the Prisma config that points at
15
+ * the installed `@working-theory/database`, and the two seeds the package
16
+ * does not publish. Recorded and carried by `update` like an app file; the
17
+ * module data files beside them (`database/flows/`, `database/waitlist/`)
18
+ * are bundle output, never recorded.
19
+ */
20
+ export declare const DATABASE_BOOT_FILES: readonly string[];
12
21
  /**
13
22
  * Whether a destination path (`/`-separated, as `templateDestination`
14
- * returns it) is one `update` ever records or touches (#8522 D2): under one
15
- * of the three app trees, not a `package.json`, not an `.env*` file, no
16
- * `.claude` segment, and not a path a generator rewrites after the copy.
23
+ * returns it) is one `update` ever records or touches (#8522 D2): one of
24
+ * the three `DATABASE_BOOT_FILES`, or under one of the three app trees, not
25
+ * a `package.json`, not an `.env*` file, no `.claude` segment, and not a
26
+ * path a generator rewrites after the copy.
17
27
  */
18
28
  export declare function isRecordable(destRel: string): boolean;
19
29
  /** The hex sha256 digest of `bytes` — the one hash every record row uses. */