@rebasepro/cli 0.23.0 → 0.24.1-canary.g19596ef
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/README.md +19 -3
- package/bin/rebase.js +4 -1
- package/dist/agent-setup-B31F00DC.js +324 -0
- package/dist/agent-setup-B31F00DC.js.map +1 -0
- package/dist/api-keys-Bl1I9q7M.js +525 -0
- package/dist/api-keys-Bl1I9q7M.js.map +1 -0
- package/dist/apps-CNgQJjg5.js +340 -0
- package/dist/apps-CNgQJjg5.js.map +1 -0
- package/dist/args-BnmsEXvu.js +109 -0
- package/dist/args-BnmsEXvu.js.map +1 -0
- package/dist/atlas-dev-database-D_LP_Woq.js +62 -0
- package/dist/atlas-dev-database-D_LP_Woq.js.map +1 -0
- package/dist/auth-aySHEF45.js +414 -0
- package/dist/auth-aySHEF45.js.map +1 -0
- package/dist/branch-pointer-DvSHBjjz.js +2 -0
- package/dist/build-DIHWIqO4.js +336 -0
- package/dist/build-DIHWIqO4.js.map +1 -0
- package/dist/bundle-CqURVN-K.js +1621 -0
- package/dist/bundle-CqURVN-K.js.map +1 -0
- package/dist/bundle.d.ts +12 -3
- package/dist/cli.d.ts +23 -2
- package/dist/cloud-DjByQlkW.js +9667 -0
- package/dist/cloud-DjByQlkW.js.map +1 -0
- package/dist/collection-drift-BKj_BoMq.js +106 -0
- package/dist/collection-drift-BKj_BoMq.js.map +1 -0
- package/dist/commands/__test_support__/parser-specs.d.ts +13 -0
- package/dist/commands/agent-setup.d.ts +116 -0
- package/dist/commands/api-keys.d.ts +86 -23
- package/dist/commands/apps.d.ts +17 -0
- package/dist/commands/auth.d.ts +7 -0
- package/dist/commands/build.d.ts +5 -1
- package/dist/commands/cloud/auth.d.ts +4 -3
- package/dist/commands/cloud/bundle-deploy.d.ts +45 -0
- package/dist/commands/cloud/context.d.ts +44 -5
- package/dist/commands/cloud/cron.d.ts +53 -0
- package/dist/commands/cloud/debug.d.ts +134 -0
- package/dist/commands/cloud/index.d.ts +89 -12
- package/dist/commands/cloud/token-capabilities.d.ts +76 -0
- package/dist/commands/cloud/tokens.d.ts +23 -0
- package/dist/commands/console.d.ts +12 -0
- package/dist/commands/db.d.ts +79 -25
- package/dist/commands/dev.d.ts +181 -13
- package/dist/commands/doctor.d.ts +5 -0
- package/dist/commands/generate_sdk.d.ts +29 -2
- package/dist/commands/init.d.ts +115 -14
- package/dist/commands/schema.d.ts +6 -0
- package/dist/commands/skills.d.ts +126 -7
- package/dist/commands/start.d.ts +44 -0
- package/dist/commands/storage.d.ts +46 -0
- package/dist/commands/upgrade.d.ts +1 -0
- package/dist/consent-ClRHmcxf.js +76 -0
- package/dist/consent-ClRHmcxf.js.map +1 -0
- package/dist/console-D6SJf8k_.js +102 -0
- package/dist/console-D6SJf8k_.js.map +1 -0
- package/dist/context-BqhRydBg.js +1234 -0
- package/dist/context-BqhRydBg.js.map +1 -0
- package/dist/{daemon-entry-LTFKtpHy.js → daemon-entry-Da-D3rmH.js} +3 -4
- package/dist/daemon-entry-Da-D3rmH.js.map +1 -0
- package/dist/daemon-pzsQwDHa.js +2 -0
- package/dist/db-B7RuNuaQ.js +1312 -0
- package/dist/db-B7RuNuaQ.js.map +1 -0
- package/dist/derive-Dl0z2OWi.js +484 -0
- package/dist/derive-Dl0z2OWi.js.map +1 -0
- package/dist/dev-CYr_WXan.js +1599 -0
- package/dist/dev-CYr_WXan.js.map +1 -0
- package/dist/dev-db/atlas-dev-database.d.ts +32 -0
- package/dist/dev-db/daemon-entry.d.ts +13 -0
- package/dist/dev-db/daemon.d.ts +10 -0
- package/dist/dev-db/last-dev-database.d.ts +41 -0
- package/dist/dev-db/prepare.d.ts +29 -3
- package/dist/dev-db/pull.d.ts +90 -5
- package/dist/dev-db/resolve.d.ts +26 -2
- package/dist/dev-preflight-B-LYyBf1.js +2 -0
- package/dist/dev-server-DG8Tt-uf.js +96 -0
- package/dist/dev-server-DG8Tt-uf.js.map +1 -0
- package/dist/doctor-BP8cZ-7F.js +771 -0
- package/dist/doctor-BP8cZ-7F.js.map +1 -0
- package/dist/eject-DizdoecV.js +335 -0
- package/dist/eject-DizdoecV.js.map +1 -0
- package/dist/fold-static-BC9CYicw.js +201 -0
- package/dist/fold-static-BC9CYicw.js.map +1 -0
- package/dist/fold-static.d.ts +26 -3
- package/dist/function-portability-BIvlvR9q.js +265 -0
- package/dist/function-portability-BIvlvR9q.js.map +1 -0
- package/dist/generate_sdk-BPqdJc3Q.js +489 -0
- package/dist/generate_sdk-BPqdJc3Q.js.map +1 -0
- package/dist/index.es.js +199 -22095
- package/dist/index.es.js.map +1 -1
- package/dist/init-Utstvh2Q.js +1149 -0
- package/dist/init-Utstvh2Q.js.map +1 -0
- package/dist/last-dev-database-B58g89uA.js +2 -0
- package/dist/manifest-DRp0UVTj.js +880 -0
- package/dist/manifest-DRp0UVTj.js.map +1 -0
- package/dist/manifest.d.ts +56 -4
- package/dist/normalize-imports-X0Tgze9y.js +107 -0
- package/dist/normalize-imports-X0Tgze9y.js.map +1 -0
- package/dist/package-manager-DSEOwTqM.js +193 -0
- package/dist/package-manager-DSEOwTqM.js.map +1 -0
- package/dist/path-flags-BFgG9V6y.js +91 -0
- package/dist/path-flags-BFgG9V6y.js.map +1 -0
- package/dist/precompress.d.ts +17 -0
- package/dist/prepare-CDN6lSpz.js +1236 -0
- package/dist/prepare-CDN6lSpz.js.map +1 -0
- package/dist/{project-3WCbrrfW.js → project-Wp2zoyeN.js} +34 -184
- package/dist/project-Wp2zoyeN.js.map +1 -0
- package/dist/pull-CrGYMEsy.js +458 -0
- package/dist/pull-CrGYMEsy.js.map +1 -0
- package/dist/resolve-B2O-wKKk.js +2 -0
- package/dist/resources-FD7AfZx8.js +183 -0
- package/dist/resources-FD7AfZx8.js.map +1 -0
- package/dist/schema-DMdr431S.js +125 -0
- package/dist/schema-DMdr431S.js.map +1 -0
- package/dist/skills-DTFibT1m.js +642 -0
- package/dist/skills-DTFibT1m.js.map +1 -0
- package/dist/start-DEa-hOBh.js +267 -0
- package/dist/start-DEa-hOBh.js.map +1 -0
- package/dist/{state-C59Elrnt.js → state-Do7ZJYkF.js} +49 -4
- package/dist/state-Do7ZJYkF.js.map +1 -0
- package/dist/status-DxnJTekv.js +352 -0
- package/dist/status-DxnJTekv.js.map +1 -0
- package/dist/storage-DyVq-f_F.js +303 -0
- package/dist/storage-DyVq-f_F.js.map +1 -0
- package/dist/telemetry/identity.d.ts +10 -1
- package/dist/telemetry-C8Uq8phb.js +129 -0
- package/dist/telemetry-C8Uq8phb.js.map +1 -0
- package/dist/telemetry-EMFRVRQi.js +351 -0
- package/dist/telemetry-EMFRVRQi.js.map +1 -0
- package/dist/unknown-command-DNwDcX3w.js +98 -0
- package/dist/unknown-command-DNwDcX3w.js.map +1 -0
- package/dist/upgrade-CtZtRkTE.js +1332 -0
- package/dist/upgrade-CtZtRkTE.js.map +1 -0
- package/dist/upgrade.d.ts +38 -5
- package/dist/utils/dev-preflight.d.ts +47 -5
- package/dist/utils/dev-server.d.ts +30 -0
- package/dist/utils/path-flags.d.ts +31 -0
- package/dist/utils/project.d.ts +16 -0
- package/dist/utils/temp-archive.d.ts +9 -0
- package/dist/version-Buyyo1ut.js +58 -0
- package/dist/version-Buyyo1ut.js.map +1 -0
- package/package.json +7 -7
- package/templates/eject/Dockerfile +4 -2
- package/templates/eject/backend/src/env.ts +1 -1
- package/templates/eject/backend/src/index.ts +42 -4
- package/templates/eject/docker-compose.custom.yml +8 -4
- package/templates/generated-schemas/blank.ts +40 -0
- package/templates/generated-schemas/blog.ts +127 -0
- package/templates/generated-schemas/ecommerce.ts +93 -0
- package/templates/overlays/baas/ai-instructions.md +1 -1
- package/templates/overlays/baas/config/package.json +1 -0
- package/templates/overlays/baas/config/storage.ts +5 -3
- package/templates/overlays/baas/package.json +1 -0
- package/templates/template/.cursorrules +1 -1
- package/templates/template/.env.example +20 -10
- package/templates/template/.github/copilot-instructions.md +1 -1
- package/templates/template/.mcp.json +2 -2
- package/templates/template/.windsurfrules +1 -1
- package/templates/template/AGENTS.md +1 -1
- package/templates/template/CLAUDE.md +1 -1
- package/templates/template/README.md +21 -15
- package/templates/template/ai-instructions.md +5 -4
- package/templates/template/backend/functions/hello.ts +8 -0
- package/templates/template/backend/package.json +1 -1
- package/templates/template/config/resources.ts +7 -6
- package/templates/template/config/storage.ts +5 -3
- package/templates/template/docker-compose.yml +15 -9
- package/templates/template/frontend/vite.config.ts +13 -3
- package/templates/template/gitignore +6 -1
- package/templates/template/package.json +5 -3
- package/templates/template/scripts/example.ts +6 -4
- package/templates/template/tsconfig.json +25 -0
- package/dist/branch-pointer-dBiClJ0p.js +0 -111
- package/dist/branch-pointer-dBiClJ0p.js.map +0 -1
- package/dist/constraints-DKGbNfUW.js +0 -48
- package/dist/constraints-DKGbNfUW.js.map +0 -1
- package/dist/daemon-DR9Tk0La.js +0 -355
- package/dist/daemon-DR9Tk0La.js.map +0 -1
- package/dist/daemon-entry-LTFKtpHy.js.map +0 -1
- package/dist/dev-preflight-CNLl4rdo.js +0 -367
- package/dist/dev-preflight-CNLl4rdo.js.map +0 -1
- package/dist/project-3WCbrrfW.js.map +0 -1
- package/dist/pull-Dywm5FWP.js +0 -232
- package/dist/pull-Dywm5FWP.js.map +0 -1
- package/dist/resolve-BAeRUBhg.js +0 -74
- package/dist/resolve-BAeRUBhg.js.map +0 -1
- package/dist/state-C59Elrnt.js.map +0 -1
- package/templates/template/backend/src/schema.generated.ts +0 -13
package/dist/commands/dev.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type AppAddress, type RebaseProjectManifest } from "@rebasepro/types";
|
|
1
2
|
import { type PreparedDatabase } from "../dev-db/prepare.js";
|
|
2
3
|
/**
|
|
3
4
|
* The line the watcher prints when it is about to run the entry again.
|
|
@@ -29,6 +30,21 @@ import { type PreparedDatabase } from "../dev-db/prepare.js";
|
|
|
29
30
|
* Exported so `dev-crash-marker.test.ts` can hold the running tsx to it.
|
|
30
31
|
*/
|
|
31
32
|
export declare const WATCHER_RESTART_MARKER: RegExp;
|
|
33
|
+
/**
|
|
34
|
+
* Calls `onLine` with each line a child process writes to `stream`.
|
|
35
|
+
*
|
|
36
|
+
* A pipe hands over whatever has been written so far, so one line can arrive
|
|
37
|
+
* in two chunks. Split chunk by chunk, "Server running at http://localhost:3001"
|
|
38
|
+
* could read as two fragments that neither matched, and `rebase dev` then
|
|
39
|
+
* never announced the backend or started the admin panel. So the piece after
|
|
40
|
+
* the last newline is held for the next chunk, decoded as UTF-8 across chunk
|
|
41
|
+
* boundaries. A held piece is handed over at the end of the stream, or after
|
|
42
|
+
* `idleFlushMs` with nothing more written, so a prompt or a progress line
|
|
43
|
+
* still shows when it is written.
|
|
44
|
+
*
|
|
45
|
+
* Exported for its test.
|
|
46
|
+
*/
|
|
47
|
+
export declare function forEachOutputLine(stream: NodeJS.ReadableStream | null | undefined, onLine: (line: string) => void, idleFlushMs?: number): void;
|
|
32
48
|
/**
|
|
33
49
|
* The corrected banner line, when the backend says it moved port.
|
|
34
50
|
*
|
|
@@ -65,15 +81,50 @@ export declare function portMovedNotice(line: string): {
|
|
|
65
81
|
*
|
|
66
82
|
* @param projectRoot Absolute path the relative entries are resolved against.
|
|
67
83
|
* @param paths The `REBASE_DEV_*` map from {@link devRuntimeEnv}.
|
|
68
|
-
* @param includeConfig Whether `config/` is watched here. It is only when
|
|
69
|
-
* auto-generation is off; with `--generate` a dedicated
|
|
70
|
-
* watcher already regenerates the schema and SDK, and tsx
|
|
71
|
-
* restarts on the files that produces.
|
|
72
84
|
*/
|
|
73
85
|
export declare function devWatchIncludes(projectRoot: string, paths: {
|
|
74
86
|
REBASE_DEV_FUNCTIONS?: string;
|
|
75
87
|
REBASE_DEV_CRONS?: string;
|
|
76
|
-
}
|
|
88
|
+
}): string[];
|
|
89
|
+
/**
|
|
90
|
+
* The file dev writes to restart the backend, or `null` when tsx would not see it.
|
|
91
|
+
*
|
|
92
|
+
* Outside the project, so nothing appears in the developer's tree, and keyed by
|
|
93
|
+
* the project so two `rebase dev`s never restart each other. tsx ignores every
|
|
94
|
+
* path with a dot-named segment (its built-in `**\/.*\/**`), so a trigger under
|
|
95
|
+
* `.rebase/` — or under a TMPDIR inside a dot directory — would never fire; in
|
|
96
|
+
* that case there is no trigger and {@link devWatchArgs} leaves the
|
|
97
|
+
* collections to tsx, as before.
|
|
98
|
+
*/
|
|
99
|
+
export declare function devRestartTrigger(projectRoot: string): string | null;
|
|
100
|
+
/**
|
|
101
|
+
* The `tsx watch` argument list for the backend (unquoted).
|
|
102
|
+
*
|
|
103
|
+
* One save of a collection file must restart the backend once. The runtime
|
|
104
|
+
* `import()`s the collections, so tsx tracks them as dependencies and used to
|
|
105
|
+
* restart the moment a file was saved — before dev had regenerated
|
|
106
|
+
* `schema.generated.ts`. That boot warned "schema.generated.ts no longer
|
|
107
|
+
* describes the database … Run `rebase schema generate`", telling the reader to
|
|
108
|
+
* run what dev was running at that moment, and the regeneration then rewrote
|
|
109
|
+
* the file and restarted the backend a second time. So tsx is told to leave the
|
|
110
|
+
* collections directory alone (`--exclude` wins over its dependency tracking),
|
|
111
|
+
* and dev restarts the backend itself, once, after the regeneration — through
|
|
112
|
+
* `restartTrigger`, which tsx watches.
|
|
113
|
+
*
|
|
114
|
+
* Every included directory also gets tsx's own default ignores, made absolute.
|
|
115
|
+
* tsx resolves those defaults (`**\/node_modules/**`, `**\/.*`, …) against its
|
|
116
|
+
* cwd, which is `backend/`, so they never reached `config/`, a sibling: chokidar
|
|
117
|
+
* walked `config/node_modules` — following symlinks — before tsx spawned the
|
|
118
|
+
* backend at all, and kept every file in it watched. In the monorepo's example
|
|
119
|
+
* app that was 17 s before the first backend line and 1,400 open files, and any
|
|
120
|
+
* install (or another checkout's Vite build writing `.vite-temp` deep inside
|
|
121
|
+
* that tree) restarted the backend. A `.DS_Store` or an editor swap file in
|
|
122
|
+
* `config/` restarted it too.
|
|
123
|
+
*/
|
|
124
|
+
export declare function devWatchArgs(projectRoot: string, paths: {
|
|
125
|
+
REBASE_DEV_FUNCTIONS?: string;
|
|
126
|
+
REBASE_DEV_CRONS?: string;
|
|
127
|
+
}, entryTarget: string, restartTrigger: string | null): string[];
|
|
77
128
|
/** Well-known filename the backend writes its actual port to. */
|
|
78
129
|
export declare const DEV_PORT_FILENAME = ".rebase-dev-port";
|
|
79
130
|
/**
|
|
@@ -84,12 +135,6 @@ export declare const DEV_PORT_FILENAME = ".rebase-dev-port";
|
|
|
84
135
|
* template still says this number, so the two cannot drift apart in silence.
|
|
85
136
|
*/
|
|
86
137
|
export declare const SCAFFOLD_DEFAULT_PORT = 3001;
|
|
87
|
-
/**
|
|
88
|
-
* Compute a deterministic port from the project root path.
|
|
89
|
-
* Range: 3001–3999 (avoids privileged ports and common services).
|
|
90
|
-
* Two different project directories will almost always get different ports.
|
|
91
|
-
*/
|
|
92
|
-
export declare function getProjectPort(projectRoot: string): number;
|
|
93
138
|
/**
|
|
94
139
|
* Which rung of the ladder below decided the port.
|
|
95
140
|
*
|
|
@@ -138,6 +183,53 @@ export declare function resolveStartPort(projectRoot: string, explicitPort?: num
|
|
|
138
183
|
* Exported for its test.
|
|
139
184
|
*/
|
|
140
185
|
export declare function databaseEndpoint(url: string | null | undefined): string | null;
|
|
186
|
+
/**
|
|
187
|
+
* What the start banner needs to know about a project's static apps.
|
|
188
|
+
*
|
|
189
|
+
* `rebase dev` runs one frontend: Vite in `frontend/`, at the root of its own
|
|
190
|
+
* localhost port, whatever path or hostname the manifest declares for it. So an
|
|
191
|
+
* app's local address and its deployed one are different things, and for an app
|
|
192
|
+
* with a hostname of its own they share nothing at all — appending its address
|
|
193
|
+
* to the local URL would print `http://localhost:5173https://admin.example.com`.
|
|
194
|
+
*/
|
|
195
|
+
export interface DevStaticShape {
|
|
196
|
+
declaresStaticApp: boolean;
|
|
197
|
+
/** The declared app whose `root` is the `frontend/` that `rebase dev` runs, if one is. */
|
|
198
|
+
served?: {
|
|
199
|
+
appName: string;
|
|
200
|
+
address: AppAddress;
|
|
201
|
+
};
|
|
202
|
+
/** Where the CMS is, when an app declares one. */
|
|
203
|
+
cms?: {
|
|
204
|
+
appName: string;
|
|
205
|
+
/** Always a path. */
|
|
206
|
+
path: string;
|
|
207
|
+
/** The serving app's hostname, when its `path` names one. */
|
|
208
|
+
host?: string;
|
|
209
|
+
/** Whether the app serving it is the one `rebase dev` runs, so it has a local address. */
|
|
210
|
+
servedLocally: boolean;
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Read {@link DevStaticShape} out of a loaded manifest. Exported for its test.
|
|
215
|
+
*
|
|
216
|
+
* Which declared app is running is decided by its `root` being `frontend/`,
|
|
217
|
+
* because that directory is what `startFrontend` launches and nothing else is.
|
|
218
|
+
* When no declared app has that root, which app serves the CMS cannot be told,
|
|
219
|
+
* and it is read as the frontend that does run — what the banner has always
|
|
220
|
+
* assumed, and right for every project `rebase init` scaffolds.
|
|
221
|
+
*/
|
|
222
|
+
export declare function devStaticShape(manifest: RebaseProjectManifest, projectRoot: string, frontendDir: string | null): DevStaticShape;
|
|
223
|
+
/**
|
|
224
|
+
* The banner's lines for a project with a frontend. Exported for its test.
|
|
225
|
+
*
|
|
226
|
+
* Every address is printed whole, once: the local one Vite answers on, and —
|
|
227
|
+
* for an app with a hostname — the https URL it answers on once deployed, on a
|
|
228
|
+
* line of its own beneath it. A CMS in an app `rebase dev` does not run gets its
|
|
229
|
+
* deployed address and a note saying so, rather than a localhost URL that the
|
|
230
|
+
* running frontend's SPA fallback would answer with the wrong app.
|
|
231
|
+
*/
|
|
232
|
+
export declare function appBannerLines(frontendUrl: string, api: string, shape: DevStaticShape): Array<[string, string]>;
|
|
141
233
|
/**
|
|
142
234
|
* The `↳ Database =` line: which database, why it was chosen, and where it is.
|
|
143
235
|
*
|
|
@@ -206,7 +298,6 @@ export declare const DEV_FLAGS: {
|
|
|
206
298
|
readonly "--backend-only": BooleanConstructor;
|
|
207
299
|
readonly "--frontend-only": BooleanConstructor;
|
|
208
300
|
readonly "--port": NumberConstructor;
|
|
209
|
-
readonly "--generate": BooleanConstructor;
|
|
210
301
|
/**
|
|
211
302
|
* Point this run at a database of your own, ahead of everything else.
|
|
212
303
|
*
|
|
@@ -220,9 +311,23 @@ export declare const DEV_FLAGS: {
|
|
|
220
311
|
readonly "-b": "--backend-only";
|
|
221
312
|
readonly "-f": "--frontend-only";
|
|
222
313
|
readonly "-P": "--port";
|
|
223
|
-
readonly "-g": "--generate";
|
|
224
314
|
readonly "--no-db": BooleanConstructor;
|
|
225
315
|
};
|
|
316
|
+
/** What {@link ensureGeneratedSchema} did at startup. */
|
|
317
|
+
export type SchemaGeneration = "generated" | "skipped" | "failed";
|
|
318
|
+
/**
|
|
319
|
+
* Whether dev must still run the driver's `schema stale --fix` before the
|
|
320
|
+
* backend boots.
|
|
321
|
+
*
|
|
322
|
+
* Not after a regeneration that succeeded: that wrote `schema.generated.ts`
|
|
323
|
+
* from these collections with this driver, moments earlier, and `stale`
|
|
324
|
+
* compares the file against the same generator — it can only answer "nothing
|
|
325
|
+
* stale", and it cost a driver process (~0.6 s) on every start. The repair it
|
|
326
|
+
* exists for, a library upgrade that changed what the generator derives, is
|
|
327
|
+
* exactly what the regeneration already did. When generation was skipped or
|
|
328
|
+
* failed, the preflight is the remaining safety net and still runs.
|
|
329
|
+
*/
|
|
330
|
+
export declare function needsStaleSchemaPreflight(generation: SchemaGeneration): boolean;
|
|
226
331
|
/**
|
|
227
332
|
* One variable's value out of `.env` text, or undefined when it has none.
|
|
228
333
|
*
|
|
@@ -251,4 +356,67 @@ export declare function readEnvValue(envText: string, key: string): string | und
|
|
|
251
356
|
* it is invisible in any assertion about the push's *outcome*.
|
|
252
357
|
*/
|
|
253
358
|
export declare function schemaPushArgv(databaseUrl: string | undefined): string[];
|
|
359
|
+
/**
|
|
360
|
+
* Start-up's independent halves, overlapped rather than run one after another.
|
|
361
|
+
*
|
|
362
|
+
* `rebase dev` used to regenerate the schema and the SDK, then derive the
|
|
363
|
+
* resource graph (every collection evaluated again, in this process), then
|
|
364
|
+
* start the managed database and wait for it — about a second when it was not
|
|
365
|
+
* already running — and only then spawn the backend. None of the three reads
|
|
366
|
+
* what another writes: the generators read `config/` and write
|
|
367
|
+
* `backend/src/schema.generated.ts` and `generated/sdk/`; the derivation reads
|
|
368
|
+
* `config/resources.ts` and the collections; the database needs neither, and
|
|
369
|
+
* `schema generate` never connects to one. So `database` starts first and is
|
|
370
|
+
* collected last.
|
|
371
|
+
*
|
|
372
|
+
* `preflight` is the exception, and the reason this is not one `Promise.all`:
|
|
373
|
+
* on the `--docker` path it pushes the schema the generators have just written,
|
|
374
|
+
* so it still runs after them.
|
|
375
|
+
*
|
|
376
|
+
* A database that fails to start is reported where it always was — after the
|
|
377
|
+
* generators' and the preflight's output — rather than ahead of it, and it is
|
|
378
|
+
* never an unhandled rejection while they run.
|
|
379
|
+
*
|
|
380
|
+
* Exported for its test.
|
|
381
|
+
*/
|
|
382
|
+
export declare function overlapDevStartup<T>(steps: {
|
|
383
|
+
generate: () => Promise<SchemaGeneration>;
|
|
384
|
+
preflight: () => Promise<void>;
|
|
385
|
+
/** Resolve and, for the managed database, start it. `null` when this run starts none. */
|
|
386
|
+
database: (() => Promise<T>) | null;
|
|
387
|
+
}): Promise<{
|
|
388
|
+
schemaGeneration: SchemaGeneration;
|
|
389
|
+
database: T | null;
|
|
390
|
+
}>;
|
|
391
|
+
/**
|
|
392
|
+
* Whether the admin panel can start beside the backend instead of after it.
|
|
393
|
+
*
|
|
394
|
+
* Vite has to be told the backend's URL when it starts (`VITE_API_URL`), and
|
|
395
|
+
* the backend's port is only certain once it has bound — so the admin panel
|
|
396
|
+
* used to wait for "Server running at", and the time to it was the backend's
|
|
397
|
+
* whole boot plus Vite's start. It can start beside the backend whenever the
|
|
398
|
+
* port the backend will bind is known in advance:
|
|
399
|
+
*
|
|
400
|
+
* - **named with `--port`**: the server binds it or refuses to start, never
|
|
401
|
+
* walks past it (`REBASE_DEV_PORT_EXPLICIT`), and `pinnedPortRefusal` has
|
|
402
|
+
* already checked that nothing answers there;
|
|
403
|
+
* - **free, and the port the backend tries first**: the server tries the port
|
|
404
|
+
* its last run landed on before the one it is given (`.rebase-dev-port`), so
|
|
405
|
+
* a remembered port must be this one — the "kept from the last run" rung —
|
|
406
|
+
* or absent, which it is after every clean exit, and the derived port is
|
|
407
|
+
* then the one tried. A port something already answers on would make the
|
|
408
|
+
* backend move, so that case keeps the old order.
|
|
409
|
+
*
|
|
410
|
+
* Nothing here can rule out another process taking the port in the second the
|
|
411
|
+
* backend boots, so `devCommand` still compares the announced port with the
|
|
412
|
+
* one Vite was given and restarts the admin panel when they differ.
|
|
413
|
+
*
|
|
414
|
+
* Exported for its test.
|
|
415
|
+
*/
|
|
416
|
+
export declare function frontendCanStartWithBackend(options: {
|
|
417
|
+
projectRoot: string;
|
|
418
|
+
port: number;
|
|
419
|
+
pinned: boolean;
|
|
420
|
+
probe?: (host: string, port: number) => Promise<boolean>;
|
|
421
|
+
}): Promise<boolean>;
|
|
254
422
|
export declare function devCommand(rawArgs: string[]): Promise<void>;
|
|
@@ -57,4 +57,9 @@ export declare const DOCTOR_FLAGS: {
|
|
|
57
57
|
readonly "--sdk": StringConstructor;
|
|
58
58
|
readonly "-k": "--sdk";
|
|
59
59
|
};
|
|
60
|
+
/**
|
|
61
|
+
* The line handed to the driver, every path on it resolved from where the
|
|
62
|
+
* command was run — the driver runs in `backend/`. See `utils/path-flags.ts`.
|
|
63
|
+
*/
|
|
64
|
+
export declare function doctorDriverArgs(rawArgs: string[], cwd: string): string[];
|
|
60
65
|
export declare function doctorCommand(rawArgs: string[]): Promise<void>;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* CLI command: generate-sdk
|
|
3
3
|
*
|
|
4
|
-
* Reads collection
|
|
5
|
-
*
|
|
4
|
+
* Reads every collection file in a directory (default: ./config/collections) —
|
|
5
|
+
* the files the backend serves, not the barrel's list — generates a typed
|
|
6
|
+
* TypeScript SDK, and writes it to the output directory (default: ./generated/sdk).
|
|
6
7
|
*
|
|
7
8
|
* Uses jiti for dynamic TypeScript import of collection files.
|
|
8
9
|
*/
|
|
@@ -21,8 +22,34 @@ interface GenerateSDKArgs {
|
|
|
21
22
|
from?: string;
|
|
22
23
|
/** Bearer token for the contract endpoint. Falls back to REBASE_SERVICE_KEY. */
|
|
23
24
|
token?: string;
|
|
25
|
+
/**
|
|
26
|
+
* Also register the generated `Database` for server-side code: write the
|
|
27
|
+
* types and the `Register` augmentation into `config/generated/`. See
|
|
28
|
+
* {@link writeRegistration}.
|
|
29
|
+
*/
|
|
30
|
+
register?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* The directory holding `rebase.json`, where `--register` is remembered.
|
|
33
|
+
* Found from `cwd` when not given.
|
|
34
|
+
*/
|
|
35
|
+
projectRoot?: string;
|
|
24
36
|
help?: boolean;
|
|
25
37
|
}
|
|
38
|
+
/** What `--register` writes, and what marks a project as having opted in. */
|
|
39
|
+
export declare const REGISTER_FILE = "register.ts";
|
|
40
|
+
/**
|
|
41
|
+
* Where `--register` writes: `generated/` beside the collections directory,
|
|
42
|
+
* which is `config/generated/` in a scaffolded project.
|
|
43
|
+
*
|
|
44
|
+
* Inside `config/` because that is the one directory both compiles of a
|
|
45
|
+
* collection file include: the backend's program (it includes
|
|
46
|
+
* `../config/**`) and the `config` package's own `tsc`. A registration
|
|
47
|
+
* there that imported `../generated/sdk/database.types` pulled a file from
|
|
48
|
+
* outside `config/` into that package's program, which TypeScript refuses
|
|
49
|
+
* (the file is not under its `rootDir`) — so the types are copied in beside
|
|
50
|
+
* the registration rather than imported from the SDK.
|
|
51
|
+
*/
|
|
52
|
+
export declare function registrationDir(collectionsDir: string): string;
|
|
26
53
|
/**
|
|
27
54
|
* The base URL to show in the printed usage example.
|
|
28
55
|
*
|
package/dist/commands/init.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { PackageManager, PMCommands } from "../utils/package-manager.js";
|
|
2
|
+
import { type AgentKey } from "./skills.js";
|
|
2
3
|
/**
|
|
3
4
|
* Every scaffolded file that carries a `{{PLACEHOLDER}}`.
|
|
4
5
|
*
|
|
@@ -42,6 +43,10 @@ export interface InitOptions {
|
|
|
42
43
|
setupKey?: string;
|
|
43
44
|
/** Control-plane URL the setup key is redeemed against. */
|
|
44
45
|
cloudUrl?: string;
|
|
46
|
+
/** AI coding agents to install skills and the MCP server for. */
|
|
47
|
+
agents: AgentKey[];
|
|
48
|
+
/** Whoever reads the closing steps can answer a prompt (a TTY, not --yes). */
|
|
49
|
+
interactive?: boolean;
|
|
45
50
|
}
|
|
46
51
|
export interface BuildQuestionsParams {
|
|
47
52
|
nameArg?: string;
|
|
@@ -91,6 +96,14 @@ export type InitQuestion = {
|
|
|
91
96
|
default: unknown;
|
|
92
97
|
when?: (answers: Record<string, unknown>) => boolean;
|
|
93
98
|
};
|
|
99
|
+
/**
|
|
100
|
+
* Why `input` cannot be this project's `DATABASE_URL`, or null when it can.
|
|
101
|
+
*
|
|
102
|
+
* The runtime refuses anything that is not a URL, and only a Postgres one can
|
|
103
|
+
* work, so `init` refuses the same — before the scaffold is written around it.
|
|
104
|
+
* The value itself is never repeated back: it may hold a password.
|
|
105
|
+
*/
|
|
106
|
+
export declare function databaseUrlProblem(input: string): string | null;
|
|
94
107
|
export declare function buildInitQuestions(params: BuildQuestionsParams): InitQuestion[];
|
|
95
108
|
/**
|
|
96
109
|
* The `cd` a user must type to enter the new project.
|
|
@@ -105,21 +118,109 @@ export declare function printInitHelp(): void;
|
|
|
105
118
|
export declare function createRebaseApp(rawArgs: string[]): Promise<void>;
|
|
106
119
|
/** The flags `rebase init` takes. */
|
|
107
120
|
export declare const INIT_FLAGS: {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
121
|
+
"--git": BooleanConstructor;
|
|
122
|
+
"--install": BooleanConstructor;
|
|
123
|
+
"--no-install": BooleanConstructor;
|
|
124
|
+
"--database-url": StringConstructor;
|
|
125
|
+
"--introspect": BooleanConstructor;
|
|
126
|
+
"--template": StringConstructor;
|
|
127
|
+
"--headless": BooleanConstructor;
|
|
128
|
+
"--project": StringConstructor;
|
|
129
|
+
"--setup-key": StringConstructor;
|
|
130
|
+
"--agent": [StringConstructor];
|
|
131
|
+
"--yes": BooleanConstructor;
|
|
132
|
+
"-a": string;
|
|
133
|
+
"-g": string;
|
|
134
|
+
"-i": string;
|
|
135
|
+
"-t": string;
|
|
136
|
+
"-y": string;
|
|
122
137
|
};
|
|
138
|
+
/** What the closing "Next steps" depend on: the project's shape, and what `init` managed to do. */
|
|
139
|
+
export interface InitNextStepsInput {
|
|
140
|
+
headless: boolean;
|
|
141
|
+
/** `--database-url` was given, so `.env` names the user's own database. */
|
|
142
|
+
ownDatabase: boolean;
|
|
143
|
+
/** Introspection was asked for. */
|
|
144
|
+
introspect: boolean;
|
|
145
|
+
/** Introspection ran and produced collections. */
|
|
146
|
+
introspected: boolean;
|
|
147
|
+
/** Dependencies were installed. */
|
|
148
|
+
installed: boolean;
|
|
149
|
+
/** What the reader types to enter the project; "" when they are in it. */
|
|
150
|
+
cdTarget: string;
|
|
151
|
+
pm: PMCommands;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* The "Next steps" `init` closes on, every command one that works as printed.
|
|
155
|
+
*
|
|
156
|
+
* Each flavour has its own steps, and the branch for one flavour must not run
|
|
157
|
+
* for another. The `--database-url` branch was checked before the headless one,
|
|
158
|
+
* so `init --headless --database-url` — the documented BaaS path — opened on
|
|
159
|
+
* `pnpm run db:push`: a script the headless scaffold does not have, for a
|
|
160
|
+
* schema it does not declare (its tables are the developer's own), with an
|
|
161
|
+
* Atlas it does not install. `init-next-steps.test.ts` holds every script
|
|
162
|
+
* named here to the scaffold it is printed for.
|
|
163
|
+
*/
|
|
164
|
+
export declare function initNextSteps(input: InitNextStepsInput): string[];
|
|
165
|
+
/**
|
|
166
|
+
* The closing "AI Agent Skills" lines, each command one its reader can run.
|
|
167
|
+
*
|
|
168
|
+
* `rebase skills install` with no `--agent` prompts, and refuses without a
|
|
169
|
+
* TTY — so printing it bare at the end of `rebase init --yes`, the agent and
|
|
170
|
+
* CI path, told that reader to run a command that answers "Cannot prompt".
|
|
171
|
+
* Named agents are spelled out (a refresh must not depend on detection, which
|
|
172
|
+
* never finds Copilot); otherwise a TTY reader gets the prompt, anyone else
|
|
173
|
+
* the `--agent` form.
|
|
174
|
+
*/
|
|
175
|
+
export declare function agentNextSteps(agents: readonly AgentKey[], interactive: boolean, pm: PMCommands): string[];
|
|
176
|
+
/**
|
|
177
|
+
* What a directory may already hold for `rebase init` to scaffold into it.
|
|
178
|
+
*
|
|
179
|
+
* `git clone` of an empty repository, or `git init`, leaves exactly `.git` —
|
|
180
|
+
* and `rebase init . --yes --git` is the help's own example. Counting every
|
|
181
|
+
* entry as "not empty" refused the one directory that example is most likely
|
|
182
|
+
* to be typed in. The entries here are a repository's metadata, the files
|
|
183
|
+
* operating systems drop into any folder, and a licence: none of them is
|
|
184
|
+
* something the scaffold writes (`init.test.ts` holds the template to that),
|
|
185
|
+
* so tolerating them can never overwrite anything. Everything else is a
|
|
186
|
+
* conflict and is named, never merged into.
|
|
187
|
+
*/
|
|
188
|
+
export declare const SCAFFOLD_TOLERATED_ENTRIES: ReadonlySet<string>;
|
|
189
|
+
/** Entries in `dir` the scaffold would overwrite or mix with — `[]` when it may proceed. */
|
|
190
|
+
export declare function scaffoldDirectoryConflicts(dir: string): string[];
|
|
191
|
+
/** The refusal for a directory that already holds files, with the two ways forward. */
|
|
192
|
+
export declare function scaffoldConflictMessage(projectName: string, displayPath: string, conflicts: string[]): string[];
|
|
193
|
+
/**
|
|
194
|
+
* `git init`, or nothing when the directory is already a repository.
|
|
195
|
+
*
|
|
196
|
+
* A cloned repository keeps its branch, its remote and its history: the
|
|
197
|
+
* scaffold is committed on top of what is there. Only a repository this
|
|
198
|
+
* function created is pointed at `main`.
|
|
199
|
+
*/
|
|
200
|
+
export declare function initGitRepository(targetDirectory: string): Promise<boolean>;
|
|
201
|
+
/**
|
|
202
|
+
* Where the generated Drizzle schema for each preset ships, beside the template.
|
|
203
|
+
*
|
|
204
|
+
* `rebase dev` regenerates `backend/src/schema.generated.ts` on every start, and
|
|
205
|
+
* the Studio's schema editor refuses to commit over a dirty copy of it — a
|
|
206
|
+
* schema change must not sweep up somebody's work in progress. So whatever
|
|
207
|
+
* `init` writes there, and commits under `--git`, has to be byte-for-byte what
|
|
208
|
+
* that first regeneration produces. A stub (`export const tables = {}`) was
|
|
209
|
+
* rewritten on the first `rebase dev`, and every new project's first Studio
|
|
210
|
+
* edit was refused with `SCHEMA_EDIT_DIRTY_TREE` before its owner had changed
|
|
211
|
+
* a thing.
|
|
212
|
+
*
|
|
213
|
+
* The file cannot be generated here: generation loads the collection files,
|
|
214
|
+
* and they import `@rebasepro/cms-types`, which the project does not have
|
|
215
|
+
* until it is installed — `init --git` without `--install` commits first. So
|
|
216
|
+
* each preset's output is generated in this repository and shipped, and
|
|
217
|
+
* `init-generated-schema.test.ts` fails the moment one of them differs from
|
|
218
|
+
* what the generator writes for that preset's collections.
|
|
219
|
+
*
|
|
220
|
+
* Outside `templates/template` on purpose: a preset's schema must not be
|
|
221
|
+
* copied into a project that chose another preset.
|
|
222
|
+
*/
|
|
223
|
+
export declare function shippedSchemaPath(preset: TemplatePreset): string;
|
|
123
224
|
/**
|
|
124
225
|
* Whether `port` is free — on the wildcard address *and* on both loopback addresses.
|
|
125
226
|
*
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The line handed to the driver, its paths resolved from where the command was
|
|
3
|
+
* run (the driver runs in `backend/`). `--schema` is left alone: on
|
|
4
|
+
* `introspect` it names a Postgres schema, not a file.
|
|
5
|
+
*/
|
|
6
|
+
export declare function schemaDriverArgs(rawArgs: string[], cwd: string): string[];
|
|
1
7
|
export declare function schemaCommand(subcommand: string | undefined, rawArgs: string[]): Promise<void>;
|
|
2
8
|
/** Every subcommand the family dispatches — the help table's keys. */
|
|
3
9
|
export declare const SCHEMA_SUBCOMMANDS: string[];
|