@rebasepro/cli 0.33.2 → 0.34.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (149) hide show
  1. package/dist/{agent-setup-Cg_zBWoW.js → agent-setup-kjdKozkF.js} +3 -3
  2. package/dist/{agent-setup-Cg_zBWoW.js.map → agent-setup-kjdKozkF.js.map} +1 -1
  3. package/dist/{api-TbmW33D7.js → api-CQh_qTyQ.js} +2 -2
  4. package/dist/{api-TbmW33D7.js.map → api-CQh_qTyQ.js.map} +1 -1
  5. package/dist/{api-keys-fPQ55DCm.js → api-keys-CG2IpknI.js} +5 -5
  6. package/dist/{api-keys-fPQ55DCm.js.map → api-keys-CG2IpknI.js.map} +1 -1
  7. package/dist/{apps-DBTRoOeP.js → apps-DaaWvv3o.js} +6 -6
  8. package/dist/{apps-DBTRoOeP.js.map → apps-DaaWvv3o.js.map} +1 -1
  9. package/dist/{atlas-dev-database-D6h65f2x.js → atlas-dev-database-BiDMUr9W.js} +2 -2
  10. package/dist/{atlas-dev-database-D6h65f2x.js.map → atlas-dev-database-BiDMUr9W.js.map} +1 -1
  11. package/dist/{auth-BpyYLEFY.js → auth-bi8x2YX1.js} +12 -12
  12. package/dist/{auth-BpyYLEFY.js.map → auth-bi8x2YX1.js.map} +1 -1
  13. package/dist/{auth-session-B6aT0Dyj.js → auth-session-BVoxE5tp.js} +4 -4
  14. package/dist/{auth-session-B6aT0Dyj.js.map → auth-session-BVoxE5tp.js.map} +1 -1
  15. package/dist/{backend-guard-Cf8eMK_f.js → backend-guard--SW3MTSh.js} +2 -2
  16. package/dist/{backend-guard-Cf8eMK_f.js.map → backend-guard--SW3MTSh.js.map} +1 -1
  17. package/dist/{branch-pointer-BJOF2Ubv.js → branch-pointer-BjKUoENm.js} +1 -1
  18. package/dist/{build-E5hfEWKj.js → build-D-0VCmbU.js} +11 -11
  19. package/dist/build-D-0VCmbU.js.map +1 -0
  20. package/dist/{bundle-CIiKGrte.js → bundle-BDTVS9XE.js} +7 -7
  21. package/dist/{bundle-CIiKGrte.js.map → bundle-BDTVS9XE.js.map} +1 -1
  22. package/dist/{cloud-DNJyUU0T.js → cloud-CR6Hps3B.js} +222 -31
  23. package/dist/cloud-CR6Hps3B.js.map +1 -0
  24. package/dist/{cms-directories-BaV-Is9a.js → cms-directories-AGHvFwH7.js} +2 -2
  25. package/dist/{cms-directories-BaV-Is9a.js.map → cms-directories-AGHvFwH7.js.map} +1 -1
  26. package/dist/{command-Bks5xkrQ.js → command-nWgittn1.js} +3 -3
  27. package/dist/{command-Bks5xkrQ.js.map → command-nWgittn1.js.map} +1 -1
  28. package/dist/commands/build.d.ts +2 -1
  29. package/dist/commands/cloud/db-connect.d.ts +31 -1
  30. package/dist/commands/cloud/db-query.d.ts +16 -0
  31. package/dist/commands/cloud/index.d.ts +1 -0
  32. package/dist/commands/cloud/resources.d.ts +19 -1
  33. package/dist/commands/dev.d.ts +15 -0
  34. package/dist/commands/users.d.ts +1 -0
  35. package/dist/{consent-UV6ObCME.js → consent-C8_Ik_GK.js} +3 -3
  36. package/dist/{consent-UV6ObCME.js.map → consent-C8_Ik_GK.js.map} +1 -1
  37. package/dist/{console-BVoYOLAO.js → console-BBGRHOFg.js} +5 -5
  38. package/dist/{console-BVoYOLAO.js.map → console-BBGRHOFg.js.map} +1 -1
  39. package/dist/{context-BOMEoKxn.js → context-C9lz1vTS.js} +6 -2
  40. package/dist/{context-BOMEoKxn.js.map → context-C9lz1vTS.js.map} +1 -1
  41. package/dist/{cron-ZRXsla0v.js → cron-BzzNxkBH.js} +3 -3
  42. package/dist/{cron-ZRXsla0v.js.map → cron-BzzNxkBH.js.map} +1 -1
  43. package/dist/{cron-CpUsQ739.js → cron-DuZ3Svjq.js} +4 -4
  44. package/dist/{cron-CpUsQ739.js.map → cron-DuZ3Svjq.js.map} +1 -1
  45. package/dist/{daemon-D5gdG7gx.js → daemon-BCBMn8hE.js} +2 -2
  46. package/dist/{daemon-D5gdG7gx.js.map → daemon-BCBMn8hE.js.map} +1 -1
  47. package/dist/{data-BJ9AZFUC.js → data-1eipHbxJ.js} +3 -3
  48. package/dist/{data-BJ9AZFUC.js.map → data-1eipHbxJ.js.map} +1 -1
  49. package/dist/{db-D_iF4E-v.js → db-DAotpOxs.js} +28 -28
  50. package/dist/{db-D_iF4E-v.js.map → db-DAotpOxs.js.map} +1 -1
  51. package/dist/{debug-nNbbxAeo.js → debug-CkiOcfsU.js} +2 -2
  52. package/dist/{debug-nNbbxAeo.js.map → debug-CkiOcfsU.js.map} +1 -1
  53. package/dist/{derive-Mky_u59_.js → derive-BU5kvcOP.js} +3 -3
  54. package/dist/{derive-Mky_u59_.js.map → derive-BU5kvcOP.js.map} +1 -1
  55. package/dist/{dev-bj6dEeSQ.js → dev-Ce9PVQS8.js} +34 -13
  56. package/dist/dev-Ce9PVQS8.js.map +1 -0
  57. package/dist/{dev-preflight-BMOf2N6r.js → dev-preflight-DROlafgr.js} +2 -2
  58. package/dist/{dev-preflight-BMOf2N6r.js.map → dev-preflight-DROlafgr.js.map} +1 -1
  59. package/dist/{dev-server-2XHSHM_q.js → dev-server-dsabI0UT.js} +2 -2
  60. package/dist/{dev-server-2XHSHM_q.js.map → dev-server-dsabI0UT.js.map} +1 -1
  61. package/dist/{doctor-FaBObSlb.js → doctor-Cdu3Llrw.js} +8 -8
  62. package/dist/{doctor-FaBObSlb.js.map → doctor-Cdu3Llrw.js.map} +1 -1
  63. package/dist/{eject-DK_M9kor.js → eject-Dy-qRYhW.js} +3 -3
  64. package/dist/{eject-DK_M9kor.js.map → eject-Dy-qRYhW.js.map} +1 -1
  65. package/dist/{fold-static-2t3UUX4z.js → fold-static-DzV3EJZm.js} +4 -4
  66. package/dist/{fold-static-2t3UUX4z.js.map → fold-static-DzV3EJZm.js.map} +1 -1
  67. package/dist/{function-portability-BIvlvR9q.js → function-portability-Dppl6uqg.js} +24 -5
  68. package/dist/{function-portability-BIvlvR9q.js.map → function-portability-Dppl6uqg.js.map} +1 -1
  69. package/dist/function-portability.d.ts +9 -0
  70. package/dist/{functions-B4JR6EZL.js → functions-BCEJnISw.js} +4 -4
  71. package/dist/{functions-B4JR6EZL.js.map → functions-BCEJnISw.js.map} +1 -1
  72. package/dist/{generate-view-BMaLQm8H.js → generate-view-CZ0SmsJc.js} +4 -4
  73. package/dist/{generate-view-BMaLQm8H.js.map → generate-view-CZ0SmsJc.js.map} +1 -1
  74. package/dist/{generate_sdk-ByD-gTsK.js → generate_sdk-MAbUUZoK.js} +6 -6
  75. package/dist/{generate_sdk-ByD-gTsK.js.map → generate_sdk-MAbUUZoK.js.map} +1 -1
  76. package/dist/index.es.js +54 -54
  77. package/dist/{init-DHCe5mJ5.js → init-BctfWO3w.js} +44 -24
  78. package/dist/init-BctfWO3w.js.map +1 -0
  79. package/dist/last-dev-database-w-r9T5Xm.js +2 -0
  80. package/dist/{legacy-layout-DI2VeQSV.js → legacy-layout-CiXWalS6.js} +2 -2
  81. package/dist/{legacy-layout-DI2VeQSV.js.map → legacy-layout-CiXWalS6.js.map} +1 -1
  82. package/dist/{logs-DpuMukJe.js → logs-B_mS4gCn.js} +4 -4
  83. package/dist/{logs-DpuMukJe.js.map → logs-B_mS4gCn.js.map} +1 -1
  84. package/dist/{manifest-RjqxfCpb.js → manifest-D6B4LA8x.js} +3 -3
  85. package/dist/{manifest-RjqxfCpb.js.map → manifest-D6B4LA8x.js.map} +1 -1
  86. package/dist/{migrate-CSY9ZDKy.js → migrate-DdcgLMyL.js} +3 -3
  87. package/dist/{migrate-CSY9ZDKy.js.map → migrate-DdcgLMyL.js.map} +1 -1
  88. package/dist/{normalize-imports-P86NVfpo.js → normalize-imports-CVjOssZ2.js} +2 -2
  89. package/dist/{normalize-imports-P86NVfpo.js.map → normalize-imports-CVjOssZ2.js.map} +1 -1
  90. package/dist/{package-manager-DSEOwTqM.js → package-manager-DTNNGHyK.js} +29 -12
  91. package/dist/package-manager-DTNNGHyK.js.map +1 -0
  92. package/dist/{path-flags-ekLdkbra.js → path-flags-B7Ydt5nv.js} +2 -2
  93. package/dist/{path-flags-ekLdkbra.js.map → path-flags-B7Ydt5nv.js.map} +1 -1
  94. package/dist/{prepare-BaJe0Zik.js → prepare-CFpYl1Nt.js} +4 -4
  95. package/dist/{prepare-BaJe0Zik.js.map → prepare-CFpYl1Nt.js.map} +1 -1
  96. package/dist/{project-DALmhb5R.js → project-CQ5nKddJ.js} +2 -2
  97. package/dist/{project-DALmhb5R.js.map → project-CQ5nKddJ.js.map} +1 -1
  98. package/dist/{project-command-Cl9EZzjr.js → project-command-5wM_bJQt.js} +7 -7
  99. package/dist/{project-command-Cl9EZzjr.js.map → project-command-5wM_bJQt.js.map} +1 -1
  100. package/dist/resolve-GDRel2ne.js +2 -0
  101. package/dist/{resources-Db3USuPO.js → resources-ecA0MEjy.js} +4 -4
  102. package/dist/{resources-Db3USuPO.js.map → resources-ecA0MEjy.js.map} +1 -1
  103. package/dist/{rls-BxrQ0P50.js → rls-B4zGbTKY.js} +3 -3
  104. package/dist/{rls-BxrQ0P50.js.map → rls-B4zGbTKY.js.map} +1 -1
  105. package/dist/{schema-_FzZEoB8.js → schema-CWzzn0cY.js} +13 -12
  106. package/dist/{schema-_FzZEoB8.js.map → schema-CWzzn0cY.js.map} +1 -1
  107. package/dist/{schema-dir-ChcYfWjP.js → schema-dir-Dd1Pzqq5.js} +2 -2
  108. package/dist/{schema-dir-ChcYfWjP.js.map → schema-dir-Dd1Pzqq5.js.map} +1 -1
  109. package/dist/schema-reconcile-DGEMmYJI.js +2 -0
  110. package/dist/{schema-show-h72UJ9zH.js → schema-show-DwYtOp4S.js} +5 -5
  111. package/dist/{schema-show-h72UJ9zH.js.map → schema-show-DwYtOp4S.js.map} +1 -1
  112. package/dist/{skills-DQ2bZGkj.js → skills-CWmBTCRW.js} +6 -6
  113. package/dist/{skills-DQ2bZGkj.js.map → skills-CWmBTCRW.js.map} +1 -1
  114. package/dist/{start-Cjx4W0bJ.js → start-4uhCu_md.js} +6 -6
  115. package/dist/{start-Cjx4W0bJ.js.map → start-4uhCu_md.js.map} +1 -1
  116. package/dist/{status-CDBk25VO.js → status-CVEzoSwX.js} +7 -7
  117. package/dist/{status-CDBk25VO.js.map → status-CVEzoSwX.js.map} +1 -1
  118. package/dist/{storage-Clc8dLG8.js → storage-Dqf5tyhs.js} +9 -9
  119. package/dist/{storage-Clc8dLG8.js.map → storage-Dqf5tyhs.js.map} +1 -1
  120. package/dist/{storage-objects-CfRKlTDe.js → storage-objects-DbFsemMV.js} +3 -3
  121. package/dist/{storage-objects-CfRKlTDe.js.map → storage-objects-DbFsemMV.js.map} +1 -1
  122. package/dist/{telemetry-DZU2-NCm.js → telemetry-B5RSeQIc.js} +3 -3
  123. package/dist/{telemetry-DZU2-NCm.js.map → telemetry-B5RSeQIc.js.map} +1 -1
  124. package/dist/{telemetry-EVtASbKb.js → telemetry-CJbrRuG3.js} +2 -2
  125. package/dist/{telemetry-EVtASbKb.js.map → telemetry-CJbrRuG3.js.map} +1 -1
  126. package/dist/{upgrade-ZASvgxWM.js → upgrade-CepjhRrz.js} +6 -6
  127. package/dist/{upgrade-ZASvgxWM.js.map → upgrade-CepjhRrz.js.map} +1 -1
  128. package/dist/{users-5PkqBY6R.js → users-Cx5HuaTn.js} +9 -6
  129. package/dist/users-Cx5HuaTn.js.map +1 -0
  130. package/dist/utils/package-manager.d.ts +12 -13
  131. package/dist/{verify-BdeqNb-V.js → verify-D-1y5HQS.js} +8 -8
  132. package/dist/{verify-BdeqNb-V.js.map → verify-D-1y5HQS.js.map} +1 -1
  133. package/package.json +10 -10
  134. package/templates/template/.cursorrules +2 -1
  135. package/templates/template/.github/copilot-instructions.md +2 -1
  136. package/templates/template/.windsurfrules +2 -1
  137. package/templates/template/AGENTS.md +2 -1
  138. package/templates/template/CLAUDE.md +2 -1
  139. package/templates/template/ai-instructions.md +5 -2
  140. package/templates/template/frontend/src/index.css +13 -0
  141. package/dist/build-E5hfEWKj.js.map +0 -1
  142. package/dist/cloud-DNJyUU0T.js.map +0 -1
  143. package/dist/dev-bj6dEeSQ.js.map +0 -1
  144. package/dist/init-DHCe5mJ5.js.map +0 -1
  145. package/dist/last-dev-database-CBVkEUEl.js +0 -2
  146. package/dist/package-manager-DSEOwTqM.js.map +0 -1
  147. package/dist/resolve-C36px9tR.js +0 -2
  148. package/dist/schema-reconcile-DV14XY4o.js +0 -2
  149. package/dist/users-5PkqBY6R.js.map +0 -1
@@ -9,5 +9,6 @@ These hold before you have opened ai-instructions.md, and in every session:
9
9
  - **A table is a file in `backend/schema/`.** Declare it with `defineTable` from `@rebasepro/server/schema` — columns, relations and a required `rls` — export it from `backend/schema/index.ts`, and `pnpm dev` creates it. How it looks in the admin panel is a separate, optional file: `frontend/src/cms/<table>.tsx` with `customizeTable`, which imports the table as a type only. Never `CREATE TABLE`, `ALTER TABLE` or `CREATE INDEX` in code, and never SQL as the database owner against an application table: `rebase.sql()` skips row-level security, validation and hooks, so keep it for server work that needs every row and for reading a column marked `.private()`. When the SDK cannot express a query, run it as the caller with `getSql(c)` — the same row-level security as the SDK, read-only unless `{ write: true }`, every value in `params`. A table that already exists gets its file from `pnpm schema:introspect`. With no `backend/schema/` (a headless project) the database is the schema instead: ai-instructions.md says how to serve a table.
10
10
  - **Data goes through the SDK:** `rebase.dataAsAdmin.<table>` in functions and crons, `getDriver(c)` to act as the caller.
11
11
  - **A route in `backend/functions/` is public until you guard it** with `requireAuth` or `requireAdmin` from `@rebasepro/server/functions`.
12
- - **Never deploy, never edit `.env`, never edit generated files** (`backend/src/schema.generated.ts`, `rebase.resources.json`).
12
+ - **Never deploy, never edit generated files** (`backend/src/schema.generated.ts`, `rebase.resources.json`). In `.env`, change only a local setting the task needs (`AUTH_MAGIC_LINK`, `FRONTEND_URL`, `REBASE_FUNCTIONS_TIMEOUT_MS` and the like), one line at a time, and say which; never rewrite, print or rotate its secrets (`DATABASE_URL`, `JWT_SECRET`, `REBASE_SERVICE_KEY`).
13
+ - **An admin, back-office or internal tool is built in the Rebase admin, never as a new app.** A dashboard, a review queue, a staff screen or a settings page is a custom view, the home page, a record tab or an action in `frontend/` (ai-instructions.md, "Admin UI", says how). A separate app is only for what the project's own users see.
13
14
  - **When Rebase cannot do what the task needs, tell the human** what is missing instead of working around it.
@@ -9,5 +9,6 @@ These hold before you have opened ai-instructions.md, and in every session:
9
9
  - **A table is a file in `backend/schema/`.** Declare it with `defineTable` from `@rebasepro/server/schema` — columns, relations and a required `rls` — export it from `backend/schema/index.ts`, and `pnpm dev` creates it. How it looks in the admin panel is a separate, optional file: `frontend/src/cms/<table>.tsx` with `customizeTable`, which imports the table as a type only. Never `CREATE TABLE`, `ALTER TABLE` or `CREATE INDEX` in code, and never SQL as the database owner against an application table: `rebase.sql()` skips row-level security, validation and hooks, so keep it for server work that needs every row and for reading a column marked `.private()`. When the SDK cannot express a query, run it as the caller with `getSql(c)` — the same row-level security as the SDK, read-only unless `{ write: true }`, every value in `params`. A table that already exists gets its file from `pnpm schema:introspect`. With no `backend/schema/` (a headless project) the database is the schema instead: ai-instructions.md says how to serve a table.
10
10
  - **Data goes through the SDK:** `rebase.dataAsAdmin.<table>` in functions and crons, `getDriver(c)` to act as the caller.
11
11
  - **A route in `backend/functions/` is public until you guard it** with `requireAuth` or `requireAdmin` from `@rebasepro/server/functions`.
12
- - **Never deploy, never edit `.env`, never edit generated files** (`backend/src/schema.generated.ts`, `rebase.resources.json`).
12
+ - **Never deploy, never edit generated files** (`backend/src/schema.generated.ts`, `rebase.resources.json`). In `.env`, change only a local setting the task needs (`AUTH_MAGIC_LINK`, `FRONTEND_URL`, `REBASE_FUNCTIONS_TIMEOUT_MS` and the like), one line at a time, and say which; never rewrite, print or rotate its secrets (`DATABASE_URL`, `JWT_SECRET`, `REBASE_SERVICE_KEY`).
13
+ - **An admin, back-office or internal tool is built in the Rebase admin, never as a new app.** A dashboard, a review queue, a staff screen or a settings page is a custom view, the home page, a record tab or an action in `frontend/` (ai-instructions.md, "Admin UI", says how). A separate app is only for what the project's own users see.
13
14
  - **When Rebase cannot do what the task needs, tell the human** what is missing instead of working around it.
@@ -9,5 +9,6 @@ These hold before you have opened ai-instructions.md, and in every session:
9
9
  - **A table is a file in `backend/schema/`.** Declare it with `defineTable` from `@rebasepro/server/schema` — columns, relations and a required `rls` — export it from `backend/schema/index.ts`, and `pnpm dev` creates it. How it looks in the admin panel is a separate, optional file: `frontend/src/cms/<table>.tsx` with `customizeTable`, which imports the table as a type only. Never `CREATE TABLE`, `ALTER TABLE` or `CREATE INDEX` in code, and never SQL as the database owner against an application table: `rebase.sql()` skips row-level security, validation and hooks, so keep it for server work that needs every row and for reading a column marked `.private()`. When the SDK cannot express a query, run it as the caller with `getSql(c)` — the same row-level security as the SDK, read-only unless `{ write: true }`, every value in `params`. A table that already exists gets its file from `pnpm schema:introspect`. With no `backend/schema/` (a headless project) the database is the schema instead: ai-instructions.md says how to serve a table.
10
10
  - **Data goes through the SDK:** `rebase.dataAsAdmin.<table>` in functions and crons, `getDriver(c)` to act as the caller.
11
11
  - **A route in `backend/functions/` is public until you guard it** with `requireAuth` or `requireAdmin` from `@rebasepro/server/functions`.
12
- - **Never deploy, never edit `.env`, never edit generated files** (`backend/src/schema.generated.ts`, `rebase.resources.json`).
12
+ - **Never deploy, never edit generated files** (`backend/src/schema.generated.ts`, `rebase.resources.json`). In `.env`, change only a local setting the task needs (`AUTH_MAGIC_LINK`, `FRONTEND_URL`, `REBASE_FUNCTIONS_TIMEOUT_MS` and the like), one line at a time, and say which; never rewrite, print or rotate its secrets (`DATABASE_URL`, `JWT_SECRET`, `REBASE_SERVICE_KEY`).
13
+ - **An admin, back-office or internal tool is built in the Rebase admin, never as a new app.** A dashboard, a review queue, a staff screen or a settings page is a custom view, the home page, a record tab or an action in `frontend/` (ai-instructions.md, "Admin UI", says how). A separate app is only for what the project's own users see.
13
14
  - **When Rebase cannot do what the task needs, tell the human** what is missing instead of working around it.
@@ -24,7 +24,7 @@
24
24
 
25
25
  - **Never create or change a table in code, and never write SQL as the database owner against application tables.** A table is a file in `backend/schema/` (core rule 1), and one that already exists gets its file from `pnpm schema:introspect`. `rebase.sql()` runs as the owner — no row-level security, validation or hooks — so it is for server work that genuinely needs every row, and for reading a column marked `.private()`, which the API never returns; it logs a warning naming the fix when it is used to create, alter, drop or index a table. Prefer the SDK where it fits: `aggregate()` with `countDistinct`, `mode`, `percentile`, `distinct` and groups by `lower(…)`, `day(…)` or `unnest(tags)`; `fingerprint()` instead of hashing a table; `updateMany` with a value per row and `createMany` (one statement for the batch); `array-contains-all` / `array-contained-by` filters; a `defineView(...)` in `backend/schema/` for a query worth naming. For anything else, write the SQL **as the caller**: `getSql(c)` in a function runs one statement in the caller's transaction under the same row-level security as the SDK, read-only unless `{ write: true }`. The query text is yours and every value goes in `params` (`$1`, `$2`, …) — never interpolate into the string. Columns the caller may not read (`.private()`, `.access({ read })`) are dropped from what it returns when the query names them plainly, not when it computes from them; read hooks, validation and save hooks do not run.
26
26
  - **Never deploy.** `pnpm deploy`, `rebase cloud deploy`, `firebase deploy`, `gcloud run deploy` — print the command and let the human run it, even when the task list ends in "deploy" and the tests are green.
27
- - **Never edit `.env`.** It holds generated secrets and the connection string. Add a variable by asking, and document it in `.env.example`.
27
+ - **`.env` is yours to change only for local settings.** It holds generated secrets and the connection string, and it is the only file the backend reads its settings from (there is no `.env.local`). Change a local switch the task needs (`AUTH_MAGIC_LINK=true`, `FRONTEND_URL`, `REBASE_FUNCTIONS_TIMEOUT_MS`) one line at a time and say which; never rewrite, print or rotate `DATABASE_URL`, `JWT_SECRET` or `REBASE_SERVICE_KEY`. Document a new variable in `.env.example`.
28
28
  - **Never edit `backend/src/schema.generated.ts`.** It is overwritten by `pnpm schema:generate`; `backend/schema/` is the source.
29
29
  - **Never edit `rebase.resources.json`.** It is generated from `backend/resources.ts` — declare there, then `rebase resources --write`.
30
30
  - **Never pass `--allow-destructive`** to anything pointed at a database that is not the local development one. It drops columns and tables.
@@ -53,10 +53,13 @@
53
53
  - **Configuration:** the human sets variables with `rebase cloud env set NAME=value` (`--secret` makes a value write-only). A change applies at the next deploy. Read variables inside the handler, with `requireEnv(c, "NAME")`.
54
54
  - **Generated files** (audio, images, exports) go to storage: `rebase.storage.putObject({ file, key })`. A key under `public/` is served to anyone at `/api/storage/file/<key>`. Any other key needs a download token. The project needs `rebase cloud storage create` once, plus a `storageAuthorize` hook that allows the write.
55
55
 
56
- ## Admin UI — only when you build it
56
+ ## Admin UI
57
+
58
+ The Rebase admin is this project's admin. When the task is an admin, a back-office, an internal tool or a screen for staff (a dashboard, a review or approval queue, a dispatch board, a settings page, a bulk action), build it inside the admin: a custom view (`rebase generate view <name>`), the home page, a record tab (`entityViews` in `customizeTable`), or a record or toolbar action. Never scaffold a separate app or a second admin for it, and never rebuild in it what the admin already gives every table (lists, filters, forms, history, users and roles). If the admin cannot do what the task needs, tell the human what is missing.
57
59
 
58
60
  These rules apply to views inside the Rebase admin panel: custom views, home pages, dashboards and entity tabs. A public site or a static app this project serves (an `apps` entry with `"type": "static"`) is not the admin panel. Style it the way that app is already styled. It does not need `@rebasepro/ui`.
59
61
 
60
62
  - **Build admin UI from the kit, never from scratch**: every one of those views is composed from `@rebasepro/ui` components (`Card`, `Typography`, `Button`, `Chip`, `Alert`, …) and the theme's tokens. Backgrounds and borders take a surface by role — `bg-surface-frame`, `bg-surface-sheet`, `bg-surface-card`, `bg-surface-raised`, `bg-surface-field`, `bg-surface-well`, `border-hairline` — and those switch with the theme on their own, so they need no `dark:` pair; text takes `<Typography>` or `text-text-primary dark:text-text-primary-dark`. Do **not** invent a palette, a type scale, or hand-written CSS: a hardcoded colour like `#111` is invisible in one of the two themes and nothing will catch it. The roles and their reasoning are in `@rebasepro/ui/theme.css` in your `node_modules`; the live reference is `import { UIReferenceView } from "@rebasepro/app/debug"` — mount it on a route and look before building a view. See [Styling Custom UI](https://rebase.pro/docs/frontend/styling).
63
+ - **Rebranding the admin is tokens, not components.** Brand colour, fonts and corners are a `@theme { --color-primary: …; --font-sans: …; --radius-lg: … }` block in `frontend/src/index.css` (there is a commented one to start from); light and dark backgrounds are `--surface-*` variables under `:root` and `.dark`; the logo and name are `<RebaseShell title logo logoDark>`, and the same logo reaches the sign-in screen. Never restyle by overriding components or writing the brand colour as a literal: a filled control is `bg-primary text-on-primary`, so a light brand still gets readable labels. See [Theming & Branding](https://rebase.pro/docs/frontend/theming).
61
64
  - **The admin panel shows every table with no code; `frontend/src/cms/<table>.tsx` changes how one looks.** `export const postsCms = customizeTable<typeof posts>("posts", { icon, fields: { … } })` from `@rebasepro/cms`, with `import type { posts } from "../../../backend/schema/posts"` — a type import only: a value import from `backend/` would put server code in the browser bundle, and `check:templates` refuses it. List it in `App.tsx`: `<RebaseCMS tableCustomizations={[postsCms]} />`. Labels, enum colours, icons, markdown and custom `Field` components live there, never in `backend/schema/`.
62
65
  - **Set `span` on every field you customize, from what it holds.** The admin form puts every field at full width unless the property says otherwise, pairing only two neighbouring fields with the same small editor (two numbers, two switches, two dates, two short selects); it never pairs free text and never looks at the title. Pair two short values that belong together (`2` + `2`: start / end date, provider / region; `1` for numbers, booleans and short codes beside their siblings), keep anything that reads long at `4` (names, URLs, emails, ids, descriptions, markdown, files), make each row add up to 4, and declare pairs next to each other. It goes in `fields: { <column>: { span } }` of the table's `customizeTable`.
@@ -5,6 +5,19 @@
5
5
 
6
6
  @custom-variant dark (&:where(.dark, .dark *));
7
7
 
8
+ /* Your brand. Uncomment and edit: every part of the admin follows these
9
+ tokens, in both themes, and button labels switch to black or white to
10
+ stay readable on the colour you pick. Fonts, surfaces, dark mode and the
11
+ logo: https://rebase.pro/docs/frontend/theming
12
+
13
+ @theme {
14
+ --color-primary: #0070F4;
15
+ --font-sans: "Inter Variable", ui-sans-serif, system-ui, sans-serif;
16
+ --radius-lg: 9px;
17
+ --radius-xl: 13px;
18
+ }
19
+ */
20
+
8
21
  @layer utilities {
9
22
  body {
10
23
  @apply w-full min-h-screen bg-surface-50 dark:bg-surface-900 flex flex-col items-center justify-center;
@@ -1 +0,0 @@
1
- {"version":3,"file":"build-E5hfEWKj.js","names":[],"sources":["../src/commands/build.ts"],"sourcesContent":["/**\n * CLI command: rebase build [app...]\n *\n * Builds the apps a repository declares in `rebase.json`.\n *\n * For a `backend` app this produces a **bundle** — compiled tables,\n * functions and schema plus a manifest — which is the artifact the runtime\n * loads. For `static` and bundled `admin` apps it runs the declared build\n * command and reports where the output landed.\n *\n * A project with no manifest, or one whose backend has been ejected to its own\n * entrypoint, falls back to the previous behaviour: run every workspace's own\n * `build` script. Nothing that built before stops building.\n */\nimport fs from \"fs\";\nimport path from \"path\";\nimport chalk from \"chalk\";\nimport { execa } from \"execa\";\nimport type { RebaseAppConfig, RebaseStaticAppConfig } from \"@rebasepro/types\";\nimport { requireProjectRoot } from \"../utils/project\";\nimport { assertBackendGuarded } from \"../utils/backend-guard\";\nimport { parseCommandArgs, UsageError, wantsHelp } from \"../utils/args\";\nimport { detectPackageManager, getPMCommands } from \"../utils/package-manager\";\nimport { cliVersion } from \"../utils/version\";\nimport { toolStdio } from \"../utils/tool-stdio\";\nimport {\n buildableApps,\n findBackendApp,\n formatAppAddress,\n loadManifest,\n ManifestError,\n resolveBackendPaths,\n staticAppAddress\n} from \"../manifest\";\nimport { legacyCollectionsDir, legacyLayoutRefusal } from \"../utils/legacy-layout\";\nimport {\n buildBundle,\n buildStaticBundle,\n detectFrameworkDepDrift,\n DEFAULT_BUNDLE_DIR,\n UNVENDORED_COST,\n unvendoredReason,\n VENDOR_SIZE_WARN_BYTES\n} from \"../bundle\";\nimport { assertBuiltForPath, foldFrontendIntoBundle, staticBuildEnv } from \"../fold-static\";\nimport { deriveOptionsFor, deriveResourceGraph, RESOURCE_GRAPH_FILENAME, writeResourceGraphFile } from \"../resources/derive\";\n\nfunction printHelp(): void {\n console.log(`\n${chalk.bold(\"rebase build\")} — build the apps declared in rebase.json\n\n${chalk.bold(\"Usage\")}\n rebase build [app...] Build the named apps (default: all)\n\n${chalk.bold(\"Options\")}\n --output, --out <dir> Bundle output directory (default: ${DEFAULT_BUNDLE_DIR});\n one app at a time\n --skip-type-check Compile without type checking (faster; use for iteration only)\n --skip-schema Do not regenerate the database schema from the tables\n --no-static Do not fold the frontend into the backend bundle (each\n static app still gets its own bundle)\n --skip-static-build Fold the frontend as already built, without running its\n build command — for CI that built it in an earlier step\n --no-vendor Do not install dependencies into the bundle (they\n install on every pod start instead, ~40-60s slower)\n --vendor Install them whatever the tree's size — for a\n deploy that builds from source and never uploads it\n --workspace Run every workspace's own build script instead\n -h, --help Show this help\n\n${chalk.bold(\"Examples\")}\n rebase build Build every app in this repository\n rebase build backend Build only the backend bundle\n rebase build web Build only the \"web\" static app\n`.trim());\n}\n\n/**\n * The two commands that turn a custom-runtime app into an image.\n *\n * Exported for the test, because the failure this replaced was in the printed\n * text and nowhere else. It said:\n *\n * docker build -f backend/Dockerfile .\n *\n * for every custom backend, and the `.` was a guess — `context` was validated,\n * stored on the config, and read by nothing. For the reference project that\n * guess is wrong: `app/backend/Dockerfile` opens by copying `pnpm-lock.yaml`\n * and `pnpm-workspace.yaml`, which live at the monorepo root, so the command\n * `rebase build` handed you died on its first instruction. The deploy that\n * actually works, `infra/cloudbuild.yaml`, has always said\n * `-f app/backend/Dockerfile .` from the root.\n *\n * `dockerfile` is relative to `rebase.json`; `context` is too, and may point\n * above it. Docker resolves `-f` against the working directory, not the\n * context, so the path has to be re-expressed against wherever the command\n * runs — which is what the old line never did and is the whole reason it\n * could not be right for both.\n */\nexport function dockerBuildHint(\n projectRoot: string,\n name: string,\n app: { dockerfile?: string; context?: string }\n): string[] {\n const dockerfile = app.dockerfile ?? \"Dockerfile\";\n const context = app.context ?? \".\";\n const contextDir = path.resolve(projectRoot, context);\n const fromContext = path.relative(contextDir, path.resolve(projectRoot, dockerfile));\n\n const build = `${chalk.cyan(`npm run build --workspace ${name}`)}`;\n\n // A Dockerfile outside its own context is legal to `docker build` but means\n // nothing it copies is reachable, so there is no command to offer. Say what\n // is wrong instead of printing one that cannot work.\n if (fromContext.startsWith(\"..\")) {\n return [\n chalk.dim(` ${build}`),\n chalk.yellow(` ⚠ ${dockerfile} is outside the build context (${context}) — nothing it COPYs is reachable.`),\n chalk.dim(` Widen \"context\" in rebase.json, or move the Dockerfile inside it.`)\n ];\n }\n\n const docker = chalk.cyan(`docker build -f ${fromContext} .`);\n return context === \".\"\n ? [chalk.dim(` ${build} then ${docker}`)]\n : [chalk.dim(` ${build}`), chalk.dim(` ${chalk.cyan(`cd ${context}`)} && ${docker}`)];\n}\n\nexport async function buildCommand(rawArgs: string[] = []): Promise<void> {\n if (wantsHelp(rawArgs)) {\n printHelp();\n return;\n }\n\n const { flags: args, positionals: requested } = parseCommandArgs({\n spec: {\n \"--output\": String,\n // `--out` kept as an accepted alias. `generate-sdk` has always\n // spelled this `--output`, and two names for one concept across one\n // CLI is a thing you have to remember rather than know. `--output`\n // is canonical now; `--out` still works so no script breaks.\n \"--out\": \"--output\",\n \"--skip-type-check\": Boolean,\n /* Do not install the declared dependencies into the bundle. The\n bundle still works — it installs them at boot, as every bundle did\n before vendoring existed — so this is for a build that must not\n shell out to npm, not for a smaller artifact. */\n \"--no-vendor\": Boolean,\n /* Keep the installed tree whatever its size. The size ceiling\n protects an upload that a source-built deploy never performs, so\n that path needs a way to say so. */\n \"--vendor\": Boolean,\n \"--skip-schema\": Boolean,\n /* Do not fold the frontend into the backend bundle. For a project\n that publishes its frontend elsewhere and does not want the assets\n travelling with its API. */\n \"--no-static\": Boolean,\n /* Fold assets that are already built, without re-running the app's\n build command — for a CI job that built the frontend in an earlier\n step. */\n \"--skip-static-build\": Boolean,\n \"--workspace\": Boolean\n },\n rawArgs,\n commandWords: 1,\n command: \"build\"\n });\n\n const projectRoot = requireProjectRoot();\n\n if (args[\"--workspace\"]) {\n await runWorkspaceBuilds(projectRoot);\n return;\n }\n\n let loaded;\n try {\n loaded = loadManifest(projectRoot);\n } catch (err) {\n if (err instanceof ManifestError) {\n console.error(chalk.red(`✗ ${err.message}`));\n for (const issue of err.issues) {\n console.error(chalk.red(` ${issue.path ? `${issue.path}: ` : \"\"}${issue.message}`));\n }\n process.exit(1);\n }\n throw err;\n }\n\n const { manifest, source } = loaded;\n\n let targets = buildableApps(manifest);\n if (requested.length > 0) {\n const known = new Set(targets.map(t => t.name));\n const unknown = requested.filter(name => !known.has(name));\n if (unknown.length > 0) {\n console.error(chalk.red(`✗ Unknown app(s): ${unknown.join(\", \")}`));\n console.error(chalk.dim(` This repository declares: ${targets.map(t => t.name).join(\", \") || \"(none)\"}`));\n process.exit(1);\n }\n targets = targets.filter(t => requested.includes(t.name));\n }\n\n if (targets.length === 0) {\n console.log(chalk.yellow(\"No buildable apps declared. Nothing to do.\"));\n return;\n }\n\n // An ejected backend owns its own build; the workspace scripts are the only\n // thing that knows how to run it.\n const backend = findBackendApp(manifest);\n if (!backend && source === \"synthesized\") {\n console.log(chalk.dim(\"No rebase.json found — building workspace packages.\\n\"));\n await refuseUnguardedFrontend(projectRoot);\n await runWorkspaceBuilds(projectRoot);\n return;\n }\n\n // `--output` names one bundle directory, resolved from where it was typed.\n // It is refused for a build that produces several bundles rather than\n // handed to each: every bundle build empties its directory first, so the\n // last app built deleted the others' and the build still reported success.\n const output = args[\"--output\"] ? path.resolve(process.cwd(), args[\"--output\"]) : undefined;\n const bundled = targets.filter(({ app }) =>\n (app.type === \"backend\" && app.runtime !== \"custom\") ||\n (app.type === \"static\" && Boolean(app.build) && Boolean(app.output)));\n if (output && bundled.length > 1) {\n throw new UsageError(\n `--output names one bundle directory, and this build produces ${bundled.length}: ` +\n `${bundled.map(t => t.name).join(\", \")}. Build one app into it: ` +\n `rebase build ${bundled[0].name} --output ${args[\"--output\"]}`\n );\n }\n\n // Before the frontend guard and everything else: on a project still on\n // config/collections every later check fails for a reason that is not the\n // one to fix, and none of them names the command that fixes it.\n for (const { app } of targets) {\n if (app.type !== \"backend\" || app.runtime === \"custom\") continue;\n const tablesDir = resolveBackendPaths(app, projectRoot).tables;\n const legacy = legacyCollectionsDir(projectRoot, tablesDir);\n if (!legacy) continue;\n const refusal = legacyLayoutRefusal(legacy, tablesDir);\n console.error(chalk.red(`✗ ${refusal.message}`));\n console.error(chalk.dim(` ${refusal.hint}`));\n process.exit(1);\n }\n\n console.log(`${chalk.bold(\"Rebase\")} — building ${targets.length} app(s)\\n`);\n\n await refuseUnguardedFrontend(projectRoot);\n\n // Each static app is built once per run, whichever consumer gets to it\n // first: folding into the backend bundle, or its own static bundle.\n const builtApps = new Set<string>();\n\n for (const { name, app } of targets) {\n console.log(chalk.cyan(`▸ ${name}`) + chalk.dim(` (${app.type})`));\n\n if (app.type === \"backend\" && app.runtime === \"custom\") {\n // An ejected backend's artifact is an IMAGE, not a bundle. Building\n // one anyway produced a `dist-bundle/` the project never deploys,\n // which is worse than doing nothing: it looks like the thing that\n // ships. The workspace's own `build` script compiles this app, and\n // the Dockerfile turns it into the image.\n console.log(chalk.dim(\" custom runtime — this project builds its own image, not a bundle\"));\n for (const line of dockerBuildHint(projectRoot, name, app)) console.log(line);\n console.log(\"\");\n continue;\n }\n\n if (app.type === \"backend\") {\n // Derived per backend app, because each has its own config\n // directory. Issues are fatal here rather than reported: a bundle\n // whose manifest is missing a bucket the code declares would deploy\n // into a tenant with nothing provisioned for it, and the first sign\n // would be uploads failing in production.\n const { graph: resourceGraph, issues } = await deriveResourceGraph(deriveOptionsFor(projectRoot, app));\n if (issues.length > 0) {\n console.error(chalk.red(`\\n ✗ ${issues.length} problem(s) in the declared resources:\\n`));\n for (const issue of issues) console.error(` ${chalk.bold(issue.path)} ${issue.message}`);\n console.error(\"\");\n process.exitCode = 1;\n return;\n }\n // Written alongside the bundle so the repository records what this\n // project needs. `rebase resources --check` is what keeps it honest.\n // Committed, so a change to it is said: the first build of a\n // scaffold otherwise left it untracked with no word on what it is.\n if (writeResourceGraphFile(projectRoot, resourceGraph).changed) {\n console.log(chalk.dim(` ${RESOURCE_GRAPH_FILENAME} updated — commit it: it records what this project needs from a host`));\n }\n\n /* The framework pins, read before the build and reported after it.\n Ranges no single version satisfies are refused by `buildBundle`\n itself, before it builds anything, for every command that builds\n a bundle. */\n const drift = detectFrameworkDepDrift(projectRoot, cliVersion());\n\n const result = await buildBundle({\n projectRoot,\n appName: name,\n app,\n outDir: output,\n runtimeRange: manifest.rebase,\n resources: resourceGraph,\n skipTypeCheck: args[\"--skip-type-check\"],\n skipSchema: args[\"--skip-schema\"],\n vendor: args[\"--no-vendor\"] ? false : (args[\"--vendor\"] ? true : undefined)\n });\n const rel = path.relative(projectRoot, result.outDir);\n console.log(chalk.green(` ✓ bundle → ${rel}/`));\n // A headless build has no schema version — the API is introspected\n // from the live database at boot — and interpolating it anyway left\n // the summary ending in a dangling `schema `, which reads as a value\n // that failed to render rather than one that does not exist.\n const schemaVersion = result.manifest.schemaVersion;\n console.log(chalk.dim(\n ` ${result.tableCount} table(s)${schemaVersion ? `, schema ${schemaVersion}` : \"\"}`\n ));\n /* Say what the bundle's cold start will be, at the one moment\n anyone is listening.\n\n A vendored bundle starts in about five seconds; one that installs\n at boot takes forty to sixty, on EVERY pod start — an eviction, a\n node failure, an OOM, a runtime rollout. That is not a build\n detail, it is what each of those events costs in downtime, and it\n is invisible until an incident unless it is said here. */\n const unvendored = unvendoredReason(result);\n if (result.vendor.vendored) {\n console.log(chalk.dim(` dependencies installed into the bundle (${result.vendor.target?.os}/${result.vendor.target?.cpu})`));\n if ((result.vendor.bytes ?? 0) > VENDOR_SIZE_WARN_BYTES) {\n const mb = Math.round((result.vendor.bytes ?? 0) / (1024 * 1024));\n /* The limit is on the *compressed* upload and this is the\n tree on disk, so a number above 1024 does not mean the\n upload fails — but \"1600 MB, close to the 1 GB limit\"\n reads as nonsense and got ignored for exactly that\n reason. Say which quantity is which. */\n console.log(chalk.yellow(\n ` ⚠ the installed tree is ${mb} MB on disk — enough to risk the control plane's 1 GB ` +\n \"limit on the compressed upload\"));\n console.log(chalk.dim(\" Shrink the declared dependencies, or rebuild with --no-vendor.\"));\n }\n } else if (unvendored) {\n console.log(chalk.yellow(` ⚠ dependencies not bundled: ${unvendored}`));\n console.log(chalk.dim(` ${UNVENDORED_COST}`));\n } else {\n console.log(chalk.dim(\" no dependencies to install — nothing to bundle\"));\n }\n\n if (result.manifest.hooks.native) {\n const names = (result.manifest.hooks.nativeModules ?? []).map(m => m.name).join(\", \");\n console.log(chalk.yellow(` ⚠ native dependencies detected: ${names}`));\n console.log(chalk.dim(\" These cannot run on the managed runtime. See `rebase doctor`.\"));\n }\n\n /* Framework pins older than this CLI.\n\n Warned here because this is the only moment anyone can be told.\n Locally every `@rebasepro/*` resolves through pnpm's workspace and\n `link:` overrides to the checkout, so the version strings in\n package.json are never exercised — the project runs fine on a\n developer's machine while declaring something years old. Those\n strings are first honoured when the runtime npm-installs them in\n the cloud, and by then the symptom is a tenant that boots and then\n misbehaves against its database.\n\n A warning rather than a hard failure: the CLI cannot know that a\n newer package has actually been published, and refusing to build\n over a guess would be worse than saying it out loud. (`drift` was\n read before the build, above.) */\n if (drift.behind.length > 0) {\n console.log(chalk.yellow(` ⚠ framework dependencies older than this CLI (${cliVersion()}):`));\n for (const dep of drift.behind) {\n console.log(chalk.dim(` ${dep.name}@${dep.range} (${dep.file})`));\n }\n console.log(chalk.dim(\" The image supplies the server, but your bundle supplies the database\"));\n console.log(chalk.dim(\" driver — a newer runtime does not update it.\"));\n console.log(chalk.dim(` Run \\`${upgradeToThisCli()}\\`, then rebuild.`));\n } else if (drift.disagreeing.length > 0) {\n console.log(chalk.yellow(` ⚠ mixed @rebasepro versions declared: ${drift.disagreeing.join(\", \")}`));\n console.log(chalk.dim(\" These are published together and expect to run together.\"));\n console.log(chalk.dim(` Run \\`${upgradeToThisCli()}\\` to pin them alike, then rebuild.`));\n }\n\n /* Fold the project's static apps into the backend bundle, so ONE\n runtime serves the site at `/`, the admin at `/admin` and the API\n at `/api` — the shape the scaffolded template produces and the\n shape a custom container already had.\n\n Without this, moving a project to the managed runtime silently\n removed its website: the API answered perfectly and every page\n 404'd, because the managed pod runs the backend bundle and nothing\n else. Parity with the container being replaced is the only honest\n baseline for calling managed a drop-in.\n\n `--no-static` opts out, for a project that publishes its frontend\n somewhere else and does not want the assets in its bundle. */\n if (!args[\"--no-static\"]) {\n const folded = await foldFrontendIntoBundle({\n projectRoot,\n manifest,\n bundleDir: result.outDir,\n skipBuild: args[\"--skip-static-build\"] === true,\n builtApps,\n log: (m) => console.log(m)\n }).catch((err: unknown) => {\n console.error(chalk.red(` ✗ ${err instanceof Error ? err.message : String(err)}`));\n process.exit(1);\n });\n for (const outcome of folded ?? []) {\n console.log(\n chalk.green(` ✓ ${outcome.appName} folded in`) +\n chalk.dim(` (${outcome.fileCount} file(s) → served at ${formatAppAddress(outcome)})`)\n );\n }\n }\n } else if (app.type === \"static\") {\n await buildAssetApp(projectRoot, name, app, manifest.rebase, output, { builtApps }).catch((err: unknown) => {\n console.error(chalk.red(` ✗ ${err instanceof Error ? err.message : String(err)}`));\n process.exit(1);\n });\n }\n\n console.log(\"\");\n }\n\n console.log(chalk.green(\"✓ Build complete.\"));\n}\n\n/**\n * Build a static app and package it into a static bundle.\n *\n * Runs the app's own build command, checks it produced the declared output, then\n * packages that output into a `static`-kind bundle — the same deployable shape as\n * a backend bundle, so a frontend or admin app deploys through the identical\n * path and runs on the identical image, just serving files instead of an API.\n *\n * Throws when the build fails or produces nothing usable, so the caller answers\n * in its own way: `rebase build` with a red line, `rebase cloud deploy --json`\n * with its JSON error.\n */\nexport async function buildAssetApp(\n projectRoot: string,\n name: string,\n app: RebaseAppConfig,\n runtimeRange: string,\n outOverride?: string,\n /**\n * `quietStdout`: every line, the build command's included, goes to stderr. See `toolStdio`.\n * `builtApps`: the static apps already built in this run (see `FoldOptions.builtApps`).\n */\n options: { quietStdout?: boolean; builtApps?: Set<string> } = {}\n): Promise<string | undefined> {\n const asset = app as RebaseStaticAppConfig;\n // The path part is what the app is built for and mounted at; the hostname,\n // when `path` names one, only travels in the bundle.\n const address = staticAppAddress(name, asset);\n const basePath = address.path;\n const say = (line: string): void => {\n if (options.quietStdout) console.error(line);\n else console.log(line);\n };\n\n if (!asset.build) {\n say(chalk.dim(\" no build command declared — skipping\"));\n return undefined;\n }\n\n if (options.builtApps?.has(name)) {\n say(chalk.dim(\" built once already in this run — packaging that output\"));\n } else {\n try {\n await execa(asset.build, {\n cwd: projectRoot,\n stdio: toolStdio(options.quietStdout),\n shell: true,\n env: staticBuildEnv(basePath, name)\n });\n } catch {\n throw new Error(`build command failed for \"${name}\"`);\n }\n options.builtApps?.add(name);\n }\n\n if (!asset.output) {\n say(chalk.yellow(\" no output directory declared — built, but nothing to bundle\"));\n return undefined;\n }\n\n const outputPath = path.join(projectRoot, asset.output);\n if (!fs.existsSync(outputPath)) {\n // The command exited 0 but produced nothing where the manifest says it\n // should. Bundling that would ship an empty site.\n throw new Error(`declared output \"${asset.output}\" does not exist after building`);\n }\n\n // The assets were built for `basePath`; refusing here is the difference\n // between a build error and a blank page nobody can diagnose.\n const indexHtml = path.join(outputPath, \"index.html\");\n if (fs.existsSync(indexHtml)) {\n assertBuiltForPath(fs.readFileSync(indexHtml, \"utf8\"), basePath, name);\n }\n\n // Per-app bundle directory, so a project's several static apps do not clobber\n // one another or the backend's `dist-bundle`.\n const outDir = outOverride\n ? path.resolve(process.cwd(), outOverride)\n : path.join(projectRoot, `dist-bundle-${name}`);\n const result = buildStaticBundle({\n projectRoot,\n appName: name,\n assetsDir: outputPath,\n outDir,\n runtimeRange,\n path: basePath,\n host: address.host,\n spa: asset.spa ?? true,\n cms: asset.cms,\n routes: asset.routes,\n frameAncestors: asset.frameAncestors\n });\n const rel = path.relative(projectRoot, result.outDir);\n say(\n chalk.green(` ✓ static bundle → ${rel}/`) +\n chalk.dim(` (${result.fileCount} file(s) → served at ${formatAppAddress(address)})`)\n );\n return result.outDir;\n}\n\n/**\n * The `rebase upgrade` line the drift warnings print.\n *\n * Aimed at this CLI's own version, because that is what the warning measured\n * against: \"older than this CLI\" is answered by moving to exactly this CLI, not\n * to whatever `latest` happens to be — which, on a canary, is older still.\n */\nfunction upgradeToThisCli(): string {\n const version = cliVersion();\n return version === \"unknown\" ? \"rebase upgrade\" : `rebase upgrade --to ${version}`;\n}\n\n/**\n * Refuse to build a frontend whose Vite config lacks `rebaseBackendGuard()`.\n *\n * The CLI runs each app's own build command rather than driving Vite, so it\n * cannot add the guard to the build; it refuses to run the build without it.\n * Without the guard nothing stops a value import of `backend/` from shipping\n * server hooks to the browser (`utils/backend-guard.ts`).\n */\nasync function refuseUnguardedFrontend(projectRoot: string): Promise<void> {\n try {\n await assertBackendGuarded(projectRoot);\n } catch (err) {\n console.error(chalk.red(`✗ ${err instanceof Error ? err.message : String(err)}`));\n process.exit(1);\n }\n}\n\n/** The pre-manifest behaviour: build every workspace package. */\nasync function runWorkspaceBuilds(projectRoot: string): Promise<void> {\n const pm = detectPackageManager(projectRoot);\n const cmds = getPMCommands(pm);\n const buildCmd = cmds.runAll(\"build\");\n\n console.log(`${chalk.bold(\"Rebase\")} — Building all workspaces with ${chalk.cyan(pm)}...\\n`);\n\n try {\n await execa(buildCmd[0], buildCmd.slice(1), {\n cwd: projectRoot,\n stdio: \"inherit\"\n });\n } catch {\n console.error(chalk.red(\"\\n✗ Build failed.\"));\n process.exit(1);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+CA,SAAS,YAAkB;CACvB,QAAQ,IAAI;EACd,MAAM,KAAK,cAAc,EAAE;;EAE3B,MAAM,KAAK,OAAO,EAAE;;;EAGpB,MAAM,KAAK,SAAS,EAAE;mEAC2C,mBAAmB;;;;;;;;;;;;;;;EAepF,MAAM,KAAK,UAAU,EAAE;;;;EAIvB,KAAK,CAAC;AACR;;;;;;;;;;;;;;;;;;;;;;;AAwBA,SAAgB,gBACZ,aACA,MACA,KACQ;CACR,MAAM,aAAa,IAAI,cAAc;CACrC,MAAM,UAAU,IAAI,WAAW;CAC/B,MAAM,aAAa,KAAK,QAAQ,aAAa,OAAO;CACpD,MAAM,cAAc,KAAK,SAAS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