@rebasepro/cli 0.33.2 → 0.34.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (149) hide show
  1. package/dist/{agent-setup-Cg_zBWoW.js → agent-setup-kjdKozkF.js} +3 -3
  2. package/dist/{agent-setup-Cg_zBWoW.js.map → agent-setup-kjdKozkF.js.map} +1 -1
  3. package/dist/{api-TbmW33D7.js → api-CQh_qTyQ.js} +2 -2
  4. package/dist/{api-TbmW33D7.js.map → api-CQh_qTyQ.js.map} +1 -1
  5. package/dist/{api-keys-fPQ55DCm.js → api-keys-CG2IpknI.js} +5 -5
  6. package/dist/{api-keys-fPQ55DCm.js.map → api-keys-CG2IpknI.js.map} +1 -1
  7. package/dist/{apps-DBTRoOeP.js → apps-DaaWvv3o.js} +6 -6
  8. package/dist/{apps-DBTRoOeP.js.map → apps-DaaWvv3o.js.map} +1 -1
  9. package/dist/{atlas-dev-database-D6h65f2x.js → atlas-dev-database-BiDMUr9W.js} +2 -2
  10. package/dist/{atlas-dev-database-D6h65f2x.js.map → atlas-dev-database-BiDMUr9W.js.map} +1 -1
  11. package/dist/{auth-BpyYLEFY.js → auth-bi8x2YX1.js} +12 -12
  12. package/dist/{auth-BpyYLEFY.js.map → auth-bi8x2YX1.js.map} +1 -1
  13. package/dist/{auth-session-B6aT0Dyj.js → auth-session-BVoxE5tp.js} +4 -4
  14. package/dist/{auth-session-B6aT0Dyj.js.map → auth-session-BVoxE5tp.js.map} +1 -1
  15. package/dist/{backend-guard-Cf8eMK_f.js → backend-guard--SW3MTSh.js} +2 -2
  16. package/dist/{backend-guard-Cf8eMK_f.js.map → backend-guard--SW3MTSh.js.map} +1 -1
  17. package/dist/{branch-pointer-BJOF2Ubv.js → branch-pointer-BjKUoENm.js} +1 -1
  18. package/dist/{build-E5hfEWKj.js → build-D-0VCmbU.js} +11 -11
  19. package/dist/build-D-0VCmbU.js.map +1 -0
  20. package/dist/{bundle-CIiKGrte.js → bundle-BDTVS9XE.js} +7 -7
  21. package/dist/{bundle-CIiKGrte.js.map → bundle-BDTVS9XE.js.map} +1 -1
  22. package/dist/{cloud-DNJyUU0T.js → cloud-CR6Hps3B.js} +222 -31
  23. package/dist/cloud-CR6Hps3B.js.map +1 -0
  24. package/dist/{cms-directories-BaV-Is9a.js → cms-directories-AGHvFwH7.js} +2 -2
  25. package/dist/{cms-directories-BaV-Is9a.js.map → cms-directories-AGHvFwH7.js.map} +1 -1
  26. package/dist/{command-Bks5xkrQ.js → command-nWgittn1.js} +3 -3
  27. package/dist/{command-Bks5xkrQ.js.map → command-nWgittn1.js.map} +1 -1
  28. package/dist/commands/build.d.ts +2 -1
  29. package/dist/commands/cloud/db-connect.d.ts +31 -1
  30. package/dist/commands/cloud/db-query.d.ts +16 -0
  31. package/dist/commands/cloud/index.d.ts +1 -0
  32. package/dist/commands/cloud/resources.d.ts +19 -1
  33. package/dist/commands/dev.d.ts +15 -0
  34. package/dist/commands/users.d.ts +1 -0
  35. package/dist/{consent-UV6ObCME.js → consent-C8_Ik_GK.js} +3 -3
  36. package/dist/{consent-UV6ObCME.js.map → consent-C8_Ik_GK.js.map} +1 -1
  37. package/dist/{console-BVoYOLAO.js → console-BBGRHOFg.js} +5 -5
  38. package/dist/{console-BVoYOLAO.js.map → console-BBGRHOFg.js.map} +1 -1
  39. package/dist/{context-BOMEoKxn.js → context-C9lz1vTS.js} +6 -2
  40. package/dist/{context-BOMEoKxn.js.map → context-C9lz1vTS.js.map} +1 -1
  41. package/dist/{cron-ZRXsla0v.js → cron-BzzNxkBH.js} +3 -3
  42. package/dist/{cron-ZRXsla0v.js.map → cron-BzzNxkBH.js.map} +1 -1
  43. package/dist/{cron-CpUsQ739.js → cron-DuZ3Svjq.js} +4 -4
  44. package/dist/{cron-CpUsQ739.js.map → cron-DuZ3Svjq.js.map} +1 -1
  45. package/dist/{daemon-D5gdG7gx.js → daemon-BCBMn8hE.js} +2 -2
  46. package/dist/{daemon-D5gdG7gx.js.map → daemon-BCBMn8hE.js.map} +1 -1
  47. package/dist/{data-BJ9AZFUC.js → data-1eipHbxJ.js} +3 -3
  48. package/dist/{data-BJ9AZFUC.js.map → data-1eipHbxJ.js.map} +1 -1
  49. package/dist/{db-D_iF4E-v.js → db-DAotpOxs.js} +28 -28
  50. package/dist/{db-D_iF4E-v.js.map → db-DAotpOxs.js.map} +1 -1
  51. package/dist/{debug-nNbbxAeo.js → debug-CkiOcfsU.js} +2 -2
  52. package/dist/{debug-nNbbxAeo.js.map → debug-CkiOcfsU.js.map} +1 -1
  53. package/dist/{derive-Mky_u59_.js → derive-BU5kvcOP.js} +3 -3
  54. package/dist/{derive-Mky_u59_.js.map → derive-BU5kvcOP.js.map} +1 -1
  55. package/dist/{dev-bj6dEeSQ.js → dev-Ce9PVQS8.js} +34 -13
  56. package/dist/dev-Ce9PVQS8.js.map +1 -0
  57. package/dist/{dev-preflight-BMOf2N6r.js → dev-preflight-DROlafgr.js} +2 -2
  58. package/dist/{dev-preflight-BMOf2N6r.js.map → dev-preflight-DROlafgr.js.map} +1 -1
  59. package/dist/{dev-server-2XHSHM_q.js → dev-server-dsabI0UT.js} +2 -2
  60. package/dist/{dev-server-2XHSHM_q.js.map → dev-server-dsabI0UT.js.map} +1 -1
  61. package/dist/{doctor-FaBObSlb.js → doctor-Cdu3Llrw.js} +8 -8
  62. package/dist/{doctor-FaBObSlb.js.map → doctor-Cdu3Llrw.js.map} +1 -1
  63. package/dist/{eject-DK_M9kor.js → eject-Dy-qRYhW.js} +3 -3
  64. package/dist/{eject-DK_M9kor.js.map → eject-Dy-qRYhW.js.map} +1 -1
  65. package/dist/{fold-static-2t3UUX4z.js → fold-static-DzV3EJZm.js} +4 -4
  66. package/dist/{fold-static-2t3UUX4z.js.map → fold-static-DzV3EJZm.js.map} +1 -1
  67. package/dist/{function-portability-BIvlvR9q.js → function-portability-Dppl6uqg.js} +24 -5
  68. package/dist/{function-portability-BIvlvR9q.js.map → function-portability-Dppl6uqg.js.map} +1 -1
  69. package/dist/function-portability.d.ts +9 -0
  70. package/dist/{functions-B4JR6EZL.js → functions-BCEJnISw.js} +4 -4
  71. package/dist/{functions-B4JR6EZL.js.map → functions-BCEJnISw.js.map} +1 -1
  72. package/dist/{generate-view-BMaLQm8H.js → generate-view-CZ0SmsJc.js} +4 -4
  73. package/dist/{generate-view-BMaLQm8H.js.map → generate-view-CZ0SmsJc.js.map} +1 -1
  74. package/dist/{generate_sdk-ByD-gTsK.js → generate_sdk-MAbUUZoK.js} +6 -6
  75. package/dist/{generate_sdk-ByD-gTsK.js.map → generate_sdk-MAbUUZoK.js.map} +1 -1
  76. package/dist/index.es.js +54 -54
  77. package/dist/{init-DHCe5mJ5.js → init-BctfWO3w.js} +44 -24
  78. package/dist/init-BctfWO3w.js.map +1 -0
  79. package/dist/last-dev-database-w-r9T5Xm.js +2 -0
  80. package/dist/{legacy-layout-DI2VeQSV.js → legacy-layout-CiXWalS6.js} +2 -2
  81. package/dist/{legacy-layout-DI2VeQSV.js.map → legacy-layout-CiXWalS6.js.map} +1 -1
  82. package/dist/{logs-DpuMukJe.js → logs-B_mS4gCn.js} +4 -4
  83. package/dist/{logs-DpuMukJe.js.map → logs-B_mS4gCn.js.map} +1 -1
  84. package/dist/{manifest-RjqxfCpb.js → manifest-D6B4LA8x.js} +3 -3
  85. package/dist/{manifest-RjqxfCpb.js.map → manifest-D6B4LA8x.js.map} +1 -1
  86. package/dist/{migrate-CSY9ZDKy.js → migrate-DdcgLMyL.js} +3 -3
  87. package/dist/{migrate-CSY9ZDKy.js.map → migrate-DdcgLMyL.js.map} +1 -1
  88. package/dist/{normalize-imports-P86NVfpo.js → normalize-imports-CVjOssZ2.js} +2 -2
  89. package/dist/{normalize-imports-P86NVfpo.js.map → normalize-imports-CVjOssZ2.js.map} +1 -1
  90. package/dist/{package-manager-DSEOwTqM.js → package-manager-DTNNGHyK.js} +29 -12
  91. package/dist/package-manager-DTNNGHyK.js.map +1 -0
  92. package/dist/{path-flags-ekLdkbra.js → path-flags-B7Ydt5nv.js} +2 -2
  93. package/dist/{path-flags-ekLdkbra.js.map → path-flags-B7Ydt5nv.js.map} +1 -1
  94. package/dist/{prepare-BaJe0Zik.js → prepare-CFpYl1Nt.js} +4 -4
  95. package/dist/{prepare-BaJe0Zik.js.map → prepare-CFpYl1Nt.js.map} +1 -1
  96. package/dist/{project-DALmhb5R.js → project-CQ5nKddJ.js} +2 -2
  97. package/dist/{project-DALmhb5R.js.map → project-CQ5nKddJ.js.map} +1 -1
  98. package/dist/{project-command-Cl9EZzjr.js → project-command-5wM_bJQt.js} +7 -7
  99. package/dist/{project-command-Cl9EZzjr.js.map → project-command-5wM_bJQt.js.map} +1 -1
  100. package/dist/resolve-GDRel2ne.js +2 -0
  101. package/dist/{resources-Db3USuPO.js → resources-ecA0MEjy.js} +4 -4
  102. package/dist/{resources-Db3USuPO.js.map → resources-ecA0MEjy.js.map} +1 -1
  103. package/dist/{rls-BxrQ0P50.js → rls-B4zGbTKY.js} +3 -3
  104. package/dist/{rls-BxrQ0P50.js.map → rls-B4zGbTKY.js.map} +1 -1
  105. package/dist/{schema-_FzZEoB8.js → schema-CWzzn0cY.js} +13 -12
  106. package/dist/{schema-_FzZEoB8.js.map → schema-CWzzn0cY.js.map} +1 -1
  107. package/dist/{schema-dir-ChcYfWjP.js → schema-dir-Dd1Pzqq5.js} +2 -2
  108. package/dist/{schema-dir-ChcYfWjP.js.map → schema-dir-Dd1Pzqq5.js.map} +1 -1
  109. package/dist/schema-reconcile-DGEMmYJI.js +2 -0
  110. package/dist/{schema-show-h72UJ9zH.js → schema-show-DwYtOp4S.js} +5 -5
  111. package/dist/{schema-show-h72UJ9zH.js.map → schema-show-DwYtOp4S.js.map} +1 -1
  112. package/dist/{skills-DQ2bZGkj.js → skills-CWmBTCRW.js} +6 -6
  113. package/dist/{skills-DQ2bZGkj.js.map → skills-CWmBTCRW.js.map} +1 -1
  114. package/dist/{start-Cjx4W0bJ.js → start-4uhCu_md.js} +6 -6
  115. package/dist/{start-Cjx4W0bJ.js.map → start-4uhCu_md.js.map} +1 -1
  116. package/dist/{status-CDBk25VO.js → status-CVEzoSwX.js} +7 -7
  117. package/dist/{status-CDBk25VO.js.map → status-CVEzoSwX.js.map} +1 -1
  118. package/dist/{storage-Clc8dLG8.js → storage-Dqf5tyhs.js} +9 -9
  119. package/dist/{storage-Clc8dLG8.js.map → storage-Dqf5tyhs.js.map} +1 -1
  120. package/dist/{storage-objects-CfRKlTDe.js → storage-objects-DbFsemMV.js} +3 -3
  121. package/dist/{storage-objects-CfRKlTDe.js.map → storage-objects-DbFsemMV.js.map} +1 -1
  122. package/dist/{telemetry-DZU2-NCm.js → telemetry-B5RSeQIc.js} +3 -3
  123. package/dist/{telemetry-DZU2-NCm.js.map → telemetry-B5RSeQIc.js.map} +1 -1
  124. package/dist/{telemetry-EVtASbKb.js → telemetry-CJbrRuG3.js} +2 -2
  125. package/dist/{telemetry-EVtASbKb.js.map → telemetry-CJbrRuG3.js.map} +1 -1
  126. package/dist/{upgrade-ZASvgxWM.js → upgrade-CepjhRrz.js} +6 -6
  127. package/dist/{upgrade-ZASvgxWM.js.map → upgrade-CepjhRrz.js.map} +1 -1
  128. package/dist/{users-5PkqBY6R.js → users-Cx5HuaTn.js} +9 -6
  129. package/dist/users-Cx5HuaTn.js.map +1 -0
  130. package/dist/utils/package-manager.d.ts +12 -13
  131. package/dist/{verify-BdeqNb-V.js → verify-D-1y5HQS.js} +8 -8
  132. package/dist/{verify-BdeqNb-V.js.map → verify-D-1y5HQS.js.map} +1 -1
  133. package/package.json +10 -10
  134. package/templates/template/.cursorrules +2 -1
  135. package/templates/template/.github/copilot-instructions.md +2 -1
  136. package/templates/template/.windsurfrules +2 -1
  137. package/templates/template/AGENTS.md +2 -1
  138. package/templates/template/CLAUDE.md +2 -1
  139. package/templates/template/ai-instructions.md +5 -2
  140. package/templates/template/frontend/src/index.css +13 -0
  141. package/dist/build-E5hfEWKj.js.map +0 -1
  142. package/dist/cloud-DNJyUU0T.js.map +0 -1
  143. package/dist/dev-bj6dEeSQ.js.map +0 -1
  144. package/dist/init-DHCe5mJ5.js.map +0 -1
  145. package/dist/last-dev-database-CBVkEUEl.js +0 -2
  146. package/dist/package-manager-DSEOwTqM.js.map +0 -1
  147. package/dist/resolve-C36px9tR.js +0 -2
  148. package/dist/schema-reconcile-DV14XY4o.js +0 -2
  149. package/dist/users-5PkqBY6R.js.map +0 -1
@@ -1,4 +1,5 @@
1
1
  import type { RebaseAppConfig } from "@rebasepro/types";
2
+ import { type PMCommands } from "../utils/package-manager.js";
2
3
  /**
3
4
  * The two commands that turn a custom-runtime app into an image.
4
5
  *
@@ -24,7 +25,7 @@ import type { RebaseAppConfig } from "@rebasepro/types";
24
25
  export declare function dockerBuildHint(projectRoot: string, name: string, app: {
25
26
  dockerfile?: string;
26
27
  context?: string;
27
- }): string[];
28
+ }, pm?: PMCommands): string[];
28
29
  export declare function buildCommand(rawArgs?: string[]): Promise<void>;
29
30
  /**
30
31
  * Build a static app and package it into a static bundle.
@@ -32,12 +32,31 @@
32
32
  * unreachable from a browser too.
33
33
  */
34
34
  import net from "node:net";
35
- import { type SessionHolder } from "./context.js";
35
+ import { type SessionHolder, type CloudClient } from "./context.js";
36
36
  /** Documented in `action-help.ts`, and paired with it by `action-help.test.ts`. */
37
37
  export declare const DB_CONNECT_FLAGS: {
38
38
  readonly "--port": NumberConstructor;
39
39
  readonly "--reveal": BooleanConstructor;
40
40
  };
41
+ /** What `db-info` answers. Mirrors `saas/backend/functions/db-info.ts`. */
42
+ interface DbInfoResponse {
43
+ type: "managed" | "byodb";
44
+ host: string | null;
45
+ port: string | null;
46
+ database: string | null;
47
+ username: string | null;
48
+ passwordAvailable: boolean;
49
+ directAccess: {
50
+ via: "tunnel";
51
+ kubectl?: {
52
+ namespace: string;
53
+ service: string;
54
+ localPort: number;
55
+ remotePort: number;
56
+ };
57
+ } | null;
58
+ unavailableReason: string | null;
59
+ }
41
60
  /** `https://app.rebase.pro` → `wss://app.rebase.pro/api/db-tunnel/p1`. */
42
61
  export declare function tunnelUrl(cloudUrl: string, projectId: string): string;
43
62
  /**
@@ -53,6 +72,16 @@ export declare function localDsn(opts: {
53
72
  database: string | null;
54
73
  password?: string;
55
74
  }): string;
75
+ /**
76
+ * What a tunnel needs from the control plane: the database's name and user,
77
+ * and its password when `reveal` asks for it (owner or admin only, as the
78
+ * console's SQL console). Refuses, by `fail`, a project with nothing to tunnel.
79
+ * Shared by `db connect` and `db query`.
80
+ */
81
+ export declare function loadTunnelAccess(client: CloudClient, projectId: string, reveal: boolean): Promise<{
82
+ info: DbInfoResponse;
83
+ password?: string;
84
+ }>;
56
85
  export declare function dbConnect(rawArgs: string[]): Promise<void>;
57
86
  /**
58
87
  * The local listener: each connection it accepts gets its own tunnel, signed in
@@ -83,3 +112,4 @@ export declare function tunnelListener(client: SessionHolder, endpoint: string):
83
112
  * surfaces as a protocol error nowhere near here.
84
113
  */
85
114
  export declare function pipeThroughTunnel(socket: net.Socket, endpoint: string, token: string): void;
115
+ export {};
@@ -0,0 +1,16 @@
1
+ import type { QueryResult } from "pg";
2
+ /** Documented in `action-help.ts`, and paired with it by `action-help.test.ts`. */
3
+ export declare const DB_QUERY_FLAGS: {
4
+ readonly "--file": StringConstructor;
5
+ };
6
+ /** One statement's result, as the JSON form reports it. */
7
+ export interface QueryResultSummary {
8
+ command: string | null;
9
+ rowCount: number | null;
10
+ rows: Record<string, unknown>[];
11
+ }
12
+ /** The SQL to run: the file, or the one positional. Exactly one of them. */
13
+ export declare function querySql(file: string | undefined, positional: string | undefined, read?: (path: string) => string): string;
14
+ /** `pg` answers one result for one statement and an array for several. */
15
+ export declare function summarizeResults(result: QueryResult | QueryResult[]): QueryResultSummary[];
16
+ export declare function dbQuery(rawArgs: string[]): Promise<void>;
@@ -50,6 +50,7 @@ export declare const CLOUD_VALUE_FLAGS: {
50
50
  readonly "--endpoint": StringConstructor;
51
51
  readonly "--events": StringConstructor;
52
52
  readonly "--expires-in": StringConstructor;
53
+ readonly "--file": StringConstructor;
53
54
  readonly "--format": StringConstructor;
54
55
  readonly "--function": StringConstructor;
55
56
  readonly "--grep": StringConstructor;
@@ -60,6 +60,17 @@ export interface BlockedState {
60
60
  /** The exact command that unblocks it. `null` when nothing is blocked. */
61
61
  nextAction: string | null;
62
62
  }
63
+ /**
64
+ * The live app's public `GET /api/auth/config`, or `undefined` when it does
65
+ * not answer in time or is not a Rebase backend. Read by `status` for the
66
+ * sign-in methods the app switched on and cannot offer (`unavailable`).
67
+ */
68
+ export declare function readAuthConfig(appUrl: string, fetchImpl?: typeof fetch): Promise<{
69
+ unavailable?: {
70
+ magicLink?: string;
71
+ emailOtp?: string;
72
+ };
73
+ } | undefined>;
63
74
  export declare function resolveBlockedState(input: {
64
75
  projectStatus?: string | null;
65
76
  /** The project's database row, or undefined when none is attached. */
@@ -70,6 +81,13 @@ export declare function resolveBlockedState(input: {
70
81
  status?: string | null;
71
82
  logs?: string | null;
72
83
  } | undefined;
84
+ /** What the live app's `GET /api/auth/config` answered, when it answered. */
85
+ authConfig?: {
86
+ unavailable?: {
87
+ magicLink?: string;
88
+ emailOtp?: string;
89
+ };
90
+ } | undefined;
73
91
  }): BlockedState;
74
92
  /**
75
93
  * One line describing what engine is serving this project.
@@ -128,7 +146,7 @@ export declare const METRICS_FLAGS: {
128
146
  * `packages/server/src/metrics/history-store.ts`), which is not exported;
129
147
  * `cloud-api-commands.test.ts` holds the two together.
130
148
  */
131
- export declare const HISTORY_SERIES: readonly ["cpu_millicores", "memory_bytes", "event_loop_delay_ms"];
149
+ export declare const HISTORY_SERIES: readonly ["cpu_millicores", "memory_bytes", "event_loop_delay_ms", "requests_data", "errors_data", "requests_auth", "errors_auth", "requests_storage", "errors_storage", "requests_functions", "errors_functions", "requests_app", "errors_app"];
132
150
  /** The longest window the runtime keeps: fourteen days, in minutes. */
133
151
  export declare const HISTORY_MAX_MINUTES = 20160;
134
152
  /** What `/api/functions/metrics/:projectId/runtime` returns. Mirrors saas metrics.ts. */
@@ -238,6 +238,15 @@ export declare function databaseEndpoint(url: string | null | undefined): string
238
238
  */
239
239
  export interface DevStaticShape {
240
240
  declaresStaticApp: boolean;
241
+ /**
242
+ * The declared apps with no build step (`output` is `root`, no `build`):
243
+ * the dev backend serves them from their directory, at their path, as
244
+ * `rebase start` serves them from the bundle.
245
+ */
246
+ servedByBackend?: Array<{
247
+ appName: string;
248
+ path: string;
249
+ }>;
241
250
  /** The declared app whose `root` is the `frontend/` that `rebase dev` runs, if one is. */
242
251
  served?: {
243
252
  appName: string;
@@ -254,6 +263,12 @@ export interface DevStaticShape {
254
263
  servedLocally: boolean;
255
264
  };
256
265
  }
266
+ /**
267
+ * Where the site the dev backend serves itself is, for `FRONTEND_URL`, or
268
+ * `undefined` when it serves none: the app at `/` when there is one, else the
269
+ * first. Exported for its test.
270
+ */
271
+ export declare function devServedSiteUrl(shape: DevStaticShape, backendPort: number): string | undefined;
257
272
  /**
258
273
  * Read {@link DevStaticShape} out of a loaded manifest. Exported for its test.
259
274
  *
@@ -39,6 +39,7 @@ export declare const CREATE_USER_FLAGS: {
39
39
  "--role": [StringConstructor];
40
40
  "--password": StringConstructor;
41
41
  "--skip-password-policy": BooleanConstructor;
42
+ "--no-invite": BooleanConstructor;
42
43
  "--project": StringConstructor;
43
44
  "-p": "--project";
44
45
  "--cloud": BooleanConstructor;
@@ -1,4 +1,4 @@
1
- import { a as setConsent, c as buildEvent, f as readConfig, o as suppressionReason } from "./telemetry-EVtASbKb.js";
1
+ import { a as setConsent, c as buildEvent, f as readConfig, o as suppressionReason } from "./telemetry-CJbrRuG3.js";
2
2
  import chalk from "chalk";
3
3
  import inquirer from "inquirer";
4
4
  //#region src/telemetry/consent.ts
@@ -46,7 +46,7 @@ async function promptForConsent(options = {}) {
46
46
  type: "confirm",
47
47
  name: "accepted",
48
48
  message: "Share anonymous usage data?",
49
- default: false
49
+ default: true
50
50
  }]);
51
51
  setConsent(Boolean(accepted));
52
52
  console.log(accepted ? chalk.green(" Thank you — sharing enabled.") : chalk.gray(" Nothing will be sent." + (options.reAskDeclined ? " You will be asked again the next time you scaffold a project." : " You will not be asked again.")));
@@ -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-UV6ObCME.js.map
76
+ //# sourceMappingURL=consent-C8_Ik_GK.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"consent-UV6ObCME.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,I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["../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 yes. The question is still asked, with the\n // payload described above it, and nothing is sent before an\n // answer; `n` is one keystroke, and `rebase telemetry disable`\n // is the same answer later. DO_NOT_TRACK, CI and a project's\n // `\"telemetry\": false` still suppress the prompt entirely.\n default: true\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,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ACG,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,8 +1,8 @@
1
1
  import { a as wantsHelp, n as parseCommandArgs } from "./args-DHyrshtI.js";
2
- import { r as schemaDirArgs } from "./schema-dir-ChcYfWjP.js";
3
- import { a as refuseRemovedCollectionsFlag, i as refuseMissingSchemaDir, n as SCHEMA_DIR_FLAG_HELP } from "./path-flags-ekLdkbra.js";
4
- import { DEV_DATABASE_KIND_ENV, managedNotices, prepareDatabaseEnv } from "./prepare-BaJe0Zik.js";
5
- import { absolutizeLocalPathArgs, ensureDockerDatabase, n as argsFromCommand, resolveDriverCli, spawnDriverCli, t as reportSpawnFailure } from "./db-D_iF4E-v.js";
2
+ import { r as schemaDirArgs } from "./schema-dir-Dd1Pzqq5.js";
3
+ import { a as refuseRemovedCollectionsFlag, i as refuseMissingSchemaDir, n as SCHEMA_DIR_FLAG_HELP } from "./path-flags-B7Ydt5nv.js";
4
+ import { DEV_DATABASE_KIND_ENV, managedNotices, prepareDatabaseEnv } from "./prepare-CFpYl1Nt.js";
5
+ import { absolutizeLocalPathArgs, ensureDockerDatabase, n as argsFromCommand, resolveDriverCli, spawnDriverCli, t as reportSpawnFailure } from "./db-DAotpOxs.js";
6
6
  import chalk from "chalk";
7
7
  import path from "path";
8
8
  //#region src/commands/console.ts
@@ -106,4 +106,4 @@ async function consoleCommand(rawArgs) {
106
106
  //#endregion
107
107
  export { consoleCommand };
108
108
 
109
- //# sourceMappingURL=console-BVoYOLAO.js.map
109
+ //# sourceMappingURL=console-BBGRHOFg.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"console-BVoYOLAO.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 * `tables` 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 `backend/schema` 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 { SCHEMA_DIR_FLAG_HELP, refuseMissingSchemaDir, refuseRemovedCollectionsFlag } from \"../utils/path-flags\";\nimport { schemaDirArgs } from \"../utils/schema-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 \"--schema-dir\": String,\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 \"--schema-dir\": SCHEMA_DIR_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 tables the project's tables, as their descriptors\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 refuseRemovedCollectionsFlag(rawArgs.slice(2), \"console\");\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 refuseMissingSchemaDir(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 ...schemaDirArgs(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,gBAAgB;CAChB,kBAA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AAM,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,cAAc,aAAa,SAAS;EACvC,aAAa,mBAAmB,WAAW;CAC/C;CAEA,IAAI;EACA,MAAM,eAAe,UAAU,SAAS;CAC5C,SAAS,OAAO;EAGZ,mBAAmB,KAAK;EACxB,QAAQ,KAAK,CAAC;CAClB;AACJ"}
1
+ {"version":3,"file":"console-BBGRHOFg.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 * `tables` 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 `backend/schema` 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 { SCHEMA_DIR_FLAG_HELP, refuseMissingSchemaDir, refuseRemovedCollectionsFlag } from \"../utils/path-flags\";\nimport { schemaDirArgs } from \"../utils/schema-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 \"--schema-dir\": String,\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 \"--schema-dir\": SCHEMA_DIR_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 tables the project's tables, as their descriptors\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 refuseRemovedCollectionsFlag(rawArgs.slice(2), \"console\");\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 refuseMissingSchemaDir(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 ...schemaDirArgs(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,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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,cAAc,aAAa,SAAS;EACvC,aAAa,mBAAmB,WAAW;CAC/C;CAEA,IAAI;EACA,MAAM,eAAe,UAAU,SAAS;CAC5C,SAAS,OAAO;EAGZ,mBAAmB,KAAK;EACxB,QAAQ,KAAK,CAAC;CAClB;AACJ"}
@@ -1,6 +1,6 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.js";
2
2
  import { i as switchOn, n as parseCommandArgs } from "./args-DHyrshtI.js";
3
- import { c as findProjectRoot } from "./project-DALmhb5R.js";
3
+ import { c as findProjectRoot } from "./project-CQ5nKddJ.js";
4
4
  import { t as cliUserAgent } from "./version-ONIeo7jl.js";
5
5
  import chalk from "chalk";
6
6
  import arg from "arg";
@@ -1379,6 +1379,10 @@ function printGroupHelp(page) {
1379
1379
  }, {
1380
1380
  usage: `rebase ${page.command} ${page.usage ?? "<action>"} [options]`,
1381
1381
  summary: page.title,
1382
+ flags: [...page.options ?? [], ...page.globalFlags ?? GLOBAL_HELP_FLAGS].map(([flag, description]) => ({
1383
+ flag,
1384
+ description
1385
+ })),
1382
1386
  options: (page.options ?? []).map(([flag, description]) => ({
1383
1387
  flag,
1384
1388
  description
@@ -1794,4 +1798,4 @@ function requireCloudRow(row, what) {
1794
1798
  //#endregion
1795
1799
  export { resolveCloudTarget as $, linkedEphemeralGrant as A, projectHost as B, getContextOrg as C, isJsonMode as D, initOutputMode as E, parseCloudArgs as F, reportError as G, readLink as H, printGroupHelp as I, requireInteractive as J, requireClient as K, printJson as L, note as M, noteBlank as N, isKnownControlPlane as O, openUrl as P, requireSessionClient as Q, probeToken as R, freshAccessToken as S, grantProjectOf as T, refuseDirectLink as U, projectLinkPath as V, removeLink as W, requireProject as X, requireKnownAction as Y, requireProjectRef as Z, ephemeralGrantFor as _, isTokenCapability as _t, billingAccountIdOf as a, setCurrentContext as at, fetchTenantBaseDomain as b, scopesForOrgCapabilities as bt, colorStatus as c, warn as ct, createCloudClient as d, ORG_CAPABILITIES as dt, resolveCloudUrl as et, displayProjectRef as f, ORG_CAPABILITY_NAMES as ft, envToken as g, isOrgCapability as gt, emitHelp as h, capabilitiesInScopes as ht, appKeyExpiryNote as i, setContextOrg as it, lookupProjectId as j, keyValues as k, confirmDestructive as l, writeLink as lt, emit as m, TOKEN_CAPABILITY_NAMES as mt, GLOBAL_HELP_FLAGS as n, resolveTimeoutMs as nt, cloudRow as o, storedGrantForLink as ot, dotenvSets as p, TOKEN_CAPABILITIES as pt, requireCloudRow as q, TOKEN_ENV as r, saveEphemeralGrant as rt, cloudRows as s, success as st, GLOBAL_CLOUD_FLAGS as t, resolveProjectRef as tt, context_exports as u, ALWAYS_SCOPES as ut, fail as v, orgCapabilitiesInScopes as vt, grantForLink as w, forgetEphemeralGrant as x, wantsRawError as xt, fetchDeployTargets as y, scopesForCapabilities as yt, projectDotenvSetsAppKey as z };
1796
1800
 
1797
- //# sourceMappingURL=context-BOMEoKxn.js.map
1801
+ //# sourceMappingURL=context-C9lz1vTS.js.map