@rebasepro/cli 0.9.0 → 0.9.1-canary.0de22e0

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 (47) hide show
  1. package/README.md +32 -3
  2. package/bin/rebase.js +67 -1
  3. package/dist/commands/cloud/auth.d.ts +3 -0
  4. package/dist/commands/cloud/context.d.ts +151 -0
  5. package/dist/commands/cloud/databases.d.ts +1 -0
  6. package/dist/commands/cloud/debug.d.ts +117 -0
  7. package/dist/commands/cloud/deploy.d.ts +2 -0
  8. package/dist/commands/cloud/deployments.d.ts +38 -0
  9. package/dist/commands/cloud/domains.d.ts +1 -0
  10. package/dist/commands/cloud/env.d.ts +6 -0
  11. package/dist/commands/cloud/extensions.d.ts +3 -0
  12. package/dist/commands/cloud/index.d.ts +1 -0
  13. package/dist/commands/cloud/link.d.ts +5 -0
  14. package/dist/commands/cloud/orgs.d.ts +1 -0
  15. package/dist/commands/cloud/power.d.ts +3 -0
  16. package/dist/commands/cloud/projects.d.ts +13 -0
  17. package/dist/commands/cloud/resources.d.ts +6 -0
  18. package/dist/commands/cloud/settings.d.ts +8 -0
  19. package/dist/commands/init.d.ts +23 -0
  20. package/dist/commands/skills.d.ts +1 -1
  21. package/dist/index.d.ts +1 -0
  22. package/dist/index.es.js +6083 -1819
  23. package/dist/index.es.js.map +1 -1
  24. package/dist/utils/package-manager.d.ts +19 -5
  25. package/dist/utils/project.d.ts +1 -1
  26. package/package.json +8 -7
  27. package/templates/overlays/baas/README.md +55 -0
  28. package/templates/overlays/baas/backend/package.json +31 -0
  29. package/templates/overlays/baas/backend/src/index.ts +192 -0
  30. package/templates/overlays/baas/backend/tsconfig.json +19 -0
  31. package/templates/overlays/baas/package.json +42 -0
  32. package/templates/overlays/baas/pnpm-workspace.yaml +9 -0
  33. package/templates/template/.env.example +25 -3
  34. package/templates/template/backend/functions/hello.ts +1 -1
  35. package/templates/template/backend/package.json +6 -7
  36. package/templates/template/backend/src/env.ts +31 -2
  37. package/templates/template/backend/src/index.ts +21 -16
  38. package/templates/template/config/collections/index.ts +20 -0
  39. package/templates/template/config/collections/presets/blank/index.ts +3 -1
  40. package/templates/template/config/collections/presets/ecommerce/index.ts +3 -1
  41. package/templates/template/config/collections/users.ts +2 -0
  42. package/templates/template/config/package.json +1 -2
  43. package/templates/template/frontend/package.json +2 -3
  44. package/templates/template/frontend/src/App.tsx +3 -4
  45. package/templates/template/frontend/vite.config.ts +1 -1
  46. package/templates/template/gitignore +31 -0
  47. package/templates/template/npmrc +10 -0
package/README.md CHANGED
@@ -26,9 +26,38 @@ The CLI is also bundled with every Rebase project as a local dependency.
26
26
  | `rebase generate-sdk` | Generate a typed TypeScript SDK from collections |
27
27
  | `rebase auth reset-password` | Reset a user's password |
28
28
  | `rebase doctor` | Detect schema drift between collections, Drizzle schema, and database |
29
+ | `rebase cloud <command>` | Manage your apps on Rebase Cloud (auth, deploy, databases, …) |
29
30
 
30
31
  Run `rebase --help` or `rebase <command> --help` for detailed usage.
31
32
 
33
+ ## Rebase Cloud
34
+
35
+ `rebase cloud` talks to the hosted control plane (default `https://app.rebase.pro`,
36
+ override with `--url` or `REBASE_CLOUD_URL`). Sign in once — credentials are stored
37
+ in `~/.rebase/credentials.json`, keyed per host — then link a directory to a project
38
+ so deploy/logs/status need no flags.
39
+
40
+ ```bash
41
+ rebase cloud login # sign in (stores a session)
42
+ rebase cloud link # pick a project → writes .rebase/cloud.json
43
+ rebase cloud deploy # deploy the linked project + stream build logs
44
+ rebase cloud logs --runtime # tail runtime logs
45
+ rebase cloud status # project status at a glance
46
+ ```
47
+
48
+ | Group | Commands |
49
+ |-------|----------|
50
+ | Auth | `login`, `logout`, `whoami` |
51
+ | Link/context | `link`, `unlink`, `use [org]`, `open` |
52
+ | Projects | `projects list \| create \| info \| delete` |
53
+ | Deploy/observe | `deploy`, `logs [--runtime] [-f]`, `status`, `metrics` |
54
+ | Organizations | `orgs list \| create \| members` |
55
+ | Databases | `db list \| create \| test`, `db backup list \| create \| restore` |
56
+ | Resources | `webhooks list \| create \| delete`, `storage`, `clusters`, `billing [checkout]` |
57
+
58
+ Most commands act on the linked project unless you pass `--project <id>`.
59
+ Run `rebase cloud --help` for the full list.
60
+
32
61
  ## Quick Start
33
62
 
34
63
  ```bash
@@ -43,7 +72,7 @@ pnpm run dev
43
72
 
44
73
  | Package | Role |
45
74
  |---------|------|
46
- | `@rebasepro/server-core` | Backend framework used by `dev` and `start` |
47
- | `@rebasepro/server-postgresql` | PostgreSQL driver used by schema/db commands |
48
- | `@rebasepro/sdk-generator` | Powers `generate-sdk` |
75
+ | `@rebasepro/server` | Backend framework used by `dev` and `start` |
76
+ | `@rebasepro/server-postgres` | PostgreSQL driver used by schema/db commands |
77
+ | `@rebasepro/codegen` | Powers `generate-sdk` |
49
78
  | `@rebasepro/types` | Shared type definitions |
package/bin/rebase.js CHANGED
@@ -1,4 +1,70 @@
1
1
  #!/usr/bin/env node
2
- import { entry } from "../dist/index.es.js";
2
+ import { existsSync, readdirSync, statSync } from "node:fs";
3
+ import { dirname, join } from "node:path";
4
+ import { fileURLToPath } from "node:url";
5
+
6
+ const here = dirname(fileURLToPath(import.meta.url));
7
+ const distEntry = join(here, "..", "dist", "index.es.js");
8
+ const srcDir = join(here, "..", "src");
9
+
10
+ /**
11
+ * Warn when the built CLI is older than the source it was built from.
12
+ *
13
+ * `rebase` runs `dist/`, and a global install of this package is usually a
14
+ * symlink to a working checkout — so every agent and shell on the machine runs
15
+ * whatever was last built, not what is in the code. A stale build is invisible:
16
+ * the command works, it just silently lacks the subcommand you added, which
17
+ * reads as "my change did nothing" rather than "you forgot to build".
18
+ *
19
+ * Development-only by construction: `src/` is not in the published `files`
20
+ * list, so this is skipped entirely for installed copies.
21
+ *
22
+ * Writes to **stderr**. Agents parse stdout as JSON under `--json`, and a
23
+ * warning there would corrupt the one guarantee those commands make.
24
+ */
25
+ function newestMtimeMs(dir, deadline) {
26
+ let newest = 0;
27
+ for (const entry of readdirSync(dir, { withFileTypes: true })) {
28
+ if (Date.now() > deadline) break; // never let a warning cost real time
29
+ if (entry.name === "node_modules" || entry.name.startsWith(".")) continue;
30
+ const full = join(dir, entry.name);
31
+ if (entry.isDirectory()) {
32
+ newest = Math.max(newest, newestMtimeMs(full, deadline));
33
+ } else if (/\.tsx?$/.test(entry.name) && !/\.(test|spec)\.tsx?$/.test(entry.name)) {
34
+ // Tests are not bundled, so editing one does not make dist stale.
35
+ // Counting them cried wolf on the ordinary edit-test-run loop.
36
+ newest = Math.max(newest, statSync(full).mtimeMs);
37
+ }
38
+ }
39
+ return newest;
40
+ }
41
+
42
+ function warnIfStale() {
43
+ if (!existsSync(srcDir) || !existsSync(distEntry)) return;
44
+ const builtAt = statSync(distEntry).mtimeMs;
45
+ const editedAt = newestMtimeMs(srcDir, Date.now() + 150);
46
+ // A couple of seconds of slack: a build writes dist while src is being
47
+ // stat'd, and a sub-second delta is that race, not a stale build.
48
+ const staleByMs = editedAt - builtAt;
49
+ if (staleByMs <= 2000) return;
50
+
51
+ const seconds = Math.round(staleByMs / 1000);
52
+ const ago = seconds >= 3600
53
+ ? `${Math.round(seconds / 3600)}h`
54
+ : seconds >= 60 ? `${Math.round(seconds / 60)}m` : `${seconds}s`;
55
+ process.stderr.write(
56
+ `⚠ rebase CLI: dist/ is ${ago} older than src/ — you are running a stale build.\n` +
57
+ ` Rebuild with: (cd ${join(here, "..")} && npm run build)\n`
58
+ );
59
+ }
60
+
61
+ // A broken staleness check must never stop the CLI from running.
62
+ try {
63
+ warnIfStale();
64
+ } catch {
65
+ /* ignore */
66
+ }
67
+
68
+ const { entry } = await import("../dist/index.es.js");
3
69
 
4
70
  entry(process.argv);
@@ -0,0 +1,3 @@
1
+ export declare function loginCommand(rawArgs: string[]): Promise<void>;
2
+ export declare function logoutCommand(rawArgs: string[]): Promise<void>;
3
+ export declare function whoamiCommand(rawArgs: string[]): Promise<void>;
@@ -0,0 +1,151 @@
1
+ import { createRebaseClient } from "@rebasepro/client";
2
+ /** Project-local link file: <project>/.rebase/cloud.json */
3
+ export declare function projectLinkPath(cwd?: string): string;
4
+ /** Persist the active organization id for a host. */
5
+ export declare function setContextOrg(url: string, org: string | undefined): void;
6
+ export declare function getContextOrg(url: string): string | undefined;
7
+ /** Mark a host as the active context (called on login). */
8
+ export declare function setCurrentContext(url: string): void;
9
+ export declare function resolveCloudUrl(rawArgs: string[]): string;
10
+ export type CloudClient = ReturnType<typeof createRebaseClient>;
11
+ /**
12
+ * Build an SDK client bound to a control-plane host, backed by the on-disk
13
+ * credential store. `autoRefresh` is disabled so we never leave a dangling
14
+ * setTimeout that keeps the CLI process alive; token refresh is done on demand
15
+ * by `requireClient`.
16
+ */
17
+ export declare function createCloudClient(url: string): CloudClient;
18
+ /**
19
+ * Return an authenticated client for the resolved host, refreshing the access
20
+ * token if it is close to expiry. Exits with a helpful message when there is no
21
+ * usable session (never logged in, or the refresh token was revoked).
22
+ */
23
+ export declare function requireClient(rawArgs: string[]): Promise<{
24
+ client: CloudClient;
25
+ url: string;
26
+ }>;
27
+ export declare function fetchTenantBaseDomain(client: CloudClient, url: string): Promise<string | undefined>;
28
+ /**
29
+ * Public host for a project — `<subdomain>.<base>`, or the bare subdomain when
30
+ * the base domain is unknown.
31
+ *
32
+ * It deliberately never falls back to a guessed domain. The user copies this
33
+ * string into a browser, so a plausible-but-wrong hostname is worse than an
34
+ * obviously incomplete one: `acme.rebase.pro` looks reachable and isn't, while
35
+ * `acme` reads as "the subdomain is acme" and prompts no wasted debugging.
36
+ */
37
+ export declare function formatTenantHost(subdomain: string | undefined, baseDomain: string | undefined): string | undefined;
38
+ /** The fields of a project row this module needs to render a host. */
39
+ export interface HostableProject {
40
+ subdomain?: string;
41
+ /** Resolved server-side; absent on control planes older than the host hook. */
42
+ host?: string;
43
+ }
44
+ /**
45
+ * The host to display for a project.
46
+ *
47
+ * Prefers `host` off the record: the control plane resolves it through the same
48
+ * `tenantHost()` the ingress uses, so it accounts for the project's *cluster*
49
+ * base domain. The CLI cannot compute that itself — `clusters` is admin-only
50
+ * under RLS, so a normal user's token cannot read `baseDomain`, and a project on
51
+ * a second cluster is served somewhere the platform default does not name.
52
+ *
53
+ * `baseDomain` (from `platform-config`) remains the fallback for a control plane
54
+ * that predates the hook — right for the single-cluster case, which is every
55
+ * project today.
56
+ */
57
+ export declare function projectHost(project: HostableProject, baseDomain: string | undefined): string | undefined;
58
+ export interface ProjectLink {
59
+ url: string;
60
+ projectId: string;
61
+ /** The project's subdomain — the slug users see in console URLs and type into --project. */
62
+ slug?: string;
63
+ projectName?: string;
64
+ orgId?: string;
65
+ }
66
+ export declare function readLink(cwd?: string): ProjectLink | null;
67
+ export declare function writeLink(link: ProjectLink, cwd?: string): void;
68
+ export declare function removeLink(cwd?: string): boolean;
69
+ /**
70
+ * The raw project reference to operate on: explicit `--project` flag wins,
71
+ * otherwise the linked project. Exits with guidance when neither is present.
72
+ * The value is a slug (the project's subdomain, as shown in console URLs) or,
73
+ * for old scripts and link files, a raw project UUID.
74
+ */
75
+ export declare function requireProjectRef(rawArgs: string[]): string;
76
+ /**
77
+ * Resolve a project reference — slug or UUID — to the internal id the API
78
+ * takes, or undefined when no such project is visible. Slugs cost one lookup;
79
+ * UUIDs pass through untouched so linked directories and old scripts skip the
80
+ * round-trip.
81
+ */
82
+ export declare function lookupProjectId(ref: string, client: CloudClient): Promise<string | undefined>;
83
+ /** Like `lookupProjectId`, but exits with guidance when the ref matches nothing. */
84
+ export declare function resolveProjectRef(ref: string, client: CloudClient): Promise<string>;
85
+ /** `requireProjectRef` + `resolveProjectRef` in one step. */
86
+ export declare function requireProject(rawArgs: string[], client: CloudClient): Promise<string>;
87
+ /**
88
+ * The project reference to SHOW: the slug the user typed or the linked slug.
89
+ * Never resolves — for human output only. Old link files predate `slug` and
90
+ * fall back to the stored id.
91
+ */
92
+ export declare function displayProjectRef(rawArgs: string[]): string;
93
+ /**
94
+ * Resolve and latch the output mode for this invocation. Call once at the top of
95
+ * `cloudCommand`, before anything can print or `fail`. Returns the resolved mode
96
+ * (handy for tests, which otherwise leave it at its `false` default).
97
+ */
98
+ export declare function initOutputMode(rawArgs: string[]): boolean;
99
+ /** Whether the current invocation is emitting machine-readable JSON. */
100
+ export declare function isJsonMode(): boolean;
101
+ /** Force the mode (tests only — production latches it via `initOutputMode`). */
102
+ export declare function setJsonModeForTest(value: boolean): void;
103
+ /**
104
+ * The one output primitive every new command uses: in JSON mode emit `json`
105
+ * (and nothing else); otherwise run `human`. Keeping the two behind a single
106
+ * call is what guarantees a command can never print a table AND a JSON blob.
107
+ */
108
+ export declare function emit(human: () => void, json: unknown): void;
109
+ /** Print an error (+ optional hint) and exit non-zero. Never returns. */
110
+ export declare function fail(message: string, hint?: string, code?: string): never;
111
+ /**
112
+ * Confirm a destructive/irreversible action, respecting non-interactive use.
113
+ *
114
+ * With `--yes`/`-y` it proceeds silently. In JSON mode or a non-TTY it REFUSES
115
+ * to prompt — a prompt that can hang is a known repo landmine — and fails,
116
+ * telling the caller to pass `--yes`. Only an interactive terminal gets a real
117
+ * confirm prompt; declining there aborts cleanly (exit 0).
118
+ */
119
+ export declare function confirmDestructive(opts: {
120
+ yes: boolean;
121
+ prompt: string;
122
+ }): Promise<void>;
123
+ /**
124
+ * Positional tokens after `rebase cloud` — `[group, action, arg1, …]`.
125
+ *
126
+ * Deliberately NOT `arg({}, { permissive: true })._`: in permissive mode `arg`
127
+ * pushes UNKNOWN FLAGS onto `_` too, so `rollback --yes --json` would report
128
+ * `--yes` as the deployment id. Operand extraction must see operands only, so
129
+ * anything starting with `-` is dropped — the same filter the db backup handler
130
+ * has always used.
131
+ */
132
+ export declare function cloudPositionals(rawArgs: string[]): string[];
133
+ export declare function success(message: string): void;
134
+ /** Colorize a deployment / resource status token. */
135
+ export declare function colorStatus(status: string | undefined): string;
136
+ /**
137
+ * Render a two-column key/value block with aligned keys. Empty rows are skipped
138
+ * — including `null`, which the API sends for an unset column and which used to
139
+ * print the literal string "null" (e.g. `Custom domain: null`).
140
+ */
141
+ export declare function keyValues(rows: Array<[string, string | null | undefined]>): void;
142
+ /**
143
+ * Surface an SDK/HTTP error consistently. The SDK throws RebaseApiError with
144
+ * a `.status` and `.message`; anything else falls back to its string form.
145
+ */
146
+ export declare function reportError(e: unknown, context: string): never;
147
+ /**
148
+ * Open a URL in the user's default browser (best effort). Always prints the URL
149
+ * first so it stays usable over SSH or when no browser is available.
150
+ */
151
+ export declare function openUrl(target: string, label?: string): void;
@@ -0,0 +1 @@
1
+ export declare function dbCommand(subcommand: string | undefined, rawArgs: string[]): Promise<void>;
@@ -0,0 +1,117 @@
1
+ /** How a probe's outcome should be read. */
2
+ export type Verdict =
3
+ /** Behaving as a healthy deployment should. */
4
+ "ok"
5
+ /** Reachable and legal, but worth a human look (e.g. a public read). */
6
+ | "warn"
7
+ /** Broken, or wired up wrong. */
8
+ | "fail"
9
+ /** We could not classify the response. */
10
+ | "unknown";
11
+ export interface ProbeReading {
12
+ verdict: Verdict;
13
+ /** What this status code *means for this endpoint*, in one sentence. */
14
+ meaning: string;
15
+ }
16
+ export interface ProbeSpec {
17
+ id: string;
18
+ /** Column label in human output. */
19
+ label: string;
20
+ method: "GET" | "POST";
21
+ /** Path relative to the project origin. */
22
+ path: (opts: ProbeTargets) => string;
23
+ body?: unknown;
24
+ /** One-line statement of what a healthy deployment answers here. */
25
+ healthy: string;
26
+ interpret: (status: number | null) => ProbeReading;
27
+ /**
28
+ * Read the response body as well. Set only where the body carries a fact the
29
+ * status code cannot — today, the function listing.
30
+ */
31
+ needsBody?: boolean;
32
+ /**
33
+ * Sharpen the status-code reading using the parsed body. Returning null
34
+ * keeps {@link interpret}'s verdict.
35
+ */
36
+ refine?: (body: unknown, targets: ProbeTargets) => ProbeReading | null;
37
+ }
38
+ export interface ProbeTargets {
39
+ /** Collection used for the unauthenticated-read probe. */
40
+ collection: string;
41
+ /** Function to confirm exists, if the caller named one. */
42
+ fn?: string;
43
+ }
44
+ /**
45
+ * The probe set, in the order a failure cascades: if `health` is down, nothing
46
+ * below it is meaningful, so it is checked first and reported first.
47
+ */
48
+ export declare const PROBES: ProbeSpec[];
49
+ /** The function names out of a listing body, or null when it is not one. */
50
+ export declare function functionNames(body: unknown): string[] | null;
51
+ export interface ProbeResult {
52
+ id: string;
53
+ label: string;
54
+ method: string;
55
+ url: string;
56
+ status: number | null;
57
+ ms: number;
58
+ verdict: Verdict;
59
+ meaning: string;
60
+ healthy: string;
61
+ /**
62
+ * Whether the STATUS CODE alone looked healthy. False means the code itself
63
+ * was wrong; true with a failing `verdict` means the code was fine and the
64
+ * body carried the bad news (a named function that did not load). The
65
+ * summary uses this so it never tells you to expect a 200 you already got.
66
+ */
67
+ statusOk: boolean;
68
+ }
69
+ /**
70
+ * Run one probe. A transport failure is a `null` status, never a thrown error:
71
+ * "nothing answered" is a diagnosis in its own right and the other probes still
72
+ * need to run.
73
+ */
74
+ export declare function runProbe(origin: string, spec: ProbeSpec, targets: ProbeTargets): Promise<ProbeResult>;
75
+ /** The worst verdict across probes — what the command's exit code keys off. */
76
+ export declare function overallVerdict(results: ProbeResult[]): Verdict;
77
+ export interface ParsedLogLine {
78
+ ts: string | null;
79
+ pod: string | null;
80
+ text: string;
81
+ }
82
+ export declare function parseLogLine(line: string): ParsedLogLine;
83
+ /**
84
+ * Lines an operator scanning for a fault wants to see.
85
+ *
86
+ * Matches the structured `severity` field first, then the shapes that show up
87
+ * in unstructured output. `refus`/`denied` are in the list because a permission
88
+ * failure often logs at info level and is exactly what one is hunting for.
89
+ */
90
+ export declare function isErrorLine(text: string): boolean;
91
+ export interface RequestLogEntry {
92
+ status: number | null;
93
+ method: string;
94
+ path: string;
95
+ latencyMs: number | null;
96
+ }
97
+ /**
98
+ * Pull an HTTP request record out of a log line, or null when it is not one.
99
+ *
100
+ * Only structured request lines are recognised. Guessing at prose would produce
101
+ * a table with invented columns, which is worse than a short one.
102
+ */
103
+ export declare function parseRequestLine(text: string): RequestLogEntry | null;
104
+ /**
105
+ * Startup lines: what the server *decided* it was going to do. Which storage
106
+ * backend it bound, which functions it loaded, whether auth tables were found.
107
+ * This is the fastest way to tell a misconfiguration from a runtime fault.
108
+ */
109
+ export declare function isBootLine(text: string): boolean;
110
+ /** Render a number of seconds back as the compact duration a user would type. */
111
+ export declare function formatDuration(seconds: number): string;
112
+ /**
113
+ * Parse a duration like `15m`, `2h`, `90s`, `1d` (or a bare number of seconds)
114
+ * into seconds. Returns null when it is not a duration.
115
+ */
116
+ export declare function parseSince(input: string | undefined): number | null;
117
+ export declare function debugCommand(action: string | undefined, rawArgs: string[]): Promise<void>;
@@ -0,0 +1,2 @@
1
+ export declare function deployCommand(rawArgs: string[], projectRef: string): Promise<void>;
2
+ export declare function logsCommand(rawArgs: string[], projectRef: string): Promise<void>;
@@ -0,0 +1,38 @@
1
+ /** A deployment row, as the data API hands it back (camel or snake columns). */
2
+ export interface DeploymentRow {
3
+ id: string | number;
4
+ status?: string;
5
+ createdAt?: string | Date;
6
+ created_at?: string | Date;
7
+ finishedAt?: string | Date;
8
+ finished_at?: string | Date;
9
+ imageUrl?: string;
10
+ image_url?: string;
11
+ rollbackOf?: string;
12
+ rollback_of?: string;
13
+ triggeredBy?: string;
14
+ triggered_by?: string;
15
+ triggerSource?: string;
16
+ trigger_source?: string;
17
+ triggeredByUserId?: string;
18
+ triggered_by_user_id?: string;
19
+ gitCommitHash?: string;
20
+ gitCommitMessage?: string;
21
+ }
22
+ /**
23
+ * The backend's rule EXACTLY: a rollback is honoured only for a successful
24
+ * deploy that recorded an image. Any other row 409s `deploy_not_rollbackable`.
25
+ */
26
+ export declare function isRollbackable(dep: DeploymentRow): boolean;
27
+ /** finishedAt − createdAt in ms, or null (still running / missing / skewed). */
28
+ export declare function deploymentDurationMs(dep: DeploymentRow): number | null;
29
+ export declare function triggerInfo(dep: DeploymentRow): {
30
+ by: string;
31
+ source: string;
32
+ userId: string;
33
+ };
34
+ /** Shape one deployment row into the stable JSON view the CLI publishes. */
35
+ export declare function deploymentView(dep: DeploymentRow): Record<string, unknown>;
36
+ export declare function deploymentsListCommand(rawArgs: string[]): Promise<void>;
37
+ export declare function rollbackCommand(rawArgs: string[]): Promise<void>;
38
+ export declare function cancelCommand(rawArgs: string[]): Promise<void>;
@@ -0,0 +1 @@
1
+ export declare function domainsCommand(action: string | undefined, rawArgs: string[]): Promise<void>;
@@ -0,0 +1,6 @@
1
+ export declare function envCommand(action: string | undefined, rawArgs: string[]): Promise<void>;
2
+ /** Parse `KEY=VALUE` or `KEY VALUE` from the positional operands. */
3
+ export declare function parseEnvAssignment(operands: string[]): {
4
+ key: string;
5
+ value: string;
6
+ } | null;
@@ -0,0 +1,3 @@
1
+ /** The identifier CREATE EXTENSION takes. `pgvector` is a common alias. */
2
+ export declare function resolveExtensionAlias(name: string): string;
3
+ export declare function extensionsCommand(action: string | undefined, rawArgs: string[]): Promise<void>;
@@ -0,0 +1 @@
1
+ export declare function cloudCommand(subcommand: string | undefined, rawArgs: string[]): Promise<void>;
@@ -0,0 +1,5 @@
1
+ export declare function linkCommand(rawArgs: string[]): Promise<void>;
2
+ export declare function unlinkCommand(): void;
3
+ export declare function selectOrgCommand(rawArgs: string[]): Promise<void>;
4
+ /** Open the Rebase Cloud dashboard (or the linked project) in a browser. */
5
+ export declare function openCommand(rawArgs: string[]): void;
@@ -0,0 +1 @@
1
+ export declare function orgsCommand(subcommand: string | undefined, rawArgs: string[]): Promise<void>;
@@ -0,0 +1,3 @@
1
+ type PowerAction = "start" | "stop" | "restart";
2
+ export declare function powerCommand(action: PowerAction, rawArgs: string[]): Promise<void>;
3
+ export {};
@@ -0,0 +1,13 @@
1
+ import { type CloudClient } from "./context";
2
+ export declare function listProjects(rawArgs: string[]): Promise<void>;
3
+ export declare function createProject(rawArgs: string[]): Promise<void>;
4
+ export declare function projectInfo(rawArgs: string[], projectRef: string): Promise<void>;
5
+ export declare function deleteProject(rawArgs: string[], projectRef: string): Promise<void>;
6
+ export declare function firstRow(client: CloudClient, collection: string, projectId: string): Promise<Record<string, unknown> | undefined>;
7
+ export declare function latestDeployment(client: CloudClient, projectId: string): Promise<{
8
+ id: string | number;
9
+ status?: string;
10
+ createdAt?: string;
11
+ logs?: string;
12
+ } | undefined>;
13
+ export declare function fmtDate(value: string | undefined): string;
@@ -0,0 +1,6 @@
1
+ export declare function statusCommand(rawArgs: string[]): Promise<void>;
2
+ export declare function metricsCommand(rawArgs: string[]): Promise<void>;
3
+ export declare function webhooksCommand(subcommand: string | undefined, rawArgs: string[]): Promise<void>;
4
+ export declare function storageCommand(action: string | undefined, rawArgs: string[]): Promise<void>;
5
+ export declare function clustersCommand(rawArgs: string[]): Promise<void>;
6
+ export declare function billingCommand(rawArgs: string[]): Promise<void>;
@@ -0,0 +1,8 @@
1
+ export declare function settingsCommand(action: string | undefined, rawArgs: string[]): Promise<void>;
2
+ /** Build the update patch from the flags actually supplied (pure/testable). */
3
+ export declare function buildSettingsPatch(args: {
4
+ name?: string;
5
+ subdomain?: string;
6
+ repo?: string;
7
+ branch?: string;
8
+ }): Record<string, string>;
@@ -1,5 +1,19 @@
1
1
  import type { PackageManager, PMCommands } from "../utils/package-manager";
2
+ /** Returns an error message, or null when the name is a valid package name. */
3
+ export declare function validateProjectName(name: string): string | null;
2
4
  export type TemplatePreset = "blog" | "ecommerce" | "blank";
5
+ /**
6
+ * How much of Rebase to scaffold.
7
+ *
8
+ * `cms` is the full triad (config + backend + frontend). `baas` is the backend
9
+ * alone, serving the database over REST with no collection files and no UI.
10
+ */
11
+ /**
12
+ * `cms` scaffolds BaaS + the admin UI; `baas` scaffolds the API alone. The
13
+ * values match `RebaseBackendConfig.mode`, which is what the generated backend
14
+ * sets — the labels below are what users actually read.
15
+ */
16
+ export type TemplateFlavor = "cms" | "baas";
3
17
  export interface InitOptions {
4
18
  projectName: string;
5
19
  git: boolean;
@@ -10,14 +24,23 @@ export interface InitOptions {
10
24
  introspect?: boolean;
11
25
  /** Starter template preset. */
12
26
  preset: TemplatePreset;
27
+ /** Which parts of Rebase to scaffold. */
28
+ flavor: TemplateFlavor;
13
29
  /** Detected package manager (pnpm or npm). */
14
30
  pm: PackageManager;
15
31
  /** Command helpers for the detected PM. */
16
32
  pmCommands: PMCommands;
33
+ /** Cloud project slug (its subdomain) to link the scaffold to. */
34
+ cloudProject?: string;
35
+ /** One-time setup key that authenticates the cloud link. */
36
+ setupKey?: string;
37
+ /** Control-plane URL the setup key is redeemed against. */
38
+ cloudUrl?: string;
17
39
  }
18
40
  export interface BuildQuestionsParams {
19
41
  nameArg?: string;
20
42
  templateArg?: TemplatePreset;
43
+ flavorArg?: TemplateFlavor;
21
44
  hasGitFlag: boolean;
22
45
  hasInstallFlag: boolean;
23
46
  pm: PackageManager;
@@ -1 +1 @@
1
- export declare function skillsCommand(subcommand: string | undefined, _args: string[]): Promise<void>;
1
+ export declare function skillsCommand(subcommand: string | undefined, rawArgs: string[]): Promise<void>;
package/dist/index.d.ts CHANGED
@@ -8,5 +8,6 @@ export * from "./commands/start";
8
8
  export * from "./commands/auth";
9
9
  export * from "./commands/doctor";
10
10
  export * from "./commands/generate_sdk";
11
+ export * from "./commands/cloud";
11
12
  export * from "./utils/project";
12
13
  export * from "./utils/package-manager";