@rebasepro/cli 0.25.0 → 0.26.0
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 +2 -1
- package/bin/rebase.js +143 -4
- package/dist/{agent-setup-B5AKHOgt.js → agent-setup-D9mHRZ5R.js} +125 -3
- package/dist/agent-setup-D9mHRZ5R.js.map +1 -0
- package/dist/{api-keys-Tm7zvAPe.js → api-keys-CyJ26KEJ.js} +41 -10
- package/dist/api-keys-CyJ26KEJ.js.map +1 -0
- package/dist/{apps-BsU_ILbP.js → apps-CnLDV5b6.js} +6 -7
- package/dist/{apps-BsU_ILbP.js.map → apps-CnLDV5b6.js.map} +1 -1
- package/dist/{atlas-dev-database-OWtqnG7W.js → atlas-dev-database-BODqdCWt.js} +4 -4
- package/dist/{atlas-dev-database-OWtqnG7W.js.map → atlas-dev-database-BODqdCWt.js.map} +1 -1
- package/dist/{auth-Vl2hFKXP.js → auth-dII2jCO1.js} +10 -8
- package/dist/auth-dII2jCO1.js.map +1 -0
- package/dist/{branch-pointer-9DnwkFJJ.js → branch-pointer-BQUF6lYa.js} +1 -1
- package/dist/{build-BBgT8EJZ.js → build-Cza7ZQrp.js} +6 -7
- package/dist/{build-BBgT8EJZ.js.map → build-Cza7ZQrp.js.map} +1 -1
- package/dist/{bundle-DtCCCr4w.js → bundle-C6yEtMJ-.js} +53 -5
- package/dist/bundle-C6yEtMJ-.js.map +1 -0
- package/dist/bundle.d.ts +14 -0
- package/dist/{cloud-BpH0_bmV.js → cloud-BdnmqQaZ.js} +8528 -4342
- package/dist/cloud-BdnmqQaZ.js.map +1 -0
- package/dist/collections-dir-DlvDhime.js +69 -0
- package/dist/collections-dir-DlvDhime.js.map +1 -0
- package/dist/commands/agent-setup.d.ts +58 -0
- package/dist/commands/api-keys.d.ts +13 -0
- package/dist/commands/cloud/activity.d.ts +25 -0
- package/dist/commands/cloud/app-key.d.ts +18 -0
- package/dist/commands/cloud/auth.d.ts +1 -0
- package/dist/commands/cloud/billing-invoices.d.ts +39 -0
- package/dist/commands/cloud/claim.d.ts +7 -0
- package/dist/commands/cloud/context.d.ts +115 -6
- package/dist/commands/cloud/deploy-summary.d.ts +162 -0
- package/dist/commands/cloud/deploy.d.ts +64 -0
- package/dist/commands/cloud/env.d.ts +24 -0
- package/dist/commands/cloud/index.d.ts +13 -1
- package/dist/commands/cloud/init.d.ts +143 -0
- package/dist/commands/cloud/login-flow.d.ts +51 -0
- package/dist/commands/cloud/notifications.d.ts +28 -0
- package/dist/commands/cloud/orgs.d.ts +13 -0
- package/dist/commands/cloud/previews.d.ts +123 -0
- package/dist/commands/cloud/resources.d.ts +68 -14
- package/dist/commands/cloud/runtime-logs.d.ts +176 -0
- package/dist/commands/cloud/service-key.d.ts +15 -0
- package/dist/commands/cloud/token-capabilities.d.ts +61 -8
- package/dist/commands/cloud/tokens.d.ts +18 -3
- package/dist/commands/cloud/usage.d.ts +63 -0
- package/dist/commands/dev.d.ts +22 -0
- package/dist/commands/doctor.d.ts +1 -1
- package/dist/commands/generate-view.d.ts +94 -0
- package/dist/commands/generate_sdk.d.ts +19 -2
- package/dist/commands/init.d.ts +20 -0
- package/dist/commands/skills.d.ts +4 -3
- package/dist/commands/start.d.ts +10 -0
- package/dist/commands/storage.d.ts +4 -0
- package/dist/commands/upgrade.d.ts +12 -0
- package/dist/commands/verify.d.ts +96 -0
- package/dist/{consent-ClRHmcxf.js → consent-BD7F29T3.js} +2 -2
- package/dist/{consent-ClRHmcxf.js.map → consent-BD7F29T3.js.map} +1 -1
- package/dist/{console-CEGm0XNc.js → console-BXB6-8GT.js} +12 -6
- package/dist/console-BXB6-8GT.js.map +1 -0
- package/dist/{context-CyflUrKg.js → context-GUxkZm-S.js} +482 -26
- package/dist/context-GUxkZm-S.js.map +1 -0
- package/dist/{daemon-CknkDjd6.js → daemon-Cp7oNXth.js} +160 -5
- package/dist/daemon-Cp7oNXth.js.map +1 -0
- package/dist/{daemon-entry-CbLRrgzy.js → daemon-entry-zOC1revO.js} +6 -3
- package/dist/daemon-entry-zOC1revO.js.map +1 -0
- package/dist/{db-CRNpA5mH.js → db-KzlqddGD.js} +101 -54
- package/dist/db-KzlqddGD.js.map +1 -0
- package/dist/{derive-CsoFGAnK.js → derive-ae9UOoOB.js} +2 -2
- package/dist/{derive-CsoFGAnK.js.map → derive-ae9UOoOB.js.map} +1 -1
- package/dist/{dev-C0pbMmhS.js → dev-DTqVMgB3.js} +231 -44
- package/dist/dev-DTqVMgB3.js.map +1 -0
- package/dist/dev-db/daemon.d.ts +41 -0
- package/dist/dev-db/pull.d.ts +33 -5
- package/dist/dev-db/state.d.ts +9 -0
- package/dist/{dev-preflight-unHpiYO1.js → dev-preflight-Cxv3TiD1.js} +73 -27
- package/dist/dev-preflight-Cxv3TiD1.js.map +1 -0
- package/dist/{dev-server-B1UYifZJ.js → dev-server-OJsUGZEB.js} +14 -3
- package/dist/dev-server-OJsUGZEB.js.map +1 -0
- package/dist/{doctor-CATRdWm6.js → doctor-BRWOlqeG.js} +14 -12
- package/dist/doctor-BRWOlqeG.js.map +1 -0
- package/dist/{eject-DuasTr-F.js → eject-DABcDnPN.js} +3 -4
- package/dist/{eject-DuasTr-F.js.map → eject-DABcDnPN.js.map} +1 -1
- package/dist/{fold-static-hDHtDfTq.js → fold-static-BnAK-anQ.js} +3 -3
- package/dist/{fold-static-hDHtDfTq.js.map → fold-static-BnAK-anQ.js.map} +1 -1
- package/dist/generate-view-IFwCADvb.js +662 -0
- package/dist/generate-view-IFwCADvb.js.map +1 -0
- package/dist/{generate_sdk-Cvg5jjJF.js → generate_sdk-BvcWvoUh.js} +49 -13
- package/dist/generate_sdk-BvcWvoUh.js.map +1 -0
- package/dist/index.es.js +58 -40
- package/dist/index.es.js.map +1 -1
- package/dist/{init-BWAwHPtz.js → init-CaU6GhwI.js} +50 -62
- package/dist/init-CaU6GhwI.js.map +1 -0
- package/dist/invoked-command-CG_rIa_o.js +55 -0
- package/dist/invoked-command-CG_rIa_o.js.map +1 -0
- package/dist/last-dev-database-DpW5dfoX.js +2 -0
- package/dist/{manifest-DRp0UVTj.js → manifest-BtzDy7KQ.js} +36 -3
- package/dist/{manifest-DRp0UVTj.js.map → manifest-BtzDy7KQ.js.map} +1 -1
- package/dist/{normalize-imports-BoBVh5tU.js → normalize-imports-D0zXlM6g.js} +3 -3
- package/dist/{normalize-imports-BoBVh5tU.js.map → normalize-imports-D0zXlM6g.js.map} +1 -1
- package/dist/{path-flags-BFgG9V6y.js → path-flags-DNvtEi2-.js} +5 -4
- package/dist/path-flags-DNvtEi2-.js.map +1 -0
- package/dist/{prepare-DdnU70z8.js → prepare-CTw9NEkh.js} +5 -4
- package/dist/{prepare-DdnU70z8.js.map → prepare-CTw9NEkh.js.map} +1 -1
- package/dist/project-CasK56vN.js +701 -0
- package/dist/project-CasK56vN.js.map +1 -0
- package/dist/{pull-C3PXduzl.js → pull-DDMpsZ5r.js} +131 -24
- package/dist/pull-DDMpsZ5r.js.map +1 -0
- package/dist/refusal-ReeeGP8a.js +26 -0
- package/dist/refusal-ReeeGP8a.js.map +1 -0
- package/dist/resolve-D647F1LA.js +2 -0
- package/dist/{resources-BdNRDEAy.js → resources-CPSC5Kcu.js} +4 -5
- package/dist/{resources-BdNRDEAy.js.map → resources-CPSC5Kcu.js.map} +1 -1
- package/dist/{schema-B0-p6T1O.js → schema-BSXwZSiI.js} +9 -8
- package/dist/schema-BSXwZSiI.js.map +1 -0
- package/dist/{skills-DfnTeyRz.js → skills-BU2flMOy.js} +52 -8
- package/dist/skills-BU2flMOy.js.map +1 -0
- package/dist/{start-BmEZkS0n.js → start-mVb6upwY.js} +20 -7
- package/dist/start-mVb6upwY.js.map +1 -0
- package/dist/{state-CCB-FAQ9.js → state-CYdBvnwA.js} +3 -2
- package/dist/state-CYdBvnwA.js.map +1 -0
- package/dist/static-syntax-check.d.ts +64 -0
- package/dist/{status-BJ26yZOo.js → status-BREvtzJm.js} +8 -9
- package/dist/{status-BJ26yZOo.js.map → status-BREvtzJm.js.map} +1 -1
- package/dist/{storage-DKPUBTWG.js → storage-DtOXGflp.js} +159 -16
- package/dist/storage-DtOXGflp.js.map +1 -0
- package/dist/{telemetry-EMFRVRQi.js → telemetry-CgwJPVMO.js} +2 -2
- package/dist/{telemetry-EMFRVRQi.js.map → telemetry-CgwJPVMO.js.map} +1 -1
- package/dist/{telemetry-m9czTNGR.js → telemetry-DwK5RQJl.js} +4 -4
- package/dist/{telemetry-m9czTNGR.js.map → telemetry-DwK5RQJl.js.map} +1 -1
- package/dist/{upgrade-DjihWuZL.js → upgrade-B7sVwL8S.js} +26 -4
- package/dist/{upgrade-DjihWuZL.js.map → upgrade-B7sVwL8S.js.map} +1 -1
- package/dist/utils/args.d.ts +32 -3
- package/dist/utils/boot-retry.d.ts +41 -0
- package/dist/utils/collections-dir.d.ts +14 -0
- package/dist/utils/dev-preflight.d.ts +34 -1
- package/dist/utils/dev-server.d.ts +11 -0
- package/dist/utils/path-flags.d.ts +2 -1
- package/dist/utils/project.d.ts +5 -1
- package/dist/utils/tool-stdio.d.ts +1 -1
- package/dist/utils/unknown-command.d.ts +4 -0
- package/dist/verify-D7UsV_qe.js +730 -0
- package/dist/verify-D7UsV_qe.js.map +1 -0
- package/package.json +9 -7
- package/templates/eject/backend/src/index.ts +9 -1
- package/templates/generated-schemas/ecommerce.ts +3 -0
- package/templates/overlays/baas/ai-instructions.md +13 -0
- package/templates/resource-graphs/blank.json +25 -0
- package/templates/resource-graphs/blog.json +28 -0
- package/templates/resource-graphs/ecommerce.json +28 -0
- package/templates/resource-graphs/headless.json +22 -0
- package/templates/template/.claude/hooks/post-edit-collection.sh +99 -0
- package/templates/template/.claude/settings.json +17 -0
- package/templates/template/.env.example +15 -5
- package/templates/template/ai-instructions.md +21 -1
- package/templates/template/config/collections/presets/ecommerce/index.ts +23 -0
- package/templates/template/docker-compose.yml +4 -1
- package/templates/template/frontend/package.json +1 -0
- package/templates/template/frontend/src/App.tsx +10 -9
- package/templates/views/AppView.tsx.tmpl +138 -0
- package/templates/views/EntityView.tsx.tmpl +64 -0
- package/templates/views/index.ts.tmpl +8 -0
- package/dist/agent-setup-B5AKHOgt.js.map +0 -1
- package/dist/api-keys-Tm7zvAPe.js.map +0 -1
- package/dist/args-BX0YD14a.js +0 -266
- package/dist/args-BX0YD14a.js.map +0 -1
- package/dist/auth-Vl2hFKXP.js.map +0 -1
- package/dist/bundle-DtCCCr4w.js.map +0 -1
- package/dist/cloud-BpH0_bmV.js.map +0 -1
- package/dist/console-CEGm0XNc.js.map +0 -1
- package/dist/context-CyflUrKg.js.map +0 -1
- package/dist/daemon-CknkDjd6.js.map +0 -1
- package/dist/daemon-entry-CbLRrgzy.js.map +0 -1
- package/dist/db-CRNpA5mH.js.map +0 -1
- package/dist/dev-C0pbMmhS.js.map +0 -1
- package/dist/dev-preflight-unHpiYO1.js.map +0 -1
- package/dist/dev-server-B1UYifZJ.js.map +0 -1
- package/dist/doctor-CATRdWm6.js.map +0 -1
- package/dist/generate_sdk-Cvg5jjJF.js.map +0 -1
- package/dist/init-BWAwHPtz.js.map +0 -1
- package/dist/last-dev-database-c_dKz1S3.js +0 -2
- package/dist/path-flags-BFgG9V6y.js.map +0 -1
- package/dist/project-Wp2zoyeN.js +0 -349
- package/dist/project-Wp2zoyeN.js.map +0 -1
- package/dist/pull-C3PXduzl.js.map +0 -1
- package/dist/resolve-CNQjsatH.js +0 -2
- package/dist/schema-B0-p6T1O.js.map +0 -1
- package/dist/skills-DfnTeyRz.js.map +0 -1
- package/dist/start-BmEZkS0n.js.map +0 -1
- package/dist/state-CCB-FAQ9.js.map +0 -1
- package/dist/storage-DKPUBTWG.js.map +0 -1
|
@@ -50,6 +50,21 @@ export declare const REGISTER_FILE = "register.ts";
|
|
|
50
50
|
* the registration rather than imported from the SDK.
|
|
51
51
|
*/
|
|
52
52
|
export declare function registrationDir(collectionsDir: string): string;
|
|
53
|
+
/**
|
|
54
|
+
* Write the server-side registration from the collection files in
|
|
55
|
+
* `collectionsDir`, exactly as `rebase generate-sdk` writes it, for a build.
|
|
56
|
+
*
|
|
57
|
+
* Only for a project that asked for it: `registerDatabase` in `rebase.json`,
|
|
58
|
+
* or a registration an earlier `--register` left, which is kept current. The
|
|
59
|
+
* registration lives in gitignored `config/generated/`, so a fresh clone (a CI
|
|
60
|
+
* job) has none until something writes it, and a bundle compiled without it
|
|
61
|
+
* types `context.data` as untyped rows: callbacks that read a typed column
|
|
62
|
+
* fail to compile there while they compile locally.
|
|
63
|
+
*
|
|
64
|
+
* Returns the directory written, or null when there was nothing to do.
|
|
65
|
+
* Throws when a `register.ts` there is not ours, as `generate-sdk` refuses.
|
|
66
|
+
*/
|
|
67
|
+
export declare function writeRegistrationForBuild(collectionsDir: string, registerDatabase: boolean): Promise<string | null>;
|
|
53
68
|
/**
|
|
54
69
|
* The base URL to show in the printed usage example.
|
|
55
70
|
*
|
|
@@ -57,8 +72,10 @@ export declare function registrationDir(collectionsDir: string): string;
|
|
|
57
72
|
* the one it actually got to `.rebase/state.json`. Printing a hardcoded
|
|
58
73
|
* `localhost:3001` sent people to a port nothing was listening on — or, with
|
|
59
74
|
* several projects on one machine, to a different project's backend. Prefer the
|
|
60
|
-
* port
|
|
61
|
-
*
|
|
75
|
+
* port `rebase dev` says it is starting the backend on (`DEV_BACKEND_URL_ENV`:
|
|
76
|
+
* it regenerates the SDK before the backend binds), then the port this project
|
|
77
|
+
* last ran on; fall back to the literal only when the project has never been
|
|
78
|
+
* started.
|
|
62
79
|
*/
|
|
63
80
|
export declare function resolveExampleBaseUrl(cwd: string): string;
|
|
64
81
|
/** Whether a slug can be written as `rebase.data.<slug>` rather than a lookup. */
|
package/dist/commands/init.d.ts
CHANGED
|
@@ -247,6 +247,26 @@ export declare function initGitRepository(targetDirectory: string): Promise<bool
|
|
|
247
247
|
* copied into a project that chose another preset.
|
|
248
248
|
*/
|
|
249
249
|
export declare function shippedSchemaPath(preset: TemplatePreset): string;
|
|
250
|
+
/** A scaffold's shape, for the resource graph it ships with: a preset, or headless. */
|
|
251
|
+
export type ScaffoldShape = TemplatePreset | "headless";
|
|
252
|
+
/**
|
|
253
|
+
* Where each scaffold shape's `rebase.resources.json` ships, beside the template.
|
|
254
|
+
*
|
|
255
|
+
* `rebase resources --check` is the CI gate for that file, and a fresh
|
|
256
|
+
* scaffold failed it before anything had changed: `config/resources.ts`
|
|
257
|
+
* declares `main = database()`, `backend/functions/hello.ts` is a function,
|
|
258
|
+
* and nothing had written the graph — `rebase build` does, on its first run.
|
|
259
|
+
* So `init` writes it, and a fresh project starts consistent with its own
|
|
260
|
+
* gate, with the file in its first commit.
|
|
261
|
+
*
|
|
262
|
+
* It cannot be derived here for the reason the schema cannot (see
|
|
263
|
+
* `shippedSchemaPath`): deriving evaluates the collection files, which import
|
|
264
|
+
* `@rebasepro/cms-types`, and the project has none until it is installed. So
|
|
265
|
+
* each shape's graph is derived in this repository and shipped, and
|
|
266
|
+
* `init-resource-graph.test.ts` fails the moment one differs from what
|
|
267
|
+
* `rebase resources --write` writes for that shape.
|
|
268
|
+
*/
|
|
269
|
+
export declare function shippedResourceGraphPath(shape: ScaffoldShape): string;
|
|
250
270
|
/**
|
|
251
271
|
* Whether `port` is free — on the wildcard address *and* on both loopback addresses.
|
|
252
272
|
*
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
*
|
|
22
22
|
* `homeMarkers` are the directories under `~` that say the assistant is
|
|
23
23
|
* installed on this machine. They answer a different question from
|
|
24
|
-
* `detectDir`: a fresh scaffold has no `.claude
|
|
24
|
+
* `detectDir`: a fresh scaffold has no `.claude/skills` of its own, so `rebase init`
|
|
25
25
|
* asks the machine which assistants the developer has and pre-selects those.
|
|
26
26
|
*
|
|
27
27
|
* `mcp` is where the assistant reads a *project-level* MCP server list, and in
|
|
@@ -52,7 +52,7 @@ export declare const AGENTS: {
|
|
|
52
52
|
};
|
|
53
53
|
readonly claude: {
|
|
54
54
|
readonly label: "Claude Code";
|
|
55
|
-
readonly detectDir: ".claude";
|
|
55
|
+
readonly detectDir: ".claude/skills";
|
|
56
56
|
readonly homeMarkers: readonly [".claude"];
|
|
57
57
|
readonly targetDir: ".claude/skills";
|
|
58
58
|
readonly flatLayout: false;
|
|
@@ -257,10 +257,11 @@ export declare function skillsCommand(subcommand: string | undefined, rawArgs: s
|
|
|
257
257
|
* given.
|
|
258
258
|
*/
|
|
259
259
|
export declare function parseAgentFlags(rawArgs: string[]): AgentKey[] | null;
|
|
260
|
-
/** `rebase skills install`'s whole line: the agents it names, `--mcp` and `--force`. */
|
|
260
|
+
/** `rebase skills install`'s whole line: the agents it names, `--mcp`, `--hooks` and `--force`. */
|
|
261
261
|
export declare function parseSkillsInstallLine(rawArgs: string[]): {
|
|
262
262
|
agents: AgentKey[] | null;
|
|
263
263
|
mcp: boolean;
|
|
264
|
+
hooks: boolean;
|
|
264
265
|
force: boolean;
|
|
265
266
|
};
|
|
266
267
|
/**
|
package/dist/commands/start.d.ts
CHANGED
|
@@ -2,6 +2,16 @@ import { type PMCommands } from "../utils/package-manager.js";
|
|
|
2
2
|
import type { RebaseBundleStatic } from "@rebasepro/types";
|
|
3
3
|
import type { DevDatabase } from "../dev-db/resolve.js";
|
|
4
4
|
import type { DaemonState } from "../dev-db/state.js";
|
|
5
|
+
/**
|
|
6
|
+
* The help's line that runs `start` on the database `rebase dev` uses, spelled
|
|
7
|
+
* as the reader can type it.
|
|
8
|
+
*
|
|
9
|
+
* In a project, the project's package manager: a scaffold has `rebase` in
|
|
10
|
+
* `node_modules/.bin`, not on PATH, so a bare `rebase` is "command not found" —
|
|
11
|
+
* `pnpm exec rebase …`, as `missingDatabaseUrl` and the CLI's other hints say
|
|
12
|
+
* it. Outside one, the way this CLI was started (`invokedRebaseCommand`).
|
|
13
|
+
*/
|
|
14
|
+
export declare function startHelpRunLine(projectRoot?: string | null): string;
|
|
5
15
|
/** The NODE_ENV the runtime will see, and where it comes from. */
|
|
6
16
|
export interface StartNodeEnv {
|
|
7
17
|
value: string | undefined;
|
|
@@ -35,6 +35,10 @@ export interface OrphanReport {
|
|
|
35
35
|
reason: string;
|
|
36
36
|
}[];
|
|
37
37
|
}
|
|
38
|
+
/** How often a running scan is asked about. A setting so the tests need not wait. */
|
|
39
|
+
export declare const orphanScanPolling: {
|
|
40
|
+
intervalMs: number;
|
|
41
|
+
};
|
|
38
42
|
/** Bytes, as a person reads them. */
|
|
39
43
|
export declare function formatBytes(bytes: number): string;
|
|
40
44
|
/**
|
|
@@ -49,3 +49,15 @@ export interface UpgradeIo {
|
|
|
49
49
|
*/
|
|
50
50
|
export declare function npmFailure(err: unknown): string;
|
|
51
51
|
export declare function upgradeCommand(rawArgs: string[], io?: UpgradeIo): Promise<void>;
|
|
52
|
+
/**
|
|
53
|
+
* What to say about this project's managed database when an older CLI started
|
|
54
|
+
* it, or nothing.
|
|
55
|
+
*
|
|
56
|
+
* The daemon outlives every command and the database proxy runs inside it, so
|
|
57
|
+
* moving the pins does not move the proxy: the old one, with whatever the
|
|
58
|
+
* upgrade fixed in it, kept serving until `rebase db stop` or thirty idle
|
|
59
|
+
* minutes — and under a running `rebase dev` it never idles. The upgraded CLI
|
|
60
|
+
* restarts it when nothing is connected (`daemonOutdated`); this says so, and
|
|
61
|
+
* what to do while something is.
|
|
62
|
+
*/
|
|
63
|
+
export declare function runningDatabaseNotice(projectRoot: string, target: string): Promise<string[]>;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/** The flags `rebase verify` takes. */
|
|
2
|
+
export declare const VERIFY_FLAGS: {
|
|
3
|
+
readonly "--collections": StringConstructor;
|
|
4
|
+
readonly "-c": "--collections";
|
|
5
|
+
readonly "--json": BooleanConstructor;
|
|
6
|
+
readonly "--quiet": BooleanConstructor;
|
|
7
|
+
readonly "-q": "--quiet";
|
|
8
|
+
readonly "--live": BooleanConstructor;
|
|
9
|
+
readonly "--database-url": StringConstructor;
|
|
10
|
+
readonly "--docker": BooleanConstructor;
|
|
11
|
+
};
|
|
12
|
+
export type VerifyStepId = "config" | "rls" | "migrations" | "live";
|
|
13
|
+
export interface VerifyFinding {
|
|
14
|
+
step: VerifyStepId;
|
|
15
|
+
/** Stable, kebab-case: what kind of problem. An agent can branch on it. */
|
|
16
|
+
check: string;
|
|
17
|
+
severity: "error" | "warning";
|
|
18
|
+
message: string;
|
|
19
|
+
/** What to change, when there is one thing to change. */
|
|
20
|
+
fix?: string;
|
|
21
|
+
/** The collection's slug. */
|
|
22
|
+
collection?: string;
|
|
23
|
+
/** The file to open, relative to the project root. */
|
|
24
|
+
file?: string;
|
|
25
|
+
/** Dotted path into the collection config — `posts.properties.title.widget`. */
|
|
26
|
+
path?: string;
|
|
27
|
+
}
|
|
28
|
+
export interface VerifyStep {
|
|
29
|
+
id: VerifyStepId;
|
|
30
|
+
title: string;
|
|
31
|
+
status: "passed" | "failed" | "warnings" | "skipped";
|
|
32
|
+
/** Why a step was skipped, or what it covered. */
|
|
33
|
+
detail?: string;
|
|
34
|
+
}
|
|
35
|
+
export interface VerifyReport {
|
|
36
|
+
ok: boolean;
|
|
37
|
+
/** Relative to the project root. */
|
|
38
|
+
collectionsDir: string;
|
|
39
|
+
steps: VerifyStep[];
|
|
40
|
+
findings: VerifyFinding[];
|
|
41
|
+
summary: {
|
|
42
|
+
errors: number;
|
|
43
|
+
warnings: number;
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
export interface VerifyOptions {
|
|
47
|
+
projectRoot: string;
|
|
48
|
+
collectionsDir: string;
|
|
49
|
+
/** The backend package, where `drizzle/migrations` lives. Null for a project without one. */
|
|
50
|
+
backendDir: string | null;
|
|
51
|
+
live: boolean;
|
|
52
|
+
databaseUrl?: string;
|
|
53
|
+
/** Why no `databaseUrl` could be resolved for `--live`, when resolving it failed. */
|
|
54
|
+
databaseUnavailable?: string;
|
|
55
|
+
/**
|
|
56
|
+
* Whether the backend refuses a request with no token (`AUTH_REQUIRE`, on
|
|
57
|
+
* unless set to `false`). Decides how a Rebase-compiled public read reads.
|
|
58
|
+
* Defaults to true, the runtime's default.
|
|
59
|
+
*/
|
|
60
|
+
authRequired?: boolean;
|
|
61
|
+
}
|
|
62
|
+
/** One row of `rebase.atlas_schema_revisions`, as far as "applied" needs it. */
|
|
63
|
+
export interface AppliedRevision {
|
|
64
|
+
version: string;
|
|
65
|
+
/** Atlas's revision type, a bit set: 1 baseline, 2 executed, 4 resolved (`migrate set`). */
|
|
66
|
+
type: number;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* The migration files the database has not run, as Atlas's own `migrate status`
|
|
70
|
+
* counts them.
|
|
71
|
+
*
|
|
72
|
+
* A file is applied when its version has a row, or when it is at or behind the
|
|
73
|
+
* newest *baseline* row: `migrate apply --baseline V` records V alone, and
|
|
74
|
+
* means "everything up to V is already here". `rebase db migrate --baseline` is
|
|
75
|
+
* what the CLI prescribes for a booted database, so set membership alone
|
|
76
|
+
* reported the earlier migrations of every baselined database as not applied —
|
|
77
|
+
* and prescribed `rebase db migrate`, which answers "No migration files to
|
|
78
|
+
* execute". That run failed forever.
|
|
79
|
+
*/
|
|
80
|
+
export declare function pendingMigrations(files: readonly string[], revisions: readonly AppliedRevision[], compare: (a: string, b: string) => number, versionOf: (file: string) => string): string[];
|
|
81
|
+
/**
|
|
82
|
+
* Run every step and return the report. Prints nothing and never exits, so a
|
|
83
|
+
* caller — the command, a test — decides what to do with it.
|
|
84
|
+
*/
|
|
85
|
+
export declare function runVerify(options: VerifyOptions): Promise<VerifyReport>;
|
|
86
|
+
export declare function printReport(report: VerifyReport, quiet: boolean): void;
|
|
87
|
+
/**
|
|
88
|
+
* Whether the backend refuses a request with no token: `AUTH_REQUIRE` from the
|
|
89
|
+
* environment, else `.env`, read as every boolean env var is read
|
|
90
|
+
* (`parseEnvBoolean`: `false`/`0`/`no`/`off` turn it off). On unless one of
|
|
91
|
+
* those says otherwise — the runtime's default. Compared raw, `AUTH_REQUIRE=0`
|
|
92
|
+
* read as "on", and a compiled public read was reported as token-gated on a
|
|
93
|
+
* backend that serves it to anyone.
|
|
94
|
+
*/
|
|
95
|
+
export declare function authRequiredFrom(environment: Record<string, string | undefined>, envFile: Record<string, string | undefined>): boolean;
|
|
96
|
+
export declare function verifyCommand(rawArgs: string[]): Promise<void>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as setConsent, c as buildEvent, f as readConfig, o as suppressionReason } from "./telemetry-
|
|
1
|
+
import { a as setConsent, c as buildEvent, f as readConfig, o as suppressionReason } from "./telemetry-CgwJPVMO.js";
|
|
2
2
|
import chalk from "chalk";
|
|
3
3
|
import inquirer from "inquirer";
|
|
4
4
|
//#region src/telemetry/consent.ts
|
|
@@ -73,4 +73,4 @@ function describeState(env = process.env) {
|
|
|
73
73
|
//#endregion
|
|
74
74
|
export { promptForConsent as n, renderPreview as r, describeState as t };
|
|
75
75
|
|
|
76
|
-
//# sourceMappingURL=consent-
|
|
76
|
+
//# sourceMappingURL=consent-BD7F29T3.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"consent-
|
|
1
|
+
{"version":3,"file":"consent-BD7F29T3.js","names":[],"sources":["../src/telemetry/consent.ts"],"sourcesContent":["import chalk from \"chalk\";\nimport inquirer from \"inquirer\";\n\nimport { buildEvent, TELEMETRY_SCHEMA_VERSION, TelemetryEventName } from \"./payload\";\nimport { readConfig } from \"./identity\";\nimport { setConsent, suppressionReason } from \"./index\";\n\n/**\n * Asking, and what the question looks like.\n *\n * ## Why the prompt comes *after* the work\n *\n * The first `rebase init` on a machine is the event most worth having, and it\n * is the one where no consent exists yet. Asking before scaffolding puts a\n * privacy negotiation in front of someone who has not yet seen the tool do\n * anything — the worst possible moment, and a reliable way to get a reflexive\n * no.\n *\n * So the question is asked once the project exists and the user has seen it\n * work. The event's data is still in memory at that point, so nothing is lost\n * by waiting, and — this is the part that matters — **nothing has been\n * transmitted or written**. Declining leaves no id, no file, no record.\n *\n * ## Why the payload is shown rather than described\n *\n * \"Anonymous usage data\" is a phrase that has been used to mean almost\n * anything. Printing the exact JSON costs four lines of output and replaces a\n * claim the user has to take on faith with something they can read. It is also\n * the same builder the sender uses, so it cannot drift into a comfortable\n * fiction.\n */\n\n/** Where the question is being asked from, which decides how often it may be. */\nexport interface PromptOptions {\n /**\n * Ask again even though this machine already declined.\n *\n * Set by `rebase init`, and only there. Scaffolding a project is a\n * deliberate, occasional act with a natural pause in it — not something\n * anyone does in a loop — so asking each time is an offer rather than\n * nagging, and it reaches the person whose first answer was a reflex before\n * they had seen the tool do anything.\n *\n * It does **not** re-ask someone who accepted: they are already sharing, so\n * the only thing another prompt could do is talk them out of it.\n *\n * Nothing else changes. `DO_NOT_TRACK`, `REBASE_TELEMETRY_DISABLED`, `CI`\n * and a project's `\"telemetry\": false` are answers, not questions, and they\n * still suppress the prompt entirely — a re-ask that could override a\n * committed repository policy would be exactly the consent-by-proxy the\n * policy exists to prevent.\n */\n reAskDeclined?: boolean;\n}\n\n/** True when we may ask: nothing forbids it, and there is a question to ask. */\nexport function shouldPrompt(\n env: NodeJS.ProcessEnv = process.env,\n { reAskDeclined = false }: PromptOptions = {}\n): boolean {\n if (!process.stdin.isTTY) return false;\n\n const reason = suppressionReason(env);\n // `not_asked` is the only reason that is a question rather than an answer.\n // A user who set DO_NOT_TRACK, or is on CI, has already told us — and so\n // has one who is already sharing (`null`), whom we never re-ask.\n if (reason === \"not_asked\") return true;\n return reAskDeclined && reason === \"declined\";\n}\n\nexport function renderPreview(event: TelemetryEventName, properties: Record<string, unknown>): string {\n const preview = buildEvent(event, properties, {\n machineId: \"<random uuid, generated only if you say yes>\",\n projectId: \"<random uuid, per checkout>\"\n });\n return JSON.stringify(preview, null, 2);\n}\n\n/**\n * Ask, record the answer, and report it.\n *\n * Never throws and never blocks a non-interactive run: `rebase init --yes` in\n * CI must behave exactly as it does today, which means not asking and not\n * sending.\n */\nexport async function promptForConsent(options: PromptOptions = {}): Promise<boolean> {\n if (!shouldPrompt(process.env, options)) return false;\n\n // Only true when this is a second (or later) asking, which the closing line\n // needs to know: \"you will not be asked again\" is false at `init`.\n const askedBefore = suppressionReason(process.env) === \"declined\";\n\n try {\n console.log(\"\");\n console.log(chalk.bold(\"Help improve Rebase?\"));\n console.log(\"\");\n console.log(chalk.gray(\" Rebase is self-hosted, so we only learn what works if you tell us.\"));\n console.log(chalk.gray(\" Anonymous: random ids, the CLI version, your OS, and which template and\"));\n console.log(chalk.gray(\" package manager you used. Never project names, paths, schemas, URLs or\"));\n console.log(chalk.gray(\" error messages.\"));\n console.log(\"\");\n console.log(chalk.gray(` Print the exact payload with ${chalk.cyan(\"rebase telemetry show\")}; change your mind`));\n console.log(chalk.gray(` any time with ${chalk.cyan(\"rebase telemetry disable\")}.`));\n if (askedBefore) {\n console.log(\"\");\n console.log(chalk.gray(\" You declined before; that stands unless you change it here.\"));\n }\n console.log(\"\");\n\n const { accepted } = await inquirer.prompt([\n {\n type: \"confirm\",\n name: \"accepted\",\n message: \"Share anonymous usage data?\",\n // Defaults to no. Telemetry is off until somebody says yes, and\n // a bare Enter is the commonest answer to any prompt — so a\n // pre-selected yes would make pressing through `init` the\n // consent. `y` is one keystroke, and `rebase telemetry enable`\n // is the same answer later.\n default: false\n }\n ] as Parameters<typeof inquirer.prompt>[0]) as { accepted: boolean };\n\n setConsent(Boolean(accepted));\n\n console.log(\n accepted\n ? chalk.green(\" Thank you — sharing enabled.\")\n : chalk.gray(\n \" Nothing will be sent.\"\n + (options.reAskDeclined\n ? \" You will be asked again the next time you scaffold a project.\"\n : \" You will not be asked again.\")\n )\n );\n console.log(\"\");\n return Boolean(accepted);\n } catch {\n // A prompt that fails (piped stdin, a terminal that went away) is a\n // decline, and specifically a decline we do not persist — the user\n // never actually saw the question, so they should still get to answer\n // it another day.\n return false;\n }\n}\n\n/** Human-readable current state, for `rebase telemetry status`. */\nexport function describeState(env: NodeJS.ProcessEnv = process.env): string {\n const reason = suppressionReason(env);\n const config = readConfig();\n switch (reason) {\n case null:\n return `${chalk.green(\"enabled\")} — schema v${TELEMETRY_SCHEMA_VERSION}, machine id ${chalk.gray(config.machineId ?? \"unset\")}`;\n case \"not_asked\":\n return `${chalk.yellow(\"not configured\")} — nothing has been sent, and you have not been asked yet`;\n case \"declined\":\n return `${chalk.gray(\"disabled\")} — you declined${config.decidedAt ? ` on ${config.decidedAt.slice(0, 10)}` : \"\"}`;\n case \"do_not_track\":\n return `${chalk.gray(\"disabled\")} — the ${chalk.cyan(\"DO_NOT_TRACK\")} environment variable is set`;\n case \"rebase_telemetry_disabled\":\n return `${chalk.gray(\"disabled\")} — the ${chalk.cyan(\"REBASE_TELEMETRY_DISABLED\")} environment variable is set`;\n case \"ci\":\n return `${chalk.gray(\"disabled\")} — this looks like CI (${chalk.cyan(\"CI\")} is set), which is never counted`;\n case \"project_opt_out\":\n return `${chalk.gray(\"disabled\")} — this project's ${chalk.cyan(\"rebase.json\")} sets ${chalk.cyan('\"telemetry\": false')}`;\n }\n}\n"],"mappings":";;;;;AAwDA,SAAgB,aACZ,MAAyB,QAAQ,KACjC,EAAE,gBAAgB,UAAyB,CAAC,GACrC;CACP,IAAI,CAAC,QAAQ,MAAM,OAAO,OAAO;CAEjC,MAAM,SAAS,kBAAkB,GAAG;CAIpC,IAAI,WAAW,aAAa,OAAO;CACnC,OAAO,iBAAiB,WAAW;AACvC;AAEA,SAAgB,cAAc,OAA2B,YAA6C;CAClG,MAAM,UAAU,WAAW,OAAO,YAAY;EAC1C,WAAW;EACX,WAAW;CACf,CAAC;CACD,OAAO,KAAK,UAAU,SAAS,MAAM,CAAC;AAC1C;;;;;;;;AASA,eAAsB,iBAAiB,UAAyB,CAAC,GAAqB;CAClF,IAAI,CAAC,aAAa,QAAQ,KAAK,OAAO,GAAG,OAAO;CAIhD,MAAM,cAAc,kBAAkB,QAAQ,GAAG,MAAM;CAEvD,IAAI;EACA,QAAQ,IAAI,EAAE;EACd,QAAQ,IAAI,MAAM,KAAK,sBAAsB,CAAC;EAC9C,QAAQ,IAAI,EAAE;EACd,QAAQ,IAAI,MAAM,KAAK,sEAAsE,CAAC;EAC9F,QAAQ,IAAI,MAAM,KAAK,2EAA2E,CAAC;EACnG,QAAQ,IAAI,MAAM,KAAK,0EAA0E,CAAC;EAClG,QAAQ,IAAI,MAAM,KAAK,mBAAmB,CAAC;EAC3C,QAAQ,IAAI,EAAE;EACd,QAAQ,IAAI,MAAM,KAAK,kCAAkC,MAAM,KAAK,uBAAuB,EAAE,mBAAmB,CAAC;EACjH,QAAQ,IAAI,MAAM,KAAK,mBAAmB,MAAM,KAAK,0BAA0B,EAAE,EAAE,CAAC;EACpF,IAAI,aAAa;GACb,QAAQ,IAAI,EAAE;GACd,QAAQ,IAAI,MAAM,KAAK,+DAA+D,CAAC;EAC3F;EACA,QAAQ,IAAI,EAAE;EAEd,MAAM,EAAE,aAAa,MAAM,SAAS,OAAO,CACvC;GACI,MAAM;GACN,MAAM;GACN,SAAS;GAMT,SAAS;EACb,CACJ,CAA0C;EAE1C,WAAW,QAAQ,QAAQ,CAAC;EAE5B,QAAQ,IACJ,WACM,MAAM,MAAM,gCAAgC,IAC5C,MAAM,KACJ,6BACG,QAAQ,gBACL,mEACA,gCACV,CACR;EACA,QAAQ,IAAI,EAAE;EACd,OAAO,QAAQ,QAAQ;CAC3B,QAAQ;EAKJ,OAAO;CACX;AACJ;;AAGA,SAAgB,cAAc,MAAyB,QAAQ,KAAa;CACxE,MAAM,SAAS,kBAAkB,GAAG;CACpC,MAAM,SAAS,WAAW;CAC1B,QAAQ,QAAR;EACI,KAAK,MACD,OAAO,GAAG,MAAM,MAAM,SAAS,EAAE,2BAAqD,MAAM,KAAK,OAAO,aAAa,OAAO;EAChI,KAAK,aACD,OAAO,GAAG,MAAM,OAAO,gBAAgB,EAAE;EAC7C,KAAK,YACD,OAAO,GAAG,MAAM,KAAK,UAAU,EAAE,iBAAiB,OAAO,YAAY,OAAO,OAAO,UAAU,MAAM,GAAG,EAAE,MAAM;EAClH,KAAK,gBACD,OAAO,GAAG,MAAM,KAAK,UAAU,EAAE,SAAS,MAAM,KAAK,cAAc,EAAE;EACzE,KAAK,6BACD,OAAO,GAAG,MAAM,KAAK,UAAU,EAAE,SAAS,MAAM,KAAK,2BAA2B,EAAE;EACtF,KAAK,MACD,OAAO,GAAG,MAAM,KAAK,UAAU,EAAE,yBAAyB,MAAM,KAAK,IAAI,EAAE;EAC/E,KAAK,mBACD,OAAO,GAAG,MAAM,KAAK,UAAU,EAAE,oBAAoB,MAAM,KAAK,aAAa,EAAE,QAAQ,MAAM,KAAK,sBAAoB;CAC9H;AACJ"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { w as wantsHelp, x as parseCommandArgs } from "./project-CasK56vN.js";
|
|
2
|
+
import { i as refuseMissingCollectionsPath, t as COLLECTIONS_FLAG_HELP } from "./path-flags-DNvtEi2-.js";
|
|
3
|
+
import { collectionsDirArgs } from "./collections-dir-DlvDhime.js";
|
|
4
|
+
import { DEV_DATABASE_KIND_ENV, managedNotices, prepareDatabaseEnv } from "./prepare-CTw9NEkh.js";
|
|
5
|
+
import { absolutizeLocalPathArgs, ensureDockerDatabase, n as argsFromCommand, resolveDriverCli, spawnDriverCli, t as reportSpawnFailure } from "./db-KzlqddGD.js";
|
|
5
6
|
import chalk from "chalk";
|
|
6
7
|
import path from "path";
|
|
7
8
|
//#region src/commands/console.ts
|
|
@@ -89,7 +90,12 @@ async function consoleCommand(rawArgs) {
|
|
|
89
90
|
Object.assign(resolved.env, prepared.env);
|
|
90
91
|
resolved.env[DEV_DATABASE_KIND_ENV] = prepared.database.kind;
|
|
91
92
|
for (const line of managedNotices(prepared)) say(line);
|
|
92
|
-
const
|
|
93
|
+
const typedArgs = absolutizeLocalPathArgs(argsFromCommand(rawArgs, "console"), process.cwd());
|
|
94
|
+
const childArgs = [
|
|
95
|
+
...typedArgs,
|
|
96
|
+
...collectionsDirArgs(projectRoot, typedArgs),
|
|
97
|
+
`--history=${consoleHistoryPath(projectRoot)}`
|
|
98
|
+
];
|
|
93
99
|
try {
|
|
94
100
|
await spawnDriverCli(resolved, childArgs);
|
|
95
101
|
} catch (error) {
|
|
@@ -100,4 +106,4 @@ async function consoleCommand(rawArgs) {
|
|
|
100
106
|
//#endregion
|
|
101
107
|
export { consoleCommand };
|
|
102
108
|
|
|
103
|
-
//# sourceMappingURL=console-
|
|
109
|
+
//# sourceMappingURL=console-BXB6-8GT.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"console-BXB6-8GT.js","names":[],"sources":["../src/commands/console.ts"],"sourcesContent":["/**\n * CLI command: rebase console\n *\n * A Node REPL with the project open — `rebase` (what `openRebase` from\n * `@rebasepro/server-postgres` returns: `dataAsAdmin`, `sql`, `withAuth`) and\n * `collections` in scope — or, with `--eval`, one piece of code run and its\n * result printed as JSON.\n *\n * Resolved like `rebase db push`: the same project and `.env`, the same\n * database (the managed one started if that is what the project uses), the\n * same `--collections` loader — the driver's, spawned in `backend/`. Opening\n * the database changes nothing in it.\n */\nimport chalk from \"chalk\";\nimport path from \"path\";\nimport { parseCommandArgs, wantsHelp } from \"../utils/args\";\nimport { argsFromCommand } from \"../utils/command-words\";\nimport { COLLECTIONS_FLAG_HELP, refuseMissingCollectionsPath } from \"../utils/path-flags\";\nimport { collectionsDirArgs } from \"../utils/collections-dir\";\nimport { reportSpawnFailure } from \"../utils/spawn-error\";\nimport { DEV_DATABASE_KIND_ENV, managedNotices, prepareDatabaseEnv } from \"../dev-db/prepare\";\nimport { absolutizeLocalPathArgs, ensureDockerDatabase, resolveDriverCli, spawnDriverCli } from \"./db\";\n\nexport const CONSOLE_FLAGS = {\n \"--eval\": String,\n \"-e\": \"--eval\",\n \"--collections\": String,\n \"-c\": \"--collections\",\n \"--database-url\": String,\n \"--docker\": Boolean\n} as const;\n\n/** What each long flag above does, for the Options block. */\nconst CONSOLE_FLAG_HELP: Record<string, string> = {\n \"--eval\": \"Run this code instead of the REPL, print its awaited result as JSON, and exit 1 if it throws\",\n \"--collections\": COLLECTIONS_FLAG_HELP,\n \"--database-url\": \"Open this database instead of the project's\",\n \"--docker\": \"Use the database from docker compose, starting it if needed\"\n};\n\n/** Where the REPL keeps its history: the project's own `.rebase/`, which the scaffold ignores. */\nexport function consoleHistoryPath(projectRoot: string): string {\n return path.join(projectRoot, \".rebase\", \"console_history\");\n}\n\nfunction flagLabel(flag: string): string {\n const aliases = Object.entries(CONSOLE_FLAGS)\n .filter(([, target]) => target === flag)\n .map(([alias]) => alias);\n return [flag, ...aliases].join(\", \");\n}\n\nexport function printConsoleHelp(): void {\n console.log(`\n${chalk.bold(\"rebase console\")} — Explore the project's data from a REPL\n\n${chalk.green.bold(\"Usage\")}\n rebase console [options]\n\n${chalk.green.bold(\"Options\")}\n${Object.keys(CONSOLE_FLAG_HELP)\n .map(flag => ` ${chalk.blue(flagLabel(flag).padEnd(22))} ${CONSOLE_FLAG_HELP[flag]}`)\n .join(\"\\n\")}\n\nIn scope:\n rebase dataAsAdmin, sql(query, { params }), withAuth(user) → { data }, close()\n collections the project's collections\n\nTop-level await works. Opening the database changes nothing in it: no table,\nrole or trigger is created. withAuth runs as the user under row-level security.\n\n${chalk.green.bold(\"Examples\")}\n rebase console\n rebase console -e \"rebase.dataAsAdmin.posts.find({ limit: 5 })\"\n rebase console -e \"(await rebase.withAuth({ uid: 'u1', roles: ['user'] })).data.posts.find()\"\n rebase console -e \"rebase.sql('select count(*) from posts')\"\n`);\n}\n\nexport async function consoleCommand(rawArgs: string[]): Promise<void> {\n if (wantsHelp(rawArgs)) {\n printConsoleHelp();\n return;\n }\n\n // Strictly, before the line is relayed: the driver would otherwise be the\n // first to see a mistyped flag, after a database had been started for it.\n const { flags } = parseCommandArgs({\n spec: CONSOLE_FLAGS,\n rawArgs,\n commandWords: 1,\n command: \"console\",\n maxPositionals: 0\n });\n\n const resolved = await resolveDriverCli();\n const { projectRoot, backendDir } = resolved;\n refuseMissingCollectionsPath(rawArgs, process.cwd(), backendDir, \"console\");\n await ensureDockerDatabase(projectRoot, rawArgs);\n\n // With --eval, stdout is the result and nothing else, so it can be piped\n // into `jq`; piped into the REPL, it is the REPL's answers. Either way what\n // the database resolution has to say goes to stderr.\n const say = flags[\"--eval\"] === undefined && process.stdin.isTTY\n ? (line: string) => console.log(chalk.gray(` ${line}`))\n : (line: string) => console.error(chalk.gray(` ${line}`));\n const prepared = await prepareDatabaseEnv(projectRoot, {\n flagUrl: flags[\"--database-url\"] ?? null,\n flagDocker: flags[\"--docker\"] === true,\n onProgress: say\n });\n Object.assign(resolved.env, prepared.env);\n // The database this run resolved, flags included, so the driver words a\n // failure to open it for that one — a managed database that has no free\n // connection is not \"is your Postgres running?\".\n resolved.env[DEV_DATABASE_KIND_ENV] = prepared.database.kind;\n for (const line of managedNotices(prepared)) say(line);\n\n const typedArgs = absolutizeLocalPathArgs(argsFromCommand(rawArgs, \"console\"), process.cwd());\n const childArgs = [\n ...typedArgs,\n ...collectionsDirArgs(projectRoot, typedArgs),\n `--history=${consoleHistoryPath(projectRoot)}`\n ];\n\n try {\n await spawnDriverCli(resolved, childArgs);\n } catch (error) {\n // A child that exited non-zero has already said why, on the terminal it\n // shares — an `--eval` that threw, a database that refused.\n reportSpawnFailure(error);\n process.exit(1);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAuBA,IAAa,gBAAgB;CACzB,UAAU;CACV,MAAM;CACN,iBAAiB;CACjB,MAAM;CACN,kBAAkB;CAClB,YAAY;AAChB;;AAGA,IAAM,oBAA4C;CAC9C,UAAU;CACV,iBAAiB;CACjB,kBAAkB;CAClB,YAAY;AAChB;;AAGA,SAAgB,mBAAmB,aAA6B;CAC5D,OAAO,KAAK,KAAK,aAAa,WAAW,iBAAiB;AAC9D;AAEA,SAAS,UAAU,MAAsB;CAIrC,OAAO,CAAC,MAAM,GAHE,OAAO,QAAQ,aAAa,CAAC,CACxC,QAAQ,GAAG,YAAY,WAAW,IAAI,CAAC,CACvC,KAAK,CAAC,WAAW,KACL,CAAO,CAAC,CAAC,KAAK,IAAI;AACvC;AAEA,SAAgB,mBAAyB;CACrC,QAAQ,IAAI;EACd,MAAM,KAAK,gBAAgB,EAAE;;EAE7B,MAAM,MAAM,KAAK,OAAO,EAAE;;;EAG1B,MAAM,MAAM,KAAK,SAAS,EAAE;EAC5B,OAAO,KAAK,iBAAiB,CAAC,CACvB,KAAI,SAAQ,KAAK,MAAM,KAAK,UAAU,IAAI,CAAC,CAAC,OAAO,EAAE,CAAC,EAAE,GAAG,kBAAkB,OAAO,CAAC,CACrF,KAAK,IAAI,EAAE;;;;;;;;;EASlB,MAAM,MAAM,KAAK,UAAU,EAAE;;;;;CAK9B;AACD;AAEA,eAAsB,eAAe,SAAkC;CACnE,IAAI,UAAU,OAAO,GAAG;EACpB,iBAAiB;EACjB;CACJ;CAIA,MAAM,EAAE,UAAU,iBAAiB;EAC/B,MAAM;EACN;EACA,cAAc;EACd,SAAS;EACT,gBAAgB;CACpB,CAAC;CAED,MAAM,WAAW,MAAM,iBAAiB;CACxC,MAAM,EAAE,aAAa,eAAe;CACpC,6BAA6B,SAAS,QAAQ,IAAI,GAAG,YAAY,SAAS;CAC1E,MAAM,qBAAqB,aAAa,OAAO;CAK/C,MAAM,MAAM,MAAM,cAAc,KAAA,KAAa,QAAQ,MAAM,SACpD,SAAiB,QAAQ,IAAI,MAAM,KAAK,KAAK,MAAM,CAAC,KACpD,SAAiB,QAAQ,MAAM,MAAM,KAAK,KAAK,MAAM,CAAC;CAC7D,MAAM,WAAW,MAAM,mBAAmB,aAAa;EACnD,SAAS,MAAM,qBAAqB;EACpC,YAAY,MAAM,gBAAgB;EAClC,YAAY;CAChB,CAAC;CACD,OAAO,OAAO,SAAS,KAAK,SAAS,GAAG;CAIxC,SAAS,IAAI,yBAAyB,SAAS,SAAS;CACxD,KAAK,MAAM,QAAQ,eAAe,QAAQ,GAAG,IAAI,IAAI;CAErD,MAAM,YAAY,wBAAwB,gBAAgB,SAAS,SAAS,GAAG,QAAQ,IAAI,CAAC;CAC5F,MAAM,YAAY;EACd,GAAG;EACH,GAAG,mBAAmB,aAAa,SAAS;EAC5C,aAAa,mBAAmB,WAAW;CAC/C;CAEA,IAAI;EACA,MAAM,eAAe,UAAU,SAAS;CAC5C,SAAS,OAAO;EAGZ,mBAAmB,KAAK;EACxB,QAAQ,KAAK,CAAC;CAClB;AACJ"}
|