@rebasepro/cli 0.26.0 → 0.28.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/dist/{agent-setup-D9mHRZ5R.js → agent-setup-0uyfC7VX.js} +3 -3
  2. package/dist/{agent-setup-D9mHRZ5R.js.map → agent-setup-0uyfC7VX.js.map} +1 -1
  3. package/dist/{api-keys-CyJ26KEJ.js → api-keys-Dfw5-9s1.js} +23 -2
  4. package/dist/{api-keys-CyJ26KEJ.js.map → api-keys-Dfw5-9s1.js.map} +1 -1
  5. package/dist/{apps-CnLDV5b6.js → apps-BpYRGOaM.js} +3 -3
  6. package/dist/{apps-CnLDV5b6.js.map → apps-BpYRGOaM.js.map} +1 -1
  7. package/dist/{auth-dII2jCO1.js → auth-DifFaOyq.js} +2 -2
  8. package/dist/{auth-dII2jCO1.js.map → auth-DifFaOyq.js.map} +1 -1
  9. package/dist/{build-Cza7ZQrp.js → build-CS-Z75eK.js} +10 -10
  10. package/dist/build-CS-Z75eK.js.map +1 -0
  11. package/dist/{bundle-C6yEtMJ-.js → bundle-C0IBCVpV.js} +124 -22
  12. package/dist/bundle-C0IBCVpV.js.map +1 -0
  13. package/dist/bundle.d.ts +25 -11
  14. package/dist/{cloud-BdnmqQaZ.js → cloud-nwWkzAHu.js} +381 -47
  15. package/dist/cloud-nwWkzAHu.js.map +1 -0
  16. package/dist/commands/agent-setup.d.ts +2 -0
  17. package/dist/commands/cloud/auth.d.ts +13 -0
  18. package/dist/commands/cloud/bundle-deploy.d.ts +8 -15
  19. package/dist/commands/cloud/context.d.ts +18 -0
  20. package/dist/commands/cloud/guests.d.ts +11 -0
  21. package/dist/commands/cloud/index.d.ts +1 -0
  22. package/dist/commands/cloud/projects.d.ts +4 -0
  23. package/dist/commands/cloud/resources.d.ts +22 -0
  24. package/dist/commands/dev.d.ts +12 -0
  25. package/dist/commands/doctor.d.ts +10 -0
  26. package/dist/commands/schema-reconcile.d.ts +9 -0
  27. package/dist/commands/skills.d.ts +3 -0
  28. package/dist/{context-GUxkZm-S.js → context-DvIUbE-b.js} +39 -5
  29. package/dist/context-DvIUbE-b.js.map +1 -0
  30. package/dist/{dev-DTqVMgB3.js → dev-CzOazEHW.js} +17 -3
  31. package/dist/dev-CzOazEHW.js.map +1 -0
  32. package/dist/{doctor-BRWOlqeG.js → doctor-BuqSHNrd.js} +45 -26
  33. package/dist/doctor-BuqSHNrd.js.map +1 -0
  34. package/dist/doctor-environment.d.ts +7 -19
  35. package/dist/{fold-static-BnAK-anQ.js → fold-static-BMO8LC01.js} +3 -3
  36. package/dist/fold-static-BMO8LC01.js.map +1 -0
  37. package/dist/{generate_sdk-BvcWvoUh.js → generate_sdk-_SQuSbJW.js} +2 -2
  38. package/dist/{generate_sdk-BvcWvoUh.js.map → generate_sdk-_SQuSbJW.js.map} +1 -1
  39. package/dist/index.es.js +24 -24
  40. package/dist/index.es.js.map +1 -1
  41. package/dist/{init-CaU6GhwI.js → init-CHtpYLlh.js} +5 -4
  42. package/dist/init-CHtpYLlh.js.map +1 -0
  43. package/dist/{normalize-imports-D0zXlM6g.js → normalize-imports-BN0fzZS8.js} +2 -2
  44. package/dist/{normalize-imports-D0zXlM6g.js.map → normalize-imports-BN0fzZS8.js.map} +1 -1
  45. package/dist/schema-2A0dd-Bv.js +321 -0
  46. package/dist/schema-2A0dd-Bv.js.map +1 -0
  47. package/dist/schema-reconcile-C3ToVnHr.js +2 -0
  48. package/dist/{skills-BU2flMOy.js → skills-CbwV6vw_.js} +170 -5
  49. package/dist/skills-CbwV6vw_.js.map +1 -0
  50. package/dist/{start-mVb6upwY.js → start-21GRsZKc.js} +2 -2
  51. package/dist/{start-mVb6upwY.js.map → start-21GRsZKc.js.map} +1 -1
  52. package/dist/{storage-DtOXGflp.js → storage-CO9ouK76.js} +2 -2
  53. package/dist/{storage-DtOXGflp.js.map → storage-CO9ouK76.js.map} +1 -1
  54. package/dist/utils/bundle-lock.d.ts +9 -0
  55. package/dist/utils/libpq-url.d.ts +8 -0
  56. package/dist/utils/root-pointer.d.ts +43 -0
  57. package/package.json +8 -8
  58. package/templates/overlays/baas/README.md +2 -2
  59. package/templates/overlays/baas/ai-instructions.md +3 -2
  60. package/templates/overlays/baas/package.json +1 -0
  61. package/templates/overlays/baas/pnpm-workspace.yaml +4 -0
  62. package/templates/template/.cursorrules +10 -0
  63. package/templates/template/.env.example +1 -1
  64. package/templates/template/.github/copilot-instructions.md +10 -0
  65. package/templates/template/.windsurfrules +10 -0
  66. package/templates/template/AGENTS.md +10 -0
  67. package/templates/template/CLAUDE.md +10 -0
  68. package/templates/template/ai-instructions.md +5 -4
  69. package/templates/template/pnpm-workspace.yaml +4 -1
  70. package/dist/build-Cza7ZQrp.js.map +0 -1
  71. package/dist/bundle-C6yEtMJ-.js.map +0 -1
  72. package/dist/cloud-BdnmqQaZ.js.map +0 -1
  73. package/dist/context-GUxkZm-S.js.map +0 -1
  74. package/dist/dev-DTqVMgB3.js.map +0 -1
  75. package/dist/doctor-BRWOlqeG.js.map +0 -1
  76. package/dist/fold-static-BnAK-anQ.js.map +0 -1
  77. package/dist/init-CaU6GhwI.js.map +0 -1
  78. package/dist/schema-BSXwZSiI.js +0 -152
  79. package/dist/schema-BSXwZSiI.js.map +0 -1
  80. package/dist/skills-BU2flMOy.js.map +0 -1
@@ -141,6 +141,8 @@ export interface HookWriteResult {
141
141
  file: string;
142
142
  status: HookWriteStatus;
143
143
  }
144
+ /** The CLI package's own directory, from wherever this module was bundled to. */
145
+ export declare function cliPackageRoot(): string;
144
146
  /**
145
147
  * The SHA-256 of every version of `post-edit-collection.sh` this CLI has ever
146
148
  * written, oldest first, the current one last — hashed with CRLF read as LF,
@@ -40,3 +40,16 @@ export declare function passwordOnTheCommandLine(args: {
40
40
  export declare function loginCommand(rawArgs: string[]): Promise<void>;
41
41
  export declare function logoutCommand(rawArgs: string[]): Promise<void>;
42
42
  export declare function whoamiCommand(rawArgs: string[]): Promise<void>;
43
+ /**
44
+ * `rebase cloud access-token` — the bearer this CLI would send right now.
45
+ *
46
+ * For tools that reach the control plane on a person's behalf without a second
47
+ * login: the MCP server reads a project's data through the console's Studio
48
+ * proxy with it, so whoever is signed in to Rebase Cloud reaches every project
49
+ * their organizations hold, and no service key leaves the control plane. It is
50
+ * the same credential `requireClient` resolves — `REBASE_TOKEN`, the token
51
+ * `init --claim` stored for a linked project, or the login, refreshed first when
52
+ * it is close to expiry — so the control plane checks it exactly as it checks
53
+ * this CLI. The token is printed bare, so `$(rebase cloud access-token)` works.
54
+ */
55
+ export declare function accessTokenCommand(rawArgs: string[]): Promise<void>;
@@ -18,23 +18,16 @@ export declare function packBundle(bundleDir: string, outPath: string, options?:
18
18
  withModules?: boolean;
19
19
  }): Promise<void>;
20
20
  /**
21
- * Pack a bundle for upload — without `node_modules`, even a vendored tree.
21
+ * Pack a bundle for upload, with the dependency tree the build vendored for it.
22
22
  *
23
- * Vendoring exists so a pod untars and boots rather than spending 35-55s of
24
- * every start in `npm install`, and a deploy did carry the tree for one night
25
- * (c36ea4637). It is left out again because of what the control plane does
26
- * with the archive: `GET /bundle/:projectId/:bundleId` reads the whole object
27
- * into memory on every pod start, and a runtime rollout restarts every tenant's
28
- * pods at once. Bundles it was sized against are a few hundred kB; a vendored
29
- * one is tens of MB, up to the 100 MB cap — N pods starting together would hold
30
- * N of them. A slower cold start per pod is the status quo every deploy has
31
- * shipped with; a control plane out of memory is every tenant's outage. The
32
- * platform's own rebuilds build with `--no-vendor` for the same shape of
33
- * reason. When the control plane streams bundles, this is the one switch to
34
- * flip, and `rebase cloud deploy` builds with `vendor: false` until then.
23
+ * Vendoring is what lets a pod untar and boot rather than spending 35-55s of
24
+ * every start in `npm install`, which is the bulk of a new instance's time to
25
+ * ready. The control plane streams an archive in both directions, so its size
26
+ * costs that process nothing.
35
27
  *
36
- * `modulesLeftOut` says a tree the build DID vendor was not uploaded — a
37
- * prebuilt `--bundle-dir` from a plain `rebase build`, which vendors by default.
28
+ * A vendored tree that takes the archive over the cap is left out rather than
29
+ * failing the deploy: a bundle without its dependencies still boots, only more
30
+ * slowly. `modulesLeftOut` says that happened.
38
31
  */
39
32
  export declare function packBundleForUpload(bundleDir: string, outPath: string, manifest: RebaseBundleManifest, maxBytes?: number): Promise<{
40
33
  bytes: number;
@@ -706,6 +706,24 @@ export declare function keyValues(rows: Array<[string, string | null | undefined
706
706
  * cannot corrupt the JSON value on stdout.
707
707
  */
708
708
  export declare function reportError(e: unknown, context: string): never;
709
+ /**
710
+ * The program, and its argv, that hands `target` to the default browser on
711
+ * `platform` — or null when `target` is not an http(s) URL, which is left for
712
+ * the reader to open by hand.
713
+ *
714
+ * No shell is involved on any platform. `start` is a `cmd.exe` builtin, so it
715
+ * can only be reached through one, and `cmd.exe` reads `&`, `|` and `^` in its
716
+ * command line as operators: through it, `start https://x/?a=1&b=2` opens
717
+ * `?a=1` and runs `b=2` as a second command, and a URL the control plane
718
+ * returns can run anything. `rundll32 url.dll,FileProtocolHandler` is the shell's own URL
719
+ * handler as a plain program. The URL travels as its serialized `href`, which
720
+ * percent-encodes spaces and quotes, so it stays one argument through
721
+ * Windows' command-line quoting too.
722
+ */
723
+ export declare function browserOpener(target: string, platform: NodeJS.Platform): {
724
+ command: string;
725
+ args: string[];
726
+ } | null;
709
727
  /**
710
728
  * Open a URL in the user's default browser (best effort). Always announces the
711
729
  * URL first so it stays usable over SSH or when no browser is available.
@@ -0,0 +1,11 @@
1
+ export declare const GUESTS_FLAGS: {
2
+ readonly "--limit": StringConstructor;
3
+ readonly "--older-than": StringConstructor;
4
+ };
5
+ export declare const GUESTS_ACTIONS: readonly ["delete", "prune"];
6
+ /**
7
+ * `30d` as milliseconds, or undefined. A unit is required and the age cannot be
8
+ * zero: `--older-than 30` is a typo for something, and `0d` would be everyone.
9
+ */
10
+ export declare function parseAge(value: string): number | undefined;
11
+ export declare function guestsCommand(rawArgs: string[]): Promise<void>;
@@ -58,6 +58,7 @@ export declare const CLOUD_VALUE_FLAGS: {
58
58
  readonly "--message": StringConstructor;
59
59
  readonly "--month": StringConstructor;
60
60
  readonly "--name": StringConstructor;
61
+ readonly "--older-than": StringConstructor;
61
62
  readonly "--org": StringConstructor;
62
63
  readonly "--output": StringConstructor;
63
64
  readonly "--password": StringConstructor;
@@ -1,4 +1,8 @@
1
1
  import { type DeployTarget, type CloudClient } from "./context.js";
2
+ /** Documented in `action-help.ts`, and paired with it by `action-help.test.ts`. */
3
+ export declare const LIST_PROJECTS_FLAGS: {
4
+ readonly "--all-orgs": BooleanConstructor;
5
+ };
2
6
  export declare function listProjects(rawArgs: string[]): Promise<void>;
3
7
  /**
4
8
  * Where this project says it runs.
@@ -92,6 +92,28 @@ export declare function describeRuntime(project: {
92
92
  runtimeVersionPin?: string | null;
93
93
  }): string;
94
94
  export declare function statusCommand(rawArgs: string[]): Promise<void>;
95
+ /** What `/api/functions/metrics/:projectId/realtime` returns. Mirrors saas metrics.ts. */
96
+ interface TenantRealtime {
97
+ /** `null` when the instances could not be listed. */
98
+ instances?: {
99
+ name?: string;
100
+ /** `null` when this instance could not be asked, or its runtime does not report these. */
101
+ realtime?: {
102
+ sockets?: number;
103
+ channels?: number;
104
+ busFramesPublished?: number;
105
+ busFramesSkipped?: number;
106
+ } | null;
107
+ }[] | null;
108
+ }
109
+ /**
110
+ * One row per instance, under a header, for `cloud metrics`.
111
+ *
112
+ * Per instance because that is the question: where the sockets landed. A group
113
+ * that stays on one instance shows as `skipped` climbing while `to bus` stays
114
+ * flat, and both count from when that instance started.
115
+ */
116
+ export declare function realtimeTable(instances: NonNullable<TenantRealtime["instances"]>): string[];
95
117
  export declare function metricsCommand(rawArgs: string[]): Promise<void>;
96
118
  /**
97
119
  * `rebase cloud webhooks` is retired, and says where to go instead.
@@ -65,6 +65,18 @@ export declare function portMovedNotice(line: string): {
65
65
  from: string;
66
66
  to: string;
67
67
  } | null;
68
+ /**
69
+ * The backend's `tsx watch` line, quoted for the shell it is spawned through.
70
+ *
71
+ * Under `shell: true` execa joins the file and its arguments with spaces and
72
+ * hands the line to the shell as it stands, so the binary needs quoting as
73
+ * much as its arguments do: it is `<project>/backend/node_modules/.bin/tsx`,
74
+ * and a project under `~/My Projects/` ran `~/My` and exited 127.
75
+ */
76
+ export declare function backendWatchCommand(tsxBin: string, watchArgs: readonly string[]): {
77
+ file: string;
78
+ args: string[];
79
+ };
68
80
  /**
69
81
  * Directories `tsx watch` must be told about explicitly, as absolute paths.
70
82
  *
@@ -7,6 +7,16 @@ import { type AtlasBinaryState, type EnvironmentFinding } from "../doctor-enviro
7
7
  * keep its `.env` outside the root (see `findEnvFile`).
8
8
  */
9
9
  export declare function findLibpqUrlProblems(projectRoot: string, envFile?: string | null): LibpqUrlFinding[];
10
+ /**
11
+ * Report unparseable connection strings, if any. Returns true when there were,
12
+ * so the finding reaches the exit code like the environment errors do.
13
+ *
14
+ * Runs before the plugin's drift check and never blocks it. The plugin connects
15
+ * through node-postgres, which parses these URLs happily — so it cannot see this
16
+ * defect, and a project with it will otherwise get a clean bill of health while
17
+ * `rebase db backup` fails.
18
+ */
19
+ export declare function reportLibpqUrlProblems(findings: LibpqUrlFinding[]): boolean;
10
20
  /**
11
21
  * Read everything the environment checks need, then run them.
12
22
  *
@@ -0,0 +1,9 @@
1
+ import type { SchemaReconcilePlan } from "@rebasepro/types";
2
+ export declare const RECONCILE_USAGE = "rebase schema reconcile [--drop <collection>.<column>]... [--yes]";
3
+ export declare function parseReconcileArgs(rawArgs: string[]): {
4
+ drop: string[];
5
+ yes: boolean;
6
+ };
7
+ /** The plan, as a person reviews it. Returned as lines so it can be tested. */
8
+ export declare function describeReconcilePlan(plan: SchemaReconcilePlan): string[];
9
+ export declare function schemaReconcileCommand(rawArgs: string[]): Promise<void>;
@@ -1,3 +1,4 @@
1
+ import { type RootPointerResult } from "../utils/root-pointer.js";
1
2
  /**
2
3
  * Supported agent environments and their target directories.
3
4
  *
@@ -271,3 +272,5 @@ export declare function parseSkillsInstallLine(rawArgs: string[]): {
271
272
  * spellings. Throws a UsageError on a name that is not an agent.
272
273
  */
273
274
  export declare function resolveAgentNames(values: readonly string[]): AgentKey[] | null;
275
+ /** One line per repository-root agent file the project's rules were written into, or left alone. */
276
+ export declare function reportRootPointers(result: RootPointerResult): void;
@@ -907,7 +907,8 @@ async function requireClient(rawArgs) {
907
907
  };
908
908
  }
909
909
  refuseDirectLink(rawArgs);
910
- const url = resolveCloudUrl(rawArgs);
910
+ const { url, source } = resolveCloudTarget(rawArgs);
911
+ if (source === "link" && !isKnownControlPlane(url)) fail(`This directory's .rebase/cloud.json names the control plane ${url}, which you have not signed in to before.`, `${TOKEN_ENV} would be sent there. To use it there on purpose, pass --url ${url} or set REBASE_CLOUD_URL.`, "unknown_control_plane");
911
912
  const displaced = linkedEphemeralGrant(url);
912
913
  if (displaced) {
913
914
  if (!namesAnotherProject(rawArgs, displaced.projectId)) {
@@ -1622,6 +1623,38 @@ function reportError(e, context) {
1622
1623
  fail(summary.message, summary.hint, summary.code);
1623
1624
  }
1624
1625
  /**
1626
+ * The program, and its argv, that hands `target` to the default browser on
1627
+ * `platform` — or null when `target` is not an http(s) URL, which is left for
1628
+ * the reader to open by hand.
1629
+ *
1630
+ * No shell is involved on any platform. `start` is a `cmd.exe` builtin, so it
1631
+ * can only be reached through one, and `cmd.exe` reads `&`, `|` and `^` in its
1632
+ * command line as operators: through it, `start https://x/?a=1&b=2` opens
1633
+ * `?a=1` and runs `b=2` as a second command, and a URL the control plane
1634
+ * returns can run anything. `rundll32 url.dll,FileProtocolHandler` is the shell's own URL
1635
+ * handler as a plain program. The URL travels as its serialized `href`, which
1636
+ * percent-encodes spaces and quotes, so it stays one argument through
1637
+ * Windows' command-line quoting too.
1638
+ */
1639
+ function browserOpener(target, platform) {
1640
+ let href;
1641
+ try {
1642
+ const parsed = new URL(target);
1643
+ if (parsed.protocol !== "http:" && parsed.protocol !== "https:") return null;
1644
+ href = parsed.href;
1645
+ } catch {
1646
+ return null;
1647
+ }
1648
+ if (platform === "win32") return {
1649
+ command: "rundll32.exe",
1650
+ args: ["url.dll,FileProtocolHandler", href]
1651
+ };
1652
+ return {
1653
+ command: platform === "darwin" ? "open" : "xdg-open",
1654
+ args: [href]
1655
+ };
1656
+ }
1657
+ /**
1625
1658
  * Open a URL in the user's default browser (best effort). Always announces the
1626
1659
  * URL first so it stays usable over SSH or when no browser is available.
1627
1660
  *
@@ -1634,12 +1667,13 @@ function openUrl(target, label = "Opening") {
1634
1667
  noteBlank();
1635
1668
  note(`${label} ${chalk.cyan(target)}`);
1636
1669
  noteBlank();
1637
- const opener = process.platform === "darwin" ? "open" : process.platform === "win32" ? "start" : "xdg-open";
1670
+ const opener = browserOpener(target, process.platform);
1671
+ if (!opener) return;
1638
1672
  try {
1639
- const child = spawn(opener, [target], {
1673
+ const child = spawn(opener.command, opener.args, {
1640
1674
  stdio: "ignore",
1641
1675
  detached: true,
1642
- shell: process.platform === "win32"
1676
+ shell: false
1643
1677
  });
1644
1678
  child.on("error", () => {});
1645
1679
  child.unref();
@@ -1687,4 +1721,4 @@ function requireCloudRow(row, what) {
1687
1721
  //#endregion
1688
1722
  export { resolveCloudUrl as $, lookupProjectId as A, projectLinkPath as B, grantForLink as C, isKnownControlPlane as D, isJsonMode as E, printGroupHelp as F, requireClient as G, refuseDirectLink as H, printJson as I, requireKnownAction as J, requireCloudRow as K, probeToken as L, noteBlank as M, openUrl as N, keyValues as O, parseCloudArgs as P, resolveCloudTarget as Q, projectDotenvSetsAppKey as R, getContextOrg as S, initOutputMode as T, removeLink as U, readLink as V, reportError as W, requireProjectRef as X, requireProject as Y, requireSessionClient as Z, fail as _, orgCapabilitiesInScopes as _t, billingAccountIdOf as a, storedGrantForLink as at, forgetEphemeralGrant as b, wantsRawError as bt, colorStatus as c, writeLink as ct, displayProjectRef as d, ORG_CAPABILITY_NAMES as dt, resolveProjectRef as et, dotenvSets as f, TOKEN_CAPABILITIES as ft, ephemeralGrantFor as g, isTokenCapability as gt, envToken as h, isOrgCapability as ht, appKeyExpiryNote as i, setCurrentContext as it, note as j, linkedEphemeralGrant as k, confirmDestructive as l, ALWAYS_SCOPES as lt, emitHelp as m, capabilitiesInScopes as mt, GLOBAL_HELP_FLAGS as n, saveEphemeralGrant as nt, cloudRow as o, success as ot, emit as p, TOKEN_CAPABILITY_NAMES as pt, requireInteractive as q, TOKEN_ENV as r, setContextOrg as rt, cloudRows as s, warn as st, GLOBAL_CLOUD_FLAGS as t, resolveTimeoutMs as tt, createCloudClient as u, ORG_CAPABILITIES as ut, fetchDeployTargets as v, scopesForCapabilities as vt, grantProjectOf as w, freshAccessToken as x, fetchTenantBaseDomain as y, scopesForOrgCapabilities as yt, projectHost as z };
1689
1723
 
1690
- //# sourceMappingURL=context-GUxkZm-S.js.map
1724
+ //# sourceMappingURL=context-DvIUbE-b.js.map