caspian-utils 0.0.8 → 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.
@@ -1,9 +1,9 @@
1
1
  ---
2
2
  title: Commands
3
- description: Use the Caspian CLI reference to scaffold projects, generate code, and update framework files without confusing first-time setup with existing-project maintenance.
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 the routing and structure guides to place generated files correctly.
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,119 +12,281 @@ related:
12
12
  - /docs/index
13
13
  ---
14
14
 
15
- This page summarizes the main Caspian CLI workflows for creating projects, generating code, and updating an existing app.
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 the scaffold and project-update commands below as external `npx` workflows rather than project-local executables.
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
- Use Caspian CLI commands for three main tasks:
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
- - Create a new application.
24
- - Regenerate Node and Python ORM code from your Prisma schema.
25
- - Update framework-managed project files.
23
+ Use these command families for different tasks:
26
24
 
27
- Before running update commands, review `caspian.config.json` because it controls overwrite behavior.
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
- ## Project Creation
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
- Use the interactive scaffold when starting a new Caspian app:
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@latest
57
+ npx create-caspian-app my-app
35
58
  ```
36
59
 
37
- You can also create a project with starter-kit flags:
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 --starter-kit=fullstack
65
+ npx create-caspian-app my-app -y
41
66
  ```
42
67
 
43
- For a custom source setup, the CLI also supports a custom starter flow:
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-tool --starter-kit=custom ...
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
- After scaffolding, use `routing.md` to understand how Caspian maps `src/app` folders to URLs.
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
- ## Installation Flags
101
+ ## Full-stack and Frontend-enabled Create Combinations
52
102
 
53
- Common scaffold flags include:
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
- - `--backend-only` for API-only projects without frontend assets
56
- - `--tailwindcss` to install Tailwind CSS support
57
- - `--typescript` to add TypeScript support and any scaffold-specific TypeScript build/config files
58
- - `--mcp` to initialize a Model Context Protocol server for AI agents
59
- - `--prisma` to initialize Prisma ORM support
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
- ## Code Generation
124
+ You can append `-y` to any frontend-enabled example above.
62
125
 
63
- When `prisma/schema.prisma` changes in this workspace, use this command flow:
126
+ ## Starter Kit Commands
127
+
128
+ ### List available starter kits
64
129
 
65
130
  ```bash
66
- npx prisma migrate dev
131
+ npx create-caspian-app --list-starter-kits
132
+ ```
67
133
 
68
- # If the change requires refreshed seed data:
69
- npx prisma generate
70
- npx prisma db seed
134
+ Use when you want to inspect the built-in starter kit catalog before creating a project.
71
135
 
72
- npx ppy generate
136
+ ### Built-in starter kits
137
+
138
+ The current command reference includes these built-in starter kits:
139
+
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. |
146
+
147
+ If you want frontend TypeScript, add `--typescript` explicitly rather than assuming it is implied by a starter kit preset.
148
+
149
+ Append `-y` to any starter kit example when you want the same preset without prompts.
150
+
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
73
172
  ```
74
173
 
75
- Use `npx prisma migrate dev` first so the development database and migration history stay aligned. If the updated schema affects seed data, run `npx prisma generate` before `npx prisma db seed` so Node-side tooling such as `prisma/seed.ts` uses the current generated client.
174
+ Use this flow when the scaffold should come from an external repository instead of a built-in preset.
76
175
 
77
- Always finish with `npx ppy generate`. That is the required way to refresh the Python ORM classes used by the app after a schema change.
176
+ ## Update an Existing Project
78
177
 
79
- This workspace already includes an app-owned Python database layer in `src/lib/prisma/`, so reuse that package for Python-side database access instead of creating a second helper. Do not hand-edit generated ORM classes.
178
+ The updater wrapper recognizes the `update project` family:
80
179
 
81
- See `database.md` for the full Prisma workflow, including `.env`, `prisma.config.ts`, migrations, and async usage patterns.
180
+ ```bash
181
+ npx casp update project
182
+ ```
82
183
 
83
- ## Update Project
184
+ Use this only inside an existing Caspian project that already has `caspian.config.json` in the current directory.
84
185
 
85
- Use the project update command for existing Caspian apps:
186
+ ### Update to latest
86
187
 
87
188
  ```bash
88
189
  npx casp update project
89
190
  ```
90
191
 
91
- This command updates framework-managed project files and can overwrite entry points, styles, or configuration files if they are not protected. The `casp` binary is not bundled locally in this workspace, so verify the external CLI package before automating this command.
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
92
237
 
93
- ## Configuration
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
+ ```
94
247
 
95
- The CLI reads `caspian.config.json` to decide how it should interact with the project.
248
+ Use this order:
96
249
 
97
- Important configuration areas include:
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.
98
253
 
99
- - Project identity and root path
100
- - Feature toggles such as backend-only, Tailwind, MCP, Prisma, and TypeScript
101
- - Component scan directories
102
- - `excludeFiles` rules for protecting local changes during updates
254
+ Do not manually create or edit these generated files:
103
255
 
104
- ## `excludeFiles` Strategy
256
+ - `src/lib/prisma/__init__.py`
257
+ - `src/lib/prisma/db.py`
258
+ - `src/lib/prisma/models.py`
259
+ - `settings/prisma-schema.json`
105
260
 
106
- Use `excludeFiles` in `caspian.config.json` to prevent the update command from overwriting files you have customized.
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.
107
262
 
108
- This is useful for protecting:
263
+ See [database.md](./database.md) for the full schema, migration, seed, and async usage guide.
109
264
 
110
- - Stylesheets
111
- - Configuration files
112
- - Entry-point files
113
- - Other locally modified framework-managed files
265
+ ## Practical Recommendation Matrix
114
266
 
115
- If you exclude a file, it will be preserved during updates, but you may need to merge future framework changes into that file manually.
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` |
116
278
 
117
279
  ## AI Routing Notes
118
280
 
119
281
  If an AI agent is deciding which command flow to use, apply these rules first.
120
282
 
121
- - Use `npx create-caspian-app@latest` when the user is creating a new project.
122
- - Use `npx casp update project` only for an existing Caspian project.
123
- - Read `caspian.config.json` before running update commands.
124
- - When `prisma/schema.prisma` changes, run `npx prisma migrate dev` first.
125
- - If the change requires seed data, run `npx prisma generate` and then `npx prisma db seed`.
126
- - Run `npx ppy generate` after every Prisma schema change to refresh the Python ORM classes.
127
- - Never hand-edit generated Prisma or Python ORM classes.
128
- - Check `database.md` when the task involves Prisma setup, schema updates, or the current workspace's schema, migration, and seed tooling.
129
- - Check [routing.md](./routing.md) before generating or modifying route folders under `src/app/`.
130
- - Check [project-structure.md](./project-structure.md) before placing generated files into the project.
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.
@@ -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, generation, updates, and config-aware maintenance
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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "caspian-utils",
3
- "version": "0.0.8",
3
+ "version": "0.0.9",
4
4
  "description": "Caspian tooling",
5
5
  "main": "index.js",
6
6
  "scripts": {