@rebasepro/cli 0.6.1 → 0.8.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/README.md +0 -1
- package/dist/commands/api-keys.d.ts +1 -0
- package/dist/commands/generate_sdk.d.ts +1 -1
- package/dist/index.es.js +464 -58
- package/dist/index.es.js.map +1 -1
- package/dist/utils/project.d.ts +15 -0
- package/package.json +8 -9
- package/templates/template/backend/Dockerfile +4 -3
- package/templates/template/backend/functions/hello.ts +32 -32
- package/templates/template/backend/package.json +1 -1
- package/templates/template/backend/src/index.ts +1 -2
- package/templates/template/config/collections/posts.ts +4 -4
- package/templates/template/config/collections/presets/ecommerce/categories.ts +3 -1
- package/templates/template/config/collections/presets/ecommerce/orders.ts +3 -1
- package/templates/template/config/collections/presets/ecommerce/products.ts +3 -1
- package/templates/template/config/collections/tags.ts +1 -3
- package/templates/template/config/collections/users.ts +4 -5
- package/templates/template/frontend/Dockerfile +5 -3
- package/templates/template/package.json +3 -2
- package/templates/template/pnpm-workspace.yaml +2 -0
- package/templates/template/scripts/example.ts +5 -2
- package/skills/rebase-admin/SKILL.md +0 -710
- package/skills/rebase-api/SKILL.md +0 -662
- package/skills/rebase-api/references/.gitkeep +0 -3
- package/skills/rebase-auth/SKILL.md +0 -1143
- package/skills/rebase-auth/references/.gitkeep +0 -3
- package/skills/rebase-backend-postgres/SKILL.md +0 -633
- package/skills/rebase-backend-postgres/references/.gitkeep +0 -3
- package/skills/rebase-basics/SKILL.md +0 -749
- package/skills/rebase-basics/references/.gitkeep +0 -3
- package/skills/rebase-collections/SKILL.md +0 -1328
- package/skills/rebase-collections/references/.gitkeep +0 -3
- package/skills/rebase-cron-jobs/SKILL.md +0 -699
- package/skills/rebase-cron-jobs/references/.gitkeep +0 -1
- package/skills/rebase-custom-functions/SKILL.md +0 -233
- package/skills/rebase-deployment/SKILL.md +0 -885
- package/skills/rebase-deployment/references/.gitkeep +0 -3
- package/skills/rebase-design-language/SKILL.md +0 -692
- package/skills/rebase-email/SKILL.md +0 -701
- package/skills/rebase-email/references/.gitkeep +0 -1
- package/skills/rebase-entity-history/SKILL.md +0 -485
- package/skills/rebase-entity-history/references/.gitkeep +0 -1
- package/skills/rebase-local-env-setup/SKILL.md +0 -189
- package/skills/rebase-local-env-setup/references/.gitkeep +0 -3
- package/skills/rebase-realtime/SKILL.md +0 -755
- package/skills/rebase-realtime/references/.gitkeep +0 -3
- package/skills/rebase-sdk/SKILL.md +0 -594
- package/skills/rebase-sdk/references/.gitkeep +0 -0
- package/skills/rebase-storage/SKILL.md +0 -765
- package/skills/rebase-storage/references/.gitkeep +0 -3
- package/skills/rebase-studio/SKILL.md +0 -746
- package/skills/rebase-studio/references/.gitkeep +0 -3
- package/skills/rebase-ui-components/SKILL.md +0 -1488
- package/skills/rebase-ui-components/references/.gitkeep +0 -3
- package/skills/rebase-webhooks/SKILL.md +0 -623
- package/skills/rebase-webhooks/references/.gitkeep +0 -1
- package/templates/template/backend/drizzle.config.ts +0 -51
package/dist/utils/project.d.ts
CHANGED
|
@@ -35,6 +35,21 @@ export declare function resolveLocalBin(projectRoot: string, binName: string): s
|
|
|
35
35
|
* Resolve the tsx binary. Checks backend node_modules first, then root.
|
|
36
36
|
*/
|
|
37
37
|
export declare function resolveTsx(projectRoot: string): string | null;
|
|
38
|
+
/**
|
|
39
|
+
* Validate that a resolved tsx binary actually has an intact installation.
|
|
40
|
+
*
|
|
41
|
+
* `resolveLocalBin` only checks whether `node_modules/.bin/tsx` (a symlink)
|
|
42
|
+
* exists. If the pnpm content-addressable store was cleaned or a previous
|
|
43
|
+
* install was interrupted, the symlink can exist while critical files inside
|
|
44
|
+
* the tsx package (e.g. `dist/preflight.cjs`) are missing — causing a
|
|
45
|
+
* confusing MODULE_NOT_FOUND error at runtime.
|
|
46
|
+
*
|
|
47
|
+
* This function follows the symlink, walks up to find the tsx package root
|
|
48
|
+
* (`package.json` with `name: "tsx"`), and verifies that `dist/preflight.cjs`
|
|
49
|
+
* is present. Returns `null` when the installation looks healthy, or an
|
|
50
|
+
* error description string when it appears corrupted.
|
|
51
|
+
*/
|
|
52
|
+
export declare function validateTsxInstallation(tsxBinPath: string): string | null;
|
|
38
53
|
/**
|
|
39
54
|
* Require the project root or exit with a helpful error.
|
|
40
55
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rebasepro/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "Developer tools for Rebase projects",
|
|
5
5
|
"main": "./dist/index.es.js",
|
|
6
6
|
"module": "./dist/index.es.js",
|
|
@@ -31,10 +31,11 @@
|
|
|
31
31
|
"execa": "^9.6.1",
|
|
32
32
|
"inquirer": "14.0.2",
|
|
33
33
|
"jiti": "^2.7.0",
|
|
34
|
-
"@rebasepro/
|
|
35
|
-
"@rebasepro/
|
|
36
|
-
"@rebasepro/server-
|
|
37
|
-
"@rebasepro/types": "0.
|
|
34
|
+
"@rebasepro/agent-skills": "0.8.0",
|
|
35
|
+
"@rebasepro/sdk-generator": "0.8.0",
|
|
36
|
+
"@rebasepro/server-postgresql": "0.8.0",
|
|
37
|
+
"@rebasepro/types": "0.8.0",
|
|
38
|
+
"@rebasepro/server-core": "0.8.0"
|
|
38
39
|
},
|
|
39
40
|
"devDependencies": {
|
|
40
41
|
"@types/node": "^25.9.3",
|
|
@@ -47,8 +48,7 @@
|
|
|
47
48
|
"files": [
|
|
48
49
|
"bin/",
|
|
49
50
|
"dist/",
|
|
50
|
-
"templates/"
|
|
51
|
-
"skills/"
|
|
51
|
+
"templates/"
|
|
52
52
|
],
|
|
53
53
|
"exports": {
|
|
54
54
|
".": {
|
|
@@ -64,8 +64,7 @@
|
|
|
64
64
|
"scripts": {
|
|
65
65
|
"test": "vitest run",
|
|
66
66
|
"test:e2e": "vitest run --config vitest.e2e.config.ts",
|
|
67
|
-
"prebuild": "rm -rf skills && cp -r ../../rebase-agent-skills/skills skills",
|
|
68
67
|
"build": "vite build && tsc --emitDeclarationOnly -p tsconfig.json",
|
|
69
|
-
"clean": "rm -rf dist
|
|
68
|
+
"clean": "rm -rf dist && find ./src -name '*.js' -type f | xargs rm -f"
|
|
70
69
|
}
|
|
71
70
|
}
|
|
@@ -14,12 +14,12 @@ ENV PATH="$PNPM_HOME:$PATH"
|
|
|
14
14
|
RUN corepack enable
|
|
15
15
|
|
|
16
16
|
# Native dependencies for bcrypt, pg, etc.
|
|
17
|
-
RUN apk add --no-cache python3 make g++
|
|
17
|
+
RUN apk add --no-cache python3 make g++ curl ca-certificates
|
|
18
18
|
|
|
19
19
|
WORKDIR /app
|
|
20
20
|
|
|
21
21
|
# Copy workspace root files first (cache-friendly layer)
|
|
22
|
-
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./
|
|
22
|
+
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml .npmrc ./
|
|
23
23
|
|
|
24
24
|
# Copy workspace packages
|
|
25
25
|
COPY backend ./backend
|
|
@@ -41,6 +41,7 @@ FROM node:22-alpine AS runtime
|
|
|
41
41
|
ENV PNPM_HOME="/pnpm"
|
|
42
42
|
ENV PATH="$PNPM_HOME:$PATH"
|
|
43
43
|
ENV NODE_ENV=production
|
|
44
|
+
ENV CI=true
|
|
44
45
|
|
|
45
46
|
RUN corepack enable
|
|
46
47
|
|
|
@@ -50,7 +51,7 @@ RUN addgroup -g 1001 rebase && adduser -u 1001 -G rebase -s /bin/sh -D rebase
|
|
|
50
51
|
WORKDIR /app
|
|
51
52
|
|
|
52
53
|
# Copy only production artifacts
|
|
53
|
-
COPY --from=builder /app/package.json /app/pnpm-lock.yaml /app/pnpm-workspace.yaml ./
|
|
54
|
+
COPY --from=builder /app/package.json /app/pnpm-lock.yaml /app/pnpm-workspace.yaml /app/.npmrc ./
|
|
54
55
|
COPY --from=builder /app/node_modules ./node_modules
|
|
55
56
|
COPY --from=builder /app/backend ./backend
|
|
56
57
|
COPY --from=builder /app/config ./config
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { HonoEnv } from "@rebasepro/server-core";
|
|
3
|
-
import { rebase } from "@rebasepro/server-core";
|
|
1
|
+
import { defineFunction } from "@rebasepro/server-core";
|
|
4
2
|
|
|
5
3
|
/**
|
|
6
4
|
* Example custom function route.
|
|
@@ -12,41 +10,43 @@ import { rebase } from "@rebasepro/server-core";
|
|
|
12
10
|
* Call from the client SDK:
|
|
13
11
|
* const result = await client.call("functions/hello", { name: "World" });
|
|
14
12
|
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
13
|
+
* Authored with `defineFunction`, which hands you a pre-typed Hono app
|
|
14
|
+
* (so `c.get("user")` / `c.get("driver")` are typed) and the `rebase`
|
|
15
|
+
* singleton via the injected context — use any Hono middleware, define any
|
|
16
|
+
* HTTP methods, access the request/response directly.
|
|
17
17
|
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
18
|
+
* `rebase` gives you admin-level access to all app-scoped services
|
|
19
|
+
* (data, auth, storage, email). For request-scoped / RLS-scoped access,
|
|
20
|
+
* use c.get("user") and c.get("driver").
|
|
21
21
|
*/
|
|
22
|
-
|
|
22
|
+
export default defineFunction((app, { rebase }) => {
|
|
23
|
+
void rebase; // available for data/auth/storage/email — see commented usage below
|
|
23
24
|
|
|
24
|
-
app.post("/", async (c) => {
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
app.post("/", async (c) => {
|
|
26
|
+
const body = await c.req.json().catch(() => ({}));
|
|
27
|
+
const user = c.get("user");
|
|
27
28
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
const userId = (user && typeof user === "object" && "userId" in user)
|
|
30
|
+
? user.userId
|
|
31
|
+
: "anonymous";
|
|
31
32
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
33
|
+
// Access any Rebase service via the injected `rebase`:
|
|
34
|
+
// await rebase.email?.send({
|
|
35
|
+
// to: "admin@example.com",
|
|
36
|
+
// subject: "Function called",
|
|
37
|
+
// html: `<p>Hello from ${userId}!</p>`,
|
|
38
|
+
// });
|
|
39
|
+
//
|
|
40
|
+
// const authors = await rebase.data.authors.find({ limit: 5 });
|
|
40
41
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
return c.json({
|
|
43
|
+
message: `Hello, ${body.name || "World"}!`,
|
|
44
|
+
user: userId
|
|
45
|
+
});
|
|
44
46
|
});
|
|
45
|
-
});
|
|
46
47
|
|
|
47
|
-
app.get("/", (c) => {
|
|
48
|
-
|
|
49
|
-
endpoint: "hello" });
|
|
48
|
+
app.get("/", (c) => {
|
|
49
|
+
return c.json({ status: "ok",
|
|
50
|
+
endpoint: "hello" });
|
|
51
|
+
});
|
|
50
52
|
});
|
|
51
|
-
|
|
52
|
-
export default app;
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
"@rebasepro/server-core": "workspace:*",
|
|
15
15
|
"@rebasepro/server-postgresql": "workspace:*",
|
|
16
16
|
"@rebasepro/admin": "workspace:*",
|
|
17
|
+
"@rebasepro/types": "workspace:*",
|
|
17
18
|
"drizzle-orm": "^0.45.2",
|
|
18
19
|
"hono": "^4.12.10",
|
|
19
20
|
"@hono/node-server": "^1.19.12",
|
|
@@ -26,7 +27,6 @@
|
|
|
26
27
|
"@types/pg": "^8.6.5",
|
|
27
28
|
"@types/node": "^20.10.5",
|
|
28
29
|
"@types/ws": "^8.5.10",
|
|
29
|
-
"drizzle-kit": "^0.31.4",
|
|
30
30
|
"tsx": "^4.20.6",
|
|
31
31
|
"typescript": "^5.9.2"
|
|
32
32
|
}
|
|
@@ -91,7 +91,6 @@ relations },
|
|
|
91
91
|
google: env.GOOGLE_CLIENT_ID
|
|
92
92
|
? { clientId: env.GOOGLE_CLIENT_ID }
|
|
93
93
|
: undefined,
|
|
94
|
-
seedDefaultRoles: true,
|
|
95
94
|
allowRegistration: env.ALLOW_REGISTRATION,
|
|
96
95
|
email: env.SMTP_HOST
|
|
97
96
|
? {
|
|
@@ -148,7 +147,7 @@ pass: env.SMTP_PASS! }
|
|
|
148
147
|
if (!isProduction) {
|
|
149
148
|
// Dev mode: retry the next port if the current one is in use
|
|
150
149
|
const projectRoot = path.resolve(__dirname, "../..");
|
|
151
|
-
const actualPort = await listenWithPortRetry(server, PORT, { portFileDir: projectRoot });
|
|
150
|
+
const actualPort = await listenWithPortRetry(server, PORT, { portFileDir: projectRoot, serviceKey: env.REBASE_SERVICE_KEY });
|
|
152
151
|
|
|
153
152
|
// Clean up port file on exit
|
|
154
153
|
const cleanup = () => cleanupDevPortFile(projectRoot);
|
|
@@ -12,9 +12,7 @@ const postsCollection: EntityCollection = {
|
|
|
12
12
|
id: {
|
|
13
13
|
name: "ID",
|
|
14
14
|
type: "number",
|
|
15
|
-
|
|
16
|
-
required: true
|
|
17
|
-
}
|
|
15
|
+
isId: "increment"
|
|
18
16
|
},
|
|
19
17
|
title: {
|
|
20
18
|
name: "Title",
|
|
@@ -26,7 +24,9 @@ const postsCollection: EntityCollection = {
|
|
|
26
24
|
content: {
|
|
27
25
|
name: "Content",
|
|
28
26
|
type: "string",
|
|
29
|
-
|
|
27
|
+
ui: {
|
|
28
|
+
markdown: true
|
|
29
|
+
}
|
|
30
30
|
},
|
|
31
31
|
status: {
|
|
32
32
|
name: "Status",
|
|
@@ -38,16 +38,15 @@ roles: ["admin"] }
|
|
|
38
38
|
displayName: {
|
|
39
39
|
name: "Name",
|
|
40
40
|
type: "string",
|
|
41
|
-
columnName: "display_name"
|
|
42
|
-
validation: {
|
|
43
|
-
required: true
|
|
44
|
-
}
|
|
41
|
+
columnName: "display_name"
|
|
45
42
|
},
|
|
46
43
|
photoURL: {
|
|
47
44
|
name: "Photo URL",
|
|
48
45
|
type: "string",
|
|
49
46
|
columnName: "photo_url",
|
|
50
|
-
|
|
47
|
+
ui: {
|
|
48
|
+
url: "image"
|
|
49
|
+
}
|
|
51
50
|
},
|
|
52
51
|
roles: {
|
|
53
52
|
name: "Roles",
|
|
@@ -17,14 +17,16 @@ RUN apk add --no-cache python3 make g++
|
|
|
17
17
|
WORKDIR /app
|
|
18
18
|
|
|
19
19
|
# Copy workspace root files
|
|
20
|
-
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./
|
|
20
|
+
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml .npmrc ./
|
|
21
21
|
|
|
22
22
|
# Copy workspace packages
|
|
23
23
|
COPY frontend ./frontend
|
|
24
24
|
COPY config ./config
|
|
25
25
|
|
|
26
|
-
# Install dependencies
|
|
27
|
-
|
|
26
|
+
# Install dependencies (skip scripts to avoid @ariga/atlas binary download,
|
|
27
|
+
# which is a backend-only dependency that may fail on certain platforms)
|
|
28
|
+
RUN pnpm install --frozen-lockfile --ignore-scripts
|
|
29
|
+
RUN pnpm rebuild esbuild
|
|
28
30
|
|
|
29
31
|
# Build config first, then frontend
|
|
30
32
|
RUN pnpm --filter "*-config" run build
|
|
@@ -17,7 +17,6 @@
|
|
|
17
17
|
"db:migrate": "rebase db migrate",
|
|
18
18
|
"schema:introspect": "rebase schema introspect",
|
|
19
19
|
"db:push": "rebase db push --collections ../config/collections",
|
|
20
|
-
"db:studio": "rebase db studio",
|
|
21
20
|
"schema:generate": "rebase schema generate --collections ../config/collections",
|
|
22
21
|
"generate:sdk": "rebase generate-sdk",
|
|
23
22
|
"skills:install": "rebase skills install",
|
|
@@ -25,6 +24,7 @@
|
|
|
25
24
|
},
|
|
26
25
|
"devDependencies": {
|
|
27
26
|
"@rebasepro/cli": "workspace:*",
|
|
27
|
+
"@rebasepro/types": "workspace:*",
|
|
28
28
|
"concurrently": "^8.2.2",
|
|
29
29
|
"typescript": "^5.9.2"
|
|
30
30
|
},
|
|
@@ -34,7 +34,8 @@
|
|
|
34
34
|
"pnpm": {
|
|
35
35
|
"onlyBuiltDependencies": [
|
|
36
36
|
"esbuild",
|
|
37
|
-
"sharp"
|
|
37
|
+
"sharp",
|
|
38
|
+
"@ariga/atlas"
|
|
38
39
|
]
|
|
39
40
|
}
|
|
40
41
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Scripts run OUTSIDE the server and need explicit authentication.
|
|
5
5
|
* Use a Service Key (set in .env as REBASE_SERVICE_KEY) to get admin
|
|
6
|
-
* access — similar to a
|
|
6
|
+
* access — similar to a Service Account credential.
|
|
7
7
|
*
|
|
8
8
|
* Usage:
|
|
9
9
|
* # With local dev server running (`pnpm dev` in another terminal):
|
|
@@ -75,7 +75,10 @@ async function run() {
|
|
|
75
75
|
|
|
76
76
|
try {
|
|
77
77
|
// Example: Check backend health
|
|
78
|
-
const
|
|
78
|
+
const res = await fetch(`${baseUrl}/health`);
|
|
79
|
+
const health = res.headers.get("content-type")?.includes("application/json")
|
|
80
|
+
? await res.json()
|
|
81
|
+
: { status: res.status, text: await res.text() };
|
|
79
82
|
console.log("✅ Backend health:", health);
|
|
80
83
|
|
|
81
84
|
// Example: Fetch some data (requires auth if backend is secure-by-default)
|