@rebasepro/cli 0.13.1-canary.gef9608c → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundle.d.ts +4 -3
- package/dist/commands/api-keys.d.ts +51 -0
- package/dist/commands/auth.d.ts +31 -0
- package/dist/commands/cloud/context.d.ts +143 -10
- package/dist/commands/cloud/databases.d.ts +39 -0
- package/dist/commands/cloud/debug.d.ts +1 -0
- package/dist/commands/cloud/deployments.d.ts +22 -0
- package/dist/commands/cloud/domains.d.ts +10 -0
- package/dist/commands/cloud/env.d.ts +51 -0
- package/dist/commands/cloud/extensions.d.ts +21 -0
- package/dist/commands/cloud/orgs.d.ts +1 -0
- package/dist/commands/cloud/projects.d.ts +29 -0
- package/dist/commands/cloud/resources.d.ts +14 -0
- package/dist/commands/cloud/settings.d.ts +1 -0
- package/dist/commands/dev.d.ts +17 -6
- package/dist/commands/eject.d.ts +42 -0
- package/dist/commands/init.d.ts +45 -0
- package/dist/commands/skills.d.ts +81 -0
- package/dist/fold-static.d.ts +47 -0
- package/dist/index.es.js +2003 -706
- package/dist/index.es.js.map +1 -1
- package/dist/manifest.d.ts +16 -1
- package/dist/utils/args.d.ts +76 -0
- package/package.json +7 -7
- package/templates/eject/Dockerfile +29 -4
- package/templates/eject/backend/src/index.ts +60 -8
- package/templates/eject/docker-compose.custom.yml +13 -5
- package/templates/overlays/baas/backend/tsconfig.json +6 -1
- package/templates/overlays/baas/config/index.ts +9 -0
- package/templates/overlays/baas/config/package.json +1 -0
- package/templates/template/.env.example +13 -4
- package/templates/template/backend/functions/hello.ts +8 -4
- package/templates/template/backend/tsconfig.json +6 -1
- package/templates/template/docker-compose.yml +4 -4
- package/templates/template/frontend/vite.config.ts +33 -2
package/dist/bundle.d.ts
CHANGED
|
@@ -136,10 +136,11 @@ export declare function normalizeEsmSpecifiers(outDir: string): {
|
|
|
136
136
|
* deployed green, and answered 404 on every one of them, with the file still
|
|
137
137
|
* sitting in the repository looking exactly like the server.
|
|
138
138
|
*
|
|
139
|
-
* A project that means to
|
|
140
|
-
* writes
|
|
139
|
+
* A project that means to own its server process runs `rebase eject`, which
|
|
140
|
+
* writes an entrypoint, a Dockerfile and a compose file together and flips the
|
|
141
141
|
* backend to `runtime: "custom"`. The warning names that route rather than
|
|
142
|
-
* implying the file is a mistake
|
|
142
|
+
* implying the file is a mistake — but eject writes *its* entrypoint, so the
|
|
143
|
+
* warning must not read as "eject will keep what you wrote here".
|
|
143
144
|
*/
|
|
144
145
|
export declare function findUnusedServerEntry(projectRoot: string, functionsDir: string): string | undefined;
|
|
145
146
|
/**
|
|
@@ -1 +1,52 @@
|
|
|
1
1
|
export declare function apiKeysCommand(subcommand: string | undefined, rawArgs: string[]): Promise<void>;
|
|
2
|
+
/** The flags `rebase api-keys create` takes. */
|
|
3
|
+
export declare const CREATE_KEY_FLAGS: {
|
|
4
|
+
readonly "--name": StringConstructor;
|
|
5
|
+
readonly "--permissions": StringConstructor;
|
|
6
|
+
readonly "--full-access": BooleanConstructor;
|
|
7
|
+
readonly "--admin": BooleanConstructor;
|
|
8
|
+
readonly "--rate-limit": NumberConstructor;
|
|
9
|
+
readonly "--expires": StringConstructor;
|
|
10
|
+
readonly "-n": "--name";
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* What this invocation asks to be created.
|
|
14
|
+
*
|
|
15
|
+
* The name may be given either way — `--name "My Key"` or as the single
|
|
16
|
+
* positional — and under the old permissive parse an undeclared flag became
|
|
17
|
+
* that positional: `rebase api-keys create --debug --full-access` created a
|
|
18
|
+
* key called `--debug` with read/write/delete on every collection, and
|
|
19
|
+
* `--debug` is what the CLI prints after every failure as the thing to re-run
|
|
20
|
+
* with. Strict parsing makes the flag an error instead of a name.
|
|
21
|
+
*
|
|
22
|
+
* Exported so its tests can drive the real parser rather than a copy of it.
|
|
23
|
+
*/
|
|
24
|
+
export declare function resolveCreateKeyArgs(rawArgs: string[]): {
|
|
25
|
+
flags: import("arg").Result<{
|
|
26
|
+
readonly "--name": StringConstructor;
|
|
27
|
+
readonly "--permissions": StringConstructor;
|
|
28
|
+
readonly "--full-access": BooleanConstructor;
|
|
29
|
+
readonly "--admin": BooleanConstructor;
|
|
30
|
+
readonly "--rate-limit": NumberConstructor;
|
|
31
|
+
readonly "--expires": StringConstructor;
|
|
32
|
+
readonly "-n": "--name";
|
|
33
|
+
}>;
|
|
34
|
+
name: string;
|
|
35
|
+
};
|
|
36
|
+
/** The flags `rebase api-keys revoke` takes. */
|
|
37
|
+
export declare const REVOKE_KEY_FLAGS: {
|
|
38
|
+
readonly "--id": StringConstructor;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Which key this invocation names.
|
|
42
|
+
*
|
|
43
|
+
* The id is a positional, so the permissive parse handed one straight to the
|
|
44
|
+
* DELETE: `rebase api-keys revoke --foo` sent
|
|
45
|
+
* `DELETE /api/admin/api-keys/--foo`, and `rebase --debug api-keys revoke <id>`
|
|
46
|
+
* shifted the words along and revoked the key named `revoke`.
|
|
47
|
+
*
|
|
48
|
+
* Exported so its tests can drive the real parser rather than a copy of it.
|
|
49
|
+
*/
|
|
50
|
+
export declare function resolveRevokeKeyArgs(rawArgs: string[]): {
|
|
51
|
+
id?: string;
|
|
52
|
+
};
|
package/dist/commands/auth.d.ts
CHANGED
|
@@ -30,3 +30,34 @@ export interface ResolvedUser {
|
|
|
30
30
|
*/
|
|
31
31
|
export declare function selectUserForEmail(payload: unknown, email: string): ResolvedUser | undefined;
|
|
32
32
|
export declare function authCommand(subcommand: string | undefined, rawArgs: string[]): Promise<void>;
|
|
33
|
+
/**
|
|
34
|
+
* The flags `rebase auth reset-password` takes.
|
|
35
|
+
*
|
|
36
|
+
* `-p` was advertised in this command's own help and never declared here, so
|
|
37
|
+
* `arg` — running permissively — pushed it into the positionals and the value
|
|
38
|
+
* *after* it shifted out of reach: anyone following the help set the account's
|
|
39
|
+
* password to the two-character string `-p`. Declared now, and `auth.test.ts`
|
|
40
|
+
* asserts that the help and this spec list the same aliases.
|
|
41
|
+
*/
|
|
42
|
+
export declare const RESET_PASSWORD_FLAGS: {
|
|
43
|
+
readonly "--email": StringConstructor;
|
|
44
|
+
readonly "--password": StringConstructor;
|
|
45
|
+
readonly "-e": "--email";
|
|
46
|
+
readonly "-p": "--password";
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Which account, and which password, this invocation names.
|
|
50
|
+
*
|
|
51
|
+
* Both may still be absent — the caller reports a missing email — but neither
|
|
52
|
+
* can be a flag. `parseCommandArgs` parses the whole line strictly, so an
|
|
53
|
+
* undeclared flag is an error rather than a positional. That is what stops
|
|
54
|
+
* `rebase auth reset-password bob@example.com --debug` from setting Bob's
|
|
55
|
+
* password to `--debug`, which is the flag the CLI itself prints after every
|
|
56
|
+
* failure as the thing to re-run with.
|
|
57
|
+
*
|
|
58
|
+
* Exported so its tests can drive the real parser rather than a copy of it.
|
|
59
|
+
*/
|
|
60
|
+
export declare function resolveResetPasswordArgs(rawArgs: string[]): {
|
|
61
|
+
email?: string;
|
|
62
|
+
password?: string;
|
|
63
|
+
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import arg from "arg";
|
|
1
2
|
import { createRebaseClient } from "@rebasepro/client";
|
|
2
3
|
/** Project-local link file: <project>/.rebase/cloud.json */
|
|
3
4
|
export declare function projectLinkPath(cwd?: string): string;
|
|
@@ -192,6 +193,22 @@ export declare function printJson(value: unknown): void;
|
|
|
192
193
|
* call is what guarantees a command can never print a table AND a JSON blob.
|
|
193
194
|
*/
|
|
194
195
|
export declare function emit(human: () => void, json: unknown): void;
|
|
196
|
+
/**
|
|
197
|
+
* Print a help page — the human one, or a machine-readable description of the
|
|
198
|
+
* same command in JSON mode.
|
|
199
|
+
*
|
|
200
|
+
* `--help` is the one place where "stdout is not a TTY" is a weak signal: a
|
|
201
|
+
* person runs `rebase cloud db --help | less` and wants the page. But the rule
|
|
202
|
+
* this family promises is that stdout carries one JSON value whenever it is not
|
|
203
|
+
* a terminal, and a help page is the easiest possible thing to describe
|
|
204
|
+
* structurally — so rather than carve out an exception, help answers the same
|
|
205
|
+
* question in the reader's own language. For an agent, `--help` piped is then a
|
|
206
|
+
* discovery call rather than 60 lines of ANSI to scrape.
|
|
207
|
+
*
|
|
208
|
+
* `env` shipped this shape first, alone; this generalises it so every group
|
|
209
|
+
* answers the same way.
|
|
210
|
+
*/
|
|
211
|
+
export declare function emitHelp(command: string, actions: string[], human: () => void, extra?: Record<string, unknown>): void;
|
|
195
212
|
/**
|
|
196
213
|
* Print a warning (+ optional hint) — in every output mode, always to stderr.
|
|
197
214
|
*
|
|
@@ -212,7 +229,22 @@ export declare function emit(human: () => void, json: unknown): void;
|
|
|
212
229
|
* is for whoever reads the transcript afterwards.
|
|
213
230
|
*/
|
|
214
231
|
export declare function warn(message: string, hint?: string): void;
|
|
215
|
-
/**
|
|
232
|
+
/**
|
|
233
|
+
* Print an error (+ optional hint) and exit non-zero. Never returns.
|
|
234
|
+
*
|
|
235
|
+
* `code` is the field a caller branches on, and it defaults to `"error"` rather
|
|
236
|
+
* than `null`. An envelope whose only machine-readable field is null is not
|
|
237
|
+
* machine-readable — `{"error":{"message":"No project specified…","code":null}}`
|
|
238
|
+
* forced the very substring-matching on `message` that the envelope exists to
|
|
239
|
+
* make unnecessary, and `message` is the field most likely to be reworded.
|
|
240
|
+
*
|
|
241
|
+
* `"error"` is deliberately a poor code: it says "this refusal has not been
|
|
242
|
+
* classified yet" without ever being absent. Anything a caller might plausibly
|
|
243
|
+
* want to distinguish — `usage`, `not_found`, `unauthenticated` — passes a real
|
|
244
|
+
* one. Codes are part of the CLI's contract once shipped; see
|
|
245
|
+
* `cloud-reporting.test.ts`, which pins the ones commands are documented to
|
|
246
|
+
* return.
|
|
247
|
+
*/
|
|
216
248
|
export declare function fail(message: string, hint?: string, code?: string): never;
|
|
217
249
|
/**
|
|
218
250
|
* Confirm a destructive/irreversible action, respecting non-interactive use.
|
|
@@ -227,16 +259,112 @@ export declare function confirmDestructive(opts: {
|
|
|
227
259
|
prompt: string;
|
|
228
260
|
}): Promise<void>;
|
|
229
261
|
/**
|
|
230
|
-
*
|
|
262
|
+
* Refuse, rather than prompt, when there is nobody to answer.
|
|
263
|
+
*
|
|
264
|
+
* `confirmDestructive` has always done this for yes/no confirmations. The
|
|
265
|
+
* *value* prompts had no such guard: `cloud login`, `cloud link`, `cloud use`,
|
|
266
|
+
* `cloud orgs create` and `cloud db create` all called `inquirer.prompt`
|
|
267
|
+
* unconditionally, so piping any of them — which is how an agent runs every
|
|
268
|
+
* command in this family — parked the process on a prompt reading from a stdin
|
|
269
|
+
* that was never going to produce a line. A hang is the worst failure mode
|
|
270
|
+
* available here: no output, no exit code, nothing to retry on.
|
|
271
|
+
*
|
|
272
|
+
* @param what what the prompt would have asked for, e.g. "an email and password"
|
|
273
|
+
* @param flags the flags that supply it non-interactively
|
|
274
|
+
*/
|
|
275
|
+
export declare function requireInteractive(what: string, flags: string): void;
|
|
276
|
+
/**
|
|
277
|
+
* Resolve one cloud command's flags and ARGUMENTS from the full `process.argv`.
|
|
278
|
+
*
|
|
279
|
+
* This replaces `cloudPositionals`, which was `rawArgs.slice(3).filter(a =>
|
|
280
|
+
* !a.startsWith("-"))`. Dropping `-`-prefixed tokens looks like it solves the
|
|
281
|
+
* permissive-parse problem and does not: a flag that takes a VALUE leaves the
|
|
282
|
+
* value behind, an ordinary word in the argument position that no filter can
|
|
283
|
+
* tell from a real one. `--project` is the flag every one of these commands
|
|
284
|
+
* documents, so the failure was reachable from the help page:
|
|
285
|
+
*
|
|
286
|
+
* rebase cloud env unset -p acme → removed the variable "acme"
|
|
287
|
+
* rebase cloud env set KEY -p acme → stored the value "acme"
|
|
288
|
+
* rebase cloud domains add -p acme → registered the domain "acme"
|
|
289
|
+
* rebase cloud webhooks delete -p acme 42 → deleted webhook "acme", not 42
|
|
290
|
+
* rebase cloud cancel -p acme → cancelled deployment id "acme"
|
|
291
|
+
*
|
|
292
|
+
* The filter's other half is quieter. A flag nobody declared *is* dropped by
|
|
293
|
+
* it — but only from the operands, never from the run: nothing rejects it, so
|
|
294
|
+
* the command proceeds with the argument missing or defaulted. `db backup
|
|
295
|
+
* --dry-run` listed backups, `domains remove --dry-run` detached the domain,
|
|
296
|
+
* and `env set KEY=v --secrett` stored the value as an ordinary variable that
|
|
297
|
+
* `env reveal` will hand back. The one place an undeclared flag became the
|
|
298
|
+
* argument outright is `projects info|delete`, which resolved its id through
|
|
299
|
+
* `positionals()` instead — that skips only LEADING `-` tokens, so `projects
|
|
300
|
+
* delete --force` looked up a project named "--force".
|
|
301
|
+
*
|
|
302
|
+
* So: parse the whole line strictly, through the same `parseCommandArgs` the
|
|
303
|
+
* non-cloud commands use — `arg` then consumes each declared flag *with its
|
|
304
|
+
* value* wherever it appears, and rejects the undeclared, leaving `_` holding
|
|
305
|
+
* the command words followed by the real arguments. `commandWords` counts from
|
|
306
|
+
* `cloud` itself (`cloud env set` ⇒ 3), and is applied to the parsed
|
|
307
|
+
* positionals, so a flag written before the group shifts nothing.
|
|
308
|
+
*
|
|
309
|
+
* Two things this adds over calling `parseCommandArgs` directly, and the reason
|
|
310
|
+
* it is worth a wrapper:
|
|
311
|
+
*
|
|
312
|
+
* - `GLOBAL_CLOUD_FLAGS` is merged in. `--json`, `--yes` and `--project` may
|
|
313
|
+
* appear anywhere on a cloud line including before the group, so a strict
|
|
314
|
+
* parse that did not declare them would reject the CLI's own documented
|
|
315
|
+
* usage. (`parseCommandArgs` adds `--debug`/`--help` on top of that.)
|
|
316
|
+
* - A parse error is reported through `fail`, not thrown. A throw reaches
|
|
317
|
+
* `bin/rebase.js`, which prints `✗ …` to stderr — which is right for every
|
|
318
|
+
* other command and wrong here: `rebase cloud` is in JSON mode whenever
|
|
319
|
+
* stdout is not a TTY, i.e. always for the agents this family is built for,
|
|
320
|
+
* and it promises them exactly one JSON value. `fail` keeps that promise,
|
|
321
|
+
* with the same `usage` code the other refusals in this family use.
|
|
322
|
+
*/
|
|
323
|
+
export declare function parseCloudArgs<S extends arg.Spec>(opts: {
|
|
324
|
+
spec: S;
|
|
325
|
+
rawArgs: string[];
|
|
326
|
+
commandWords: number;
|
|
327
|
+
/** Names the command in errors, e.g. `cloud env set` (no leading `rebase`). */
|
|
328
|
+
command: string;
|
|
329
|
+
maxPositionals?: number;
|
|
330
|
+
}): {
|
|
331
|
+
flags: arg.Result<S & typeof GLOBAL_CLOUD_FLAGS>;
|
|
332
|
+
positionals: string[];
|
|
333
|
+
};
|
|
334
|
+
/**
|
|
335
|
+
* Announce an outcome — "Logged in as …", "Deleted project …".
|
|
231
336
|
*
|
|
232
|
-
*
|
|
233
|
-
*
|
|
234
|
-
*
|
|
235
|
-
*
|
|
236
|
-
*
|
|
337
|
+
* On **stderr**, in both modes. It reads like a result and is not one: the
|
|
338
|
+
* result is the JSON value (or the table) on stdout, and every JSON payload in
|
|
339
|
+
* this family already carries `success: true`. Leaving this on stdout meant a
|
|
340
|
+
* successful `rebase cloud link | jq` was handed a green tick followed by an
|
|
341
|
+
* object — one stream, two syntaxes, and only the second parseable.
|
|
342
|
+
*
|
|
343
|
+
* It stays visible in JSON mode, unlike `note`: an agent that got a `success`
|
|
344
|
+
* line on a command it expected to refuse has learned something.
|
|
237
345
|
*/
|
|
238
|
-
export declare function cloudPositionals(rawArgs: string[]): string[];
|
|
239
346
|
export declare function success(message: string): void;
|
|
347
|
+
/**
|
|
348
|
+
* Narrate progress, or point at the next step — "Signing in to …", "Redeploy
|
|
349
|
+
* for the tenant to pick this up".
|
|
350
|
+
*
|
|
351
|
+
* stderr, and **suppressed entirely in JSON mode**. This is the one helper that
|
|
352
|
+
* a mode may silence, and the distinction from `warn` is worth keeping sharp:
|
|
353
|
+
*
|
|
354
|
+
* - A warning is a *condition*. It is as true when piped as when watched, so
|
|
355
|
+
* silencing it hides something the caller would want to know. `warn` never
|
|
356
|
+
* silences.
|
|
357
|
+
* - A note is *hand-holding*. "Next: run `rebase generate-sdk`" tells a person
|
|
358
|
+
* what to type; the agent reading the JSON already has the same information
|
|
359
|
+
* structurally, or does not need it. Printing it anyway is transcript noise.
|
|
360
|
+
*
|
|
361
|
+
* When in doubt it is a warning. The cost of a needless warning is a line; the
|
|
362
|
+
* cost of a swallowed one is the deploy that ejected a project off the managed
|
|
363
|
+
* runtime and said so only to a terminal nobody was looking at.
|
|
364
|
+
*/
|
|
365
|
+
export declare function note(message: string, indent?: string): void;
|
|
366
|
+
/** A blank spacer line on the narration stream. No-op in JSON mode. */
|
|
367
|
+
export declare function noteBlank(): void;
|
|
240
368
|
/** Colorize a deployment / resource status token. */
|
|
241
369
|
export declare function colorStatus(status: string | undefined): string;
|
|
242
370
|
/**
|
|
@@ -251,7 +379,12 @@ export declare function keyValues(rows: Array<[string, string | null | undefined
|
|
|
251
379
|
*/
|
|
252
380
|
export declare function reportError(e: unknown, context: string): never;
|
|
253
381
|
/**
|
|
254
|
-
* Open a URL in the user's default browser (best effort). Always
|
|
255
|
-
* first so it stays usable over SSH or when no browser is available.
|
|
382
|
+
* Open a URL in the user's default browser (best effort). Always announces the
|
|
383
|
+
* URL first so it stays usable over SSH or when no browser is available.
|
|
384
|
+
*
|
|
385
|
+
* The announcement is narration, not the result — it goes to stderr, and in
|
|
386
|
+
* JSON mode it is silent. Every caller `emit`s the same URL in its payload, so
|
|
387
|
+
* a machine reader gets it from the one place it is guaranteed to be parseable
|
|
388
|
+
* rather than from a line that happens to end in a URL.
|
|
256
389
|
*/
|
|
257
390
|
export declare function openUrl(target: string, label?: string): void;
|
|
@@ -1 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `rebase cloud db` — database + backup management for a project.
|
|
3
|
+
*
|
|
4
|
+
* db list List databases attached to the project
|
|
5
|
+
* db create Attach a managed or bring-your-own database
|
|
6
|
+
* db test Test connectivity to the project's database
|
|
7
|
+
* db backup list|create|restore
|
|
8
|
+
*/
|
|
9
|
+
import arg from "arg";
|
|
1
10
|
export declare function dbCommand(subcommand: string | undefined, rawArgs: string[]): Promise<void>;
|
|
11
|
+
/**
|
|
12
|
+
* `db backup [action] [filename]`, resolved in one strict parse.
|
|
13
|
+
*
|
|
14
|
+
* Both halves were reachable by the old operand filter, and both are
|
|
15
|
+
* destructive: `rebase cloud db backup -p acme` read `--project`'s value as the
|
|
16
|
+
* ACTION (falling through to a list, so the flag silently changed what ran),
|
|
17
|
+
* and `db backup restore -p acme` read it as the FILENAME — a restore staged
|
|
18
|
+
* over the live database, named after the project slug. An undeclared flag was
|
|
19
|
+
* dropped instead of refused, which is the same failure one step quieter: `db
|
|
20
|
+
* backup --dry-run` ran a list, having silently discarded the flag that was
|
|
21
|
+
* supposed to change what it did.
|
|
22
|
+
*
|
|
23
|
+
* Exported so its tests drive the real parser.
|
|
24
|
+
*/
|
|
25
|
+
export declare function resolveBackupArgs(rawArgs: string[]): {
|
|
26
|
+
flags: arg.Result<{
|
|
27
|
+
"--yes": BooleanConstructor;
|
|
28
|
+
} & {
|
|
29
|
+
readonly "--json": BooleanConstructor;
|
|
30
|
+
readonly "--yes": BooleanConstructor;
|
|
31
|
+
readonly "--help": BooleanConstructor;
|
|
32
|
+
readonly "--project": StringConstructor;
|
|
33
|
+
readonly "-p": "--project";
|
|
34
|
+
readonly "-y": "--yes";
|
|
35
|
+
readonly "-h": "--help";
|
|
36
|
+
}>;
|
|
37
|
+
action: string;
|
|
38
|
+
filename: string;
|
|
39
|
+
};
|
|
40
|
+
export declare function printDbHelp(): void;
|
|
@@ -115,3 +115,4 @@ export declare function formatDuration(seconds: number): string;
|
|
|
115
115
|
*/
|
|
116
116
|
export declare function parseSince(input: string | undefined): number | null;
|
|
117
117
|
export declare function debugCommand(action: string | undefined, rawArgs: string[]): Promise<void>;
|
|
118
|
+
export declare function printDebugHelp(): void;
|
|
@@ -50,5 +50,27 @@ export declare const DEFAULT_DEPLOYMENTS_LIMIT = 20;
|
|
|
50
50
|
/** `--limit N`, bounded. A garbage value is a refusal, never a silent default. */
|
|
51
51
|
export declare function parseDeploymentsLimit(raw: number | undefined): number;
|
|
52
52
|
export declare function deploymentsListCommand(rawArgs: string[]): Promise<void>;
|
|
53
|
+
/**
|
|
54
|
+
* The deployment id `rollback`/`cancel` was given, if any.
|
|
55
|
+
*
|
|
56
|
+
* Both take an optional id, which is what made the old operand filter so easy
|
|
57
|
+
* to trip: `rebase cloud rollback -p acme` — the documented way to act on an
|
|
58
|
+
* unlinked project — read `--project`'s value as the id and refused with
|
|
59
|
+
* "Deployment acme not found", and `cancel -p acme` sent "acme" to the server
|
|
60
|
+
* as the deployment to cancel. Strict parsing consumes the flag with its value,
|
|
61
|
+
* so an id given as a flag value is never mistaken for an argument.
|
|
62
|
+
*/
|
|
63
|
+
export declare function resolveDeploymentIdArg(rawArgs: string[], command: string): {
|
|
64
|
+
flags: import("arg").Result<{
|
|
65
|
+
readonly "--json": BooleanConstructor;
|
|
66
|
+
readonly "--yes": BooleanConstructor;
|
|
67
|
+
readonly "--help": BooleanConstructor;
|
|
68
|
+
readonly "--project": StringConstructor;
|
|
69
|
+
readonly "-p": "--project";
|
|
70
|
+
readonly "-y": "--yes";
|
|
71
|
+
readonly "-h": "--help";
|
|
72
|
+
}>;
|
|
73
|
+
id: string;
|
|
74
|
+
};
|
|
53
75
|
export declare function rollbackCommand(rawArgs: string[]): Promise<void>;
|
|
54
76
|
export declare function cancelCommand(rawArgs: string[]): Promise<void>;
|
|
@@ -1 +1,11 @@
|
|
|
1
1
|
export declare function domainsCommand(action: string | undefined, rawArgs: string[]): Promise<void>;
|
|
2
|
+
/**
|
|
3
|
+
* The domain `domains add` was asked to register.
|
|
4
|
+
*
|
|
5
|
+
* Exported so its tests drive the real parser. Under the old operand filter
|
|
6
|
+
* `rebase cloud domains add -p acme` registered a domain called "acme" — the
|
|
7
|
+
* project slug, read out of `--project`'s own value — and a registered domain
|
|
8
|
+
* is a project-record write, not a no-op.
|
|
9
|
+
*/
|
|
10
|
+
export declare function resolveDomainArg(rawArgs: string[]): string | undefined;
|
|
11
|
+
export declare function printDomainsHelp(): void;
|
|
@@ -6,3 +6,54 @@ export declare function parseEnvAssignment(operands: string[]): {
|
|
|
6
6
|
} | null;
|
|
7
7
|
/** The prefix that makes `key` a build-time variable, or undefined. */
|
|
8
8
|
export declare function buildTimeEnvPrefix(key: string): string | undefined;
|
|
9
|
+
/** The flags `rebase cloud env set` takes, on top of the global cloud ones. */
|
|
10
|
+
export declare const ENV_SET_FLAGS: {
|
|
11
|
+
readonly "--secret": BooleanConstructor;
|
|
12
|
+
readonly "--force": BooleanConstructor;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* What `env set` was asked to store.
|
|
16
|
+
*
|
|
17
|
+
* The sharp one in this family: the old operand filter left `--project`'s value
|
|
18
|
+
* in the operand list, so `rebase cloud env set KEY -p acme` parsed as the
|
|
19
|
+
* `KEY VALUE` form and stored the project slug as KEY's value — a write that
|
|
20
|
+
* succeeds, reports success, and is wrong. Strict parsing consumes `-p` with
|
|
21
|
+
* its value, leaving `["KEY"]` and the documented empty value.
|
|
22
|
+
*
|
|
23
|
+
* A value beginning with `-` must use the `KEY=-v` form; the bare `KEY -v` form
|
|
24
|
+
* is refused rather than guessed at, as everywhere else strict parsing is used.
|
|
25
|
+
*
|
|
26
|
+
* Exported so its tests drive the real parser rather than a copy of it.
|
|
27
|
+
*/
|
|
28
|
+
export declare function resolveEnvSetArgs(rawArgs: string[]): {
|
|
29
|
+
flags: import("arg").Result<{
|
|
30
|
+
readonly "--secret": BooleanConstructor;
|
|
31
|
+
readonly "--force": BooleanConstructor;
|
|
32
|
+
} & {
|
|
33
|
+
readonly "--json": BooleanConstructor;
|
|
34
|
+
readonly "--yes": BooleanConstructor;
|
|
35
|
+
readonly "--help": BooleanConstructor;
|
|
36
|
+
readonly "--project": StringConstructor;
|
|
37
|
+
readonly "-p": "--project";
|
|
38
|
+
readonly "-y": "--yes";
|
|
39
|
+
readonly "-h": "--help";
|
|
40
|
+
}>;
|
|
41
|
+
assignment: {
|
|
42
|
+
key: string;
|
|
43
|
+
value: string;
|
|
44
|
+
} | null;
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* The variable `env unset` / `env reveal` names.
|
|
48
|
+
*
|
|
49
|
+
* `unset` is a delete, and the operand filter aimed it at the wrong variable:
|
|
50
|
+
* `rebase cloud env unset -p acme` removed a variable called "acme" from the
|
|
51
|
+
* linked project instead of reporting a missing KEY, and `env unset -p acme
|
|
52
|
+
* KEY` removed "acme" instead of KEY. Both read `--project`'s value as the
|
|
53
|
+
* operand — a plain word in the right position that no flag filter can catch.
|
|
54
|
+
*
|
|
55
|
+
* `action` is the word the caller used (`unset`, `rm`, `delete`, `reveal`); the
|
|
56
|
+
* count of command words is the same for all of them.
|
|
57
|
+
*/
|
|
58
|
+
export declare function resolveEnvKeyArg(rawArgs: string[], action: string): string | undefined;
|
|
59
|
+
export declare function printEnvHelp(): void;
|
|
@@ -1,3 +1,24 @@
|
|
|
1
1
|
/** The identifier CREATE EXTENSION takes. `pgvector` is a common alias. */
|
|
2
2
|
export declare function resolveExtensionAlias(name: string): string;
|
|
3
3
|
export declare function extensionsCommand(action: string | undefined, rawArgs: string[]): Promise<void>;
|
|
4
|
+
/**
|
|
5
|
+
* The extension `enable`/`disable` names, plus the flags that gate it.
|
|
6
|
+
*
|
|
7
|
+
* Under the old operand filter `rebase cloud extensions enable -p acme` read
|
|
8
|
+
* `--project`'s value as the extension name and asked the server to install one
|
|
9
|
+
* called "acme"; `extensions disable -p acme vector` dropped "acme" rather than
|
|
10
|
+
* vector. Strict parsing consumes the flag with its value.
|
|
11
|
+
*/
|
|
12
|
+
export declare function resolveExtensionArgs(rawArgs: string[], action: "enable" | "disable"): {
|
|
13
|
+
flags: import("arg").Result<{
|
|
14
|
+
readonly "--json": BooleanConstructor;
|
|
15
|
+
readonly "--yes": BooleanConstructor;
|
|
16
|
+
readonly "--help": BooleanConstructor;
|
|
17
|
+
readonly "--project": StringConstructor;
|
|
18
|
+
readonly "-p": "--project";
|
|
19
|
+
readonly "-y": "--yes";
|
|
20
|
+
readonly "-h": "--help";
|
|
21
|
+
}>;
|
|
22
|
+
name: string;
|
|
23
|
+
};
|
|
24
|
+
export declare function printExtensionsHelp(): void;
|
|
@@ -31,7 +31,36 @@ export declare function chooseRequestedTarget(requested: string | undefined, tar
|
|
|
31
31
|
provider: string;
|
|
32
32
|
region?: string;
|
|
33
33
|
} | null;
|
|
34
|
+
/** The flags `rebase cloud projects create` takes. */
|
|
35
|
+
export declare const CREATE_PROJECT_FLAGS: {
|
|
36
|
+
readonly "--name": StringConstructor;
|
|
37
|
+
readonly "--subdomain": StringConstructor;
|
|
38
|
+
readonly "--repo": StringConstructor;
|
|
39
|
+
readonly "--branch": StringConstructor;
|
|
40
|
+
readonly "--provider": StringConstructor;
|
|
41
|
+
readonly "--region": StringConstructor;
|
|
42
|
+
readonly "--vm-size": StringConstructor;
|
|
43
|
+
readonly "--org": StringConstructor;
|
|
44
|
+
readonly "--link": BooleanConstructor;
|
|
45
|
+
readonly "-n": "--name";
|
|
46
|
+
};
|
|
34
47
|
export declare function createProject(rawArgs: string[]): Promise<void>;
|
|
48
|
+
/**
|
|
49
|
+
* Which project `projects info` / `projects delete` acts on.
|
|
50
|
+
*
|
|
51
|
+
* The id is optional — omitted, it falls back to `--project` or the link file —
|
|
52
|
+
* and the dispatcher used to read it off `positionals()`, which skips only
|
|
53
|
+
* LEADING `-` tokens and declares only the global cloud flags. So an undeclared
|
|
54
|
+
* flag written after the action became the id: `rebase cloud projects delete
|
|
55
|
+
* --force` looked up a project named "--force" and reported it missing, rather
|
|
56
|
+
* than saying there is no such flag. Benign next to the deletes and writes the
|
|
57
|
+
* rest of this family aimed at the wrong resource, but the same mistake, and
|
|
58
|
+
* `positionals()` has no spec with which to do better — the handler's own
|
|
59
|
+
* module does.
|
|
60
|
+
*
|
|
61
|
+
* Exported so its tests drive the real parser rather than a copy of it.
|
|
62
|
+
*/
|
|
63
|
+
export declare function resolveProjectArg(rawArgs: string[], action: "info" | "delete"): string;
|
|
35
64
|
export declare function projectInfo(rawArgs: string[], projectRef: string): Promise<void>;
|
|
36
65
|
export declare function deleteProject(rawArgs: string[], projectRef: string): Promise<void>;
|
|
37
66
|
export declare function firstRow(client: CloudClient, collection: string, projectId: string): Promise<Record<string, unknown> | undefined>;
|
|
@@ -57,8 +57,22 @@ export declare function describeRuntime(project: {
|
|
|
57
57
|
}): string;
|
|
58
58
|
export declare function statusCommand(rawArgs: string[]): Promise<void>;
|
|
59
59
|
export declare function metricsCommand(rawArgs: string[]): Promise<void>;
|
|
60
|
+
/**
|
|
61
|
+
* The webhook `webhooks delete` names.
|
|
62
|
+
*
|
|
63
|
+
* The worst instance of the operand-filter bug in this family, because the
|
|
64
|
+
* argument is consumed by a DELETE and the wrong value looks entirely
|
|
65
|
+
* plausible: `rebase cloud webhooks delete --project acme 42` filtered out
|
|
66
|
+
* `--project` and kept "acme", so the id it deleted was the project slug rather
|
|
67
|
+
* than the 42 the caller wrote. Strict parsing consumes the flag with its
|
|
68
|
+
* value, leaving `["42"]`.
|
|
69
|
+
*
|
|
70
|
+
* Exported so its tests drive the real parser.
|
|
71
|
+
*/
|
|
72
|
+
export declare function resolveWebhookIdArg(rawArgs: string[]): string | undefined;
|
|
60
73
|
export declare function webhooksCommand(subcommand: string | undefined, rawArgs: string[]): Promise<void>;
|
|
61
74
|
export declare function storageCommand(action: string | undefined, rawArgs: string[]): Promise<void>;
|
|
75
|
+
export declare function printStorageHelp(): void;
|
|
62
76
|
export declare function clustersCommand(rawArgs: string[]): Promise<void>;
|
|
63
77
|
export declare function billingCommand(rawArgs: string[]): Promise<void>;
|
|
64
78
|
export {};
|
package/dist/commands/dev.d.ts
CHANGED
|
@@ -6,12 +6,23 @@ export declare const DEV_PORT_FILENAME = ".rebase-dev-port";
|
|
|
6
6
|
* Two different project directories will almost always get different ports.
|
|
7
7
|
*/
|
|
8
8
|
export declare function getProjectPort(projectRoot: string): number;
|
|
9
|
+
export declare function resolveStartPort(projectRoot: string, explicitPort?: number): number;
|
|
9
10
|
/**
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
11
|
+
* The flags `rebase dev` takes.
|
|
12
|
+
*
|
|
13
|
+
* Exported so `dev.test.ts` can assert that every short alias the help
|
|
14
|
+
* advertises is declared here: the help said `--port, -p` while the spec has
|
|
15
|
+
* only ever declared `-P`, so `rebase dev -p 4000` typed straight off the help
|
|
16
|
+
* page passed `4000` as a positional and started on the default port.
|
|
15
17
|
*/
|
|
16
|
-
export declare
|
|
18
|
+
export declare const DEV_FLAGS: {
|
|
19
|
+
readonly "--backend-only": BooleanConstructor;
|
|
20
|
+
readonly "--frontend-only": BooleanConstructor;
|
|
21
|
+
readonly "--port": NumberConstructor;
|
|
22
|
+
readonly "--generate": BooleanConstructor;
|
|
23
|
+
readonly "-b": "--backend-only";
|
|
24
|
+
readonly "-f": "--frontend-only";
|
|
25
|
+
readonly "-P": "--port";
|
|
26
|
+
readonly "-g": "--generate";
|
|
27
|
+
};
|
|
17
28
|
export declare function devCommand(rawArgs: string[]): Promise<void>;
|
package/dist/commands/eject.d.ts
CHANGED
|
@@ -1 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The two ways one project's payload differs from another's.
|
|
3
|
+
*
|
|
4
|
+
* Neither is a flag: both were decided at `rebase init` time. `--headless`
|
|
5
|
+
* deletes `config/collections`, `backend/src/schema.generated.ts` and
|
|
6
|
+
* `frontend/`, so a payload that assumes them emits an entrypoint importing
|
|
7
|
+
* three files that are not there and a Dockerfile whose first `COPY` fails.
|
|
8
|
+
*/
|
|
9
|
+
interface ProjectShape {
|
|
10
|
+
/**
|
|
11
|
+
* Collections declared in code, under `<config>/collections`. Without them
|
|
12
|
+
* the server derives its API from the live database instead — the same
|
|
13
|
+
* signal `rebase build` reads.
|
|
14
|
+
*/
|
|
15
|
+
collections: boolean;
|
|
16
|
+
/** A `frontend` workspace for the image to build and the entrypoint to serve. */
|
|
17
|
+
frontend: boolean;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Render one payload file for this project.
|
|
21
|
+
*
|
|
22
|
+
* The payload is one set of files rather than one per flavour, because the
|
|
23
|
+
* flavours differ by about a dozen lines and two copies of a 230-line
|
|
24
|
+
* entrypoint are how copies drift — the payload had already drifted from
|
|
25
|
+
* `app/backend/src/index.ts` over `cronsDir`, which silently stopped every cron
|
|
26
|
+
* job in an ejected project. So both branches live in the file, marked with
|
|
27
|
+
* lines that are comments in TypeScript, YAML and Dockerfiles alike:
|
|
28
|
+
*
|
|
29
|
+
* // {{#collections}}
|
|
30
|
+
* import { tables } from "./schema.generated.js";
|
|
31
|
+
* // {{/collections}}
|
|
32
|
+
* // {{^collections}}
|
|
33
|
+
* // No schema module: this project introspects the database.
|
|
34
|
+
* // {{/collections}}
|
|
35
|
+
*
|
|
36
|
+
* `{{#name}}` keeps its block when the flag is on, `{{^name}}` when it is off,
|
|
37
|
+
* and the marker lines themselves never reach the user. The template stays
|
|
38
|
+
* valid TypeScript with every marker line removed, which is the flavour a
|
|
39
|
+
* typechecker would see.
|
|
40
|
+
*/
|
|
41
|
+
export declare function renderPayload(contents: string, shape: ProjectShape, projectName: string): string;
|
|
1
42
|
export declare function ejectCommand(rawArgs?: string[]): Promise<void>;
|
|
43
|
+
export {};
|