@rebasepro/cli 0.25.1 → 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 (151) hide show
  1. package/README.md +2 -1
  2. package/bin/rebase.js +143 -4
  3. package/dist/{agent-setup-BYb2Tbdz.js → agent-setup-D9mHRZ5R.js} +125 -3
  4. package/dist/agent-setup-D9mHRZ5R.js.map +1 -0
  5. package/dist/{api-keys-CSMbsmAn.js → api-keys-CyJ26KEJ.js} +41 -9
  6. package/dist/api-keys-CyJ26KEJ.js.map +1 -0
  7. package/dist/{apps-iBXNZhVN.js → apps-CnLDV5b6.js} +6 -6
  8. package/dist/{apps-iBXNZhVN.js.map → apps-CnLDV5b6.js.map} +1 -1
  9. package/dist/{atlas-dev-database-BusbHP6n.js → atlas-dev-database-BODqdCWt.js} +2 -2
  10. package/dist/{atlas-dev-database-BusbHP6n.js.map → atlas-dev-database-BODqdCWt.js.map} +1 -1
  11. package/dist/{auth-DRsTWPky.js → auth-dII2jCO1.js} +10 -7
  12. package/dist/auth-dII2jCO1.js.map +1 -0
  13. package/dist/{branch-pointer-Bn_FjNld.js → branch-pointer-BQUF6lYa.js} +1 -1
  14. package/dist/{build-et7Rccxi.js → build-Cza7ZQrp.js} +6 -6
  15. package/dist/{build-et7Rccxi.js.map → build-Cza7ZQrp.js.map} +1 -1
  16. package/dist/{bundle-DlqkDYSe.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-B-ZIjHrA.js → cloud-BdnmqQaZ.js} +8527 -4340
  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 +10 -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 +15 -0
  50. package/dist/commands/skills.d.ts +4 -3
  51. package/dist/commands/storage.d.ts +4 -0
  52. package/dist/commands/verify.d.ts +96 -0
  53. package/dist/{consent-BaB-eQKG.js → consent-BD7F29T3.js} +2 -2
  54. package/dist/{consent-BaB-eQKG.js.map → consent-BD7F29T3.js.map} +1 -1
  55. package/dist/{console-BlD9kjFW.js → console-BXB6-8GT.js} +12 -6
  56. package/dist/console-BXB6-8GT.js.map +1 -0
  57. package/dist/{context-DHiiiJ5C.js → context-GUxkZm-S.js} +481 -24
  58. package/dist/context-GUxkZm-S.js.map +1 -0
  59. package/dist/{daemon-DDMRbz4T.js → daemon-Cp7oNXth.js} +2 -2
  60. package/dist/{daemon-DDMRbz4T.js.map → daemon-Cp7oNXth.js.map} +1 -1
  61. package/dist/{db-9P6MnmdC.js → db-KzlqddGD.js} +37 -30
  62. package/dist/db-KzlqddGD.js.map +1 -0
  63. package/dist/{derive-MTdClnkc.js → derive-ae9UOoOB.js} +2 -2
  64. package/dist/{derive-MTdClnkc.js.map → derive-ae9UOoOB.js.map} +1 -1
  65. package/dist/{dev-BDN_OKXA.js → dev-DTqVMgB3.js} +59 -32
  66. package/dist/dev-DTqVMgB3.js.map +1 -0
  67. package/dist/{dev-preflight-FT9GbJVj.js → dev-preflight-Cxv3TiD1.js} +2 -2
  68. package/dist/{dev-preflight-FT9GbJVj.js.map → dev-preflight-Cxv3TiD1.js.map} +1 -1
  69. package/dist/{dev-server-CIZwAfZa.js → dev-server-OJsUGZEB.js} +2 -2
  70. package/dist/{dev-server-CIZwAfZa.js.map → dev-server-OJsUGZEB.js.map} +1 -1
  71. package/dist/{doctor-D8YXz7df.js → doctor-BRWOlqeG.js} +13 -11
  72. package/dist/doctor-BRWOlqeG.js.map +1 -0
  73. package/dist/{eject-izG2KjMo.js → eject-DABcDnPN.js} +3 -3
  74. package/dist/{eject-izG2KjMo.js.map → eject-DABcDnPN.js.map} +1 -1
  75. package/dist/{fold-static-CybSay_W.js → fold-static-BnAK-anQ.js} +3 -3
  76. package/dist/{fold-static-CybSay_W.js.map → fold-static-BnAK-anQ.js.map} +1 -1
  77. package/dist/generate-view-IFwCADvb.js +662 -0
  78. package/dist/generate-view-IFwCADvb.js.map +1 -0
  79. package/dist/{generate_sdk-B4R65oUV.js → generate_sdk-BvcWvoUh.js} +33 -7
  80. package/dist/generate_sdk-BvcWvoUh.js.map +1 -0
  81. package/dist/index.es.js +57 -38
  82. package/dist/index.es.js.map +1 -1
  83. package/dist/{init-DYaeppEN.js → init-CaU6GhwI.js} +8 -8
  84. package/dist/{init-DYaeppEN.js.map → init-CaU6GhwI.js.map} +1 -1
  85. package/dist/last-dev-database-DpW5dfoX.js +2 -0
  86. package/dist/{manifest-nvPdLlJY.js → manifest-BtzDy7KQ.js} +36 -3
  87. package/dist/{manifest-nvPdLlJY.js.map → manifest-BtzDy7KQ.js.map} +1 -1
  88. package/dist/{normalize-imports-BYw8ad87.js → normalize-imports-D0zXlM6g.js} +3 -3
  89. package/dist/{normalize-imports-BYw8ad87.js.map → normalize-imports-D0zXlM6g.js.map} +1 -1
  90. package/dist/{path-flags-BFgG9V6y.js → path-flags-DNvtEi2-.js} +5 -4
  91. package/dist/path-flags-DNvtEi2-.js.map +1 -0
  92. package/dist/{prepare-1rVNd2PF.js → prepare-CTw9NEkh.js} +4 -4
  93. package/dist/{prepare-1rVNd2PF.js.map → prepare-CTw9NEkh.js.map} +1 -1
  94. package/dist/{project-g4K6kV1t.js → project-CasK56vN.js} +2 -2
  95. package/dist/{project-g4K6kV1t.js.map → project-CasK56vN.js.map} +1 -1
  96. package/dist/resolve-D647F1LA.js +2 -0
  97. package/dist/{resources-CovP8AZ-.js → resources-CPSC5Kcu.js} +4 -4
  98. package/dist/{resources-CovP8AZ-.js.map → resources-CPSC5Kcu.js.map} +1 -1
  99. package/dist/{schema-nuxvvc50.js → schema-BSXwZSiI.js} +9 -7
  100. package/dist/schema-BSXwZSiI.js.map +1 -0
  101. package/dist/{skills-DeUIsZcT.js → skills-BU2flMOy.js} +52 -7
  102. package/dist/skills-BU2flMOy.js.map +1 -0
  103. package/dist/{start-RzZqDroW.js → start-mVb6upwY.js} +5 -5
  104. package/dist/{start-RzZqDroW.js.map → start-mVb6upwY.js.map} +1 -1
  105. package/dist/static-syntax-check.d.ts +64 -0
  106. package/dist/{status-D9Zm88NZ.js → status-BREvtzJm.js} +7 -7
  107. package/dist/{status-D9Zm88NZ.js.map → status-BREvtzJm.js.map} +1 -1
  108. package/dist/{storage-BB3umRfw.js → storage-DtOXGflp.js} +159 -15
  109. package/dist/storage-DtOXGflp.js.map +1 -0
  110. package/dist/{telemetry-HfU5uAh1.js → telemetry-CgwJPVMO.js} +2 -2
  111. package/dist/{telemetry-HfU5uAh1.js.map → telemetry-CgwJPVMO.js.map} +1 -1
  112. package/dist/{telemetry-TseNLk6X.js → telemetry-DwK5RQJl.js} +4 -4
  113. package/dist/{telemetry-TseNLk6X.js.map → telemetry-DwK5RQJl.js.map} +1 -1
  114. package/dist/{upgrade-apiPKKE_.js → upgrade-B7sVwL8S.js} +4 -4
  115. package/dist/{upgrade-apiPKKE_.js.map → upgrade-B7sVwL8S.js.map} +1 -1
  116. package/dist/utils/collections-dir.d.ts +14 -0
  117. package/dist/utils/path-flags.d.ts +2 -1
  118. package/dist/utils/tool-stdio.d.ts +1 -1
  119. package/dist/verify-D7UsV_qe.js +730 -0
  120. package/dist/verify-D7UsV_qe.js.map +1 -0
  121. package/package.json +9 -7
  122. package/templates/eject/backend/src/index.ts +9 -1
  123. package/templates/generated-schemas/ecommerce.ts +3 -0
  124. package/templates/overlays/baas/ai-instructions.md +13 -0
  125. package/templates/template/.claude/hooks/post-edit-collection.sh +99 -0
  126. package/templates/template/.claude/settings.json +17 -0
  127. package/templates/template/.env.example +10 -1
  128. package/templates/template/ai-instructions.md +21 -1
  129. package/templates/template/config/collections/presets/ecommerce/index.ts +23 -0
  130. package/templates/template/docker-compose.yml +4 -1
  131. package/templates/template/frontend/package.json +1 -0
  132. package/templates/views/AppView.tsx.tmpl +138 -0
  133. package/templates/views/EntityView.tsx.tmpl +64 -0
  134. package/templates/views/index.ts.tmpl +8 -0
  135. package/dist/agent-setup-BYb2Tbdz.js.map +0 -1
  136. package/dist/api-keys-CSMbsmAn.js.map +0 -1
  137. package/dist/auth-DRsTWPky.js.map +0 -1
  138. package/dist/bundle-DlqkDYSe.js.map +0 -1
  139. package/dist/cloud-B-ZIjHrA.js.map +0 -1
  140. package/dist/console-BlD9kjFW.js.map +0 -1
  141. package/dist/context-DHiiiJ5C.js.map +0 -1
  142. package/dist/db-9P6MnmdC.js.map +0 -1
  143. package/dist/dev-BDN_OKXA.js.map +0 -1
  144. package/dist/doctor-D8YXz7df.js.map +0 -1
  145. package/dist/generate_sdk-B4R65oUV.js.map +0 -1
  146. package/dist/last-dev-database-B_75fxZC.js +0 -2
  147. package/dist/path-flags-BFgG9V6y.js.map +0 -1
  148. package/dist/resolve-BQUAC3Wi.js +0 -2
  149. package/dist/schema-nuxvvc50.js.map +0 -1
  150. package/dist/skills-DeUIsZcT.js.map +0 -1
  151. package/dist/storage-BB3umRfw.js.map +0 -1
@@ -10,9 +10,50 @@
10
10
  * this directory as a build context, and the bare form uploads nothing and asks
11
11
  * the control plane to rebuild what it already holds. That last one is the
12
12
  * dangerous one — see `planBareDeploy`.
13
+ *
14
+ * `--preview` is the bundle deploy aimed somewhere else: the same build and
15
+ * upload, triggered through the `previews` function so it is served on an
16
+ * address of its own and production is never touched. See `previews.ts`.
13
17
  */
14
18
  import arg from "arg";
15
19
  import { type CloudClient } from "./context.js";
20
+ /** Printed under a successful deploy: the way back, where it is needed. */
21
+ export declare const ROLLBACK_HINT = "Something wrong? `rebase cloud rollback` puts the previous deployment back.";
22
+ /**
23
+ * The same line for a static app deployed on its own. Its deployment records
24
+ * no bundle, so the control plane has nothing to roll back to (see the
25
+ * "Roll back" section of the cloud deployment docs). Pointing at
26
+ * `rollback` here would restore the backend instead, or refuse.
27
+ */
28
+ export declare const STATIC_UNDO_HINT = "Something wrong? A static app deployed on its own cannot be rolled back yet: deploy its last good version again.";
29
+ /**
30
+ * Stop the deploy on a syntax error in a static app's output, before anything
31
+ * is uploaded. See `checkStaticSyntax`.
32
+ *
33
+ * A static app's files are served as they are, so a broken script that no
34
+ * bundler ever parsed went live and took the page down with it. Nothing on the
35
+ * way said so: the build "succeeded" by copying it, and the deploy succeeded
36
+ * by uploading it. `--no-verify` is the way past for a file the check gets
37
+ * wrong.
38
+ */
39
+ export declare function verifyStaticOutput(projectRoot: string, apps: {
40
+ name: string;
41
+ output?: string;
42
+ }[]): void;
43
+ /** What `--preview` and `--preview-name` asked for. */
44
+ export interface PreviewRequest {
45
+ /** A stable name, so later deploys update the same address; absent, the control plane picks one. */
46
+ name?: string;
47
+ }
48
+ /**
49
+ * `--preview` / `--preview-name <name>` off the parsed flags, or undefined for
50
+ * a production deploy. A name alone is a preview: nobody names a production
51
+ * deploy's address.
52
+ */
53
+ export declare function resolvePreviewRequest(flags: {
54
+ "--preview"?: boolean;
55
+ "--preview-name"?: string;
56
+ }): PreviewRequest | undefined;
16
57
  /** A project row, reduced to what says how it deploys (camel or snake columns). */
17
58
  export interface DeployProjectRow {
18
59
  runtimeMode?: string;
@@ -195,6 +236,7 @@ export declare const DEPLOY_FLAGS: {
195
236
  readonly "--no-follow": BooleanConstructor;
196
237
  readonly "--wait": BooleanConstructor;
197
238
  readonly "--timeout": StringConstructor;
239
+ readonly "--live-timeout": StringConstructor;
198
240
  readonly "--source": StringConstructor;
199
241
  readonly "--message": StringConstructor;
200
242
  readonly "--bundle": BooleanConstructor;
@@ -202,9 +244,12 @@ export declare const DEPLOY_FLAGS: {
202
244
  readonly "--skip-type-check": BooleanConstructor;
203
245
  readonly "--no-static": BooleanConstructor;
204
246
  readonly "--skip-schema": BooleanConstructor;
247
+ readonly "--no-verify": BooleanConstructor;
205
248
  readonly "--eject": BooleanConstructor;
206
249
  readonly "--no-source": BooleanConstructor;
207
250
  readonly "--allow-downgrade": BooleanConstructor;
251
+ readonly "--preview": BooleanConstructor;
252
+ readonly "--preview-name": StringConstructor;
208
253
  readonly "-m": "--message";
209
254
  };
210
255
  /**
@@ -234,6 +279,7 @@ export declare function resolveDeployArgs(rawArgs: string[]): {
234
279
  readonly "--no-follow": BooleanConstructor;
235
280
  readonly "--wait": BooleanConstructor;
236
281
  readonly "--timeout": StringConstructor;
282
+ readonly "--live-timeout": StringConstructor;
237
283
  readonly "--source": StringConstructor;
238
284
  readonly "--message": StringConstructor;
239
285
  readonly "--bundle": BooleanConstructor;
@@ -241,9 +287,12 @@ export declare function resolveDeployArgs(rawArgs: string[]): {
241
287
  readonly "--skip-type-check": BooleanConstructor;
242
288
  readonly "--no-static": BooleanConstructor;
243
289
  readonly "--skip-schema": BooleanConstructor;
290
+ readonly "--no-verify": BooleanConstructor;
244
291
  readonly "--eject": BooleanConstructor;
245
292
  readonly "--no-source": BooleanConstructor;
246
293
  readonly "--allow-downgrade": BooleanConstructor;
294
+ readonly "--preview": BooleanConstructor;
295
+ readonly "--preview-name": StringConstructor;
247
296
  readonly "-m": "--message";
248
297
  } & {
249
298
  readonly "--json": BooleanConstructor;
@@ -258,6 +307,15 @@ export declare function resolveDeployArgs(rawArgs: string[]): {
258
307
  appName: string | undefined;
259
308
  };
260
309
  export declare function deployCommand(rawArgs: string[], projectRef: string): Promise<void>;
310
+ /**
311
+ * `--live-timeout <seconds>`: how long a deploy waits for the new version to
312
+ * answer before saying it could not confirm it. `0` skips the check. Default 60.
313
+ *
314
+ * Its own reader rather than `resolveTimeoutMs`, which refuses 0 — right for a
315
+ * follow, where 0 would mean "give up at once", and wrong here, where it is the
316
+ * documented way to say "do not check".
317
+ */
318
+ export declare function resolveLiveTimeout(value: string | undefined): number;
261
319
  /** `--timeout <seconds>` for a deploy, or the 15-minute default. */
262
320
  export declare function resolveDeployTimeout(value: string | undefined): number;
263
321
  /**
@@ -348,5 +406,11 @@ export declare const LOGS_FLAGS: {
348
406
  readonly "--runtime": BooleanConstructor;
349
407
  readonly "--follow": BooleanConstructor;
350
408
  readonly "-f": "--follow";
409
+ readonly "--since": StringConstructor;
410
+ readonly "--tail": NumberConstructor;
411
+ readonly "--previous": BooleanConstructor;
412
+ readonly "--grep": StringConstructor;
413
+ readonly "--level": StringConstructor;
414
+ readonly "--preview": BooleanConstructor;
351
415
  };
352
416
  export declare function logsCommand(rawArgs: string[], projectRef: string): Promise<void>;
@@ -1,3 +1,7 @@
1
+ /** `--preview`: act on what the project's previews run with, not production. */
2
+ export declare const ENV_PREVIEW_FLAGS: {
3
+ readonly "--preview": BooleanConstructor;
4
+ };
1
5
  export declare function envCommand(action: string | undefined, rawArgs: string[]): Promise<void>;
2
6
  /** Parse `KEY=VALUE` or `KEY VALUE` from the positional operands. */
3
7
  export declare function parseEnvAssignment(operands: string[]): {
@@ -8,8 +12,20 @@ export declare function parseEnvAssignment(operands: string[]): {
8
12
  export declare function buildTimeEnvPrefix(key: string): string | undefined;
9
13
  /** The flags `rebase cloud env set` takes, on top of the global cloud ones. */
10
14
  export declare const ENV_SET_FLAGS: {
15
+ readonly "--preview": BooleanConstructor;
11
16
  readonly "--secret": BooleanConstructor;
12
17
  readonly "--force": BooleanConstructor;
18
+ readonly "--stdin": BooleanConstructor;
19
+ };
20
+ /**
21
+ * The value `env set KEY --stdin` was piped: everything on standard input,
22
+ * less the one line ending `echo` and a here-string add. Refuses a terminal
23
+ * (it would wait for a value nobody knows to type) and a line that also gives
24
+ * the value, which would leave two candidates.
25
+ */
26
+ export declare function envValueFromStdin(operands: string[], read?: () => string, isTTY?: boolean): {
27
+ key: string;
28
+ value: string;
13
29
  };
14
30
  /**
15
31
  * What `env set` was asked to store.
@@ -27,8 +43,10 @@ export declare const ENV_SET_FLAGS: {
27
43
  */
28
44
  export declare function resolveEnvSetArgs(rawArgs: string[]): {
29
45
  flags: import("arg").Result<{
46
+ readonly "--preview": BooleanConstructor;
30
47
  readonly "--secret": BooleanConstructor;
31
48
  readonly "--force": BooleanConstructor;
49
+ readonly "--stdin": BooleanConstructor;
32
50
  } & {
33
51
  readonly "--json": BooleanConstructor;
34
52
  readonly "--yes": BooleanConstructor;
@@ -39,6 +57,7 @@ export declare function resolveEnvSetArgs(rawArgs: string[]): {
39
57
  readonly "-y": "--yes";
40
58
  readonly "-h": "--help";
41
59
  }>;
60
+ positionals: string[];
42
61
  assignment: {
43
62
  key: string;
44
63
  value: string;
@@ -57,6 +76,11 @@ export declare function resolveEnvSetArgs(rawArgs: string[]): {
57
76
  * count of command words is the same for all of them.
58
77
  */
59
78
  export declare function resolveEnvKeyArg(rawArgs: string[], action: string): string | undefined;
79
+ /** {@link resolveEnvKeyArg}, and whether `--preview` was given (`unset` and `reset` take it). */
80
+ export declare function resolveEnvKeyArgs(rawArgs: string[], action: string): {
81
+ key: string | undefined;
82
+ preview: boolean;
83
+ };
60
84
  /**
61
85
  * One `KEY=value` line that dotenv reads back as exactly `value`, or null when
62
86
  * no quoting can carry it.
@@ -20,6 +20,8 @@ import { type HelpAction } from "./context.js";
20
20
  */
21
21
  export declare const CLOUD_VALUE_FLAGS: {
22
22
  readonly "--access-key-id": StringConstructor;
23
+ readonly "--action": StringConstructor;
24
+ readonly "--actor": StringConstructor;
23
25
  readonly "--autoscale-cpu-target": StringConstructor;
24
26
  readonly "--autoscale-max": StringConstructor;
25
27
  readonly "--backup-access-key-id": StringConstructor;
@@ -27,6 +29,7 @@ export declare const CLOUD_VALUE_FLAGS: {
27
29
  readonly "--backup-endpoint": StringConstructor;
28
30
  readonly "--backup-secret-access-key": StringConstructor;
29
31
  readonly "--base-domain": StringConstructor;
32
+ readonly "--before": StringConstructor;
30
33
  readonly "--branch": StringConstructor;
31
34
  readonly "--bucket": StringConstructor;
32
35
  readonly "--bundle-dir": StringConstructor;
@@ -42,23 +45,33 @@ export declare const CLOUD_VALUE_FLAGS: {
42
45
  readonly "--endpoint": StringConstructor;
43
46
  readonly "--events": StringConstructor;
44
47
  readonly "--expires-in": StringConstructor;
48
+ readonly "--format": StringConstructor;
45
49
  readonly "--function": StringConstructor;
50
+ readonly "--grep": StringConstructor;
46
51
  readonly "--host": StringConstructor;
47
52
  readonly "--ingress-address": StringConstructor;
48
53
  readonly "--kubeconfig": StringConstructor;
54
+ readonly "--level": StringConstructor;
49
55
  readonly "--limit": StringConstructor;
56
+ readonly "--live-timeout": StringConstructor;
50
57
  readonly "--memory": StringConstructor;
51
58
  readonly "--message": StringConstructor;
59
+ readonly "--month": StringConstructor;
52
60
  readonly "--name": StringConstructor;
53
61
  readonly "--org": StringConstructor;
54
62
  readonly "--output": StringConstructor;
55
63
  readonly "--password": StringConstructor;
56
64
  readonly "--platform-rebuilds": StringConstructor;
57
65
  readonly "--port": StringConstructor;
66
+ readonly "--preview-name": StringConstructor;
58
67
  readonly "--provider": StringConstructor;
68
+ readonly "--pull-key-file": StringConstructor;
69
+ readonly "--push-service-account": StringConstructor;
59
70
  readonly "--region": StringConstructor;
60
71
  readonly "--replicas": StringConstructor;
61
72
  readonly "--repo": StringConstructor;
73
+ readonly "--repository": StringConstructor;
74
+ readonly "--role": StringConstructor;
62
75
  readonly "--scale-to-zero": StringConstructor;
63
76
  readonly "--secret-access-key": StringConstructor;
64
77
  readonly "--since": StringConstructor;
@@ -67,7 +80,6 @@ export declare const CLOUD_VALUE_FLAGS: {
67
80
  readonly "--spot": StringConstructor;
68
81
  readonly "--storage": StringConstructor;
69
82
  readonly "--subdomain": StringConstructor;
70
- readonly "--table": StringConstructor;
71
83
  readonly "--tail": StringConstructor;
72
84
  readonly "--target": StringConstructor;
73
85
  readonly "--timeout": StringConstructor;
@@ -0,0 +1,143 @@
1
+ import { dotenvSets } from "./context.js";
2
+ /** What `rebase cloud init` parses, beside the global flags. Exported so its help page cannot drift. */
3
+ export declare const INIT_FLAGS: {
4
+ readonly "--claim": BooleanConstructor;
5
+ readonly "--name": StringConstructor;
6
+ readonly "-n": "--name";
7
+ readonly "--no-deploy": BooleanConstructor;
8
+ };
9
+ /** The variable the app, the SDK and the MCP server read the backend's address from. */
10
+ export declare const BASE_URL_ENV = "REBASE_BASE_URL";
11
+ /** The variable the MCP server and the SDK read the app's key from. */
12
+ export declare const API_TOKEN_ENV = "REBASE_API_TOKEN";
13
+ /** What `POST /api/functions/ephemeral/provision` answers. */
14
+ export interface ProvisionedProject {
15
+ projectId: string;
16
+ slug: string;
17
+ name: string;
18
+ projectUrl: string;
19
+ apiKey: string;
20
+ claimUrl: string;
21
+ expiresAt: string;
22
+ }
23
+ /**
24
+ * Ask the control plane for a project. No credential: this is the one call in
25
+ * the family that is made by nobody.
26
+ */
27
+ export declare function requestEphemeralProject(url: string, name: string | undefined): Promise<ProvisionedProject>;
28
+ /** What `POST /api/functions/ephemeral/app-key` answers: a key minted on the app itself. */
29
+ export interface AppKey {
30
+ apiKey: string;
31
+ keyId: string;
32
+ scopes: string[];
33
+ expiresAt: string;
34
+ }
35
+ export type AppKeyOutcome = {
36
+ ok: true;
37
+ key: AppKey;
38
+ } | {
39
+ ok: false;
40
+ code: string;
41
+ message: string;
42
+ };
43
+ export interface AppKeyRetry {
44
+ /** How many times to ask while the app is still coming up. */
45
+ attempts: number;
46
+ sleep: (ms: number) => Promise<void>;
47
+ }
48
+ /**
49
+ * Ask the control plane for a key the deployed app accepts, with the project's
50
+ * own token.
51
+ *
52
+ * The control plane mints it on the app through the app's admin key route: a
53
+ * service key holding `data:read` and `data:write` and nothing else, running
54
+ * through the app's row-level security as a caller who is neither a person nor
55
+ * an admin, expiring with the claim window. Never fatal: the project and its
56
+ * claim link stand without it, so a refusal comes back as an outcome to report.
57
+ *
58
+ * Asks again only while the app is not answering yet, the state a rollout
59
+ * that has just finished can still be in: a 503 from the control plane (the
60
+ * app did not answer), or a 502/504 (the app's gateway answered for it — the
61
+ * control plane passes any non-2xx from the app on as 502).
62
+ */
63
+ export declare function requestAppKey(url: string, token: string, projectId: string, retry?: AppKeyRetry): Promise<AppKeyOutcome>;
64
+ /**
65
+ * Set one variable in a `.env`, keeping every other line as it was: replaced
66
+ * where it is already set, appended where it is not.
67
+ */
68
+ export declare function upsertDotenv(file: string, key: string, value: string): void;
69
+ export { dotenvSets };
70
+ /**
71
+ * Set on the deploy `init` runs as a child. `init` asks for the app's key
72
+ * itself once that deploy is done, and reports it in its own result, so the
73
+ * child leaves it alone: asked twice, the second key revokes the first.
74
+ */
75
+ export declare const INIT_CHILD_DEPLOY_ENV = "REBASE_CLOUD_INIT_DEPLOY";
76
+ /** The key's outcome as a result reports it. Never the key: this output reaches an agent's transcript. */
77
+ export declare function appKeyPayload(outcome: AppKeyOutcome): Record<string, unknown>;
78
+ /**
79
+ * After `rebase cloud deploy` succeeded: the app's key, when this directory is
80
+ * linked to an unclaimed project and its `.env` has none yet.
81
+ *
82
+ * `init` asks for the key right after its own deploy, so a project provisioned
83
+ * with `--no-deploy`, or whose first deploy failed, had no way to get one, and
84
+ * `init` does not run again in a linked directory. The next deploy that builds
85
+ * the app is that way.
86
+ *
87
+ * Asks nothing when the project is claimed or its grant has expired (there is
88
+ * no grant then), when the deploy was for a project other than the linked one,
89
+ * or when `.env` already sets `REBASE_API_TOKEN`: that may be a key someone
90
+ * made by hand, and a new one revokes the last one minted. Never throws, since
91
+ * the deploy succeeded either way, and answers `undefined` when it asked nothing.
92
+ */
93
+ export declare function mintMissingAppKey(opts: {
94
+ url: string;
95
+ projectId: string;
96
+ /** The directory holding the link and `.env`: the project root, or the working directory. */
97
+ root?: string;
98
+ appKey?: InitDeps["appKey"];
99
+ }): Promise<AppKeyOutcome | undefined>;
100
+ /**
101
+ * Say how {@link mintMissingAppKey} went, under a deploy's verdict and before
102
+ * its result. A refusal is a warning, in every output mode: the deploy
103
+ * succeeded regardless. JSON carries the same through {@link appKeyPayload}.
104
+ */
105
+ export declare function reportMintedAppKey(outcome: AppKeyOutcome | undefined): void;
106
+ /**
107
+ * Where the project's CMS is served once deployed: the mount `rebase.json`
108
+ * declares, on the project's own host unless that app names its own.
109
+ */
110
+ export declare function adminPanelUrl(projectRoot: string | null, projectUrl: string): string | undefined;
111
+ /** How a deploy went, as `rebase cloud deploy --json` reported it. */
112
+ export interface DeployOutcome {
113
+ ok: boolean;
114
+ /** The deploy's own JSON result or error, when it printed one. */
115
+ result?: unknown;
116
+ }
117
+ /**
118
+ * The environment of {@link runBundleDeploy}'s child: this one, marked as
119
+ * init's own deploy, and without `REBASE_TOKEN`.
120
+ *
121
+ * `REBASE_TOKEN` outranks the stored grant (see `requireClient`), and a shell
122
+ * or an MCP server that has one holds it for the person's other projects — it
123
+ * has no scope on the project just provisioned, so the deploy was refused and
124
+ * the project never got its collections. The project is deployed with its own
125
+ * token.
126
+ */
127
+ export declare function bundleDeployEnv(env: NodeJS.ProcessEnv): NodeJS.ProcessEnv;
128
+ /**
129
+ * Push the local collections: `rebase cloud deploy --bundle`, as a child.
130
+ *
131
+ * A child rather than a call, so this command still prints exactly one
132
+ * result — a JSON caller gets the deploy's outcome folded into it — and still
133
+ * prints the claim link when the deploy fails. The child finds the project
134
+ * through the link just written, and its token through the credentials file.
135
+ * It asks for no app key: this command does, after it (see {@link INIT_CHILD_DEPLOY_ENV}).
136
+ */
137
+ export declare function runBundleDeploy(cwd: string, json: boolean): Promise<DeployOutcome>;
138
+ export interface InitDeps {
139
+ provision: typeof requestEphemeralProject;
140
+ deploy: typeof runBundleDeploy;
141
+ appKey: (url: string, token: string, projectId: string) => Promise<AppKeyOutcome>;
142
+ }
143
+ export declare function cloudInitCommand(rawArgs: string[], deps?: InitDeps): Promise<void>;
@@ -0,0 +1,51 @@
1
+ import { type CloudClient } from "./context.js";
2
+ type CloudAuth = CloudClient["auth"];
3
+ type SignedIn = Awaited<ReturnType<CloudAuth["signInWithEmail"]>>;
4
+ /** How many codes one login takes before it gives up. The server limits verification per address too. */
5
+ export declare const CODE_ATTEMPTS = 3;
6
+ /**
7
+ * The remedy for a step that needs a terminal when there is none: a token,
8
+ * which needs neither a password nor a code. Minted in the console because a
9
+ * person who cannot log in to the CLI cannot run `rebase cloud tokens create`.
10
+ */
11
+ export declare const TOKEN_REMEDY = "Create an access token in the console (Settings \u2192 Access tokens) and set REBASE_TOKEN to it.";
12
+ /** What the password refusal adds, for the accounts that never had a password. */
13
+ export declare const NO_PASSWORD_HINT: string;
14
+ /** A sign-in waiting for its second factor. */
15
+ export interface PendingSecondFactor {
16
+ mfaToken: string;
17
+ factors: Array<{
18
+ id: string;
19
+ factorType: string;
20
+ friendlyName?: string;
21
+ }>;
22
+ }
23
+ /**
24
+ * The pending sign-in an `MFA_REQUIRED` refusal describes, or `null` for any
25
+ * other error — including one with no token or no factor, which no code step
26
+ * could finish. The same reading the console's login view makes.
27
+ */
28
+ export declare function readMfaRequired(error: unknown): PendingSecondFactor | null;
29
+ /**
30
+ * Whether the control plane mails sign-in codes, as its `/auth/config` says.
31
+ * `false` when it cannot be asked: an older control plane has no such door,
32
+ * and offering one that 404s is worse than not offering it.
33
+ */
34
+ export declare function offersSignInCodes(auth: CloudAuth): Promise<boolean>;
35
+ /** Ask "password or code?" at a terminal. */
36
+ export declare function askSignInMethod(): Promise<"password" | "code">;
37
+ /** Refuse a code step with no terminal to type it at. Never returns when there is none. */
38
+ export declare function requireTerminalForCode(): void;
39
+ /**
40
+ * Mail a code to `email` and trade what the person types for a session.
41
+ *
42
+ * Throws what `verifyEmailOtp` throws for anything but a wrong code —
43
+ * `MFA_REQUIRED` included, which the caller's {@link withSecondFactor} answers.
44
+ */
45
+ export declare function signInWithCode(auth: CloudAuth, email: string): Promise<SignedIn>;
46
+ /**
47
+ * Run a sign-in, and when the account has 2FA on, ask for the second factor
48
+ * and finish it there.
49
+ */
50
+ export declare function withSecondFactor(auth: CloudAuth, signIn: () => Promise<SignedIn>): Promise<SignedIn>;
51
+ export {};
@@ -0,0 +1,28 @@
1
+ /** The events the control plane notifies about. */
2
+ export declare const NOTIFICATION_EVENTS: readonly ["deploy.failed", "deploy.succeeded", "deploy.rolled_back", "backup.unhealthy", "billing.payment_failed", "usage.threshold", "preview.paused"];
3
+ export declare const NOTIFICATIONS_ACTIONS: readonly ["list", "add", "test", "remove"];
4
+ export declare const NOTIFICATIONS_ADD_FLAGS: {
5
+ readonly "--events": StringConstructor;
6
+ readonly "--format": StringConstructor;
7
+ readonly "--name": StringConstructor;
8
+ };
9
+ /** A destination, as the control plane lists it. */
10
+ export interface CliNotificationWebhook {
11
+ id: string;
12
+ name: string;
13
+ url: string;
14
+ events: string[];
15
+ format: "json" | "slack";
16
+ enabled: boolean;
17
+ lastStatus: number | null;
18
+ lastError: string;
19
+ lastDeliveredAt: string | null;
20
+ failureCount: number;
21
+ createdAt: string | null;
22
+ }
23
+ /**
24
+ * `--events deploy.failed,backup.unhealthy` as a list, refused when it names an
25
+ * event that does not exist. Exported so its test drives the real parser.
26
+ */
27
+ export declare function parseNotificationEvents(raw: string | undefined): string[];
28
+ export declare function notificationsCommand(action: string | undefined, rawArgs: string[]): Promise<void>;
@@ -5,4 +5,17 @@ export declare const CREATE_ORG_FLAGS: {
5
5
  readonly "--slug": StringConstructor;
6
6
  readonly "-n": "--name";
7
7
  };
8
+ /** An open invitation, as the control plane lists it. Never the link. */
9
+ export interface CliInvite {
10
+ id: string;
11
+ email: string;
12
+ role: string;
13
+ invitedBy: {
14
+ userId: string | null;
15
+ email: string | null;
16
+ };
17
+ expiresAt: string;
18
+ expired: boolean;
19
+ createdAt: string | null;
20
+ }
8
21
  export declare function printOrgsHelp(): void;
@@ -0,0 +1,123 @@
1
+ import { type CloudClient } from "./context.js";
2
+ /** The control-plane function that creates, lists and deletes previews. */
3
+ export declare const PREVIEWS_FUNCTION = "previews";
4
+ /**
5
+ * The collection a preview's deployment row lives in.
6
+ *
7
+ * Not `deployments`. Every reader of that collection — `cloud status`, `cloud
8
+ * logs`, rollback, the console's history, and every CLI already installed —
9
+ * takes its newest row to be what production runs. A preview row there would be
10
+ * reported as production by all of them, including the versions nobody can
11
+ * update any more.
12
+ */
13
+ export declare const PREVIEW_DEPLOYMENTS_COLLECTION = "preview-deployments";
14
+ /** Longest preview name: what leaves the host inside one 63-character DNS label. */
15
+ export declare const MAX_PREVIEW_NAME_LENGTH = 24;
16
+ /**
17
+ * A preview name as typed, checked and lowercased — or a refusal.
18
+ *
19
+ * It becomes part of a hostname, `<project>--<name>`, so it is held to a DNS
20
+ * label's alphabet. A double hyphen is refused because the host is split on
21
+ * it: a name holding one could never be told apart from the project's own.
22
+ */
23
+ export declare function normalizePreviewName(raw: string): string;
24
+ /** Which backend a preview's pages talk to. */
25
+ export type PreviewBackend = "preview" | "production";
26
+ /** A preview as the control plane describes it. */
27
+ export interface Preview {
28
+ name: string;
29
+ /** `https://shop--new-quiz.rebase.website`. */
30
+ url: string;
31
+ /** The app it serves: a static app's name, or the backend. */
32
+ app: string | null;
33
+ /**
34
+ * `preview` when the preview runs a backend of its own, with its own
35
+ * database; `production` when it is only files, calling the production API.
36
+ */
37
+ backend: PreviewBackend | null;
38
+ status: string | null;
39
+ /** Why it is in its status, as the control plane wrote it — set for `paused` (its database outgrew the preview limit). */
40
+ statusMessage: string | null;
41
+ /** The deployment that built it, in {@link PREVIEW_DEPLOYMENTS_COLLECTION}. */
42
+ deploymentId: string | null;
43
+ createdAt: string | null;
44
+ updatedAt: string | null;
45
+ /** When the control plane deletes it on its own, unless it is deployed again. */
46
+ expiresAt: string | null;
47
+ }
48
+ /**
49
+ * One preview out of an answer, read defensively — or null when it names no
50
+ * address, which is the one field a preview cannot be reported without.
51
+ */
52
+ export declare function previewFrom(value: unknown): Preview | null;
53
+ /**
54
+ * Whether a refusal means "this control plane has no previews" — and not, say,
55
+ * "no such preview".
56
+ *
57
+ * A control plane answers a function it does not serve with a 404 coded
58
+ * `FUNCTION_NOT_FOUND`; one from before that envelope, with a bare `Not Found`
59
+ * or `No route for …`. Either is a missing route.
60
+ */
61
+ export declare function isPreviewsUnavailable(e: unknown): boolean;
62
+ /**
63
+ * The intake code a control plane refuses a static app's own preview with when
64
+ * nothing on it serves static sites by themselves (no front door). Rebase Cloud
65
+ * is one, today: every host is served by the project's own pod.
66
+ */
67
+ export declare const PREVIEW_STATIC_UNSERVED = "PREVIEW_STATIC_UNSERVED";
68
+ /** What the `previews` trigger answers. */
69
+ export interface PreviewTrigger {
70
+ deploymentId: string;
71
+ preview: Preview;
72
+ }
73
+ /**
74
+ * Ask the control plane to build a preview from an uploaded bundle.
75
+ *
76
+ * The body is a bundle deploy's, plus `preview`; see `bundleDeployBody`. An
77
+ * answer without a preview address is refused rather than followed: whatever
78
+ * it built, this command cannot say where, and "it is somewhere" is not a
79
+ * result.
80
+ */
81
+ export declare function triggerPreview(client: CloudClient, projectId: string, body: Record<string, unknown>, refusal: (e: unknown) => void): Promise<PreviewTrigger>;
82
+ /** The lines a finished preview deploy prints under its verdict. */
83
+ export declare function previewLines(preview: Preview): string[];
84
+ /** Where the docs state what a backend preview costs. */
85
+ export declare const PREVIEW_PRICING_DOCS = "https://rebase.pro/docs/deployment/cloud/#preview-a-change";
86
+ /** The billing rule in words: what is printed when the control plane cannot put a number on it. */
87
+ export declare const PREVIEW_PRICING_RULE: string;
88
+ /** What a backend preview costs, as the control plane quotes it. */
89
+ export interface PreviewCost {
90
+ /** €/month one backend preview adds to the project's quote; null when it could not be priced. */
91
+ perPreviewMonthlyEur: number | null;
92
+ /** Backend previews the project runs, this one included; null when unknown. */
93
+ backendPreviews: number | null;
94
+ /** €/month all of them add together; null when unknown. */
95
+ previewsMonthlyEur: number | null;
96
+ /** The rule the numbers come from, in words. */
97
+ rule: string;
98
+ docs: string;
99
+ }
100
+ /**
101
+ * What a backend preview costs, in the control plane's own numbers.
102
+ *
103
+ * No price is written down here: the control plane quotes the project's dials
104
+ * with and without backend previews (`pricing/quote` with `backendPreviews`,
105
+ * the call the console's quote makes) and the difference is what they add —
106
+ * which follows the rate card, the app's region and its capacity class as
107
+ * they change. One batched call, best-effort: a control plane that does not
108
+ * price previews (its answer does not echo the count it was sent) or cannot be
109
+ * asked leaves the numbers null, and the rule and the docs carry the answer.
110
+ *
111
+ * The quote is asked with no credential. The route is public — it prices a
112
+ * hypothetical and reads nobody's data — and an access token would be refused
113
+ * on it, holding no `functions:invoke:pricing`: no token capability names it,
114
+ * and none needs to.
115
+ */
116
+ export declare function previewCost(client: CloudClient, url: string, projectId: string): Promise<PreviewCost>;
117
+ /** The line a preview deploy prints about its cost. */
118
+ export declare function previewCostLines(cost: PreviewCost, previewName: string): string[];
119
+ /** The flags `previews list` parses — the help page lists exactly these. */
120
+ export declare const PREVIEWS_LIST_FLAGS: {};
121
+ /** The flags `previews delete` parses, beyond the global `--yes`. */
122
+ export declare const PREVIEWS_DELETE_FLAGS: {};
123
+ export declare function previewsCommand(action: string | undefined, rawArgs: string[]): Promise<void>;