@rebasepro/cli 0.17.3 → 0.18.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 (103) hide show
  1. package/LICENSE +0 -1
  2. package/README.md +21 -3
  3. package/bin/rebase.js +93 -6
  4. package/dist/branch-pointer-dBiClJ0p.js +111 -0
  5. package/dist/branch-pointer-dBiClJ0p.js.map +1 -0
  6. package/dist/bundle.d.ts +80 -3
  7. package/dist/cli.d.ts +22 -0
  8. package/dist/commands/auth.d.ts +13 -0
  9. package/dist/commands/cloud/action-help.d.ts +0 -10
  10. package/dist/commands/cloud/auth.d.ts +37 -0
  11. package/dist/commands/cloud/context.d.ts +90 -2
  12. package/dist/commands/cloud/databases.d.ts +0 -2
  13. package/dist/commands/cloud/declared-resources.d.ts +3 -0
  14. package/dist/commands/cloud/deploy.d.ts +76 -6
  15. package/dist/commands/cloud/deployments.d.ts +9 -2
  16. package/dist/commands/cloud/index.d.ts +36 -0
  17. package/dist/commands/cloud/link.d.ts +1 -1
  18. package/dist/commands/cloud/orgs.d.ts +6 -0
  19. package/dist/commands/cloud/resources.d.ts +81 -3
  20. package/dist/commands/cloud/settings.d.ts +7 -0
  21. package/dist/commands/db.d.ts +119 -9
  22. package/dist/commands/dev.d.ts +216 -1
  23. package/dist/commands/doctor.d.ts +51 -0
  24. package/dist/commands/init.d.ts +1 -0
  25. package/dist/commands/skills.d.ts +82 -13
  26. package/dist/commands/status.d.ts +1 -0
  27. package/dist/commands/telemetry.d.ts +0 -8
  28. package/dist/{daemon-Bdl4lrdt.js → daemon-YDZK9NZ1.js} +88 -9
  29. package/dist/daemon-YDZK9NZ1.js.map +1 -0
  30. package/dist/{daemon-entry-CmJn83zu.js → daemon-entry-LTFKtpHy.js} +117 -44
  31. package/dist/daemon-entry-LTFKtpHy.js.map +1 -0
  32. package/dist/dev-db/branch-pointer.d.ts +71 -0
  33. package/dist/dev-db/daemon.d.ts +27 -0
  34. package/dist/dev-db/prepare.d.ts +62 -0
  35. package/dist/dev-db/pull.d.ts +28 -0
  36. package/dist/dev-db/resolve.d.ts +45 -6
  37. package/dist/dev-db/state.d.ts +21 -0
  38. package/dist/dev-preflight-CNLl4rdo.js +367 -0
  39. package/dist/dev-preflight-CNLl4rdo.js.map +1 -0
  40. package/dist/doctor-environment.d.ts +131 -0
  41. package/dist/function-portability.d.ts +7 -0
  42. package/dist/index.d.ts +25 -15
  43. package/dist/index.es.js +5594 -1741
  44. package/dist/index.es.js.map +1 -1
  45. package/dist/project-3WCbrrfW.js +499 -0
  46. package/dist/project-3WCbrrfW.js.map +1 -0
  47. package/dist/{pull-DqPRu1te.js → pull-Bj0XnH5s.js} +31 -2
  48. package/dist/pull-Bj0XnH5s.js.map +1 -0
  49. package/dist/resolve-Y56osuQH.js +74 -0
  50. package/dist/resolve-Y56osuQH.js.map +1 -0
  51. package/dist/resources/derive.d.ts +67 -1
  52. package/dist/resources/status.d.ts +128 -0
  53. package/dist/rolldown-runtime-D7D4PA-g.js +13 -0
  54. package/dist/{state-c0CJ6Kwb.js → state-C59Elrnt.js} +24 -15
  55. package/dist/state-C59Elrnt.js.map +1 -0
  56. package/dist/utils/args.d.ts +18 -0
  57. package/dist/utils/command-words.d.ts +45 -0
  58. package/dist/utils/dev-preflight.d.ts +46 -0
  59. package/dist/utils/package-manager.d.ts +23 -0
  60. package/dist/utils/project.d.ts +66 -0
  61. package/dist/utils/spawn-error.d.ts +1 -0
  62. package/dist/utils/unknown-command.d.ts +26 -0
  63. package/dist/utils/version.d.ts +10 -0
  64. package/package.json +36 -28
  65. package/templates/eject/backend/src/env.ts +9 -0
  66. package/templates/eject/backend/src/index.ts +46 -19
  67. package/templates/eject/config/resources.ts +1 -1
  68. package/templates/overlays/baas/README.md +31 -11
  69. package/templates/overlays/baas/backend/package.json +2 -2
  70. package/templates/overlays/baas/backend/tsconfig.json +1 -1
  71. package/templates/overlays/baas/package.json +5 -2
  72. package/templates/overlays/baas/pnpm-workspace.yaml +13 -0
  73. package/templates/template/.cursorrules +1 -0
  74. package/templates/template/.env.example +91 -8
  75. package/templates/template/.github/copilot-instructions.md +1 -0
  76. package/templates/template/.mcp.json +11 -0
  77. package/templates/template/.windsurfrules +1 -0
  78. package/templates/template/AGENTS.md +1 -0
  79. package/templates/template/CLAUDE.md +2 -1
  80. package/templates/template/README.md +59 -28
  81. package/templates/template/ai-instructions.md +29 -12
  82. package/templates/template/backend/functions/hello.ts +5 -1
  83. package/templates/template/backend/package.json +2 -2
  84. package/templates/template/backend/src/schema.generated.ts +8 -3
  85. package/templates/template/backend/tsconfig.json +1 -1
  86. package/templates/template/config/cms.d.ts +6 -0
  87. package/templates/template/config/package.json +1 -1
  88. package/templates/template/config/resources.ts +42 -3
  89. package/templates/template/config/storage.ts +2 -1
  90. package/templates/template/docker-compose.yml +50 -9
  91. package/templates/template/frontend/index.html +0 -1
  92. package/templates/template/frontend/package.json +1 -2
  93. package/templates/template/frontend/src/App.tsx +8 -2
  94. package/templates/template/frontend/vite.config.ts +8 -0
  95. package/templates/template/gitignore +19 -1
  96. package/templates/template/npmrc +13 -4
  97. package/templates/template/package.json +10 -1
  98. package/templates/template/pnpm-workspace.yaml +17 -0
  99. package/templates/template/scripts/example.ts +4 -1
  100. package/dist/daemon-Bdl4lrdt.js.map +0 -1
  101. package/dist/daemon-entry-CmJn83zu.js.map +0 -1
  102. package/dist/pull-DqPRu1te.js.map +0 -1
  103. package/dist/state-c0CJ6Kwb.js.map +0 -1
@@ -71,8 +71,6 @@ export declare function waitForDatabase(client: CloudClient, opts: {
71
71
  */
72
72
  export declare function resolveBackupArgs(rawArgs: string[]): {
73
73
  flags: arg.Result<{
74
- "--yes": BooleanConstructor;
75
- } & {
76
74
  readonly "--json": BooleanConstructor;
77
75
  readonly "--yes": BooleanConstructor;
78
76
  readonly "--help": BooleanConstructor;
@@ -0,0 +1,3 @@
1
+ /** The action words `rebase cloud resources` dispatches. No word lists. */
2
+ export declare const DECLARED_RESOURCES_ACTIONS: readonly ["list", "prune"];
3
+ export declare function declaredResourcesCommand(action: string | undefined, rawArgs: string[]): Promise<void>;
@@ -12,6 +12,7 @@
12
12
  * dangerous one — see `planBareDeploy`.
13
13
  */
14
14
  import arg from "arg";
15
+ import { type CloudClient } from "./context.js";
15
16
  /** A project row, reduced to what says how it deploys (camel or snake columns). */
16
17
  export interface DeployProjectRow {
17
18
  runtimeMode?: string;
@@ -81,8 +82,8 @@ export interface EjectContext {
81
82
  managed: boolean;
82
83
  /** `--source` was passed: build this directory. */
83
84
  source: boolean;
84
- /** `--force` was passed: eject on purpose. */
85
- force: boolean;
85
+ /** `--eject` was passed: leave the managed runtime on purpose. */
86
+ eject: boolean;
86
87
  }
87
88
  /**
88
89
  * Why a container-image deploy of a managed project is refused — or `undefined`
@@ -91,7 +92,15 @@ export interface EjectContext {
91
92
  * Every path below this point builds a container image, and a successful one
92
93
  * sets `runtimeMode: "custom"` server-side. So the question is never "which flag
93
94
  * was used" but "did the caller ask to leave the managed runtime", and only
94
- * `--force` answers it.
95
+ * `--eject` answers it.
96
+ *
97
+ * The flag was `--force` until the 2026-09-06 sweep. `--force` means four
98
+ * different things across this CLI — overwrite a file, disconnect other
99
+ * Postgres sessions, set a build-time key anyway — and three of them are
100
+ * recoverable in a minute. This one moves a live project off the managed
101
+ * runtime, which is the least recoverable thing the CLI can be asked to do,
102
+ * and it had the same name as "overwrite this file". Renamed rather than
103
+ * aliased: an alias would leave the dangerous spelling working.
95
104
  *
96
105
  * `--source` used to be read as answering it too, on the theory that uploading a
97
106
  * build context is self-evidently a deliberate eject. It is not: `--source`
@@ -117,13 +126,49 @@ export declare function ejectRefusal(opts: EjectContext, projectRef: string): {
117
126
  *
118
127
  * The condition is just `managed`: anything reaching this point is a container
119
128
  * image build that `ejectRefusal` has already let through, and on a managed
120
- * project that is an eject however it was spelled. A caller who passed `--force`
129
+ * project that is an eject however it was spelled. A caller who passed `--eject`
121
130
  * knows — the warning is for the transcript and the payload, which is what
122
131
  * anyone reviewing the deploy afterwards actually reads.
123
132
  */
124
133
  export declare function deployWarnings(opts: EjectContext, projectRef: string): DeployWarning[];
125
134
  /** The warning half of a deploy's JSON payload — merged into whatever it emits. */
126
135
  export declare function warningPayload(warnings: DeployWarning[]): Record<string, unknown>;
136
+ /**
137
+ * What the billing pre-check managed to learn about the organization paying for
138
+ * this project. `null` means "could not tell", and is never a refusal.
139
+ */
140
+ export interface BillingState {
141
+ /** The billing account's plan, or null when the row could not be read. */
142
+ plan: string | null;
143
+ /** Whether the control plane reports a card on file, or null when it could not be asked. */
144
+ hasPaymentMethod: boolean | null;
145
+ /** The control plane has no Stripe configured — a local or staging control plane. */
146
+ simulated: boolean;
147
+ }
148
+ /**
149
+ * Whether a deploy should be refused here, before anything is built or uploaded.
150
+ *
151
+ * The server's gate (`ensureProjectComputeBilling`) is the authority and stays
152
+ * the authority; this only moves the same refusal earlier in the sequence. A
153
+ * managed deploy type-checks, builds a bundle, packs it and uploads it before it
154
+ * triggers anything, so a 402 arrived after several minutes of work whose only
155
+ * outcome was a discarded tarball.
156
+ *
157
+ * One direction only. A positive "no card" refuses; every other answer proceeds,
158
+ * including every answer we could not obtain. That asymmetry is the whole design:
159
+ * a pre-check that guesses wrong in the refusing direction blocks a deploy the
160
+ * platform would have accepted, and there are two states this client cannot see —
161
+ * an internal billing account (skipped server-side) and `REBASE_BYO_FREE` — so
162
+ * "unknown" has to mean "carry on and let the server decide".
163
+ */
164
+ export declare function billingBlocksDeploy(state: BillingState): boolean;
165
+ /**
166
+ * Ask the control plane whether the organization behind this project has a card.
167
+ *
168
+ * Best-effort throughout, for the reason above: every failure resolves to a
169
+ * state that {@link billingBlocksDeploy} lets through.
170
+ */
171
+ export declare function readBillingState(client: CloudClient, projectId: string): Promise<BillingState>;
127
172
  /**
128
173
  * Every flag `rebase cloud deploy` accepts.
129
174
  *
@@ -141,7 +186,7 @@ export declare const DEPLOY_FLAGS: {
141
186
  readonly "--bundle": BooleanConstructor;
142
187
  readonly "--bundle-dir": StringConstructor;
143
188
  readonly "--skip-type-check": BooleanConstructor;
144
- readonly "--force": BooleanConstructor;
189
+ readonly "--eject": BooleanConstructor;
145
190
  readonly "-m": "--message";
146
191
  };
147
192
  /**
@@ -176,7 +221,7 @@ export declare function resolveDeployArgs(rawArgs: string[]): {
176
221
  readonly "--bundle": BooleanConstructor;
177
222
  readonly "--bundle-dir": StringConstructor;
178
223
  readonly "--skip-type-check": BooleanConstructor;
179
- readonly "--force": BooleanConstructor;
224
+ readonly "--eject": BooleanConstructor;
180
225
  readonly "-m": "--message";
181
226
  } & {
182
227
  readonly "--json": BooleanConstructor;
@@ -193,4 +238,29 @@ export declare function resolveDeployArgs(rawArgs: string[]): {
193
238
  export declare function deployCommand(rawArgs: string[], projectRef: string): Promise<void>;
194
239
  /** `--timeout <seconds>` for a deploy, or the 15-minute default. */
195
240
  export declare function resolveDeployTimeout(value: string | undefined): number;
241
+ /**
242
+ * Poll a deployment record and print new log output as it arrives. Returns the
243
+ * terminal status; a non-success still exits non-zero, as it always has.
244
+ *
245
+ * `quiet` follows without printing — JSON mode, where the log stream would
246
+ * corrupt the one object the caller is parsing.
247
+ */
248
+ /**
249
+ * The host a project answers on — the same one `cloud status` prints, resolved
250
+ * the same way, so the two commands cannot disagree about where the app is.
251
+ *
252
+ * `undefined` on any failure: the control plane may not report a base domain,
253
+ * and a deploy that just succeeded must not be reported as anything else
254
+ * because a cosmetic lookup did not.
255
+ */
256
+ export declare function deployedUrl(client: CloudClient, opts: {
257
+ projectId?: string;
258
+ url?: string;
259
+ }): Promise<string | undefined>;
260
+ /** What `rebase cloud logs` parses. Its page pairs against this. */
261
+ export declare const LOGS_FLAGS: {
262
+ readonly "--runtime": BooleanConstructor;
263
+ readonly "--follow": BooleanConstructor;
264
+ readonly "-f": "--follow";
265
+ };
196
266
  export declare function logsCommand(rawArgs: string[], projectRef: string): Promise<void>;
@@ -8,6 +8,8 @@ export interface DeploymentRow {
8
8
  finished_at?: string | Date;
9
9
  imageUrl?: string;
10
10
  image_url?: string;
11
+ bundleId?: string;
12
+ bundle_id?: string;
11
13
  rollbackOf?: string;
12
14
  rollback_of?: string;
13
15
  triggeredBy?: string;
@@ -24,8 +26,13 @@ export interface DeploymentRow {
24
26
  framework_version?: string;
25
27
  }
26
28
  /**
27
- * The backend's rule EXACTLY: a rollback is honoured only for a successful
28
- * deploy that recorded an image. Any other row 409s `deploy_not_rollbackable`.
29
+ * The backend's rule EXACTLY (`rollbackTargetOf`): a rollback is honoured only
30
+ * for a successful deploy that recorded an image or a bundle. Any other row
31
+ * 409s `deploy_not_rollbackable`.
32
+ *
33
+ * The bundle half was missing, and it took the whole managed tier with it: a
34
+ * managed deploy records no image, so `rebase cloud rollback` refused every
35
+ * managed project before it even asked the server.
29
36
  */
30
37
  export declare function isRollbackable(dep: DeploymentRow): boolean;
31
38
  /** finishedAt − createdAt in ms, or null (still running / missing / skewed). */
@@ -1,3 +1,4 @@
1
+ import { type HelpAction } from "./context.js";
1
2
  /**
2
3
  * Positional tokens after `rebase cloud` (group, action, …).
3
4
  *
@@ -21,4 +22,39 @@
21
22
  * as the real dispatcher was broken.
22
23
  */
23
24
  export declare function positionals(rawArgs: string[]): string[];
25
+ /**
26
+ * The help page for each group, keyed by every alias the dispatch below accepts.
27
+ *
28
+ * Aliases are listed explicitly rather than normalised first, so a group that
29
+ * gains one and forgets it here degrades to the index page — wrong, but a page.
30
+ * `cloud-help.test.ts` asserts the two stay in step.
31
+ *
32
+ * A group absent from this map has no page of its own; the index lists it.
33
+ */
34
+ /**
35
+ * The second spelling of a group, mapped to the one the pages are keyed on.
36
+ *
37
+ * The dispatch below accepts both (`case "db": case "database":`), so help has
38
+ * to as well, or half the spellings of a command have no page.
39
+ */
40
+ export declare const GROUP_ALIASES: Record<string, string>;
41
+ export declare const GROUP_HELP: Record<string, () => void>;
24
42
  export declare function cloudCommand(subcommand: string | undefined, rawArgs: string[]): Promise<void>;
43
+ /**
44
+ * Every group `cloudCommand` dispatches, canonical name first, with the line the
45
+ * index page prints for it.
46
+ *
47
+ * One list, rendered twice. It used to be two: a bare array of words for the
48
+ * JSON form and a hand-formatted template literal for the terminal — which is
49
+ * how `clusters` came to be listed on the page twice, under two different
50
+ * descriptions, in the same section. The page is generated from this now, so a
51
+ * group appears exactly as often as it appears here, and `cloud-help.test.ts`
52
+ * holds the list to the dispatch switch and to the pages.
53
+ *
54
+ * Sub-actions are deliberately not here. Every group answers `--help` with its
55
+ * own page now, listing its actions, their arguments and their flags; repeating
56
+ * a subset of that on the index is the duplication this replaced.
57
+ */
58
+ export declare const CLOUD_GROUPS: HelpAction[];
59
+ /** The dispatch words alone — what `--help` routing and the tests iterate. */
60
+ export declare const CLOUD_GROUP_NAMES: string[];
@@ -1,5 +1,5 @@
1
1
  export declare function linkCommand(rawArgs: string[]): Promise<void>;
2
- export declare function unlinkCommand(): void;
2
+ export declare function unlinkCommand(rawArgs: string[]): void;
3
3
  export declare function selectOrgCommand(rawArgs: string[]): Promise<void>;
4
4
  /** Open the Rebase Cloud dashboard (or the linked project) in a browser. */
5
5
  export declare function openCommand(rawArgs: string[]): void;
@@ -1,2 +1,8 @@
1
1
  export declare function orgsCommand(subcommand: string | undefined, rawArgs: string[]): Promise<void>;
2
+ /** What `rebase cloud orgs create` parses. Its page is the group's own. */
3
+ export declare const CREATE_ORG_FLAGS: {
4
+ readonly "--name": StringConstructor;
5
+ readonly "--slug": StringConstructor;
6
+ readonly "-n": "--name";
7
+ };
2
8
  export declare function printOrgsHelp(): void;
@@ -68,6 +68,7 @@ export declare function resolveBlockedState(input: {
68
68
  } | undefined;
69
69
  lastDeploy?: {
70
70
  status?: string | null;
71
+ logs?: string | null;
71
72
  } | undefined;
72
73
  }): BlockedState;
73
74
  /**
@@ -105,9 +106,15 @@ export declare function metricsCommand(rawArgs: string[]): Promise<void>;
105
106
  * Exported so its tests drive the real parser.
106
107
  */
107
108
  export declare function resolveWebhookIdArg(rawArgs: string[]): string | undefined;
109
+ /** The action words `rebase cloud webhooks` dispatches. No word means `list`. */
110
+ export declare const WEBHOOKS_ACTIONS: readonly ["list", "create", "delete"];
108
111
  export declare function webhooksCommand(subcommand: string | undefined, rawArgs: string[]): Promise<void>;
112
+ /** The action words `rebase cloud storage` dispatches. No word means `list`. */
113
+ export declare const STORAGE_ACTIONS: readonly ["list", "create", "attach"];
109
114
  export declare function storageCommand(action: string | undefined, rawArgs: string[]): Promise<void>;
110
115
  export declare function printStorageHelp(): void;
116
+ /** The action words `rebase cloud clusters` dispatches. No word means `list`. */
117
+ export declare const CLUSTERS_ACTIONS: readonly ["list", "add", "verify"];
111
118
  /**
112
119
  * `rebase cloud clusters` — list, register and verify the clusters tenants run on.
113
120
  *
@@ -148,9 +155,80 @@ export declare function resolveClusterVerifyArgs(rawArgs: string[]): {
148
155
  id?: string;
149
156
  baseline: boolean;
150
157
  };
158
+ /**
159
+ * Register a cluster from a kubeconfig file.
160
+ *
161
+ * Verifies immediately rather than reporting a successful insert: a row that
162
+ * names an unreachable cluster is worse than no row, because a project pointed
163
+ * at it fails at deploy instead of at registration.
164
+ */
165
+ /** The columns a `clusters` row is registered with. Exported for its test. */
166
+ export interface ClusterAddArgs {
167
+ name: string;
168
+ provider: "gcp" | "aws" | "hetzner";
169
+ region: string;
170
+ kubeconfigPath: string;
171
+ baseDomain?: string;
172
+ ingressAddress?: string;
173
+ /** This is capacity we operate: projects placed in its region deploy here. */
174
+ platformCapacity: boolean;
175
+ backupBucket?: string;
176
+ backupEndpoint?: string;
177
+ backupAccessKeyId?: string;
178
+ backupSecretAccessKey?: string;
179
+ }
180
+ /**
181
+ * What `clusters add` was asked to register.
182
+ *
183
+ * Everything a row needs to serve tenants is settable HERE, at insert, because
184
+ * the control plane installs the cluster baseline on insert and reads the row
185
+ * to do it: the name is what the Hetzner load balancer is adopted by, the
186
+ * address is what the ingress is pinned to. Registering with the four
187
+ * required flags and patching the rest afterwards would install a baseline
188
+ * that knew neither.
189
+ *
190
+ * The backup fields travel together: a bucket with no key, or a key with no
191
+ * bucket, is a row `resolveBackupStore` deliberately treats as "no store" —
192
+ * so it is refused here, where the operator can still fix the command.
193
+ */
194
+ export declare function resolveClusterAddArgs(rawArgs: string[]): ClusterAddArgs;
195
+ /**
196
+ * The action words `rebase cloud billing` dispatches. No word at all is the
197
+ * account view, which is why it is not in the list.
198
+ *
199
+ * Exported because `action-help.test.ts` holds the page's usage line to it: the
200
+ * page said `cloud billing [portal|usage]` and the dispatch answered `setup` and
201
+ * `checkout`, so both documented words fell through to the default and printed
202
+ * the account — a help page describing a command that does not exist, and a typo
203
+ * exiting 0.
204
+ */
205
+ export declare const BILLING_ACTIONS: readonly ["setup", "checkout"];
151
206
  export declare function billingCommand(rawArgs: string[]): Promise<void>;
152
207
  /**
153
- * `rebase cloud resources` show what a project is given, and change it.
208
+ * The action words `rebase cloud compute` dispatches. No word, or `show`,
209
+ * prints the dials and the quote.
210
+ */
211
+ export declare const COMPUTE_ACTIONS: readonly ["show", "set"];
212
+ /**
213
+ * The flags `resources set` accepts, in the shape a spec is written in.
214
+ *
215
+ * Derived from `DIAL_FLAGS` rather than written out beside it: `action-help.ts`
216
+ * documents this command and `action-help.test.ts` pairs the page against this
217
+ * constant, so a dial added above is a dial the help page has to describe on the
218
+ * same commit. A hand-copied second list is how the page and the parser drift.
219
+ *
220
+ * `buildDialPatch` still scans `rawArgs` itself — it has to, because
221
+ * `--no-autoscale` is value-less and a dial's value may not be consumed as one
222
+ * — so this is a description of that line, not a second parser for it.
223
+ */
224
+ export declare const COMPUTE_SET_FLAGS: Record<string, unknown>;
225
+ /**
226
+ * `rebase cloud compute` — show what a project reserves, and change it.
227
+ *
228
+ * Named for what it shows — CPU, memory, replicas, the database's shape, and
229
+ * what those cost — because `rebase resources` already means the graph a
230
+ * project declares, and two commands called "resources" that show different
231
+ * things is a support ticket.
154
232
  *
155
233
  * ## Why nothing is validated here
156
234
  *
@@ -164,7 +242,7 @@ export declare function billingCommand(rawArgs: string[]): Promise<void>;
164
242
  * boundary refuses a raw PATCH and a console save, which is the property worth
165
243
  * having — a check in a client only covers the clients that run it.
166
244
  */
167
- export declare function resourcesCommand(action: string | undefined, rawArgs: string[]): Promise<void>;
245
+ export declare function computeCommand(action: string | undefined, rawArgs: string[]): Promise<void>;
168
246
  /**
169
247
  * Turn `--cpu 500m --db-instances 2` into the patch to send.
170
248
  *
@@ -176,7 +254,7 @@ export declare function buildDialPatch(rawArgs: string[],
176
254
  /**
177
255
  * `requireOne: false` for `projects create`, where naming no dial is the
178
256
  * ordinary case — a new project takes the platform default. On
179
- * `resources set` a patch with nothing in it is a typo, and saying so beats
257
+ * `compute set` a patch with nothing in it is a typo, and saying so beats
180
258
  * a success message for a change nobody made.
181
259
  */
182
260
  opts?: {
@@ -6,4 +6,11 @@ export declare function buildSettingsPatch(args: {
6
6
  repo?: string;
7
7
  branch?: string;
8
8
  }): Record<string, string>;
9
+ /** What `rebase cloud settings set` parses. Its page is the group's own. */
10
+ export declare const SET_SETTINGS_FLAGS: {
11
+ readonly "--name": StringConstructor;
12
+ readonly "--subdomain": StringConstructor;
13
+ readonly "--repo": StringConstructor;
14
+ readonly "--branch": StringConstructor;
15
+ };
9
16
  export declare function printSettingsHelp(): void;
@@ -1,3 +1,22 @@
1
+ import { type PreparedDatabase } from "../dev-db/prepare.js";
2
+ import { type DevDatabase } from "../dev-db/resolve.js";
3
+ /**
4
+ * The connection string a prepared database actually answers on.
5
+ *
6
+ * One function, because `db url` and `db pull` disagreed about it and the
7
+ * disagreement was a dead command: `prepareDatabaseEnv` returns `env: {}` for a
8
+ * plain external database — the connection string is already somewhere the
9
+ * child looks — so `db pull`'s `prepared.env.DATABASE_URL ?? process.env
10
+ * .DATABASE_URL` was empty for the standard `.env` configuration and answered
11
+ * `✗ No local database to pull into.` on a project whose `rebase db url` had
12
+ * just printed one. Exporting the same URL in the shell made it work, which is
13
+ * the shape of a bug nobody reports as one.
14
+ *
15
+ * `readEnvFile` is passed in rather than imported: this module loads
16
+ * `../utils/project` dynamically everywhere else, and the callers already have
17
+ * it open.
18
+ */
19
+ export declare function databaseUrlOf(prepared: Pick<PreparedDatabase, "env" | "database">, envFile: Record<string, string>): string | undefined;
1
20
  /**
2
21
  * Rewrite local path arguments so they mean what the user typed.
3
22
  *
@@ -14,19 +33,110 @@
14
33
  */
15
34
  export declare function absolutizeLocalPathArgs(args: string[], cwd: string): string[];
16
35
  /**
17
- * Run a database subcommand through the active driver's CLI, throwing on
18
- * failure instead of exiting.
36
+ * A managed-database refusal, raised so the caller decides what it costs.
37
+ *
38
+ * These two guards used to `process.exit(1)` where they stood. That is right
39
+ * for `rebase db push`, typed by a person, and catastrophic for the same code
40
+ * reached from inside `rebase dev`: the dev server's first-boot schema push
41
+ * runs in-process, so an exit there took the whole dev server down — with a
42
+ * `try/catch` around it written expressly to prevent that, which could never
43
+ * run. The first `rebase dev --docker` of every scaffold died this way.
44
+ *
45
+ * So the refusal is a value now. It carries the block it wants printed rather
46
+ * than printing it, because who prints (and whether printing is even right) is
47
+ * the caller's question: `dbCommand` prints it and exits 1, and `rebase dev`
48
+ * keeps serving.
49
+ */
50
+ export declare class ManagedDatabaseRefusal extends Error {
51
+ /** The lines to print, in order, already coloured. */
52
+ readonly lines: readonly string[];
53
+ constructor(summary: string, lines: readonly string[]);
54
+ }
55
+ /** Print a refusal exactly as the guards used to print it themselves. */
56
+ export declare function printManagedDatabaseRefusal(refusal: ManagedDatabaseRefusal): void;
57
+ /**
58
+ * Stop an Atlas-backed subcommand before it fails inside Atlas on the managed
59
+ * development database.
60
+ *
61
+ * **PGlite serves exactly one database.** `CREATE DATABASE "postgres_dev_diff"`
62
+ * against it reports success and creates nothing, so Atlas connects its dev-url
63
+ * straight back to the database it is meant to be comparing against, finds the
64
+ * project's own tables there, and stops with
65
+ * `connected database is not clean: found schema "public"`. Verified on a
66
+ * completely fresh scaffold, so this is not a leftover-state problem that a
67
+ * reset would fix — the model does not fit the engine.
68
+ *
69
+ * Before this guard the failure was worse than unhelpful. The first thing the
70
+ * reader hit was `pq: SSL is not enabled on the server`, whose remedy box said
71
+ * to append `sslmode=disable` to `DATABASE_URL` — a variable `rebase init`
72
+ * deliberately leaves unset, which is the very reason the managed database was
73
+ * in use. Two errors deep, about a variable that does not exist, for a command
74
+ * the quickstart told them to run.
75
+ *
76
+ * There is nothing to fix by trying harder here: Atlas's other dev-url option
77
+ * is `docker://`, and needing Docker is precisely what the managed database
78
+ * exists to avoid. So this says what the managed database can and cannot do,
79
+ * and names the two things that work.
80
+ */
81
+ export declare function refuseAtlasOnManagedDatabase(rawArgs: string[], kind: string): void;
82
+ /**
83
+ * Stop `rebase db branch` before it reports a branch that is not one.
19
84
  *
20
- * `dbCommand` below turns every failure into `process.exit(1)`, which is right
21
- * for a command the user invoked directly and wrong for a caller that has more
22
- * to do afterwards — `rebase dev` runs a schema push during start-up and must
23
- * survive it failing. Exiting is therefore the wrapper's job, not this
24
- * function's.
85
+ * **PGlite serves exactly one database**, and this is the second thing that
86
+ * follows from it. `CREATE DATABASE "rb_feature_x" TEMPLATE "postgres"` there
87
+ * writes a `pg_database` catalog row and nothing else. Nothing errors, so the
88
+ * whole feature reports success end to end:
25
89
  *
26
- * The database is resolved *here* rather than in the wrapper, so the schema
27
- * push `rebase dev` performs during start-up reaches the managed database too.
90
+ * $ rebase db branch create feature_x
91
+ * Branch "feature_x" created successfully.
92
+ * $ rebase db branch list
93
+ * ● feature_x (7.1 MB) — created just now
94
+ *
95
+ * `listBranches` joins `pg_database`, the catalog row is there, and
96
+ * `pg_database_size` answers with the one database's size — so the listing
97
+ * corroborates the lie. Then connecting to `rb_feature_x` reports
98
+ * `current_database()` = `postgres`, and a table created "in the branch" is
99
+ * visible in the parent immediately. Measured on a fresh `rebase init` scaffold.
100
+ *
101
+ * **The branch is the parent.** Every write made in the belief that it is
102
+ * sandboxed lands in the developer's real development database — which is the
103
+ * exact failure branching exists to prevent, announced as a success.
104
+ *
105
+ * So this refuses the whole `branch` domain rather than `create` alone: `list`
106
+ * on the managed database ends with "Create one with: rebase db branch create",
107
+ * an invitation to do the broken thing, and `info` would confirm a size for a
108
+ * database that was never made.
109
+ *
110
+ * `refuseAtlasOnManagedDatabase` above is the same shape for a different
111
+ * reason, and its comment named `branch` as one of the subcommands it does not
112
+ * cover. It does now.
113
+ */
114
+ export declare function refuseBranchOnManagedDatabase(rawArgs: string[], kind: string): void;
115
+ /**
116
+ * Run a `schema` subcommand through the active driver's CLI.
117
+ *
118
+ * Separate from {@link runDriverDbCommand} because it must NOT resolve a
119
+ * database. `rebase dev` calls this before the database exists, which is the
120
+ * whole point: the generated schema has to be right before anything reads it.
121
+ * Throws rather than exiting — the caller has more to do.
28
122
  */
123
+ export declare function runDriverSchemaCommand(rawArgs: string[], options?: {
124
+ quiet?: boolean;
125
+ }): Promise<void>;
29
126
  export declare function runDriverDbCommand(rawArgs: string[], options?: {
30
127
  quiet?: boolean;
31
128
  }): Promise<void>;
32
129
  export declare function dbCommand(subcommand: string | undefined, rawArgs: string[]): Promise<void>;
130
+ /**
131
+ * The examples, which are not the same on the managed development database.
132
+ *
133
+ * Every one of the four the help used to lead with — `db push`, `db generate`,
134
+ * `db migrate`, `db branch` — is refused there, by guards in this same file
135
+ * that explain exactly why. So on the project the CLI had just scaffolded, the
136
+ * first thing `rebase db --help` offered was a command that answers with a
137
+ * refusal, and the reader's most likely conclusion is that their install is
138
+ * broken.
139
+ *
140
+ * Exported for its test.
141
+ */
142
+ export declare function dbExamples(kind: DevDatabase["kind"] | null): string;