@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
package/dist/index.es.js CHANGED
@@ -1,8 +1,10 @@
1
- import { i as recordEvent, n as isEnabled, u as errorClass } from "./telemetry-CgwJPVMO.js";
2
- import { E as unknownCommand, b as UsageError, i as failAsJson, p as requireProjectRoot, x as parseCommandArgs, y as wantsJsonOutput } from "./project-CasK56vN.js";
1
+ import { i as recordEvent, n as isEnabled, u as errorClass } from "./telemetry-M3HjlyhZ.js";
2
+ import { n as parseCommandArgs, s as unknownCommand, t as UsageError } from "./args-CaCcrYE1.js";
3
+ import { i as failAsJson, p as requireProjectRoot, y as wantsJsonOutput } from "./project-CLcF5i8c.js";
4
+ import { C as resolveBackendPaths, D as validateManifest, E as synthesizeManifest, O as writeManifest, S as manifestPath, T as staticAppAddress, _ as findBackendApp, a as DEFAULT_TABLES_DIR, b as loadManifest, c as LEGACY_CONFIG_DIR, d as STORAGE_FILE, f as TABLES_INDEX_FILES, g as compareMountOrder, h as cmsMountOf, i as DEFAULT_SCHEMA_FILE, l as ManifestError, m as buildableApps, n as DEFAULT_CRONS_DIR, o as GENERATED_DIR, p as assessManagedCompatibility, r as DEFAULT_FUNCTIONS_DIR, s as HOOKS_FILE, t as CURRENT_RUNTIME_RANGE, u as RESOURCES_FILE, v as findTablesIndex, w as selectDeployApp, x as manifestExists, y as formatAppAddress } from "./manifest-C3uLDrrJ.js";
5
+ import { a as refuseRemovedCollectionsFlag } from "./path-flags-7O5uPBcQ.js";
3
6
  import { n as cliVersion } from "./version-Buyyo1ut.js";
4
- import { _ as selectDeployApp, a as DEFAULT_SCHEMA_FILE, b as validateManifest, c as buildableApps, d as findBackendApp, f as formatAppAddress, g as resolveBackendPaths, h as manifestPath, i as DEFAULT_FUNCTIONS_DIR, l as cmsMountOf, m as manifestExists, n as DEFAULT_CONFIG_DIR, o as ManifestError, p as loadManifest, r as DEFAULT_CRONS_DIR, s as assessManagedCompatibility, t as CURRENT_RUNTIME_RANGE, u as compareMountOrder, v as staticAppAddress, x as writeManifest, y as synthesizeManifest } from "./manifest-BtzDy7KQ.js";
5
- import { S as vendorDependencies, _ as detectStorageAuthorize, a as VENDOR_TARGET_CPU, b as normalizeEsmSpecifiers, c as buildStaticBundle, d as commentSpans, f as composeBundleManifest, g as detectNativeDependencies, h as detectFrameworkDepDrift, i as VENDOR_SIZE_WARN_BYTES, l as bundledNpmrc, m as detectDeclaredDepConflicts, n as UNVENDORED_COST, o as VENDOR_TARGET_OS, p as describeDepConflicts, r as VENDOR_SIZE_MAX_BYTES, s as buildBundle, t as DEFAULT_BUNDLE_DIR, u as collectDeclaredDependencies, v as findUnusedServerEntry, x as unvendoredReason, y as foldStaticIntoBundle } from "./bundle-BAH4FCju.js";
7
+ import { C as unvendoredReason, S as normalizeEsmSpecifiers, _ as detectFrameworkDepDrift, a as VENDOR_SIZE_WARN_BYTES, b as findUnusedServerEntry, c as buildBundle, d as bundledNpmrc, f as collectDeclaredDependencies, g as detectDeclaredDepConflicts, h as describeDepConflicts, i as VENDOR_SIZE_MAX_BYTES, l as buildStaticBundle, m as composeBundleManifest, n as DEFAULT_BUNDLE_DIR, o as VENDOR_TARGET_CPU, p as commentSpans, r as UNVENDORED_COST, s as VENDOR_TARGET_OS, t as BUNDLED_UI_CONFIG, u as bundleUiConfig, v as detectNativeDependencies, w as vendorDependencies, x as foldStaticIntoBundle, y as detectStorageAuthorize } from "./bundle-DgILeA5b.js";
6
8
  import chalk from "chalk";
7
9
  import arg from "arg";
8
10
  import path from "path";
@@ -72,6 +74,7 @@ var namespacedCommands = [
72
74
  "resources",
73
75
  "status",
74
76
  "upgrade",
77
+ "migrate",
75
78
  "normalize-imports"
76
79
  ];
77
80
  var NO_VOCABULARY = {
@@ -90,43 +93,47 @@ var NO_VOCABULARY = {
90
93
  async function commandVocabulary(command) {
91
94
  switch (command) {
92
95
  case "schema": return {
93
- subcommands: (await import("./schema-DtLPsXbT.js")).SCHEMA_SUBCOMMANDS,
96
+ subcommands: (await import("./schema-DwFDI1iU.js")).SCHEMA_SUBCOMMANDS,
94
97
  aliases: {}
95
98
  };
96
99
  case "db": return {
97
- subcommands: (await import("./db-DBbKpjYX.js")).DB_SUBCOMMANDS,
100
+ subcommands: (await import("./db-A7XDCIIO.js")).DB_SUBCOMMANDS,
98
101
  aliases: {}
99
102
  };
100
103
  case "auth": return {
101
- subcommands: (await import("./auth-Bv0rTbQX.js")).AUTH_SUBCOMMANDS,
104
+ subcommands: (await import("./auth-CyADghFQ.js")).AUTH_SUBCOMMANDS,
102
105
  aliases: {}
103
106
  };
104
107
  case "skills": return {
105
- subcommands: (await import("./skills-CbwV6vw_.js")).SKILLS_SUBCOMMANDS,
108
+ subcommands: (await import("./skills-CXjA9TWw.js").then((n) => n.u)).SKILLS_SUBCOMMANDS,
106
109
  aliases: {}
107
110
  };
108
111
  case "api-keys": return {
109
- subcommands: (await import("./api-keys-Dfw5-9s1.js").then((n) => n.t)).API_KEYS_SUBCOMMANDS,
112
+ subcommands: (await import("./api-keys-eIUjMqWn.js").then((n) => n.t)).API_KEYS_SUBCOMMANDS,
110
113
  aliases: {}
111
114
  };
112
115
  case "storage": return {
113
- subcommands: (await import("./storage-CO9ouK76.js")).STORAGE_SUBCOMMANDS,
116
+ subcommands: (await import("./storage-iTqj5-Av.js")).STORAGE_SUBCOMMANDS,
114
117
  aliases: {}
115
118
  };
116
119
  case "apps": return {
117
- subcommands: (await import("./apps-MKQbgDtN.js")).APPS_SUBCOMMANDS,
120
+ subcommands: (await import("./apps-DExO4PEl.js")).APPS_SUBCOMMANDS,
118
121
  aliases: {}
119
122
  };
120
123
  case "telemetry": return {
121
- subcommands: (await import("./telemetry-DwK5RQJl.js")).TELEMETRY_SUBCOMMANDS,
124
+ subcommands: (await import("./telemetry-BP_1Cl9r.js")).TELEMETRY_SUBCOMMANDS,
122
125
  aliases: {}
123
126
  };
124
127
  case "generate": return {
125
- subcommands: (await import("./generate-view-IFwCADvb.js")).GENERATE_SUBCOMMANDS,
128
+ subcommands: (await import("./generate-view-CTOluXvH.js")).GENERATE_SUBCOMMANDS,
129
+ aliases: {}
130
+ };
131
+ case "migrate": return {
132
+ subcommands: (await import("./migrate-VrKoi3nB.js")).MIGRATE_SUBCOMMANDS,
126
133
  aliases: {}
127
134
  };
128
135
  case "cloud": {
129
- const cloud = await import("./cloud-DtADfWwn.js");
136
+ const cloud = await import("./cloud-CYMk92iG.js");
130
137
  return {
131
138
  subcommands: cloud.CLOUD_GROUP_NAMES,
132
139
  aliases: cloud.GROUP_ALIASES
@@ -140,8 +147,8 @@ async function commandVocabulary(command) {
140
147
  * group dispatches.
141
148
  *
142
149
  * The first word that is not a flag is not always the subcommand: after a flag
143
- * that takes a value it is that value. `rebase db --collections ./c push` was
144
- * refused as an unknown db command `./c`, `rebase api-keys --name ci create` as
150
+ * that takes a value it is that value. `rebase db --schema-dir ./s push` was
151
+ * refused as an unknown db command `./s`, `rebase api-keys --name ci create` as
145
152
  * one called `ci`, and `rebase skills --agent claude install` as `claude` —
146
153
  * lines every one of those commands parses happily once it is reached.
147
154
  *
@@ -254,21 +261,20 @@ async function dispatch(command, effectiveSubcommand, args, parsedArgs, namespac
254
261
  return;
255
262
  }
256
263
  case "init": {
257
- const { createRebaseApp } = await import("./init-vL1DWOeC.js");
264
+ const { createRebaseApp } = await import("./init-Dtl-IcXf.js");
258
265
  await createRebaseApp(args);
259
266
  break;
260
267
  }
261
268
  case "generate-sdk": {
269
+ refuseRemovedCollectionsFlag(args.slice(2), "generate-sdk");
262
270
  const { flags: sdkArgs, help: sdkHelp } = parseCommandArgs({
263
271
  spec: {
264
- "--collections": String,
265
- "--collections-dir": "--collections",
272
+ "--schema-dir": String,
266
273
  "--output": String,
267
274
  "--out": "--output",
268
275
  "--from": String,
269
276
  "--token": String,
270
277
  "--register": Boolean,
271
- "-c": "--collections",
272
278
  "-o": "--output"
273
279
  },
274
280
  rawArgs: args,
@@ -277,9 +283,9 @@ async function dispatch(command, effectiveSubcommand, args, parsedArgs, namespac
277
283
  maxPositionals: 0
278
284
  });
279
285
  const sdkRoot = sdkHelp ? process.cwd() : requireProjectRoot();
280
- const { generateSdkCommand } = await import("./generate_sdk-DNmNuFuW.js");
286
+ const { generateSdkCommand } = await import("./generate_sdk-De-aLC1L.js");
281
287
  await generateSdkCommand({
282
- collectionsDir: sdkArgs["--collections"] || (sdkHelp ? path.join(sdkRoot, "config/collections") : (await import("./collections-dir-DlvDhime.js")).resolveCollectionsDir(sdkRoot)),
288
+ schemaDir: sdkArgs["--schema-dir"] || (sdkHelp ? sdkRoot : (await import("./schema-dir-Cd1kvYbf.js").then((n) => n.i)).resolveSchemaDir(sdkRoot)),
283
289
  output: sdkArgs["--output"] || path.join(sdkRoot, "generated/sdk"),
284
290
  from: sdkArgs["--from"],
285
291
  token: sdkArgs["--token"],
@@ -291,111 +297,116 @@ async function dispatch(command, effectiveSubcommand, args, parsedArgs, namespac
291
297
  break;
292
298
  }
293
299
  case "schema": {
294
- const { schemaCommand } = await import("./schema-DtLPsXbT.js");
300
+ const { schemaCommand } = await import("./schema-DwFDI1iU.js");
295
301
  await schemaCommand(effectiveSubcommand, args);
296
302
  break;
297
303
  }
298
304
  case "db": {
299
- const { dbCommand } = await import("./db-DBbKpjYX.js");
305
+ const { dbCommand } = await import("./db-A7XDCIIO.js");
300
306
  await dbCommand(effectiveSubcommand, args);
301
307
  break;
302
308
  }
303
309
  case "console": {
304
- const { consoleCommand } = await import("./console-CdwIYOMV.js");
310
+ const { consoleCommand } = await import("./console-CMjhgMUE.js");
305
311
  await consoleCommand(args);
306
312
  break;
307
313
  }
308
314
  case "dev": {
309
- const { devCommand } = await import("./dev-C93d4QIv.js");
315
+ const { devCommand } = await import("./dev-tWwPyWkQ.js");
310
316
  await devCommand(args);
311
317
  break;
312
318
  }
313
319
  case "normalize-imports": {
314
- const { normalizeImportsCommand } = await import("./normalize-imports-Bd5Y4yLp.js");
320
+ const { normalizeImportsCommand } = await import("./normalize-imports-DwxqEMYq.js");
315
321
  await normalizeImportsCommand(args);
316
322
  break;
317
323
  }
318
324
  case "build": {
319
- const { buildCommand } = await import("./build-BuKTnec8.js").then((n) => n.n);
325
+ const { buildCommand } = await import("./build-CA5R07tw.js").then((n) => n.n);
320
326
  await buildCommand(args);
321
327
  break;
322
328
  }
323
329
  case "start": {
324
- const { startCommand } = await import("./start-YOr3X5Zm.js");
330
+ const { startCommand } = await import("./start-Bwbtt2W5.js");
325
331
  await startCommand(args);
326
332
  break;
327
333
  }
328
334
  case "upgrade": {
329
- const { upgradeCommand } = await import("./upgrade-B7sVwL8S.js");
335
+ const { upgradeCommand } = await import("./upgrade-oZzJ13jM.js");
330
336
  await upgradeCommand(args);
331
337
  break;
332
338
  }
339
+ case "migrate": {
340
+ const { migrateCommand } = await import("./migrate-VrKoi3nB.js");
341
+ await migrateCommand(effectiveSubcommand, args);
342
+ break;
343
+ }
333
344
  case "apps": {
334
- const { appsCommand } = await import("./apps-MKQbgDtN.js");
345
+ const { appsCommand } = await import("./apps-DExO4PEl.js");
335
346
  await appsCommand(effectiveSubcommand, args);
336
347
  break;
337
348
  }
338
349
  case "generate": {
339
- const { generateCommand } = await import("./generate-view-IFwCADvb.js");
350
+ const { generateCommand } = await import("./generate-view-CTOluXvH.js");
340
351
  await generateCommand(effectiveSubcommand, args);
341
352
  break;
342
353
  }
343
354
  case "eject": {
344
- const { ejectCommand } = await import("./eject-DABcDnPN.js");
355
+ const { ejectCommand } = await import("./eject-Bhzd6hgb.js");
345
356
  await ejectCommand(args);
346
357
  break;
347
358
  }
348
359
  case "auth": {
349
- const { authCommand } = await import("./auth-Bv0rTbQX.js");
360
+ const { authCommand } = await import("./auth-CyADghFQ.js");
350
361
  await authCommand(effectiveSubcommand, args);
351
362
  break;
352
363
  }
353
364
  case "status": {
354
- const { statusCommand } = await import("./status-BREvtzJm.js");
365
+ const { statusCommand } = await import("./status-DQ_PPz4C.js");
355
366
  await statusCommand(args);
356
367
  break;
357
368
  }
358
369
  case "resources": {
359
- const { resourcesCommand } = await import("./resources-CPSC5Kcu.js");
370
+ const { resourcesCommand } = await import("./resources-Dpfs2y8P.js");
360
371
  await resourcesCommand(args);
361
372
  break;
362
373
  }
363
374
  case "doctor": {
364
- const { doctorCommand } = await import("./doctor-BBPQUO2g.js");
375
+ const { doctorCommand } = await import("./doctor-BBM0dWvZ.js");
365
376
  await doctorCommand(args);
366
377
  break;
367
378
  }
368
379
  case "verify": {
369
- const { verifyCommand } = await import("./verify-Y3rWSgfA.js");
380
+ const { verifyCommand } = await import("./verify-DkJqhYPI.js");
370
381
  await verifyCommand(args);
371
382
  break;
372
383
  }
373
384
  case "skills": {
374
- const { skillsCommand } = await import("./skills-CbwV6vw_.js");
385
+ const { skillsCommand } = await import("./skills-CXjA9TWw.js").then((n) => n.u);
375
386
  await skillsCommand(effectiveSubcommand, args);
376
387
  break;
377
388
  }
378
389
  case "api-keys": {
379
- const { apiKeysCommand } = await import("./api-keys-Dfw5-9s1.js").then((n) => n.t);
390
+ const { apiKeysCommand } = await import("./api-keys-eIUjMqWn.js").then((n) => n.t);
380
391
  await apiKeysCommand(effectiveSubcommand, args);
381
392
  break;
382
393
  }
383
394
  case "storage": {
384
- const { storageCommand } = await import("./storage-CO9ouK76.js");
395
+ const { storageCommand } = await import("./storage-iTqj5-Av.js");
385
396
  await storageCommand(effectiveSubcommand, args);
386
397
  break;
387
398
  }
388
399
  case "cloud": {
389
- const { cloudCommand } = await import("./cloud-DtADfWwn.js");
400
+ const { cloudCommand } = await import("./cloud-CYMk92iG.js");
390
401
  await cloudCommand(effectiveSubcommand, args);
391
402
  break;
392
403
  }
393
404
  case "telemetry": {
394
- const { telemetryCommand } = await import("./telemetry-DwK5RQJl.js");
405
+ const { telemetryCommand } = await import("./telemetry-BP_1Cl9r.js");
395
406
  await telemetryCommand(args);
396
407
  break;
397
408
  }
398
- default: unknownCommand(command, namespacedCommands, "", { cloud: (await import("./cloud-DtADfWwn.js")).CLOUD_GROUP_NAMES });
409
+ default: unknownCommand(command, namespacedCommands, "", { cloud: (await import("./cloud-CYMk92iG.js")).CLOUD_GROUP_NAMES });
399
410
  }
400
411
  }
401
412
  /** The global help. Exported so its Options block can be held against {@link ROOT_FLAGS}. */
@@ -413,12 +424,14 @@ ${chalk.green.bold("Commands")}
413
424
  ${chalk.blue.bold("normalize-imports")} Complete compiled output's relative imports for Node ESM
414
425
  ${chalk.blue.bold("start")} Run the built bundle, as a deployment does ${chalk.gray("(in the NODE_ENV you set)")}
415
426
  ${chalk.blue.bold("upgrade")} Move every @rebasepro package to one release, then install
427
+ ${chalk.blue.bold("migrate collections-to-tables")} config/collections → backend/schema, SQL-checked
428
+ ${chalk.blue.bold("migrate sdk-calls")} Rewrite your own code for the table renames (data.table, rule keys)
416
429
  ${chalk.blue.bold("apps list")} Show the apps this repository declares
417
430
 
418
431
  ${chalk.green.bold("Schema")}
419
- ${chalk.blue.bold("schema generate")} Generate Drizzle schema from collections
420
- ${chalk.blue.bold("schema introspect")} Introspect database → Rebase collections
421
- ${chalk.blue.bold("schema stale")} Report generated schema files the collections have moved past
432
+ ${chalk.blue.bold("schema generate")} Generate the Drizzle schema from backend/schema
433
+ ${chalk.blue.bold("schema introspect")} Introspect database → defineTable modules in backend/schema
434
+ ${chalk.blue.bold("schema stale")} Report generated schema files the tables have moved past
422
435
  ${chalk.blue.bold("schema")} ${chalk.gray("--help")} Show schema command help
423
436
 
424
437
  ${chalk.green.bold("Database")}
@@ -436,7 +449,7 @@ ${chalk.green.bold("Explore")}
436
449
 
437
450
  ${chalk.green.bold("Generate")}
438
451
  ${chalk.blue.bold("generate view")} ${chalk.gray("<slug>")} Scaffold a custom admin screen ${chalk.gray("(--collection: a record tab)")}
439
- ${chalk.blue.bold("generate-sdk")} Generate a typed TypeScript SDK from collections
452
+ ${chalk.blue.bold("generate-sdk")} Generate a typed TypeScript SDK from the tables
440
453
 
441
454
  ${chalk.green.bold("Auth")}
442
455
  ${chalk.blue.bold("auth reset-password")} Reset a user's password
@@ -444,8 +457,8 @@ ${chalk.green.bold("Auth")}
444
457
 
445
458
  ${chalk.green.bold("Diagnostics")}
446
459
  ${chalk.blue.bold("status")} Show every resource and whether its variables are set
447
- ${chalk.blue.bold("doctor")} Detect schema drift between collections, schema, and DB
448
- ${chalk.blue.bold("verify")} Check collections, RLS coverage and migrations ${chalk.gray("(CI + agent hooks)")}
460
+ ${chalk.blue.bold("doctor")} Detect schema drift between tables, generated schema, and DB
461
+ ${chalk.blue.bold("verify")} Check tables, RLS coverage and migrations ${chalk.gray("(CI + agent hooks)")}
449
462
  ${chalk.blue.bold("resources")} List the databases, buckets and topics this project declares
450
463
 
451
464
  ${chalk.green.bold("Take ownership")}
@@ -501,6 +514,6 @@ function telemetryNotice() {
501
514
  return chalk.gray(`Usage sharing: ${sharing ? "on" : "off"} — ${chalk.cyan("rebase telemetry")} to inspect or change\n`);
502
515
  }
503
516
  //#endregion
504
- export { CURRENT_RUNTIME_RANGE, DEFAULT_BUNDLE_DIR, DEFAULT_CONFIG_DIR, DEFAULT_CRONS_DIR, DEFAULT_FUNCTIONS_DIR, DEFAULT_SCHEMA_FILE, ManifestError, UNVENDORED_COST, VENDOR_SIZE_MAX_BYTES, VENDOR_SIZE_WARN_BYTES, VENDOR_TARGET_CPU, VENDOR_TARGET_OS, assessManagedCompatibility, buildBundle, buildStaticBundle, buildableApps, bundledNpmrc, cmsMountOf, collectDeclaredDependencies, commentSpans, compareMountOrder, composeBundleManifest, describeDepConflicts, detectDeclaredDepConflicts, detectFrameworkDepDrift, detectNativeDependencies, detectStorageAuthorize, entry, findBackendApp, findUnusedServerEntry, foldStaticIntoBundle, formatAppAddress, loadManifest, manifestExists, manifestPath, normalizeEsmSpecifiers, resolveBackendPaths, selectDeployApp, staticAppAddress, synthesizeManifest, unvendoredReason, validateManifest, vendorDependencies, writeManifest };
517
+ export { BUNDLED_UI_CONFIG, CURRENT_RUNTIME_RANGE, DEFAULT_BUNDLE_DIR, DEFAULT_CRONS_DIR, DEFAULT_FUNCTIONS_DIR, DEFAULT_SCHEMA_FILE, DEFAULT_TABLES_DIR, GENERATED_DIR, HOOKS_FILE, LEGACY_CONFIG_DIR, ManifestError, RESOURCES_FILE, STORAGE_FILE, TABLES_INDEX_FILES, UNVENDORED_COST, VENDOR_SIZE_MAX_BYTES, VENDOR_SIZE_WARN_BYTES, VENDOR_TARGET_CPU, VENDOR_TARGET_OS, assessManagedCompatibility, buildBundle, buildStaticBundle, buildableApps, bundleUiConfig, bundledNpmrc, cmsMountOf, collectDeclaredDependencies, commentSpans, compareMountOrder, composeBundleManifest, describeDepConflicts, detectDeclaredDepConflicts, detectFrameworkDepDrift, detectNativeDependencies, detectStorageAuthorize, entry, findBackendApp, findTablesIndex, findUnusedServerEntry, foldStaticIntoBundle, formatAppAddress, loadManifest, manifestExists, manifestPath, normalizeEsmSpecifiers, resolveBackendPaths, selectDeployApp, staticAppAddress, synthesizeManifest, unvendoredReason, validateManifest, vendorDependencies, writeManifest };
505
518
 
506
519
  //# sourceMappingURL=index.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.es.js","names":[],"sources":["../src/cli.ts"],"sourcesContent":["import chalk from \"chalk\";\nimport arg from \"arg\";\nimport { errorClass, isEnabled, recordEvent } from \"./telemetry\";\nimport { failAsJson, requireProjectRoot, wantsJsonOutput } from \"./utils/project\";\nimport { parseCommandArgs, UsageError } from \"./utils/args\";\nimport { unknownCommand } from \"./utils/unknown-command\";\nimport { cliVersion } from \"./utils/version\";\nimport path from \"path\";\n\n/**\n * Silence dotenv's own banner, for this process and everything it spawns.\n *\n * dotenv 17 prints `injected env (13) from .env // tip: ◈ encrypted .env\n * [www.dotenvx.com]` on every `config()` — a third-party advertisement that\n * appeared in `rebase dev`, `rebase build` and, because `rebase start` loads\n * the same way, in production server logs. `DOTENV_CONFIG_QUIET` is dotenv's\n * documented switch (`lib/main.js` reads it before `options.quiet`), and\n * setting it in `process.env` also reaches the backend, Vite and Atlas child\n * processes, which inherit it. Errors are unaffected — `quiet` gates the\n * success banner only.\n *\n * Not forced: an explicit `DOTENV_CONFIG_QUIET=false` still turns it back on.\n */\nfunction silenceDotenvBanner(): void {\n if (process.env.DOTENV_CONFIG_QUIET === undefined) {\n process.env.DOTENV_CONFIG_QUIET = \"true\";\n }\n}\n\n/**\n * The flags that mean the same thing wherever they appear.\n *\n * `--debug` is in here even though this file does not act on it: it is\n * implemented one level up, in `bin/rebase.js`, which prints the stack of a\n * failed command instead of the one-line message. That is exactly why it went\n * missing from the help for as long as it did — the flag lived in the\n * launcher, the Options block lived here, and neither knew about the other.\n * Declaring it here puts both under one spec, which `cli.test.ts` holds\n * against the printed help.\n *\n * Exported for that test.\n */\nexport const ROOT_FLAGS = {\n \"--version\": Boolean,\n \"--help\": Boolean,\n \"--debug\": Boolean,\n \"-v\": \"--version\",\n \"-h\": \"--help\"\n} as const;\n\n/**\n * Every command the dispatch below answers and the help lists. Declared as a\n * literal under this name: `help-coverage.test.ts`, `printed-commands.test.ts`\n * and the docs verifier read it out of this file's source.\n */\nconst namespacedCommands = [\"init\", \"schema\", \"db\", \"console\", \"dev\", \"build\", \"start\", \"auth\", \"doctor\", \"verify\", \"skills\", \"api-keys\", \"storage\", \"cloud\", \"apps\", \"eject\", \"generate\", \"generate-sdk\", \"telemetry\", \"resources\", \"status\", \"upgrade\", \"normalize-imports\"];\n\n/** The words a command group dispatches, and the other spellings it accepts for them. */\ninterface CommandVocabulary {\n subcommands: readonly string[];\n aliases: Readonly<Record<string, string>>;\n}\n\nconst NO_VOCABULARY: CommandVocabulary = { subcommands: [], aliases: {} };\n\n/**\n * The subcommands each command group dispatches, from the lists those groups\n * dispatch on. A command absent from here takes no subcommand.\n *\n * Read from the group's own module, which is loaded here rather than at\n * startup: every command module is imported when its command runs (see\n * {@link dispatch}), and this is only ever asked about the command being run,\n * whose module the dispatch is about to load anyway.\n */\nasync function commandVocabulary(command: string): Promise<CommandVocabulary> {\n switch (command) {\n case \"schema\": return { subcommands: (await import(\"./commands/schema\")).SCHEMA_SUBCOMMANDS, aliases: {} };\n case \"db\": return { subcommands: (await import(\"./commands/db\")).DB_SUBCOMMANDS, aliases: {} };\n case \"auth\": return { subcommands: (await import(\"./commands/auth\")).AUTH_SUBCOMMANDS, aliases: {} };\n case \"skills\": return { subcommands: (await import(\"./commands/skills\")).SKILLS_SUBCOMMANDS, aliases: {} };\n case \"api-keys\": return { subcommands: (await import(\"./commands/api-keys\")).API_KEYS_SUBCOMMANDS, aliases: {} };\n case \"storage\": return { subcommands: (await import(\"./commands/storage\")).STORAGE_SUBCOMMANDS, aliases: {} };\n case \"apps\": return { subcommands: (await import(\"./commands/apps\")).APPS_SUBCOMMANDS, aliases: {} };\n case \"telemetry\": return { subcommands: (await import(\"./commands/telemetry\")).TELEMETRY_SUBCOMMANDS, aliases: {} };\n case \"generate\": return { subcommands: (await import(\"./commands/generate-view\")).GENERATE_SUBCOMMANDS, aliases: {} };\n case \"cloud\": {\n const cloud = await import(\"./commands/cloud\");\n return { subcommands: cloud.CLOUD_GROUP_NAMES, aliases: cloud.GROUP_ALIASES };\n }\n default: return NO_VOCABULARY;\n }\n}\n\n/**\n * The subcommand in the words after a command, read against the subcommands the\n * group dispatches.\n *\n * The first word that is not a flag is not always the subcommand: after a flag\n * that takes a value it is that value. `rebase db --collections ./c push` was\n * refused as an unknown db command `./c`, `rebase api-keys --name ci create` as\n * one called `ci`, and `rebase skills --agent claude install` as `claude` —\n * lines every one of those commands parses happily once it is reached.\n *\n * Which flags take a value is not known at this level, so the vocabulary decides\n * instead: a word the group dispatches is the subcommand; a word straight after\n * a flag (and not glued to it with `=`) may be that flag's value and is passed\n * over. When no word is a known subcommand, the first word is returned as\n * before, so a typo — `rebase db psuh`, `rebase db --dry-run psuh` — still\n * reaches the group and is refused by name. A command with no vocabulary keeps\n * the first word.\n *\n * Exported for its tests.\n */\nexport function resolveSubcommand(after: readonly string[], known: readonly string[]): string | undefined {\n const words = after.filter(token => !token.startsWith(\"-\"));\n if (known.length === 0) return words[0];\n for (let i = 0; i < after.length; i++) {\n const token = after[i];\n if (token.startsWith(\"-\")) continue;\n if (known.includes(token)) return token;\n const previous = after[i - 1];\n const mayBeAValue = previous !== undefined && previous.startsWith(\"-\") && !previous.includes(\"=\");\n if (!mayBeAValue) return token;\n }\n return words[0];\n}\n\n/**\n * The command and subcommand words as `cli.error` may send them: each one is a\n * word this CLI dispatches, `\"none\"` when nothing was typed, or `\"other\"`.\n *\n * The words come from what was typed, and what is typed after a command is\n * only sometimes a subcommand. `rebase init acme-payroll-internal`, `rebase\n * cloud --project acme-prod deploy` and `rebase db psuh` put a project name, a\n * slug and a typo in the subcommand's position — the consent screen promises\n * \"never project names\", and `sanitize` cannot tell one of those from a\n * subcommand because neither has a separator in it. So the words are held\n * against the vocabulary here, where it is known, and nothing else survives.\n *\n * Exported for `cli.test.ts`.\n */\nexport async function telemetryCommandWords(\n command: string | undefined,\n subcommand: string | undefined\n): Promise<{ command: string; subcommand: string }> {\n if (!command) return { command: \"none\", subcommand: \"none\" };\n const dispatched = namespacedCommands.includes(command) || command === \"__dev-db-daemon\";\n if (!dispatched) return { command: \"other\", subcommand: subcommand ? \"other\" : \"none\" };\n\n if (!subcommand) return { command, subcommand: \"none\" };\n if (subcommand === \"--help\") return { command, subcommand };\n const { subcommands, aliases } = await commandVocabulary(command);\n const canonical = aliases[subcommand] ?? subcommand;\n return { command, subcommand: subcommands.includes(canonical) ? canonical : \"other\" };\n}\n\nexport async function entry(args: string[]) {\n silenceDotenvBanner();\n\n const parsedArgs = arg(\n { ...ROOT_FLAGS },\n {\n argv: args.slice(2),\n permissive: true\n }\n );\n\n if (parsedArgs[\"--version\"]) {\n console.log(cliVersion());\n return;\n }\n\n // `permissive: true` is load-bearing here — each command parses its own\n // flags, so this parser must pass anything it does not recognise through\n // rather than reject it. The cost is that `arg` puts those flags into `_`,\n // mixed in with the positionals: for `rebase cloud --json storage create`,\n // `_` is [\"cloud\", \"--json\", \"storage\", \"create\"] and the subcommand read as\n // \"--json\". Skip the flags when naming the command and its subcommand.\n //\n // A flag that takes a value leaves the value behind as a bare token, and\n // which flags take values is a fact only the individual command knows — for\n // `db` and `schema`, only the database driver's own CLI. So the subcommand\n // is named against the group's vocabulary instead: see `resolveSubcommand`.\n // `cloud` resolves its own group and action against the family's flag\n // specs — `positionals()` in commands/cloud/index.ts.\n const commandAt = parsedArgs._.findIndex(a => !a.startsWith(\"-\"));\n const command = commandAt === -1 ? undefined : parsedArgs._[commandAt];\n const subcommand = command === undefined\n ? undefined\n : resolveSubcommand(parsedArgs._.slice(commandAt + 1), (await commandVocabulary(command)).subcommands);\n\n // Show global help only when no command given, or --help with no recognized command\n if (!command || (parsedArgs[\"--help\"] && !namespacedCommands.includes(command))) {\n printHelp();\n return;\n }\n\n // For a namespaced command, `--help` becomes the subcommand *only when the\n // user did not name one*. `rebase db --help` wants the db help; `rebase\n // cloud env --help` wants env's, and overwriting \"env\" with \"--help\" was\n // what made every `rebase cloud <group> --help` print the same index page —\n // the group never reached the dispatcher. Seven cloud modules declare their\n // own `\"--help\": Boolean` and none of it could run, so ~44 flags had no way\n // to be listed.\n //\n // A group still gets its `--help` in `rawArgs` either way, so a handler that\n // parses its own flags sees the request whichever branch this takes.\n const effectiveSubcommand = parsedArgs[\"--help\"] && !subcommand ? \"--help\" : subcommand;\n\n try {\n await dispatch(command, effectiveSubcommand, args, parsedArgs, namespacedCommands);\n } catch (error) {\n // What failed, never why. `cli.error` records the command that threw and\n // a classification of the error — never its message, and never anything\n // derived from one. The consent screen promises \"no project names,\n // paths, schemas, URLs or error messages\", and a failure is exactly\n // where those leak: a message is usually a path, a connection string or\n // a column name. Which command fails, and how often, is the signal\n // worth having and costs none of that.\n //\n // The classification is `errorClass`, not `error.constructor.name`.\n // Both are safe, but the constructor name is almost always the useless\n // half of the answer: Node reports a refused connection, a missing file\n // and a permission denial all as plain `Error` carrying a `code`, so\n // every ECONNREFUSED, ENOENT and EACCES arrived here as the word\n // \"Error\" and the one question this event exists to answer — what is\n // actually going wrong out there — had no answer in the data.\n // `errorClass` prefers the `code` and falls back to the name, and it\n // is already the classifier the payload contract is written around.\n //\n // `recordEvent` is fire-and-forget and swallows its own failures, but it\n // is awaited so a short-lived CLI does not exit before the request is\n // made. The error is re-thrown untouched — `bin/rebase.js` owns how a\n // failure is printed and what the exit code is.\n //\n // The command words go through `telemetryCommandWords`, never raw: a\n // word typed after a command is as often a project name or a typo as a\n // subcommand, and neither has a separator for `sanitize` to catch.\n await recordEvent(\"cli.error\", {\n ...(await telemetryCommandWords(command, effectiveSubcommand)),\n error_type: errorClass(error),\n usage: Boolean(error && typeof error === \"object\" && (error as { isUsageError?: unknown }).isUsageError)\n }, { projectRoot: process.cwd() });\n // The one failure printed here rather than by `bin/rebase.js`: a caller\n // that asked for `--json` is promised one JSON value on stdout on every\n // exit, and a mistyped flag (`rebase status --json --bogus`) left stdout\n // empty — an agent parsing it unconditionally got an empty-input error\n // instead of the reason.\n if (error instanceof UsageError && wantsJsonOutput(args)) {\n failAsJson(error.message, \"usage\", `Run \\`rebase ${command} --help\\` for the flags it takes.`);\n }\n throw error;\n }\n}\n\n/**\n * The dispatch, lifted out of {@link entry} so the whole of it sits inside one\n * `try`. Inlining the switch there would have put the `catch` around the flag\n * parsing too, which throws its own usage errors before a command is even named.\n *\n * Each command's module is imported here, when its command runs. Imported at\n * the top of this file, every invocation (`rebase --version` and `--help`\n * included, and the CLI `rebase dev` re-runs for itself) loaded all of them:\n * inquirer, execa, the SDK client, the code generator and the server\n * packages, 231 modules and 125–144 ms before the first line of output.\n */\nasync function dispatch(\n command: string | undefined,\n effectiveSubcommand: string | undefined,\n args: string[],\n parsedArgs: Record<string, unknown>,\n namespacedCommands: string[]\n): Promise<void> {\n switch (command) {\n // Hidden: the managed development database's own process, spawned by\n // `ensureManagedDatabase` re-invoking this CLI. Not in\n // `namespacedCommands` and not in the help, because it is never typed\n // by a person — it exists so the daemon resolves the same way from\n // `src` under tsx and from a bundled `dist`.\n case \"__dev-db-daemon\": {\n const { parseDaemonArgs, runDaemon } = await import(\"./dev-db/daemon-entry\");\n await runDaemon(parseDaemonArgs(args));\n // Deliberately no `break`-and-return: the daemon owns this process\n // from here and exits through its own signal handlers.\n return;\n }\n\n case \"init\": {\n const { createRebaseApp } = await import(\"./commands/init\");\n await createRebaseApp(args);\n break;\n }\n\n case \"generate-sdk\": {\n // Strict, and parsed from the whole line rather than `slice(3)`.\n // Permissive parsing turned a typo into silence: `rebase\n // generate-sdk --ouput ./sdk` wrote the SDK to the default path and\n // said nothing, so the next build imported a stale one. And the\n // fixed slice meant `rebase --debug generate-sdk -o ./sdk` read\n // `generate-sdk` as the first token of the flag line, dropping the\n // flags entirely. `parseCommandArgs` fixes both: it consumes flags\n // wherever they appear and rejects the ones nobody declared.\n const { flags: sdkArgs, help: sdkHelp } = parseCommandArgs({\n spec: {\n // `--collections`, as every other command spells it; the\n // older name stays an alias.\n \"--collections\": String,\n \"--collections-dir\": \"--collections\",\n \"--output\": String,\n // The alias `build`, `cloud env pull` and `db backup` carry.\n // Two names for one concept across one CLI is a thing you\n // have to remember rather than know.\n \"--out\": \"--output\",\n \"--from\": String,\n \"--token\": String,\n \"--register\": Boolean,\n \"-c\": \"--collections\",\n \"-o\": \"--output\"\n },\n rawArgs: args,\n commandWords: 1,\n command: \"generate-sdk\",\n maxPositionals: 0\n });\n // Defaults hang off the project root, not the cwd. `./config/\n // collections` relative to wherever you happen to be standing meant\n // `rebase generate-sdk` worked from the repository root and threw\n // \"Collections directory not found\" one directory down — from\n // `backend/`, from `frontend/`, from anywhere a developer actually\n // sits — while `rebase db push` and `rebase dev` worked from all of\n // them. An explicitly passed path still resolves against the cwd,\n // which is where the person typing it means it.\n const sdkRoot = sdkHelp ? process.cwd() : requireProjectRoot();\n const { generateSdkCommand } = await import(\"./commands/generate_sdk\");\n await generateSdkCommand({\n collectionsDir: sdkArgs[\"--collections\"]\n || (sdkHelp ? path.join(sdkRoot, \"config/collections\") : (await import(\"./utils/collections-dir\")).resolveCollectionsDir(sdkRoot)),\n output: sdkArgs[\"--output\"] || path.join(sdkRoot, \"generated/sdk\"),\n from: sdkArgs[\"--from\"],\n token: sdkArgs[\"--token\"],\n register: sdkArgs[\"--register\"],\n projectRoot: sdkHelp ? undefined : sdkRoot,\n help: sdkHelp,\n cwd: process.cwd()\n });\n break;\n }\n\n case \"schema\": {\n const { schemaCommand } = await import(\"./commands/schema\");\n await schemaCommand(effectiveSubcommand, args);\n break;\n }\n\n case \"db\": {\n const { dbCommand } = await import(\"./commands/db\");\n await dbCommand(effectiveSubcommand, args);\n break;\n }\n\n case \"console\": {\n const { consoleCommand } = await import(\"./commands/console\");\n await consoleCommand(args);\n break;\n }\n\n case \"dev\": {\n const { devCommand } = await import(\"./commands/dev\");\n await devCommand(args);\n break;\n }\n\n case \"normalize-imports\": {\n const { normalizeImportsCommand } = await import(\"./commands/normalize-imports\");\n await normalizeImportsCommand(args);\n break;\n }\n case \"build\": {\n const { buildCommand } = await import(\"./commands/build\");\n await buildCommand(args);\n break;\n }\n\n case \"start\": {\n const { startCommand } = await import(\"./commands/start\");\n await startCommand(args);\n break;\n }\n\n case \"upgrade\": {\n const { upgradeCommand } = await import(\"./commands/upgrade\");\n await upgradeCommand(args);\n break;\n }\n\n case \"apps\": {\n const { appsCommand } = await import(\"./commands/apps\");\n await appsCommand(effectiveSubcommand, args);\n break;\n }\n\n case \"generate\": {\n const { generateCommand } = await import(\"./commands/generate-view\");\n await generateCommand(effectiveSubcommand, args);\n break;\n }\n\n case \"eject\": {\n const { ejectCommand } = await import(\"./commands/eject\");\n await ejectCommand(args);\n break;\n }\n\n case \"auth\": {\n const { authCommand } = await import(\"./commands/auth\");\n await authCommand(effectiveSubcommand, args);\n break;\n }\n\n case \"status\": {\n const { statusCommand } = await import(\"./commands/status\");\n await statusCommand(args);\n break;\n }\n case \"resources\": {\n const { resourcesCommand } = await import(\"./commands/resources\");\n await resourcesCommand(args);\n break;\n }\n case \"doctor\": {\n const { doctorCommand } = await import(\"./commands/doctor\");\n await doctorCommand(args);\n break;\n }\n\n case \"verify\": {\n const { verifyCommand } = await import(\"./commands/verify\");\n await verifyCommand(args);\n break;\n }\n\n case \"skills\": {\n const { skillsCommand } = await import(\"./commands/skills\");\n await skillsCommand(effectiveSubcommand, args);\n break;\n }\n\n case \"api-keys\": {\n const { apiKeysCommand } = await import(\"./commands/api-keys\");\n await apiKeysCommand(effectiveSubcommand, args);\n break;\n }\n\n case \"storage\": {\n const { storageCommand } = await import(\"./commands/storage\");\n await storageCommand(effectiveSubcommand, args);\n break;\n }\n\n case \"cloud\": {\n const { cloudCommand } = await import(\"./commands/cloud\");\n await cloudCommand(effectiveSubcommand, args);\n break;\n }\n\n case \"telemetry\": {\n const { telemetryCommand } = await import(\"./commands/telemetry\");\n await telemetryCommand(args);\n break;\n }\n\n default:\n // One line, with the correction, and no screen of help after it: the\n // sentence that says what happened must not scroll off the top of a\n // CI log. `namespacedCommands` is the dispatch itself, so the\n // suggestion can never name a command that is not there.\n //\n // A mistyped command must not look like success to a shell or CI.\n //\n // And a word that is a whole cloud command — `rebase deploy` — is\n // named as one: `cloud deploy`.\n unknownCommand(command, namespacedCommands, \"\", { cloud: (await import(\"./commands/cloud\")).CLOUD_GROUP_NAMES });\n }\n}\n\n/** The global help. Exported so its Options block can be held against {@link ROOT_FLAGS}. */\nexport function printHelp() {\n console.log(`\n${chalk.bold(\"Rebase CLI\")} — Developer tools for Rebase projects\n\n${chalk.green.bold(\"Usage\")}\n rebase ${chalk.blue(\"<command>\")} [options]\n\n${chalk.green.bold(\"Commands\")}\n ${chalk.blue.bold(\"init\")} Create a new Rebase project\n ${chalk.blue.bold(\"dev\")} Start the development server\n ${chalk.blue.bold(\"build\")} Build the apps declared in rebase.json into a bundle\n ${chalk.blue.bold(\"normalize-imports\")} Complete compiled output's relative imports for Node ESM\n ${chalk.blue.bold(\"start\")} Run the built bundle, as a deployment does ${chalk.gray(\"(in the NODE_ENV you set)\")}\n ${chalk.blue.bold(\"upgrade\")} Move every @rebasepro package to one release, then install\n ${chalk.blue.bold(\"apps list\")} Show the apps this repository declares\n\n${chalk.green.bold(\"Schema\")}\n ${chalk.blue.bold(\"schema generate\")} Generate Drizzle schema from collections\n ${chalk.blue.bold(\"schema introspect\")} Introspect database → Rebase collections\n ${chalk.blue.bold(\"schema stale\")} Report generated schema files the collections have moved past\n ${chalk.blue.bold(\"schema\")} ${chalk.gray(\"--help\")} Show schema command help\n\n${chalk.green.bold(\"Database\")}\n ${chalk.blue.bold(\"db push\")} Apply schema directly to database ${chalk.gray(\"(dev)\")}\n ${chalk.blue.bold(\"db generate\")} Generate SQL migration files\n ${chalk.blue.bold(\"db migrate\")} Run pending migrations\n ${chalk.blue.bold(\"db pull\")} Copy another database into local development\n ${chalk.blue.bold(\"db branch\")} Create, list, switch and delete database branches\n ${chalk.blue.bold(\"db stop\")} Stop the managed development database ${chalk.gray(\"(data is kept)\")}\n ${chalk.blue.bold(\"db reset\")} Delete the managed development database and start over\n ${chalk.blue.bold(\"db\")} ${chalk.gray(\"--help\")} Backup, restore, and every flag\n\n${chalk.green.bold(\"Explore\")}\n ${chalk.blue.bold(\"console\")} A REPL with the project's data in scope ${chalk.gray(\"(-e <code> runs one snippet)\")}\n\n${chalk.green.bold(\"Generate\")}\n ${chalk.blue.bold(\"generate view\")} ${chalk.gray(\"<slug>\")} Scaffold a custom admin screen ${chalk.gray(\"(--collection: a record tab)\")}\n ${chalk.blue.bold(\"generate-sdk\")} Generate a typed TypeScript SDK from collections\n\n${chalk.green.bold(\"Auth\")}\n ${chalk.blue.bold(\"auth reset-password\")} Reset a user's password\n ${chalk.blue.bold(\"auth\")} ${chalk.gray(\"--help\")} Show auth command help\n\n${chalk.green.bold(\"Diagnostics\")}\n ${chalk.blue.bold(\"status\")} Show every resource and whether its variables are set\n ${chalk.blue.bold(\"doctor\")} Detect schema drift between collections, schema, and DB\n ${chalk.blue.bold(\"verify\")} Check collections, RLS coverage and migrations ${chalk.gray(\"(CI + agent hooks)\")}\n ${chalk.blue.bold(\"resources\")} List the databases, buckets and topics this project declares\n\n${chalk.green.bold(\"Take ownership\")}\n ${chalk.blue.bold(\"eject\")} Own the server process and the image ${chalk.gray(\"(one-way)\")}\n\n${chalk.green.bold(\"AI Agent Skills\")}\n ${chalk.blue.bold(\"skills install\")} Install Rebase agent skills for your AI coding assistant\n\n${chalk.green.bold(\"API Keys\")}\n ${chalk.blue.bold(\"api-keys list\")} List the service API keys: kind, scopes, roles\n ${chalk.blue.bold(\"api-keys get\")} ${chalk.gray(\"<id>\")} Show one key\n ${chalk.blue.bold(\"api-keys create\")} Create a service key holding the scopes you name\n ${chalk.blue.bold(\"api-keys revoke\")} Revoke an API key\n ${chalk.blue.bold(\"api-keys scopes\")} List the scopes a key can hold\n ${chalk.blue.bold(\"api-keys\")} ${chalk.gray(\"--help\")} Show API key command help\n\n${chalk.green.bold(\"Stored files\")}\n ${chalk.blue.bold(\"storage orphans\")} List the stored files no row names ${chalk.gray(\"(--delete to delete)\")}\n ${chalk.blue.bold(\"storage move\")} Copy a folder of files to another storage source\n\n${chalk.green.bold(\"Usage sharing\")}\n ${chalk.blue.bold(\"telemetry\")} Anonymous usage sharing (opt-in, off by default)\n\n${chalk.green.bold(\"Rebase Cloud\")}\n ${chalk.blue.bold(\"cloud login\")} Sign in to the hosted control plane\n ${chalk.blue.bold(\"cloud link\")} Link this directory to a cloud project\n ${chalk.blue.bold(\"cloud deploy\")} Deploy the linked project + stream logs\n ${chalk.blue.bold(\"cloud tokens create\")} A token for CI and agents ${chalk.gray(\"(used as REBASE_TOKEN)\")}\n ${chalk.blue.bold(\"cloud\")} ${chalk.gray(\"--help\")} Show all cloud commands\n\n${chalk.green.bold(\"Options\")}\n ${chalk.blue(\"--version, -v\")} Show version number\n ${chalk.blue(\"--help, -h\")} Show this help message\n ${chalk.blue(\"--debug\")} Print the stack trace when a command fails ${chalk.gray(\"(or REBASE_DEBUG=1)\")}\n\n${chalk.gray(\"Documentation: https://rebase.pro/docs\")}\n${telemetryNotice()}`);\n}\n\n/**\n * One line about usage sharing, in the global help.\n *\n * Every other tool that collects anything prints a first-run notice. Ours asks\n * at the end of `rebase init` — but someone who installs the CLI and never runs\n * `init`, or who joins a project someone else scaffolded, would otherwise never\n * learn the subsystem exists. This is the cheapest place to close that: the\n * help is what an unfamiliar user reads first.\n *\n * It states the current setting rather than a generic sentence, so it is also\n * the fastest answer to \"is this thing on?\".\n */\nfunction telemetryNotice(): string {\n const sharing = isEnabled();\n return chalk.gray(\n `Usage sharing: ${sharing ? \"on\" : \"off\"} — ${chalk.cyan(\"rebase telemetry\")} to inspect or change\\n`\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAuBA,SAAS,sBAA4B;CACjC,IAAI,QAAQ,IAAI,wBAAwB,KAAA,GACpC,QAAQ,IAAI,sBAAsB;AAE1C;;;;;;;;;;;;;;AAeA,IAAa,aAAa;CACtB,aAAa;CACb,UAAU;CACV,WAAW;CACX,MAAM;CACN,MAAM;AACV;;;;;;AAOA,IAAM,qBAAqB;CAAC;CAAQ;CAAU;CAAM;CAAW;CAAO;CAAS;CAAS;CAAQ;CAAU;CAAU;CAAU;CAAY;CAAW;CAAS;CAAQ;CAAS;CAAY;CAAgB;CAAa;CAAa;CAAU;CAAW;AAAmB;AAQ7Q,IAAM,gBAAmC;CAAE,aAAa,CAAC;CAAG,SAAS,CAAC;AAAE;;;;;;;;;;AAWxE,eAAe,kBAAkB,SAA6C;CAC1E,QAAQ,SAAR;EACI,KAAK,UAAU,OAAO;GAAE,cAAc,MAAM,OAAO,wBAAA,CAAsB;GAAoB,SAAS,CAAC;EAAE;EACzG,KAAK,MAAM,OAAO;GAAE,cAAc,MAAM,OAAO,oBAAA,CAAkB;GAAgB,SAAS,CAAC;EAAE;EAC7F,KAAK,QAAQ,OAAO;GAAE,cAAc,MAAM,OAAO,sBAAA,CAAoB;GAAkB,SAAS,CAAC;EAAE;EACnG,KAAK,UAAU,OAAO;GAAE,cAAc,MAAM,OAAO,wBAAA,CAAsB;GAAoB,SAAS,CAAC;EAAE;EACzG,KAAK,YAAY,OAAO;GAAE,cAAc,MAAM,OAAO,yBAAA,CAAA,MAAA,MAAA,EAAA,CAAA,EAAA,CAAwB;GAAsB,SAAS,CAAC;E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AAM,KAAK,wCAAwC,EAAE;EACrD,gBAAgB,GAAG;AACrB;;;;;;;;;;;;;AAcA,SAAS,kBAA0B;CAC/B,MAAM,UAAU,UAAU;CAC1B,OAAO,MAAM,KACT,kBAAkB,UAAU,OAAO,MAAM,KAAK,MAAM,KAAK,kBAAkB,EAAE,wBACjF;AACJ"}
1
+ {"version":3,"file":"index.es.js","names":[],"sources":["../src/cli.ts"],"sourcesContent":["import chalk from \"chalk\";\nimport arg from \"arg\";\nimport { errorClass, isEnabled, recordEvent } from \"./telemetry\";\nimport { failAsJson, requireProjectRoot, wantsJsonOutput } from \"./utils/project\";\nimport { parseCommandArgs, UsageError } from \"./utils/args\";\nimport { refuseRemovedCollectionsFlag } from \"./utils/path-flags\";\nimport { unknownCommand } from \"./utils/unknown-command\";\nimport { cliVersion } from \"./utils/version\";\nimport path from \"path\";\n\n/**\n * Silence dotenv's own banner, for this process and everything it spawns.\n *\n * dotenv 17 prints `injected env (13) from .env // tip: ◈ encrypted .env\n * [www.dotenvx.com]` on every `config()` — a third-party advertisement that\n * appeared in `rebase dev`, `rebase build` and, because `rebase start` loads\n * the same way, in production server logs. `DOTENV_CONFIG_QUIET` is dotenv's\n * documented switch (`lib/main.js` reads it before `options.quiet`), and\n * setting it in `process.env` also reaches the backend, Vite and Atlas child\n * processes, which inherit it. Errors are unaffected — `quiet` gates the\n * success banner only.\n *\n * Not forced: an explicit `DOTENV_CONFIG_QUIET=false` still turns it back on.\n */\nfunction silenceDotenvBanner(): void {\n if (process.env.DOTENV_CONFIG_QUIET === undefined) {\n process.env.DOTENV_CONFIG_QUIET = \"true\";\n }\n}\n\n/**\n * The flags that mean the same thing wherever they appear.\n *\n * `--debug` is in here even though this file does not act on it: it is\n * implemented one level up, in `bin/rebase.js`, which prints the stack of a\n * failed command instead of the one-line message. That is exactly why it went\n * missing from the help for as long as it did — the flag lived in the\n * launcher, the Options block lived here, and neither knew about the other.\n * Declaring it here puts both under one spec, which `cli.test.ts` holds\n * against the printed help.\n *\n * Exported for that test.\n */\nexport const ROOT_FLAGS = {\n \"--version\": Boolean,\n \"--help\": Boolean,\n \"--debug\": Boolean,\n \"-v\": \"--version\",\n \"-h\": \"--help\"\n} as const;\n\n/**\n * Every command the dispatch below answers and the help lists. Declared as a\n * literal under this name: `help-coverage.test.ts`, `printed-commands.test.ts`\n * and the docs verifier read it out of this file's source.\n */\nconst namespacedCommands = [\"init\", \"schema\", \"db\", \"console\", \"dev\", \"build\", \"start\", \"auth\", \"doctor\", \"verify\", \"skills\", \"api-keys\", \"storage\", \"cloud\", \"apps\", \"eject\", \"generate\", \"generate-sdk\", \"telemetry\", \"resources\", \"status\", \"upgrade\", \"migrate\", \"normalize-imports\"];\n\n/** The words a command group dispatches, and the other spellings it accepts for them. */\ninterface CommandVocabulary {\n subcommands: readonly string[];\n aliases: Readonly<Record<string, string>>;\n}\n\nconst NO_VOCABULARY: CommandVocabulary = { subcommands: [], aliases: {} };\n\n/**\n * The subcommands each command group dispatches, from the lists those groups\n * dispatch on. A command absent from here takes no subcommand.\n *\n * Read from the group's own module, which is loaded here rather than at\n * startup: every command module is imported when its command runs (see\n * {@link dispatch}), and this is only ever asked about the command being run,\n * whose module the dispatch is about to load anyway.\n */\nasync function commandVocabulary(command: string): Promise<CommandVocabulary> {\n switch (command) {\n case \"schema\": return { subcommands: (await import(\"./commands/schema\")).SCHEMA_SUBCOMMANDS, aliases: {} };\n case \"db\": return { subcommands: (await import(\"./commands/db\")).DB_SUBCOMMANDS, aliases: {} };\n case \"auth\": return { subcommands: (await import(\"./commands/auth\")).AUTH_SUBCOMMANDS, aliases: {} };\n case \"skills\": return { subcommands: (await import(\"./commands/skills\")).SKILLS_SUBCOMMANDS, aliases: {} };\n case \"api-keys\": return { subcommands: (await import(\"./commands/api-keys\")).API_KEYS_SUBCOMMANDS, aliases: {} };\n case \"storage\": return { subcommands: (await import(\"./commands/storage\")).STORAGE_SUBCOMMANDS, aliases: {} };\n case \"apps\": return { subcommands: (await import(\"./commands/apps\")).APPS_SUBCOMMANDS, aliases: {} };\n case \"telemetry\": return { subcommands: (await import(\"./commands/telemetry\")).TELEMETRY_SUBCOMMANDS, aliases: {} };\n case \"generate\": return { subcommands: (await import(\"./commands/generate-view\")).GENERATE_SUBCOMMANDS, aliases: {} };\n case \"migrate\": return { subcommands: (await import(\"./commands/migrate\")).MIGRATE_SUBCOMMANDS, aliases: {} };\n case \"cloud\": {\n const cloud = await import(\"./commands/cloud\");\n return { subcommands: cloud.CLOUD_GROUP_NAMES, aliases: cloud.GROUP_ALIASES };\n }\n default: return NO_VOCABULARY;\n }\n}\n\n/**\n * The subcommand in the words after a command, read against the subcommands the\n * group dispatches.\n *\n * The first word that is not a flag is not always the subcommand: after a flag\n * that takes a value it is that value. `rebase db --schema-dir ./s push` was\n * refused as an unknown db command `./s`, `rebase api-keys --name ci create` as\n * one called `ci`, and `rebase skills --agent claude install` as `claude` —\n * lines every one of those commands parses happily once it is reached.\n *\n * Which flags take a value is not known at this level, so the vocabulary decides\n * instead: a word the group dispatches is the subcommand; a word straight after\n * a flag (and not glued to it with `=`) may be that flag's value and is passed\n * over. When no word is a known subcommand, the first word is returned as\n * before, so a typo — `rebase db psuh`, `rebase db --dry-run psuh` — still\n * reaches the group and is refused by name. A command with no vocabulary keeps\n * the first word.\n *\n * Exported for its tests.\n */\nexport function resolveSubcommand(after: readonly string[], known: readonly string[]): string | undefined {\n const words = after.filter(token => !token.startsWith(\"-\"));\n if (known.length === 0) return words[0];\n for (let i = 0; i < after.length; i++) {\n const token = after[i];\n if (token.startsWith(\"-\")) continue;\n if (known.includes(token)) return token;\n const previous = after[i - 1];\n const mayBeAValue = previous !== undefined && previous.startsWith(\"-\") && !previous.includes(\"=\");\n if (!mayBeAValue) return token;\n }\n return words[0];\n}\n\n/**\n * The command and subcommand words as `cli.error` may send them: each one is a\n * word this CLI dispatches, `\"none\"` when nothing was typed, or `\"other\"`.\n *\n * The words come from what was typed, and what is typed after a command is\n * only sometimes a subcommand. `rebase init acme-payroll-internal`, `rebase\n * cloud --project acme-prod deploy` and `rebase db psuh` put a project name, a\n * slug and a typo in the subcommand's position — the consent screen promises\n * \"never project names\", and `sanitize` cannot tell one of those from a\n * subcommand because neither has a separator in it. So the words are held\n * against the vocabulary here, where it is known, and nothing else survives.\n *\n * Exported for `cli.test.ts`.\n */\nexport async function telemetryCommandWords(\n command: string | undefined,\n subcommand: string | undefined\n): Promise<{ command: string; subcommand: string }> {\n if (!command) return { command: \"none\", subcommand: \"none\" };\n const dispatched = namespacedCommands.includes(command) || command === \"__dev-db-daemon\";\n if (!dispatched) return { command: \"other\", subcommand: subcommand ? \"other\" : \"none\" };\n\n if (!subcommand) return { command, subcommand: \"none\" };\n if (subcommand === \"--help\") return { command, subcommand };\n const { subcommands, aliases } = await commandVocabulary(command);\n const canonical = aliases[subcommand] ?? subcommand;\n return { command, subcommand: subcommands.includes(canonical) ? canonical : \"other\" };\n}\n\nexport async function entry(args: string[]) {\n silenceDotenvBanner();\n\n const parsedArgs = arg(\n { ...ROOT_FLAGS },\n {\n argv: args.slice(2),\n permissive: true\n }\n );\n\n if (parsedArgs[\"--version\"]) {\n console.log(cliVersion());\n return;\n }\n\n // `permissive: true` is load-bearing here — each command parses its own\n // flags, so this parser must pass anything it does not recognise through\n // rather than reject it. The cost is that `arg` puts those flags into `_`,\n // mixed in with the positionals: for `rebase cloud --json storage create`,\n // `_` is [\"cloud\", \"--json\", \"storage\", \"create\"] and the subcommand read as\n // \"--json\". Skip the flags when naming the command and its subcommand.\n //\n // A flag that takes a value leaves the value behind as a bare token, and\n // which flags take values is a fact only the individual command knows — for\n // `db` and `schema`, only the database driver's own CLI. So the subcommand\n // is named against the group's vocabulary instead: see `resolveSubcommand`.\n // `cloud` resolves its own group and action against the family's flag\n // specs — `positionals()` in commands/cloud/index.ts.\n const commandAt = parsedArgs._.findIndex(a => !a.startsWith(\"-\"));\n const command = commandAt === -1 ? undefined : parsedArgs._[commandAt];\n const subcommand = command === undefined\n ? undefined\n : resolveSubcommand(parsedArgs._.slice(commandAt + 1), (await commandVocabulary(command)).subcommands);\n\n // Show global help only when no command given, or --help with no recognized command\n if (!command || (parsedArgs[\"--help\"] && !namespacedCommands.includes(command))) {\n printHelp();\n return;\n }\n\n // For a namespaced command, `--help` becomes the subcommand *only when the\n // user did not name one*. `rebase db --help` wants the db help; `rebase\n // cloud env --help` wants env's, and overwriting \"env\" with \"--help\" was\n // what made every `rebase cloud <group> --help` print the same index page —\n // the group never reached the dispatcher. Seven cloud modules declare their\n // own `\"--help\": Boolean` and none of it could run, so ~44 flags had no way\n // to be listed.\n //\n // A group still gets its `--help` in `rawArgs` either way, so a handler that\n // parses its own flags sees the request whichever branch this takes.\n const effectiveSubcommand = parsedArgs[\"--help\"] && !subcommand ? \"--help\" : subcommand;\n\n try {\n await dispatch(command, effectiveSubcommand, args, parsedArgs, namespacedCommands);\n } catch (error) {\n // What failed, never why. `cli.error` records the command that threw and\n // a classification of the error — never its message, and never anything\n // derived from one. The consent screen promises \"no project names,\n // paths, schemas, URLs or error messages\", and a failure is exactly\n // where those leak: a message is usually a path, a connection string or\n // a column name. Which command fails, and how often, is the signal\n // worth having and costs none of that.\n //\n // The classification is `errorClass`, not `error.constructor.name`.\n // Both are safe, but the constructor name is almost always the useless\n // half of the answer: Node reports a refused connection, a missing file\n // and a permission denial all as plain `Error` carrying a `code`, so\n // every ECONNREFUSED, ENOENT and EACCES arrived here as the word\n // \"Error\" and the one question this event exists to answer — what is\n // actually going wrong out there — had no answer in the data.\n // `errorClass` prefers the `code` and falls back to the name, and it\n // is already the classifier the payload contract is written around.\n //\n // `recordEvent` is fire-and-forget and swallows its own failures, but it\n // is awaited so a short-lived CLI does not exit before the request is\n // made. The error is re-thrown untouched — `bin/rebase.js` owns how a\n // failure is printed and what the exit code is.\n //\n // The command words go through `telemetryCommandWords`, never raw: a\n // word typed after a command is as often a project name or a typo as a\n // subcommand, and neither has a separator for `sanitize` to catch.\n await recordEvent(\"cli.error\", {\n ...(await telemetryCommandWords(command, effectiveSubcommand)),\n error_type: errorClass(error),\n usage: Boolean(error && typeof error === \"object\" && (error as { isUsageError?: unknown }).isUsageError)\n }, { projectRoot: process.cwd() });\n // The one failure printed here rather than by `bin/rebase.js`: a caller\n // that asked for `--json` is promised one JSON value on stdout on every\n // exit, and a mistyped flag (`rebase status --json --bogus`) left stdout\n // empty — an agent parsing it unconditionally got an empty-input error\n // instead of the reason.\n if (error instanceof UsageError && wantsJsonOutput(args)) {\n failAsJson(error.message, \"usage\", `Run \\`rebase ${command} --help\\` for the flags it takes.`);\n }\n throw error;\n }\n}\n\n/**\n * The dispatch, lifted out of {@link entry} so the whole of it sits inside one\n * `try`. Inlining the switch there would have put the `catch` around the flag\n * parsing too, which throws its own usage errors before a command is even named.\n *\n * Each command's module is imported here, when its command runs. Imported at\n * the top of this file, every invocation (`rebase --version` and `--help`\n * included, and the CLI `rebase dev` re-runs for itself) loaded all of them:\n * inquirer, execa, the SDK client, the code generator and the server\n * packages, 231 modules and 125–144 ms before the first line of output.\n */\nasync function dispatch(\n command: string | undefined,\n effectiveSubcommand: string | undefined,\n args: string[],\n parsedArgs: Record<string, unknown>,\n namespacedCommands: string[]\n): Promise<void> {\n switch (command) {\n // Hidden: the managed development database's own process, spawned by\n // `ensureManagedDatabase` re-invoking this CLI. Not in\n // `namespacedCommands` and not in the help, because it is never typed\n // by a person — it exists so the daemon resolves the same way from\n // `src` under tsx and from a bundled `dist`.\n case \"__dev-db-daemon\": {\n const { parseDaemonArgs, runDaemon } = await import(\"./dev-db/daemon-entry\");\n await runDaemon(parseDaemonArgs(args));\n // Deliberately no `break`-and-return: the daemon owns this process\n // from here and exits through its own signal handlers.\n return;\n }\n\n case \"init\": {\n const { createRebaseApp } = await import(\"./commands/init\");\n await createRebaseApp(args);\n break;\n }\n\n case \"generate-sdk\": {\n // Strict, and parsed from the whole line rather than `slice(3)`.\n // Permissive parsing turned a typo into silence: `rebase\n // generate-sdk --ouput ./sdk` wrote the SDK to the default path and\n // said nothing, so the next build imported a stale one. And the\n // fixed slice meant `rebase --debug generate-sdk -o ./sdk` read\n // `generate-sdk` as the first token of the flag line, dropping the\n // flags entirely. `parseCommandArgs` fixes both: it consumes flags\n // wherever they appear and rejects the ones nobody declared.\n refuseRemovedCollectionsFlag(args.slice(2), \"generate-sdk\");\n const { flags: sdkArgs, help: sdkHelp } = parseCommandArgs({\n spec: {\n // `--schema-dir`, as every command that reads the tables spells it.\n \"--schema-dir\": String,\n \"--output\": String,\n // The alias `build`, `cloud env pull` and `db backup` carry.\n // Two names for one concept across one CLI is a thing you\n // have to remember rather than know.\n \"--out\": \"--output\",\n \"--from\": String,\n \"--token\": String,\n \"--register\": Boolean,\n \"-o\": \"--output\"\n },\n rawArgs: args,\n commandWords: 1,\n command: \"generate-sdk\",\n maxPositionals: 0\n });\n // Defaults hang off the project root, not the cwd. A default schema\n // directory relative to wherever you happen to be standing meant\n // `rebase generate-sdk` worked from the repository root and threw\n // \"directory not found\" one directory down — from\n // `backend/`, from `frontend/`, from anywhere a developer actually\n // sits — while `rebase db push` and `rebase dev` worked from all of\n // them. An explicitly passed path still resolves against the cwd,\n // which is where the person typing it means it.\n const sdkRoot = sdkHelp ? process.cwd() : requireProjectRoot();\n const { generateSdkCommand } = await import(\"./commands/generate_sdk\");\n await generateSdkCommand({\n schemaDir: sdkArgs[\"--schema-dir\"]\n || (sdkHelp ? sdkRoot : (await import(\"./utils/schema-dir\")).resolveSchemaDir(sdkRoot)),\n output: sdkArgs[\"--output\"] || path.join(sdkRoot, \"generated/sdk\"),\n from: sdkArgs[\"--from\"],\n token: sdkArgs[\"--token\"],\n register: sdkArgs[\"--register\"],\n projectRoot: sdkHelp ? undefined : sdkRoot,\n help: sdkHelp,\n cwd: process.cwd()\n });\n break;\n }\n\n case \"schema\": {\n const { schemaCommand } = await import(\"./commands/schema\");\n await schemaCommand(effectiveSubcommand, args);\n break;\n }\n\n case \"db\": {\n const { dbCommand } = await import(\"./commands/db\");\n await dbCommand(effectiveSubcommand, args);\n break;\n }\n\n case \"console\": {\n const { consoleCommand } = await import(\"./commands/console\");\n await consoleCommand(args);\n break;\n }\n\n case \"dev\": {\n const { devCommand } = await import(\"./commands/dev\");\n await devCommand(args);\n break;\n }\n\n case \"normalize-imports\": {\n const { normalizeImportsCommand } = await import(\"./commands/normalize-imports\");\n await normalizeImportsCommand(args);\n break;\n }\n case \"build\": {\n const { buildCommand } = await import(\"./commands/build\");\n await buildCommand(args);\n break;\n }\n\n case \"start\": {\n const { startCommand } = await import(\"./commands/start\");\n await startCommand(args);\n break;\n }\n\n case \"upgrade\": {\n const { upgradeCommand } = await import(\"./commands/upgrade\");\n await upgradeCommand(args);\n break;\n }\n\n case \"migrate\": {\n const { migrateCommand } = await import(\"./commands/migrate\");\n await migrateCommand(effectiveSubcommand, args);\n break;\n }\n\n case \"apps\": {\n const { appsCommand } = await import(\"./commands/apps\");\n await appsCommand(effectiveSubcommand, args);\n break;\n }\n\n case \"generate\": {\n const { generateCommand } = await import(\"./commands/generate-view\");\n await generateCommand(effectiveSubcommand, args);\n break;\n }\n\n case \"eject\": {\n const { ejectCommand } = await import(\"./commands/eject\");\n await ejectCommand(args);\n break;\n }\n\n case \"auth\": {\n const { authCommand } = await import(\"./commands/auth\");\n await authCommand(effectiveSubcommand, args);\n break;\n }\n\n case \"status\": {\n const { statusCommand } = await import(\"./commands/status\");\n await statusCommand(args);\n break;\n }\n case \"resources\": {\n const { resourcesCommand } = await import(\"./commands/resources\");\n await resourcesCommand(args);\n break;\n }\n case \"doctor\": {\n const { doctorCommand } = await import(\"./commands/doctor\");\n await doctorCommand(args);\n break;\n }\n\n case \"verify\": {\n const { verifyCommand } = await import(\"./commands/verify\");\n await verifyCommand(args);\n break;\n }\n\n case \"skills\": {\n const { skillsCommand } = await import(\"./commands/skills\");\n await skillsCommand(effectiveSubcommand, args);\n break;\n }\n\n case \"api-keys\": {\n const { apiKeysCommand } = await import(\"./commands/api-keys\");\n await apiKeysCommand(effectiveSubcommand, args);\n break;\n }\n\n case \"storage\": {\n const { storageCommand } = await import(\"./commands/storage\");\n await storageCommand(effectiveSubcommand, args);\n break;\n }\n\n case \"cloud\": {\n const { cloudCommand } = await import(\"./commands/cloud\");\n await cloudCommand(effectiveSubcommand, args);\n break;\n }\n\n case \"telemetry\": {\n const { telemetryCommand } = await import(\"./commands/telemetry\");\n await telemetryCommand(args);\n break;\n }\n\n default:\n // One line, with the correction, and no screen of help after it: the\n // sentence that says what happened must not scroll off the top of a\n // CI log. `namespacedCommands` is the dispatch itself, so the\n // suggestion can never name a command that is not there.\n //\n // A mistyped command must not look like success to a shell or CI.\n //\n // And a word that is a whole cloud command — `rebase deploy` — is\n // named as one: `cloud deploy`.\n unknownCommand(command, namespacedCommands, \"\", { cloud: (await import(\"./commands/cloud\")).CLOUD_GROUP_NAMES });\n }\n}\n\n/** The global help. Exported so its Options block can be held against {@link ROOT_FLAGS}. */\nexport function printHelp() {\n console.log(`\n${chalk.bold(\"Rebase CLI\")} — Developer tools for Rebase projects\n\n${chalk.green.bold(\"Usage\")}\n rebase ${chalk.blue(\"<command>\")} [options]\n\n${chalk.green.bold(\"Commands\")}\n ${chalk.blue.bold(\"init\")} Create a new Rebase project\n ${chalk.blue.bold(\"dev\")} Start the development server\n ${chalk.blue.bold(\"build\")} Build the apps declared in rebase.json into a bundle\n ${chalk.blue.bold(\"normalize-imports\")} Complete compiled output's relative imports for Node ESM\n ${chalk.blue.bold(\"start\")} Run the built bundle, as a deployment does ${chalk.gray(\"(in the NODE_ENV you set)\")}\n ${chalk.blue.bold(\"upgrade\")} Move every @rebasepro package to one release, then install\n ${chalk.blue.bold(\"migrate collections-to-tables\")} config/collections → backend/schema, SQL-checked\n ${chalk.blue.bold(\"migrate sdk-calls\")} Rewrite your own code for the table renames (data.table, rule keys)\n ${chalk.blue.bold(\"apps list\")} Show the apps this repository declares\n\n${chalk.green.bold(\"Schema\")}\n ${chalk.blue.bold(\"schema generate\")} Generate the Drizzle schema from backend/schema\n ${chalk.blue.bold(\"schema introspect\")} Introspect database → defineTable modules in backend/schema\n ${chalk.blue.bold(\"schema stale\")} Report generated schema files the tables have moved past\n ${chalk.blue.bold(\"schema\")} ${chalk.gray(\"--help\")} Show schema command help\n\n${chalk.green.bold(\"Database\")}\n ${chalk.blue.bold(\"db push\")} Apply schema directly to database ${chalk.gray(\"(dev)\")}\n ${chalk.blue.bold(\"db generate\")} Generate SQL migration files\n ${chalk.blue.bold(\"db migrate\")} Run pending migrations\n ${chalk.blue.bold(\"db pull\")} Copy another database into local development\n ${chalk.blue.bold(\"db branch\")} Create, list, switch and delete database branches\n ${chalk.blue.bold(\"db stop\")} Stop the managed development database ${chalk.gray(\"(data is kept)\")}\n ${chalk.blue.bold(\"db reset\")} Delete the managed development database and start over\n ${chalk.blue.bold(\"db\")} ${chalk.gray(\"--help\")} Backup, restore, and every flag\n\n${chalk.green.bold(\"Explore\")}\n ${chalk.blue.bold(\"console\")} A REPL with the project's data in scope ${chalk.gray(\"(-e <code> runs one snippet)\")}\n\n${chalk.green.bold(\"Generate\")}\n ${chalk.blue.bold(\"generate view\")} ${chalk.gray(\"<slug>\")} Scaffold a custom admin screen ${chalk.gray(\"(--collection: a record tab)\")}\n ${chalk.blue.bold(\"generate-sdk\")} Generate a typed TypeScript SDK from the tables\n\n${chalk.green.bold(\"Auth\")}\n ${chalk.blue.bold(\"auth reset-password\")} Reset a user's password\n ${chalk.blue.bold(\"auth\")} ${chalk.gray(\"--help\")} Show auth command help\n\n${chalk.green.bold(\"Diagnostics\")}\n ${chalk.blue.bold(\"status\")} Show every resource and whether its variables are set\n ${chalk.blue.bold(\"doctor\")} Detect schema drift between tables, generated schema, and DB\n ${chalk.blue.bold(\"verify\")} Check tables, RLS coverage and migrations ${chalk.gray(\"(CI + agent hooks)\")}\n ${chalk.blue.bold(\"resources\")} List the databases, buckets and topics this project declares\n\n${chalk.green.bold(\"Take ownership\")}\n ${chalk.blue.bold(\"eject\")} Own the server process and the image ${chalk.gray(\"(one-way)\")}\n\n${chalk.green.bold(\"AI Agent Skills\")}\n ${chalk.blue.bold(\"skills install\")} Install Rebase agent skills for your AI coding assistant\n\n${chalk.green.bold(\"API Keys\")}\n ${chalk.blue.bold(\"api-keys list\")} List the service API keys: kind, scopes, roles\n ${chalk.blue.bold(\"api-keys get\")} ${chalk.gray(\"<id>\")} Show one key\n ${chalk.blue.bold(\"api-keys create\")} Create a service key holding the scopes you name\n ${chalk.blue.bold(\"api-keys revoke\")} Revoke an API key\n ${chalk.blue.bold(\"api-keys scopes\")} List the scopes a key can hold\n ${chalk.blue.bold(\"api-keys\")} ${chalk.gray(\"--help\")} Show API key command help\n\n${chalk.green.bold(\"Stored files\")}\n ${chalk.blue.bold(\"storage orphans\")} List the stored files no row names ${chalk.gray(\"(--delete to delete)\")}\n ${chalk.blue.bold(\"storage move\")} Copy a folder of files to another storage source\n\n${chalk.green.bold(\"Usage sharing\")}\n ${chalk.blue.bold(\"telemetry\")} Anonymous usage sharing (opt-in, off by default)\n\n${chalk.green.bold(\"Rebase Cloud\")}\n ${chalk.blue.bold(\"cloud login\")} Sign in to the hosted control plane\n ${chalk.blue.bold(\"cloud link\")} Link this directory to a cloud project\n ${chalk.blue.bold(\"cloud deploy\")} Deploy the linked project + stream logs\n ${chalk.blue.bold(\"cloud tokens create\")} A token for CI and agents ${chalk.gray(\"(used as REBASE_TOKEN)\")}\n ${chalk.blue.bold(\"cloud\")} ${chalk.gray(\"--help\")} Show all cloud commands\n\n${chalk.green.bold(\"Options\")}\n ${chalk.blue(\"--version, -v\")} Show version number\n ${chalk.blue(\"--help, -h\")} Show this help message\n ${chalk.blue(\"--debug\")} Print the stack trace when a command fails ${chalk.gray(\"(or REBASE_DEBUG=1)\")}\n\n${chalk.gray(\"Documentation: https://rebase.pro/docs\")}\n${telemetryNotice()}`);\n}\n\n/**\n * One line about usage sharing, in the global help.\n *\n * Every other tool that collects anything prints a first-run notice. Ours asks\n * at the end of `rebase init` — but someone who installs the CLI and never runs\n * `init`, or who joins a project someone else scaffolded, would otherwise never\n * learn the subsystem exists. This is the cheapest place to close that: the\n * help is what an unfamiliar user reads first.\n *\n * It states the current setting rather than a generic sentence, so it is also\n * the fastest answer to \"is this thing on?\".\n */\nfunction telemetryNotice(): string {\n const sharing = isEnabled();\n return chalk.gray(\n `Usage sharing: ${sharing ? \"on\" : \"off\"} — ${chalk.cyan(\"rebase telemetry\")} to inspect or change\\n`\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAwBA,SAAS,sBAA4B;CACjC,IAAI,QAAQ,IAAI,wBAAwB,KAAA,GACpC,QAAQ,IAAI,sBAAsB;AAE1C;;;;;;;;;;;;;;AAeA,IAAa,aAAa;CACtB,aAAa;CACb,UAAU;CACV,WAAW;CACX,MAAM;CACN,MAAM;AACV;;;;;;AAOA,IAAM,qBAAqB;CAAC;CAAQ;CAAU;CAAM;CAAW;CAAO;CAAS;CAAS;CAAQ;CAAU;CAAU;CAAU;CAAY;CAAW;CAAS;CAAQ;CAAS;CAAY;CAAgB;CAAa;CAAa;CAAU;CAAW;CAAW;AAAmB;AAQxR,IAAM,gBAAmC;CAAE,aAAa,CAAC;CAAG,SAAS,CAAC;AAAE;;;;;;;;;;AAWxE,eAAe,kBAAkB,SAA6C;CAC1E,QAAQ,SAAR;EACI,KAAK,UAAU,OAAO;GAAE,cAAc,MAAM,OAAO,wBAAA,CAAsB;GAAoB,SAAS,CAAC;EAAE;EACzG,KAAK,MAAM,OAAO;GAAE,cAAc,MAAM,OAAO,oBAAA,CAAkB;GAAgB,SAAS,CAAC;EAAE;EAC7F,KAAK,QAAQ,OAAO;GAAE,cAAc,MAAM,OAAO,sBAAA,CAAoB;GAAkB,SAAS,CAAC;EAAE;EACnG,KAAK,UAAU,OAAO;GAAE,cAAc,MAAM,OAAO,uBAAA,CAAA,MAAA,MAAA,EAAA,CAAA,EAAA,CAAsB;GAAoB,SAAS,CAAC;EAAE;EACzG,KAAK,YAAY,OAAO;GAAE,cAAc,MAAM,OAAO,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