create-ailk 0.24.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 (599) hide show
  1. package/README.md +42 -20
  2. package/component-catalog.json +3 -3
  3. package/component-catalog.md +3 -3
  4. package/dist/add-module.js +4 -2
  5. package/dist/add-route.d.ts +12 -1
  6. package/dist/add-route.js +31 -3
  7. package/dist/cli.js +12 -7
  8. package/dist/derive-architecture.d.ts +3 -4
  9. package/dist/derive-architecture.js +65 -29
  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/module-architecture.d.ts +20 -3
  20. package/dist/module-architecture.js +117 -550
  21. package/dist/paid-sections.d.ts +25 -1
  22. package/dist/paid-sections.js +88 -3
  23. package/dist/surfaces.js +10 -2
  24. package/dist/template-record.d.ts +14 -4
  25. package/dist/template-record.js +23 -5
  26. package/dist/topology.d.ts +16 -3
  27. package/dist/topology.js +31 -19
  28. package/dist/update.d.ts +10 -1
  29. package/dist/update.js +540 -16
  30. package/package.json +3 -3
  31. package/release-scope.json +1 -1
  32. package/templates/.claude/cloudparity-repo-hooks.json +5 -0
  33. package/templates/.claude/hooks/template-guard.sh +137 -0
  34. package/templates/.claude/rules/extending.md +106 -0
  35. package/templates/.claude/rules/loop-contract.md +2 -2
  36. package/templates/.claude/settings.json +11 -0
  37. package/templates/.env.example +5 -5
  38. package/templates/.github/workflows/ci.yml +7 -4
  39. package/templates/CLAUDE.md +11 -1
  40. package/templates/CONVENTIONS.md +8 -10
  41. package/templates/README.md +14 -13
  42. package/templates/apps/api/.env.example +2 -2
  43. package/templates/apps/api/CLAUDE.md +102 -76
  44. package/templates/apps/api/jest.config.cjs +15 -5
  45. package/templates/apps/api/package.json +16 -20
  46. package/templates/apps/api/src/__tests__/trusted-origins.server.test.ts +2 -2
  47. package/templates/apps/api/src/__tests__/vercel-handler.test.ts +4 -4
  48. package/templates/apps/api/src/index.ts +1 -1
  49. package/templates/apps/api/src/lib/__mocks__/prisma.ts +3 -3
  50. package/templates/apps/api/src/modules/commerce.ts +10 -0
  51. package/templates/apps/api/src/modules/content-write.ts +10 -0
  52. package/templates/apps/api/src/modules/multi-tenant.ts +10 -0
  53. package/templates/apps/api/src/modules/scheduling.ts +10 -0
  54. package/templates/apps/api/src/modules/signal-collectors.ts +10 -0
  55. package/templates/apps/api/src/modules/workspace.ts +10 -0
  56. package/templates/apps/api/src/server.ts +117 -1882
  57. package/templates/apps/api/vercel.json +2 -2
  58. package/templates/apps/mcp/CLAUDE.md +67 -20
  59. package/templates/apps/mcp/__tests__/app-entry.test.ts +4 -254
  60. package/templates/apps/mcp/__tests__/boot-file.test.ts +92 -0
  61. package/templates/apps/mcp/jest.config.cjs +6 -1
  62. package/templates/apps/mcp/package.json +5 -13
  63. package/templates/apps/mcp/src/app.ts +8 -7
  64. package/templates/apps/mcp/src/index.ts +6 -34
  65. package/templates/apps/mcp/src/lib/paid-tools.generated.ts +10 -0
  66. package/templates/apps/mcp/src/lib/topology.generated.ts +2 -2
  67. package/templates/apps/mcp/src/site.ts +12 -0
  68. package/templates/apps/web/.env.example +1 -1
  69. package/templates/apps/web/CLAUDE.md +10 -3
  70. package/templates/apps/web/app/.well-known/mcp.json/route.ts +9 -3
  71. package/templates/apps/web/app/[locale]/contact/intake-analytics.ts +1 -1
  72. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/magnet-page.test.tsx +22 -1
  73. package/templates/apps/web/app/[locale]/flows/[slug]/magnet-page.tsx +7 -3
  74. package/templates/apps/web/app/[locale]/pricing/__tests__/unconnected.test.tsx +43 -0
  75. package/templates/apps/web/app/[locale]/pricing/page.tsx +7 -3
  76. package/templates/apps/web/app/api/offerings/checkout/[lookupKey]/__tests__/route.test.ts +222 -0
  77. package/templates/apps/web/app/api/offerings/checkout/[lookupKey]/route.ts +10 -3
  78. package/templates/apps/web/app/api/revalidate/route.ts +3 -3
  79. package/templates/apps/web/auth.ts +2 -2
  80. package/templates/apps/web/jest.config.cjs +1 -0
  81. package/templates/apps/web/lib/auth-email.ts +1 -1
  82. package/templates/apps/web/lib/relay.ts +2 -2
  83. package/templates/apps/web/lib/release-scope.ts +47 -0
  84. package/templates/apps/web/lib/server-api.ts +1 -1
  85. package/templates/apps/web/src/lib/commerce-claim.ts +1 -1
  86. package/templates/customizations.yaml +37 -0
  87. package/templates/database/prisma.config.ts +10 -14
  88. package/templates/database/seed-test.ts +2 -2
  89. package/templates/database/seed.ts +5 -5
  90. package/templates/package.json +12 -6
  91. package/templates/pnpm-workspace.yaml +0 -1
  92. package/templates/project.yaml +16 -8
  93. package/templates/tools/jest/reporters.cjs +65 -0
  94. package/templates/tools/lint-architecture.ts +553 -7
  95. package/templates/tsconfig.json +1 -2
  96. package/versions.json +48 -35
  97. package/templates/apps/api/src/__tests__/commerce-claim-registration.test.ts +0 -409
  98. package/templates/apps/api/src/__tests__/factories/agent-caller.ts +0 -102
  99. package/templates/apps/api/src/__tests__/factories/content-fixture.ts +0 -138
  100. package/templates/apps/api/src/__tests__/factories/in-memory-prisma.ts +0 -441
  101. package/templates/apps/api/src/__tests__/factories/index.ts +0 -70
  102. package/templates/apps/api/src/__tests__/factories/lead-fixture.ts +0 -82
  103. package/templates/apps/api/src/__tests__/leads-forwarded-rate-limit.test.ts +0 -135
  104. package/templates/apps/api/src/__tests__/services/enrichment-shim.test.ts +0 -126
  105. package/templates/apps/api/src/__tests__/stripe-boot.test.ts +0 -132
  106. package/templates/apps/api/src/__tests__/support/hub-sign-in-fake-db.ts +0 -362
  107. package/templates/apps/api/src/bin/__tests__/rate-limit-probe.test.ts +0 -184
  108. package/templates/apps/api/src/bin/abandon-sweep.ts +0 -42
  109. package/templates/apps/api/src/bin/rate-limit-probe.ts +0 -53
  110. package/templates/apps/api/src/bin/spokes.ts +0 -198
  111. package/templates/apps/api/src/bin/stripe-connections-rekey.ts +0 -45
  112. package/templates/apps/api/src/config/__tests__/hub-require-spoke-key.test.ts +0 -196
  113. package/templates/apps/api/src/config/__tests__/index.test.ts +0 -233
  114. package/templates/apps/api/src/config/__tests__/modules.test.ts +0 -76
  115. package/templates/apps/api/src/config/__tests__/stripe-connection-key.test.ts +0 -185
  116. package/templates/apps/api/src/config/__tests__/trusted-origins.test.ts +0 -238
  117. package/templates/apps/api/src/config/index.ts +0 -596
  118. package/templates/apps/api/src/config/modules.ts +0 -83
  119. package/templates/apps/api/src/lib/__tests__/agent-store.test.ts +0 -581
  120. package/templates/apps/api/src/lib/__tests__/auth-email-budget.test.ts +0 -143
  121. package/templates/apps/api/src/lib/__tests__/consent-ledger-double.ts +0 -237
  122. package/templates/apps/api/src/lib/__tests__/consent-store.test.ts +0 -353
  123. package/templates/apps/api/src/lib/__tests__/content-adapter.test.ts +0 -201
  124. package/templates/apps/api/src/lib/__tests__/deliverable-asset-store.test.ts +0 -224
  125. package/templates/apps/api/src/lib/__tests__/error-serializer.test.ts +0 -120
  126. package/templates/apps/api/src/lib/__tests__/errors.test.ts +0 -94
  127. package/templates/apps/api/src/lib/__tests__/file-fallback.test.ts +0 -144
  128. package/templates/apps/api/src/lib/__tests__/fixtures/HomePage/home.mdx +0 -8
  129. package/templates/apps/api/src/lib/__tests__/flow-completion-store.test.ts +0 -149
  130. package/templates/apps/api/src/lib/__tests__/flow-rename-race.db.test.ts +0 -116
  131. package/templates/apps/api/src/lib/__tests__/hub-sign-in-store.test.ts +0 -209
  132. package/templates/apps/api/src/lib/__tests__/lead-capture-store.test.ts +0 -257
  133. package/templates/apps/api/src/lib/__tests__/lead-delivery.test.ts +0 -96
  134. package/templates/apps/api/src/lib/__tests__/outbound-http.test.ts +0 -125
  135. package/templates/apps/api/src/lib/__tests__/prisma.test.ts +0 -165
  136. package/templates/apps/api/src/lib/__tests__/require-commerce-claim.test.ts +0 -317
  137. package/templates/apps/api/src/lib/__tests__/require-paid-tier.test.ts +0 -129
  138. package/templates/apps/api/src/lib/__tests__/site.test.ts +0 -308
  139. package/templates/apps/api/src/lib/__tests__/slice-load.test.ts +0 -89
  140. package/templates/apps/api/src/lib/__tests__/spoke-store.test.ts +0 -202
  141. package/templates/apps/api/src/lib/__tests__/stripe-admission.test.ts +0 -217
  142. package/templates/apps/api/src/lib/__tests__/stripe.test.ts +0 -82
  143. package/templates/apps/api/src/lib/agent-store.ts +0 -613
  144. package/templates/apps/api/src/lib/auth-email-budget.ts +0 -161
  145. package/templates/apps/api/src/lib/consent-store.ts +0 -363
  146. package/templates/apps/api/src/lib/content-adapter.ts +0 -112
  147. package/templates/apps/api/src/lib/deliverable-asset-store.ts +0 -96
  148. package/templates/apps/api/src/lib/error-serializer.ts +0 -164
  149. package/templates/apps/api/src/lib/errors.ts +0 -95
  150. package/templates/apps/api/src/lib/file-fallback.ts +0 -87
  151. package/templates/apps/api/src/lib/flow-completion-store.ts +0 -136
  152. package/templates/apps/api/src/lib/hub-sign-in-store.ts +0 -455
  153. package/templates/apps/api/src/lib/lead-capture-store.ts +0 -122
  154. package/templates/apps/api/src/lib/lead-delivery.ts +0 -52
  155. package/templates/apps/api/src/lib/license-key-store.ts +0 -45
  156. package/templates/apps/api/src/lib/locales.ts +0 -201
  157. package/templates/apps/api/src/lib/outbound-http.ts +0 -127
  158. package/templates/apps/api/src/lib/prisma.ts +0 -21
  159. package/templates/apps/api/src/lib/proposal-paid-store.ts +0 -66
  160. package/templates/apps/api/src/lib/rate-limit-probe.ts +0 -165
  161. package/templates/apps/api/src/lib/rate-limit-store.ts +0 -142
  162. package/templates/apps/api/src/lib/require-commerce-claim.ts +0 -250
  163. package/templates/apps/api/src/lib/require-paid-tier.ts +0 -53
  164. package/templates/apps/api/src/lib/site.ts +0 -257
  165. package/templates/apps/api/src/lib/slice-load.ts +0 -90
  166. package/templates/apps/api/src/lib/spoke-store.ts +0 -180
  167. package/templates/apps/api/src/lib/stripe.ts +0 -321
  168. package/templates/apps/api/src/lib/webhook-idempotency.ts +0 -156
  169. package/templates/apps/api/src/middleware/__tests__/adversarial/bearer-token-format.test.ts +0 -111
  170. package/templates/apps/api/src/middleware/__tests__/adversarial/cookie-or-bearer-precedence.test.ts +0 -172
  171. package/templates/apps/api/src/middleware/__tests__/adversarial/csrf-bearer-skip.test.ts +0 -119
  172. package/templates/apps/api/src/middleware/__tests__/adversarial/csrf-cookie-path.test.ts +0 -138
  173. package/templates/apps/api/src/middleware/__tests__/adversarial/csrf-trusted-origins.test.ts +0 -142
  174. package/templates/apps/api/src/middleware/__tests__/adversarial/session-fixation.test.ts +0 -155
  175. package/templates/apps/api/src/middleware/__tests__/adversarial/session-timeout.test.ts +0 -139
  176. package/templates/apps/api/src/middleware/__tests__/auth.bearer-path.test.ts +0 -562
  177. package/templates/apps/api/src/middleware/__tests__/auth.both-present-precedence.test.ts +0 -76
  178. package/templates/apps/api/src/middleware/__tests__/auth.cookie-path.test.ts +0 -220
  179. package/templates/apps/api/src/middleware/__tests__/auth.database-not-configured.test.ts +0 -97
  180. package/templates/apps/api/src/middleware/__tests__/auth.hub-session-path.test.ts +0 -557
  181. package/templates/apps/api/src/middleware/__tests__/auth.neither-present.test.ts +0 -72
  182. package/templates/apps/api/src/middleware/__tests__/auth.optional-cookie.test.ts +0 -140
  183. package/templates/apps/api/src/middleware/__tests__/default-tenant.test.ts +0 -721
  184. package/templates/apps/api/src/middleware/__tests__/rate-limit-cross-isolate.db.test.ts +0 -220
  185. package/templates/apps/api/src/middleware/__tests__/rate-limit-store.test.ts +0 -430
  186. package/templates/apps/api/src/middleware/__tests__/rate-limit.test.ts +0 -1409
  187. package/templates/apps/api/src/middleware/__tests__/write-budget.test.ts +0 -174
  188. package/templates/apps/api/src/middleware/auth.ts +0 -864
  189. package/templates/apps/api/src/middleware/default-tenant.ts +0 -166
  190. package/templates/apps/api/src/middleware/rate-limit.ts +0 -983
  191. package/templates/apps/api/src/openapi/__tests__/openapi.test.ts +0 -391
  192. package/templates/apps/api/src/openapi/__tests__/spec-identity.test.ts +0 -182
  193. package/templates/apps/api/src/openapi/index.ts +0 -18
  194. package/templates/apps/api/src/openapi/spec.ts +0 -2148
  195. package/templates/apps/api/src/openapi/surface-drift.ts +0 -195
  196. package/templates/apps/api/src/routes/aeo/__tests__/index.test.ts +0 -175
  197. package/templates/apps/api/src/routes/aeo/index.ts +0 -107
  198. package/templates/apps/api/src/routes/auth/__tests__/auth-tokens.functional.test.ts +0 -196
  199. package/templates/apps/api/src/routes/auth/__tests__/auth-user.functional.test.ts +0 -249
  200. package/templates/apps/api/src/routes/auth/__tests__/hub-sign-in.test.ts +0 -532
  201. package/templates/apps/api/src/routes/auth/__tests__/tokens.test.ts +0 -313
  202. package/templates/apps/api/src/routes/auth/__tests__/transactional-email.test.ts +0 -413
  203. package/templates/apps/api/src/routes/auth/__tests__/user.test.ts +0 -609
  204. package/templates/apps/api/src/routes/auth/hub-sign-in.ts +0 -242
  205. package/templates/apps/api/src/routes/auth/tokens.ts +0 -211
  206. package/templates/apps/api/src/routes/auth/transactional-email.ts +0 -301
  207. package/templates/apps/api/src/routes/auth/user.ts +0 -305
  208. package/templates/apps/api/src/routes/billing/plan-checkout.ts +0 -332
  209. package/templates/apps/api/src/routes/checkout/__tests__/live-key.test.ts +0 -178
  210. package/templates/apps/api/src/routes/checkout/__tests__/offerings-authorization.test.ts +0 -1426
  211. package/templates/apps/api/src/routes/checkout/__tests__/session.test.ts +0 -448
  212. package/templates/apps/api/src/routes/checkout/__tests__/sessions.test.ts +0 -1742
  213. package/templates/apps/api/src/routes/checkout/index.ts +0 -34
  214. package/templates/apps/api/src/routes/checkout/session.ts +0 -171
  215. package/templates/apps/api/src/routes/checkout/sessions.ts +0 -540
  216. package/templates/apps/api/src/routes/consent/__tests__/account.test.ts +0 -386
  217. package/templates/apps/api/src/routes/consent/__tests__/sign-up-rate-limit.test.ts +0 -160
  218. package/templates/apps/api/src/routes/consent/account.ts +0 -268
  219. package/templates/apps/api/src/routes/consent/cookie.ts +0 -90
  220. package/templates/apps/api/src/routes/consent/index.ts +0 -26
  221. package/templates/apps/api/src/routes/consent/unsubscribe.ts +0 -127
  222. package/templates/apps/api/src/routes/content/__tests__/get-page.test.ts +0 -853
  223. package/templates/apps/api/src/routes/content/__tests__/list-pages.test.ts +0 -230
  224. package/templates/apps/api/src/routes/content/__tests__/list-types.test.ts +0 -44
  225. package/templates/apps/api/src/routes/content/__tests__/locale.test.ts +0 -118
  226. package/templates/apps/api/src/routes/content/__tests__/offerings.test.ts +0 -731
  227. package/templates/apps/api/src/routes/content/__tests__/pricing.test.ts +0 -753
  228. package/templates/apps/api/src/routes/content/__tests__/rate-limit.test.ts +0 -51
  229. package/templates/apps/api/src/routes/content/__tests__/search.test.ts +0 -450
  230. package/templates/apps/api/src/routes/content/__tests__/shown-offerings.test.ts +0 -762
  231. package/templates/apps/api/src/routes/content/get-page.ts +0 -183
  232. package/templates/apps/api/src/routes/content/index.ts +0 -49
  233. package/templates/apps/api/src/routes/content/list-pages.ts +0 -74
  234. package/templates/apps/api/src/routes/content/list-types.ts +0 -19
  235. package/templates/apps/api/src/routes/content/offerings.ts +0 -184
  236. package/templates/apps/api/src/routes/content/pricing.ts +0 -176
  237. package/templates/apps/api/src/routes/content/rate-limit.ts +0 -22
  238. package/templates/apps/api/src/routes/content/search.ts +0 -100
  239. package/templates/apps/api/src/routes/content/shown-offerings.ts +0 -229
  240. package/templates/apps/api/src/routes/leads/__tests__/capture.test.ts +0 -88
  241. package/templates/apps/api/src/routes/leads/__tests__/list.test.ts +0 -171
  242. package/templates/apps/api/src/routes/leads/__tests__/magnet-completion.test.ts +0 -515
  243. package/templates/apps/api/src/routes/leads/__tests__/spoke.test.ts +0 -392
  244. package/templates/apps/api/src/routes/leads/__tests__/track.test.ts +0 -165
  245. package/templates/apps/api/src/routes/leads/index.ts +0 -639
  246. package/templates/apps/api/src/routes/leads/list.ts +0 -104
  247. package/templates/apps/api/src/routes/project-listings/__tests__/configured-application.test.ts +0 -626
  248. package/templates/apps/api/src/routes/project-listings/__tests__/drafts.test.ts +0 -1268
  249. package/templates/apps/api/src/routes/project-listings/__tests__/founder-identity.test.ts +0 -847
  250. package/templates/apps/api/src/routes/project-listings/__tests__/me.test.ts +0 -491
  251. package/templates/apps/api/src/routes/project-listings/__tests__/public.test.ts +0 -476
  252. package/templates/apps/api/src/routes/project-listings/__tests__/resume-email.test.ts +0 -872
  253. package/templates/apps/api/src/routes/project-listings/__tests__/site-answers.test.ts +0 -1022
  254. package/templates/apps/api/src/routes/project-listings/__tests__/site-key.test.ts +0 -484
  255. package/templates/apps/api/src/routes/project-listings/__tests__/structured-address.test.ts +0 -535
  256. package/templates/apps/api/src/routes/project-listings/index.ts +0 -164
  257. package/templates/apps/api/src/routes/project-listings/me.ts +0 -87
  258. package/templates/apps/api/src/routes/project-listings/patch-copy.ts +0 -224
  259. package/templates/apps/api/src/routes/project-listings/patch-draft.ts +0 -102
  260. package/templates/apps/api/src/routes/project-listings/public.ts +0 -98
  261. package/templates/apps/api/src/routes/project-listings/respond.ts +0 -48
  262. package/templates/apps/api/src/routes/project-listings/resume-token.ts +0 -27
  263. package/templates/apps/api/src/routes/project-listings/start.ts +0 -140
  264. package/templates/apps/api/src/routes/project-listings/submit.ts +0 -130
  265. package/templates/apps/api/src/routes/project-listings/verify-email.ts +0 -150
  266. package/templates/apps/api/src/routes/requests/__tests__/confirm.test.ts +0 -686
  267. package/templates/apps/api/src/routes/requests/confirm.ts +0 -601
  268. package/templates/apps/api/src/routes/requests/index.ts +0 -54
  269. package/templates/apps/api/src/routes/test/auth/__tests__/session.test.ts +0 -306
  270. package/templates/apps/api/src/routes/test/auth/session.ts +0 -143
  271. package/templates/apps/api/src/routes/webhooks/README.md +0 -398
  272. package/templates/apps/api/src/routes/webhooks/__tests__/stripe-checkout-consent.test.ts +0 -649
  273. package/templates/apps/api/src/routes/webhooks/__tests__/stripe-dunning.test.ts +0 -749
  274. package/templates/apps/api/src/routes/webhooks/__tests__/stripe-flow-checkout.test.ts +0 -449
  275. package/templates/apps/api/src/routes/webhooks/__tests__/stripe-idempotency.test.ts +0 -264
  276. package/templates/apps/api/src/routes/webhooks/__tests__/stripe-livemode-live.test.ts +0 -159
  277. package/templates/apps/api/src/routes/webhooks/__tests__/stripe-livemode.test.ts +0 -158
  278. package/templates/apps/api/src/routes/webhooks/__tests__/stripe-offerings.test.ts +0 -814
  279. package/templates/apps/api/src/routes/webhooks/__tests__/stripe-org-billing.test.ts +0 -301
  280. package/templates/apps/api/src/routes/webhooks/__tests__/stripe-proposal-paid.test.ts +0 -369
  281. package/templates/apps/api/src/routes/webhooks/__tests__/stripe-rate-limit.test.ts +0 -215
  282. package/templates/apps/api/src/routes/webhooks/__tests__/stripe-request-paid.test.ts +0 -301
  283. package/templates/apps/api/src/routes/webhooks/__tests__/stripe-site-filter.test.ts +0 -809
  284. package/templates/apps/api/src/routes/webhooks/__tests__/stripe.test.ts +0 -1155
  285. package/templates/apps/api/src/routes/webhooks/index.ts +0 -141
  286. package/templates/apps/api/src/routes/webhooks/stripe-offerings.ts +0 -384
  287. package/templates/apps/api/src/routes/webhooks/stripe.ts +0 -2028
  288. package/templates/apps/api/src/services/__tests__/abandon-email.test.ts +0 -645
  289. package/templates/apps/api/src/services/__tests__/answer-distributions.test.ts +0 -132
  290. package/templates/apps/api/src/services/__tests__/audit-log.test.ts +0 -1028
  291. package/templates/apps/api/src/services/__tests__/checkout-plan.test.ts +0 -313
  292. package/templates/apps/api/src/services/__tests__/consent-ledger.test.ts +0 -503
  293. package/templates/apps/api/src/services/__tests__/consent-migration.test.ts +0 -65
  294. package/templates/apps/api/src/services/__tests__/consent.test.ts +0 -299
  295. package/templates/apps/api/src/services/__tests__/default-tenant.test.ts +0 -147
  296. package/templates/apps/api/src/services/__tests__/deliverable-fulfillment.test.ts +0 -877
  297. package/templates/apps/api/src/services/__tests__/deliverable-resend.test.ts +0 -379
  298. package/templates/apps/api/src/services/__tests__/dunning-policy.test.ts +0 -368
  299. package/templates/apps/api/src/services/__tests__/entitlements.test.ts +0 -142
  300. package/templates/apps/api/src/services/__tests__/hub-sign-in.test.ts +0 -854
  301. package/templates/apps/api/src/services/__tests__/keyless-workspace-predicate.test.ts +0 -234
  302. package/templates/apps/api/src/services/__tests__/lead-accept-user.test.ts +0 -251
  303. package/templates/apps/api/src/services/__tests__/lead-routing.test.ts +0 -2660
  304. package/templates/apps/api/src/services/__tests__/listing-config.test.ts +0 -166
  305. package/templates/apps/api/src/services/__tests__/magnet-completion.test.ts +0 -389
  306. package/templates/apps/api/src/services/__tests__/person.test.ts +0 -1204
  307. package/templates/apps/api/src/services/__tests__/plan-offerings.test.ts +0 -450
  308. package/templates/apps/api/src/services/__tests__/project-listings.counts.test.ts +0 -202
  309. package/templates/apps/api/src/services/__tests__/project-listings.fence.test.ts +0 -151
  310. package/templates/apps/api/src/services/__tests__/public-site-resolver.test.ts +0 -137
  311. package/templates/apps/api/src/services/__tests__/request-confirm.test.ts +0 -531
  312. package/templates/apps/api/src/services/__tests__/revalidation.test.ts +0 -372
  313. package/templates/apps/api/src/services/__tests__/slack-notify.test.ts +0 -348
  314. package/templates/apps/api/src/services/__tests__/spoke-resolution.test.ts +0 -660
  315. package/templates/apps/api/src/services/__tests__/usage-aggregation.test.ts +0 -941
  316. package/templates/apps/api/src/services/__tests__/usage-credits.test.ts +0 -588
  317. package/templates/apps/api/src/services/__tests__/verified-email.test.ts +0 -78
  318. package/templates/apps/api/src/services/abandon-email.ts +0 -336
  319. package/templates/apps/api/src/services/aeo-score.ts +0 -325
  320. package/templates/apps/api/src/services/answer-distributions.ts +0 -138
  321. package/templates/apps/api/src/services/audit-log.ts +0 -961
  322. package/templates/apps/api/src/services/checkout-buyer.ts +0 -168
  323. package/templates/apps/api/src/services/consent.ts +0 -834
  324. package/templates/apps/api/src/services/default-tenant.ts +0 -416
  325. package/templates/apps/api/src/services/deliverable-fulfillment.ts +0 -750
  326. package/templates/apps/api/src/services/dunning-policy.ts +0 -294
  327. package/templates/apps/api/src/services/enrichment-shim.ts +0 -53
  328. package/templates/apps/api/src/services/entitlements.ts +0 -338
  329. package/templates/apps/api/src/services/hub-sign-in.ts +0 -472
  330. package/templates/apps/api/src/services/lead-accept-user.ts +0 -126
  331. package/templates/apps/api/src/services/lead-promotion.ts +0 -160
  332. package/templates/apps/api/src/services/lead-routing.ts +0 -1372
  333. package/templates/apps/api/src/services/leads-inbox.ts +0 -312
  334. package/templates/apps/api/src/services/listing-config.ts +0 -178
  335. package/templates/apps/api/src/services/magnet-completion.ts +0 -242
  336. package/templates/apps/api/src/services/offerings/__tests__/catalog.test.ts +0 -348
  337. package/templates/apps/api/src/services/offerings/__tests__/checkout-session-record.test.ts +0 -268
  338. package/templates/apps/api/src/services/offerings/__tests__/connection.test.ts +0 -975
  339. package/templates/apps/api/src/services/offerings/__tests__/fixtures.ts +0 -416
  340. package/templates/apps/api/src/services/offerings/__tests__/org-products.test.ts +0 -400
  341. package/templates/apps/api/src/services/offerings/__tests__/readers.test.ts +0 -685
  342. package/templates/apps/api/src/services/offerings/__tests__/source.test.ts +0 -231
  343. package/templates/apps/api/src/services/offerings/catalog.ts +0 -318
  344. package/templates/apps/api/src/services/offerings/checkout-authorization.ts +0 -403
  345. package/templates/apps/api/src/services/offerings/checkout-session-record.ts +0 -192
  346. package/templates/apps/api/src/services/offerings/connection.ts +0 -1083
  347. package/templates/apps/api/src/services/offerings/index.ts +0 -614
  348. package/templates/apps/api/src/services/offerings/source.ts +0 -140
  349. package/templates/apps/api/src/services/offerings/store.ts +0 -150
  350. package/templates/apps/api/src/services/owner-workspaces.ts +0 -132
  351. package/templates/apps/api/src/services/person.ts +0 -1211
  352. package/templates/apps/api/src/services/plan-offerings.ts +0 -125
  353. package/templates/apps/api/src/services/project-listing-resume-email.ts +0 -326
  354. package/templates/apps/api/src/services/project-listings.ts +0 -2085
  355. package/templates/apps/api/src/services/public-site-resolver.ts +0 -396
  356. package/templates/apps/api/src/services/request-confirm.ts +0 -698
  357. package/templates/apps/api/src/services/revalidation.ts +0 -235
  358. package/templates/apps/api/src/services/slack-notify.ts +0 -291
  359. package/templates/apps/api/src/services/usage-aggregation.ts +0 -516
  360. package/templates/apps/api/src/services/usage-credits.ts +0 -340
  361. package/templates/apps/api/src/services/verified-email.ts +0 -71
  362. package/templates/apps/mcp/__tests__/abuse/daily-cap.test.ts +0 -52
  363. package/templates/apps/mcp/__tests__/abuse/email-validator.test.ts +0 -46
  364. package/templates/apps/mcp/__tests__/abuse/guard.test.ts +0 -198
  365. package/templates/apps/mcp/__tests__/abuse/honeypot.test.ts +0 -36
  366. package/templates/apps/mcp/__tests__/abuse/user-agent-deny.test.ts +0 -54
  367. package/templates/apps/mcp/__tests__/aeo-cli-parity.test.ts +0 -116
  368. package/templates/apps/mcp/__tests__/audit-single-page.test.ts +0 -299
  369. package/templates/apps/mcp/__tests__/boot.test.ts +0 -280
  370. package/templates/apps/mcp/__tests__/catalog-drift.test.ts +0 -359
  371. package/templates/apps/mcp/__tests__/config/modules.test.ts +0 -78
  372. package/templates/apps/mcp/__tests__/get_business_hours.test.ts +0 -82
  373. package/templates/apps/mcp/__tests__/get_faq.test.ts +0 -80
  374. package/templates/apps/mcp/__tests__/get_locations.test.ts +0 -65
  375. package/templates/apps/mcp/__tests__/get_offerings.test.ts +0 -557
  376. package/templates/apps/mcp/__tests__/get_pricing.test.ts +0 -524
  377. package/templates/apps/mcp/__tests__/get_site_info.test.ts +0 -81
  378. package/templates/apps/mcp/__tests__/http-transport.test.ts +0 -1232
  379. package/templates/apps/mcp/__tests__/index.test.ts +0 -195
  380. package/templates/apps/mcp/__tests__/lib/audit-single-page-readiness-scan.test.ts +0 -191
  381. package/templates/apps/mcp/__tests__/lib/commerce-claim.test.ts +0 -531
  382. package/templates/apps/mcp/__tests__/lib/content-adapter-parity.test.ts +0 -70
  383. package/templates/apps/mcp/__tests__/lib/content-adapter.test.ts +0 -162
  384. package/templates/apps/mcp/__tests__/lib/content-root.test.ts +0 -93
  385. package/templates/apps/mcp/__tests__/lib/errors.test.ts +0 -75
  386. package/templates/apps/mcp/__tests__/lib/fail-closed-tools.test.ts +0 -180
  387. package/templates/apps/mcp/__tests__/lib/public-workspace.test.ts +0 -124
  388. package/templates/apps/mcp/__tests__/list_pages.test.ts +0 -268
  389. package/templates/apps/mcp/__tests__/locale.test.ts +0 -120
  390. package/templates/apps/mcp/__tests__/module-exclusion.test.ts +0 -175
  391. package/templates/apps/mcp/__tests__/purchase-disabled.test.ts +0 -101
  392. package/templates/apps/mcp/__tests__/rate-limit-write.test.ts +0 -189
  393. package/templates/apps/mcp/__tests__/read_content.test.ts +0 -511
  394. package/templates/apps/mcp/__tests__/request_callback.test.ts +0 -160
  395. package/templates/apps/mcp/__tests__/search_content.test.ts +0 -271
  396. package/templates/apps/mcp/__tests__/server.test.ts +0 -388
  397. package/templates/apps/mcp/__tests__/start_purchase.test.ts +0 -448
  398. package/templates/apps/mcp/__tests__/submit_lead.test.ts +0 -222
  399. package/templates/apps/mcp/__tests__/subscribe_newsletter.test.ts +0 -152
  400. package/templates/apps/mcp/__tests__/tools/create_project.test.ts +0 -243
  401. package/templates/apps/mcp/__tests__/tools/purchase.test.ts +0 -451
  402. package/templates/apps/mcp/src/abuse/daily-cap.ts +0 -47
  403. package/templates/apps/mcp/src/abuse/email-validator.ts +0 -25
  404. package/templates/apps/mcp/src/abuse/honeypot.ts +0 -21
  405. package/templates/apps/mcp/src/abuse/index.ts +0 -349
  406. package/templates/apps/mcp/src/abuse/user-agent-deny.ts +0 -58
  407. package/templates/apps/mcp/src/boot.ts +0 -167
  408. package/templates/apps/mcp/src/config/modules.ts +0 -43
  409. package/templates/apps/mcp/src/http-transport.ts +0 -564
  410. package/templates/apps/mcp/src/lib/audit-single-page.ts +0 -308
  411. package/templates/apps/mcp/src/lib/commerce-claim.ts +0 -263
  412. package/templates/apps/mcp/src/lib/content-adapter.ts +0 -116
  413. package/templates/apps/mcp/src/lib/empty-content-adapter.ts +0 -140
  414. package/templates/apps/mcp/src/lib/errors.ts +0 -61
  415. package/templates/apps/mcp/src/lib/license-key-store.ts +0 -45
  416. package/templates/apps/mcp/src/lib/locales.ts +0 -171
  417. package/templates/apps/mcp/src/lib/prisma.ts +0 -39
  418. package/templates/apps/mcp/src/lib/public-workspace.ts +0 -133
  419. package/templates/apps/mcp/src/lib/resolve-locale.ts +0 -30
  420. package/templates/apps/mcp/src/lib/shown-offerings.ts +0 -105
  421. package/templates/apps/mcp/src/lib/site-config.ts +0 -53
  422. package/templates/apps/mcp/src/lib/stripe-tax-signal.ts +0 -59
  423. package/templates/apps/mcp/src/request-context.ts +0 -52
  424. package/templates/apps/mcp/src/server.ts +0 -343
  425. package/templates/apps/mcp/src/serverless-app.ts +0 -88
  426. package/templates/apps/mcp/src/tools/audit.ts +0 -127
  427. package/templates/apps/mcp/src/tools/capture_lead.ts +0 -66
  428. package/templates/apps/mcp/src/tools/create_project.ts +0 -134
  429. package/templates/apps/mcp/src/tools/get_business_hours.ts +0 -68
  430. package/templates/apps/mcp/src/tools/get_faq.ts +0 -71
  431. package/templates/apps/mcp/src/tools/get_locations.ts +0 -88
  432. package/templates/apps/mcp/src/tools/get_offerings.ts +0 -96
  433. package/templates/apps/mcp/src/tools/get_pricing.ts +0 -94
  434. package/templates/apps/mcp/src/tools/get_site_info.ts +0 -86
  435. package/templates/apps/mcp/src/tools/index.ts +0 -138
  436. package/templates/apps/mcp/src/tools/list_pages.ts +0 -68
  437. package/templates/apps/mcp/src/tools/person_notes.ts +0 -25
  438. package/templates/apps/mcp/src/tools/proposals.ts +0 -27
  439. package/templates/apps/mcp/src/tools/purchase.ts +0 -205
  440. package/templates/apps/mcp/src/tools/read_content.ts +0 -81
  441. package/templates/apps/mcp/src/tools/request_callback.ts +0 -52
  442. package/templates/apps/mcp/src/tools/search_content.ts +0 -63
  443. package/templates/apps/mcp/src/tools/subscribe_newsletter.ts +0 -54
  444. package/templates/apps/mcp/src/workspace-server.ts +0 -224
  445. package/templates/database/CHANGELOG.md +0 -981
  446. package/templates/database/LICENSE +0 -202
  447. package/templates/database/NOTICE +0 -2
  448. package/templates/database/README.md +0 -243
  449. package/templates/database/__tests__/agents.db.test.ts +0 -320
  450. package/templates/database/__tests__/appointment.db.test.ts +0 -106
  451. package/templates/database/__tests__/artifact-content-store.db.test.ts +0 -316
  452. package/templates/database/__tests__/composite-fence.db.test.ts +0 -206
  453. package/templates/database/__tests__/consent-ledger.db.test.ts +0 -345
  454. package/templates/database/__tests__/consent-source-checkout-migration.test.ts +0 -79
  455. package/templates/database/__tests__/fence-fan-out.db.test.ts +0 -715
  456. package/templates/database/__tests__/fixtures/appointment-create-probe.ts +0 -79
  457. package/templates/database/__tests__/fixtures/person-backfill.json +0 -264
  458. package/templates/database/__tests__/fixtures/person-contact-backfill.json +0 -182
  459. package/templates/database/__tests__/fixtures/project-listing-consent-probe.ts +0 -100
  460. package/templates/database/__tests__/flow-completion-migration.test.ts +0 -115
  461. package/templates/database/__tests__/flow-completion.db.test.ts +0 -136
  462. package/templates/database/__tests__/flow-workspace-key.db.test.ts +0 -263
  463. package/templates/database/__tests__/flows-listing-diagnostic.test.ts +0 -392
  464. package/templates/database/__tests__/flows-presets.test.ts +0 -173
  465. package/templates/database/__tests__/in-page-magnets-migration.test.ts +0 -161
  466. package/templates/database/__tests__/lead-idempotency-key.db.test.ts +0 -92
  467. package/templates/database/__tests__/member-area.db.test.ts +0 -257
  468. package/templates/database/__tests__/member-contract-migration.test.ts +0 -85
  469. package/templates/database/__tests__/member-contract.db.test.ts +0 -413
  470. package/templates/database/__tests__/offerings-checkout-session.db.test.ts +0 -270
  471. package/templates/database/__tests__/offerings-migration.test.ts +0 -197
  472. package/templates/database/__tests__/offerings-shown-price-ids-migration.test.ts +0 -86
  473. package/templates/database/__tests__/offerings.db.test.ts +0 -303
  474. package/templates/database/__tests__/outbound-message-action.db.test.ts +0 -80
  475. package/templates/database/__tests__/person-contact.db.test.ts +0 -563
  476. package/templates/database/__tests__/person-notes.db.test.ts +0 -249
  477. package/templates/database/__tests__/person.db.test.ts +0 -586
  478. package/templates/database/__tests__/piece-kind-migration.test.ts +0 -67
  479. package/templates/database/__tests__/piece-kind.db.test.ts +0 -208
  480. package/templates/database/__tests__/prefixed-ids.db.test.ts +0 -222
  481. package/templates/database/__tests__/project-listing-consent-at.db.test.ts +0 -111
  482. package/templates/database/__tests__/seed.test.ts +0 -272
  483. package/templates/database/__tests__/spoke-registry.db.test.ts +0 -191
  484. package/templates/database/__tests__/tenancy.test.ts +0 -141
  485. package/templates/database/__tests__/trial-magnet-migration.test.ts +0 -186
  486. package/templates/database/__tests__/user-cascade.test.ts +0 -140
  487. package/templates/database/_gitignore +0 -8
  488. package/templates/database/auth/.gitkeep +0 -0
  489. package/templates/database/auth/schema.prisma +0 -641
  490. package/templates/database/config/.gitkeep +0 -0
  491. package/templates/database/config/schema.prisma +0 -441
  492. package/templates/database/content/.gitkeep +0 -0
  493. package/templates/database/content/schema.prisma +0 -339
  494. package/templates/database/eslint.config.mjs +0 -69
  495. package/templates/database/flows/listing-diagnostic.ts +0 -182
  496. package/templates/database/flows/presets.ts +0 -315
  497. package/templates/database/inbox/.gitkeep +0 -0
  498. package/templates/database/inbox/README.md +0 -3
  499. package/templates/database/inbox/__tests__/schema.test.ts +0 -44
  500. package/templates/database/inbox/schema.prisma +0 -1447
  501. package/templates/database/jest.config.cjs +0 -36
  502. package/templates/database/migrations/20260508000000_add_inbox_namespace/migration.sql +0 -328
  503. package/templates/database/migrations/20260513000000_better_auth_migration/migration.sql +0 -100
  504. package/templates/database/migrations/20260515000000_add_user_billing_fields/migration.sql +0 -28
  505. package/templates/database/migrations/20260516000000_add_user_tier_care_plan_seat/migration.sql +0 -25
  506. package/templates/database/migrations/20260518000000_add_telemetry_records/migration.sql +0 -42
  507. package/templates/database/migrations/20260525000000_theme_wiring/migration.sql +0 -67
  508. package/templates/database/migrations/20260710000000_retire_commercial_tier/migration.sql +0 -21
  509. package/templates/database/migrations/20260712215647_add_multi_tenant_tenancy/migration.sql +0 -201
  510. package/templates/database/migrations/20260713143320_reanchor_site_config_to_workspace/migration.sql +0 -67
  511. package/templates/database/migrations/20260713174000_add_audit_logs/migration.sql +0 -46
  512. package/templates/database/migrations/20260713190000_drop_telemetry_records/migration.sql +0 -25
  513. package/templates/database/migrations/20260713192000_add_uuidv7_function/migration.sql +0 -49
  514. package/templates/database/migrations/20260713192429_prefixed_uuid_entity_ids/migration.sql +0 -197
  515. package/templates/database/migrations/20260713200000_add_org_billing/migration.sql +0 -32
  516. package/templates/database/migrations/20260714000000_add_lead_promotion_fields/migration.sql +0 -22
  517. package/templates/database/migrations/20260714010000_add_usage_billing_content_models/migration.sql +0 -151
  518. package/templates/database/migrations/20260714020000_add_usage_billing_auth_config_models/migration.sql +0 -223
  519. package/templates/database/migrations/20260714030000_credit_balance_non_negative/migration.sql +0 -22
  520. package/templates/database/migrations/20260714030000_widen_usage_billing_report_aggregates/migration.sql +0 -32
  521. package/templates/database/migrations/20260810233516_add_flow_engine_models/migration.sql +0 -40
  522. package/templates/database/migrations/20260811020000_add_flow_session_abandon_email_columns/migration.sql +0 -4
  523. package/templates/database/migrations/20260811030000_add_flow_session_abandon_email_index/migration.sql +0 -2
  524. package/templates/database/migrations/20260811040000_add_flow_session_segment/migration.sql +0 -2
  525. package/templates/database/migrations/20260811050000_add_deliverable_models/migration.sql +0 -29
  526. package/templates/database/migrations/20260812000000_add_deliverable_grant_send_columns/migration.sql +0 -6
  527. package/templates/database/migrations/20260902222948_add_waitlist_experiment_models/migration.sql +0 -39
  528. package/templates/database/migrations/20260902224500_add_waitlist_id_format_checks/migration.sql +0 -24
  529. package/templates/database/migrations/20260903004112_add_flow_session_flags_aeo_score/migration.sql +0 -3
  530. package/templates/database/migrations/20260903010000_add_playbook_instance/migration.sql +0 -33
  531. package/templates/database/migrations/20260904000000_add_waitlist_followup_send/migration.sql +0 -30
  532. package/templates/database/migrations/20260905230000_add_flow_checkout/migration.sql +0 -47
  533. package/templates/database/migrations/20260906000000_add_flow_checkout_idempotency/migration.sql +0 -16
  534. package/templates/database/migrations/20260907120000_add_project_listing/migration.sql +0 -47
  535. package/templates/database/migrations/20260907130000_add_project_listing_slack_columns/migration.sql +0 -10
  536. package/templates/database/migrations/20260907180000_add_listing_csv_send/migration.sql +0 -26
  537. package/templates/database/migrations/20260909120000_project_listings_platform/migration.sql +0 -90
  538. package/templates/database/migrations/20260909180000_listing_draft_and_fields/migration.sql +0 -174
  539. package/templates/database/migrations/20260910120000_listing_public_site_key/migration.sql +0 -14
  540. package/templates/database/migrations/20260911120000_listing_copy_edit_audit/migration.sql +0 -25
  541. package/templates/database/migrations/20260911140000_listing_structured_address/migration.sql +0 -32
  542. package/templates/database/migrations/20260911180000_consent_grants/migration.sql +0 -71
  543. package/templates/database/migrations/20260911200000_listing_site_answers/migration.sql +0 -30
  544. package/templates/database/migrations/20260912120000_listing_owner_link/migration.sql +0 -49
  545. package/templates/database/migrations/20260914120000_listing_founder_identity/migration.sql +0 -123
  546. package/templates/database/migrations/20260915120000_project_listing_solution/migration.sql +0 -15
  547. package/templates/database/migrations/20260916120000_artifact_content_store/migration.sql +0 -158
  548. package/templates/database/migrations/20260917120000_callback_request_confirm/migration.sql +0 -40
  549. package/templates/database/migrations/20260918120000_add_appointment/migration.sql +0 -67
  550. package/templates/database/migrations/20260918120000_asset_metadata_columns/migration.sql +0 -70
  551. package/templates/database/migrations/20260919120000_flow_workspace_key/migration.sql +0 -181
  552. package/templates/database/migrations/20260919130000_flow_definition_admin_columns/migration.sql +0 -172
  553. package/templates/database/migrations/20260919130000_workspace_meetings/migration.sql +0 -41
  554. package/templates/database/migrations/20260919140000_inbox_workspace_key/migration.sql +0 -185
  555. package/templates/database/migrations/20260920120000_lead_handled_at/migration.sql +0 -70
  556. package/templates/database/migrations/20260920130000_lead_workspace_source_index/migration.sql +0 -57
  557. package/templates/database/migrations/20260921120000_deliverable_grant_workspace_key/migration.sql +0 -68
  558. package/templates/database/migrations/20260922120000_tenancy_fence/migration.sql +0 -1067
  559. package/templates/database/migrations/20260923120000_listing_capturing_magnet/migration.sql +0 -210
  560. package/templates/database/migrations/20261003120000_spoke_registry/migration.sql +0 -80
  561. package/templates/database/migrations/20261003130000_scheduling_connection/migration.sql +0 -49
  562. package/templates/database/migrations/20261005120000_agents/migration.sql +0 -84
  563. package/templates/database/migrations/20261008120000_user_last_workspace/migration.sql +0 -35
  564. package/templates/database/migrations/20261008130000_lead_idempotency_key/migration.sql +0 -20
  565. package/templates/database/migrations/20261009120000_agent_grants/migration.sql +0 -33
  566. package/templates/database/migrations/20261010120000_person/migration.sql +0 -106
  567. package/templates/database/migrations/20261010121000_person_backfill/migration.sql +0 -132
  568. package/templates/database/migrations/20261010130000_agent_grants_people_read/migration.sql +0 -20
  569. package/templates/database/migrations/20261011120000_member_area/migration.sql +0 -158
  570. package/templates/database/migrations/20261011130000_agent_grants_member_pieces_manage/migration.sql +0 -21
  571. package/templates/database/migrations/20261012120000_member_contract/migration.sql +0 -192
  572. package/templates/database/migrations/20261013120000_lead_spoke_checkout/migration.sql +0 -20
  573. package/templates/database/migrations/20261014120000_consent_ledger/migration.sql +0 -122
  574. package/templates/database/migrations/20261014120000_person_contact/migration.sql +0 -231
  575. package/templates/database/migrations/20261015120000_person_notes/migration.sql +0 -77
  576. package/templates/database/migrations/20261015120000_rate_limit_counters/migration.sql +0 -43
  577. package/templates/database/migrations/20261016120000_piece_kind/migration.sql +0 -95
  578. package/templates/database/migrations/20261017120000_outbound_message_action/migration.sql +0 -30
  579. package/templates/database/migrations/20261018120000_flow_completion/migration.sql +0 -52
  580. package/templates/database/migrations/20261019120000_consent_source_checkout/migration.sql +0 -27
  581. package/templates/database/migrations/20261020120000_offerings_data_model/migration.sql +0 -146
  582. package/templates/database/migrations/20261021120000_offerings_checkout_session/migration.sql +0 -77
  583. package/templates/database/migrations/20261022120000_in_page_magnets/migration.sql +0 -45
  584. package/templates/database/migrations/20261023120000_offerings_shown_price_ids/migration.sql +0 -47
  585. package/templates/database/migrations/20261024120000_organization_plan_checkout_session/migration.sql +0 -16
  586. package/templates/database/migrations/20261025120000_trial_magnet/migration.sql +0 -28
  587. package/templates/database/migrations/20261026120000_trial_magnet_proof_line/migration.sql +0 -23
  588. package/templates/database/migrations/migration_lock.toml +0 -3
  589. package/templates/database/ops/.gitkeep +0 -0
  590. package/templates/database/ops/schema.prisma +0 -43
  591. package/templates/database/package.json +0 -89
  592. package/templates/database/schema.prisma +0 -71
  593. package/templates/database/scripts/db-generate-locked.sh +0 -80
  594. package/templates/database/scripts/person-backfill.sql +0 -132
  595. package/templates/database/tenancy.ts +0 -183
  596. package/templates/database/tsconfig.build.json +0 -16
  597. package/templates/database/tsconfig.flows.json +0 -15
  598. package/templates/database/tsconfig.json +0 -16
  599. package/templates/database/tsconfig.tenancy.json +0 -14
@@ -110,7 +110,7 @@ export const ARCHITECTURE_BASE = {
110
110
  version: 1,
111
111
  composition_model: {
112
112
  tiers: {
113
- data: "database/ — Prisma schema + migrations",
113
+ data: "database/ — Prisma config + seed; schema and migrations ship in @working-theory/database",
114
114
  api: "apps/api (public HTTP API) + apps/mcp (agent tools)",
115
115
  presentation: "apps/web — frontend surfaces",
116
116
  },
@@ -150,82 +150,6 @@ export const ARCHITECTURE_BASE = {
150
150
  },
151
151
  ],
152
152
  };
153
- /**
154
- * The member area's apps/api files (#7877 D9, D11), co-owned by `workspace`
155
- * and `multi-tenant`: server.ts registers all five routes under the
156
- * `workspace || multi-tenant` disjunction, so both bundles must deliver every
157
- * file behind it — the three operator route files, the two member route
158
- * files, the member resolution (`services/member-area.ts`) and the member
159
- * data boundary (`lib/member-store.ts`).
160
- *
161
- * #8169 D9 adds the five Phase 1 member reads registered under that same
162
- * disjunction. Its two other reads — `routes/member/meeting-types.ts` and
163
- * `availability.ts` — reach `services/scheduling/`, so they are the
164
- * `scheduling` slice's, not listed here.
165
- *
166
- * #8170 D11 adds the four member writes registered under that same
167
- * disjunction (the message POST rides `messages.ts`). The fifth —
168
- * `routes/member/bookings.ts` — reaches `services/scheduling/`, so it is the
169
- * `scheduling` slice's.
170
- */
171
- const MEMBER_AREA_FILES = [
172
- "apps/api/src/routes/workspaces/pieces.ts",
173
- "apps/api/src/routes/workspaces/plan.ts",
174
- "apps/api/src/routes/workspaces/messages-out.ts",
175
- // #8171 D8 — the workspace Requests read; imports only pieces.ts,
176
- // lib/tenant-db.ts and @working-theory/validation.
177
- "apps/api/src/routes/workspaces/requests.ts",
178
- "apps/api/src/routes/member/pieces.ts",
179
- "apps/api/src/routes/member/messages.ts",
180
- "apps/api/src/routes/member/purchases.ts",
181
- "apps/api/src/routes/member/appointments.ts",
182
- "apps/api/src/routes/member/artifacts.ts",
183
- "apps/api/src/routes/member/request-form.ts",
184
- "apps/api/src/routes/member/billing.ts",
185
- "apps/api/src/routes/member/requests.ts",
186
- // #8515 D13 — the client's onboarding read and write.
187
- "apps/api/src/routes/member/onboarding.ts",
188
- "apps/api/src/routes/member/artifact-review.ts",
189
- "apps/api/src/routes/member/profile.ts",
190
- "apps/api/src/routes/member/deletion-request.ts",
191
- // #8438 D6 — the member's own consents; the same gate as the writes above.
192
- "apps/api/src/routes/member/consents.ts",
193
- "apps/api/src/services/member-area.ts",
194
- // #8516 D8 — whether proposal payment runs, and the Checkout Session;
195
- // imported only by member-area files (pieces.ts and the two member
196
- // artifact routes), and itself imports only base files.
197
- "apps/api/src/services/proposal-payments.ts",
198
- "apps/api/src/lib/member-store.ts",
199
- // #8226 D12 — the member-request match CLI; both import member-store.ts,
200
- // which a build without the member slice does not carry.
201
- "apps/api/src/lib/member-request-match.ts",
202
- "apps/api/src/bin/member-request-match.ts",
203
- ];
204
- /**
205
- * The workspace asset store (#5854), CO-OWNED by the `workspace` and
206
- * `multi-tenant` slices.
207
- *
208
- * `server.ts` registers both of its routes under
209
- * `isModuleEnabled("workspace") || isModuleEnabled("multi-tenant")`, and a file
210
- * behind a two-module disjunction must be deliverable by BOTH bundles — or
211
- * whichever module lacks it throws ERR_MODULE_NOT_FOUND during `build()`. One
212
- * array spread into both `ownedFiles` lists makes the two copies incapable of
213
- * drifting, which matters because a drift only surfaces in a scaffolded
214
- * customer repo rather than here.
215
- *
216
- * `routes/assets/index.ts` is listed although it registers nothing: the
217
- * template-exclusion closure runs over IMPORTERS, so a shared-constants module
218
- * that is imported BY the routes and imports neither of them is never reached
219
- * from them, and an unlisted one would ship into the keyless Free starter.
220
- */
221
- const ASSET_STORE_FILES = [
222
- "apps/api/src/routes/assets/index.ts",
223
- "apps/api/src/routes/assets/upload.ts",
224
- "apps/api/src/routes/assets/read.ts",
225
- // The manage routes — list, PATCH, DELETE (#6093 D16).
226
- "apps/api/src/routes/assets/manage.ts",
227
- "apps/api/src/lib/asset-store.ts",
228
- ];
229
153
  /**
230
154
  * The auth-adapter exception (#587 in the AILK repo's own architecture.yaml):
231
155
  * the base apps/web hands Better Auth its Prisma client from
@@ -548,7 +472,7 @@ export const MODULE_SLICES = {
548
472
  apps: {
549
473
  admin: {
550
474
  path: "apps/admin",
551
- description: "Next.js — authed Admin app (Organization → Workspace → Membership). Hosts the organization-plugin Better Auth handlers; imports the database only via lib/prisma-for-auth.ts (auth-adapter exception); all domain data via apps/api's workspace-scoped routes over HTTP.",
475
+ description: "Next.js — the Admin shell (Organization → Workspace → Membership): boots @working-theory/admin, which carries the pages, components, lib and auth, through generated route re-exports (#9570). Hosts the organization-plugin Better Auth route; the database read sits in that package (its lib/prisma-for-auth.ts, the auth-adapter exception); all domain data via apps/api's workspace-scoped routes over HTTP.",
552
476
  may_import_from: [
553
477
  "database",
554
478
  "packages/templates",
@@ -699,12 +623,17 @@ export const MODULE_SLICES = {
699
623
  // ownedFiles (S1, #5088). Verified against the current filesystem and
700
624
  // server.ts's module-conditional registration (isModuleEnabled('multi-tenant')).
701
625
  //
702
- // apps-paid/admin/** is a single glob — the whole app (43 files as of
703
- // this pass, excluding __tests__/node_modules), just moved here from
704
- // apps/workspace by a parallel workstream on this same branch. Later
705
- // renamed in place from its former Workspace-prefixed directory name by
706
- // #5637, the Admin-vocabulary rename. Unlike every other entry below,
707
- // this one is intentionally a glob, not an enumeration.
626
+ // apps-paid/admin/** is a single glob — the whole app, originally moved
627
+ // here from apps/workspace by a parallel workstream on this same branch,
628
+ // later renamed in place from its former Workspace-prefixed directory
629
+ // name by #5637, the Admin-vocabulary rename. Since #9570 the app under
630
+ // the glob is the Next SHELL (@working-theory/admin-shell): its configs,
631
+ // root layout, stylesheet, icons, Better Auth route, a re-exporting
632
+ // auth.ts and the generated re-exports of the package's routes — the
633
+ // pages, components, lib and auth implementation live in
634
+ // @working-theory/admin (packages-paid/admin), which the staged shell
635
+ // depends on, so the bundle carries no Admin source. Unlike every other
636
+ // entry below, this one is intentionally a glob, not an enumeration.
708
637
  //
709
638
  // apps/api/src/routes/project-listings/ is MIXED (free anonymous surface
710
639
  // + tenant dashboard sharing one directory) — only the tenant-guarded
@@ -723,20 +652,20 @@ export const MODULE_SLICES = {
723
652
  // patch.ts (tenant) AND ALSO by patch-draft.ts/public.ts (free) —
724
653
  // shared within the directory across the free/paid split, so it stays.
725
654
  //
726
- // apps/api/src/routes/waitlist-experiments/respond.ts, by contrast, IS
655
+ // routes/waitlist-experiments/respond.ts (now api-signal-collectors'), by contrast, IS
727
656
  // listed: grepped every `from "./respond.js"` importer in the repo and
728
657
  // it is used ONLY by this directory's own comparison.ts/list.ts/signup.ts/
729
658
  // signups.ts — all four tenant-scoped — so unlike its project-listings
730
659
  // namesake it is NOT shared with a free route.
731
660
  //
732
- // apps/api/src/middleware/tenant.ts, services/tenant-context.ts,
661
+ // packages/api/src/middleware/tenant.ts, services/tenant-context.ts,
733
662
  // services/waitlist-dashboard.ts: each grepped for every importer
734
663
  // repo-wide. tenant.ts is registered only in server.ts's tenantScope;
735
664
  // tenant-context.ts backs only workspaces/tenant-guarded routes;
736
665
  // waitlist-dashboard.ts backs only the four waitlist-experiments handlers
737
666
  // above. None is reachable from a free route.
738
667
  //
739
- // apps/api/src/lib/tenant-db.ts and lib/ws-token.ts are an ADDITION beyond
668
+ // packages/api/src/lib/tenant-db.ts and lib/ws-token.ts are an ADDITION beyond
740
669
  // this card's literal checklist, found by tracing workspaces/*.ts's own
741
670
  // imports: tenant-db.ts (the per-tenant Prisma-scoped client) is used only
742
671
  // by services/tenant-context.ts and the three workspaces/*.ts route files
@@ -790,124 +719,6 @@ export const MODULE_SLICES = {
790
719
  // not file grain, so it stays out of this literal list rather than
791
720
  // asserting a split the evidence doesn't cleanly support.
792
721
  ownedFiles: [
793
- "apps/api/src/routes/workspaces/index.ts",
794
- "apps/api/src/routes/workspaces/sessions.ts",
795
- "apps/api/src/routes/workspaces/config.ts",
796
- // #8926 D1 — the workspace Offerings routes, registered in the
797
- // multi-tenant tenant scope beside the billing routes.
798
- "apps/api/src/routes/workspaces/offerings.ts",
799
- // #8438 D8 — the Admin owner's consents to Working Theory: registered
800
- // under `isModuleEnabled("multi-tenant")` alone, the module that
801
- // contributes the Admin app.
802
- "apps/api/src/routes/consent/platform.ts",
803
- // Co-owned with `workspace` (#5853): the content-write scope is gated on
804
- // content-write AND (workspace || multi-tenant) and this file imports
805
- // lib/tenant-db.ts, so each tenancy slice must deliver it.
806
- "apps/api/src/routes/workspaces/content.ts",
807
- ...ASSET_STORE_FILES,
808
- "apps/api/src/routes/billing/index.ts",
809
- "apps/api/src/routes/billing/portal.ts",
810
- "apps/api/src/routes/billing/read.ts",
811
- "apps/api/src/routes/billing/stripe-connection.ts",
812
- "apps/api/src/routes/billing/stripe-products.ts",
813
- "apps/api/src/routes/billing/usage.ts",
814
- "apps/api/src/routes/waitlist-experiments/index.ts",
815
- "apps/api/src/routes/waitlist-experiments/list.ts",
816
- "apps/api/src/routes/waitlist-experiments/comparison.ts",
817
- "apps/api/src/routes/waitlist-experiments/signup.ts",
818
- "apps/api/src/routes/waitlist-experiments/signups.ts",
819
- "apps/api/src/routes/waitlist-experiments/respond.ts",
820
- "apps/api/src/routes/project-listings/get.ts",
821
- "apps/api/src/routes/project-listings/list.ts",
822
- "apps/api/src/routes/project-listings/patch.ts",
823
- "apps/api/src/middleware/tenant.ts",
824
- "apps/api/src/services/tenant-context.ts",
825
- "apps/api/src/services/waitlist-dashboard.ts",
826
- // #6258 — the file waitlist-dashboard.ts imports for the pinned
827
- // platform-operator read scope. It rides BOTH slices for the same
828
- // reason its importer does: an unlisted import target breaks a
829
- // signal-collectors-without-multi-tenant scaffold at build() time.
830
- "apps/api/src/services/waitlist-operator-reads.ts",
831
- // #6204/#6280 CI fix — `listUnhandledMessages`/`markMessageHandled`
832
- // (the "Needs-you" message read/write over `tenantDb(tenant).leads`)
833
- // moved here off `services/leads-inbox.ts`, a BASE-tier file every
834
- // scaffold ships. Importing `lib/tenant-db.ts` from that base file
835
- // walked `paidModuleTemplateExclusions()`'s companion closure
836
- // (`lib/import-graph.ts`) BACKWARD into `leads-inbox.ts` itself and
837
- // then into every one of `apps/api/src/{server,cli,index,
838
- // vercel-handler}.ts` — all of which reach it through
839
- // `routes/leads/list.ts` — dropping them from a keyless scaffold
840
- // (`__tests__/paid-module-exclusions.test.ts`'s `MUST_SHIP` guard,
841
- // #5678's cascade shape recurring a third time).
842
- //
843
- // #6216 — now reached: `routes/workspaces/messages.ts` (below)
844
- // consumes `getMessage` alongside the two functions above. That route
845
- // registers under `isModuleEnabled("workspace") ||
846
- // isModuleEnabled("multi-tenant")` — the SAME gate
847
- // `workspaces/general.ts`/`members.ts` register under, NOT the
848
- // multi-tenant-only family `workspaces/meetings.ts`/`config.ts` sit
849
- // in — so this file and `routes/workspaces/messages.ts` are now
850
- // CO-OWNED with `workspace` too (see that slice's entry below), the
851
- // asset-store precedent: a file behind an OR gate must be
852
- // deliverable by BOTH bundles.
853
- "apps/api/src/services/inbox-messages.ts",
854
- "apps/api/src/routes/workspaces/messages.ts",
855
- // #7535 — the Inbox submissions and subscribers reads: the same
856
- // workspace||multi-tenant gate and the same tenant-db.ts import as
857
- // the two lines above, so co-owned with `workspace` for the same
858
- // reason (see that slice's entry below).
859
- "apps/api/src/routes/workspaces/submissions.ts",
860
- "apps/api/src/routes/workspaces/subscribers.ts",
861
- "apps/api/src/services/inbox-submissions.ts",
862
- // #9170 — the Inbox orders read: the same gate and the same
863
- // tenant-db.ts import, co-owned with `workspace` for the same reason.
864
- "apps/api/src/routes/workspaces/orders.ts",
865
- "apps/api/src/services/inbox-orders.ts",
866
- // #9254 DD5 — the Inbox callbacks read: the same gate and the same
867
- // tenant-db.ts import, co-owned with `workspace` for the same reason.
868
- "apps/api/src/routes/workspaces/callbacks.ts",
869
- // #9287 DD2 — Start, Get and Extend trial: the same gate and the same
870
- // tenant-db.ts import, co-owned with `workspace` for the same reason.
871
- "apps/api/src/routes/workspaces/trial.ts",
872
- "apps/api/src/services/trial.ts",
873
- // #852 D8 — the People reads: the same workspace||multi-tenant gate and
874
- // the same tenant-db.ts import, co-owned with `workspace` for the same
875
- // reason.
876
- "apps/api/src/routes/workspaces/people.ts",
877
- // #7877 D9, D11 — the member area: the operator's routes and the member
878
- // reads register under the same workspace||multi-tenant gate, so each
879
- // file behind it — the routes, the member resolution and the member
880
- // data boundary — is co-owned with `workspace`, as people.ts is.
881
- ...MEMBER_AREA_FILES,
882
- // #7399 — the two siblings #6216 left `workspace`-only. They register
883
- // under that same `workspace || multi-tenant` gate, so a scaffold with
884
- // `multi-tenant` and without `workspace` loaded them with no file behind
885
- // the specifier and 500'd every request at server construction. Co-owned
886
- // with `workspace` (see that slice's entry below); both import only
887
- // `lib/tenant-db.ts` (owned here) and base files.
888
- // `__tests__/tenancy-slice-resolution.test.ts` holds the whole gate set.
889
- "apps/api/src/routes/workspaces/general.ts",
890
- "apps/api/src/routes/workspaces/members.ts",
891
- // #3591 PR-B — the agent seat's routes, a sibling of `members.ts` under
892
- // the same `workspace || multi-tenant` gate, so co-owned with
893
- // `workspace` for the #7399 reason above.
894
- "apps/api/src/routes/workspaces/agents.ts",
895
- // #3591 PR-E — the signed-in workspace MCP tools that twin the agent
896
- // context, message and submission routes above. Each registers when
897
- // its twin route does (`workspace || multi-tenant`), so co-owned with
898
- // `workspace` for the same reason; the application tools' file is
899
- // co-owned with `signal-collectors` instead, its routes' gate.
900
- "apps/mcp/src/tools/agent_context.ts",
901
- "apps/mcp/src/tools/inbox_messages.ts",
902
- "apps/mcp/src/tools/inbox_submissions.ts",
903
- "apps/mcp/src/tools/inbox_applications.ts",
904
- "apps/api/src/lib/tenant-db.ts",
905
- "apps/api/src/lib/ws-token.ts",
906
- // #6157 D16 — the magnet Admin authoring surface, co-owned with
907
- // `signal-collectors` below for the SAME reason #5677 co-owns the
908
- // review surface under both: its scope is registered under the
909
- // widened `multi-tenant || signal-collectors` gate.
910
- "apps/api/src/routes/magnets/index.ts",
911
722
  "apps/web/app/[locale]/(authed)/waitlist/page.tsx",
912
723
  "apps/web/app/[locale]/(authed)/waitlist/[experimentId]/page.tsx",
913
724
  "apps/web/app/[locale]/(authed)/waitlist/[experimentId]/signups/[leadId]/page.tsx",
@@ -918,25 +729,13 @@ export const MODULE_SLICES = {
918
729
  "apps/web/app/[locale]/(authed)/waitlist/components/SignupsTable.tsx",
919
730
  "apps/web/app/[locale]/(authed)/waitlist/components/WaitlistComparisonTabs.tsx",
920
731
  "apps/web/app/[locale]/(authed)/waitlist/components/status-badges.tsx",
921
- // #7389 — the three api suites that enable `multi-tenant` ALONE and so
922
- // reach files this slice delivers (`services/tenant-context.ts` and the
923
- // `routes/workspaces/` index). Each is listed individually, never as a
924
- // glob (the `scheduling` slice's § D12 property 1: a glob entry is a
925
- // silent no-op), so it ships to a keyed scaffold with the slice and is
926
- // stripped from a keyless one with it — instead of a keyless scaffold
927
- // carrying a test that raises `createNoMappedModuleFoundError`. A suite
928
- // that enables SEVERAL paid modules cannot be owned by any one of
929
- // them; those are `EXCLUDE_TEMPLATE_DIRS` entries below.
930
- "apps/api/src/services/__tests__/lead-promotion.test.ts",
931
- "apps/api/src/services/__tests__/leads-inbox.test.ts",
932
- "apps/api/src/__tests__/content-write-production-boot.test.ts",
933
732
  "apps-paid/admin/**",
934
733
  ],
935
734
  // The whole-app glob above lands its files at their REPO-relative path
936
735
  // unless something re-roots them (`installBundleTree`'s `copyTree`
937
736
  // excludes only `installMap` KEYS from its verbatim copy), so without a
938
737
  // rename rule a keyed install left a stray source-tree-relative
939
- // directory in the scaffold instead of the working `apps/admin` app
738
+ // directory in the scaffold instead of the working `apps/admin` shell
940
739
  // this slice's own `apps.admin.path` (and `paid-paths.ts`'s
941
740
  // `introducedAppPaths()`) already declares (#5626 D3/D4). The fix lives
942
741
  // here, on the module, so `--modules multi-tenant` alone is fixed too —
@@ -953,6 +752,26 @@ export const MODULE_SLICES = {
953
752
  // fixture calls the same derivation so it cannot drift from the
954
753
  // producer's. See `installRoot`'s own doc on `ModuleSlice` above.
955
754
  installRoot: "apps/admin/",
755
+ // #9460 DD5/DD6 — the signed-in workspace MCP tools (#3591 PR-E) ride
756
+ // `@working-theory/mcp-workspace`, delivered as a dependency of the
757
+ // buyer's apps/mcp and reached through the generated registry; the
758
+ // merge-keys op is the same shape every other paid package uses.
759
+ paidMcpToolPackages: ["@working-theory/mcp-workspace"],
760
+ patches: [
761
+ {
762
+ target: "apps/mcp/package.json",
763
+ kind: "json",
764
+ ops: [
765
+ {
766
+ op: "merge-keys",
767
+ path: ["dependencies"],
768
+ entries: {
769
+ "@working-theory/mcp-workspace": "workspace:*",
770
+ },
771
+ },
772
+ ],
773
+ },
774
+ ],
956
775
  },
957
776
  // ── workspace — Pro module: the single-workspace settings shell (D-27/D-49)
958
777
  //
@@ -1013,47 +832,6 @@ export const MODULE_SLICES = {
1013
832
  "apps/web/app/[locale]/(authed)/admin/page.tsx",
1014
833
  "apps/web/app/[locale]/(authed)/admin/site/page.tsx",
1015
834
  "apps/web/app/[locale]/(authed)/admin/team/page.tsx",
1016
- // Co-owned with `multi-tenant` (#7399) — see that slice's entry: both
1017
- // register under the workspace||multi-tenant gate.
1018
- "apps/api/src/routes/workspaces/general.ts",
1019
- "apps/api/src/routes/workspaces/members.ts",
1020
- // Co-owned with `multi-tenant` (#3591 PR-B), for the reason the two
1021
- // lines above carry.
1022
- "apps/api/src/routes/workspaces/agents.ts",
1023
- // Co-owned with `multi-tenant` (#3591 PR-E): the signed-in MCP tools
1024
- // that twin the agent context, message and submission routes register
1025
- // under the same `workspace || multi-tenant` disjunction as those
1026
- // routes.
1027
- "apps/mcp/src/tools/agent_context.ts",
1028
- "apps/mcp/src/tools/inbox_messages.ts",
1029
- "apps/mcp/src/tools/inbox_submissions.ts",
1030
- // Co-owned with `multi-tenant` (#6216) — see that slice's entry: the
1031
- // route registers under the SAME workspace||multi-tenant gate as the
1032
- // two lines above, and its service function imports `lib/tenant-db.ts`
1033
- // (a multi-tenant-owned file), so both must be deliverable by either
1034
- // bundle alone.
1035
- "apps/api/src/routes/workspaces/messages.ts",
1036
- "apps/api/src/services/inbox-messages.ts",
1037
- // Co-owned with `multi-tenant` (#7535), for the reason the two
1038
- // message lines above carry.
1039
- "apps/api/src/routes/workspaces/submissions.ts",
1040
- "apps/api/src/routes/workspaces/subscribers.ts",
1041
- "apps/api/src/services/inbox-submissions.ts",
1042
- // Co-owned with `multi-tenant` (#9170), as the reads above.
1043
- "apps/api/src/routes/workspaces/orders.ts",
1044
- "apps/api/src/services/inbox-orders.ts",
1045
- // Co-owned with `multi-tenant` (#9254 DD5), as the reads above.
1046
- "apps/api/src/routes/workspaces/callbacks.ts",
1047
- // Co-owned with `multi-tenant` (#9287 DD2), as the reads above.
1048
- "apps/api/src/routes/workspaces/trial.ts",
1049
- "apps/api/src/services/trial.ts",
1050
- // Co-owned with `multi-tenant` (#852 D8), as the reads above.
1051
- "apps/api/src/routes/workspaces/people.ts",
1052
- // Co-owned with `multi-tenant` (#7877 D9, D11) — see that slice's entry.
1053
- ...MEMBER_AREA_FILES,
1054
- // Co-owned with `multi-tenant` (#5853) — see that slice's entry.
1055
- "apps/api/src/routes/workspaces/content.ts",
1056
- ...ASSET_STORE_FILES,
1057
835
  ],
1058
836
  // patches — the dependency add that delivers the shared package to the
1059
837
  // buyer's apps/web, mirroring docs-blog's own fumadocs-schema merge-keys
@@ -1075,7 +853,23 @@ export const MODULE_SLICES = {
1075
853
  },
1076
854
  ],
1077
855
  },
856
+ // #9460 DD5/DD6 — the signed-in workspace MCP tools (#3591 PR-E),
857
+ // co-owned with `multi-tenant`, ride `@working-theory/mcp-workspace`.
858
+ {
859
+ target: "apps/mcp/package.json",
860
+ kind: "json",
861
+ ops: [
862
+ {
863
+ op: "merge-keys",
864
+ path: ["dependencies"],
865
+ entries: {
866
+ "@working-theory/mcp-workspace": "workspace:*",
867
+ },
868
+ },
869
+ ],
870
+ },
1078
871
  ],
872
+ paidMcpToolPackages: ["@working-theory/mcp-workspace"],
1079
873
  },
1080
874
  // ── scheduling — full-stack module (provider + routes + booker pages) ────
1081
875
  //
@@ -1183,7 +977,7 @@ export const MODULE_SLICES = {
1183
977
  // server.ts's module-conditional registration (isModuleEnabled('scheduling')),
1184
978
  // and a repo-wide grep of every importer of each candidate file.
1185
979
  //
1186
- // apps/api/src/services/scheduling/index.ts, cal-provider.ts, types.ts —
980
+ // services/scheduling/index.ts, cal-provider.ts, types.ts (now api-scheduling's) —
1187
981
  // the whole directory; grepped `services/scheduling` repo-wide and the
1188
982
  // ONLY importer outside its own __tests__/ is routes/schedule/index.ts,
1189
983
  // so no sibling error-type file exists elsewhere to add.
@@ -1246,19 +1040,6 @@ export const MODULE_SLICES = {
1246
1040
  // deliberately NOT listed here: they ship, and listing one would take the
1247
1041
  // whole dispatch table with it.
1248
1042
  ownedFiles: [
1249
- "apps/api/src/routes/schedule/index.ts",
1250
- "apps/api/src/services/scheduling/index.ts",
1251
- "apps/api/src/services/scheduling/cal-provider.ts",
1252
- "apps/api/src/services/scheduling/types.ts",
1253
- // #6182 (S9a) — the Cal adapter's own suite. Individually, never as a
1254
- // glob (§ D12 above, property 1: a glob entry is a silent no-op, so
1255
- // `__tests__/**` would ship no test at all to a keyed scaffold).
1256
- "apps/api/src/services/scheduling/__tests__/cal-provider.test.ts",
1257
- "apps/mcp/src/tools/list_availability.ts",
1258
- "apps/mcp/src/tools/get_event_meta.ts",
1259
- // #8843 D5 — the twin of GET /v1/schedule/meetings.
1260
- "apps/mcp/src/tools/list_meetings.ts",
1261
- "apps/mcp/src/tools/create_booking.ts",
1262
1043
  "apps/web/app/[locale]/meet/page.tsx",
1263
1044
  "apps/web/app/[locale]/meet/[slug]/page.tsx",
1264
1045
  "apps/web/app/[locale]/meet/confirmed/page.tsx",
@@ -1272,23 +1053,6 @@ export const MODULE_SLICES = {
1272
1053
  "apps/web/app/[locale]/private/page.tsx",
1273
1054
  "apps/web/app/[locale]/private/__tests__/page.test.tsx",
1274
1055
  "apps/web/app/[locale]/private/__tests__/sitemap.test.ts",
1275
- // #6085 (brief H7) — the six files the webhook receiver + the
1276
- // tenant-guarded appointments read add. Individually, never as a
1277
- // glob (§ D12 / this card's own comment above, property 1: a glob
1278
- // entry is a silent no-op, so __tests__/** would ship no test at all
1279
- // to a keyed scaffold). `apps/api/src/routes/webhooks/index.ts` is
1280
- // NOT added — it is the mixed barrel that also registers the Stripe
1281
- // receiver, the same "mixed barrel is never listed" precedent this
1282
- // slice already records for `routes/project-listings/index.ts`.
1283
- // `apps/api/src/routes/schedule/index.ts` is already listed above and
1284
- // stays (it re-exports `listAppointmentsRoute` alongside the three
1285
- // anonymous routes it already re-exports).
1286
- "apps/api/src/routes/webhooks/calcom.ts",
1287
- "apps/api/src/routes/webhooks/__tests__/calcom.test.ts",
1288
- "apps/api/src/services/scheduling/appointments.ts",
1289
- "apps/api/src/services/scheduling/__tests__/appointments.test.ts",
1290
- "apps/api/src/routes/schedule/appointments.ts",
1291
- "apps/api/src/routes/schedule/__tests__/appointments.test.ts",
1292
1056
  // #6086 (brief H7) — the SITE's appointments page, the visible half of
1293
1057
  // the read above. The co-located suite is listed EXPLICITLY alongside
1294
1058
  // its page: `EXCLUDE_TEMPLATE_DIRS` below drops only the three
@@ -1299,80 +1063,6 @@ export const MODULE_SLICES = {
1299
1063
  // test for a page it does not have.
1300
1064
  "apps/web/app/[locale]/(authed)/appointments/page.tsx",
1301
1065
  "apps/web/app/[locale]/(authed)/appointments/__tests__/page.test.tsx",
1302
- // #6183 S9b — the enabled-meeting-slugs gate. `meetings.ts` is its own
1303
- // file (not folded into `routes/workspaces/config.ts`, which is
1304
- // `workspace`/`multi-tenant`-owned) precisely because its GET reaches
1305
- // `services/scheduling/` — the SAME reason `routes/schedule/
1306
- // appointments.ts` above is its own file rather than a row on an
1307
- // existing route. `lib/public-meetings-config.ts` is the public-read
1308
- // boundary `routes/schedule/meeting-types.ts` (the anonymous read,
1309
- // already reached via the already-listed `routes/schedule/index.ts`)
1310
- // calls into.
1311
- "apps/api/src/routes/workspaces/meetings.ts",
1312
- "apps/api/src/routes/workspaces/__tests__/meetings.test.ts",
1313
- "apps/api/src/lib/public-meetings-config.ts",
1314
- "apps/api/src/routes/schedule/meeting-types.ts",
1315
- "apps/api/src/routes/schedule/__tests__/meeting-types.test.ts",
1316
- // #8843 D1 — the meetings read's own suite; the route is in
1317
- // `routes/schedule/index.ts`, listed above.
1318
- "apps/api/src/routes/schedule/__tests__/meetings.test.ts",
1319
- // #7532 — a hub spoke's meeting types and booking, through the real
1320
- // scheduling routes; it ships and strips with them.
1321
- "apps/api/src/routes/schedule/__tests__/spoke.test.ts",
1322
- // meetings.ts is the FIRST scheduling-gated route to use the generic
1323
- // tenantDb() scope layer directly (its sibling, appointments.ts, does
1324
- // its own scoped read in services/scheduling/appointments.ts instead)
1325
- // — and `workspaceMeetings` is now in architecture.yaml's tenant-scope
1326
- // forbidden_pattern (#6183), so meetings.ts cannot bypass tenantDb()
1327
- // with a raw prisma call. Co-owned with `multi-tenant` below (the
1328
- // SAME two files, same reason `content.ts`'s own comment there
1329
- // records: "each tenancy slice must deliver it").
1330
- "apps/api/src/lib/tenant-db.ts",
1331
- "apps/api/src/services/tenant-context.ts",
1332
- // #7389 — `routes/workspaces/__tests__/meetings.test.ts` and
1333
- // `meetings-connection.test.ts` (listed below) register the real
1334
- // `tenantPreHandlerPlugin` in front of `meetings.ts`, so a scheduling
1335
- // scaffold without `multi-tenant` could not load them. It imports only
1336
- // `services/tenant-context.ts` (owned above) and the base
1337
- // `default-tenant.ts`, so co-owning it keeps the closure tight.
1338
- "apps/api/src/middleware/tenant.ts",
1339
- // #7533 — a scheduling connection per workspace. `connections.ts` (the
1340
- // cipher + the one SchedulingConnection data-access boundary) and
1341
- // `resolve.ts` (the workspace-aware provider resolution the meetings,
1342
- // schedule and webhook routes above now call), plus each new suite,
1343
- // individually (§ D12, property 1: a glob ships no test). The config
1344
- // suite is listed here although `config/index.ts` itself stays base:
1345
- // it tests a scheduling-only variable, so a keyless scaffold carries
1346
- // neither the variable's purpose nor its test.
1347
- "apps/api/src/services/scheduling/connections.ts",
1348
- "apps/api/src/services/scheduling/resolve.ts",
1349
- "apps/api/src/services/scheduling/__tests__/connections.test.ts",
1350
- "apps/api/src/services/scheduling/__tests__/provider-resolution.test.ts",
1351
- // #9129 — the meetings-list assembly the meetings route and the member
1352
- // meeting types share, plus its suite.
1353
- "apps/api/src/services/scheduling/meetings.ts",
1354
- "apps/api/src/services/scheduling/__tests__/meetings.test.ts",
1355
- "apps/api/src/routes/workspaces/__tests__/meetings-connection.test.ts",
1356
- "apps/api/src/routes/schedule/__tests__/public-connection.test.ts",
1357
- "apps/api/src/routes/webhooks/__tests__/calcom-connection.test.ts",
1358
- "apps/api/src/config/__tests__/scheduling-credential-key.test.ts",
1359
- // #8169 D9 — the two member reads that reach `services/scheduling/`,
1360
- // registered under `scheduling && (workspace || multi-tenant)`, plus
1361
- // the three member files they import, which this slice then CO-OWNS
1362
- // with the two tenancy slices (`MEMBER_AREA_FILES`) — exactly as it
1363
- // co-owns `lib/tenant-db.ts` for `routes/workspaces/meetings.ts` above.
1364
- "apps/api/src/routes/member/meeting-types.ts",
1365
- "apps/api/src/routes/member/availability.ts",
1366
- // #8170 D11 — the member booking, the same shape.
1367
- "apps/api/src/routes/member/bookings.ts",
1368
- "apps/api/src/routes/member/pieces.ts",
1369
- "apps/api/src/services/member-area.ts",
1370
- "apps/api/src/lib/member-store.ts",
1371
- // #7389 — the two api suites that enable `scheduling` alone, so they
1372
- // strip with `routes/schedule/index.ts`, which they load by a computed
1373
- // specifier the import-graph closure cannot follow.
1374
- "apps/api/src/__tests__/schedule-forwarded-rate-limit.test.ts",
1375
- "apps/api/src/__tests__/openapi-keyless-hub.test.ts",
1376
1066
  ],
1377
1067
  // pageContributions (spec 5478; parent § D6 shape 1) — the meeting
1378
1068
  // index, the meeting page, the confirmation page and the private index
@@ -1406,7 +1096,23 @@ export const MODULE_SLICES = {
1406
1096
  },
1407
1097
  ],
1408
1098
  },
1099
+ // #9460 DD5/DD6 — the four scheduling MCP tools (#4416, #4633, #8843
1100
+ // D5) ride `@working-theory/mcp-scheduling`.
1101
+ {
1102
+ target: "apps/mcp/package.json",
1103
+ kind: "json",
1104
+ ops: [
1105
+ {
1106
+ op: "merge-keys",
1107
+ path: ["dependencies"],
1108
+ entries: {
1109
+ "@working-theory/mcp-scheduling": "workspace:*",
1110
+ },
1111
+ },
1112
+ ],
1113
+ },
1409
1114
  ],
1115
+ paidMcpToolPackages: ["@working-theory/mcp-scheduling"],
1410
1116
  },
1411
1117
  // ── signal-collectors — flows, deliverables, project listings, waitlist
1412
1118
  // signups (D-48, #5366) ───────────────────────────────────────────────
@@ -1416,14 +1122,14 @@ export const MODULE_SLICES = {
1416
1122
  // and a repo-wide grep of every importer of each candidate file (an
1417
1123
  // independent re-grep, not carried over from the spec's own table).
1418
1124
  //
1419
- // apps/api/src/routes/project-listings/index.ts is MIXED (D4): it holds
1125
+ // routes/project-listings/index.ts (now api-signal-collectors') is MIXED (D4): it holds
1420
1126
  // this module's five anonymous/founder-read re-exports (lines 1-55) AND
1421
1127
  // multi-tenant's TENANT_HANDLERS table + projectListingTenantRoutes
1422
1128
  // (lines 57-139) in one file. NOT listed here — never deleted/edited on
1423
1129
  // its own, exactly like the scheduling/multi-tenant precedent for a mixed
1424
1130
  // barrel above.
1425
1131
  //
1426
- // apps/api/src/routes/project-listings/respond.ts (`sendValidated`) IS
1132
+ // routes/project-listings/respond.ts (`sendValidated`, now api-signal-collectors') IS
1427
1133
  // listed, even though it is ALSO imported directly by the tenant routes
1428
1134
  // get.ts/list.ts/patch.ts/patch-copy.ts (multi-tenant, Pro Plus territory
1429
1135
  // — grep-verified, four direct importers outside this module). Same D6
@@ -1470,13 +1176,13 @@ export const MODULE_SLICES = {
1470
1176
  // selection, exactly as it did before this card (a narrower, temporary
1471
1177
  // miss than the one D6 accepts on purpose for the other nine).
1472
1178
  //
1473
- // apps/api/src/services/listing-promotion.ts has ZERO production
1179
+ // services/listing-promotion.ts (now api-signal-collectors') has ZERO production
1474
1180
  // importers anywhere in the repo (only its own test) — confirmed dead code
1475
1181
  // (spec §7 Q5). Listed anyway: it is listing code by subject, D-48 places
1476
1182
  // the instrument here, and a reachability grep cannot place an unreached
1477
1183
  // file — this is a recorded pre-existing defect, not fixed by this card.
1478
1184
  //
1479
- // apps/api/src/bin/deliverable-upload.ts imports only `prisma` (no moved
1185
+ // bin/deliverable-upload.ts (now api-signal-collectors') imports only `prisma` (no moved
1480
1186
  // service) but is a deliverables CLI a Free starter should not ship —
1481
1187
  // listed by subject, not by the import-criterion the other six bins meet.
1482
1188
  //
@@ -1522,7 +1228,7 @@ export const MODULE_SLICES = {
1522
1228
  // ownedFiles under apps/api/** dropped (removed root)
1523
1229
  // ownedFiles under (authed)/waitlist/** dropped (removal seed)
1524
1230
  // ownedFiles projects/apply/ListingApplicationClient lands; no route mounts it
1525
- // ownedFiles under apps/mcp/src/tools/** lands when apps/mcp is kept
1231
+ // paidMcpToolPackages (apps/mcp/package.json) lands when apps/mcp is kept
1526
1232
  // installMap content/en/** (12 seeds) lands, but for the five report seeds
1527
1233
  // installMap database/flows/{referral,fit-check}.flow.json
1528
1234
  // remapped to flows/<name>.json — declared
@@ -1535,148 +1241,14 @@ export const MODULE_SLICES = {
1535
1241
  // It stays a Pro module: a keyless spoke carries no flows.
1536
1242
  spoke: true,
1537
1243
  paidSectionsPackage: "@working-theory/ui-signal-collectors",
1244
+ // #9460 DD5/DD6 — the flow tools ride `@working-theory/mcp-signal-collectors`;
1245
+ // the listing-application tools (#3591 PR-E, co-owned with multi-tenant)
1246
+ // ride `@working-theory/mcp-workspace`, whose one file holds them.
1247
+ paidMcpToolPackages: [
1248
+ "@working-theory/mcp-signal-collectors",
1249
+ "@working-theory/mcp-workspace",
1250
+ ],
1538
1251
  ownedFiles: [
1539
- "apps/api/src/routes/flows/index.ts",
1540
- // README.md documents the flows rate-limit rationale (#4730) — not a
1541
- // test/generated file, and its absence is exactly what left a stray
1542
- // apps/api/src/routes/flows/ directory in a keyless templates/ snapshot
1543
- // (empirically found, #5366) since the import-graph closure below only
1544
- // scans source extensions, never markdown.
1545
- "apps/api/src/routes/flows/README.md",
1546
- "apps/api/src/routes/deliverables/index.ts",
1547
- "apps/api/src/routes/slack/index.ts",
1548
- "apps/api/src/routes/slack/actions.ts",
1549
- "apps/api/src/routes/waitlist-signups/index.ts",
1550
- // #7479 — the listing-draft forwarded-visitor suite exercises the three
1551
- // project-listings draft routes through the real build(), and those
1552
- // routes register only under isModuleEnabled("signal-collectors"), so
1553
- // the suite strips with this slice (the #7389 shape for
1554
- // schedule-forwarded-rate-limit.test.ts under scheduling) instead of
1555
- // failing every keyless scaffold's apps/api jest gate.
1556
- "apps/api/src/__tests__/listings-forwarded-rate-limit.test.ts",
1557
- // apps/api/src/routes/project-listings/{start,patch-draft,submit,public,
1558
- // me,respond,resume-token}.ts and services/{project-listings,
1559
- // listing-config}.ts deliberately NOT listed — see the comment above
1560
- // this array (D-48/#5366 escalation: the mixed-barrel `index.ts` in
1561
- // that directory is reached from server.ts by a plain, literal
1562
- // `import()` for multi-tenant's tenant routes, and statically imports
1563
- // all nine of these files itself, so `paidModuleTemplateExclusions()`'s
1564
- // import-graph closure excluded `index.ts`, then `server.ts` itself,
1565
- // from every keyless scaffold (empirically found, #5366 resume pass,
1566
- // same failure mode as the deliverable-fulfillment.ts case below but a
1567
- // permanent structural one rather than a temporal gap pending another
1568
- // PR). This is also the ORIGINAL multi-tenant/#5088 card's own
1569
- // conclusion about these same nine files (lines 556-571 above) —
1570
- // D-48 moves their tier ownership to signal-collectors but not their
1571
- // must-ship-unconditionally constraint. Registration of every route
1572
- // that reaches them stays gated by `isModuleEnabled("signal-collectors")`
1573
- // in server.ts; only the source files themselves ship regardless.
1574
- "apps/api/src/services/flow-engine.ts",
1575
- "apps/api/src/services/flow-aggregate.ts",
1576
- "apps/api/src/services/waitlist-signups.ts",
1577
- "apps/api/src/services/waitlist-scoring.ts",
1578
- "apps/api/src/services/playbook-compile.ts",
1579
- "apps/api/src/services/playbook-render.ts",
1580
- "apps/api/src/services/listing-csv-sweep.ts",
1581
- "apps/api/src/services/waitlist-followup.ts",
1582
- "apps/api/src/services/listing-promotion.ts",
1583
- "apps/api/src/services/project-listing-decision.ts",
1584
- "apps/api/src/services/project-listing-flow.ts",
1585
- "apps/api/src/services/project-listing-issue.ts",
1586
- "apps/api/src/services/waitlist-experiments.ts",
1587
- // deliverable-fulfillment.ts deliberately NOT listed — see the comment
1588
- // above this array (spec §5.4 escalation boundary, temporary pending #5364).
1589
- "apps/api/src/bin/deliverable-resend.ts",
1590
- "apps/api/src/bin/deliverable-upload.ts",
1591
- "apps/api/src/bin/session-retention-sweep.ts",
1592
- "apps/api/src/bin/seed-presets.ts",
1593
- // #7844 D7 — the operator flow-copy CLI and its service: flows code by
1594
- // subject, and a Free scaffold carries no flows.
1595
- "apps/api/src/bin/flows-copy.ts",
1596
- "apps/api/src/services/flow-copy.ts",
1597
- "apps/api/src/bin/listing-csv-sweep.ts",
1598
- "apps/api/src/bin/followup-sweep.ts",
1599
- "apps/api/src/bin/seed-waitlist-experiments.ts",
1600
- // #7389 — the listing-directory suite enables `signal-collectors` alone
1601
- // and loads `routes/waitlist-signups/index.ts` through the server it
1602
- // builds, so it strips with that route. Individually, never as a glob.
1603
- "apps/api/src/routes/project-listings/__tests__/directory.test.ts",
1604
- "apps/mcp/src/tools/get_flow.ts",
1605
- "apps/mcp/src/tools/submit_flow_step.ts",
1606
- // #3591 PR-E — the signed-in MCP tools that twin the tenant-scoped
1607
- // project-listing routes, CO-OWNED with multi-tenant: they register
1608
- // under the routes' own `multi-tenant || signal-collectors` gate.
1609
- "apps/mcp/src/tools/inbox_applications.ts",
1610
- // ── The review surface (#5677) — CO-OWNED with multi-tenant ──────────
1611
- //
1612
- // Every path below is ALSO a multi-tenant `ownedFiles` entry and stays
1613
- // one. Listing a file under two modules is additive, not a transfer:
1614
- // `paidModuleTemplateExclusions()` unions every paid module's entries,
1615
- // so the `templates/` snapshot is unchanged, and a multi-tenant scaffold
1616
- // keeps receiving these from the multi-tenant bundle exactly as before.
1617
- // What changes is that a signal-collectors bundle now carries them too.
1618
- //
1619
- // WHY THEY MUST BE HERE. #5677 widened `server.ts`'s review-surface
1620
- // registration from `multi-tenant` to `multi-tenant || signal-collectors`,
1621
- // because signal-collectors is the module that SELLS the instruments
1622
- // these routes read back. Registration and DELIVERY are separate layers:
1623
- // the widened gate calls `sliceRoutePlugin("waitlistExperimentRoutes")`
1624
- // and imports `projectListingTenantRoutes`, so on a scaffold whose
1625
- // `AILK_ENABLED_MODULES` names signal-collectors but whose tree lacks
1626
- // these files, `loadSlice` throws ERR_MODULE_NOT_FOUND during `build()`
1627
- // — construction, so EVERY route 500s rather than one. That is not a
1628
- // feature gap; it is the outage shape `lib/slice-load.ts` exists to
1629
- // diagnose.
1630
- //
1631
- // It is not hypothetical: `marketing-site` — the Pro flagship in
1632
- // `template-manifest.ts` — declares
1633
- // `requires: ["marketing", "docs-blog", "scheduling", "signal-collectors"]`,
1634
- // i.e. signal-collectors WITHOUT multi-tenant. That is exactly the
1635
- // configuration that would crash, which is why the gate and the delivery
1636
- // land together rather than the delivery being deferred.
1637
- //
1638
- // The closure is tight, verified by grep rather than assumed: none of
1639
- // these files imports `lib/tenant-db.ts` or `services/tenant-context.ts`
1640
- // (both multi-tenant-only). #5677 retargeted `waitlist-dashboard.ts`'s
1641
- // type import of `tenant-context.js` to the base `services/default-tenant.ts`,
1642
- // which severed the one cross-slice edge that existed.
1643
- //
1644
- // `routes/project-listings/{start,patch-draft,submit,public,me,respond,
1645
- // resume-token,patch-copy}.ts` are NOT listed — they are the free
1646
- // anonymous surface and the mixed barrel, covered by the note above this
1647
- // array, and they already ship unconditionally.
1648
- "apps/api/src/routes/waitlist-experiments/index.ts",
1649
- "apps/api/src/routes/waitlist-experiments/list.ts",
1650
- "apps/api/src/routes/waitlist-experiments/comparison.ts",
1651
- "apps/api/src/routes/waitlist-experiments/signup.ts",
1652
- "apps/api/src/routes/waitlist-experiments/signups.ts",
1653
- "apps/api/src/routes/waitlist-experiments/respond.ts",
1654
- "apps/api/src/services/waitlist-dashboard.ts",
1655
- // #6258 — the file waitlist-dashboard.ts imports for the pinned
1656
- // platform-operator read scope. It rides BOTH slices for the same
1657
- // reason its importer does: an unlisted import target breaks a
1658
- // signal-collectors-without-multi-tenant scaffold at build() time.
1659
- "apps/api/src/services/waitlist-operator-reads.ts",
1660
- // #6157 D14/D16 — the magnet Admin authoring surface's own sibling
1661
- // tenant scope is gated `multi-tenant || signal-collectors` (D4,
1662
- // the SAME expression this review-surface block co-owns files
1663
- // under), so both its route file AND `lib/tenant-db.ts` (the ONE
1664
- // data path it reads/writes through, FR3) must be delivered here
1665
- // too. `lib/tenant-db.ts` is ALSO listed under `multi-tenant` above
1666
- // — additive, not a transfer (the same reasoning this array's own
1667
- // header comment already states for every other file in it).
1668
- //
1669
- // The closure stays tight WITHOUT dragging in `tenant-context.ts` or
1670
- // the multi-tenant guard assembly behind it, because `tenant-db.ts`'s
1671
- // own type import was retargeted from `tenant-context.js` to the
1672
- // BASE-tree `services/default-tenant.js` in this same unit (D15) —
1673
- // the identical one-line class of move #5677 made for
1674
- // `waitlist-dashboard.ts` two paragraphs above this one.
1675
- "apps/api/src/routes/magnets/index.ts",
1676
- "apps/api/src/lib/tenant-db.ts",
1677
- "apps/api/src/routes/project-listings/get.ts",
1678
- "apps/api/src/routes/project-listings/list.ts",
1679
- "apps/api/src/routes/project-listings/patch.ts",
1680
1252
  // The dashboard itself. Without these the Pro scaffold would boot with
1681
1253
  // reachable review routes and no UI to read them through, and the two
1682
1254
  // files that DO already ship into every scaffold
@@ -1876,14 +1448,30 @@ export const MODULE_SLICES = {
1876
1448
  },
1877
1449
  ],
1878
1450
  },
1451
+ // #9460 DD6 — the two MCP packs above, as apps/mcp dependencies.
1452
+ {
1453
+ target: "apps/mcp/package.json",
1454
+ kind: "json",
1455
+ ops: [
1456
+ {
1457
+ op: "merge-keys",
1458
+ path: ["dependencies"],
1459
+ entries: {
1460
+ "@working-theory/mcp-signal-collectors": "workspace:*",
1461
+ "@working-theory/mcp-workspace": "workspace:*",
1462
+ },
1463
+ },
1464
+ ],
1465
+ },
1879
1466
  ],
1880
1467
  },
1881
1468
  // ── commerce — per-site paid add-on (D-47, amending D-26) ─────────────────
1882
1469
  //
1883
1470
  // Checkout, the Stripe webhook receiver, flow checkouts and the recommender
1884
1471
  // (D-47's disposition sentence, verbatim). The base API keeps only
1885
- // `isModuleEnabled("commerce")`; every registration loads through
1886
- // `SLICE_PLUGINS` (server.ts). `apps.api.may_import_from` names
1472
+ // `isModuleEnabled("commerce")`; every registration is a row of
1473
+ // `API_MODULE_TABLE` carried by the commerce module object (#9565).
1474
+ // `apps.api.may_import_from` names
1887
1475
  // `packages/stripe-client` — the module's own package (D5) — mirroring the
1888
1476
  // `multi-tenant`/`scheduling` slices' identical entry, which already
1889
1477
  // document "checkout moved to the commerce module (D-47)" for the same
@@ -1966,30 +1554,19 @@ export const MODULE_SLICES = {
1966
1554
  //
1967
1555
  // THE PRIMITIVES LEFT THIS SLICE (D-64, epic #5770, #5796). The checkout
1968
1556
  // launcher, the Stripe webhook receiver, customer mapping and the
1969
- // `lib/stripe.ts` shim are BASE TREE now: `apps/api/src/server.ts`
1557
+ // `lib/stripe.ts` shim are BASE TREE now: `packages/api/src/server.ts`
1970
1558
  // registers them unconditionally and gates them at CALL time on the JWT
1971
- // `commerce` claim (`apps/api/src/lib/require-commerce-claim.ts`), so a
1559
+ // `commerce` claim (`packages/api/src/lib/require-commerce-claim.ts`), so a
1972
1560
  // keyless scaffold must CARRY them. Claiming them here is what deleted
1973
1561
  // them from that scaffold while the server still loaded them —
1974
1562
  // ERR_MODULE_NOT_FOUND inside build(), every route 500ing, which is the
1975
- // exact defect `tools/lint-slice-registration.ts` (#5701) exists to
1976
- // catch. The six that left: lib/stripe.ts,
1563
+ // exact defect the slice-registration lint (#5701; retired by #9565 D8)
1564
+ // existed to catch. The six that left: lib/stripe.ts,
1977
1565
  // routes/checkout/{index,sessions}.ts, routes/webhooks/{index,stripe}.ts
1978
1566
  // and routes/webhooks/README.md. The four below STAY — they are commerce
1979
1567
  // OVERLAY, still registered behind `isModuleEnabled("commerce")` and
1980
1568
  // still carrying their `// oss: false` markers.
1981
1569
  ownedFiles: [
1982
- "apps/api/src/routes/flow-checkouts/index.ts",
1983
- "apps/api/src/routes/flows/recommender.ts",
1984
- "apps/api/src/services/recommender-capture.ts",
1985
- "apps/api/src/services/flow-checkouts.ts",
1986
- // #6038 — the buyer-scoped subscription-status route pair (the
1987
- // update-your-card banner's read + portal handoff). Commerce OVERLAY,
1988
- // same posture as the four flow-checkouts/recommender entries above.
1989
- "apps/api/src/routes/subscription/index.ts",
1990
- "apps/api/src/routes/subscription/me.ts",
1991
- "apps/api/src/routes/subscription/portal.ts",
1992
- "apps/api/src/services/subscription.ts",
1993
1570
  // #5581 U5 — the fifteen commerce components (+ ten .text.ts extractors
1994
1571
  // + the slice's own re-export entry point) moved to
1995
1572
  // packages-paid/ui-commerce; the package is delivered to a keyed
@@ -2222,12 +1799,6 @@ export function coOwnedModuleDestinations() {
2222
1799
  // The exclusion is per file, not a `testPathIgnorePatterns` entry in the
2223
1800
  // scaffold's jest config: that would hide these suites from a keyed
2224
1801
  // scaffold too, and from the suites a slice owns.
2225
- // - database/__tests__/build.test.ts (#7959) — the monorepo build probe
2226
- // (#7565). Its `beforeAll` symlinks `REPO_ROOT/packages` and copies
2227
- // `REPO_ROOT/tsconfig.base.json`, neither of which a scaffold has, so it
2228
- // red the scaffold's database jest run. Matched exactly, not by basename
2229
- // in `EXCLUDE_FILES`, which would drop a `build.test.ts` anywhere in the
2230
- // snapshot; every other database suite still ships.
2231
1802
  // - the /pricing suite `monorepo-only.test.tsx` and its snapshot (#9179) —
2232
1803
  // it snapshots the monorepo's own `content/en/Pricing/pricing.mdx`, which
2233
1804
  // a scaffold replaces with its seed, and reads
@@ -2246,28 +1817,24 @@ export const EXCLUDE_TEMPLATE_DIRS = [
2246
1817
  "apps/web/app/[locale]/__tests__",
2247
1818
  "apps/web/app/[locale]/(authed)/edit",
2248
1819
  "apps/web/content",
2249
- "apps/api/src/__tests__/api-parity.test.ts",
2250
- "apps/api/src/__tests__/api-parity-paid.test.ts",
2251
1820
  "apps/mcp/__tests__/api-parity.test.ts",
2252
1821
  "apps/mcp/__tests__/pro-tool-call-gate.test.ts",
2253
1822
  "apps/mcp/__tests__/write-tool-guard.test.ts",
2254
- "apps/api/src/services/__tests__/aeo-score.test.ts",
2255
- "apps/api/src/routes/leads/__tests__/index.test.ts",
2256
- "apps/api/src/routes/workspaces/__tests__/inbox-wire-schemas.test.ts",
2257
- "apps/api/src/__tests__/server.test.ts",
2258
- "apps/api/src/__tests__/cors.test.ts",
2259
- "apps/api/src/__tests__/root-modules.test.ts",
2260
- "apps/api/src/__tests__/module-exclusion.test.ts",
2261
- "apps/api/src/openapi/__tests__/surface-drift.test.ts",
2262
- "apps/api/src/__tests__/review-surface-registration.test.ts",
2263
- "apps/api/src/__tests__/workspace-module-registration.test.ts",
1823
+ "apps/mcp/__tests__/create-booking-guard.test.ts",
1824
+ // #9564 AC-1 — pins THIS monorepo's route table and imports the six module
1825
+ // objects; a scaffold has neither.
1826
+ "apps/api/src/__tests__/registration-table.test.ts",
1827
+ "apps/api/src/__tests__/fixtures",
1828
+ // #9571 — exercises the composition's `loadInstalledHub` by `jest.doMock`-ing
1829
+ // `@working-theory/api-hub/package.json`, a specifier a Free scaffold cannot
1830
+ // resolve (no `virtual` mock), and it depends on the monorepo
1831
+ // `apps/api/jest.config.cjs` mapper that `build-templates` drops; the
1832
+ // scaffold's own boot behaviour is covered by `verify-scaffold`'s boot leg.
1833
+ "apps/api/src/__tests__/hub-install.test.ts",
2264
1834
  "apps/mcp/__tests__/workspace-surface.test.ts",
2265
1835
  "apps/mcp/__tests__/parity.test.ts",
2266
- "apps/mcp/__tests__/audit.test.ts",
2267
- "database/__tests__/build.test.ts",
2268
1836
  "apps/web/app/[locale]/pricing/__tests__/monorepo-only.test.tsx",
2269
1837
  "apps/web/app/[locale]/pricing/__tests__/__snapshots__/monorepo-only.test.tsx.snap",
2270
- "apps/api/src/services/offerings/__tests__/delegate-confinement.test.ts",
2271
1838
  ];
2272
1839
  export function paidModuleTemplateExclusions(snapshotRoots, repoRoot) {
2273
1840
  const roots = new Set(snapshotRoots);
@@ -2283,8 +1850,8 @@ export function paidModuleTemplateExclusions(snapshotRoots, repoRoot) {
2283
1850
  }
2284
1851
  }
2285
1852
  // Companion closure by import graph, to a fixed point — the shared walker
2286
- // (`lib/import-graph.ts`), so `tools/lint-slice-registration.ts` asks the
2287
- // question with the same resolution this answer was computed with (#5701).
1853
+ // (`lib/import-graph.ts`), the resolution the retired slice-registration
1854
+ // lint (#5701, #9565 D8) asked its question with.
2288
1855
  return [...importClosure(repoRoot, [...roots], seeds)].sort();
2289
1856
  }
2290
1857
  /** The scaffold's architecture linter, relative to the site root (#6649). */