create-caspian-app 0.2.0-beta.2 → 0.2.0-beta.21
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/.github/copilot-instructions.md +88 -0
- package/dist/AGENTS.md +105 -0
- package/dist/CLAUDE.md +1 -0
- package/dist/index.js +1 -2
- package/dist/main.py +6 -0
- package/dist/public/js/pp-reactive-v2.js +1 -1
- package/dist/pyproject.toml +1 -1
- package/dist/settings/files-list.ts +8 -0
- package/dist/src/app/error.html +66 -85
- package/package.json +1 -1
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
# Copilot Instructions
|
|
2
|
+
|
|
3
|
+
- Read `AGENTS.md` before working in `main.py`, `src/lib/**`, `.venv/Lib/site-packages/casp/**`, `public/js/**`, `prisma/**`, or `node_modules/caspian-utils/dist/docs/**`.
|
|
4
|
+
- Keep all repo-level Copilot guidance in this file. Do not add `.github/instructions/` for this workspace.
|
|
5
|
+
|
|
6
|
+
## Global Rules
|
|
7
|
+
|
|
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`.
|
|
10
|
+
- For current repo behavior, trust `main.py`, `src/lib/**`, `public/js/**`, `prisma/**`, and `src/app/**` over generic Caspian docs.
|
|
11
|
+
- For framework internals, trust `.venv/Lib/site-packages/casp/**` over generic or older upstream guidance.
|
|
12
|
+
- When docs and runtime disagree, align the docs to the code that actually runs in this workspace.
|
|
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.
|
|
14
|
+
- Keep auth policy in `src/lib/auth/auth_config.py` and keep auth bootstrap, middleware wiring, and provider registration in `main.py`.
|
|
15
|
+
- Use PulsePoint and `pp.rpc(...)` as the default frontend and client-to-server contract unless the user requests another stack.
|
|
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.
|
|
17
|
+
- `layout()` is synchronous in the installed runtime. Put async I/O in `page()` or `@rpc()`.
|
|
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.
|
|
19
|
+
- Do not assume `StateManager` survives across requests unless `request.state.session` is explicitly bridged from `request.session`.
|
|
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.
|
|
21
|
+
|
|
22
|
+
## Path-Specific Rules
|
|
23
|
+
|
|
24
|
+
### `main.py`
|
|
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.
|
|
27
|
+
- Preserve the effective middleware execution order unless the task explicitly changes request semantics: `SessionMiddleware -> CSRFMiddleware -> AuthMiddleware -> RPCMiddleware`.
|
|
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.
|
|
30
|
+
|
|
31
|
+
### `src/lib/**/*.py`
|
|
32
|
+
|
|
33
|
+
- Keep `src/lib/` for app-owned shared code, service wrappers, and reusable helpers.
|
|
34
|
+
- Reuse and extend the existing `src/lib/prisma/` package for Python database access.
|
|
35
|
+
- Keep auth policy in `src/lib/auth/auth_config.py`. Keep auth bootstrap and middleware order changes in `main.py`.
|
|
36
|
+
|
|
37
|
+
### `public/js/main.js`
|
|
38
|
+
|
|
39
|
+
- Treat `public/js/main.js` as the thin browser bootstrap entry point.
|
|
40
|
+
- Keep it minimal and point it at the runtime shipped in `public/js/pp-reactive-v2.js`.
|
|
41
|
+
- Do not duplicate PulsePoint runtime logic here.
|
|
42
|
+
|
|
43
|
+
### `public/js/pp-reactive-v2.js`
|
|
44
|
+
|
|
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.
|
|
46
|
+
- Preserve the current public runtime contract unless the task explicitly changes Caspian frontend behavior.
|
|
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.
|
|
48
|
+
|
|
49
|
+
### `src/app/**/*.html`
|
|
50
|
+
|
|
51
|
+
- Keep route templates and layouts server-rendered first, with PulsePoint enhancement as the default interactive layer.
|
|
52
|
+
- Preserve Caspian template syntax such as `[[...]]` in layouts and `pp-*` runtime attributes in rendered HTML.
|
|
53
|
+
- Do not author `pp-component="..."` manually in route or layout templates; the Python render pipeline injects it onto the single root element.
|
|
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.
|
|
56
|
+
- Do not assume React, Vue, JSX, HTMX, or another frontend runtime unless the user explicitly requests one.
|
|
57
|
+
|
|
58
|
+
### `prisma/**`
|
|
59
|
+
|
|
60
|
+
- Treat `prisma/schema.prisma` as the data-model source of truth.
|
|
61
|
+
- Treat `prisma.config.ts` as the datasource and migration or seed configuration source of truth.
|
|
62
|
+
- Keep Node-side generation and seeding aligned with `npx prisma generate` and `prisma/seed.ts`.
|
|
63
|
+
- Keep Python-side database access aligned with `src/lib/prisma/**`.
|
|
64
|
+
|
|
65
|
+
### `.venv/Lib/site-packages/casp/**/*.py`
|
|
66
|
+
|
|
67
|
+
- Treat these files as framework internals.
|
|
68
|
+
- Only change them when the task is explicitly about Caspian core behavior, installed-runtime debugging, or documentation that must match the installed implementation.
|
|
69
|
+
- If behavior changes here, update the matching docs under `node_modules/caspian-utils/dist/docs/`.
|
|
70
|
+
|
|
71
|
+
### `node_modules/caspian-utils/dist/docs/**/*.md`
|
|
72
|
+
|
|
73
|
+
- These files are the local documentation layer, not the runtime. Verify every behavior claim against the actual code that runs.
|
|
74
|
+
- Use this verification order:
|
|
75
|
+
1. `caspian.config.json`, then `main.py`, `src/lib/**`, `public/js/**`, `prisma/**`, `src/app/**`
|
|
76
|
+
2. `.venv/Lib/site-packages/casp/**`
|
|
77
|
+
3. the markdown file being edited
|
|
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
|
|
80
|
+
- this workspace already has `src/lib/prisma/**`
|
|
81
|
+
- auth policy lives in `src/lib/auth/auth_config.py`
|
|
82
|
+
- PulsePoint runtime lives in `public/js/pp-reactive-v2.js`
|
|
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
|
|
85
|
+
- dynamic route params are passed to `page()` as a single positional `dict`
|
|
86
|
+
- `layout()` is sync-only in the installed runtime
|
|
87
|
+
- `StateManager` persistence depends on `request.state.session`, which is not bridged from `request.session` in the current `main.py`
|
|
88
|
+
- Keep `index.md` and cross-links aligned when adding or changing pages.
|
package/dist/AGENTS.md
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# Caspian Agent Guide
|
|
2
|
+
|
|
3
|
+
## Purpose
|
|
4
|
+
|
|
5
|
+
This workspace is a Caspian application plus a local copy of the packaged Caspian docs.
|
|
6
|
+
|
|
7
|
+
When you work here, use the code that actually runs as the source of truth and use the markdown docs as the routing and explanation layer.
|
|
8
|
+
|
|
9
|
+
## Source Of Truth Order
|
|
10
|
+
|
|
11
|
+
Use this precedence whenever behavior, docs, and generated code disagree:
|
|
12
|
+
|
|
13
|
+
1. App runtime and app-owned code
|
|
14
|
+
- `main.py`
|
|
15
|
+
- `src/app/**`
|
|
16
|
+
- `src/lib/**`
|
|
17
|
+
- `public/js/**`
|
|
18
|
+
- `prisma/**`
|
|
19
|
+
- `caspian.config.json`
|
|
20
|
+
2. Installed Caspian framework runtime
|
|
21
|
+
- `.venv/Lib/site-packages/casp/**`
|
|
22
|
+
3. Packaged Caspian docs in this workspace
|
|
23
|
+
- `node_modules/caspian-utils/dist/docs/**`
|
|
24
|
+
|
|
25
|
+
If the task is about current repo behavior, prefer the app runtime.
|
|
26
|
+
|
|
27
|
+
If the task is about framework internals, prefer the installed `casp` package.
|
|
28
|
+
|
|
29
|
+
If docs differ from either of those, update the docs to match the code that actually runs.
|
|
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
|
+
|
|
33
|
+
## Verified Workspace Facts
|
|
34
|
+
|
|
35
|
+
- Local Caspian docs live under `node_modules/caspian-utils/dist/docs/`.
|
|
36
|
+
- `main.py` is the application entry point and owns auth bootstrap, FastAPI setup, static asset routes, route registration, error handlers, cache defaults, and middleware wiring.
|
|
37
|
+
- Middleware is added in this source order: `RPCMiddleware`, `AuthMiddleware`, `CSRFMiddleware`, `SessionMiddleware`.
|
|
38
|
+
- Effective request order is therefore: `SessionMiddleware -> CSRFMiddleware -> AuthMiddleware -> RPCMiddleware`.
|
|
39
|
+
- App-level auth policy lives in `src/lib/auth/auth_config.py`.
|
|
40
|
+
- `main.py` applies auth settings with `configure_auth(build_auth_settings())` and registers `GithubProvider()` plus `GoogleProvider()`.
|
|
41
|
+
- This workspace already has an app-owned Python database layer in `src/lib/prisma/`.
|
|
42
|
+
- Reuse `src/lib/prisma/prisma`, `PrismaClient`, generated models, and helper types instead of creating a second Python database abstraction.
|
|
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"]`.
|
|
45
|
+
- PulsePoint runtime code is shipped in `public/js/pp-reactive-v2.js` and loaded from `public/js/main.js`.
|
|
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.
|
|
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>`.
|
|
49
|
+
- In the current router inside `main.py`, path params are passed to `page()` as the first positional `dict` argument.
|
|
50
|
+
- Matching query params can still be injected by name, and `request` is injected by keyword when declared.
|
|
51
|
+
- The installed `casp.layout` runtime calls `layout()` synchronously. Keep async I/O in `page()` or `@rpc()`.
|
|
52
|
+
- `StateManager` reads and writes `request.state.session`, but the current middleware stack in `main.py` does not mirror `request.session` into `request.state.session`.
|
|
53
|
+
- Do not assume `StateManager` persistence survives across requests until that bridge exists.
|
|
54
|
+
- Route HTML caching uses `caches/` and `caches/cache_manifest.json` through `casp.cache_handler`.
|
|
55
|
+
- The current app tree has root templates in `src/app/` and does not currently include route-specific `index.py` files.
|
|
56
|
+
|
|
57
|
+
## Task Routing
|
|
58
|
+
|
|
59
|
+
Use this map before making changes.
|
|
60
|
+
|
|
61
|
+
| Task area | Read first | Verify against |
|
|
62
|
+
| --- | --- | --- |
|
|
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/**` |
|
|
65
|
+
| Routing, layouts, metadata | `node_modules/caspian-utils/dist/docs/routing.md` | `main.py`, `.venv/Lib/site-packages/casp/layout.py` |
|
|
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` |
|
|
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` |
|
|
68
|
+
| Server state | `node_modules/caspian-utils/dist/docs/state.md` | `.venv/Lib/site-packages/casp/state_manager.py`, `main.py` |
|
|
69
|
+
| Page caching | `node_modules/caspian-utils/dist/docs/cache.md` | `.venv/Lib/site-packages/casp/cache_handler.py`, `main.py` |
|
|
70
|
+
| Validation | `node_modules/caspian-utils/dist/docs/validation.md` | `.venv/Lib/site-packages/casp/validate.py` |
|
|
71
|
+
| Database and seed flow | `node_modules/caspian-utils/dist/docs/database.md` | `prisma/schema.prisma`, `prisma/seed.ts`, `src/lib/prisma/**` |
|
|
72
|
+
|
|
73
|
+
## Editing Rules
|
|
74
|
+
|
|
75
|
+
- Keep app-owned shared code in `src/lib/**`.
|
|
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.
|
|
78
|
+
- Treat `.venv/Lib/site-packages/casp/**` as framework internals unless the task is explicitly about Caspian core behavior or installed-runtime documentation.
|
|
79
|
+
- When a task involves Python-side database access, extend or reuse `src/lib/prisma/**` instead of introducing a parallel helper.
|
|
80
|
+
- Keep auth policy in `src/lib/auth/auth_config.py`.
|
|
81
|
+
- Keep auth bootstrap, middleware ordering, provider wiring, and router behavior in `main.py`.
|
|
82
|
+
- Use PulsePoint and `pp.rpc(...)` as the default frontend and browser-to-server contract unless the user explicitly wants another stack.
|
|
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.
|
|
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.
|
|
86
|
+
- Keep Copilot guidance consolidated in `.github/copilot-instructions.md`; do not add `.github/instructions/` in this workspace.
|
|
87
|
+
- When writing docs about route behavior, describe the param passing and layout behavior implemented in the current runtime, not generic upstream assumptions.
|
|
88
|
+
- When a runtime change affects documentation, update the matching page in `node_modules/caspian-utils/dist/docs/`.
|
|
89
|
+
- When a repo-level rule changes, update this file too.
|
|
90
|
+
|
|
91
|
+
## Docs Alignment Notes
|
|
92
|
+
|
|
93
|
+
The packaged docs in this workspace are already mostly aligned with the installed runtime, but keep these repo-specific clarifications in mind:
|
|
94
|
+
|
|
95
|
+
- `database.md` describes the scaffold generically, but this workspace now includes a real app-owned Python Prisma-style layer under `src/lib/prisma/`.
|
|
96
|
+
- `state.md` is correct to warn that cross-request persistence depends on `request.state.session`, which is not bridged in the current `main.py`.
|
|
97
|
+
- `routing.md`, `components.md`, `auth.md`, `fetch-data.md`, `cache.md`, `pulsepoint.md`, and `validation.md` should continue to be validated against the installed `casp` package before any behavior claims are changed.
|
|
98
|
+
|
|
99
|
+
## Maintenance Checklist
|
|
100
|
+
|
|
101
|
+
Before merging doc or runtime changes:
|
|
102
|
+
|
|
103
|
+
1. Compare the claim or behavior against `main.py`, `src/lib/**`, and `.venv/Lib/site-packages/casp/**`.
|
|
104
|
+
2. Update the matching packaged doc in `node_modules/caspian-utils/dist/docs/` if the running behavior changed.
|
|
105
|
+
3. Update this file if the repo-level source-of-truth rules or workspace facts changed.
|
package/dist/CLAUDE.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@AGENTS.md
|