caspian-utils 0.0.7 → 0.0.9
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/dist/docs/commands.md +228 -55
- package/dist/docs/database.md +24 -11
- package/dist/docs/index.md +1 -1
- package/package.json +1 -1
package/dist/docs/commands.md
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Commands
|
|
3
|
-
description: Use
|
|
3
|
+
description: Use this Caspian CLI reference to choose the right create, starter-kit, update, and Prisma-to-Python ORM regeneration flow for the current workspace.
|
|
4
4
|
related:
|
|
5
5
|
title: Related docs
|
|
6
|
-
description: Start with installation for new apps, then use
|
|
6
|
+
description: Start with installation for new apps, then use database and structure docs when commands affect schema, generated ORM files, or project layout.
|
|
7
7
|
links:
|
|
8
8
|
- /docs/installation
|
|
9
9
|
- /docs/database
|
|
@@ -12,108 +12,281 @@ related:
|
|
|
12
12
|
- /docs/index
|
|
13
13
|
---
|
|
14
14
|
|
|
15
|
-
This page
|
|
15
|
+
This page documents the current Caspian command families used with this workspace and the surrounding docs toolchain.
|
|
16
16
|
|
|
17
17
|
## Overview
|
|
18
18
|
|
|
19
|
-
The current workspace includes a local `prisma` binary, but it does not include local `create-caspian-app`, `casp`, or `ppy` binaries under `node_modules/.bin`. Treat
|
|
19
|
+
The current workspace includes a local `prisma` binary, but it does not include local `create-caspian-app`, `casp`, or `ppy` binaries under `node_modules/.bin`. Treat project creation, project update, and Python ORM generation as external `npx` workflows rather than project-local executables.
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
Examples below use the bare package name for readability. If you want to force the latest published scaffold package, you can add `@latest`, for example `npx create-caspian-app@latest my-app`.
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
- Generate code from your Prisma schema.
|
|
25
|
-
- Update framework-managed project files.
|
|
23
|
+
Use these command families for different tasks:
|
|
26
24
|
|
|
27
|
-
|
|
25
|
+
| Task | Command | When to use |
|
|
26
|
+
| --- | --- | --- |
|
|
27
|
+
| Create a new project | `npx create-caspian-app my-app` | First-time scaffold for a brand new Caspian app. |
|
|
28
|
+
| Update an existing project | `npx casp update project` | Refresh framework-managed files inside an existing Caspian project. |
|
|
29
|
+
| Create from a starter kit | `npx create-caspian-app my-app --starter-kit=fullstack` | Start from a built-in or custom template instead of the default scaffold. |
|
|
30
|
+
| List starter kits | `npx create-caspian-app --list-starter-kits` | Inspect the starter catalog before choosing a preset. |
|
|
31
|
+
| Regenerate ORM after schema change | `npx prisma migrate dev` then optional seed commands, then `npx ppy generate` | Keep Prisma migrations, seed flow, and generated Python ORM files aligned after `prisma/schema.prisma` changes. |
|
|
28
32
|
|
|
29
|
-
|
|
33
|
+
Before running `npx casp update project`, read `caspian.config.json` because it controls feature flags and `excludeFiles` overwrite protection. Before running Prisma or `ppy` commands, read [database.md](./database.md).
|
|
30
34
|
|
|
31
|
-
|
|
35
|
+
## Supported Flags
|
|
36
|
+
|
|
37
|
+
The scaffold CLI exposes these feature flags:
|
|
38
|
+
|
|
39
|
+
| Flag | Meaning | When to use |
|
|
40
|
+
| --- | --- | --- |
|
|
41
|
+
| `-y` | Non-interactive mode | Use in CI, automation, or scripted setup. |
|
|
42
|
+
| `--backend-only` | Backend-only project | Use for APIs, services, or apps with no browser UI. |
|
|
43
|
+
| `--tailwindcss` | Enable Tailwind CSS | Use for frontend or full-stack styling. |
|
|
44
|
+
| `--typescript` | Enable TypeScript frontend tooling | Use when you want frontend TypeScript assets. |
|
|
45
|
+
| `--mcp` | Enable MCP support | Use when the app needs Model Context Protocol support. |
|
|
46
|
+
| `--prisma` | Enable Prisma setup | Use when the app needs schema, migration, and ORM tooling. |
|
|
47
|
+
| `--starter-kit=<kit>` | Use a built-in or named starter kit | Use to bootstrap from a preset instead of the default scaffold. |
|
|
48
|
+
| `--starter-kit-source=<url>` | Pull a starter kit from a Git source | Use when the starter kit lives in an external repository. |
|
|
49
|
+
|
|
50
|
+
Add `-y` to most create or update examples below when you want the same flow to run without prompts.
|
|
51
|
+
|
|
52
|
+
## Create a New Project
|
|
53
|
+
|
|
54
|
+
### Interactive create
|
|
32
55
|
|
|
33
56
|
```bash
|
|
34
|
-
npx create-caspian-app
|
|
57
|
+
npx create-caspian-app my-app
|
|
35
58
|
```
|
|
36
59
|
|
|
37
|
-
|
|
60
|
+
Use when you want the normal interactive scaffold flow. The CLI can prompt for project name and feature toggles.
|
|
61
|
+
|
|
62
|
+
### Non-interactive create
|
|
38
63
|
|
|
39
64
|
```bash
|
|
40
|
-
npx create-caspian-app my-app
|
|
65
|
+
npx create-caspian-app my-app -y
|
|
41
66
|
```
|
|
42
67
|
|
|
43
|
-
|
|
68
|
+
Use when you already know the desired feature flags or when automation should avoid prompts.
|
|
69
|
+
|
|
70
|
+
Without extra flags, the non-interactive default behaves like this:
|
|
71
|
+
|
|
72
|
+
- `backendOnly: false`
|
|
73
|
+
- `tailwindcss: false`
|
|
74
|
+
- `typescript: false`
|
|
75
|
+
- `mcp: false`
|
|
76
|
+
- `prisma: false`
|
|
77
|
+
|
|
78
|
+
## Backend-only Create Combinations
|
|
79
|
+
|
|
80
|
+
When `--backend-only` is enabled, the meaningful feature toggles are `--mcp` and `--prisma`. Frontend-oriented flags are not part of the normal backend-only prompt flow.
|
|
81
|
+
|
|
82
|
+
| Goal | Example command | When to use |
|
|
83
|
+
| --- | --- | --- |
|
|
84
|
+
| Minimal backend-only | `npx create-caspian-app my-app --backend-only` | Simple API or service without frontend assets. |
|
|
85
|
+
| Backend-only + MCP | `npx create-caspian-app my-app --backend-only --mcp` | Backend service plus MCP support. |
|
|
86
|
+
| Backend-only + Prisma | `npx create-caspian-app my-app --backend-only --prisma` | API or service with database and ORM support. |
|
|
87
|
+
| Backend-only + MCP + Prisma | `npx create-caspian-app my-app --backend-only --mcp --prisma` | Full backend-only setup with both integrations. |
|
|
88
|
+
|
|
89
|
+
You can append `-y` to any backend-only example above.
|
|
90
|
+
|
|
91
|
+
### Accepted but not recommended in backend-only mode
|
|
44
92
|
|
|
45
93
|
```bash
|
|
46
|
-
npx create-caspian-app my-
|
|
94
|
+
npx create-caspian-app my-app --backend-only --tailwindcss
|
|
95
|
+
npx create-caspian-app my-app --backend-only --typescript
|
|
96
|
+
npx create-caspian-app my-app --backend-only --tailwindcss --typescript
|
|
47
97
|
```
|
|
48
98
|
|
|
49
|
-
|
|
99
|
+
Avoid them in normal use. Backend-only mode strips frontend assets, so Tailwind and frontend TypeScript flags do not have a practical effect in the resulting scaffold.
|
|
50
100
|
|
|
51
|
-
##
|
|
101
|
+
## Full-stack and Frontend-enabled Create Combinations
|
|
52
102
|
|
|
53
|
-
|
|
103
|
+
When `--backend-only` is not used, the feature flags `--tailwindcss`, `--typescript`, `--mcp`, and `--prisma` can be combined in any subset. The table below lists the common command matrix.
|
|
54
104
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
105
|
+
| Flags | Example command | When to use |
|
|
106
|
+
| --- | --- | --- |
|
|
107
|
+
| none | `npx create-caspian-app my-app` | Default full-stack scaffold. |
|
|
108
|
+
| `--tailwindcss` | `npx create-caspian-app my-app --tailwindcss` | Styled frontend with Tailwind. |
|
|
109
|
+
| `--typescript` | `npx create-caspian-app my-app --typescript` | Frontend TypeScript assets. |
|
|
110
|
+
| `--mcp` | `npx create-caspian-app my-app --mcp` | Full-stack app with MCP support. |
|
|
111
|
+
| `--prisma` | `npx create-caspian-app my-app --prisma` | Full-stack app with Prisma support. |
|
|
112
|
+
| `--tailwindcss --typescript` | `npx create-caspian-app my-app --tailwindcss --typescript` | Styled frontend with TypeScript. |
|
|
113
|
+
| `--tailwindcss --mcp` | `npx create-caspian-app my-app --tailwindcss --mcp` | Styled UI plus MCP support. |
|
|
114
|
+
| `--tailwindcss --prisma` | `npx create-caspian-app my-app --tailwindcss --prisma` | Styled UI plus database tooling. |
|
|
115
|
+
| `--typescript --mcp` | `npx create-caspian-app my-app --typescript --mcp` | Frontend TypeScript plus MCP. |
|
|
116
|
+
| `--typescript --prisma` | `npx create-caspian-app my-app --typescript --prisma` | Frontend TypeScript plus Prisma. |
|
|
117
|
+
| `--mcp --prisma` | `npx create-caspian-app my-app --mcp --prisma` | Both major backend integrations without forcing frontend styling choices. |
|
|
118
|
+
| `--tailwindcss --typescript --mcp` | `npx create-caspian-app my-app --tailwindcss --typescript --mcp` | Rich frontend plus MCP. |
|
|
119
|
+
| `--tailwindcss --typescript --prisma` | `npx create-caspian-app my-app --tailwindcss --typescript --prisma` | Rich frontend plus Prisma. |
|
|
120
|
+
| `--tailwindcss --mcp --prisma` | `npx create-caspian-app my-app --tailwindcss --mcp --prisma` | Styled UI plus both major integrations. |
|
|
121
|
+
| `--typescript --mcp --prisma` | `npx create-caspian-app my-app --typescript --mcp --prisma` | Frontend TypeScript plus both major integrations. |
|
|
122
|
+
| `--tailwindcss --typescript --mcp --prisma` | `npx create-caspian-app my-app --tailwindcss --typescript --mcp --prisma` | Most feature-complete default full-stack setup. |
|
|
60
123
|
|
|
61
|
-
|
|
124
|
+
You can append `-y` to any frontend-enabled example above.
|
|
62
125
|
|
|
63
|
-
|
|
126
|
+
## Starter Kit Commands
|
|
127
|
+
|
|
128
|
+
### List available starter kits
|
|
64
129
|
|
|
65
130
|
```bash
|
|
66
|
-
npx
|
|
131
|
+
npx create-caspian-app --list-starter-kits
|
|
67
132
|
```
|
|
68
133
|
|
|
69
|
-
|
|
134
|
+
Use when you want to inspect the built-in starter kit catalog before creating a project.
|
|
135
|
+
|
|
136
|
+
### Built-in starter kits
|
|
137
|
+
|
|
138
|
+
The current command reference includes these built-in starter kits:
|
|
70
139
|
|
|
71
|
-
|
|
140
|
+
| Starter kit | Example command | Preset features | When to use |
|
|
141
|
+
| --- | --- | --- | --- |
|
|
142
|
+
| `basic` | `npx create-caspian-app my-app --starter-kit=basic` | `backendOnly=true`, `tailwindcss=false`, `prisma=false`, `mcp=false` | Minimal backend-oriented scaffold. |
|
|
143
|
+
| `fullstack` | `npx create-caspian-app my-app --starter-kit=fullstack` | `backendOnly=false`, `tailwindcss=true`, `prisma=true`, `mcp=false` | Complete full-stack web app preset. |
|
|
144
|
+
| `api` | `npx create-caspian-app my-app --starter-kit=api` | `backendOnly=true`, `tailwindcss=false`, `prisma=true`, `mcp=false` | Backend API preset with Prisma. |
|
|
145
|
+
| `realtime` | `npx create-caspian-app my-app --starter-kit=realtime` | `backendOnly=false`, `tailwindcss=true`, `prisma=true`, `mcp=true` | Realtime-oriented preset with both UI and integration support. |
|
|
72
146
|
|
|
73
|
-
|
|
147
|
+
If you want frontend TypeScript, add `--typescript` explicitly rather than assuming it is implied by a starter kit preset.
|
|
74
148
|
|
|
75
|
-
|
|
149
|
+
Append `-y` to any starter kit example when you want the same preset without prompts.
|
|
76
150
|
|
|
77
|
-
|
|
151
|
+
### Starter kit overrides
|
|
152
|
+
|
|
153
|
+
```bash
|
|
154
|
+
npx create-caspian-app my-app --starter-kit=basic --prisma
|
|
155
|
+
npx create-caspian-app my-app --starter-kit=fullstack --typescript
|
|
156
|
+
npx create-caspian-app my-app --starter-kit=api --mcp
|
|
157
|
+
npx create-caspian-app my-app --starter-kit=realtime --backend-only
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
Use overrides when a starter kit is close to the target app but you need to force one or more feature flags.
|
|
161
|
+
|
|
162
|
+
### Custom starter kit source
|
|
163
|
+
|
|
164
|
+
```bash
|
|
165
|
+
npx create-caspian-app my-app --starter-kit=custom --starter-kit-source=https://github.com/user/repo
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
You can combine extra flags with the custom source:
|
|
169
|
+
|
|
170
|
+
```bash
|
|
171
|
+
npx create-caspian-app my-app --starter-kit=custom --starter-kit-source=https://github.com/user/repo --typescript --prisma
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
Use this flow when the scaffold should come from an external repository instead of a built-in preset.
|
|
175
|
+
|
|
176
|
+
## Update an Existing Project
|
|
177
|
+
|
|
178
|
+
The updater wrapper recognizes the `update project` family:
|
|
78
179
|
|
|
79
180
|
```bash
|
|
80
181
|
npx casp update project
|
|
81
182
|
```
|
|
82
183
|
|
|
83
|
-
|
|
184
|
+
Use this only inside an existing Caspian project that already has `caspian.config.json` in the current directory.
|
|
185
|
+
|
|
186
|
+
### Update to latest
|
|
84
187
|
|
|
85
|
-
|
|
188
|
+
```bash
|
|
189
|
+
npx casp update project
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
Use when you want the normal refresh to the latest framework-managed files.
|
|
193
|
+
|
|
194
|
+
### Update to a specific tag
|
|
195
|
+
|
|
196
|
+
```bash
|
|
197
|
+
npx casp update project @v4-alpha
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
Use when you want a prerelease or named tag instead of the latest stable release.
|
|
201
|
+
|
|
202
|
+
### Update to a specific version
|
|
203
|
+
|
|
204
|
+
```bash
|
|
205
|
+
npx casp update project @1.2.3
|
|
206
|
+
npx casp update project 1.2.3
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
Use when you want a deterministic pinned version.
|
|
210
|
+
|
|
211
|
+
### Non-interactive update
|
|
212
|
+
|
|
213
|
+
```bash
|
|
214
|
+
npx casp update project -y
|
|
215
|
+
npx casp update project @v4-alpha -y
|
|
216
|
+
npx casp update project @1.2.3 -y
|
|
217
|
+
npx casp update project 1.2.3 -y
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
Use when automation, CI, or scripted maintenance should skip confirmation prompts.
|
|
221
|
+
|
|
222
|
+
### Update safety notes
|
|
223
|
+
|
|
224
|
+
The update flow is config-aware. Review `caspian.config.json` before running it, especially these areas:
|
|
225
|
+
|
|
226
|
+
- feature flags such as backend-only, Tailwind, TypeScript, MCP, and Prisma
|
|
227
|
+
- `componentScanDirs`
|
|
228
|
+
- `excludeFiles`, which protects customized files from overwrite
|
|
229
|
+
|
|
230
|
+
If you exclude a file, the updater preserves it, but you are responsible for merging future framework changes into that file manually.
|
|
231
|
+
|
|
232
|
+
## Prisma and Python ORM Regeneration
|
|
233
|
+
|
|
234
|
+
The create and update commands above are not the whole maintenance story for this workspace. When `prisma/schema.prisma` changes, follow the ORM flow below so the TypeScript Prisma client, database state, and Python ORM layer stay aligned.
|
|
235
|
+
|
|
236
|
+
### Required order after `prisma/schema.prisma` changes
|
|
237
|
+
|
|
238
|
+
```bash
|
|
239
|
+
npx prisma migrate dev
|
|
240
|
+
|
|
241
|
+
# Only when seed flow or prisma/seed.ts depends on the new schema:
|
|
242
|
+
npx prisma generate
|
|
243
|
+
npx prisma db seed
|
|
244
|
+
|
|
245
|
+
npx ppy generate
|
|
246
|
+
```
|
|
86
247
|
|
|
87
|
-
|
|
248
|
+
Use this order:
|
|
88
249
|
|
|
89
|
-
|
|
250
|
+
1. Run `npx prisma migrate dev` first so migrations and the development database stay aligned.
|
|
251
|
+
2. If `prisma/seed.ts` or seed data depends on the new schema, run `npx prisma generate` and then `npx prisma db seed`.
|
|
252
|
+
3. Run `npx ppy generate` last so the Python ORM layer matches the updated Prisma schema.
|
|
90
253
|
|
|
91
|
-
|
|
92
|
-
- Feature toggles such as backend-only, Tailwind, MCP, Prisma, and TypeScript
|
|
93
|
-
- Component scan directories
|
|
94
|
-
- `excludeFiles` rules for protecting local changes during updates
|
|
254
|
+
Do not manually create or edit these generated files:
|
|
95
255
|
|
|
96
|
-
|
|
256
|
+
- `src/lib/prisma/__init__.py`
|
|
257
|
+
- `src/lib/prisma/db.py`
|
|
258
|
+
- `src/lib/prisma/models.py`
|
|
259
|
+
- `settings/prisma-schema.json`
|
|
97
260
|
|
|
98
|
-
|
|
261
|
+
`npx ppy generate` owns those files. Treat `src/lib/prisma/` as the app's generated Python database layer, not as a manual editing surface.
|
|
99
262
|
|
|
100
|
-
|
|
263
|
+
See [database.md](./database.md) for the full schema, migration, seed, and async usage guide.
|
|
101
264
|
|
|
102
|
-
|
|
103
|
-
- Configuration files
|
|
104
|
-
- Entry-point files
|
|
105
|
-
- Other locally modified framework-managed files
|
|
265
|
+
## Practical Recommendation Matrix
|
|
106
266
|
|
|
107
|
-
|
|
267
|
+
| Goal | Recommended command |
|
|
268
|
+
| --- | --- |
|
|
269
|
+
| Minimal backend without database | `npx create-caspian-app my-app --backend-only -y` |
|
|
270
|
+
| Small API or service with Prisma | `npx create-caspian-app my-app --backend-only --prisma -y` |
|
|
271
|
+
| Full-stack app with styled UI and Prisma | `npx create-caspian-app my-app --tailwindcss --prisma -y` |
|
|
272
|
+
| Rich full-stack app with TypeScript, Tailwind, and Prisma | `npx create-caspian-app my-app --tailwindcss --typescript --prisma -y` |
|
|
273
|
+
| Full-stack app with everything enabled | `npx create-caspian-app my-app --tailwindcss --typescript --mcp --prisma -y` |
|
|
274
|
+
| Realtime preset | `npx create-caspian-app my-app --starter-kit=realtime -y` |
|
|
275
|
+
| Update current project to latest | `npx casp update project` |
|
|
276
|
+
| Update current project in automation | `npx casp update project -y` |
|
|
277
|
+
| Update current project to an exact version | `npx casp update project @1.2.3 -y` |
|
|
108
278
|
|
|
109
279
|
## AI Routing Notes
|
|
110
280
|
|
|
111
281
|
If an AI agent is deciding which command flow to use, apply these rules first.
|
|
112
282
|
|
|
113
|
-
- Use `npx create-caspian-app
|
|
114
|
-
- Use `npx casp update project
|
|
115
|
-
-
|
|
116
|
-
-
|
|
117
|
-
-
|
|
118
|
-
-
|
|
119
|
-
-
|
|
283
|
+
- Use `npx create-caspian-app ...` only when the user is creating a new Caspian project.
|
|
284
|
+
- Use `npx casp update project ...` only when the user is already inside an existing Caspian project.
|
|
285
|
+
- Add `-y` when the user wants automation, CI, or a no-prompt flow.
|
|
286
|
+
- Treat `--tailwindcss` and `--typescript` as frontend-oriented flags. They are not meaningful in normal backend-only scaffolds.
|
|
287
|
+
- Treat starter kit defaults as a base layer that can be overridden by explicit flags.
|
|
288
|
+
- When `prisma/schema.prisma` changes, run `npx prisma migrate dev` first, then any required seed refresh, then `npx ppy generate`.
|
|
289
|
+
- Never hand-edit generated Python ORM files under `src/lib/prisma/` or `settings/prisma-schema.json`.
|
|
290
|
+
- Read [database.md](./database.md) before generating Prisma schema, migration, seed, or ORM guidance.
|
|
291
|
+
- Read [routing.md](./routing.md) before generating or modifying route folders under `src/app/`.
|
|
292
|
+
- Read [project-structure.md](./project-structure.md) before placing generated files into the project.
|
package/dist/docs/database.md
CHANGED
|
@@ -22,9 +22,10 @@ The standard Prisma flow in Caspian is:
|
|
|
22
22
|
|
|
23
23
|
1. Define models in `prisma/schema.prisma`.
|
|
24
24
|
2. Configure `DATABASE_URL` in `.env`.
|
|
25
|
-
3. Run `npx prisma
|
|
26
|
-
4.
|
|
27
|
-
5.
|
|
25
|
+
3. Run `npx prisma migrate dev` after schema changes so the development database and migration history stay aligned.
|
|
26
|
+
4. If the change requires seed data, run `npx prisma generate` and then `npx prisma db seed`.
|
|
27
|
+
5. Run `npx ppy generate` so the Python ORM classes stay aligned with the updated schema.
|
|
28
|
+
6. Reuse the shared Python database layer in `src/lib/prisma/` when Python route or RPC code needs database access, and never hand-edit generated ORM classes.
|
|
28
29
|
|
|
29
30
|
Use this workflow instead of writing raw SQL first. Drop to raw SQL only when a query cannot be expressed clearly with the generated client.
|
|
30
31
|
|
|
@@ -99,22 +100,30 @@ model Post {
|
|
|
99
100
|
}
|
|
100
101
|
```
|
|
101
102
|
|
|
102
|
-
After changing the schema,
|
|
103
|
+
After changing the schema, use this order in the current workspace:
|
|
104
|
+
|
|
105
|
+
1. Run `npx prisma migrate dev`.
|
|
106
|
+
2. If seed data or the seed script needs the new schema, run `npx prisma generate` and then `npx prisma db seed`.
|
|
107
|
+
3. Run `npx ppy generate` to refresh the generated Python ORM classes.
|
|
108
|
+
|
|
109
|
+
Do not hand-edit generated Prisma or Python ORM output. Treat `prisma/schema.prisma` as the source of truth and regenerate from it.
|
|
103
110
|
|
|
104
111
|
## Command Reference
|
|
105
112
|
|
|
106
113
|
Use these commands for the normal Prisma lifecycle in Caspian:
|
|
107
114
|
|
|
108
|
-
- `npx prisma
|
|
109
|
-
- `npx prisma
|
|
115
|
+
- `npx prisma migrate dev` creates and applies a development migration. This is the first command to run after changing `prisma/schema.prisma`.
|
|
116
|
+
- `npx prisma generate` compiles `schema.prisma` into the generated Node Prisma client. Run it before `npx prisma db seed` when the updated seed flow depends on the new schema.
|
|
117
|
+
- `npx prisma db seed` runs the configured seeding script.
|
|
118
|
+
- `npx ppy generate` regenerates the Python ORM classes used by the app. Use this after every schema change.
|
|
110
119
|
- `npx prisma migrate deploy` applies pending migrations in deployment environments.
|
|
111
120
|
- `npx prisma db push` syncs schema changes without creating a migration file, which is useful for prototyping.
|
|
112
|
-
- `npx prisma db seed` runs the configured seeding script.
|
|
113
121
|
- `npx prisma studio` opens the Prisma data browser.
|
|
114
122
|
|
|
115
123
|
Default rule:
|
|
116
124
|
|
|
117
|
-
-
|
|
125
|
+
- When `prisma/schema.prisma` changes, use this order: `npx prisma migrate dev`; if seeding is involved, run `npx prisma generate` and `npx prisma db seed`; then run `npx ppy generate`.
|
|
126
|
+
- Never hand-edit generated Prisma or Python ORM classes, and never replace `npx ppy generate` with a manual class update.
|
|
118
127
|
- Use migrations for tracked application changes.
|
|
119
128
|
- Use `db push` only when you intentionally want a faster, migration-free prototype loop.
|
|
120
129
|
|
|
@@ -142,7 +151,7 @@ After `npx prisma generate`, Prisma writes the generated JavaScript client into
|
|
|
142
151
|
|
|
143
152
|
This workspace already includes an app-owned async Python database package that exports `prisma`, `PrismaClient`, generated models, and helper types.
|
|
144
153
|
|
|
145
|
-
If Python route or RPC code needs database access, import from `src.lib.prisma` and keep that import path explicit in application code.
|
|
154
|
+
If Python route or RPC code needs database access, import from `src.lib.prisma` and keep that import path explicit in application code. Refresh generated classes with `npx ppy generate` instead of editing them manually.
|
|
146
155
|
|
|
147
156
|
## Python Route Usage
|
|
148
157
|
|
|
@@ -306,8 +315,9 @@ Use raw SQL sparingly. Prefer the generated Prisma API when the query can be exp
|
|
|
306
315
|
|
|
307
316
|
## Recommended Project Rules
|
|
308
317
|
|
|
309
|
-
- Keep the schema in `prisma/schema.prisma` and
|
|
318
|
+
- Keep the schema in `prisma/schema.prisma` and follow the required regeneration order after changes: `npx prisma migrate dev`, optional seed flow, then `npx ppy generate`.
|
|
310
319
|
- Reuse `src/lib/prisma/` for Python-side database access instead of creating a second bridge.
|
|
320
|
+
- Never hand-edit generated Prisma or Python ORM classes.
|
|
311
321
|
- Keep reusable database helpers in `src/lib/`, and keep route-specific orchestration in `src/app/`.
|
|
312
322
|
- Use `await` with Prisma operations.
|
|
313
323
|
- Convert Prisma objects to template-safe dictionaries when rendering HTML.
|
|
@@ -320,7 +330,10 @@ If an AI agent is working on a Caspian app with Prisma enabled, apply these rule
|
|
|
320
330
|
|
|
321
331
|
- Treat Prisma as the default ORM and persistence layer.
|
|
322
332
|
- Read `prisma/schema.prisma` before proposing model, relation, or field changes.
|
|
323
|
-
-
|
|
333
|
+
- When `prisma/schema.prisma` changes, run `npx prisma migrate dev` first.
|
|
334
|
+
- If the schema change requires seed data, run `npx prisma generate` and then `npx prisma db seed`.
|
|
335
|
+
- Run `npx ppy generate` after schema changes to refresh the Python ORM classes.
|
|
336
|
+
- Never hand-edit generated Prisma or Python ORM classes.
|
|
324
337
|
- Read `prisma.config.ts` and `prisma/seed.ts` when you need the current workspace's Prisma tooling examples.
|
|
325
338
|
- Reuse the existing `src/lib/prisma/` package when the Python app needs database access.
|
|
326
339
|
- Put reusable database helpers in `src/lib/`; keep route and RPC orchestration in `src/app/`.
|
package/dist/docs/index.md
CHANGED
|
@@ -36,7 +36,7 @@ The packaged Caspian docs distributed by the current toolchain also live here:
|
|
|
36
36
|
## Available Documents
|
|
37
37
|
|
|
38
38
|
- `installation.md` - First-time setup flow for creating a new Caspian application
|
|
39
|
-
- `commands.md` - Main Caspian CLI workflows for project creation,
|
|
39
|
+
- `commands.md` - Main Caspian CLI workflows for project creation, starter kits, updates, and Prisma or ORM-aware maintenance
|
|
40
40
|
- `database.md` - Prisma schema, migration, seed, and client-generation workflow for the current workspace, plus Python-side helper caveats
|
|
41
41
|
- `auth.md` - Session-backed authentication with `casp.auth`, centralized `auth_config.py`, decorators, RBAC, and OAuth provider helpers
|
|
42
42
|
- `components.md` - Create reusable Python components, template-backed UI, JSX-style imports, and the single-parent root rule for component HTML files
|