create-caspian-app 0.2.0-beta.19 → 0.2.0-beta.20

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.
@@ -6,17 +6,18 @@
6
6
  ## Global Rules
7
7
 
8
8
  - Use this source-of-truth order: app runtime and app-owned code first, installed `casp` runtime second, packaged markdown docs third.
9
+ - Read `./caspian.config.json` almost immediately before making feature, tooling, scaffolding, or file-placement decisions. Treat it as the workspace feature gate for flags such as `backendOnly`, `tailwindcss`, `mcp`, `prisma`, `typescript`, and `componentScanDirs`.
9
10
  - For current repo behavior, trust `main.py`, `src/lib/**`, `public/js/**`, `prisma/**`, and `src/app/**` over generic Caspian docs.
10
11
  - For framework internals, trust `.venv/Lib/site-packages/casp/**` over generic or older upstream guidance.
11
12
  - When docs and runtime disagree, align the docs to the code that actually runs in this workspace.
12
13
  - Reuse the existing Python database layer in `src/lib/prisma/**`; do not create a second app-owned database abstraction unless the user explicitly asks for one.
13
14
  - Keep auth policy in `src/lib/auth/auth_config.py` and keep auth bootstrap, middleware wiring, and provider registration in `main.py`.
14
15
  - Use PulsePoint and `pp.rpc(...)` as the default frontend and client-to-server contract unless the user requests another stack.
15
- - Treat `pp-component` on routes, layouts, and components as compiler-injected by the Python side; do not add it manually in authored templates unless the task is explicitly about runtime internals.
16
+ - Treat `pp-component` on routes, layouts, and components, and `type="text/pp"` on owned PulsePoint scripts, as compiler-injected by the Python side; do not add them manually in authored templates unless the task is explicitly about runtime internals.
16
17
  - `layout()` is synchronous in the installed runtime. Put async I/O in `page()` or `@rpc()`.
17
18
  - Dynamic route params currently reach `page()` as a single positional `dict`, with query params injected by name and `request` injected by keyword when declared.
18
19
  - Do not assume `StateManager` survives across requests unless `request.state.session` is explicitly bridged from `request.session`.
19
- - Route, layout, and component HTML templates must keep a single top-level lowercase HTML element so Caspian can inject `pp-component`.
20
+ - Route, layout, and component HTML templates must keep a single top-level lowercase HTML element so Caspian can inject `pp-component`. Think React-style single parent wrapper: good one root containing the markup and any owned PulsePoint script, bad sibling top-level tags.
20
21
 
21
22
  ## Path-Specific Rules
22
23
 
@@ -25,6 +26,7 @@
25
26
  - Treat `main.py` as the repo source of truth for FastAPI setup, static asset routes, auth bootstrap, middleware order, route registration, cache defaults, and error handlers.
26
27
  - Preserve the effective middleware execution order unless the task explicitly changes request semantics: `SessionMiddleware -> CSRFMiddleware -> AuthMiddleware -> RPCMiddleware`.
27
28
  - Document route param behavior exactly as implemented here.
29
+ - Do not use `main.py` alone to infer whether optional features are enabled; confirm that in `caspian.config.json` first.
28
30
 
29
31
  ### `src/lib/**/*.py`
30
32
 
@@ -42,14 +44,15 @@
42
44
 
43
45
  - Treat `public/js/pp-reactive-v2.js` as the browser-side PulsePoint runtime source of truth for component execution, refs, directives, SPA navigation, and `pp.rpc(...)` behavior.
44
46
  - Preserve the current public runtime contract unless the task explicitly changes Caspian frontend behavior.
45
- - In `pp-component` roots, component logic must live in `script[type="text/pp"]`.
47
+ - At runtime, component logic is discovered from `script[type="text/pp"]` inside `pp-component` roots. In authored route, layout, and component templates, write plain `<script>` and let `main.py` plus `casp.scripts_type.transform_scripts(...)` add the type.
46
48
 
47
49
  ### `src/app/**/*.html`
48
50
 
49
51
  - Keep route templates and layouts server-rendered first, with PulsePoint enhancement as the default interactive layer.
50
52
  - Preserve Caspian template syntax such as `[[...]]` in layouts and `pp-*` runtime attributes in rendered HTML.
51
53
  - Do not author `pp-component="..."` manually in route or layout templates; the Python render pipeline injects it onto the single root element.
52
- - Keep authored route and layout templates to one top-level lowercase HTML root element, the same constraint used for component templates.
54
+ - Do not author `type="text/pp"` manually in route or layout templates either. Use plain `<script>` in source and let the render path rewrite it.
55
+ - Keep authored route and layout templates to one top-level lowercase HTML root element, the same constraint used for component templates. If a script is needed, keep it inside that root instead of as a sibling top-level node.
53
56
  - Do not assume React, Vue, JSX, HTMX, or another frontend runtime unless the user explicitly requests one.
54
57
 
55
58
  ### `prisma/**`
@@ -69,15 +72,16 @@
69
72
 
70
73
  - These files are the local documentation layer, not the runtime. Verify every behavior claim against the actual code that runs.
71
74
  - Use this verification order:
72
- 1. `main.py`, `src/lib/**`, `public/js/**`, `prisma/**`, `src/app/**`
75
+ 1. `caspian.config.json`, then `main.py`, `src/lib/**`, `public/js/**`, `prisma/**`, `src/app/**`
73
76
  2. `.venv/Lib/site-packages/casp/**`
74
77
  3. the markdown file being edited
75
78
  - Keep repo-specific facts accurate when they matter:
79
+ - `caspian.config.json` is the first config file to read for enabled workspace features and scan directories
76
80
  - this workspace already has `src/lib/prisma/**`
77
81
  - auth policy lives in `src/lib/auth/auth_config.py`
78
82
  - PulsePoint runtime lives in `public/js/pp-reactive-v2.js`
79
- - `pp-component` is injected by the Python render pipeline; authored route and component templates should not add it manually
80
- - route, layout, and component templates must keep a single top-level lowercase HTML root for `pp-component` injection
83
+ - `pp-component` is injected by the Python render pipeline, and `main.py` rewrites authored body scripts to `type="text/pp"`; authored route, layout, and component templates should not add those attributes manually
84
+ - route, layout, and component templates must keep a single top-level lowercase HTML root for `pp-component` injection, with any owned plain `<script>` kept inside that same root
81
85
  - dynamic route params are passed to `page()` as a single positional `dict`
82
86
  - `layout()` is sync-only in the installed runtime
83
87
  - `StateManager` persistence depends on `request.state.session`, which is not bridged from `request.session` in the current `main.py`
package/dist/AGENTS.md CHANGED
@@ -28,6 +28,8 @@ If the task is about framework internals, prefer the installed `casp` package.
28
28
 
29
29
  If docs differ from either of those, update the docs to match the code that actually runs.
30
30
 
31
+ Before making feature, tooling, or scaffolding decisions, read `caspian.config.json` almost immediately. Treat it as the workspace feature gate for flags such as `backendOnly`, `tailwindcss`, `mcp`, `prisma`, `typescript`, and `componentScanDirs`.
32
+
31
33
  ## Verified Workspace Facts
32
34
 
33
35
  - Local Caspian docs live under `node_modules/caspian-utils/dist/docs/`.
@@ -39,9 +41,11 @@ If docs differ from either of those, update the docs to match the code that actu
39
41
  - This workspace already has an app-owned Python database layer in `src/lib/prisma/`.
40
42
  - Reuse `src/lib/prisma/prisma`, `PrismaClient`, generated models, and helper types instead of creating a second Python database abstraction.
41
43
  - Prisma schema source of truth is `prisma/schema.prisma`, and the local Node workflow still uses `npx prisma generate` plus `prisma/seed.ts`.
44
+ - `caspian.config.json` is the first config file to check for enabled workspace features. In the current workspace it sets `backendOnly: false`, `tailwindcss: true`, `mcp: false`, `prisma: true`, `typescript: false`, and `componentScanDirs: ["src"]`.
42
45
  - PulsePoint runtime code is shipped in `public/js/pp-reactive-v2.js` and loaded from `public/js/main.js`.
43
46
  - `pp-component` is injected by the Python render pipeline onto page, layout, and component roots; authored route and component templates should not add it manually.
44
- - Route and component HTML templates must keep exactly one top-level lowercase HTML element so Caspian can inject `pp-component`.
47
+ - `main.py` runs `transform_scripts(...)`, so authored body `<script>` tags are rewritten to `<script type="text/pp">` in rendered HTML; route, layout, and component templates should write plain `<script>` in source.
48
+ - Route and component HTML templates must keep exactly one top-level lowercase HTML element so Caspian can inject `pp-component`. Think React-style single parent wrapper: good `<div>...</div>` with any owned script inside that same root, bad sibling top-level tags such as `<div>...</div><script ...></script>`.
45
49
  - In the current router inside `main.py`, path params are passed to `page()` as the first positional `dict` argument.
46
50
  - Matching query params can still be injected by name, and `request` is injected by keyword when declared.
47
51
  - The installed `casp.layout` runtime calls `layout()` synchronously. Keep async I/O in `page()` or `@rpc()`.
@@ -57,6 +61,7 @@ Use this map before making changes.
57
61
  | Task area | Read first | Verify against |
58
62
  | --- | --- | --- |
59
63
  | Project layout and file placement | `node_modules/caspian-utils/dist/docs/index.md`, `node_modules/caspian-utils/dist/docs/project-structure.md` | current workspace tree |
64
+ | Feature availability and tooling switches | `caspian.config.json` | current workspace tree, `main.py`, `prisma/**`, `public/js/**` |
60
65
  | Routing, layouts, metadata | `node_modules/caspian-utils/dist/docs/routing.md` | `main.py`, `.venv/Lib/site-packages/casp/layout.py` |
61
66
  | Auth, sessions, RBAC, providers | `node_modules/caspian-utils/dist/docs/auth.md` | `src/lib/auth/auth_config.py`, `main.py`, `.venv/Lib/site-packages/casp/auth.py` |
62
67
  | RPC, data loading, streaming, uploads | `node_modules/caspian-utils/dist/docs/fetch-data.md`, `node_modules/caspian-utils/dist/docs/pulsepoint.md` | `.venv/Lib/site-packages/casp/rpc.py`, `public/js/pp-reactive-v2.js`, `main.py` |
@@ -69,13 +74,15 @@ Use this map before making changes.
69
74
 
70
75
  - Keep app-owned shared code in `src/lib/**`.
71
76
  - Keep route-specific logic in `src/app/**`.
77
+ - Read `caspian.config.json` before deciding whether a Caspian feature should be used, documented, scaffolded, or avoided in the current workspace.
72
78
  - Treat `.venv/Lib/site-packages/casp/**` as framework internals unless the task is explicitly about Caspian core behavior or installed-runtime documentation.
73
79
  - When a task involves Python-side database access, extend or reuse `src/lib/prisma/**` instead of introducing a parallel helper.
74
80
  - Keep auth policy in `src/lib/auth/auth_config.py`.
75
81
  - Keep auth bootstrap, middleware ordering, provider wiring, and router behavior in `main.py`.
76
82
  - Use PulsePoint and `pp.rpc(...)` as the default frontend and browser-to-server contract unless the user explicitly wants another stack.
77
83
  - Treat `pp-component` as a framework-owned attribute on authored templates. Document it, but do not manually add it in normal route or component HTML.
78
- - Keep route and component HTML templates to a single top-level lowercase HTML element so the Python side can inject `pp-component` safely.
84
+ - Treat `type="text/pp"` on PulsePoint scripts as a render-time attribute too. In authored route, layout, and component HTML, write plain `<script>` and let Caspian rewrite it.
85
+ - Keep route and component HTML templates to a single top-level lowercase HTML element so the Python side can inject `pp-component` safely. Keep any owned PulsePoint script inside that same root instead of as a sibling top-level node.
79
86
  - Keep Copilot guidance consolidated in `.github/copilot-instructions.md`; do not add `.github/instructions/` in this workspace.
80
87
  - When writing docs about route behavior, describe the param passing and layout behavior implemented in the current runtime, not generic upstream assumptions.
81
88
  - When a runtime change affects documentation, update the matching page in `node_modules/caspian-utils/dist/docs/`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-caspian-app",
3
- "version": "0.2.0-beta.19",
3
+ "version": "0.2.0-beta.20",
4
4
  "description": "Scaffold a new Caspian project (FastAPI-powered reactive Python framework).",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",