@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.
Files changed (190) hide show
  1. package/README.md +2 -1
  2. package/bin/rebase.js +143 -4
  3. package/dist/{agent-setup-B5AKHOgt.js → agent-setup-D9mHRZ5R.js} +125 -3
  4. package/dist/agent-setup-D9mHRZ5R.js.map +1 -0
  5. package/dist/{api-keys-Tm7zvAPe.js → api-keys-CyJ26KEJ.js} +41 -10
  6. package/dist/api-keys-CyJ26KEJ.js.map +1 -0
  7. package/dist/{apps-BsU_ILbP.js → apps-CnLDV5b6.js} +6 -7
  8. package/dist/{apps-BsU_ILbP.js.map → apps-CnLDV5b6.js.map} +1 -1
  9. package/dist/{atlas-dev-database-OWtqnG7W.js → atlas-dev-database-BODqdCWt.js} +4 -4
  10. package/dist/{atlas-dev-database-OWtqnG7W.js.map → atlas-dev-database-BODqdCWt.js.map} +1 -1
  11. package/dist/{auth-Vl2hFKXP.js → auth-dII2jCO1.js} +10 -8
  12. package/dist/auth-dII2jCO1.js.map +1 -0
  13. package/dist/{branch-pointer-9DnwkFJJ.js → branch-pointer-BQUF6lYa.js} +1 -1
  14. package/dist/{build-BBgT8EJZ.js → build-Cza7ZQrp.js} +6 -7
  15. package/dist/{build-BBgT8EJZ.js.map → build-Cza7ZQrp.js.map} +1 -1
  16. package/dist/{bundle-DtCCCr4w.js → bundle-C6yEtMJ-.js} +53 -5
  17. package/dist/bundle-C6yEtMJ-.js.map +1 -0
  18. package/dist/bundle.d.ts +14 -0
  19. package/dist/{cloud-BpH0_bmV.js → cloud-BdnmqQaZ.js} +8528 -4342
  20. package/dist/cloud-BdnmqQaZ.js.map +1 -0
  21. package/dist/collections-dir-DlvDhime.js +69 -0
  22. package/dist/collections-dir-DlvDhime.js.map +1 -0
  23. package/dist/commands/agent-setup.d.ts +58 -0
  24. package/dist/commands/api-keys.d.ts +13 -0
  25. package/dist/commands/cloud/activity.d.ts +25 -0
  26. package/dist/commands/cloud/app-key.d.ts +18 -0
  27. package/dist/commands/cloud/auth.d.ts +1 -0
  28. package/dist/commands/cloud/billing-invoices.d.ts +39 -0
  29. package/dist/commands/cloud/claim.d.ts +7 -0
  30. package/dist/commands/cloud/context.d.ts +115 -6
  31. package/dist/commands/cloud/deploy-summary.d.ts +162 -0
  32. package/dist/commands/cloud/deploy.d.ts +64 -0
  33. package/dist/commands/cloud/env.d.ts +24 -0
  34. package/dist/commands/cloud/index.d.ts +13 -1
  35. package/dist/commands/cloud/init.d.ts +143 -0
  36. package/dist/commands/cloud/login-flow.d.ts +51 -0
  37. package/dist/commands/cloud/notifications.d.ts +28 -0
  38. package/dist/commands/cloud/orgs.d.ts +13 -0
  39. package/dist/commands/cloud/previews.d.ts +123 -0
  40. package/dist/commands/cloud/resources.d.ts +68 -14
  41. package/dist/commands/cloud/runtime-logs.d.ts +176 -0
  42. package/dist/commands/cloud/service-key.d.ts +15 -0
  43. package/dist/commands/cloud/token-capabilities.d.ts +61 -8
  44. package/dist/commands/cloud/tokens.d.ts +18 -3
  45. package/dist/commands/cloud/usage.d.ts +63 -0
  46. package/dist/commands/dev.d.ts +22 -0
  47. package/dist/commands/doctor.d.ts +1 -1
  48. package/dist/commands/generate-view.d.ts +94 -0
  49. package/dist/commands/generate_sdk.d.ts +19 -2
  50. package/dist/commands/init.d.ts +20 -0
  51. package/dist/commands/skills.d.ts +4 -3
  52. package/dist/commands/start.d.ts +10 -0
  53. package/dist/commands/storage.d.ts +4 -0
  54. package/dist/commands/upgrade.d.ts +12 -0
  55. package/dist/commands/verify.d.ts +96 -0
  56. package/dist/{consent-ClRHmcxf.js → consent-BD7F29T3.js} +2 -2
  57. package/dist/{consent-ClRHmcxf.js.map → consent-BD7F29T3.js.map} +1 -1
  58. package/dist/{console-CEGm0XNc.js → console-BXB6-8GT.js} +12 -6
  59. package/dist/console-BXB6-8GT.js.map +1 -0
  60. package/dist/{context-CyflUrKg.js → context-GUxkZm-S.js} +482 -26
  61. package/dist/context-GUxkZm-S.js.map +1 -0
  62. package/dist/{daemon-CknkDjd6.js → daemon-Cp7oNXth.js} +160 -5
  63. package/dist/daemon-Cp7oNXth.js.map +1 -0
  64. package/dist/{daemon-entry-CbLRrgzy.js → daemon-entry-zOC1revO.js} +6 -3
  65. package/dist/daemon-entry-zOC1revO.js.map +1 -0
  66. package/dist/{db-CRNpA5mH.js → db-KzlqddGD.js} +101 -54
  67. package/dist/db-KzlqddGD.js.map +1 -0
  68. package/dist/{derive-CsoFGAnK.js → derive-ae9UOoOB.js} +2 -2
  69. package/dist/{derive-CsoFGAnK.js.map → derive-ae9UOoOB.js.map} +1 -1
  70. package/dist/{dev-C0pbMmhS.js → dev-DTqVMgB3.js} +231 -44
  71. package/dist/dev-DTqVMgB3.js.map +1 -0
  72. package/dist/dev-db/daemon.d.ts +41 -0
  73. package/dist/dev-db/pull.d.ts +33 -5
  74. package/dist/dev-db/state.d.ts +9 -0
  75. package/dist/{dev-preflight-unHpiYO1.js → dev-preflight-Cxv3TiD1.js} +73 -27
  76. package/dist/dev-preflight-Cxv3TiD1.js.map +1 -0
  77. package/dist/{dev-server-B1UYifZJ.js → dev-server-OJsUGZEB.js} +14 -3
  78. package/dist/dev-server-OJsUGZEB.js.map +1 -0
  79. package/dist/{doctor-CATRdWm6.js → doctor-BRWOlqeG.js} +14 -12
  80. package/dist/doctor-BRWOlqeG.js.map +1 -0
  81. package/dist/{eject-DuasTr-F.js → eject-DABcDnPN.js} +3 -4
  82. package/dist/{eject-DuasTr-F.js.map → eject-DABcDnPN.js.map} +1 -1
  83. package/dist/{fold-static-hDHtDfTq.js → fold-static-BnAK-anQ.js} +3 -3
  84. package/dist/{fold-static-hDHtDfTq.js.map → fold-static-BnAK-anQ.js.map} +1 -1
  85. package/dist/generate-view-IFwCADvb.js +662 -0
  86. package/dist/generate-view-IFwCADvb.js.map +1 -0
  87. package/dist/{generate_sdk-Cvg5jjJF.js → generate_sdk-BvcWvoUh.js} +49 -13
  88. package/dist/generate_sdk-BvcWvoUh.js.map +1 -0
  89. package/dist/index.es.js +58 -40
  90. package/dist/index.es.js.map +1 -1
  91. package/dist/{init-BWAwHPtz.js → init-CaU6GhwI.js} +50 -62
  92. package/dist/init-CaU6GhwI.js.map +1 -0
  93. package/dist/invoked-command-CG_rIa_o.js +55 -0
  94. package/dist/invoked-command-CG_rIa_o.js.map +1 -0
  95. package/dist/last-dev-database-DpW5dfoX.js +2 -0
  96. package/dist/{manifest-DRp0UVTj.js → manifest-BtzDy7KQ.js} +36 -3
  97. package/dist/{manifest-DRp0UVTj.js.map → manifest-BtzDy7KQ.js.map} +1 -1
  98. package/dist/{normalize-imports-BoBVh5tU.js → normalize-imports-D0zXlM6g.js} +3 -3
  99. package/dist/{normalize-imports-BoBVh5tU.js.map → normalize-imports-D0zXlM6g.js.map} +1 -1
  100. package/dist/{path-flags-BFgG9V6y.js → path-flags-DNvtEi2-.js} +5 -4
  101. package/dist/path-flags-DNvtEi2-.js.map +1 -0
  102. package/dist/{prepare-DdnU70z8.js → prepare-CTw9NEkh.js} +5 -4
  103. package/dist/{prepare-DdnU70z8.js.map → prepare-CTw9NEkh.js.map} +1 -1
  104. package/dist/project-CasK56vN.js +701 -0
  105. package/dist/project-CasK56vN.js.map +1 -0
  106. package/dist/{pull-C3PXduzl.js → pull-DDMpsZ5r.js} +131 -24
  107. package/dist/pull-DDMpsZ5r.js.map +1 -0
  108. package/dist/refusal-ReeeGP8a.js +26 -0
  109. package/dist/refusal-ReeeGP8a.js.map +1 -0
  110. package/dist/resolve-D647F1LA.js +2 -0
  111. package/dist/{resources-BdNRDEAy.js → resources-CPSC5Kcu.js} +4 -5
  112. package/dist/{resources-BdNRDEAy.js.map → resources-CPSC5Kcu.js.map} +1 -1
  113. package/dist/{schema-B0-p6T1O.js → schema-BSXwZSiI.js} +9 -8
  114. package/dist/schema-BSXwZSiI.js.map +1 -0
  115. package/dist/{skills-DfnTeyRz.js → skills-BU2flMOy.js} +52 -8
  116. package/dist/skills-BU2flMOy.js.map +1 -0
  117. package/dist/{start-BmEZkS0n.js → start-mVb6upwY.js} +20 -7
  118. package/dist/start-mVb6upwY.js.map +1 -0
  119. package/dist/{state-CCB-FAQ9.js → state-CYdBvnwA.js} +3 -2
  120. package/dist/state-CYdBvnwA.js.map +1 -0
  121. package/dist/static-syntax-check.d.ts +64 -0
  122. package/dist/{status-BJ26yZOo.js → status-BREvtzJm.js} +8 -9
  123. package/dist/{status-BJ26yZOo.js.map → status-BREvtzJm.js.map} +1 -1
  124. package/dist/{storage-DKPUBTWG.js → storage-DtOXGflp.js} +159 -16
  125. package/dist/storage-DtOXGflp.js.map +1 -0
  126. package/dist/{telemetry-EMFRVRQi.js → telemetry-CgwJPVMO.js} +2 -2
  127. package/dist/{telemetry-EMFRVRQi.js.map → telemetry-CgwJPVMO.js.map} +1 -1
  128. package/dist/{telemetry-m9czTNGR.js → telemetry-DwK5RQJl.js} +4 -4
  129. package/dist/{telemetry-m9czTNGR.js.map → telemetry-DwK5RQJl.js.map} +1 -1
  130. package/dist/{upgrade-DjihWuZL.js → upgrade-B7sVwL8S.js} +26 -4
  131. package/dist/{upgrade-DjihWuZL.js.map → upgrade-B7sVwL8S.js.map} +1 -1
  132. package/dist/utils/args.d.ts +32 -3
  133. package/dist/utils/boot-retry.d.ts +41 -0
  134. package/dist/utils/collections-dir.d.ts +14 -0
  135. package/dist/utils/dev-preflight.d.ts +34 -1
  136. package/dist/utils/dev-server.d.ts +11 -0
  137. package/dist/utils/path-flags.d.ts +2 -1
  138. package/dist/utils/project.d.ts +5 -1
  139. package/dist/utils/tool-stdio.d.ts +1 -1
  140. package/dist/utils/unknown-command.d.ts +4 -0
  141. package/dist/verify-D7UsV_qe.js +730 -0
  142. package/dist/verify-D7UsV_qe.js.map +1 -0
  143. package/package.json +9 -7
  144. package/templates/eject/backend/src/index.ts +9 -1
  145. package/templates/generated-schemas/ecommerce.ts +3 -0
  146. package/templates/overlays/baas/ai-instructions.md +13 -0
  147. package/templates/resource-graphs/blank.json +25 -0
  148. package/templates/resource-graphs/blog.json +28 -0
  149. package/templates/resource-graphs/ecommerce.json +28 -0
  150. package/templates/resource-graphs/headless.json +22 -0
  151. package/templates/template/.claude/hooks/post-edit-collection.sh +99 -0
  152. package/templates/template/.claude/settings.json +17 -0
  153. package/templates/template/.env.example +15 -5
  154. package/templates/template/ai-instructions.md +21 -1
  155. package/templates/template/config/collections/presets/ecommerce/index.ts +23 -0
  156. package/templates/template/docker-compose.yml +4 -1
  157. package/templates/template/frontend/package.json +1 -0
  158. package/templates/template/frontend/src/App.tsx +10 -9
  159. package/templates/views/AppView.tsx.tmpl +138 -0
  160. package/templates/views/EntityView.tsx.tmpl +64 -0
  161. package/templates/views/index.ts.tmpl +8 -0
  162. package/dist/agent-setup-B5AKHOgt.js.map +0 -1
  163. package/dist/api-keys-Tm7zvAPe.js.map +0 -1
  164. package/dist/args-BX0YD14a.js +0 -266
  165. package/dist/args-BX0YD14a.js.map +0 -1
  166. package/dist/auth-Vl2hFKXP.js.map +0 -1
  167. package/dist/bundle-DtCCCr4w.js.map +0 -1
  168. package/dist/cloud-BpH0_bmV.js.map +0 -1
  169. package/dist/console-CEGm0XNc.js.map +0 -1
  170. package/dist/context-CyflUrKg.js.map +0 -1
  171. package/dist/daemon-CknkDjd6.js.map +0 -1
  172. package/dist/daemon-entry-CbLRrgzy.js.map +0 -1
  173. package/dist/db-CRNpA5mH.js.map +0 -1
  174. package/dist/dev-C0pbMmhS.js.map +0 -1
  175. package/dist/dev-preflight-unHpiYO1.js.map +0 -1
  176. package/dist/dev-server-B1UYifZJ.js.map +0 -1
  177. package/dist/doctor-CATRdWm6.js.map +0 -1
  178. package/dist/generate_sdk-Cvg5jjJF.js.map +0 -1
  179. package/dist/init-BWAwHPtz.js.map +0 -1
  180. package/dist/last-dev-database-c_dKz1S3.js +0 -2
  181. package/dist/path-flags-BFgG9V6y.js.map +0 -1
  182. package/dist/project-Wp2zoyeN.js +0 -349
  183. package/dist/project-Wp2zoyeN.js.map +0 -1
  184. package/dist/pull-C3PXduzl.js.map +0 -1
  185. package/dist/resolve-CNQjsatH.js +0 -2
  186. package/dist/schema-B0-p6T1O.js.map +0 -1
  187. package/dist/skills-DfnTeyRz.js.map +0 -1
  188. package/dist/start-BmEZkS0n.js.map +0 -1
  189. package/dist/state-CCB-FAQ9.js.map +0 -1
  190. package/dist/storage-DKPUBTWG.js.map +0 -1
@@ -101,13 +101,33 @@ export declare function probeTcp(host: string, port: number, timeoutMs?: number)
101
101
  * forward. {@link waitForQueryable} is the check that a query will work.
102
102
  */
103
103
  export declare function waitForPort(host: string, port: number, timeoutMs?: number, intervalMs?: number): Promise<boolean>;
104
- /** Whether a database answered a query, and if not, the last reason it gave. */
104
+ /**
105
+ * Whether a database answered a query, and if not, the last reason it gave —
106
+ * and, for a database closed to new connections, its name.
107
+ */
105
108
  export type QueryReadiness = {
106
109
  ready: true;
107
110
  } | {
108
111
  ready: false;
109
112
  error: string;
113
+ closedDatabase?: string;
110
114
  };
115
+ /** What opening a closed database again did, and what to say about it. */
116
+ export interface ClosedDatabaseHeal {
117
+ /** It accepts connections again. */
118
+ reopened: boolean;
119
+ /** The driver's own lines about it (`reopenedDatabasesNotice`). */
120
+ notice: string[];
121
+ }
122
+ /**
123
+ * The database a connection was refused by because it is closed to new
124
+ * connections (`ALLOW_CONNECTIONS false`), or null.
125
+ *
126
+ * The driver's `closedDatabaseName`, for the error a bare `pg` connect gives:
127
+ * the sentence is matched, not SQLSTATE 55000, which also covers failures that
128
+ * have nothing to do with connecting.
129
+ */
130
+ export declare function closedDatabaseName(error: unknown): string | null;
111
131
  /**
112
132
  * Poll until `SELECT 1` succeeds on this connection string, or the bound runs out.
113
133
  *
@@ -118,10 +138,21 @@ export type QueryReadiness = {
118
138
  * three. Every error is retried: a reset, "the database system is starting up"
119
139
  * and a refused connection all mean "not yet", and the bound is what turns
120
140
  * "not yet" into an answer.
141
+ *
142
+ * Except one, which is not "not yet": a database closed to new connections
143
+ * (`closedDatabaseName`), which is what a `rebase db branch create --force`
144
+ * killed mid-copy leaves its source as. Waiting cannot open it, and it was
145
+ * waited on for the whole minute. It is opened again with the driver's
146
+ * `reopenClosedDatabases`, once, and then either answers or the wait ends at
147
+ * once, naming it.
121
148
  */
122
149
  export declare function waitForQueryable(databaseUrl: string, options?: {
123
150
  timeoutMs?: number;
124
151
  intervalMs?: number;
152
+ /** Opens a closed database again. The driver's `reopenClosedDatabases` by default; injected for tests. */
153
+ reopenClosed?: (databaseUrl: string) => Promise<ClosedDatabaseHeal>;
154
+ /** Where the driver's lines about a database it opened go. */
155
+ onNotice?: (line: string) => void;
125
156
  }): Promise<QueryReadiness>;
126
157
  /**
127
158
  * What a failed schema push printed, as lines to show.
@@ -204,6 +235,8 @@ export interface EnsureDevDatabaseOptions {
204
235
  startDatabase?: (projectRoot: string) => Promise<void>;
205
236
  /** How long a started database has to answer `SELECT 1`. Defaults to 60s. */
206
237
  readyTimeoutMs?: number;
238
+ /** Opens a database closed to new connections again; see `waitForQueryable`. Injected for tests. */
239
+ reopenClosed?: (databaseUrl: string) => Promise<ClosedDatabaseHeal>;
207
240
  /**
208
241
  * Who answers on the compose port. Asks Docker by default; injected for the
209
242
  * same reason `startDatabase` is.
@@ -1,3 +1,14 @@
1
+ /**
2
+ * The address `rebase dev` is starting its backend on, handed to the
3
+ * `generate-sdk` child it runs.
4
+ *
5
+ * Dev regenerates the SDK at boot, beside the database start and before the
6
+ * backend binds — so before the backend writes `.rebase/state.json`, which is
7
+ * where `generate-sdk` otherwise reads the address for the README's example.
8
+ * Dev knows the port it hands the backend, and the child's environment is the
9
+ * only channel between them.
10
+ */
11
+ export declare const DEV_BACKEND_URL_ENV = "REBASE_DEV_BACKEND_URL";
1
12
  /**
2
13
  * The port `rebase dev` derives from the project root path.
3
14
  * Range: 3001–3999 (avoids privileged ports and common services).
@@ -1,7 +1,7 @@
1
1
  /** The rule, as every help page and error states it. */
2
2
  export declare const COLLECTIONS_PATH_RULE = "relative paths are resolved from where you run the command";
3
3
  /** The `--collections` line of a help page. */
4
- export declare const COLLECTIONS_FLAG_HELP = "Collections directory (default: config/collections); relative paths are resolved from where you run the command";
4
+ export declare const COLLECTIONS_FLAG_HELP = "Collections directory (default: config/collections, or <config>/collections when rebase.json moves the backend's config); relative paths are resolved from where you run the command";
5
5
  /**
6
6
  * What a refusal over a missing `--collections` path spared, by what the command
7
7
  * would have done with it. Only a schema writer drops tables; a console or a
@@ -11,6 +11,7 @@ declare const MISSING_COLLECTIONS_CONSEQUENCE: {
11
11
  readonly schema: readonly ["Nothing was generated and nothing was applied — a schema generated from a", "directory that is not there is an empty one, and applying it would drop", "every table it does not describe."];
12
12
  readonly console: readonly ["Nothing was started — a console over a directory that is not there would", "load none of this project's collections."];
13
13
  readonly doctor: readonly ["Nothing was checked — a directory that is not there has no collections, so", "every collection check would pass over it."];
14
+ readonly verify: readonly ["Nothing was verified — a directory that is not there has no collections, so", "every step would pass over it and report 0 errors."];
14
15
  };
15
16
  /** What a command does with its `--collections` path. */
16
17
  export type CollectionsPathUse = keyof typeof MISSING_COLLECTIONS_CONSEQUENCE;
@@ -158,7 +158,11 @@ export interface JsonFailureIssue {
158
158
  * failure mode of not doing it is an unparseable stream.
159
159
  */
160
160
  export declare function failAsJson(message: string, code: string, hint?: string, issues?: JsonFailureIssue[]): never;
161
- /** Did the command line ask for machine-readable output? */
161
+ /**
162
+ * Did the command line ask for machine-readable output? Read as the parser
163
+ * reads a switch: `--json`, `--json=true` and `--json=1` ask for it,
164
+ * `--json=false` and `--json=0` do not.
165
+ */
162
166
  export declare function wantsJsonOutput(argv?: readonly string[]): boolean;
163
167
  /**
164
168
  * Require the project root or exit with a helpful error.
@@ -4,7 +4,7 @@
4
4
  *
5
5
  * Inherited, so its output streams as it happens. With `quietStdout` its stdout
6
6
  * goes to stderr instead, for a command whose own stdout carries a result:
7
- * `rebase cloud deploy` in JSON mode — every piped run — owes stdout exactly one
7
+ * `rebase cloud deploy --json` owes stdout exactly one
8
8
  * JSON value, and a `vite v6 building…` line in front of it is a result no
9
9
  * parser can read. The tool's output still reaches the person watching.
10
10
  */
@@ -17,6 +17,10 @@ export declare function suggestCommand(typed: string, known: readonly string[]):
17
17
  * `family` is empty for the top level: `rebase --help`, not `rebase --help`.
18
18
  * `families` are the command families below this level, by name, whose
19
19
  * commands a word may be one of.
20
+ *
21
+ * The typed word is repeated with any connection-string password masked: a URL
22
+ * pasted where the command goes (`rebase db "postgres://u:pw@h/db"`) is a
23
+ * word like any other here, and this line lands in terminals and CI logs.
20
24
  */
21
25
  export declare function unknownCommandMessage(typed: string | undefined, known: readonly string[], family?: string, families?: Readonly<Record<string, readonly string[]>>): string;
22
26
  /**