@rebasepro/cli 0.30.1 → 0.31.0-canary.g902a0ce

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 (283) hide show
  1. package/README.md +8 -7
  2. package/dist/{agent-setup-0uyfC7VX.js → agent-setup-DqAcoDcn.js} +10 -5
  3. package/dist/{agent-setup-0uyfC7VX.js.map → agent-setup-DqAcoDcn.js.map} +1 -1
  4. package/dist/{api-keys-Dfw5-9s1.js → api-keys-eIUjMqWn.js} +8 -7
  5. package/dist/api-keys-eIUjMqWn.js.map +1 -0
  6. package/dist/{apps-MKQbgDtN.js → apps-DExO4PEl.js} +8 -7
  7. package/dist/apps-DExO4PEl.js.map +1 -0
  8. package/dist/{project-CasK56vN.js → args-CaCcrYE1.js} +2 -351
  9. package/dist/args-CaCcrYE1.js.map +1 -0
  10. package/dist/{atlas-dev-database-BODqdCWt.js → atlas-dev-database-DOCKk6ht.js} +2 -2
  11. package/dist/{atlas-dev-database-BODqdCWt.js.map → atlas-dev-database-DOCKk6ht.js.map} +1 -1
  12. package/dist/{auth-Bv0rTbQX.js → auth-CyADghFQ.js} +7 -6
  13. package/dist/{auth-Bv0rTbQX.js.map → auth-CyADghFQ.js.map} +1 -1
  14. package/dist/backend-guard-C0mVkXBw.js +162 -0
  15. package/dist/backend-guard-C0mVkXBw.js.map +1 -0
  16. package/dist/{branch-pointer-BQUF6lYa.js → branch-pointer-DMPyvZoK.js} +1 -1
  17. package/dist/{build-BuKTnec8.js → build-CA5R07tw.js} +29 -9
  18. package/dist/build-CA5R07tw.js.map +1 -0
  19. package/dist/{bundle-BAH4FCju.js → bundle-DgILeA5b.js} +112 -138
  20. package/dist/bundle-DgILeA5b.js.map +1 -0
  21. package/dist/bundle.d.ts +35 -12
  22. package/dist/cli.d.ts +2 -2
  23. package/dist/{cloud-DtADfWwn.js → cloud-CYMk92iG.js} +72 -71
  24. package/dist/cloud-CYMk92iG.js.map +1 -0
  25. package/dist/cms-directories-BK3vcswg.js +33 -0
  26. package/dist/cms-directories-BK3vcswg.js.map +1 -0
  27. package/dist/codemod/collections-to-tables/ast.d.ts +135 -0
  28. package/dist/codemod/collections-to-tables/backend.d.ts +38 -0
  29. package/dist/codemod/collections-to-tables/command.d.ts +35 -0
  30. package/dist/codemod/collections-to-tables/comments.d.ts +45 -0
  31. package/dist/codemod/collections-to-tables/customization.d.ts +47 -0
  32. package/dist/codemod/collections-to-tables/dynamic-props.d.ts +34 -0
  33. package/dist/codemod/collections-to-tables/export-changes.d.ts +83 -0
  34. package/dist/codemod/collections-to-tables/firestore.d.ts +11 -0
  35. package/dist/codemod/collections-to-tables/helper-hooks.d.ts +41 -0
  36. package/dist/codemod/collections-to-tables/hooks.d.ts +44 -0
  37. package/dist/codemod/collections-to-tables/journal.d.ts +10 -0
  38. package/dist/codemod/collections-to-tables/legacy-shims.d.ts +52 -0
  39. package/dist/codemod/collections-to-tables/load-legacy.d.ts +81 -0
  40. package/dist/codemod/collections-to-tables/migrate.d.ts +20 -0
  41. package/dist/codemod/collections-to-tables/modules.d.ts +127 -0
  42. package/dist/codemod/collections-to-tables/moved-imports.d.ts +70 -0
  43. package/dist/codemod/collections-to-tables/moved-symbols.generated.d.ts +12 -0
  44. package/dist/codemod/collections-to-tables/own.d.ts +10 -0
  45. package/dist/codemod/collections-to-tables/path-aliases.d.ts +26 -0
  46. package/dist/codemod/collections-to-tables/plan-context.d.ts +49 -0
  47. package/dist/codemod/collections-to-tables/print-js.d.ts +44 -0
  48. package/dist/codemod/collections-to-tables/project-files.d.ts +144 -0
  49. package/dist/codemod/collections-to-tables/repoint.d.ts +50 -0
  50. package/dist/codemod/collections-to-tables/row-hands.d.ts +7 -0
  51. package/dist/codemod/collections-to-tables/sdk-calls.d.ts +88 -0
  52. package/dist/codemod/collections-to-tables/skills-step.d.ts +13 -0
  53. package/dist/codemod/collections-to-tables/split-constants.d.ts +42 -0
  54. package/dist/codemod/collections-to-tables/storage-paths.d.ts +28 -0
  55. package/dist/codemod/collections-to-tables/types.d.ts +164 -0
  56. package/dist/codemod/collections-to-tables/verify.d.ts +27 -0
  57. package/dist/codemod/collections-to-tables/vocabulary.d.ts +40 -0
  58. package/dist/command-D5lhW_-B.js +9984 -0
  59. package/dist/command-D5lhW_-B.js.map +1 -0
  60. package/dist/commands/agent-setup.d.ts +6 -2
  61. package/dist/commands/cloud/context.d.ts +1 -1
  62. package/dist/commands/cloud/init.d.ts +2 -2
  63. package/dist/commands/console.d.ts +1 -2
  64. package/dist/commands/db.d.ts +5 -6
  65. package/dist/commands/dev.d.ts +18 -17
  66. package/dist/commands/doctor.d.ts +4 -5
  67. package/dist/commands/eject.d.ts +17 -13
  68. package/dist/commands/generate-view.d.ts +20 -9
  69. package/dist/commands/generate_sdk.d.ts +27 -27
  70. package/dist/commands/init.d.ts +21 -8
  71. package/dist/commands/migrate.d.ts +24 -0
  72. package/dist/commands/schema-reconcile.d.ts +1 -1
  73. package/dist/commands/skills.d.ts +8 -0
  74. package/dist/commands/verify-cms.d.ts +28 -0
  75. package/dist/commands/verify.d.ts +14 -9
  76. package/dist/{consent-BD7F29T3.js → consent-BXLIrMl8.js} +2 -2
  77. package/dist/{consent-BD7F29T3.js.map → consent-BXLIrMl8.js.map} +1 -1
  78. package/dist/{console-CdwIYOMV.js → console-CMjhgMUE.js} +14 -14
  79. package/dist/console-CMjhgMUE.js.map +1 -0
  80. package/dist/{context-AXdAh-q8.js → context--JwaHaZp.js} +6 -5
  81. package/dist/context--JwaHaZp.js.map +1 -0
  82. package/dist/{daemon-Cp7oNXth.js → daemon-w30PsdwV.js} +2 -2
  83. package/dist/{daemon-Cp7oNXth.js.map → daemon-w30PsdwV.js.map} +1 -1
  84. package/dist/{db-DBbKpjYX.js → db-A7XDCIIO.js} +51 -51
  85. package/dist/db-A7XDCIIO.js.map +1 -0
  86. package/dist/{derive-ae9UOoOB.js → derive-C3ezmY-p.js} +105 -133
  87. package/dist/derive-C3ezmY-p.js.map +1 -0
  88. package/dist/dev-db/attver.d.ts +11 -0
  89. package/dist/{dev-preflight-Cxv3TiD1.js → dev-preflight-DjvcV6SK.js} +5 -5
  90. package/dist/dev-preflight-DjvcV6SK.js.map +1 -0
  91. package/dist/{dev-server-OJsUGZEB.js → dev-server-BLxCbQEP.js} +2 -2
  92. package/dist/{dev-server-OJsUGZEB.js.map → dev-server-BLxCbQEP.js.map} +1 -1
  93. package/dist/{dev-C93d4QIv.js → dev-tWwPyWkQ.js} +142 -84
  94. package/dist/dev-tWwPyWkQ.js.map +1 -0
  95. package/dist/{doctor-BBPQUO2g.js → doctor-BBM0dWvZ.js} +39 -62
  96. package/dist/doctor-BBM0dWvZ.js.map +1 -0
  97. package/dist/doctor-environment.d.ts +6 -6
  98. package/dist/{eject-DABcDnPN.js → eject-Bhzd6hgb.js} +25 -16
  99. package/dist/eject-Bhzd6hgb.js.map +1 -0
  100. package/dist/{fold-static-BWzxNn06.js → fold-static-CKewnAPX.js} +5 -3
  101. package/dist/fold-static-CKewnAPX.js.map +1 -0
  102. package/dist/{generate-view-IFwCADvb.js → generate-view-CTOluXvH.js} +160 -89
  103. package/dist/generate-view-CTOluXvH.js.map +1 -0
  104. package/dist/{generate_sdk-DNmNuFuW.js → generate_sdk-De-aLC1L.js} +120 -137
  105. package/dist/generate_sdk-De-aLC1L.js.map +1 -0
  106. package/dist/import-schema-module-Df67TIWj.js +51 -0
  107. package/dist/import-schema-module-Df67TIWj.js.map +1 -0
  108. package/dist/index.es.js +64 -51
  109. package/dist/index.es.js.map +1 -1
  110. package/dist/{init-vL1DWOeC.js → init-Dtl-IcXf.js} +83 -80
  111. package/dist/init-Dtl-IcXf.js.map +1 -0
  112. package/dist/last-dev-database-Dc8cP01o.js +2 -0
  113. package/dist/{manifest-BtzDy7KQ.js → manifest-C3uLDrrJ.js} +115 -40
  114. package/dist/manifest-C3uLDrrJ.js.map +1 -0
  115. package/dist/manifest.d.ts +79 -24
  116. package/dist/migrate-VrKoi3nB.js +138 -0
  117. package/dist/migrate-VrKoi3nB.js.map +1 -0
  118. package/dist/{normalize-imports-Bd5Y4yLp.js → normalize-imports-DwxqEMYq.js} +3 -3
  119. package/dist/{normalize-imports-Bd5Y4yLp.js.map → normalize-imports-DwxqEMYq.js.map} +1 -1
  120. package/dist/path-flags-7O5uPBcQ.js +139 -0
  121. package/dist/path-flags-7O5uPBcQ.js.map +1 -0
  122. package/dist/{prepare-CTw9NEkh.js → prepare-Ccxspoj-.js} +4 -4
  123. package/dist/{prepare-CTw9NEkh.js.map → prepare-Ccxspoj-.js.map} +1 -1
  124. package/dist/project-CLcF5i8c.js +360 -0
  125. package/dist/project-CLcF5i8c.js.map +1 -0
  126. package/dist/project-schema-CsSOG2gE.js +30 -0
  127. package/dist/project-schema-CsSOG2gE.js.map +1 -0
  128. package/dist/{pull-DDMpsZ5r.js → pull-D9WvpDYY.js} +189 -1
  129. package/dist/pull-D9WvpDYY.js.map +1 -0
  130. package/dist/resolve-BY7bSFRT.js +2 -0
  131. package/dist/resources/derive.d.ts +19 -13
  132. package/dist/{resources-CPSC5Kcu.js → resources-Dpfs2y8P.js} +5 -4
  133. package/dist/{resources-CPSC5Kcu.js.map → resources-Dpfs2y8P.js.map} +1 -1
  134. package/dist/{schema-DtLPsXbT.js → schema-DwFDI1iU.js} +41 -39
  135. package/dist/schema-DwFDI1iU.js.map +1 -0
  136. package/dist/schema-dir-Cd1kvYbf.js +98 -0
  137. package/dist/schema-dir-Cd1kvYbf.js.map +1 -0
  138. package/dist/schema-reconcile-Tto54Qbv.js +2 -0
  139. package/dist/schema-text-CpNrsuMe.js +73 -0
  140. package/dist/schema-text-CpNrsuMe.js.map +1 -0
  141. package/dist/{skills-CbwV6vw_.js → skills-CXjA9TWw.js} +54 -10
  142. package/dist/skills-CXjA9TWw.js.map +1 -0
  143. package/dist/{start-YOr3X5Zm.js → start-Bwbtt2W5.js} +7 -10
  144. package/dist/{start-YOr3X5Zm.js.map → start-Bwbtt2W5.js.map} +1 -1
  145. package/dist/{status-BREvtzJm.js → status-DQ_PPz4C.js} +12 -12
  146. package/dist/status-DQ_PPz4C.js.map +1 -0
  147. package/dist/{storage-CO9ouK76.js → storage-iTqj5-Av.js} +12 -11
  148. package/dist/storage-iTqj5-Av.js.map +1 -0
  149. package/dist/{telemetry-DwK5RQJl.js → telemetry-BP_1Cl9r.js} +4 -4
  150. package/dist/{telemetry-DwK5RQJl.js.map → telemetry-BP_1Cl9r.js.map} +1 -1
  151. package/dist/{telemetry-CgwJPVMO.js → telemetry-M3HjlyhZ.js} +2 -2
  152. package/dist/{telemetry-CgwJPVMO.js.map → telemetry-M3HjlyhZ.js.map} +1 -1
  153. package/dist/{upgrade-B7sVwL8S.js → upgrade-oZzJ13jM.js} +5 -4
  154. package/dist/{upgrade-B7sVwL8S.js.map → upgrade-oZzJ13jM.js.map} +1 -1
  155. package/dist/utils/backend-guard.d.ts +47 -0
  156. package/dist/utils/cms-directories.d.ts +6 -0
  157. package/dist/utils/dev-preflight.d.ts +2 -2
  158. package/dist/utils/import-schema-module.d.ts +16 -0
  159. package/dist/utils/path-flags.d.ts +35 -16
  160. package/dist/utils/project-schema.d.ts +40 -0
  161. package/dist/utils/project.d.ts +8 -2
  162. package/dist/utils/schema-dir.d.ts +32 -0
  163. package/dist/utils/schema-drift.d.ts +6 -0
  164. package/dist/utils/schema-text.d.ts +24 -0
  165. package/dist/verify-DkJqhYPI.js +1160 -0
  166. package/dist/verify-DkJqhYPI.js.map +1 -0
  167. package/package.json +11 -8
  168. package/runtime/dev-server.mjs +5 -1
  169. package/templates/eject/Dockerfile +1 -4
  170. package/templates/eject/backend/src/env.ts +1 -1
  171. package/templates/eject/backend/src/index.ts +53 -40
  172. package/templates/eject/docker-compose.custom.yml +1 -1
  173. package/templates/overlays/baas/README.md +39 -12
  174. package/templates/overlays/baas/ai-instructions.md +8 -8
  175. package/templates/overlays/baas/{config → backend}/storage.ts +3 -4
  176. package/templates/overlays/baas/backend/tsconfig.json +10 -12
  177. package/templates/overlays/baas/package.json +1 -2
  178. package/templates/overlays/baas/pnpm-workspace.yaml +0 -1
  179. package/templates/presets/blank/backend/schema/index.ts +19 -0
  180. package/templates/presets/blank/frontend/src/App.tsx +56 -0
  181. package/templates/presets/ecommerce/backend/schema/categories.ts +12 -0
  182. package/templates/presets/ecommerce/backend/schema/index.ts +23 -0
  183. package/templates/presets/ecommerce/backend/schema/orders.ts +13 -0
  184. package/templates/presets/ecommerce/backend/schema/products.ts +18 -0
  185. package/templates/presets/ecommerce/frontend/src/App.tsx +59 -0
  186. package/templates/presets/ecommerce/frontend/src/cms/categories.tsx +12 -0
  187. package/templates/presets/ecommerce/frontend/src/cms/orders.tsx +38 -0
  188. package/templates/presets/ecommerce/frontend/src/cms/products.tsx +27 -0
  189. package/templates/resource-graphs/blank.json +2 -2
  190. package/templates/resource-graphs/blog.json +5 -5
  191. package/templates/resource-graphs/ecommerce.json +5 -5
  192. package/templates/resource-graphs/headless.json +1 -1
  193. package/templates/template/.claude/hooks/post-edit-collection.sh +27 -23
  194. package/templates/template/.cursorrules +2 -2
  195. package/templates/template/.env.example +6 -17
  196. package/templates/template/.github/copilot-instructions.md +2 -2
  197. package/templates/template/.windsurfrules +2 -2
  198. package/templates/template/AGENTS.md +2 -2
  199. package/templates/template/CLAUDE.md +2 -2
  200. package/templates/template/README.md +47 -13
  201. package/templates/template/ai-instructions.md +15 -14
  202. package/templates/template/backend/functions/hello.ts +1 -1
  203. package/templates/template/backend/package.json +0 -2
  204. package/templates/template/{config → backend}/resources.ts +3 -3
  205. package/templates/template/backend/schema/authors.ts +11 -0
  206. package/templates/template/backend/schema/index.ts +29 -0
  207. package/templates/template/backend/schema/posts.ts +29 -0
  208. package/templates/template/backend/schema/tags.ts +9 -0
  209. package/templates/template/backend/schema/users.ts +32 -0
  210. package/templates/template/{config → backend}/storage.ts +4 -4
  211. package/templates/template/backend/tsconfig.json +15 -20
  212. package/templates/template/docker-compose.yml +3 -3
  213. package/templates/template/frontend/package.json +0 -2
  214. package/templates/template/frontend/src/App.tsx +10 -4
  215. package/templates/template/frontend/src/cms/authors.tsx +7 -0
  216. package/templates/template/frontend/src/cms/posts.tsx +27 -0
  217. package/templates/template/frontend/src/cms/tags.tsx +11 -0
  218. package/templates/template/frontend/src/cms/ui-config.json +3 -0
  219. package/templates/template/frontend/src/cms/users.tsx +54 -0
  220. package/templates/template/frontend/src/{virtual.d.ts → vite-env.d.ts} +0 -4
  221. package/templates/template/frontend/vite.config.ts +6 -2
  222. package/templates/template/gitignore +1 -1
  223. package/templates/template/package.json +1 -2
  224. package/templates/template/pnpm-workspace.yaml +0 -1
  225. package/templates/template/scripts/example.ts +3 -3
  226. package/templates/template/tsconfig.json +1 -1
  227. package/templates/views/AppView.tsx.tmpl +4 -4
  228. package/templates/views/EntityView.tsx.tmpl +3 -4
  229. package/dist/api-keys-Dfw5-9s1.js.map +0 -1
  230. package/dist/apps-MKQbgDtN.js.map +0 -1
  231. package/dist/build-BuKTnec8.js.map +0 -1
  232. package/dist/bundle-BAH4FCju.js.map +0 -1
  233. package/dist/cloud-DtADfWwn.js.map +0 -1
  234. package/dist/collection-drift-BKj_BoMq.js +0 -106
  235. package/dist/collection-drift-BKj_BoMq.js.map +0 -1
  236. package/dist/collections-dir-DlvDhime.js +0 -69
  237. package/dist/collections-dir-DlvDhime.js.map +0 -1
  238. package/dist/console-CdwIYOMV.js.map +0 -1
  239. package/dist/context-AXdAh-q8.js.map +0 -1
  240. package/dist/db-DBbKpjYX.js.map +0 -1
  241. package/dist/derive-ae9UOoOB.js.map +0 -1
  242. package/dist/dev-C93d4QIv.js.map +0 -1
  243. package/dist/dev-preflight-Cxv3TiD1.js.map +0 -1
  244. package/dist/doctor-BBPQUO2g.js.map +0 -1
  245. package/dist/eject-DABcDnPN.js.map +0 -1
  246. package/dist/fold-static-BWzxNn06.js.map +0 -1
  247. package/dist/generate-view-IFwCADvb.js.map +0 -1
  248. package/dist/generate_sdk-DNmNuFuW.js.map +0 -1
  249. package/dist/init-vL1DWOeC.js.map +0 -1
  250. package/dist/last-dev-database-DpW5dfoX.js +0 -2
  251. package/dist/manifest-BtzDy7KQ.js.map +0 -1
  252. package/dist/path-flags-DNvtEi2-.js +0 -92
  253. package/dist/path-flags-DNvtEi2-.js.map +0 -1
  254. package/dist/project-CasK56vN.js.map +0 -1
  255. package/dist/pull-DDMpsZ5r.js.map +0 -1
  256. package/dist/resolve-D647F1LA.js +0 -2
  257. package/dist/schema-DtLPsXbT.js.map +0 -1
  258. package/dist/schema-reconcile-DkArN9jF.js +0 -2
  259. package/dist/skills-CbwV6vw_.js.map +0 -1
  260. package/dist/status-BREvtzJm.js.map +0 -1
  261. package/dist/storage-CO9ouK76.js.map +0 -1
  262. package/dist/utils/collection-drift.d.ts +0 -27
  263. package/dist/utils/collections-dir.d.ts +0 -14
  264. package/dist/verify-Y3rWSgfA.js +0 -730
  265. package/dist/verify-Y3rWSgfA.js.map +0 -1
  266. package/templates/overlays/baas/config/index.ts +0 -24
  267. package/templates/overlays/baas/config/package.json +0 -30
  268. package/templates/template/config/cms.d.ts +0 -15
  269. package/templates/template/config/collections/authors.ts +0 -47
  270. package/templates/template/config/collections/index.ts +0 -44
  271. package/templates/template/config/collections/posts.ts +0 -94
  272. package/templates/template/config/collections/presets/blank/index.ts +0 -5
  273. package/templates/template/config/collections/presets/ecommerce/categories.ts +0 -42
  274. package/templates/template/config/collections/presets/ecommerce/index.ts +0 -31
  275. package/templates/template/config/collections/presets/ecommerce/orders.ts +0 -78
  276. package/templates/template/config/collections/presets/ecommerce/products.ts +0 -73
  277. package/templates/template/config/collections/tags.ts +0 -27
  278. package/templates/template/config/collections/users.ts +0 -149
  279. package/templates/template/config/frontend-assets.d.ts +0 -17
  280. package/templates/template/config/index.ts +0 -12
  281. package/templates/template/config/package.json +0 -30
  282. package/templates/template/config/tsconfig.json +0 -35
  283. /package/templates/eject/{config → backend}/resources.ts +0 -0
@@ -1,16 +1,17 @@
1
- import { i as recordEvent } from "./telemetry-CgwJPVMO.js";
1
+ import { i as recordEvent } from "./telemetry-M3HjlyhZ.js";
2
2
  import { n as getPMCommands, t as detectPackageManager } from "./package-manager-DSEOwTqM.js";
3
- import { C as switchOn, a as findBackendDir, b as UsageError, g as resolveTsx, h as resolvePluginCliScript, l as getActiveBackendPlugin, n as dependenciesNotInstalled, o as findEnvFile, p as requireProjectRoot, s as findFrontendDir, v as validateTsxInstallation, w as wantsHelp, x as parseCommandArgs } from "./project-CasK56vN.js";
4
- import { d as findBackendApp, f as formatAppAddress, g as resolveBackendPaths, l as cmsMountOf, p as loadManifest, v as staticAppAddress } from "./manifest-BtzDy7KQ.js";
5
- import { r as getProjectPort, t as DEV_BACKEND_URL_ENV } from "./dev-server-OJsUGZEB.js";
6
- import { collectionsDirArgs, resolveCollectionsDir, resolveConfigDir } from "./collections-dir-DlvDhime.js";
3
+ import { a as wantsHelp, i as switchOn, n as parseCommandArgs, t as UsageError } from "./args-CaCcrYE1.js";
4
+ import { a as findBackendDir, g as resolveTsx, h as resolvePluginCliScript, l as getActiveBackendPlugin, n as dependenciesNotInstalled, o as findEnvFile, p as requireProjectRoot, s as findFrontendDir, v as validateTsxInstallation } from "./project-CLcF5i8c.js";
5
+ import { C as resolveBackendPaths, T as staticAppAddress, _ as findBackendApp, a as DEFAULT_TABLES_DIR, b as loadManifest, d as STORAGE_FILE, h as cmsMountOf, i as DEFAULT_SCHEMA_FILE, n as DEFAULT_CRONS_DIR, r as DEFAULT_FUNCTIONS_DIR, s as HOOKS_FILE, u as RESOURCES_FILE, v as findTablesIndex, y as formatAppAddress } from "./manifest-C3uLDrrJ.js";
6
+ import { n as resolveSchemaDir, r as schemaDirArgs } from "./schema-dir-Cd1kvYbf.js";
7
+ import { a as backendGuardMissingMessage, n as BACKEND_GUARD_FIX, o as backendGuardStates } from "./backend-guard-C0mVkXBw.js";
8
+ import { r as getProjectPort, t as DEV_BACKEND_URL_ENV } from "./dev-server-BLxCbQEP.js";
7
9
  import { t as Refusal } from "./refusal-ReeeGP8a.js";
8
- import { i as ensureDevDatabase, o as probeTcp } from "./dev-preflight-Cxv3TiD1.js";
10
+ import { i as ensureDevDatabase, o as probeTcp } from "./dev-preflight-DjvcV6SK.js";
9
11
  import { t as MANAGED_IDLE_TIMEOUT_MS } from "./constraints-CtiylsGf.js";
10
- import { a as resolveCliEntry, o as resolveSpawn } from "./daemon-Cp7oNXth.js";
11
- import { DEV_DATABASE_KIND_ENV, i as lastDevDatabaseNotice, managedNotices, prepareDatabaseEnv, resolveProjectDatabase, s as recordLastDevDatabase } from "./prepare-CTw9NEkh.js";
12
- import { runDriverDbCommand, runDriverSchemaCommand } from "./db-DBbKpjYX.js";
13
- import { t as affectsSqlSchema } from "./collection-drift-BKj_BoMq.js";
12
+ import { a as resolveCliEntry, o as resolveSpawn } from "./daemon-w30PsdwV.js";
13
+ import { DEV_DATABASE_KIND_ENV, i as lastDevDatabaseNotice, managedNotices, prepareDatabaseEnv, resolveProjectDatabase, s as recordLastDevDatabase } from "./prepare-Ccxspoj-.js";
14
+ import { runDriverDbCommand, runDriverSchemaCommand } from "./db-A7XDCIIO.js";
14
15
  import chalk from "chalk";
15
16
  import fs from "fs";
16
17
  import os from "os";
@@ -21,6 +22,52 @@ import dotenv from "dotenv";
21
22
  import { DEFAULT_RESOURCE_KEY, parseEnvBoolean } from "@rebasepro/types";
22
23
  import { execa, execaCommandSync } from "execa";
23
24
  import { StringDecoder } from "string_decoder";
25
+ //#region src/utils/schema-drift.ts
26
+ /**
27
+ * Which edits under the tables directory can put the *SQL* schema out of date.
28
+ *
29
+ * `rebase dev` watches `backend/schema` and, on a change, either tells the
30
+ * developer to run `rebase schema generate` / `rebase db push` or runs them.
31
+ *
32
+ * Every source file there is a schema edit. The directory holds `defineTable`
33
+ * and `defineView` declarations and the helpers they import, and nothing else:
34
+ * presentation (`customizeTable`) lives in `frontend/src/cms`, and Firestore
35
+ * collections (`defineFirestoreCollection`) are client-side and live there too.
36
+ * The old layout had to tell a Postgres collection from a Firestore one, and an
37
+ * admin-only edit from a SQL one, by reading the file; this one does not.
38
+ *
39
+ * Unlike the old collections directory, the loader does not scan files: it
40
+ * imports `index.ts`, which imports the rest — so `index.ts` itself counts, and
41
+ * so does a file in a subdirectory.
42
+ *
43
+ * What does not count is what no import of the schema can reach: tests,
44
+ * declaration files, dotfiles (editor swap and lock files), and anything that is
45
+ * not a module.
46
+ */
47
+ var MODULE_EXTENSIONS = [
48
+ ".ts",
49
+ ".mts",
50
+ ".cts",
51
+ ".tsx",
52
+ ".js",
53
+ ".mjs",
54
+ ".cjs"
55
+ ];
56
+ /**
57
+ * Can an edit to this file have changed the generated SQL schema?
58
+ *
59
+ * `relativePath` is relative to the tables directory, as `fs.watch` reports it.
60
+ */
61
+ function isSchemaSourceFile(relativePath) {
62
+ const segments = relativePath.split(path.sep).join("/").split("/");
63
+ if (segments.some((segment) => segment.startsWith("."))) return false;
64
+ const file = segments[segments.length - 1];
65
+ if (!MODULE_EXTENSIONS.some((extension) => file.endsWith(extension))) return false;
66
+ if (/\.d\.[cm]?ts$/.test(file)) return false;
67
+ if (/\.(test|spec)\.[cm]?[jt]sx?$/.test(file)) return false;
68
+ return true;
69
+ }
70
+ //#endregion
24
71
  //#region src/utils/boot-retry.ts
25
72
  /**
26
73
  * A backend boot that lost its database part-way, which booting again fixes.
@@ -271,22 +318,27 @@ function resolveDevRuntimeEntry() {
271
318
  /**
272
319
  * Tell the dev runtime where this project keeps its parts.
273
320
  *
274
- * Read from `rebase.json` when there is one, so a project that moved its config
275
- * directory is honoured; otherwise the conventional layout.
321
+ * Read from `rebase.json` when there is one, so a project that moved its schema
322
+ * directory is honoured; otherwise the conventional layout. The three backend
323
+ * modules (`resources`, `storage`, `hooks`) are at fixed places; the runtime
324
+ * resolves each one's extension and drops a module that is not there.
276
325
  */
277
326
  function devRuntimeEnv(projectRoot) {
278
327
  const result = {
279
328
  REBASE_DEV_PROJECT_ROOT: projectRoot,
280
- REBASE_DEV_CONFIG: "config",
281
- REBASE_DEV_FUNCTIONS: "backend/functions",
282
- REBASE_DEV_CRONS: "backend/crons",
283
- REBASE_DEV_SCHEMA: "backend/src/schema.generated.ts"
329
+ REBASE_DEV_TABLES: DEFAULT_TABLES_DIR,
330
+ REBASE_DEV_RESOURCES: RESOURCES_FILE,
331
+ REBASE_DEV_STORAGE: STORAGE_FILE,
332
+ REBASE_DEV_HOOKS: HOOKS_FILE,
333
+ REBASE_DEV_FUNCTIONS: DEFAULT_FUNCTIONS_DIR,
334
+ REBASE_DEV_CRONS: DEFAULT_CRONS_DIR,
335
+ REBASE_DEV_SCHEMA: DEFAULT_SCHEMA_FILE
284
336
  };
285
337
  try {
286
338
  const backend = findBackendApp(loadManifest(projectRoot).manifest);
287
339
  if (backend) {
288
340
  const paths = resolveBackendPaths(backend.app, projectRoot);
289
- result.REBASE_DEV_CONFIG = paths.config;
341
+ result.REBASE_DEV_TABLES = paths.tables;
290
342
  result.REBASE_DEV_FUNCTIONS = paths.functions;
291
343
  result.REBASE_DEV_CRONS = paths.crons;
292
344
  result.REBASE_DEV_SCHEMA = paths.schema;
@@ -302,8 +354,9 @@ function devRuntimeEnv(projectRoot) {
302
354
  * crons are not imported: the runtime scans their directories at boot. So
303
355
  * adding `backend/functions/new.ts` while `rebase dev` ran did nothing —
304
356
  * `GET /api/functions/new` stayed 404, and a new cron never registered — until
305
- * somebody restarted by hand. The same is true of `config/`, which is read as
306
- * data.
357
+ * somebody restarted by hand. The schema directory is imported, but it is
358
+ * excluded from tsx's own tracking (see {@link devWatchArgs}) and restarted
359
+ * through the trigger instead.
307
360
  *
308
361
  * `--include` is tsx's own answer to this, it takes a directory rather than a
309
362
  * glob, and it tolerates a directory that does not exist yet: a `crons/`
@@ -313,13 +366,11 @@ function devRuntimeEnv(projectRoot) {
313
366
  * @param paths The `REBASE_DEV_*` map from {@link devRuntimeEnv}.
314
367
  */
315
368
  function devWatchIncludes(projectRoot, paths) {
316
- const dirs = [paths.REBASE_DEV_FUNCTIONS, paths.REBASE_DEV_CRONS].filter((entry) => Boolean(entry)).map((entry) => path.resolve(projectRoot, entry));
317
- dirs.push(path.join(projectRoot, resolveConfigDir(projectRoot)));
318
- return dirs;
369
+ return [paths.REBASE_DEV_FUNCTIONS, paths.REBASE_DEV_CRONS].filter((entry) => Boolean(entry)).map((entry) => path.resolve(projectRoot, entry));
319
370
  }
320
- /** Where dev watches the collections it regenerates the schema and SDK from. */
321
- function devCollectionsDir(projectRoot) {
322
- return resolveCollectionsDir(projectRoot);
371
+ /** Where dev watches the tables it regenerates the schema and SDK from. */
372
+ function devSchemaDir(projectRoot) {
373
+ return resolveSchemaDir(projectRoot);
323
374
  }
324
375
  /**
325
376
  * Call `onAppear` once, when `target` exists, and return what stops waiting.
@@ -327,7 +378,7 @@ function devCollectionsDir(projectRoot) {
327
378
  * Watches the nearest directory above `target` that exists (no higher than
328
379
  * `root`), and follows the path down as each part of it appears — `fs.watch`
329
380
  * cannot watch a directory that is not there yet. A headless project has no
330
- * `config/collections` until `rebase schema introspect` writes one, and dev
381
+ * `backend/schema` until one is written, and dev
331
382
  * watched it only when it was there at start: the backend kept serving the
332
383
  * API it derived from the database, and edits to the new files did nothing,
333
384
  * until dev was restarted by hand.
@@ -370,7 +421,7 @@ function whenDirectoryAppears(target, root, onAppear) {
370
421
  * path with a dot-named segment (its built-in `**\/.*\/**`), so a trigger under
371
422
  * `.rebase/` — or under a TMPDIR inside a dot directory — would never fire; in
372
423
  * that case there is no trigger and {@link devWatchArgs} leaves the
373
- * collections to tsx, as before.
424
+ * schema directory to tsx, as before.
374
425
  */
375
426
  function devRestartTrigger(projectRoot) {
376
427
  let tmp = os.tmpdir();
@@ -378,7 +429,7 @@ function devRestartTrigger(projectRoot) {
378
429
  tmp = fs.realpathSync(tmp);
379
430
  } catch {}
380
431
  const key = createHash("sha256").update(projectRoot).digest("hex").slice(0, 16);
381
- const trigger = path.join(tmp, "rebase-dev", key, "collections-changed");
432
+ const trigger = path.join(tmp, "rebase-dev", key, "schema-changed");
382
433
  return trigger.split(path.sep).some((segment) => segment.startsWith(".")) ? null : trigger;
383
434
  }
384
435
  /**
@@ -394,26 +445,26 @@ var TSX_DEFAULT_IGNORES = [
394
445
  /**
395
446
  * The `tsx watch` argument list for the backend (unquoted).
396
447
  *
397
- * One save of a collection file must restart the backend once. The runtime
398
- * `import()`s the collections, so tsx tracks them as dependencies and used to
448
+ * One save of a schema file must restart the backend once. The runtime
449
+ * `import()`s the schema, so tsx tracks it as a dependency and used to
399
450
  * restart the moment a file was saved — before dev had regenerated
400
451
  * `schema.generated.ts`. That boot warned "schema.generated.ts no longer
401
452
  * describes the database … Run `rebase schema generate`", telling the reader to
402
453
  * run what dev was running at that moment, and the regeneration then rewrote
403
454
  * the file and restarted the backend a second time. So tsx is told to leave the
404
- * collections directory alone (`--exclude` wins over its dependency tracking),
455
+ * schema directory alone (`--exclude` wins over its dependency tracking),
405
456
  * and dev restarts the backend itself, once, after the regeneration — through
406
457
  * `restartTrigger`, which tsx watches.
407
458
  *
408
459
  * Every included directory also gets tsx's own default ignores, made absolute.
409
460
  * tsx resolves those defaults (`**\/node_modules/**`, `**\/.*`, …) against its
410
- * cwd, which is `backend/`, so they never reached `config/`, a sibling: chokidar
411
- * walked `config/node_modules` — following symlinks — before tsx spawned the
461
+ * cwd, which is `backend/`, so they never reached a sibling directory: chokidar
462
+ * walked the old `config/node_modules` — following symlinks — before tsx spawned the
412
463
  * backend at all, and kept every file in it watched. In the monorepo's example
413
464
  * app that was 17 s before the first backend line and 1,400 open files, and any
414
465
  * install (or another checkout's Vite build writing `.vite-temp` deep inside
415
466
  * that tree) restarted the backend. A `.DS_Store` or an editor swap file in
416
- * `config/` restarted it too.
467
+ * an included directory restarted it too.
417
468
  */
418
469
  function devWatchArgs(projectRoot, paths, entryTarget, restartTrigger, envFile = null) {
419
470
  const args = ["watch"];
@@ -424,7 +475,7 @@ function devWatchArgs(projectRoot, paths, entryTarget, restartTrigger, envFile =
424
475
  }
425
476
  if (restartTrigger) {
426
477
  args.push("--include", restartTrigger);
427
- args.push("--exclude", `${glob(devCollectionsDir(projectRoot))}/**`);
478
+ args.push("--exclude", `${glob(devSchemaDir(projectRoot))}/**`);
428
479
  }
429
480
  if (envFile) args.push("--include", envFile);
430
481
  args.push("--conditions", "development", entryTarget);
@@ -443,7 +494,7 @@ function envFileHiddenFromTsx(envFile, backendDir) {
443
494
  /**
444
495
  * The databases the project declares beyond the default, by key.
445
496
  *
446
- * Read from the graph, so `database("analytics")` in `config/resources.ts`
497
+ * Read from the graph, so `database("analytics")` in `backend/resources.ts`
447
498
  * is enough for `rebase dev` to serve a second database — the declaration is
448
499
  * the request. A config that does not evaluate is the backend's problem to
449
500
  * report, in the terms it already uses; here it means "no additional
@@ -453,9 +504,10 @@ async function declaredAdditionalDatabases(projectRoot) {
453
504
  try {
454
505
  const backend = findBackendApp(loadManifest(projectRoot).manifest);
455
506
  if (!backend) return [];
456
- const { deriveResourceGraph, deriveOptionsFor } = await import("./derive-ae9UOoOB.js").then((n) => n.i);
507
+ const { deriveResourceGraph, deriveOptionsFor } = await import("./derive-C3ezmY-p.js").then((n) => n.i);
457
508
  const { graph } = await deriveResourceGraph({
458
509
  ...deriveOptionsFor(projectRoot, backend.app),
510
+ schemaDir: void 0,
459
511
  cronsDir: void 0,
460
512
  functionsDir: void 0
461
513
  });
@@ -790,21 +842,21 @@ function readEnvVar(projectRoot, name) {
790
842
  }
791
843
  }
792
844
  /**
793
- * Whether this project declares collections at all.
845
+ * Whether this project declares tables at all: its schema directory has an
846
+ * `index`, the module the loader reads.
794
847
  *
795
848
  * A project with none has no schema to generate or push — the headless BaaS
796
849
  * mode serves whatever the database already has.
797
850
  */
798
- function projectHasCollections(projectRoot) {
799
- const collectionsDir = devCollectionsDir(projectRoot);
800
- return fs.existsSync(collectionsDir) && fs.readdirSync(collectionsDir).some((name) => /\.(ts|js|mts|mjs)$/.test(name) && !name.startsWith("index."));
851
+ function projectHasTables(projectRoot) {
852
+ return findTablesIndex(devSchemaDir(projectRoot)) !== void 0;
801
853
  }
802
854
  /**
803
- * Make the generated Drizzle schema match the collections before anything reads it.
855
+ * Make the generated Drizzle schema match the tables before anything reads it.
804
856
  *
805
857
  * `rebase init` writes `backend/src/schema.generated.ts` from the preset's own
806
- * collections (`templates/generated-schemas/<preset>.ts`), so a new project
807
- * starts with the real schema. It is stale the moment a collection changes, and
858
+ * tables (`templates/generated-schemas/<preset>.ts`), so a new project
859
+ * starts with the real schema. It is stale the moment a table changes, and
808
860
  * on the managed PGlite path — the one a new project takes, because `rebase
809
861
  * init` leaves `DATABASE_URL` commented out — no `rebase db push` runs to
810
862
  * regenerate it. So `dev` does.
@@ -816,10 +868,10 @@ function projectHasCollections(projectRoot) {
816
868
  *
817
869
  * ## Why it runs unconditionally
818
870
  *
819
- * Generation reads collection files and writes one file. It needs no database,
871
+ * Generation reads the schema directory and writes one file. It needs no database,
820
872
  * it is idempotent, and it takes about two seconds. Making it a precondition of
821
873
  * starting the dev server — rather than a side effect of one database path —
822
- * is what makes "the generated schema matches the collections" true by
874
+ * is what makes "the generated schema matches the tables" true by
823
875
  * construction instead of true by remembering. The same staleness bites a
824
876
  * project whose database was already running, where the push never ran either.
825
877
  *
@@ -828,7 +880,7 @@ function projectHasCollections(projectRoot) {
828
880
  * worse than one that boots and says so.
829
881
  */
830
882
  async function ensureGeneratedSchema(projectRoot) {
831
- if (!projectHasCollections(projectRoot)) return "skipped";
883
+ if (!projectHasTables(projectRoot)) return "skipped";
832
884
  const schemaFile = path.join(findBackendDir(projectRoot) ?? path.join(projectRoot, "backend"), "src", "schema.generated.ts");
833
885
  const read = () => {
834
886
  try {
@@ -848,13 +900,13 @@ async function ensureGeneratedSchema(projectRoot) {
848
900
  const after = read();
849
901
  if (before !== null && after !== null && before !== after) {
850
902
  const shown = path.relative(projectRoot, schemaFile).split(path.sep).join("/");
851
- console.log(` ${chalk.gray(`↻ ${shown} was out of date with the collections, so it was regenerated.`)}`);
903
+ console.log(` ${chalk.gray(`↻ ${shown} was out of date with the tables, so it was regenerated.`)}`);
852
904
  }
853
905
  return "generated";
854
906
  } catch (error) {
855
907
  const message = error instanceof Error ? error.message : String(error);
856
908
  console.log(` ${chalk.yellow("⚠")} ${chalk.gray(`Could not regenerate the database schema: ${message}`)}`);
857
- console.log(` ${chalk.gray(`Run ${chalk.cyan("rebase schema generate")} to see why. Collection reads will fail until it succeeds.`)}`);
909
+ console.log(` ${chalk.gray(`Run ${chalk.cyan("rebase schema generate")} to see why. Reads of the changed tables will fail until it succeeds.`)}`);
858
910
  return "failed";
859
911
  }
860
912
  }
@@ -863,7 +915,7 @@ async function ensureGeneratedSchema(projectRoot) {
863
915
  * backend boots.
864
916
  *
865
917
  * Not after a regeneration that succeeded: that wrote `schema.generated.ts`
866
- * from these collections with this driver, moments earlier, and `stale`
918
+ * from these tables with this driver, moments earlier, and `stale`
867
919
  * compares the file against the same generator — it can only answer "nothing
868
920
  * stale", and it cost a driver process (~0.6 s) on every start. The repair it
869
921
  * exists for, a library upgrade that changed what the generator derives, is
@@ -874,17 +926,17 @@ function needsStaleSchemaPreflight(generation) {
874
926
  return generation !== "generated";
875
927
  }
876
928
  /**
877
- * Make `generated/sdk` match the collections, the same way the schema is kept.
929
+ * Make `generated/sdk` match the tables, the same way the schema is kept.
878
930
  *
879
931
  * This used to happen only under `--generate`, and `generated/` is gitignored,
880
932
  * so a fresh clone had no SDK types at all until someone ran
881
- * `rebase generate-sdk`, and every collection edit left the typed client one
933
+ * `rebase generate-sdk`, and every schema edit left the typed client one
882
934
  * step behind. A frontend compiling against a `Database` type that no longer
883
935
  * describes the backend is the drift this whole command exists to prevent.
884
936
  *
885
- * A child process rather than a call into `generateSdkCommand`: that loads the
886
- * collections through jiti, whose module cache would hand the second
887
- * regeneration the collections the first one loaded. And this CLI re-run
937
+ * A child process rather than a call into `generateSdkCommand`: that imports the
938
+ * schema in process, and Node's module cache would hand the second
939
+ * regeneration the tables the first one loaded. And this CLI re-run
888
940
  * directly, not `pnpm exec rebase`: the package manager's pre-run dependency
889
941
  * check can start an install on every save, and its `rebase` is whichever one
890
942
  * it resolves, not necessarily the one running `dev`.
@@ -899,7 +951,7 @@ function needsStaleSchemaPreflight(generation) {
899
951
  * rather than left to read `.rebase/state.json`.
900
952
  */
901
953
  async function regenerateSdk(projectRoot, backendPort) {
902
- if (!projectHasCollections(projectRoot)) return "skipped";
954
+ if (!projectHasTables(projectRoot)) return "skipped";
903
955
  const entry = resolveCliEntry();
904
956
  const { execPath, prefixArgs } = resolveSpawn(entry);
905
957
  try {
@@ -922,15 +974,15 @@ async function regenerateSdk(projectRoot, backendPort) {
922
974
  }
923
975
  }
924
976
  /**
925
- * What dev prints once a collection edit's regeneration is done.
977
+ * What dev prints once a schema edit's regeneration is done.
926
978
  *
927
979
  * The green "regenerated" box only when neither half failed. It used to be
928
980
  * printed unconditionally, right under "⚠ Could not regenerate the database
929
981
  * schema … nothing was applied" — and then the backend refused to boot over
930
- * the same collection error, so the success line was the one wrong thing on
982
+ * the same schema error, so the success line was the one wrong thing on
931
983
  * the screen.
932
984
  */
933
- function collectionChangeSummary(schema, sdk) {
985
+ function schemaChangeSummary(schema, sdk) {
934
986
  const failed = [schema === "failed" && "the database schema", sdk === "failed" && "the SDK types"].filter((part) => Boolean(part));
935
987
  if (failed.length > 0) return [
936
988
  chalk.yellow(` ⚠ Not regenerated: ${failed.join(" and ")} — fix the error above and save again.`),
@@ -939,7 +991,7 @@ function collectionChangeSummary(schema, sdk) {
939
991
  ];
940
992
  return [
941
993
  chalk.green(" ✓ Schema and SDK types regenerated. The backend restarts and boot"),
942
- chalk.green(" creates what is missing — a new collection, a new property."),
994
+ chalk.green(" creates what is missing — a new table, a new column."),
943
995
  chalk.gray(" For what boot leaves alone — a renamed column, a narrowed type,"),
944
996
  chalk.gray(` a removed field — run ${chalk.cyan("rebase db push")}.`),
945
997
  ""
@@ -991,12 +1043,12 @@ function schemaPushArgv(databaseUrl) {
991
1043
  * Start-up's independent halves, overlapped rather than run one after another.
992
1044
  *
993
1045
  * `rebase dev` used to regenerate the schema and the SDK, then derive the
994
- * resource graph (every collection evaluated again, in this process), then
1046
+ * resource graph (every table evaluated again, in this process), then
995
1047
  * start the managed database and wait for it — about a second when it was not
996
1048
  * already running — and only then spawn the backend. None of the three reads
997
- * what another writes: the generators read `config/` and write
1049
+ * what another writes: the generators read `backend/schema` and write
998
1050
  * `backend/src/schema.generated.ts` and `generated/sdk/`; the derivation reads
999
- * `config/resources.ts` and the collections; the database needs neither, and
1051
+ * `backend/resources.ts` and the tables; the database needs neither, and
1000
1052
  * `schema generate` never connects to one. So `database` starts first and is
1001
1053
  * collected last.
1002
1054
  *
@@ -1035,13 +1087,13 @@ async function overlapDevStartup(steps) {
1035
1087
  */
1036
1088
  async function runDatabasePreflight(options) {
1037
1089
  const { projectRoot, disabled } = options;
1038
- const hasCollections = projectHasCollections(projectRoot);
1090
+ const hasTables = projectHasTables(projectRoot);
1039
1091
  const databaseUrl = options.databaseUrl ?? readEnvVar(projectRoot, "DATABASE_URL");
1040
1092
  if ((await ensureDevDatabase({
1041
1093
  projectRoot,
1042
1094
  databaseUrl,
1043
1095
  disabled,
1044
- hasCollections,
1096
+ hasTables,
1045
1097
  pushSchema: async () => {
1046
1098
  await runDriverDbCommand(schemaPushArgv(databaseUrl), { quiet: true });
1047
1099
  }
@@ -1143,7 +1195,7 @@ async function devCommand(rawArgs) {
1143
1195
  printDevHelp();
1144
1196
  return;
1145
1197
  }
1146
- if (switchOn(rawArgs, "--generate") || rawArgs.includes("-g")) throw new UsageError("`rebase dev --generate` is gone: dev now regenerates the schema and the SDK types on every start and every collection save. Drop the flag.");
1198
+ if (switchOn(rawArgs, "--generate") || rawArgs.includes("-g")) throw new UsageError("`rebase dev --generate` is gone: dev now regenerates the schema and the SDK types on every start and every schema save. Drop the flag.");
1147
1199
  const { flags: args } = parseCommandArgs({
1148
1200
  spec: DEV_FLAGS,
1149
1201
  rawArgs,
@@ -1353,6 +1405,12 @@ async function devCommand(rawArgs) {
1353
1405
  function startFrontend(backendPort) {
1354
1406
  if (!frontendDir) return;
1355
1407
  console.log(` ${chalk.magenta("▶")} Frontend: ${chalk.gray(frontendDir)}`);
1408
+ backendGuardStates(projectRoot).then((states) => {
1409
+ for (const state of states.filter((candidate) => candidate.state === "missing")) {
1410
+ console.log(chalk.yellow(` ⚠ ${backendGuardMissingMessage(state)}`));
1411
+ console.log(chalk.dim(` ${BACKEND_GUARD_FIX} \`rebase build\` refuses to build it as it is.`));
1412
+ }
1413
+ }).catch(() => void 0);
1356
1414
  const frontendEnv = { ...process.env };
1357
1415
  frontendApiPort = backendPort;
1358
1416
  if (backendPort) {
@@ -1471,7 +1529,7 @@ async function devCommand(rawArgs) {
1471
1529
  await execa(tsxBin, [
1472
1530
  pluginCli,
1473
1531
  ...staleArgs,
1474
- ...collectionsDirArgs(projectRoot, staleArgs)
1532
+ ...schemaDirArgs(projectRoot, staleArgs)
1475
1533
  ], {
1476
1534
  cwd: backendDir,
1477
1535
  stdio: "inherit",
@@ -1492,7 +1550,7 @@ async function devCommand(rawArgs) {
1492
1550
  const usableTrigger = restartTrigger && fs.existsSync(restartTrigger) ? restartTrigger : null;
1493
1551
  const envFileForDev = envFile && envFileHiddenFromTsx(envFile, backendDir) ? envFile : null;
1494
1552
  const backendCommand = backendWatchCommand(tsxBin, devWatchArgs(projectRoot, runtimePaths, entryTarget, usableTrigger, envFileForDev ? null : envFile));
1495
- /** Restart the backend once, after dev has finished reacting to a collection save. */
1553
+ /** Restart the backend once, after dev has finished reacting to a schema save. */
1496
1554
  const restartBackend = () => {
1497
1555
  if (!usableTrigger) return;
1498
1556
  try {
@@ -1520,12 +1578,12 @@ async function devCommand(rawArgs) {
1520
1578
  return null;
1521
1579
  }
1522
1580
  };
1523
- const collectionsDir = devCollectionsDir(projectRoot);
1581
+ const schemaDir = devSchemaDir(projectRoot);
1524
1582
  {
1525
1583
  let debounce = null;
1526
1584
  let sqlSchemaAffected = false;
1527
1585
  let changed = "";
1528
- const collectionsChanged = (filename, affectsSchema) => {
1586
+ const schemaChanged = (filename, affectsSchema) => {
1529
1587
  sqlSchemaAffected = sqlSchemaAffected || affectsSchema;
1530
1588
  changed = filename;
1531
1589
  if (debounce) clearTimeout(debounce);
@@ -1542,27 +1600,27 @@ async function devCommand(rawArgs) {
1542
1600
  console.log([
1543
1601
  "",
1544
1602
  chalk.yellow(" ┌──────────────────────────────────────────────────────────────┐"),
1545
- chalk.yellow(" │ 🔄 Collection file changed: ") + chalk.white(shown) + chalk.yellow("│"),
1603
+ chalk.yellow(" │ 🔄 Schema file changed: ") + chalk.white(shown) + chalk.yellow("│"),
1546
1604
  chalk.yellow(" │ Regenerating the schema and the SDK types… │"),
1547
1605
  chalk.yellow(" └──────────────────────────────────────────────────────────────┘")
1548
1606
  ].join("\n"));
1549
1607
  const schemaBefore = generatedSchemaStamp();
1550
1608
  const [schemaResult, sdkResult] = await Promise.all([ensureGeneratedSchema(projectRoot), regenerateSdkFor(resolvedBackendPort ?? startPort)]);
1551
1609
  if (!(usesStockRuntime && schemaBefore !== null && generatedSchemaStamp() !== schemaBefore)) restartBackend();
1552
- console.log(collectionChangeSummary(schemaResult, sdkResult).join("\n"));
1610
+ console.log(schemaChangeSummary(schemaResult, sdkResult).join("\n"));
1553
1611
  })();
1554
1612
  }, 500);
1555
1613
  };
1556
- const watchCollections = () => {
1557
- fs.watch(collectionsDir, { recursive: true }, (_eventType, filename) => {
1614
+ const watchSchema = () => {
1615
+ fs.watch(schemaDir, { recursive: true }, (_eventType, filename) => {
1558
1616
  if (!filename || filename.startsWith(".") || filename.endsWith(".tmp")) return;
1559
- collectionsChanged(filename, affectsSqlSchema(collectionsDir, filename));
1617
+ schemaChanged(filename, isSchemaSourceFile(filename));
1560
1618
  });
1561
1619
  };
1562
- if (fs.existsSync(collectionsDir)) watchCollections();
1563
- else whenDirectoryAppears(collectionsDir, projectRoot, () => {
1564
- watchCollections();
1565
- collectionsChanged(`${path.basename(collectionsDir)}/`, true);
1620
+ if (fs.existsSync(schemaDir)) watchSchema();
1621
+ else whenDirectoryAppears(schemaDir, projectRoot, () => {
1622
+ watchSchema();
1623
+ schemaChanged(`${path.basename(schemaDir)}/`, true);
1566
1624
  });
1567
1625
  }
1568
1626
  if (!backendOnly && frontendDir && await frontendCanStartWithBackend({
@@ -1634,7 +1692,7 @@ async function devCommand(rawArgs) {
1634
1692
  * half that was missing. The old timer fired once, thirty seconds after
1635
1693
  * start-up, and its body began `if (backendAnnounced) return` — so a
1636
1694
  * backend that came up and then died on the next save was covered by
1637
- * nothing at all. Breaking `config/resources.ts` under a running
1695
+ * nothing at all. Breaking `backend/resources.ts` under a running
1638
1696
  * `rebase dev` printed a stack trace, took `/health` to nothing, and
1639
1697
  * left the CLI saying "Press Ctrl+C to stop all servers."
1640
1698
  */
@@ -1832,7 +1890,7 @@ ${chalk.green.bold("Which database")}
1832
1890
  6. the managed development database ${chalk.gray("(PGlite, data in .rebase/)")}
1833
1891
 
1834
1892
  A scaffolded project sets none of 1–5, so it lands on (6): no Docker,
1835
- nothing to install, and the collections' tables are created at boot.
1893
+ nothing to install, and the tables are created at boot.
1836
1894
 
1837
1895
  ${chalk.blue("--docker")} reaches the ${chalk.gray("db")} service in this project's docker-compose.yml,
1838
1896
  starting the container if nothing is listening on its port, and pushing
@@ -1879,9 +1937,9 @@ ${chalk.green.bold("Description")}
1879
1937
  VITE_API_URL is injected with the port the backend actually bound —
1880
1938
  the frontend is restarted if the backend had to move.
1881
1939
 
1882
- On startup and on every save under config/collections, the Drizzle
1940
+ On startup and on every save under backend/schema, the Drizzle
1883
1941
  schema (backend/src/schema.generated.ts) and the SDK types
1884
- (generated/sdk) are regenerated from the collections.
1942
+ (generated/sdk) are regenerated from the tables.
1885
1943
 
1886
1944
  An edit to .env restarts the backend, which reads the file again. What
1887
1945
  this command sets for it is kept until ${chalk.cyan("rebase dev")} restarts: ${chalk.gray("PORT")}, and
@@ -1891,4 +1949,4 @@ ${chalk.green.bold("Description")}
1891
1949
  //#endregion
1892
1950
  export { devCommand };
1893
1951
 
1894
- //# sourceMappingURL=dev-C93d4QIv.js.map
1952
+ //# sourceMappingURL=dev-tWwPyWkQ.js.map