robodev 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.
- package/package.json +1 -1
- package/src/collect-files.test.ts +67 -0
- package/src/collect-files.ts +58 -9
- package/src/config.test.ts +22 -2
- package/src/config.ts +33 -15
- package/src/emit-starter.test.ts +18 -17
- package/src/index.ts +32 -4
- package/templates/auth-chat/.rulesync/rules/frontend-api-boundary.md +1 -1
- package/templates/auth-chat/.rulesync/rules/frontend-notifications.md +1 -1
- package/templates/auth-chat/.rulesync/rules/project-overview.md +3 -3
- package/templates/auth-chat/.rulesync/rules/robodev-api.md +7 -7
- package/templates/auth-chat/.rulesync/rules/robodev-auth.md +3 -2
- package/templates/auth-chat/.rulesync/rules/robodev-database.md +5 -5
- package/templates/auth-chat/.rulesync/rules/role-based-app-structure.md +2 -2
- package/templates/auth-chat/.rulesync/skills/media-feature/SKILL.md +1 -1
- package/templates/auth-chat/.rulesync/skills/robodev-api-route/SKILL.md +3 -3
- package/templates/auth-chat/.rulesync/skills/robodev-table/SKILL.md +2 -2
- package/templates/auth-chat/README.md +1 -1
- package/templates/auth-chat/apps/fe/package.json +4 -4
- package/templates/auth-chat/package.json +2 -2
- package/templates/auth-chat/{api → robodev/api}/invite.ts +14 -4
- package/templates/auth-chat/{database.ts → robodev/database.ts} +12 -2
- package/templates/auth-chat/robodev/hooks/auth.ts +17 -0
- package/templates/auth-chat/robodev/package.json +4 -0
- package/templates/auth-chat/tsconfig.json +1 -1
- package/templates/backend/README.md +1 -1
- package/templates/backend/package.json +2 -2
- package/templates/backend/robodev/package.json +4 -0
- package/templates/backend/tsconfig.json +1 -1
- package/templates/empty/README.md +2 -2
- package/templates/empty/package.json +2 -2
- package/templates/empty/robodev/package.json +4 -0
- package/templates/empty/tsconfig.json +1 -1
- package/templates/marketplace/.rulesync/rules/frontend-api-boundary.md +1 -1
- package/templates/marketplace/.rulesync/rules/frontend-notifications.md +1 -1
- package/templates/marketplace/.rulesync/rules/project-overview.md +2 -2
- package/templates/marketplace/.rulesync/rules/robodev-api.md +7 -7
- package/templates/marketplace/.rulesync/rules/robodev-auth.md +2 -2
- package/templates/marketplace/.rulesync/rules/robodev-database.md +5 -5
- package/templates/marketplace/.rulesync/rules/role-based-app-structure.md +2 -2
- package/templates/marketplace/.rulesync/skills/media-feature/SKILL.md +1 -1
- package/templates/marketplace/.rulesync/skills/robodev-api-route/SKILL.md +3 -3
- package/templates/marketplace/.rulesync/skills/robodev-table/SKILL.md +2 -2
- package/templates/marketplace/README.md +2 -2
- package/templates/marketplace/apps/fe/package.json +4 -4
- package/templates/marketplace/package.json +2 -2
- package/templates/marketplace/robodev/package.json +4 -0
- package/templates/marketplace/tsconfig.json +1 -1
- package/templates/space/.rulesync/rules/frontend-api-boundary.md +1 -1
- package/templates/space/.rulesync/rules/frontend-notifications.md +1 -1
- package/templates/space/.rulesync/rules/project-overview.md +2 -2
- package/templates/space/.rulesync/rules/robodev-api.md +7 -7
- package/templates/space/.rulesync/rules/robodev-auth.md +2 -2
- package/templates/space/.rulesync/rules/robodev-database.md +5 -5
- package/templates/space/.rulesync/rules/role-based-app-structure.md +2 -2
- package/templates/space/.rulesync/skills/media-feature/SKILL.md +1 -1
- package/templates/space/.rulesync/skills/robodev-api-route/SKILL.md +3 -3
- package/templates/space/.rulesync/skills/robodev-table/SKILL.md +2 -2
- package/templates/space/README.md +2 -2
- package/templates/space/apps/fe/package.json +4 -4
- package/templates/space/package.json +2 -2
- package/templates/space/robodev/package.json +4 -0
- package/templates/space/tsconfig.json +1 -1
- /package/templates/auth-chat/{api → robodev/api}/health.ts +0 -0
- /package/templates/auth-chat/{api → robodev/api}/me.ts +0 -0
- /package/templates/auth-chat/{api → robodev/api}/messages.ts +0 -0
- /package/templates/backend/{api → robodev/api}/_lib.ts +0 -0
- /package/templates/backend/{api → robodev/api}/aliens/labels.ts +0 -0
- /package/templates/backend/{api → robodev/api}/planets/[id]/like.ts +0 -0
- /package/templates/backend/{api → robodev/api}/planets/[id].ts +0 -0
- /package/templates/backend/{api → robodev/api}/planets/paginate.ts +0 -0
- /package/templates/backend/{api → robodev/api}/planets.ts +0 -0
- /package/templates/backend/{database.ts → robodev/database.ts} +0 -0
- /package/templates/empty/{api → robodev/api}/health.ts +0 -0
- /package/templates/empty/{database.ts → robodev/database.ts} +0 -0
- /package/templates/marketplace/{api → robodev/api}/_lib.seed.test.ts +0 -0
- /package/templates/marketplace/{api → robodev/api}/_lib.ts +0 -0
- /package/templates/marketplace/{api → robodev/api}/cart/[id].ts +0 -0
- /package/templates/marketplace/{api → robodev/api}/cart.ts +0 -0
- /package/templates/marketplace/{api → robodev/api}/categories.ts +0 -0
- /package/templates/marketplace/{api → robodev/api}/checkout.ts +0 -0
- /package/templates/marketplace/{api → robodev/api}/health.ts +0 -0
- /package/templates/marketplace/{api → robodev/api}/listings/[id].ts +0 -0
- /package/templates/marketplace/{api → robodev/api}/listings/paginate.ts +0 -0
- /package/templates/marketplace/{api → robodev/api}/listings.ts +0 -0
- /package/templates/marketplace/{api → robodev/api}/me.ts +0 -0
- /package/templates/marketplace/{api → robodev/api}/orders/[id]/complete.ts +0 -0
- /package/templates/marketplace/{api → robodev/api}/orders/[id]/ship.ts +0 -0
- /package/templates/marketplace/{api → robodev/api}/orders/[id].ts +0 -0
- /package/templates/marketplace/{api → robodev/api}/purchases.ts +0 -0
- /package/templates/marketplace/{api → robodev/api}/reviews.ts +0 -0
- /package/templates/marketplace/{api → robodev/api}/sales.ts +0 -0
- /package/templates/marketplace/{api → robodev/api}/watches/[listingId].ts +0 -0
- /package/templates/marketplace/{api → robodev/api}/watches.ts +0 -0
- /package/templates/marketplace/{database.ts → robodev/database.ts} +0 -0
- /package/templates/space/{api → robodev/api}/_lib.ts +0 -0
- /package/templates/space/{api → robodev/api}/aliens/labels.ts +0 -0
- /package/templates/space/{api → robodev/api}/planets/[id]/like.ts +0 -0
- /package/templates/space/{api → robodev/api}/planets/[id].ts +0 -0
- /package/templates/space/{api → robodev/api}/planets/paginate.ts +0 -0
- /package/templates/space/{api → robodev/api}/planets.ts +0 -0
- /package/templates/space/{database.ts → robodev/database.ts} +0 -0
|
@@ -8,10 +8,10 @@
|
|
|
8
8
|
"dev": "bunx --bun vite",
|
|
9
9
|
"build": "bun run openapi:gen && bunx --bun vite build",
|
|
10
10
|
"clean": "rimraf dist src/openapi",
|
|
11
|
-
"lint": "oxlint --type-aware . ../../api ../../database.ts --fix",
|
|
12
|
-
"lint:check": "oxlint --type-aware . ../../api ../../database.ts --quiet",
|
|
13
|
-
"format": "oxfmt -c \"../../oxfmt.config.js\" . ../../api ../../database.ts",
|
|
14
|
-
"format:check": "oxfmt -c \"../../oxfmt.config.js\" --check . ../../api ../../database.ts",
|
|
11
|
+
"lint": "oxlint --type-aware . ../../robodev/api ../../robodev/database.ts --fix",
|
|
12
|
+
"lint:check": "oxlint --type-aware . ../../robodev/api ../../robodev/database.ts --quiet",
|
|
13
|
+
"format": "oxfmt -c \"../../oxfmt.config.js\" . ../../robodev/api ../../robodev/database.ts",
|
|
14
|
+
"format:check": "oxfmt -c \"../../oxfmt.config.js\" --check . ../../robodev/api ../../robodev/database.ts",
|
|
15
15
|
"ts:check": "tsc -b --noEmit",
|
|
16
16
|
"test": "vitest run",
|
|
17
17
|
"check": "bun ts:check && bun lint:check && bun format:check",
|
|
@@ -8,10 +8,10 @@
|
|
|
8
8
|
"rules:gen": "rulesync generate"
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@robodev-ai/sdk": "^0.
|
|
11
|
+
"@robodev-ai/sdk": "^0.7.0"
|
|
12
12
|
},
|
|
13
13
|
"devDependencies": {
|
|
14
|
-
"robodev": "^0.
|
|
14
|
+
"robodev": "^0.28.0",
|
|
15
15
|
"rulesync": "^8.18.0",
|
|
16
16
|
"typescript": "^5.9.2"
|
|
17
17
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
/** POST /api/invite — signed-in users
|
|
1
|
+
/** POST /api/invite — signed-in users persist an invite, then send email. */
|
|
2
|
+
import { invites } from "../database";
|
|
2
3
|
import { defineApi, z } from "@robodev-ai/sdk";
|
|
3
4
|
|
|
4
5
|
function headerValue(
|
|
@@ -28,16 +29,25 @@ export const post = defineApi({
|
|
|
28
29
|
auth: "required",
|
|
29
30
|
body: z.object({ to: z.string().email() }),
|
|
30
31
|
response: z.object({ id: z.string(), status: z.literal("sent") }),
|
|
31
|
-
handler: async ({ email, body, user, env, headers }) => {
|
|
32
|
+
handler: async ({ db, email, body, user, env, headers }) => {
|
|
33
|
+
const inviteEmail = body.to.toLowerCase();
|
|
34
|
+
const [row] = await db
|
|
35
|
+
.insert(invites)
|
|
36
|
+
.values({
|
|
37
|
+
email: inviteEmail,
|
|
38
|
+
invitedByUserId: user!.id,
|
|
39
|
+
})
|
|
40
|
+
.returning();
|
|
32
41
|
const url = resolveProjectUrl(env, headers);
|
|
33
42
|
const who = user?.name?.trim() || user?.email || "Someone";
|
|
34
43
|
const project = url ? ` Project URL: ${url}` : "";
|
|
35
|
-
|
|
36
|
-
to:
|
|
44
|
+
const sent = await email.send({
|
|
45
|
+
to: inviteEmail,
|
|
37
46
|
subject: "You're invited to the chat",
|
|
38
47
|
text:
|
|
39
48
|
`${who} invited you to a shared chat on Robodev. ` +
|
|
40
49
|
`Open the App URL and sign in to join.${project}`,
|
|
41
50
|
});
|
|
51
|
+
return { id: row?.id ?? sent.id, status: "sent" as const };
|
|
42
52
|
},
|
|
43
53
|
});
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Shared chat room. `robodev_auth.users` is platform-owned — store only a
|
|
3
|
-
* snapshot of the author on each message.
|
|
3
|
+
* snapshot of the author on each message. Invite `userId` columns are text
|
|
4
|
+
* matching Auth `ctx.user.id`.
|
|
4
5
|
*/
|
|
5
6
|
import { defineDatabase, pgTable, text, timestamp, uuid } from "@robodev-ai/sdk";
|
|
6
7
|
|
|
@@ -13,7 +14,16 @@ export const messages = pgTable("messages", {
|
|
|
13
14
|
createdAt: timestamp("createdAt", { withTimezone: true }).defaultNow(),
|
|
14
15
|
});
|
|
15
16
|
|
|
17
|
+
export const invites = pgTable("invites", {
|
|
18
|
+
id: uuid("id").primaryKey().defaultRandom(),
|
|
19
|
+
email: text("email").notNull(),
|
|
20
|
+
invitedByUserId: text("invitedByUserId").notNull(),
|
|
21
|
+
createdAt: timestamp("createdAt", { withTimezone: true }).defaultNow(),
|
|
22
|
+
claimedAt: timestamp("claimedAt", { withTimezone: true }),
|
|
23
|
+
claimedByUserId: text("claimedByUserId"),
|
|
24
|
+
});
|
|
25
|
+
|
|
16
26
|
export default defineDatabase({
|
|
17
27
|
name: "chat",
|
|
18
|
-
tables: { messages },
|
|
28
|
+
tables: { messages, invites },
|
|
19
29
|
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { and, defineAuthHook, eq, isNull } from "@robodev-ai/sdk";
|
|
2
|
+
import { invites } from "../database";
|
|
3
|
+
|
|
4
|
+
export default defineAuthHook({
|
|
5
|
+
onUserCreated: async ({ db, event }) => {
|
|
6
|
+
const email = event.user?.email.toLowerCase();
|
|
7
|
+
const userId = event.user?.id;
|
|
8
|
+
if (!email || !userId) return;
|
|
9
|
+
await db
|
|
10
|
+
.update(invites)
|
|
11
|
+
.set({
|
|
12
|
+
claimedAt: new Date(),
|
|
13
|
+
claimedByUserId: userId,
|
|
14
|
+
})
|
|
15
|
+
.where(and(eq(invites.email, email), isNull(invites.claimedAt)));
|
|
16
|
+
},
|
|
17
|
+
});
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# {{NAME}}
|
|
2
2
|
|
|
3
|
-
Blank `database.ts` and `GET /api/health` — no sample schema or UI. For Lovable, Bolt, or v0.
|
|
3
|
+
Blank `robodev/database.ts` and `GET /api/health` — no sample schema or UI. For Lovable, Bolt, or v0.
|
|
4
4
|
|
|
5
|
-
Deploy `database.ts` and `api/` from a real terminal:
|
|
5
|
+
Deploy `robodev/database.ts` and `robodev/api/` from a real terminal:
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
8
|
npx robodev deploy
|
|
@@ -23,7 +23,7 @@ For generated mutations, pass invalidation through the mutation options instead
|
|
|
23
23
|
|
|
24
24
|
After mutations, derive follow-up UI state from canonical API response or query state instead of leaving action controls unchanged. Disable duplicate submissions when the API state already represents a pending or completed action, and surface mutation errors through the default generated-client error handler or a feature-specific message.
|
|
25
25
|
|
|
26
|
-
Do not import `@robodev-ai/sdk`, `database.ts`, Drizzle tables, or API helper modules into frontend features.
|
|
26
|
+
Do not import `@robodev-ai/sdk`, `robodev/database.ts`, Drizzle tables, or API helper modules into frontend features.
|
|
27
27
|
|
|
28
28
|
`apps/fe/src/openapi` is generated by `@povio/openapi-codegen-cli` from root `openapi.json` (or a live project `/openapi.json` when `OPENAPI_LIVE=true`). Do not hand-edit generated OpenAPI client files.
|
|
29
29
|
|
|
@@ -11,7 +11,7 @@ cursor:
|
|
|
11
11
|
|
|
12
12
|
# Frontend Notifications
|
|
13
13
|
|
|
14
|
-
Use generated `@/openapi` queries, mutations, and models for notification history, preferences, and push-token registration. Do not import `@robodev-ai/sdk` or `database.ts` into frontend feature code.
|
|
14
|
+
Use generated `@/openapi` queries, mutations, and models for notification history, preferences, and push-token registration. Do not import `@robodev-ai/sdk` or `robodev/database.ts` into frontend feature code.
|
|
15
15
|
|
|
16
16
|
Request push permission only after an explanatory UI and explicit user gesture. Never request it automatically during initial application load. Handle unsupported, default, denied, granted, registered, expired, and failed-registration states.
|
|
17
17
|
|
|
@@ -11,7 +11,7 @@ cursor:
|
|
|
11
11
|
|
|
12
12
|
# Marketplace starter AI rules
|
|
13
13
|
|
|
14
|
-
This project is a Vite React frontend in `apps/fe` plus a Robodev backend
|
|
14
|
+
This project is a Vite React frontend in `apps/fe` plus a Robodev backend under **`robodev/`** (`robodev/database.ts` + `robodev/api/**/*.ts` using `@robodev-ai/sdk`). There is no Expo / mobile app in this starter. End-user auth is reserved on the project host at `/api/user/*`. There is no in-browser fake backend.
|
|
15
15
|
|
|
16
16
|
`robodev deploy` from this root uploads schema and APIs. It does not host the Povio SPA. Run the UI with bun in `apps/fe`.
|
|
17
17
|
|
|
@@ -23,7 +23,7 @@ When an app has multiple user roles with distinct UI or business workflows, use
|
|
|
23
23
|
|
|
24
24
|
Use the more specific generated rules for:
|
|
25
25
|
|
|
26
|
-
- Robodev `defineDatabase` tables in `database.ts`.
|
|
26
|
+
- Robodev `defineDatabase` tables in `robodev/database.ts`.
|
|
27
27
|
- Robodev `defineApi` routes in `api/`.
|
|
28
28
|
- Reserved `/api/user/*` auth contracts (do not implement `api/user/**` in the project).
|
|
29
29
|
- Frontend API boundaries around generated `@/openapi` queries and models.
|
|
@@ -2,24 +2,24 @@
|
|
|
2
2
|
root: false
|
|
3
3
|
targets: ["claudecode", "codexcli", "cursor"]
|
|
4
4
|
description: "Robodev defineApi file routes and handler conventions."
|
|
5
|
-
globs: ["api/**/*.ts"]
|
|
5
|
+
globs: ["robodev/api/**/*.ts"]
|
|
6
6
|
cursor:
|
|
7
7
|
alwaysApply: false
|
|
8
8
|
description: "Apply when editing Starbase API routes."
|
|
9
|
-
globs: ["api/**/*.ts"]
|
|
9
|
+
globs: ["robodev/api/**/*.ts"]
|
|
10
10
|
---
|
|
11
11
|
|
|
12
12
|
# Robodev API
|
|
13
13
|
|
|
14
|
-
Project APIs live in `api/`. `api/planets.ts` is served at `/planets` and `/api/planets`. Prefer the `/api/...` path in OpenAPI and frontend clients.
|
|
14
|
+
Project APIs live in `robodev/api/`. `robodev/api/planets.ts` is served at `/planets` and `/api/planets`. Prefer the `/api/...` path in OpenAPI and frontend clients.
|
|
15
15
|
|
|
16
16
|
## File layout
|
|
17
17
|
|
|
18
|
-
- `api/foo.ts` → `/api/foo`
|
|
19
|
-
- `api/foo/[id].ts` → `/api/foo/:id`
|
|
18
|
+
- `robodev/api/foo.ts` → `/api/foo`
|
|
19
|
+
- `robodev/api/foo/[id].ts` → `/api/foo/:id`
|
|
20
20
|
- Export `get` / `post` / `put` / `patch` / `delete` as `defineApi(...)`.
|
|
21
|
-
- Shared helpers belong in `api/_lib.ts`. Do not export `defineApi` from `_lib.ts`.
|
|
22
|
-
- Do not add `api/user/**`. Those paths are reserved for Robodev Auth.
|
|
21
|
+
- Shared helpers belong in `robodev/api/_lib.ts`. Do not export `defineApi` from `_lib.ts`.
|
|
22
|
+
- Do not add `robodev/api/user/**`. Those paths are reserved for Robodev Auth.
|
|
23
23
|
|
|
24
24
|
## Handlers
|
|
25
25
|
|
|
@@ -8,8 +8,8 @@ cursor:
|
|
|
8
8
|
description: "Apply when touching auth, login, register, or /api/user clients."
|
|
9
9
|
globs:
|
|
10
10
|
[
|
|
11
|
-
"database.ts",
|
|
12
|
-
"api/**/*.ts",
|
|
11
|
+
"robodev/database.ts",
|
|
12
|
+
"robodev/api/**/*.ts",
|
|
13
13
|
"apps/fe/src/components/features/auth/**/*.{ts,tsx}",
|
|
14
14
|
"apps/fe/src/clients/**/*.ts",
|
|
15
15
|
]
|
|
@@ -2,21 +2,21 @@
|
|
|
2
2
|
root: false
|
|
3
3
|
targets: ["claudecode", "codexcli", "cursor"]
|
|
4
4
|
description: "Robodev database.ts Drizzle schema and deploy sync."
|
|
5
|
-
globs: ["database.ts"]
|
|
5
|
+
globs: ["robodev/database.ts"]
|
|
6
6
|
cursor:
|
|
7
7
|
alwaysApply: false
|
|
8
8
|
description: "Apply when editing the Starbase database schema."
|
|
9
|
-
globs: ["database.ts"]
|
|
9
|
+
globs: ["robodev/database.ts"]
|
|
10
10
|
---
|
|
11
11
|
|
|
12
12
|
# Robodev Database
|
|
13
13
|
|
|
14
|
-
The backend schema lives in `database.ts
|
|
14
|
+
The backend schema lives in `robodev/database.ts`. Default-export `defineDatabase` with Drizzle `pgTable` definitions. `robodev deploy` from this root creates or syncs the named Postgres database. There are no migration files.
|
|
15
15
|
|
|
16
16
|
## Rules
|
|
17
17
|
|
|
18
18
|
- Import table helpers from `@robodev-ai/sdk` (`pgTable`, `uuid`, `text`, `timestamp`, `integer`, and query helpers).
|
|
19
19
|
- Do not recreate User or auth tables. End users live in platform `robodev_auth`. Store `userId` as `text` matching `ctx.user.id`.
|
|
20
20
|
- Prefer scalar columns and foreign keys. Destructive drops need deploy confirmation or `--force`.
|
|
21
|
-
- Export named tables so API files can import them from `../database` or `api/_lib.ts`.
|
|
22
|
-
- Seed demo rows in API handlers on first read (see `api/_lib.ts` `ensureSeed`), not with a separate seed runner.
|
|
21
|
+
- Export named tables so API files can import them from `../database` or `robodev/api/_lib.ts`.
|
|
22
|
+
- Seed demo rows in API handlers on first read (see `robodev/api/_lib.ts` `ensureSeed`), not with a separate seed runner.
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
root: false
|
|
3
3
|
targets: ["claudecode", "codexcli", "cursor"]
|
|
4
4
|
description: "Conditional role-based frontend and API structure for apps with distinct user roles."
|
|
5
|
-
globs: ["apps/fe/src/**/*.{ts,tsx}", "api/**/*.ts"]
|
|
5
|
+
globs: ["apps/fe/src/**/*.{ts,tsx}", "robodev/api/**/*.ts"]
|
|
6
6
|
cursor:
|
|
7
7
|
alwaysApply: false
|
|
8
8
|
description: "Apply only when an app has multiple user roles with distinct UI surfaces or business workflows."
|
|
9
|
-
globs: ["apps/fe/src/**/*.{ts,tsx}", "api/**/*.ts"]
|
|
9
|
+
globs: ["apps/fe/src/**/*.{ts,tsx}", "robodev/api/**/*.ts"]
|
|
10
10
|
---
|
|
11
11
|
|
|
12
12
|
# Role-Based App Structure
|
|
@@ -18,4 +18,4 @@ Preserve the upload contract:
|
|
|
18
18
|
|
|
19
19
|
Never use a standalone files API. File bytes stay on the device until submit.
|
|
20
20
|
|
|
21
|
-
Media metadata lives in the `media` table in `database.ts`. Bytes live in Robodev storage. Listing images use resource name `listing-image`.
|
|
21
|
+
Media metadata lives in the `media` table in `robodev/database.ts`. Bytes live in Robodev storage. Listing images use resource name `listing-image`.
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: robodev-api-route
|
|
3
|
-
description: Add a defineApi route under api/.
|
|
3
|
+
description: Add a defineApi route under robodev/api/.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Add a Robodev API route
|
|
7
7
|
|
|
8
|
-
1. Create `api/<path>.ts` or `api/<path>/[id].ts`.
|
|
8
|
+
1. Create `robodev/api/<path>.ts` or `robodev/api/<path>/[id].ts`.
|
|
9
9
|
2. Export HTTP methods with `defineApi` from `@robodev-ai/sdk`.
|
|
10
10
|
3. Use `auth: "required"` unless the route is public.
|
|
11
11
|
4. Keep JSON shapes aligned with `openapi.json`.
|
|
12
|
-
5. Do not create `api/user/**` files.
|
|
12
|
+
5. Do not create `robodev/api/user/**` files.
|
|
13
13
|
6. Deploy from the project root (`robodev deploy`), then `bun openapi:gen` in `apps/fe` if the contract changed.
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: robodev-table
|
|
3
|
-
description: Add a Drizzle table to database.ts and wire it into defineApi handlers.
|
|
3
|
+
description: Add a Drizzle table to robodev/database.ts and wire it into defineApi handlers.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Add a Robodev table
|
|
7
7
|
|
|
8
|
-
1. Add a `pgTable` to `database.ts` and include it in `defineDatabase({ tables })`.
|
|
8
|
+
1. Add a `pgTable` to `robodev/database.ts` and include it in `defineDatabase({ tables })`.
|
|
9
9
|
2. Do not add a User table. Auth users are platform-managed; store `userId` as text.
|
|
10
10
|
3. Import the table in `api/_lib.ts` or the route file that needs it.
|
|
11
11
|
4. Deploy from the project root with `robodev deploy`. Destructive drops need confirmation or `--force`.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# {{NAME}}
|
|
2
2
|
|
|
3
|
-
Starter from `robodev create --starter marketplace`: Marketplace C2C marketplace schema (`categories`, `listings`, `cart_items`, `orders`, `watches`, `reviews`, `media`), file-based APIs in `api/`, and a Povio UI in `apps/fe`.
|
|
3
|
+
Starter from `robodev create --starter marketplace`: Marketplace C2C marketplace schema (`categories`, `listings`, `cart_items`, `orders`, `watches`, `reviews`, `media`), file-based APIs in `robodev/api/`, and a Povio UI in `apps/fe`.
|
|
4
4
|
|
|
5
5
|
After a CLI create or deploy with `.robodev` `frontend` set (the default for this starter), the project host serves the built Marketplace SPA at `GET /`. APIs and Swagger still win over static files.
|
|
6
6
|
|
|
@@ -29,7 +29,7 @@ npx robodev deploy
|
|
|
29
29
|
|
|
30
30
|
Dashboard create deploys schema + APIs only. The Marketplace FE tree is copied by `robodev create`; a later CLI deploy hosts the SPA.
|
|
31
31
|
|
|
32
|
-
Auth stays reserved at `/api/user/*`. Do not add `api/user/**`.
|
|
32
|
+
Auth stays reserved at `/api/user/*`. Do not add `robodev/api/user/**`.
|
|
33
33
|
|
|
34
34
|
Regenerate AI rules after editing `.rulesync/`:
|
|
35
35
|
|
|
@@ -8,10 +8,10 @@
|
|
|
8
8
|
"dev": "bunx --bun vite",
|
|
9
9
|
"build": "bun run openapi:gen && bunx --bun vite build",
|
|
10
10
|
"clean": "rimraf dist src/openapi",
|
|
11
|
-
"lint": "oxlint --type-aware . ../../api ../../database.ts --fix",
|
|
12
|
-
"lint:check": "oxlint --type-aware . ../../api ../../database.ts --quiet",
|
|
13
|
-
"format": "oxfmt -c \"../../oxfmt.config.js\" . ../../api ../../database.ts",
|
|
14
|
-
"format:check": "oxfmt -c \"../../oxfmt.config.js\" --check . ../../api ../../database.ts",
|
|
11
|
+
"lint": "oxlint --type-aware . ../../robodev/api ../../robodev/database.ts --fix",
|
|
12
|
+
"lint:check": "oxlint --type-aware . ../../robodev/api ../../robodev/database.ts --quiet",
|
|
13
|
+
"format": "oxfmt -c \"../../oxfmt.config.js\" . ../../robodev/api ../../robodev/database.ts",
|
|
14
|
+
"format:check": "oxfmt -c \"../../oxfmt.config.js\" --check . ../../robodev/api ../../robodev/database.ts",
|
|
15
15
|
"ts:check": "tsc -b --noEmit",
|
|
16
16
|
"test": "vitest run",
|
|
17
17
|
"check": "bun ts:check && bun lint:check && bun format:check",
|
|
@@ -8,10 +8,10 @@
|
|
|
8
8
|
"rules:gen": "rulesync generate"
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@robodev-ai/sdk": "^0.
|
|
11
|
+
"@robodev-ai/sdk": "^0.7.0"
|
|
12
12
|
},
|
|
13
13
|
"devDependencies": {
|
|
14
|
-
"robodev": "^0.
|
|
14
|
+
"robodev": "^0.28.0",
|
|
15
15
|
"rulesync": "^8.18.0",
|
|
16
16
|
"typescript": "^5.9.2"
|
|
17
17
|
}
|
|
@@ -23,7 +23,7 @@ For generated mutations, pass invalidation through the mutation options instead
|
|
|
23
23
|
|
|
24
24
|
After mutations, derive follow-up UI state from canonical API response or query state instead of leaving action controls unchanged. Disable duplicate submissions when the API state already represents a pending or completed action, and surface mutation errors through the default generated-client error handler or a feature-specific message.
|
|
25
25
|
|
|
26
|
-
Do not import `@robodev-ai/sdk`, `database.ts`, Drizzle tables, or API helper modules into frontend features.
|
|
26
|
+
Do not import `@robodev-ai/sdk`, `robodev/database.ts`, Drizzle tables, or API helper modules into frontend features.
|
|
27
27
|
|
|
28
28
|
`apps/fe/src/openapi` is generated by `@povio/openapi-codegen-cli` from root `openapi.json` (or a live project `/openapi.json` when `OPENAPI_LIVE=true`). Do not hand-edit generated OpenAPI client files.
|
|
29
29
|
|
|
@@ -11,7 +11,7 @@ cursor:
|
|
|
11
11
|
|
|
12
12
|
# Frontend Notifications
|
|
13
13
|
|
|
14
|
-
Use generated `@/openapi` queries, mutations, and models for notification history, preferences, and push-token registration. Do not import `@robodev-ai/sdk` or `database.ts` into frontend feature code.
|
|
14
|
+
Use generated `@/openapi` queries, mutations, and models for notification history, preferences, and push-token registration. Do not import `@robodev-ai/sdk` or `robodev/database.ts` into frontend feature code.
|
|
15
15
|
|
|
16
16
|
Request push permission only after an explanatory UI and explicit user gesture. Never request it automatically during initial application load. Handle unsupported, default, denied, granted, registered, expired, and failed-registration states.
|
|
17
17
|
|
|
@@ -11,7 +11,7 @@ cursor:
|
|
|
11
11
|
|
|
12
12
|
# Space starter AI rules
|
|
13
13
|
|
|
14
|
-
This project is a Vite React frontend in `apps/fe` plus a Robodev backend
|
|
14
|
+
This project is a Vite React frontend in `apps/fe` plus a Robodev backend under **`robodev/`** (`robodev/database.ts` + `robodev/api/**/*.ts` using `@robodev-ai/sdk`). There is no Expo / mobile app in this starter. End-user auth is reserved on the project host at `/api/user/*`. There is no in-browser fake backend.
|
|
15
15
|
|
|
16
16
|
`robodev deploy` from this root uploads schema and APIs. It does not host the Povio SPA. Run the UI with bun in `apps/fe`.
|
|
17
17
|
|
|
@@ -23,7 +23,7 @@ When an app has multiple user roles with distinct UI or business workflows, use
|
|
|
23
23
|
|
|
24
24
|
Use the more specific generated rules for:
|
|
25
25
|
|
|
26
|
-
- Robodev `defineDatabase` tables in `database.ts`.
|
|
26
|
+
- Robodev `defineDatabase` tables in `robodev/database.ts`.
|
|
27
27
|
- Robodev `defineApi` routes in `api/`.
|
|
28
28
|
- Reserved `/api/user/*` auth contracts (do not implement `api/user/**` in the project).
|
|
29
29
|
- Frontend API boundaries around generated `@/openapi` queries and models.
|
|
@@ -2,24 +2,24 @@
|
|
|
2
2
|
root: false
|
|
3
3
|
targets: ["claudecode", "codexcli", "cursor"]
|
|
4
4
|
description: "Robodev defineApi file routes and handler conventions."
|
|
5
|
-
globs: ["api/**/*.ts"]
|
|
5
|
+
globs: ["robodev/api/**/*.ts"]
|
|
6
6
|
cursor:
|
|
7
7
|
alwaysApply: false
|
|
8
8
|
description: "Apply when editing Starbase API routes."
|
|
9
|
-
globs: ["api/**/*.ts"]
|
|
9
|
+
globs: ["robodev/api/**/*.ts"]
|
|
10
10
|
---
|
|
11
11
|
|
|
12
12
|
# Robodev API
|
|
13
13
|
|
|
14
|
-
Project APIs live in `api/`. `api/planets.ts` is served at `/planets` and `/api/planets`. Prefer the `/api/...` path in OpenAPI and frontend clients.
|
|
14
|
+
Project APIs live in `robodev/api/`. `robodev/api/planets.ts` is served at `/planets` and `/api/planets`. Prefer the `/api/...` path in OpenAPI and frontend clients.
|
|
15
15
|
|
|
16
16
|
## File layout
|
|
17
17
|
|
|
18
|
-
- `api/foo.ts` → `/api/foo`
|
|
19
|
-
- `api/foo/[id].ts` → `/api/foo/:id`
|
|
18
|
+
- `robodev/api/foo.ts` → `/api/foo`
|
|
19
|
+
- `robodev/api/foo/[id].ts` → `/api/foo/:id`
|
|
20
20
|
- Export `get` / `post` / `put` / `patch` / `delete` as `defineApi(...)`.
|
|
21
|
-
- Shared helpers belong in `api/_lib.ts`. Do not export `defineApi` from `_lib.ts`.
|
|
22
|
-
- Do not add `api/user/**`. Those paths are reserved for Robodev Auth.
|
|
21
|
+
- Shared helpers belong in `robodev/api/_lib.ts`. Do not export `defineApi` from `_lib.ts`.
|
|
22
|
+
- Do not add `robodev/api/user/**`. Those paths are reserved for Robodev Auth.
|
|
23
23
|
|
|
24
24
|
## Handlers
|
|
25
25
|
|
|
@@ -8,8 +8,8 @@ cursor:
|
|
|
8
8
|
description: "Apply when touching auth, login, register, or /api/user clients."
|
|
9
9
|
globs:
|
|
10
10
|
[
|
|
11
|
-
"database.ts",
|
|
12
|
-
"api/**/*.ts",
|
|
11
|
+
"robodev/database.ts",
|
|
12
|
+
"robodev/api/**/*.ts",
|
|
13
13
|
"apps/fe/src/components/features/auth/**/*.{ts,tsx}",
|
|
14
14
|
"apps/fe/src/clients/**/*.ts",
|
|
15
15
|
]
|
|
@@ -2,21 +2,21 @@
|
|
|
2
2
|
root: false
|
|
3
3
|
targets: ["claudecode", "codexcli", "cursor"]
|
|
4
4
|
description: "Robodev database.ts Drizzle schema and deploy sync."
|
|
5
|
-
globs: ["database.ts"]
|
|
5
|
+
globs: ["robodev/database.ts"]
|
|
6
6
|
cursor:
|
|
7
7
|
alwaysApply: false
|
|
8
8
|
description: "Apply when editing the Starbase database schema."
|
|
9
|
-
globs: ["database.ts"]
|
|
9
|
+
globs: ["robodev/database.ts"]
|
|
10
10
|
---
|
|
11
11
|
|
|
12
12
|
# Robodev Database
|
|
13
13
|
|
|
14
|
-
The backend schema lives in `database.ts
|
|
14
|
+
The backend schema lives in `robodev/database.ts`. Default-export `defineDatabase` with Drizzle `pgTable` definitions. `robodev deploy` from this root creates or syncs the named Postgres database. There are no migration files.
|
|
15
15
|
|
|
16
16
|
## Rules
|
|
17
17
|
|
|
18
18
|
- Import table helpers from `@robodev-ai/sdk` (`pgTable`, `uuid`, `text`, `timestamp`, `integer`, and query helpers).
|
|
19
19
|
- Do not recreate User or auth tables. End users live in platform `robodev_auth`. Store `userId` as `text` matching `ctx.user.id`.
|
|
20
20
|
- Prefer scalar columns and foreign keys. Destructive drops need deploy confirmation or `--force`.
|
|
21
|
-
- Export named tables so API files can import them from `../database` or `api/_lib.ts`.
|
|
22
|
-
- Seed demo rows in API handlers on first read (see `api/_lib.ts` `ensureSeed`), not with a separate seed runner.
|
|
21
|
+
- Export named tables so API files can import them from `../database` or `robodev/api/_lib.ts`.
|
|
22
|
+
- Seed demo rows in API handlers on first read (see `robodev/api/_lib.ts` `ensureSeed`), not with a separate seed runner.
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
root: false
|
|
3
3
|
targets: ["claudecode", "codexcli", "cursor"]
|
|
4
4
|
description: "Conditional role-based frontend and API structure for apps with distinct user roles."
|
|
5
|
-
globs: ["apps/fe/src/**/*.{ts,tsx}", "api/**/*.ts"]
|
|
5
|
+
globs: ["apps/fe/src/**/*.{ts,tsx}", "robodev/api/**/*.ts"]
|
|
6
6
|
cursor:
|
|
7
7
|
alwaysApply: false
|
|
8
8
|
description: "Apply only when an app has multiple user roles with distinct UI surfaces or business workflows."
|
|
9
|
-
globs: ["apps/fe/src/**/*.{ts,tsx}", "api/**/*.ts"]
|
|
9
|
+
globs: ["apps/fe/src/**/*.{ts,tsx}", "robodev/api/**/*.ts"]
|
|
10
10
|
---
|
|
11
11
|
|
|
12
12
|
# Role-Based App Structure
|
|
@@ -18,4 +18,4 @@ Preserve the upload contract:
|
|
|
18
18
|
|
|
19
19
|
Never use a standalone files API. File bytes stay on the device until submit.
|
|
20
20
|
|
|
21
|
-
Media metadata lives in the `media` table in `database.ts`. Bytes live in Robodev storage. Planet images use resource name `planet-image`.
|
|
21
|
+
Media metadata lives in the `media` table in `robodev/database.ts`. Bytes live in Robodev storage. Planet images use resource name `planet-image`.
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: robodev-api-route
|
|
3
|
-
description: Add a defineApi route under api/.
|
|
3
|
+
description: Add a defineApi route under robodev/api/.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Add a Robodev API route
|
|
7
7
|
|
|
8
|
-
1. Create `api/<path>.ts` or `api/<path>/[id].ts`.
|
|
8
|
+
1. Create `robodev/api/<path>.ts` or `robodev/api/<path>/[id].ts`.
|
|
9
9
|
2. Export HTTP methods with `defineApi` from `@robodev-ai/sdk`.
|
|
10
10
|
3. Use `auth: "required"` unless the route is public.
|
|
11
11
|
4. Keep JSON shapes aligned with `openapi.json`.
|
|
12
|
-
5. Do not create `api/user/**` files.
|
|
12
|
+
5. Do not create `robodev/api/user/**` files.
|
|
13
13
|
6. Deploy from the project root (`robodev deploy`), then `bun openapi:gen` in `apps/fe` if the contract changed.
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: robodev-table
|
|
3
|
-
description: Add a Drizzle table to database.ts and wire it into defineApi handlers.
|
|
3
|
+
description: Add a Drizzle table to robodev/database.ts and wire it into defineApi handlers.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Add a Robodev table
|
|
7
7
|
|
|
8
|
-
1. Add a `pgTable` to `database.ts` and include it in `defineDatabase({ tables })`.
|
|
8
|
+
1. Add a `pgTable` to `robodev/database.ts` and include it in `defineDatabase({ tables })`.
|
|
9
9
|
2. Do not add a User table. Auth users are platform-managed; store `userId` as text.
|
|
10
10
|
3. Import the table in `api/_lib.ts` or the route file that needs it.
|
|
11
11
|
4. Deploy from the project root with `robodev deploy`. Destructive drops need confirmation or `--force`.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# {{NAME}}
|
|
2
2
|
|
|
3
|
-
Starter from `robodev create`: Tiny Template schema (`planets`, `aliens`, `media`, `planet_likes`), file-based APIs in `api/`, and a Povio UI in `apps/fe`.
|
|
3
|
+
Starter from `robodev create`: Tiny Template schema (`planets`, `aliens`, `media`, `planet_likes`), file-based APIs in `robodev/api/`, and a Povio UI in `apps/fe`.
|
|
4
4
|
|
|
5
5
|
After a CLI create or deploy with `.robodev` `frontend` set (the default for this starter), the project host serves the built Tiny SPA at `GET /`. APIs and Swagger still win over static files.
|
|
6
6
|
|
|
@@ -29,7 +29,7 @@ npx robodev deploy
|
|
|
29
29
|
|
|
30
30
|
Dashboard create deploys schema + APIs only. The Tiny FE tree is copied by `robodev create`; a later CLI deploy hosts the SPA.
|
|
31
31
|
|
|
32
|
-
Auth stays reserved at `/api/user/*`. Do not add `api/user/**`.
|
|
32
|
+
Auth stays reserved at `/api/user/*`. Do not add `robodev/api/user/**`.
|
|
33
33
|
|
|
34
34
|
Regenerate AI rules after editing `.rulesync/`:
|
|
35
35
|
|