create-prisma-php-app 5.0.0-alpha.3 → 5.0.0-alpha.30

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.
@@ -0,0 +1,97 @@
1
+ # Project Guidelines
2
+
3
+ ## Source Of Truth
4
+
5
+ - For Prisma PHP applications, treat `node_modules/prisma-php/dist/docs/index.md` as the entry point for the installed framework version.
6
+ - Read the matching doc in `node_modules/prisma-php/dist/docs` before generating or editing framework-specific Prisma PHP code.
7
+ - Expect `AGENTS.md` in the project root and keep it aligned with the installed Prisma PHP docs contract.
8
+ - In the Prisma PHP package source repo, keep `AGENTS.md`, `.github/copilot-instructions.md`, and `dist/docs` aligned so the published docs remain correct after install.
9
+ - Do not assume installed consumer apps also ship a root `.github/copilot-instructions.md` unless the generator explicitly creates one.
10
+ - Keep every `dist/docs/*.md` page AI-discoverable on its own: the frontmatter description and opening section should clearly say when agents should read that file and which adjacent docs to consult next.
11
+
12
+ ## Project Structure Recommendations
13
+
14
+ - Keep `src/app` focused on route files, layouts, handlers, and route-scoped partials.
15
+ - Prefer `src/Components` for reusable application UI components shared across pages or layouts.
16
+ - Keep reusable non-UI code such as services, auth, middleware, Prisma classes, and helpers in `src/Lib`.
17
+ - If a partial starts as route-local but becomes shared across the app, move it from `src/app` to `src/Components`.
18
+ - Suggest this structure by default when helping users organize growing Prisma PHP apps.
19
+
20
+ ## Framework-Managed Package Scripts
21
+
22
+ - Prisma PHP can generate `package.json` scripts for BrowserSync, Tailwind, TypeScript, WebSocket, MCP, Swagger docs, and related helpers.
23
+ - Prefer `npm run dev` for ordinary local development and `npm run build` for ordinary production-style asset builds.
24
+ - Do not default to telling users to run `npm run tailwind`, `npm run tailwind:build`, `npm run ts:watch`, or `npm run ts:build` after routine file changes, because those are usually orchestrated through the generated top-level scripts.
25
+ - Use `npm run websocket` or `npm run mcp` only when isolating local runtime startup, debugging, or when the project's scripts show those services are not already covered by the normal development flow.
26
+ - Use `npm run create-swagger-docs` only when Swagger or OpenAPI output must be intentionally generated or refreshed.
27
+ - When package-script behavior matters, read `dist/docs/commands.md` first and inspect the actual `package.json` in the target project before assuming which scripts exist.
28
+
29
+ ## CLI Command Alignment
30
+
31
+ - For new apps, prefer `npx create-prisma-php-app <project-name>` as the default recommended create command.
32
+ - For existing apps, prefer `npx pp update project` after saving feature changes in `prisma-php.json`.
33
+ - When an existing app needs a specific release channel or pinned update version, prefer `npx pp update project --tag <value>` or `npx pp update project --tag=<value>`.
34
+ - Use `--tag <value>` or `--tag=<value>` for release-channel or pinned-version updates.
35
+ - Do not use `npx pp update project` as a substitute for Prisma ORM migration commands.
36
+
37
+ ## Authentication Route Strategy
38
+
39
+ - Prisma PHP defaults to public routes.
40
+ - Choose the route privacy strategy at the start of the app, before creating most routes.
41
+ - If the app will have many public pages, keep the public-default strategy.
42
+ - If the app will have only a few public entry points and most routes should require login, use the private-default strategy.
43
+ - For private-default routing, enable both `IS_ALL_ROUTES_PRIVATE = true` and `IS_TOKEN_AUTO_REFRESH = true` in `src/Lib/Auth/AuthConfig.php`.
44
+ - When `IS_ALL_ROUTES_PRIVATE` is `true`, Prisma PHP treats routes as private by default and uses `publicRoutes` for the public allowlist; home is already public by default because `publicRoutes` starts as `['/']`.
45
+ - Keep `authRoutes` public by default unless the user explicitly asks to change them.
46
+ - There is no need to modify other Prisma PHP core files for this route privacy behavior.
47
+ - If `src/Lib/Auth/AuthConfig.php` is customized, preserve it during future Prisma PHP project updates by adding `./src/Lib/Auth/AuthConfig.php` to `excludeFiles` in `prisma-php.json`.
48
+
49
+ ## PulsePoint-First Frontend Rules
50
+
51
+ - In full-stack Prisma PHP apps, treat PulsePoint as the primary JavaScript authoring model for frontend behavior.
52
+ - For page-local interactivity, prefer `index.php` or nested `layout.php` with a plain inline `<script>` that contains PulsePoint state and functions directly, and use `pp.fetchFunction(...)` for backend calls.
53
+ - Do not wrap inline PulsePoint code in `DOMContentLoaded`, IIFEs, manual `pp.mount()` calls, or custom scoping/bootstrap helpers. Prisma PHP scopes the component boundary and runs the script for you.
54
+ - Reserve plain browser JavaScript or TypeScript modules for reusable helpers in `ts/`, third-party libraries, low-level browser APIs, or behavior that does not belong inside a PulsePoint component boundary.
55
+
56
+ ## Route File Conventions
57
+
58
+ - For PulsePoint-aware `index.php` and nested `layout.php`, keep file order as PHP first, then one parent HTML element; keep the PulsePoint `<script>` as the last child inside that same root element.
59
+ - `index.php` and nested `layout.php` must render a single parent HTML element. Treat that root like a React-style component boundary rather than loose sibling markup.
60
+ - For pages and nested layouts, author a plain single root element and let Prisma PHP inject the PulsePoint `pp-component` scope automatically.
61
+ - Author plain `<script>` tags inside that root when PulsePoint is needed. Put the PulsePoint code at the top level of that script. Do not manually add `type="text/pp"`, `DOMContentLoaded` wrappers, IIFEs, or manual bootstrap code; Prisma PHP normalizes the script contract for the runtime.
62
+ - Only the root `layout.php` should define `<html>`, `<head>`, and `<body>`. When PulsePoint is present, keep `MainLayout::$children;` and any `<script>` inside one clear wrapper.
63
+
64
+ ## Component Boundary Rules
65
+
66
+ - Distinguish PHPX class components from `ImportComponent` partials.
67
+ - `ImportComponent` partials must output exactly one root element because Prisma PHP uses that root as the imported component boundary and serializes props there.
68
+ - Do not manually add `pp-component` inside `ImportComponent` partial source; Prisma PHP injects it there.
69
+ - When imported partials need PulsePoint logic, keep the `<script>` inside that same root element and author it as a plain `<script>` tag without `type="text/pp"`, DOM-ready wrappers, or manual bootstrap code.
70
+
71
+ ## Relevant Docs
72
+
73
+ - Project structure and feature placement: `dist/docs/project-structure.md`
74
+ - CLI project creation and update commands: `dist/docs/commands.md`
75
+ - First-time project installation and local setup: `dist/docs/installation.md`
76
+ - Existing-project upgrades and feature refreshes: `dist/docs/upgrading.md`
77
+ - TypeScript frontend tooling, the `typescript` flag, and `ts/main.ts` registration: `dist/docs/typescript.md`
78
+ - Backend-only API usage and `backendOnly`: `dist/docs/backend-only.md`
79
+ - Route and layout structure: `dist/docs/layouts-and-pages.md`
80
+ - AI integration, provider-backed chat, streaming, and MCP boundary: `dist/docs/get-started-ia.md`
81
+ - Data loading, `#[Exposed]`, and SSE streaming: `dist/docs/fetching-data.md`
82
+ - Bootstrap flow, runtime init order, request initialization, and function-call protection: `dist/docs/bootstrap-runtime.md`
83
+ - PulsePoint runtime rules: `dist/docs/pulsepoint.md`
84
+ - Component and `ImportComponent` rules: `dist/docs/components.md`
85
+ - Cache behavior and `CacheHandler`: `dist/docs/caching.md`
86
+ - Validation rules: `dist/docs/validator.md`
87
+ - Prisma ORM schema, migrations, and generated PHP classes: `dist/docs/prisma-php-orm.md`
88
+ - Environment variables and `PP\Env` usage: `dist/docs/env.md`
89
+ - File uploads and file manager behavior: `dist/docs/file-manager.md`
90
+ - Email and SMTP workflows: `dist/docs/email.md`
91
+ - WebSocket and realtime behavior: `dist/docs/websocket.md`
92
+ - MCP server and tool rules: `dist/docs/mcp.md`
93
+ - Authentication: `dist/docs/authentication.md`
94
+ - Error handling, expected failures, and route error files: `dist/docs/error-handling.md`
95
+ - Metadata and icons: `dist/docs/metadata-and-og-images.md`
96
+ - API-style handlers and webhooks: `dist/docs/route-handlers.md`
97
+ - Swagger/OpenAPI generation and `swaggerDocs`: `dist/docs/swagger-docs.md`