robodev 0.50.0 → 0.51.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/package.json +2 -2
- package/src/api.ts +15 -0
- package/src/dev.ts +6 -2
- package/src/index.ts +4 -0
- package/templates/auth-chat/package.json +1 -1
- package/templates/backend/package.json +1 -1
- package/templates/empty/package.json +1 -1
- package/templates/marketplace/package.json +1 -1
- package/templates/povio/package.json +1 -1
- package/templates/shadcn/package.json +1 -1
- package/templates/space/package.json +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "robodev",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.51.0",
|
|
4
4
|
"description": "CLI for Robodev Starbase — create, auth, link, deploy, load, and run a project locally with robodev dev",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"embedded-postgres": "17.10.0-beta.17",
|
|
27
27
|
"fastify": "^5.12.1",
|
|
28
28
|
"tsx": "^4.20.5",
|
|
29
|
-
"@robodev-ai/runtime": "0.
|
|
29
|
+
"@robodev-ai/runtime": "0.11.0",
|
|
30
30
|
"@robodev-ai/sdk": "0.15.0"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
package/src/api.ts
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
1
2
|
import { readCredentials, starbaseUrl, writeCredentials, type Credentials } from "./config.js";
|
|
2
3
|
|
|
4
|
+
function cliVersion(): string {
|
|
5
|
+
try {
|
|
6
|
+
const pkg = createRequire(import.meta.url)("../package.json") as { version?: string };
|
|
7
|
+
return typeof pkg.version === "string" && pkg.version ? pkg.version : "unknown";
|
|
8
|
+
} catch {
|
|
9
|
+
return "unknown";
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/** Starbase labels deploys carrying this header "CLI" (vs a bare API call with a token). */
|
|
14
|
+
export const ROBODEV_CLIENT_HEADER = "X-Robodev-Client";
|
|
15
|
+
export const ROBODEV_CLIENT = `robodev-cli/${cliVersion()}`;
|
|
16
|
+
|
|
3
17
|
export class ApiError extends Error {
|
|
4
18
|
constructor(
|
|
5
19
|
message: string,
|
|
@@ -23,6 +37,7 @@ async function request<T>(
|
|
|
23
37
|
if (credentials?.accessToken) {
|
|
24
38
|
headers.set("Authorization", `Bearer ${credentials.accessToken}`);
|
|
25
39
|
}
|
|
40
|
+
if (!headers.has(ROBODEV_CLIENT_HEADER)) headers.set(ROBODEV_CLIENT_HEADER, ROBODEV_CLIENT);
|
|
26
41
|
|
|
27
42
|
const res = await fetch(`${starbaseUrl()}${path}`, { ...init, headers });
|
|
28
43
|
const body = (await res.json().catch(() => ({}))) as Record<string, unknown>;
|
package/src/dev.ts
CHANGED
|
@@ -228,8 +228,12 @@ export async function main(args: string[]): Promise<void> {
|
|
|
228
228
|
throw error;
|
|
229
229
|
}
|
|
230
230
|
|
|
231
|
-
|
|
232
|
-
|
|
231
|
+
// A reload is a fresh deploy of local code: strict checks, warnings printed.
|
|
232
|
+
const loaded = await loadModules(distDir, files, undefined, {
|
|
233
|
+
mode: "deploy",
|
|
234
|
+
onWarning: (message) => log(`Warning: ${message}`),
|
|
235
|
+
});
|
|
236
|
+
assertJobCrons(loaded.jobs, { mode: "deploy" });
|
|
233
237
|
// Any edit to database.ts can change columns, not just tables, so compare its source.
|
|
234
238
|
const schemaSource = files.find((file) => file.path === "database.ts")?.content ?? "";
|
|
235
239
|
|
package/src/index.ts
CHANGED
|
@@ -337,6 +337,7 @@ async function runDeploy(
|
|
|
337
337
|
docsUrl: string;
|
|
338
338
|
routes: { method: string; path: string }[];
|
|
339
339
|
plan: { operations: { type: string; table: string; column?: string; sql: string }[] };
|
|
340
|
+
warnings?: string[];
|
|
340
341
|
}>(`/v1/projects/${link.projectId}/deploy`, {
|
|
341
342
|
method: "POST",
|
|
342
343
|
body: JSON.stringify({
|
|
@@ -364,6 +365,9 @@ async function runDeploy(
|
|
|
364
365
|
for (const route of result.routes) {
|
|
365
366
|
console.log(` ${route.method.toUpperCase()} ${route.path}`);
|
|
366
367
|
}
|
|
368
|
+
for (const warning of result.warnings ?? []) {
|
|
369
|
+
console.log(`Warning: ${warning}`);
|
|
370
|
+
}
|
|
367
371
|
return result.appUrl ?? result.apiUrl;
|
|
368
372
|
} catch (error) {
|
|
369
373
|
if (
|