@rebasepro/cli 0.30.1 → 0.31.0-canary.g59cd6fd
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.
- package/README.md +8 -7
- package/dist/{agent-setup-0uyfC7VX.js → agent-setup-DqAcoDcn.js} +10 -5
- package/dist/{agent-setup-0uyfC7VX.js.map → agent-setup-DqAcoDcn.js.map} +1 -1
- package/dist/{api-keys-Dfw5-9s1.js → api-keys-eIUjMqWn.js} +8 -7
- package/dist/api-keys-eIUjMqWn.js.map +1 -0
- package/dist/{apps-MKQbgDtN.js → apps-DExO4PEl.js} +8 -7
- package/dist/apps-DExO4PEl.js.map +1 -0
- package/dist/{project-CasK56vN.js → args-CaCcrYE1.js} +2 -351
- package/dist/args-CaCcrYE1.js.map +1 -0
- package/dist/{atlas-dev-database-BODqdCWt.js → atlas-dev-database-DOCKk6ht.js} +2 -2
- package/dist/{atlas-dev-database-BODqdCWt.js.map → atlas-dev-database-DOCKk6ht.js.map} +1 -1
- package/dist/{auth-Bv0rTbQX.js → auth-D96QYgFR.js} +7 -6
- package/dist/{auth-Bv0rTbQX.js.map → auth-D96QYgFR.js.map} +1 -1
- package/dist/backend-guard-C0mVkXBw.js +162 -0
- package/dist/backend-guard-C0mVkXBw.js.map +1 -0
- package/dist/{branch-pointer-BQUF6lYa.js → branch-pointer-DMPyvZoK.js} +1 -1
- package/dist/{build-BuKTnec8.js → build-CA5R07tw.js} +29 -9
- package/dist/build-CA5R07tw.js.map +1 -0
- package/dist/{bundle-BAH4FCju.js → bundle-DgILeA5b.js} +112 -138
- package/dist/bundle-DgILeA5b.js.map +1 -0
- package/dist/bundle.d.ts +35 -12
- package/dist/cli.d.ts +2 -2
- package/dist/{cloud-DtADfWwn.js → cloud-CYMk92iG.js} +72 -71
- package/dist/cloud-CYMk92iG.js.map +1 -0
- package/dist/cms-directories-BK3vcswg.js +33 -0
- package/dist/cms-directories-BK3vcswg.js.map +1 -0
- package/dist/codemod/collections-to-tables/ast.d.ts +135 -0
- package/dist/codemod/collections-to-tables/backend.d.ts +38 -0
- package/dist/codemod/collections-to-tables/command.d.ts +35 -0
- package/dist/codemod/collections-to-tables/comments.d.ts +45 -0
- package/dist/codemod/collections-to-tables/customization.d.ts +47 -0
- package/dist/codemod/collections-to-tables/dynamic-props.d.ts +34 -0
- package/dist/codemod/collections-to-tables/export-changes.d.ts +83 -0
- package/dist/codemod/collections-to-tables/firestore.d.ts +11 -0
- package/dist/codemod/collections-to-tables/helper-hooks.d.ts +41 -0
- package/dist/codemod/collections-to-tables/hooks.d.ts +44 -0
- package/dist/codemod/collections-to-tables/journal.d.ts +10 -0
- package/dist/codemod/collections-to-tables/legacy-shims.d.ts +52 -0
- package/dist/codemod/collections-to-tables/load-legacy.d.ts +81 -0
- package/dist/codemod/collections-to-tables/migrate.d.ts +20 -0
- package/dist/codemod/collections-to-tables/modules.d.ts +127 -0
- package/dist/codemod/collections-to-tables/moved-imports.d.ts +70 -0
- package/dist/codemod/collections-to-tables/moved-symbols.generated.d.ts +12 -0
- package/dist/codemod/collections-to-tables/own.d.ts +10 -0
- package/dist/codemod/collections-to-tables/path-aliases.d.ts +26 -0
- package/dist/codemod/collections-to-tables/plan-context.d.ts +49 -0
- package/dist/codemod/collections-to-tables/print-js.d.ts +44 -0
- package/dist/codemod/collections-to-tables/project-files.d.ts +144 -0
- package/dist/codemod/collections-to-tables/repoint.d.ts +50 -0
- package/dist/codemod/collections-to-tables/row-hands.d.ts +7 -0
- package/dist/codemod/collections-to-tables/sdk-calls.d.ts +88 -0
- package/dist/codemod/collections-to-tables/skills-step.d.ts +13 -0
- package/dist/codemod/collections-to-tables/split-constants.d.ts +42 -0
- package/dist/codemod/collections-to-tables/storage-paths.d.ts +28 -0
- package/dist/codemod/collections-to-tables/types.d.ts +164 -0
- package/dist/codemod/collections-to-tables/verify.d.ts +27 -0
- package/dist/codemod/collections-to-tables/vocabulary.d.ts +40 -0
- package/dist/command-D5lhW_-B.js +9984 -0
- package/dist/command-D5lhW_-B.js.map +1 -0
- package/dist/commands/agent-setup.d.ts +6 -2
- package/dist/commands/cloud/context.d.ts +1 -1
- package/dist/commands/cloud/init.d.ts +2 -2
- package/dist/commands/console.d.ts +1 -2
- package/dist/commands/db.d.ts +5 -6
- package/dist/commands/dev.d.ts +18 -17
- package/dist/commands/doctor.d.ts +4 -5
- package/dist/commands/eject.d.ts +17 -13
- package/dist/commands/generate-view.d.ts +20 -9
- package/dist/commands/generate_sdk.d.ts +27 -27
- package/dist/commands/init.d.ts +21 -8
- package/dist/commands/migrate.d.ts +24 -0
- package/dist/commands/schema-reconcile.d.ts +1 -1
- package/dist/commands/skills.d.ts +8 -0
- package/dist/commands/verify-cms.d.ts +28 -0
- package/dist/commands/verify.d.ts +14 -9
- package/dist/{consent-BD7F29T3.js → consent-BXLIrMl8.js} +2 -2
- package/dist/{consent-BD7F29T3.js.map → consent-BXLIrMl8.js.map} +1 -1
- package/dist/{console-CdwIYOMV.js → console-C1d3LwB7.js} +14 -14
- package/dist/console-C1d3LwB7.js.map +1 -0
- package/dist/{context-AXdAh-q8.js → context--JwaHaZp.js} +6 -5
- package/dist/context--JwaHaZp.js.map +1 -0
- package/dist/{daemon-Cp7oNXth.js → daemon-w30PsdwV.js} +2 -2
- package/dist/{daemon-Cp7oNXth.js.map → daemon-w30PsdwV.js.map} +1 -1
- package/dist/{db-DBbKpjYX.js → db-DQZK9n9c.js} +52 -51
- package/dist/db-DQZK9n9c.js.map +1 -0
- package/dist/{derive-ae9UOoOB.js → derive-C3ezmY-p.js} +105 -133
- package/dist/derive-C3ezmY-p.js.map +1 -0
- package/dist/{dev-C93d4QIv.js → dev-PY5h4O6u.js} +142 -84
- package/dist/dev-PY5h4O6u.js.map +1 -0
- package/dist/dev-db/attver.d.ts +32 -0
- package/dist/dev-db/pull.d.ts +15 -1
- package/dist/{dev-preflight-Cxv3TiD1.js → dev-preflight-DjvcV6SK.js} +5 -5
- package/dist/dev-preflight-DjvcV6SK.js.map +1 -0
- package/dist/{dev-server-OJsUGZEB.js → dev-server-BLxCbQEP.js} +2 -2
- package/dist/{dev-server-OJsUGZEB.js.map → dev-server-BLxCbQEP.js.map} +1 -1
- package/dist/{doctor-BBPQUO2g.js → doctor-CnUu8kpM.js} +39 -62
- package/dist/doctor-CnUu8kpM.js.map +1 -0
- package/dist/doctor-environment.d.ts +6 -6
- package/dist/{eject-DABcDnPN.js → eject-Bhzd6hgb.js} +25 -16
- package/dist/eject-Bhzd6hgb.js.map +1 -0
- package/dist/{fold-static-BWzxNn06.js → fold-static-CKewnAPX.js} +5 -3
- package/dist/fold-static-CKewnAPX.js.map +1 -0
- package/dist/{generate-view-IFwCADvb.js → generate-view-CTOluXvH.js} +160 -89
- package/dist/generate-view-CTOluXvH.js.map +1 -0
- package/dist/{generate_sdk-DNmNuFuW.js → generate_sdk-De-aLC1L.js} +120 -137
- package/dist/generate_sdk-De-aLC1L.js.map +1 -0
- package/dist/import-schema-module-Df67TIWj.js +51 -0
- package/dist/import-schema-module-Df67TIWj.js.map +1 -0
- package/dist/index.es.js +64 -51
- package/dist/index.es.js.map +1 -1
- package/dist/{init-vL1DWOeC.js → init-Dtl-IcXf.js} +83 -80
- package/dist/init-Dtl-IcXf.js.map +1 -0
- package/dist/last-dev-database-Dc8cP01o.js +2 -0
- package/dist/{manifest-BtzDy7KQ.js → manifest-C3uLDrrJ.js} +115 -40
- package/dist/manifest-C3uLDrrJ.js.map +1 -0
- package/dist/manifest.d.ts +79 -24
- package/dist/migrate-VrKoi3nB.js +138 -0
- package/dist/migrate-VrKoi3nB.js.map +1 -0
- package/dist/{normalize-imports-Bd5Y4yLp.js → normalize-imports-DwxqEMYq.js} +3 -3
- package/dist/{normalize-imports-Bd5Y4yLp.js.map → normalize-imports-DwxqEMYq.js.map} +1 -1
- package/dist/path-flags-7O5uPBcQ.js +139 -0
- package/dist/path-flags-7O5uPBcQ.js.map +1 -0
- package/dist/{prepare-CTw9NEkh.js → prepare-Ccxspoj-.js} +4 -4
- package/dist/{prepare-CTw9NEkh.js.map → prepare-Ccxspoj-.js.map} +1 -1
- package/dist/project-CLcF5i8c.js +360 -0
- package/dist/project-CLcF5i8c.js.map +1 -0
- package/dist/project-schema-CsSOG2gE.js +30 -0
- package/dist/project-schema-CsSOG2gE.js.map +1 -0
- package/dist/{pull-DDMpsZ5r.js → pull-DRWqBZp5.js} +327 -4
- package/dist/pull-DRWqBZp5.js.map +1 -0
- package/dist/resolve-BY7bSFRT.js +2 -0
- package/dist/resources/derive.d.ts +19 -13
- package/dist/{resources-CPSC5Kcu.js → resources-Dpfs2y8P.js} +5 -4
- package/dist/{resources-CPSC5Kcu.js.map → resources-Dpfs2y8P.js.map} +1 -1
- package/dist/{schema-DtLPsXbT.js → schema-CdDjv5zI.js} +41 -39
- package/dist/schema-CdDjv5zI.js.map +1 -0
- package/dist/schema-dir-Cd1kvYbf.js +98 -0
- package/dist/schema-dir-Cd1kvYbf.js.map +1 -0
- package/dist/schema-reconcile-BAupXfkd.js +2 -0
- package/dist/schema-text-CpNrsuMe.js +73 -0
- package/dist/schema-text-CpNrsuMe.js.map +1 -0
- package/dist/{skills-CbwV6vw_.js → skills-CXjA9TWw.js} +54 -10
- package/dist/skills-CXjA9TWw.js.map +1 -0
- package/dist/{start-YOr3X5Zm.js → start-Bwbtt2W5.js} +7 -10
- package/dist/{start-YOr3X5Zm.js.map → start-Bwbtt2W5.js.map} +1 -1
- package/dist/{status-BREvtzJm.js → status-D7XCGHu2.js} +12 -12
- package/dist/status-D7XCGHu2.js.map +1 -0
- package/dist/{storage-CO9ouK76.js → storage-iTqj5-Av.js} +12 -11
- package/dist/storage-iTqj5-Av.js.map +1 -0
- package/dist/{telemetry-DwK5RQJl.js → telemetry-BP_1Cl9r.js} +4 -4
- package/dist/{telemetry-DwK5RQJl.js.map → telemetry-BP_1Cl9r.js.map} +1 -1
- package/dist/{telemetry-CgwJPVMO.js → telemetry-M3HjlyhZ.js} +2 -2
- package/dist/{telemetry-CgwJPVMO.js.map → telemetry-M3HjlyhZ.js.map} +1 -1
- package/dist/{upgrade-B7sVwL8S.js → upgrade-oZzJ13jM.js} +5 -4
- package/dist/{upgrade-B7sVwL8S.js.map → upgrade-oZzJ13jM.js.map} +1 -1
- package/dist/utils/backend-guard.d.ts +47 -0
- package/dist/utils/cms-directories.d.ts +6 -0
- package/dist/utils/dev-preflight.d.ts +2 -2
- package/dist/utils/import-schema-module.d.ts +16 -0
- package/dist/utils/path-flags.d.ts +35 -16
- package/dist/utils/project-schema.d.ts +40 -0
- package/dist/utils/project.d.ts +8 -2
- package/dist/utils/schema-dir.d.ts +32 -0
- package/dist/utils/schema-drift.d.ts +6 -0
- package/dist/utils/schema-text.d.ts +24 -0
- package/dist/verify-5p_vaUG2.js +1160 -0
- package/dist/verify-5p_vaUG2.js.map +1 -0
- package/package.json +11 -8
- package/runtime/dev-server.mjs +5 -1
- package/templates/eject/Dockerfile +1 -4
- package/templates/eject/backend/src/env.ts +1 -1
- package/templates/eject/backend/src/index.ts +53 -40
- package/templates/eject/docker-compose.custom.yml +1 -1
- package/templates/overlays/baas/README.md +39 -12
- package/templates/overlays/baas/ai-instructions.md +8 -8
- package/templates/overlays/baas/{config → backend}/storage.ts +3 -4
- package/templates/overlays/baas/backend/tsconfig.json +10 -12
- package/templates/overlays/baas/package.json +1 -2
- package/templates/overlays/baas/pnpm-workspace.yaml +0 -1
- package/templates/presets/blank/backend/schema/index.ts +19 -0
- package/templates/presets/blank/frontend/src/App.tsx +56 -0
- package/templates/presets/ecommerce/backend/schema/categories.ts +12 -0
- package/templates/presets/ecommerce/backend/schema/index.ts +23 -0
- package/templates/presets/ecommerce/backend/schema/orders.ts +13 -0
- package/templates/presets/ecommerce/backend/schema/products.ts +18 -0
- package/templates/presets/ecommerce/frontend/src/App.tsx +59 -0
- package/templates/presets/ecommerce/frontend/src/cms/categories.tsx +12 -0
- package/templates/presets/ecommerce/frontend/src/cms/orders.tsx +38 -0
- package/templates/presets/ecommerce/frontend/src/cms/products.tsx +27 -0
- package/templates/resource-graphs/blank.json +2 -2
- package/templates/resource-graphs/blog.json +5 -5
- package/templates/resource-graphs/ecommerce.json +5 -5
- package/templates/resource-graphs/headless.json +1 -1
- package/templates/template/.claude/hooks/post-edit-collection.sh +27 -23
- package/templates/template/.cursorrules +2 -2
- package/templates/template/.env.example +6 -17
- package/templates/template/.github/copilot-instructions.md +2 -2
- package/templates/template/.windsurfrules +2 -2
- package/templates/template/AGENTS.md +2 -2
- package/templates/template/CLAUDE.md +2 -2
- package/templates/template/README.md +47 -13
- package/templates/template/ai-instructions.md +15 -14
- package/templates/template/backend/functions/hello.ts +1 -1
- package/templates/template/backend/package.json +0 -2
- package/templates/template/{config → backend}/resources.ts +3 -3
- package/templates/template/backend/schema/authors.ts +11 -0
- package/templates/template/backend/schema/index.ts +29 -0
- package/templates/template/backend/schema/posts.ts +29 -0
- package/templates/template/backend/schema/tags.ts +9 -0
- package/templates/template/backend/schema/users.ts +32 -0
- package/templates/template/{config → backend}/storage.ts +4 -4
- package/templates/template/backend/tsconfig.json +15 -20
- package/templates/template/docker-compose.yml +3 -3
- package/templates/template/frontend/package.json +0 -2
- package/templates/template/frontend/src/App.tsx +10 -4
- package/templates/template/frontend/src/cms/authors.tsx +7 -0
- package/templates/template/frontend/src/cms/posts.tsx +27 -0
- package/templates/template/frontend/src/cms/tags.tsx +11 -0
- package/templates/template/frontend/src/cms/ui-config.json +3 -0
- package/templates/template/frontend/src/cms/users.tsx +54 -0
- package/templates/template/frontend/src/{virtual.d.ts → vite-env.d.ts} +0 -4
- package/templates/template/frontend/vite.config.ts +6 -2
- package/templates/template/gitignore +1 -1
- package/templates/template/package.json +1 -2
- package/templates/template/pnpm-workspace.yaml +0 -1
- package/templates/template/scripts/example.ts +3 -3
- package/templates/template/tsconfig.json +1 -1
- package/templates/views/AppView.tsx.tmpl +4 -4
- package/templates/views/EntityView.tsx.tmpl +3 -4
- package/dist/api-keys-Dfw5-9s1.js.map +0 -1
- package/dist/apps-MKQbgDtN.js.map +0 -1
- package/dist/build-BuKTnec8.js.map +0 -1
- package/dist/bundle-BAH4FCju.js.map +0 -1
- package/dist/cloud-DtADfWwn.js.map +0 -1
- package/dist/collection-drift-BKj_BoMq.js +0 -106
- package/dist/collection-drift-BKj_BoMq.js.map +0 -1
- package/dist/collections-dir-DlvDhime.js +0 -69
- package/dist/collections-dir-DlvDhime.js.map +0 -1
- package/dist/console-CdwIYOMV.js.map +0 -1
- package/dist/context-AXdAh-q8.js.map +0 -1
- package/dist/db-DBbKpjYX.js.map +0 -1
- package/dist/derive-ae9UOoOB.js.map +0 -1
- package/dist/dev-C93d4QIv.js.map +0 -1
- package/dist/dev-preflight-Cxv3TiD1.js.map +0 -1
- package/dist/doctor-BBPQUO2g.js.map +0 -1
- package/dist/eject-DABcDnPN.js.map +0 -1
- package/dist/fold-static-BWzxNn06.js.map +0 -1
- package/dist/generate-view-IFwCADvb.js.map +0 -1
- package/dist/generate_sdk-DNmNuFuW.js.map +0 -1
- package/dist/init-vL1DWOeC.js.map +0 -1
- package/dist/last-dev-database-DpW5dfoX.js +0 -2
- package/dist/manifest-BtzDy7KQ.js.map +0 -1
- package/dist/path-flags-DNvtEi2-.js +0 -92
- package/dist/path-flags-DNvtEi2-.js.map +0 -1
- package/dist/project-CasK56vN.js.map +0 -1
- package/dist/pull-DDMpsZ5r.js.map +0 -1
- package/dist/resolve-D647F1LA.js +0 -2
- package/dist/schema-DtLPsXbT.js.map +0 -1
- package/dist/schema-reconcile-DkArN9jF.js +0 -2
- package/dist/skills-CbwV6vw_.js.map +0 -1
- package/dist/status-BREvtzJm.js.map +0 -1
- package/dist/storage-CO9ouK76.js.map +0 -1
- package/dist/utils/collection-drift.d.ts +0 -27
- package/dist/utils/collections-dir.d.ts +0 -14
- package/dist/verify-Y3rWSgfA.js +0 -730
- package/dist/verify-Y3rWSgfA.js.map +0 -1
- package/templates/overlays/baas/config/index.ts +0 -24
- package/templates/overlays/baas/config/package.json +0 -30
- package/templates/template/config/cms.d.ts +0 -15
- package/templates/template/config/collections/authors.ts +0 -47
- package/templates/template/config/collections/index.ts +0 -44
- package/templates/template/config/collections/posts.ts +0 -94
- package/templates/template/config/collections/presets/blank/index.ts +0 -5
- package/templates/template/config/collections/presets/ecommerce/categories.ts +0 -42
- package/templates/template/config/collections/presets/ecommerce/index.ts +0 -31
- package/templates/template/config/collections/presets/ecommerce/orders.ts +0 -78
- package/templates/template/config/collections/presets/ecommerce/products.ts +0 -73
- package/templates/template/config/collections/tags.ts +0 -27
- package/templates/template/config/collections/users.ts +0 -149
- package/templates/template/config/frontend-assets.d.ts +0 -17
- package/templates/template/config/index.ts +0 -12
- package/templates/template/config/package.json +0 -30
- package/templates/template/config/tsconfig.json +0 -35
- /package/templates/eject/{config → backend}/resources.ts +0 -0
package/dist/index.es.js.map
CHANGED
|
@@ -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,C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D,MAAM,KAAK,qBAAqB,EAAE;;EAEhH,MAAM,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;EAC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KAAK,cAAc,EAAE;IAC/B,MAAM,KAAK,KAAK,aAAa,EAAE;IAC/B,MAAM,KAAK,KAAK,YAAY,EAAE;IAC9B,MAAM,KAAK,KAAK,cAAc,EAAE;IAChC,MAAM,KAAK,KAAK,qBAAqB,EAAE,iCAAiC,MAAM,KAAK,wBAAwB,EAAE;IAC7G,MAAM,KAAK,KAAK,OAAO,EAAE,GAAG,MAAM,KAAK,QAAQ,EAAE;;EAEnD,MAAM,MAAM,KAAK,SAAS,EAAE;IAC1B,MAAM,KAAK,eAAe,EAAE;IAC5B,MAAM,KAAK,YAAY,EAAE;IACzB,MAAM,KAAK,SAAS,EAAE,sDAAsD,MAAM,KAAK,qBAAqB,EAAE;;EAEhH,MAAM,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,14 +1,14 @@
|
|
|
1
|
-
import { i as recordEvent, l as durationBucket } from "./telemetry-
|
|
1
|
+
import { i as recordEvent, l as durationBucket } from "./telemetry-M3HjlyhZ.js";
|
|
2
2
|
import { n as getPMCommands, t as detectPackageManager } from "./package-manager-DSEOwTqM.js";
|
|
3
|
-
import {
|
|
3
|
+
import { a as wantsHelp, n as parseCommandArgs } from "./args-CaCcrYE1.js";
|
|
4
4
|
import { n as cliVersion } from "./version-Buyyo1ut.js";
|
|
5
|
-
import {
|
|
6
|
-
import { configureAgents, printAgentSetup, promptForAgents, retargetScaffoldMcpConfig } from "./agent-setup-
|
|
7
|
-
import { $ as resolveCloudUrl, ct as writeLink } from "./context
|
|
5
|
+
import { c as reportRootPointers, d as writeRootPointers, l as resolveAgentNames, n as AGENT_KEYS, t as AGENTS } from "./skills-CXjA9TWw.js";
|
|
6
|
+
import { configureAgents, printAgentSetup, promptForAgents, retargetScaffoldMcpConfig } from "./agent-setup-DqAcoDcn.js";
|
|
7
|
+
import { $ as resolveCloudUrl, ct as writeLink } from "./context--JwaHaZp.js";
|
|
8
8
|
import { t as Refusal } from "./refusal-ReeeGP8a.js";
|
|
9
|
-
import { r as dockerClaimedPorts } from "./dev-preflight-
|
|
9
|
+
import { r as dockerClaimedPorts } from "./dev-preflight-DjvcV6SK.js";
|
|
10
10
|
import { t as invokedRebaseCommand } from "./invoked-command-CG_rIa_o.js";
|
|
11
|
-
import { n as promptForConsent } from "./consent-
|
|
11
|
+
import { n as promptForConsent } from "./consent-BXLIrMl8.js";
|
|
12
12
|
import chalk from "chalk";
|
|
13
13
|
import fs from "fs";
|
|
14
14
|
import path from "path";
|
|
@@ -53,7 +53,6 @@ var TEMPLATE_PLACEHOLDER_FILES = [
|
|
|
53
53
|
"package.json",
|
|
54
54
|
"frontend/package.json",
|
|
55
55
|
"backend/package.json",
|
|
56
|
-
"config/package.json",
|
|
57
56
|
"frontend/index.html",
|
|
58
57
|
"pnpm-workspace.yaml",
|
|
59
58
|
"docker-compose.yml",
|
|
@@ -71,15 +70,16 @@ function validateProjectName(name) {
|
|
|
71
70
|
* A boolean, not a named pair. It was `--flavor cms|baas`, and neither word
|
|
72
71
|
* survived what they described: "cms" is a product category rather than a thing
|
|
73
72
|
* this tool builds, and "baas" was the same value that used to appear as
|
|
74
|
-
* `backend.mode` — which is now derived from whether
|
|
75
|
-
* What is left is one question: does this project get an
|
|
73
|
+
* `backend.mode` — which is now derived from whether tables are declared in
|
|
74
|
+
* `backend/schema/`. What is left is one question: does this project get an
|
|
75
|
+
* admin UI?
|
|
76
76
|
*/
|
|
77
77
|
var HEADLESS_CHOICES = [{
|
|
78
|
-
name: "Backend + admin — API plus an admin UI,
|
|
78
|
+
name: "Backend + admin — API plus an admin UI, over tables you define in backend/schema (like Payload/Directus)",
|
|
79
79
|
value: false,
|
|
80
80
|
short: "Backend + admin"
|
|
81
81
|
}, {
|
|
82
|
-
name: "Backend only — headless API over your database. No
|
|
82
|
+
name: "Backend only — headless API over your database. No schema files, no UI (like Supabase)",
|
|
83
83
|
value: true,
|
|
84
84
|
short: "Backend only"
|
|
85
85
|
}];
|
|
@@ -177,7 +177,7 @@ function buildInitQuestions(params) {
|
|
|
177
177
|
questions.push({
|
|
178
178
|
type: "confirm",
|
|
179
179
|
name: "introspect",
|
|
180
|
-
message: "Would you like to introspect this database to
|
|
180
|
+
message: "Would you like to introspect this database to generate backend/schema from its tables?",
|
|
181
181
|
default: true,
|
|
182
182
|
when: (answers) => !!answers.databaseUrl?.trim()
|
|
183
183
|
});
|
|
@@ -206,7 +206,7 @@ ${chalk.bold("Usage")}
|
|
|
206
206
|
|
|
207
207
|
${chalk.bold("Options")}
|
|
208
208
|
${chalk.blue("-t, --template")} ${chalk.gray("<preset>")} blog | ecommerce | blank ${chalk.gray("(default: blog)")}
|
|
209
|
-
${chalk.blue("--headless")} Backend only — no admin panel, no
|
|
209
|
+
${chalk.blue("--headless")} Backend only — no admin panel, no backend/schema
|
|
210
210
|
${chalk.blue("-y, --yes")} Never prompt ${chalk.gray("(required for CI / non-TTY)")}: take every default,
|
|
211
211
|
${chalk.gray("except that git init and the install are skipped unless")}
|
|
212
212
|
${chalk.gray("--git / --install is passed")}
|
|
@@ -216,7 +216,7 @@ ${chalk.bold("Options")}
|
|
|
216
216
|
${chalk.blue("-g, --git")} Initialize a git repository and make an initial commit.
|
|
217
217
|
${chalk.gray("Without it, init asks (default yes); under --yes, no repository")}
|
|
218
218
|
${chalk.blue("--database-url")} ${chalk.gray("<url>")} Use an existing database instead of the generated one
|
|
219
|
-
${chalk.blue("--introspect")} Generate
|
|
219
|
+
${chalk.blue("--introspect")} Generate backend/schema from that database ${chalk.gray("(implies --template blank; needs --install)")}
|
|
220
220
|
${chalk.blue("--project")} ${chalk.gray("<slug>")} Link the scaffold to a Rebase Cloud project
|
|
221
221
|
${chalk.blue("--setup-key")} ${chalk.gray("<key>")} One-time key authenticating the cloud link ${chalk.gray("(use with --project)")}
|
|
222
222
|
${chalk.blue("-a, --agent")} ${chalk.gray("<name>")} Set up an AI coding agent: Rebase skills + the MCP server.
|
|
@@ -225,9 +225,9 @@ ${chalk.bold("Options")}
|
|
|
225
225
|
${chalk.gray("machine; under --yes, none unless named.")}
|
|
226
226
|
|
|
227
227
|
${chalk.bold("What gets scaffolded")}
|
|
228
|
-
${chalk.gray("default")}
|
|
229
|
-
${chalk.blue("--headless")}
|
|
230
|
-
${chalk.gray("--template has no effect: there are no
|
|
228
|
+
${chalk.gray("default")} backend/ (tables in backend/schema) + frontend/ (the admin UI) ${chalk.gray("(like Payload/Directus)")}
|
|
229
|
+
${chalk.blue("--headless")} backend/ only, over your existing database ${chalk.gray("(like Supabase)")}
|
|
230
|
+
${chalk.gray("--template has no effect: there are no tables to seed.")}
|
|
231
231
|
|
|
232
232
|
${chalk.bold("Examples")}
|
|
233
233
|
${chalk.gray("$")} rebase init my-shop --template ecommerce --install
|
|
@@ -506,7 +506,7 @@ async function linkScaffoldToCloud(options) {
|
|
|
506
506
|
* new scaffold whose first `git status` is dirty invites the reader to conclude
|
|
507
507
|
* the lockfile is deliberately ignored and never commit it at all.
|
|
508
508
|
*
|
|
509
|
-
* Introspection has the same shape: it generates `
|
|
509
|
+
* Introspection has the same shape: it generates `backend/schema` and
|
|
510
510
|
* `schema.generated.ts`, which belong in the commit describing the scaffold that
|
|
511
511
|
* produced them.
|
|
512
512
|
*
|
|
@@ -560,7 +560,7 @@ function initNextSteps(input) {
|
|
|
560
560
|
if (!installed) lines.push(cmd(pm.install));
|
|
561
561
|
lines.push("");
|
|
562
562
|
if (introspected) {
|
|
563
|
-
lines.push(note("Database
|
|
563
|
+
lines.push(note("Database introspected: its tables are in backend/schema."));
|
|
564
564
|
lines.push(note(headless ? "Start the API over it:" : "Start the development server (frontend + backend):"));
|
|
565
565
|
lines.push(runDev);
|
|
566
566
|
} else if (introspect) {
|
|
@@ -606,7 +606,7 @@ function initNextSteps(input) {
|
|
|
606
606
|
lines.push(note("In production (docker compose) that window is shut and the account named by"));
|
|
607
607
|
lines.push(note("REBASE_ADMIN_EMAIL in .env is created at boot instead."));
|
|
608
608
|
lines.push("");
|
|
609
|
-
lines.push(headless ? introspected ? chalk.gray("This starts a headless API (Hono + PostgreSQL) over the
|
|
609
|
+
lines.push(headless ? introspected ? chalk.gray("This starts a headless API (Hono + PostgreSQL) over the tables just ") + chalk.gray("generated from your database in backend/schema. Edit them to change what the ") + chalk.gray("API exposes; its OpenAPI document is /api/docs for signed-in callers (Swagger UI: set REBASE_ENABLE_SWAGGER=true).") : chalk.gray("This starts a headless API (Hono + PostgreSQL). There is no backend/schema: ") + chalk.gray("the API is derived from your database schema. Once it serves a table, its OpenAPI document is /api/docs for signed-in callers (Swagger UI: set REBASE_ENABLE_SWAGGER=true).") : chalk.gray("This starts both the backend (Hono + PostgreSQL)") + chalk.gray(" and the frontend (Vite + React) concurrently."));
|
|
610
610
|
return lines;
|
|
611
611
|
}
|
|
612
612
|
/**
|
|
@@ -760,10 +760,10 @@ async function createProject(options) {
|
|
|
760
760
|
const shipped = path.join(options.targetDirectory, from);
|
|
761
761
|
if (fs.existsSync(shipped)) fs.renameSync(shipped, path.join(options.targetDirectory, to));
|
|
762
762
|
}
|
|
763
|
-
if (options.headless && options.explicitPreset) console.log(chalk.yellow(` Ignoring --template ${options.preset}: a headless project declares no
|
|
763
|
+
if (options.headless && options.explicitPreset) console.log(chalk.yellow(` Ignoring --template ${options.preset}: a headless project declares no tables (no backend/schema).`));
|
|
764
764
|
let applied = null;
|
|
765
765
|
if (!options.headless) {
|
|
766
|
-
if (options.introspect && options.preset !== "blank") console.log(chalk.gray(" Using the blank template:
|
|
766
|
+
if (options.introspect && options.preset !== "blank") console.log(chalk.gray(" Using the blank template: backend/schema will come from your database."));
|
|
767
767
|
applied = await applyPreset(options.targetDirectory, options.introspect ? "blank" : options.preset);
|
|
768
768
|
writeShippedSchema(options.targetDirectory, applied);
|
|
769
769
|
}
|
|
@@ -806,7 +806,7 @@ async function createProject(options) {
|
|
|
806
806
|
if (options.introspect) {
|
|
807
807
|
console.log("");
|
|
808
808
|
if (options.installDeps) {
|
|
809
|
-
console.log(chalk.gray(" Introspecting database
|
|
809
|
+
console.log(chalk.gray(" Introspecting the database into backend/schema..."));
|
|
810
810
|
console.log("");
|
|
811
811
|
try {
|
|
812
812
|
await execa(execCmd[0], execCmd.slice(1), {
|
|
@@ -867,27 +867,22 @@ async function createProject(options) {
|
|
|
867
867
|
if (await promptForConsent({ reAskDeclined: true })) await recordEvent("cli.init", initProperties, { projectRoot: options.targetDirectory });
|
|
868
868
|
}
|
|
869
869
|
/**
|
|
870
|
-
* Apply a template preset by replacing the default collection files.
|
|
871
|
-
*
|
|
872
|
-
* The template ships with blog collections at the top level and
|
|
873
|
-
* preset alternatives under `config/collections/presets/<name>/`.
|
|
874
|
-
* This function swaps the active collection files and removes the
|
|
875
|
-
* presets directory so the final project is clean.
|
|
876
|
-
*/
|
|
877
|
-
/**
|
|
878
870
|
* Reduce the scaffolded project to the chosen shape.
|
|
879
871
|
*
|
|
880
|
-
* The base template is
|
|
881
|
-
*
|
|
882
|
-
* its API from the database — and overlays
|
|
872
|
+
* The base template is Mode B: `backend/` and `frontend/`. `--headless` is
|
|
873
|
+
* Mode A: it drops `frontend/` and `backend/schema/` — there is nothing to
|
|
874
|
+
* declare, since the server derives its API from the database — and overlays
|
|
875
|
+
* the files that differ (`templates/overlays/baas/`).
|
|
883
876
|
*
|
|
884
|
-
*
|
|
885
|
-
* under row-level security, so a deployment with file storage
|
|
886
|
-
* access model serves every user's files to every signed-in
|
|
887
|
-
* refuses to boot in that state
|
|
888
|
-
*
|
|
889
|
-
*
|
|
890
|
-
*
|
|
877
|
+
* `backend/storage.ts` stays, replaced by the overlay's stricter default.
|
|
878
|
+
* Storage is not under row-level security, so a deployment with file storage
|
|
879
|
+
* enabled and no access model serves every user's files to every signed-in
|
|
880
|
+
* user; the server refuses to boot in that state, and the scaffold's own
|
|
881
|
+
* docker-compose.yml enables storage — without the hook the first
|
|
882
|
+
* `docker compose up` would crash-loop.
|
|
883
|
+
*
|
|
884
|
+
* Declaring tables later is one step: create `backend/schema/index.ts`. The
|
|
885
|
+
* overlay's README says so.
|
|
891
886
|
*/
|
|
892
887
|
async function applyHeadless(targetDirectory, headless) {
|
|
893
888
|
if (!headless) return;
|
|
@@ -895,15 +890,14 @@ async function applyHeadless(targetDirectory, headless) {
|
|
|
895
890
|
recursive: true,
|
|
896
891
|
force: true
|
|
897
892
|
});
|
|
898
|
-
fs.rmSync(path.join(targetDirectory, "
|
|
893
|
+
fs.rmSync(path.join(targetDirectory, "backend", "schema"), {
|
|
899
894
|
recursive: true,
|
|
900
895
|
force: true
|
|
901
896
|
});
|
|
902
|
-
for (const stray of ["cms.d.ts", "frontend-assets.d.ts"]) fs.rmSync(path.join(targetDirectory, "config", stray), { force: true });
|
|
903
897
|
fs.rmSync(path.join(targetDirectory, "backend", "src", "schema.generated.ts"), { force: true });
|
|
904
898
|
const overlayDir = path.resolve(cliRoot, "templates", "overlays", "baas");
|
|
905
899
|
if (!fs.existsSync(overlayDir)) {
|
|
906
|
-
console.error(`${chalk.red.bold("ERROR")}
|
|
900
|
+
console.error(`${chalk.red.bold("ERROR")} Headless template overlay not found at ${overlayDir}`);
|
|
907
901
|
process.exit(1);
|
|
908
902
|
}
|
|
909
903
|
await cp(overlayDir, targetDirectory, {
|
|
@@ -940,30 +934,45 @@ async function writeProjectPackageManagerIntoManifest(targetDirectory, pmCommand
|
|
|
940
934
|
if (changed) fs.writeFileSync(manifestPath, `${JSON.stringify(manifest, null, 4)}\n`, "utf8");
|
|
941
935
|
} catch {}
|
|
942
936
|
}
|
|
943
|
-
/**
|
|
937
|
+
/**
|
|
938
|
+
* The blog preset's own files: the template ships the blog preset, and these
|
|
939
|
+
* are what another preset takes out before laying its own files over it.
|
|
940
|
+
* `users` — the table and its customization — is shared by every preset, and
|
|
941
|
+
* `backend/schema/index.ts` and `frontend/src/App.tsx` are replaced by the
|
|
942
|
+
* preset's copies.
|
|
943
|
+
*
|
|
944
|
+
* Exported for `check:templates` and the init tests, which materialise each
|
|
945
|
+
* preset exactly as this does.
|
|
946
|
+
*/
|
|
947
|
+
var BLOG_PRESET_FILES = [
|
|
948
|
+
"backend/schema/posts.ts",
|
|
949
|
+
"backend/schema/authors.ts",
|
|
950
|
+
"backend/schema/tags.ts",
|
|
951
|
+
"frontend/src/cms/posts.tsx",
|
|
952
|
+
"frontend/src/cms/authors.tsx",
|
|
953
|
+
"frontend/src/cms/tags.tsx"
|
|
954
|
+
];
|
|
955
|
+
/** Where a non-blog preset's files ship: `templates/presets/<preset>/`, laid out as in a project. */
|
|
956
|
+
function presetOverlayPath(preset) {
|
|
957
|
+
return path.resolve(cliRoot, "templates", "presets", preset);
|
|
958
|
+
}
|
|
959
|
+
/**
|
|
960
|
+
* Lay the preset's tables and customizations over the blog preset the template
|
|
961
|
+
* ships. Returns the preset actually applied.
|
|
962
|
+
*/
|
|
944
963
|
async function applyPreset(targetDirectory, preset) {
|
|
945
|
-
|
|
946
|
-
const
|
|
947
|
-
if (
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
console.warn(chalk.yellow(` Warning: Preset "${preset}" not found, falling back to blog template.`));
|
|
951
|
-
cleanupPresets(presetsDir);
|
|
952
|
-
return "blog";
|
|
953
|
-
}
|
|
954
|
-
for (const file of [
|
|
955
|
-
"posts.ts",
|
|
956
|
-
"authors.ts",
|
|
957
|
-
"tags.ts",
|
|
958
|
-
"index.ts"
|
|
959
|
-
]) {
|
|
960
|
-
const filePath = path.join(collectionsDir, file);
|
|
961
|
-
if (fs.existsSync(filePath)) fs.unlinkSync(filePath);
|
|
962
|
-
}
|
|
963
|
-
const presetFiles = fs.readdirSync(presetDir).filter((f) => f.endsWith(".ts"));
|
|
964
|
-
for (const file of presetFiles) fs.copyFileSync(path.join(presetDir, file), path.join(collectionsDir, file));
|
|
964
|
+
if (preset === "blog") return preset;
|
|
965
|
+
const presetDir = presetOverlayPath(preset);
|
|
966
|
+
if (!fs.existsSync(presetDir)) {
|
|
967
|
+
console.warn(chalk.yellow(` Warning: Preset "${preset}" not found, falling back to the blog template.`));
|
|
968
|
+
return "blog";
|
|
965
969
|
}
|
|
966
|
-
|
|
970
|
+
for (const file of BLOG_PRESET_FILES) fs.rmSync(path.join(targetDirectory, file), { force: true });
|
|
971
|
+
await cp(presetDir, targetDirectory, {
|
|
972
|
+
recursive: true,
|
|
973
|
+
force: true,
|
|
974
|
+
filter: (source) => path.basename(source) !== ".DS_Store"
|
|
975
|
+
});
|
|
967
976
|
return preset;
|
|
968
977
|
}
|
|
969
978
|
/**
|
|
@@ -978,12 +987,12 @@ async function applyPreset(targetDirectory, preset) {
|
|
|
978
987
|
* edit was refused with `SCHEMA_EDIT_DIRTY_TREE` before its owner had changed
|
|
979
988
|
* a thing.
|
|
980
989
|
*
|
|
981
|
-
* The file cannot be generated here: generation loads
|
|
982
|
-
*
|
|
990
|
+
* The file cannot be generated here: generation loads `backend/schema`, and
|
|
991
|
+
* its files import `@rebasepro/server/schema`, which the project does not have
|
|
983
992
|
* until it is installed — `init --git` without `--install` commits first. So
|
|
984
993
|
* each preset's output is generated in this repository and shipped, and
|
|
985
994
|
* `init-generated-schema.test.ts` fails the moment one of them differs from
|
|
986
|
-
* what the generator writes for that preset's
|
|
995
|
+
* what the generator writes for that preset's tables.
|
|
987
996
|
*
|
|
988
997
|
* Outside `templates/template` on purpose: a preset's schema must not be
|
|
989
998
|
* copied into a project that chose another preset.
|
|
@@ -1001,15 +1010,15 @@ function writeShippedSchema(targetDirectory, preset) {
|
|
|
1001
1010
|
* Where each scaffold shape's `rebase.resources.json` ships, beside the template.
|
|
1002
1011
|
*
|
|
1003
1012
|
* `rebase resources --check` is the CI gate for that file, and a fresh
|
|
1004
|
-
* scaffold failed it before anything had changed: `
|
|
1013
|
+
* scaffold failed it before anything had changed: `backend/resources.ts`
|
|
1005
1014
|
* declares `main = database()`, `backend/functions/hello.ts` is a function,
|
|
1006
1015
|
* and nothing had written the graph — `rebase build` does, on its first run.
|
|
1007
1016
|
* So `init` writes it, and a fresh project starts consistent with its own
|
|
1008
1017
|
* gate, with the file in its first commit.
|
|
1009
1018
|
*
|
|
1010
1019
|
* It cannot be derived here for the reason the schema cannot (see
|
|
1011
|
-
* `shippedSchemaPath`): deriving evaluates
|
|
1012
|
-
* `@rebasepro/
|
|
1020
|
+
* `shippedSchemaPath`): deriving evaluates `backend/schema`, which imports
|
|
1021
|
+
* `@rebasepro/server/schema`, and the project has none until it is installed. So
|
|
1013
1022
|
* each shape's graph is derived in this repository and shipped, and
|
|
1014
1023
|
* `init-resource-graph.test.ts` fails the moment one differs from what
|
|
1015
1024
|
* `rebase resources --write` writes for that shape.
|
|
@@ -1021,12 +1030,6 @@ function shippedResourceGraphPath(shape) {
|
|
|
1021
1030
|
function writeShippedResourceGraph(targetDirectory, shape) {
|
|
1022
1031
|
fs.copyFileSync(shippedResourceGraphPath(shape), path.join(targetDirectory, "rebase.resources.json"));
|
|
1023
1032
|
}
|
|
1024
|
-
function cleanupPresets(presetsDir) {
|
|
1025
|
-
if (fs.existsSync(presetsDir)) fs.rmSync(presetsDir, {
|
|
1026
|
-
recursive: true,
|
|
1027
|
-
force: true
|
|
1028
|
-
});
|
|
1029
|
-
}
|
|
1030
1033
|
/** The package the probe asks about. Not the CLI: the CLI is what is running. */
|
|
1031
1034
|
var RELEASE_PROBE_PACKAGE = "@rebasepro/server";
|
|
1032
1035
|
async function probeRelease(version) {
|
|
@@ -1331,4 +1334,4 @@ async function configureEnvFile(targetDirectory, databaseUrl) {
|
|
|
1331
1334
|
//#endregion
|
|
1332
1335
|
export { createRebaseApp };
|
|
1333
1336
|
|
|
1334
|
-
//# sourceMappingURL=init-
|
|
1337
|
+
//# sourceMappingURL=init-Dtl-IcXf.js.map
|