create-prisma-php-app 5.0.0-alpha.8 → 5.1.0-alpha.1

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/AGENTS.md CHANGED
@@ -2,89 +2,113 @@
2
2
 
3
3
  # Prisma PHP AI Agent Rules
4
4
 
5
- Before generating, editing, or reviewing Prisma PHP code, read the installed Prisma PHP docs for the current project version, read the project manifest, and only inspect framework internals when the docs do not answer the task.
5
+ This AGENTS.md belongs in the root of a Prisma PHP application.
6
6
 
7
- Do not guess framework behavior from Laravel, Next.js, React, Vue, Livewire, Alpine, or generic PHP habits. The installed Prisma PHP docs and the local project configuration are the source of truth.
7
+ Treat `./node_modules/prisma-php/dist/docs/index.md` as the entry point for Prisma PHP guidance, then read the matching document in `./node_modules/prisma-php/dist/docs` before generating, editing, reviewing, or documenting framework-specific behavior.
8
8
 
9
- ## Source of truth priority
9
+ Treat the installed docs as framework knowledge. They explain what Prisma PHP can do and how to do it. Do not treat the presence of a page in `./node_modules/prisma-php/dist/docs` as proof that the current app has that feature enabled.
10
10
 
11
- Use this order of truth when working in a Prisma PHP project:
11
+ Do not guess framework behavior from Laravel, Next.js, React, Vue, Livewire, Alpine, Symfony, Socket.IO, or generic PHP habits. Prisma PHP's installed docs in `./node_modules/prisma-php/dist/docs` and the current project files are the source of truth.
12
12
 
13
- 1. The user’s explicit request
13
+ If `.github/instructions/**/*.instructions.md` exists, treat those files as workspace-local task instructions. Inspect `.github/instructions/` before deciding how to implement the task, then read any instruction files whose name, described scope, target files, or library focus matches the current work, such as PHPXUI or `ppicons`.
14
+
15
+ ## Documentation source of truth
16
+
17
+ For Prisma PHP projects, use this order first:
18
+
19
+ 1. the user's explicit request
14
20
  2. `./prisma-php.json`
15
- 3. Installed Prisma PHP docs in `node_modules/prisma-php/dist/docs`
16
- 4. Project-local conventions and existing project files
17
- 5. Prisma PHP core internals in `vendor/tsnc/prisma-php/src`
18
- 6. General framework knowledge
21
+ 3. the relevant `.github/instructions/**/*.instructions.md` files for the current task, library, or target files
22
+ 4. the relevant installed document in `./node_modules/prisma-php/dist/docs`
23
+ 5. `./AGENTS.md`
24
+ 6. project-local conventions and existing app files
25
+ 7. Prisma PHP core internals in `vendor/tsnc/prisma-php/src` only when the docs still leave a gap
26
+ 8. general framework knowledge as the last fallback
19
27
 
20
- If a documented Prisma PHP rule conflicts with a habit from another framework, follow Prisma PHP.
28
+ Important rules:
29
+
30
+ - use `./prisma-php.json` as the single source of truth for current-project feature flags and framework-managed scaffolds
31
+ - if `.github/instructions/**/*.instructions.md` exists, inspect `.github/instructions/` and read the files that match the current task, named library, or target files before generating code
32
+ - treat `.github/instructions/**/*.instructions.md` as workspace-local guidance for third-party libraries, design systems, icon packs, and other implementation-specific rules
33
+ - treat `./node_modules/prisma-php/dist/docs` as the single documentation source of truth for the installed Prisma PHP version
34
+ - treat the docs inventory as a framework reference set for AI routing, not as a statement that every optional Prisma PHP feature is enabled in the current app
35
+ - expect `./AGENTS.md` at the project root
36
+ - when the installed docs and a habit from another framework conflict, follow Prisma PHP
37
+ - when a workspace instruction file and the general Prisma PHP docs both apply, follow both; keep `./prisma-php.json` as the source of truth for feature enablement and prefer the most specific matching instruction for library- or file-scoped implementation details
38
+ - when updating Prisma PHP package/docs sources, keep `AGENTS.md` and `dist/docs` aligned for consumer apps; if the Prisma PHP package source repo also maintains `.github/copilot-instructions.md` or `.github/instructions/**/*.instructions.md`, keep those source-repo files aligned there too
39
+
40
+ ## Runtime lookup for AI
41
+
42
+ Use this map only after `prisma-php.json`, matching workspace instructions, installed docs, and current project files do not answer the task.
43
+
44
+ | Need to verify | Runtime/source file |
45
+ | --- | --- |
46
+ | route root scoping, HTML fragment parsing, component tag compilation, prop casing | `vendor/tsnc/prisma-php/src/PHPX/TemplateCompiler.php` |
47
+ | imported PHP partial execution, one-root enforcement, prop serialization, imported `#[Exposed]` functions | `vendor/tsnc/prisma-php/src/ImportComponent.php` |
48
+ | metadata, custom head tags, dynamic head/footer scripts | `vendor/tsnc/prisma-php/src/MainLayout.php` |
49
+ | route and component maps | `vendor/tsnc/prisma-php/src/PrismaPHPSettings.php`, `settings/files-list.json`, `settings/component-map.json` |
50
+ | request data, dynamic params, redirects, function-call requests | `vendor/tsnc/prisma-php/src/Request.php` |
51
+ | exposed functions | `vendor/tsnc/prisma-php/src/Attributes/Exposed.php`, `vendor/tsnc/prisma-php/src/Attributes/ExposedRegistry.php` |
52
+ | validation | `vendor/tsnc/prisma-php/src/Validator.php`, `vendor/tsnc/prisma-php/src/Rule.php` |
53
+ | env values | `vendor/tsnc/prisma-php/src/Env.php` |
54
+ | uploads, email, streaming | `vendor/tsnc/prisma-php/src/FileManager/UploadFile.php`, `vendor/tsnc/prisma-php/src/PHPMailer/Mailer.php`, `vendor/tsnc/prisma-php/src/Streaming/SSE.php` |
21
55
 
22
56
  ## Installed docs location
23
57
 
24
- The installed Prisma PHP documentation for the active project lives in:
58
+ In Prisma PHP applications, the installed docs live in:
25
59
 
26
60
  ```txt
27
61
  node_modules/prisma-php/dist/docs
28
62
  ```
29
63
 
30
- AI agents must treat this directory as the primary documentation source for Prisma PHP behavior, routing, file conventions, features, helpers, and usage patterns for the installed version.
31
-
32
- Before writing framework-specific code, inspect the relevant documentation files in this directory.
33
-
34
- ## Read `prisma-php.json` first
35
-
36
- Before generating code or making framework decisions, read:
64
+ The current docs entry point for the installed version is:
37
65
 
38
66
  ```txt
39
- ./prisma-php.json
67
+ node_modules/prisma-php/dist/docs/index.md
40
68
  ```
41
69
 
42
- Treat it as the capability manifest for the current app.
43
-
44
- Use it to verify whether the project has features such as:
70
+ The project root should also include:
45
71
 
46
- - `tailwindcss`
47
- - `backendOnly`
48
- - `swaggerDocs`
49
- - `websocket`
50
- - `mcp`
51
- - `prisma`
52
- - `typescript`
72
+ ```txt
73
+ AGENTS.md
74
+ ```
53
75
 
54
- Also use it to confirm environment-specific project details such as:
76
+ When present, task-scoped workspace instructions live in:
55
77
 
56
- - project root path
57
- - PHP executable path
58
- - BrowserSync target and path rewrite rules
59
- - component scan directories
60
- - excluded files
78
+ ```txt
79
+ .github/instructions
80
+ ```
61
81
 
62
- Do not assume a feature is enabled unless it is present and enabled in `prisma-php.json`.
82
+ ## Required doc-routing map
63
83
 
64
- ## Framework-managed generated files
84
+ Before generating code, examples, instructions, or reviews, choose the documentation file based on the task.
65
85
 
66
- Prisma PHP automatically generates and maintains certain framework files.
86
+ Use the docs router to learn how Prisma PHP implements a task. Use `./prisma-php.json` to decide whether the current app enables the relevant optional feature. When `.github/instructions/` exists, inspect that directory first and read any `*.instructions.md` files that match the task before routing into the Prisma PHP docs.
67
87
 
68
- ### `files-list.json`
88
+ ### Read workspace instruction files first for these tasks
69
89
 
70
- Do **not** create, edit, reorder, or manually maintain `files-list.json`.
90
+ - **Third-party UI, icon, component, or design-system work such as PHPXUI, `ppicons`, or similar workspace-specific integrations**
91
+ Read the matching `.github/instructions/**/*.instructions.md` file first
71
92
 
72
- Treat `files-list.json` as a **framework-generated file** for route discovery and internal bookkeeping. When creating, renaming, or removing routes, make the change in the actual route folders and route files under `src/app` and let Prisma PHP regenerate `files-list.json` automatically.
93
+ - **Tasks that target files, folders, or conventions covered by a workspace instruction file**
94
+ Read the most specific matching `.github/instructions/**/*.instructions.md` file first
73
95
 
74
- If a route task appears to require editing `files-list.json`, that is almost certainly the wrong approach. The correct workflow is:
96
+ - **Library-specific refactors, reviews, or implementations where the workspace provides a dedicated instruction file**
97
+ Read that instruction file first, then read the matching Prisma PHP docs page for framework behavior
75
98
 
76
- 1. create or update the route folder/file in `src/app`
77
- 2. do **not** touch `files-list.json`
78
- 3. let Prisma PHP regenerate framework-managed route metadata
99
+ ### Read these docs first for these tasks
79
100
 
80
- ## Required doc-routing map
101
+ - **Framework orientation, repo-wide guidance, or the high-level AI quick start**
102
+ Read `index.md`
81
103
 
82
- Before generating code, choose the documentation file based on the task.
104
+ - **Project setup, folder placement, route file choice, feature placement, or overall file conventions**
105
+ Read `project-structure.md`
83
106
 
84
- ### Read these docs first for these tasks
107
+ - **CLI project creation, starter kits, feature flags, or `npx pp update project` usage**
108
+ Read `commands.md`
85
109
 
86
- - **Project setup, folder placement, route file choice, or overall file conventions**
87
- Read `project-structure.md`
110
+ - **Backend-only Prisma PHP usage, API-first projects, `backendOnly`, separate frontend consumers, or CORS setup for API routes**
111
+ Read `backend-only.md`
88
112
 
89
113
  - **Creating a page, layout, nested route, dynamic route, or normal UI route**
90
114
  Read `layouts-and-pages.md`
@@ -92,15 +116,42 @@ Before generating code, choose the documentation file based on the task.
92
116
  - **Creating, editing, composing, or reviewing PHPX components, props, children, fragments, icons, buttons, accordions, or component file placement**
93
117
  Read `components.md`
94
118
 
95
- - **File uploads, `multipart/form-data`, `$_FILES`, `PP\FileManager\UploadFile`, rename flows, delete flows, allowed file types, upload size rules, or file manager UI behavior**
96
- Read `file-manager.md`, then verify the official File Manager docs at `get-started-file`
97
-
98
- - **Authentication strategy, `AuthConfig.php`, route privacy model, sign-in, sign-out, JWT session lifecycle, `refreshUserSession`, RBAC, credentials auth, OAuth, social login, or auth state manager usage**
99
- Read `authentication.md`, then verify the matching official docs in this order: `auth-get-started`, `credentials`, and `state-manager-auth`
119
+ - **TypeScript frontend tooling, the `typescript` feature flag, the root `ts/` directory, `ts/main.ts`, npm packages, or registered browser helpers used from template expressions and PulsePoint scripts**
120
+ Read `typescript.md`, then use `pulsepoint.md`, `layouts-and-pages.md`, or `components.md` for the affected component boundary
100
121
 
101
- - **Loading data, calling backend logic from the frontend, `pp.fetchFunction(...)`, `#[Exposed]`, or interactive backend validation**
122
+ - **Loading data, calling backend logic from the frontend, `pp.fetchFunction(...)`, `#[Exposed]`, route-local mutations, streaming responses, or interactive backend validation**
102
123
  Read `fetching-data.md`
103
124
 
125
+ - **AI integration, provider SDKs, chat UIs, streamed assistant output, or deciding between page-local assistant UI, websocket, and MCP tools**
126
+ Read `get-started-ia.md`, then use `fetching-data.md`, `validator.md`, `websocket.md`, or `mcp.md` as needed
127
+
128
+ - **PulsePoint runtime behavior such as `pp.state`, `pp.effect`, `pp-for`, `pp-spread`, `pp-style`, `pp-ref`, context, portals, controlled form values, or keyed diffing**
129
+ Read `pulsepoint.md`
130
+
131
+ - **Validation, sanitization, `PP\Validator`, `PP\Rule`, field validation, form validation, live validation, or request validation rules**
132
+ Read `validator.md`, then apply the relevant local guidance from `fetching-data.md`, `error-handling.md`, and `route-handlers.md`
133
+
134
+ - **Environment variables, `.env`, `PP\Env`, `Env::get`, `Env::string`, `Env::bool`, `Env::int`, feature flags, host and port config, or runtime bootstrap settings**
135
+ Read `env.md`, then verify the official env docs at `env` and `env-file`
136
+
137
+ - **Bootstrap flow, request initialization, `FUNCTION_CALL_SECRET`, `prisma_php_csrf`, route resolution, or runtime init order**
138
+ Read `bootstrap-runtime.md`, then use `env.md`, `fetching-data.md`, or `error-handling.md` as needed
139
+
140
+ - **File uploads, `multipart/form-data`, `$_FILES`, `PP\FileManager\UploadFile`, rename flows, replace flows, delete flows, allowed file types, upload size rules, or file manager UI behavior**
141
+ Read `file-manager.md`, then verify the official File Manager docs and, when internals matter, the core upload file at `vendor/tsnc/prisma-php/src/FileManager/UploadFile.php`
142
+
143
+ - **SMTP setup, `.env` mail variables, `PP\PHPMailer\Mailer`, HTML bodies, plain-text bodies, recipients, reply-to, CC, BCC, or attachments**
144
+ Read `email.md`, then verify the official email docs at `email-get-started`
145
+
146
+ - **Ratchet websocket setup, `IoServer`, `HttpServer`, `WsServer`, `ConnectionManager`, browser `WebSocket`, or realtime route behavior**
147
+ Read `websocket.md`, then verify the official websocket docs in this order: `websocket-get-started`, `websocket-chat-app`
148
+
149
+ - **MCP support, `#[McpTool]`, `#[Schema]`, `PhpMcp\Server\Server`, `StreamableHttpServerTransport`, AI tool endpoints, or `src/Lib/MCP/mcp-server.php`**
150
+ Read `mcp.md`, then verify the official MCP docs in this order: `prisma-php-ai-mcp`, `ai-tools`
151
+
152
+ - **Authentication strategy, `AuthConfig.php`, route privacy model, sign-in, sign-out, JWT session lifecycle, `refreshUserSession`, RBAC, credentials auth, OAuth, social login, or auth state manager usage**
153
+ Read `authentication.md`, then verify the matching official docs in this order: `auth-get-started`, `credentials`, `state-manager-auth`
154
+
104
155
  - **Cache behavior, route caching, invalidation, or `CacheHandler`**
105
156
  Read `caching.md`
106
157
 
@@ -110,17 +161,14 @@ Before generating code, choose the documentation file based on the task.
110
161
  - **Expected errors, uncaught exceptions, `error.php`, `not-found.php`, `ErrorHandler`, or validation failures as expected errors**
111
162
  Read `error-handling.md`
112
163
 
113
- - **Metadata, title, description, head scripts, favicon, icon, or `MainLayout` metadata behavior**
164
+ - **Metadata, title, description, custom head tags, favicon, icon, apple icon, or `MainLayout` metadata behavior**
114
165
  Read `metadata-and-og-images.md`
115
166
 
116
- - **API-style routes, JSON responses, handlers, form-processing endpoints, `route.php`, or request validation in handlers**
167
+ - **API-style routes, JSON responses, handlers, webhooks, form-processing endpoints, `route.php`, or request validation in handlers**
117
168
  Read `route-handlers.md`
118
169
 
119
- - **PulsePoint runtime behavior such as `pp.state`, `pp.effect`, `pp.ref`, `pp-for`, `pp-spread`, or `pp-ref`**
120
- Read `pulsepoint.md`
121
-
122
- - **Sanitization, `PP\Validator`, `PP\Rule`, field validation, form validation, live validation, or backend validation rules**
123
- Read the official Validator docs at `https://prismaphp.tsnc.tech/docs/php-validator`, then apply the relevant local guidance from `fetching-data.md`, `error-handling.md`, and `route-handlers.md`
170
+ - **Swagger or OpenAPI generation, `swaggerDocs`, `pphp-swagger.json`, `create-swagger-docs`, or `settings/prisma-schema-config.json`**
171
+ Read `swagger-docs.md`
124
172
 
125
173
  - **Upgrading Prisma PHP, enabling features, syncing framework-managed project files, or running project updates**
126
174
  Read `upgrading.md`
@@ -128,20 +176,145 @@ Before generating code, choose the documentation file based on the task.
128
176
  - **First-time project installation or app creation flow**
129
177
  Read `installation.md`
130
178
 
131
- - **General doc entry point and framework orientation**
132
- Read `index.md`
179
+ ## Framework docs inventory in this repo
180
+
181
+ The current Prisma PHP docs shipped here include:
182
+
183
+ - `authentication.md`
184
+ - `backend-only.md`
185
+ - `bootstrap-runtime.md`
186
+ - `caching.md`
187
+ - `commands.md`
188
+ - `components.md`
189
+ - `email.md`
190
+ - `env.md`
191
+ - `error-handling.md`
192
+ - `fetching-data.md`
193
+ - `file-manager.md`
194
+ - `get-started-ia.md`
195
+ - `index.md`
196
+ - `installation.md`
197
+ - `layouts-and-pages.md`
198
+ - `mcp.md`
199
+ - `metadata-and-og-images.md`
200
+ - `prisma-php-orm.md`
201
+ - `project-structure.md`
202
+ - `pulsepoint.md`
203
+ - `route-handlers.md`
204
+ - `swagger-docs.md`
205
+ - `typescript.md`
206
+ - `upgrading.md`
207
+ - `validator.md`
208
+ - `websocket.md`
209
+
210
+ This inventory exists to help AI find the right Prisma PHP guidance quickly. It is not a feature inventory for the current app.
211
+
212
+ When a task depends on optional capabilities such as `backendOnly`, `swaggerDocs`, `typescript`, `websocket`, or `mcp`, inspect `./prisma-php.json` before assuming the generated scaffold exists.
213
+
214
+ When adding or reviewing AI guidance, do not stop at older docs only. Make sure the guidance also covers `backend-only.md`, `email.md`, `env.md`, `get-started-ia.md`, `mcp.md`, `swagger-docs.md`, `typescript.md`, and `websocket.md`, plus newer behavior documented in `fetching-data.md` and `metadata-and-og-images.md`.
215
+
216
+ ## Framework-generated files
217
+
218
+ Prisma PHP automatically generates and maintains certain framework files in consumer apps.
219
+
220
+ ### `files-list.json`
221
+
222
+ Do **not** create, edit, reorder, or manually maintain `files-list.json`.
223
+
224
+ Treat `files-list.json` as a framework-generated file for route discovery and internal bookkeeping. When creating, renaming, or removing routes in a Prisma PHP app, make the change in the actual route folders and route files under `src/app` and let Prisma PHP regenerate `files-list.json` automatically.
225
+
226
+ If a route task appears to require editing `files-list.json`, that is almost certainly the wrong approach.
227
+
228
+ ## Reusable project organization
229
+
230
+ When organizing a growing Prisma PHP app, keep route code and reusable code separated.
231
+
232
+ - keep `src/app` focused on the route tree, route-local layouts, pages, handlers, and route-scoped partials
233
+ - prefer `src/Components` for reusable application UI components shared across multiple routes or layouts
234
+ - keep reusable non-UI code such as services, auth, middleware, Prisma classes, and helper libraries in `src/Lib`
235
+ - treat generated libraries such as `src/Lib/PHPXUI` and `src/Lib/PPIcons` as library-specific surfaces governed by their manifests and matching `.github/instructions/**/*.instructions.md` files
236
+ - if a partial starts in `src/app` but becomes shared across the app, promote it into `src/Components`
237
+ - do **not** default to placing app-wide reusable components under `src/app` unless the user explicitly wants route-local colocation
133
238
 
134
- ## Default interactive UI and fetching rule
239
+ ## HTML-first component tag contract
135
240
 
136
- For normal full-stack Prisma PHP work, assume the user wants the **PulsePoint-first** approach unless they explicitly ask otherwise.
241
+ Class-based PHPX components and generated icon components are consumed with HTML-first `x-` tags from `settings/component-map.json`, such as `<x-alert>` and `<x-search />`.
242
+
243
+ Important rules:
244
+
245
+ - use the `tagName` entries in `settings/component-map.json` as the supported runtime contract
246
+ - inspect `settings/component-map.json` instead of inventing `x-` tag names from PHP class names
247
+ - document, review, and generate component and icon markup with the current `x-` tag shape
248
+ - keep examples aligned with the current runtime instead of carrying alternate tag-shape guidance
249
+
250
+ ## Component attribute and prop contract
251
+
252
+ Component attributes in Prisma PHP template markup should be authored in kebab-case. The runtime maps kebab-case attribute names to camelCase prop and public property names when hydrating PHPX components and PulsePoint component boundaries.
253
+
254
+ Examples:
255
+
256
+ ```html
257
+ <x-button as-child="true" />
258
+ <x-dialog-content close-on-escape-key="true" />
259
+ <x-calendar selected-date="{selectedDate}" on-date-select="{setSelectedDate}" />
260
+ ```
261
+
262
+ Important rules:
263
+
264
+ - use kebab-case for component attribute names in documentation, examples, reviews, and generated code
265
+ - expect `as-child` to hydrate `asChild`, `close-on-escape-key` to hydrate `closeOnEscapeKey`, and `selected-date` to hydrate `selectedDate`
266
+ - use mustache values such as `selected-date="{selectedDate}"` and `on-date-select="{setSelectedDate}"` when a component prop must receive PulsePoint state or callbacks
267
+ - write component examples as HTML-first Prisma PHP markup using the current `x-` tag contract
268
+ - do not document component props with camelCase template attributes when writing new Prisma PHP markup
269
+
270
+ ## Framework-managed package scripts
271
+
272
+ Prisma PHP can generate `package.json` scripts for BrowserSync, Tailwind, TypeScript, WebSocket, MCP, Swagger docs, and related project helpers.
273
+
274
+ AI agents should follow this default rule:
275
+
276
+ - prefer `npm run dev` for ordinary local development
277
+ - prefer `npm run build` for ordinary production-style asset builds
278
+ - 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 framework-managed through the generated top-level scripts
279
+ - 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
280
+ - use `npm run create-swagger-docs` only when Swagger or OpenAPI output must be intentionally generated or refreshed
281
+
282
+ When a task involves package scripts, read `commands.md` first and inspect the current `package.json` before assuming which feature scripts exist.
283
+
284
+ ## BrowserSync URL source of truth
285
+
286
+ When AI needs to test or confirm whether a page route, exposed function request, proxy-backed response, or local server workflow is working, check `./settings/bs-config.json` first.
287
+
288
+ Important rules:
289
+
290
+ - use `./settings/bs-config.json` as the source of truth for the active BrowserSync URLs in this app
291
+ - do **not** assume the proxy remains on the default `http://localhost:5090`; if that port is already in use, Prisma PHP may use a different port
292
+ - confirm the current `local`, `external`, `ui`, and `uiExternal` values in `./settings/bs-config.json` before suggesting a browser URL, route test URL, or BrowserSync UI URL
293
+ - when frontend console logs, network errors, or terminal output suggest the app is being tested through the wrong URL or proxy port, re-check `./settings/bs-config.json` before changing app code
294
+
295
+ ## CLI command alignment
296
+
297
+ When a task involves Prisma PHP CLI usage, keep the command guidance aligned with `commands.md`.
298
+
299
+ - for new apps, prefer `npx create-prisma-php-app <project-name>` as the default recommended create command
300
+ - for existing apps, prefer `npx pp update project` after saving feature changes in `prisma-php.json`
301
+ - 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>`
302
+ - use `--tag <value>` or `--tag=<value>` for release-channel or pinned-version updates
303
+ - do **not** use `npx pp update project` as a substitute for Prisma ORM migration commands
304
+
305
+ ## Default interactive UI and data-flow rule
306
+
307
+ For normal full-stack Prisma PHP work, assume the user wants the PulsePoint-first approach unless they explicitly ask otherwise.
308
+
309
+ PulsePoint is the primary JavaScript authoring model for frontend work in Prisma PHP. For normal page behavior, keep the client logic inside a plain inline `<script>` within the route or imported-partial root, let Prisma PHP scope and execute it, and prefer `pp.fetchFunction(...)` over ad hoc endpoints.
137
310
 
138
311
  Default interaction stack:
139
312
 
140
313
  1. render route UI with `index.php`
141
- 2. keep browser-side interactivity in **PulsePoint**
142
- 3. call backend PHP from the frontend with **`pp.fetchFunction(...)`**
143
- 4. mark callable PHP functions or methods with **`#[Exposed]`**
144
- 5. validate and normalize input on the PHP side with **`PP\Validator`**
314
+ 2. keep browser-side interactivity in PulsePoint
315
+ 3. call backend PHP from the frontend with `pp.fetchFunction(...)`
316
+ 4. mark callable PHP functions or methods with `#[Exposed]`
317
+ 5. validate and normalize input on the PHP side with `PP\Validator`
145
318
 
146
319
  Treat this as the default for:
147
320
 
@@ -154,54 +327,176 @@ Treat this as the default for:
154
327
  - inline validation
155
328
  - route-local CRUD actions
156
329
  - dashboard interactions
330
+ - streaming assistants
331
+ - progress logs
157
332
  - similar reactive page behavior
158
333
 
159
334
  Do **not** default to:
160
335
 
161
336
  - a PHP-only interaction style
337
+ - plain browser-DOM wiring when PulsePoint state, bindings, and native `on*` handlers already fit the task
162
338
  - ad hoc `fetch('/api/...')` patterns
163
339
  - extra `route.php` files for page-local interactions that already fit `pp.fetchFunction(...)`
340
+ - a separate Node realtime or tool server when the documented Prisma PHP runtime already fits the task
164
341
 
165
- Choose a more PHP-only pattern only when:
342
+ Choose a more PHP-only or handler-only pattern only when:
166
343
 
167
- - the user explicitly asks for PHP-only behavior
344
+ - the user explicitly asks for it
168
345
  - the task is clearly non-reactive
169
346
  - the task is a standalone API, webhook, integration endpoint, or public JSON handler
170
347
 
171
- ## Default workflow for AI agents
348
+ ## Route structure rule AI must not get wrong
349
+
350
+ There are two related structure rules, and AI must not mix their responsibilities.
351
+
352
+ ### Normal route files such as `index.php` and nested `layout.php`
353
+
354
+ Use this pattern:
355
+
356
+ 1. PHP first
357
+ 2. one parent HTML element for the route content
358
+ 3. when PulsePoint is present, let Prisma PHP inject the route or layout `pp-component` scope on that root automatically
359
+ 4. keep one `<script>` block as the last child inside that same root element
360
+
361
+ Also follow these route-file rules:
362
+
363
+ - `index.php` and nested `layout.php` must render a single parent HTML element
364
+ - for normal pages and nested layouts, do **not** manually author `pp-component` on that root; Prisma PHP adds it automatically
365
+ - author a plain `<script>` tag inside that root when PulsePoint logic is needed and do **not** add `type="text/pp"` manually
366
+ - write PulsePoint state, derived values, and functions directly at the top level of that script; do **not** wrap them in `DOMContentLoaded`, an IIFE, manual `pp.mount()` calls, or custom scoping helpers
367
+ - only the root `layout.php` should define `<html>`, `<head>`, and `<body>`
368
+ - when PulsePoint is present in a root `layout.php`, keep `MainLayout::$children` and any `<script>` inside one clear wrapper
369
+
370
+ Example:
371
+
372
+ ```php
373
+ <?php
172
374
 
173
- Use this workflow unless the user asks for something narrower:
375
+ use PP\MainLayout;
376
+
377
+ MainLayout::$title = 'Todos';
378
+ MainLayout::$description = 'Track tasks and view the current item count.';
379
+ ?>
380
+
381
+ <section>
382
+ <h1>Todos</h1>
383
+ <p>Count: {count}</p>
384
+ <script>
385
+ const [count, setCount] = pp.state(0);
386
+ </script>
387
+ </section>
388
+ ```
389
+
390
+ ### Imported partials rendered with `ImportComponent::render(...)`
391
+
392
+ Use this pattern:
393
+
394
+ 1. PHP first
395
+ 2. exactly one parent root element
396
+ 3. keep any component-local `<script>` inside that root element
397
+
398
+ Example:
399
+
400
+ ```php
401
+ <?php
402
+
403
+ // PHP code
404
+
405
+ ?>
406
+
407
+ <div>
408
+ <h2>Search</h2>
409
+ <input value="{query}" />
410
+ <script>
411
+ console.log('Search component ready');
412
+ </script>
413
+ </div>
414
+ ```
174
415
 
175
- 1. Read `./prisma-php.json`
176
- 2. Read the relevant installed doc from `node_modules/prisma-php/dist/docs`
177
- 3. Inspect nearby project files that match the route, feature, or component being changed
178
- 4. If the task is component-related, read `components.md` before generating PHPX component code
179
- 5. If the task is upload- or file-manager-related, read `file-manager.md` before generating upload, rename, delete, or file-listing code
180
- 6. Generate code using Prisma PHP conventions
181
- 7. Inspect `vendor/tsnc/prisma-php/src` only if framework internals are required
416
+ Do not:
182
417
 
183
- Do not jump directly into framework internals if the installed docs already answer the task.
418
+ - put a sibling `<script>` next to a route root or imported partial root
419
+ - manually add `pp-component` inside imported partial source
420
+ - manually add `type="text/pp"` to route or imported-partial scripts
421
+ - wrap imported-partial PulsePoint code in `DOMContentLoaded`, an IIFE, manual `pp.mount()` calls, or custom auto-execute helpers
422
+
423
+ ## Metadata rules
424
+
425
+ For document metadata, prefer `MainLayout::$title` and `MainLayout::$description`.
426
+
427
+ Important metadata rules:
428
+
429
+ - a local `$title` variable only affects rendered page content unless you also assign metadata through `MainLayout`
430
+ - use `MainLayout::addCustomMetadata(...)` for additional `<meta>` values when needed
431
+ - keep visible headings separate from document metadata when the UI text and SEO title must differ
432
+ - read `metadata-and-og-images.md` or `layouts-and-pages.md` before inventing Next.js-style metadata exports or Open Graph image workflows
433
+
434
+ ## Streaming and SSE rules
435
+
436
+ Prisma PHP supports streaming through `pp.fetchFunction(...)` when an exposed function yields values.
437
+
438
+ Default streaming rules:
439
+
440
+ - prefer an exposed generator that simply yields strings or arrays
441
+ - let Prisma PHP handle the SSE response automatically for normal `pp.fetchFunction(...)` streaming
442
+ - on the client, put stream UI updates in `onStream`, `onStreamError`, and `onStreamComplete`
443
+ - do not wait for a final JSON payload when the response is streamed
444
+
445
+ Current parsing rules AI should know:
446
+
447
+ - Prisma PHP sends streamed payloads as SSE `data:` lines
448
+ - the built-in `pp.fetchFunction(...)` stream parser currently forwards only `data:` lines to `onStream`
449
+ - `event:`, `id:`, and `retry:` may be emitted by low-level SSE helpers, but the built-in stream callback currently ignores them
450
+ - prefer JSON values or single-line strings for streamed chunks instead of multi-line text blobs
451
+
452
+ Low-level helpers exist when manual SSE control is required:
453
+
454
+ - `PP\Streaming\SSE`
455
+ - `PP\Streaming\ServerSentEvent`
456
+
457
+ Core locations documented for those helpers are:
458
+
459
+ ```txt
460
+ vendor/tsnc/prisma-php/src/Streaming/SSE.php
461
+ vendor/tsnc/prisma-php/src/Streaming/ServerSentEvent.php
462
+ ```
184
463
 
185
464
  ## Route file decision rules
186
465
 
187
466
  When the task is about creating or editing a route, do not guess.
188
467
 
189
- Important: creating a route means creating or updating the correct folder and route file under `src/app`. It does **not** mean editing generated route metadata. In particular, never update `files-list.json` by hand.
468
+ Important: creating a route means creating or updating the correct folder and route file under `src/app`. It does **not** mean editing generated route metadata.
469
+
470
+ - use `index.php` for rendered UI and normal page routes
471
+ - use `layout.php` for shared UI that wraps route subtrees
472
+ - use `route.php` for direct handlers such as JSON endpoints, API-style routes, AJAX handlers, form-processing endpoints, and webhooks
473
+ - use `not-found.php` for route-specific not-found UI
474
+ - use `error.php` for route or app-level error UI
475
+ - use `loading.php` when the task is specifically about a loading UI state for a route subtree
190
476
 
191
- - Use `index.php` for rendered UI and normal page routes, and default to PulsePoint plus `pp.fetchFunction(...)` for interactive behavior inside those routes unless the user explicitly asks for PHP-only behavior
192
- - Use `layout.php` for shared UI that wraps route subtrees
193
- - Use `route.php` for direct handlers such as JSON endpoints, API-style routes, AJAX handlers, form-processing endpoints, webhooks, or other no-view server logic; do not default to `route.php` for normal route-local interactions that fit PulsePoint plus `pp.fetchFunction(...)`
194
- - Use `not-found.php` for route-specific not-found UI
195
- - Use `error.php` for route or app-level error UI
477
+ For normal route-local interactivity, prefer `index.php` plus PulsePoint and `pp.fetchFunction(...)` over inventing extra handlers.
196
478
 
197
- Also verify `backendOnly` in `prisma-php.json`:
479
+ In a consumer app, also verify `backendOnly` in `prisma-php.json`:
198
480
 
199
481
  - if `backendOnly` is `false`, normal routes should usually be implemented with `index.php`
200
482
  - if `backendOnly` is `true`, route behavior will usually center on `route.php`
201
483
 
484
+ ## Default workflow for AI agents
485
+
486
+ Use this workflow unless the user asks for something narrower.
487
+
488
+ 1. read `./prisma-php.json`
489
+ 2. inspect `.github/instructions/` and read any relevant `*.instructions.md` files when that directory exists
490
+ 3. read the relevant installed doc from `./node_modules/prisma-php/dist/docs`
491
+ 4. inspect `./AGENTS.md` for project-level Prisma PHP guidance
492
+ 5. inspect nearby project files that match the route, feature, or component being changed
493
+ 6. inspect `vendor/tsnc/prisma-php/src` only if the docs and matching workspace instructions do not answer the task
494
+
495
+ Do not jump directly into framework internals if the current docs and matching workspace instruction files already answer the task.
496
+
202
497
  ## Authentication rules
203
498
 
204
- When the task involves auth, do not guess from Laravel, NextAuth, generic JWT packages, or ad hoc middleware habits.
499
+ When the task involves auth, do not guess from Laravel, generic JWT packages, or ad hoc middleware habits.
205
500
 
206
501
  Use this auth decision flow:
207
502
 
@@ -210,15 +505,23 @@ Use this auth decision flow:
210
505
  3. inspect `src/Lib/Auth/AuthConfig.php` when present
211
506
  4. inspect the current auth-related routes under `src/app`
212
507
  5. inspect Prisma models that support auth before generating registration, login, or provider code
213
- 6. keep route protection, function protection, and session lifecycle aligned with Prisma PHPs documented auth model
508
+ 6. keep route protection, function protection, and session lifecycle aligned with Prisma PHP's documented auth model
214
509
 
215
510
  Important auth rules:
216
511
 
217
512
  - route privacy strategy is configured from `AuthConfig.php`
218
513
  - Prisma PHP supports both public-default and private-default route protection strategies
219
- - sign users in with `Auth::signIn(...)`
220
- - sign users out with `Auth::signOut(...)`
221
- - use `refreshUserSession(...)` when current-session auth payloads must be updated after role or profile changes
514
+ - Prisma PHP defaults to public routes, so keep the public-default strategy when the app will expose many public pages
515
+ - choose the route privacy strategy early, ideally before creating most routes in a new app or route subtree
516
+ - if the app will have only a few public entry points and most routes should require login, switch to the private-default strategy
517
+ - when choosing private-default routing, enable both `AuthConfig::IS_ALL_ROUTES_PRIVATE` and `AuthConfig::IS_TOKEN_AUTO_REFRESH`
518
+ - when `IS_ALL_ROUTES_PRIVATE` is `true`, keep public exceptions in `AuthConfig::$publicRoutes`; home remains public by default because it starts as `['/']`
519
+ - keep `AuthConfig::$authRoutes` public by default unless the user explicitly wants a different auth route allowlist
520
+ - there is no need to modify other Prisma PHP core files to enable private-default routing
521
+ - if `src/Lib/Auth/AuthConfig.php` was customized, protect it from future project updates by adding `./src/Lib/Auth/AuthConfig.php` to `excludeFiles` in `prisma-php.json`
522
+ - sign users in with `Auth::getInstance()->signIn(...)`
523
+ - sign users out with `Auth::getInstance()->signOut(...)`
524
+ - use `Auth::getInstance()->refreshUserSession(...)` when current-session auth payloads must be updated after role or profile changes
222
525
  - use role-based route protection in auth config for page access control
223
526
  - use `#[Exposed(allowedRoles: [...])]` for function-level access control when frontend code calls PHP directly
224
527
  - for credentials auth, model the schema first, then generate ORM classes before writing auth flows
@@ -233,7 +536,7 @@ Use this file-manager decision flow:
233
536
  1. read `file-manager.md`
234
537
  2. verify the official File Manager docs for the installed version
235
538
  3. decide whether the task belongs in a rendered page with `index.php` or a direct handler with `route.php`
236
- 4. confirm the upload destination directory is outside `src/app`
539
+ 4. use `./public/uploads` as the default local public upload directory and treat it as publicly accessible
237
540
  5. use `PP\FileManager\UploadFile` when the task matches the documented upload workflow
238
541
  6. use `PP\Validator` for non-file request values such as rename targets, labels, or filters
239
542
  7. return structured messages for expected upload failures such as invalid size, invalid type, partial upload, or missing file
@@ -243,9 +546,108 @@ Important file-manager rules:
243
546
  - do **not** omit `enctype="multipart/form-data"` on upload forms
244
547
  - do **not** forget the `[]` suffix when generating multiple-file inputs
245
548
  - do **not** place uploaded files inside `src/app`
549
+ - use `PUBLIC_PATH . '/uploads/'` or the equivalent absolute `./public/uploads` path for local public uploads
550
+ - treat files saved in `./public/uploads` as publicly accessible from the app's public web root
551
+ - keep `./settings/bs-config.ts` aligned with `const PUBLIC_IGNORE_DIRS = ["uploads"];` so local upload mutations do not trigger BrowserSync reloads
552
+ - do **not** document or generate legacy local upload destinations such as `DOCUMENT_PATH . '/uploads/'`, a project-root `/uploads`, or `src/uploads`
246
553
  - do **not** assume HTML size hints replace `php.ini` upload limits
247
554
  - do **not** invent undocumented storage abstractions when `UploadFile` already fits the task
248
- - for upload, rename, replace, delete, and file-listing tasks, read `file-manager.md` first
555
+
556
+ ## Email rules
557
+
558
+ When the task involves email, read `email.md` first.
559
+
560
+ Prisma PHP email follows the documented `PP\PHPMailer\Mailer` model backed by PHPMailer. Do not replace it with raw `mail()`, undocumented wrappers, or habits copied from another mail framework.
561
+
562
+ Use this email workflow:
563
+
564
+ 1. read `email.md`
565
+ 2. inspect `.env` for SMTP and sender values in the target app
566
+ 3. inspect the route, exposed function, or handler that sends the email
567
+ 4. inspect the HTML body or attachment source when present
568
+ 5. inspect framework internals only when the docs and current app code still leave a gap
569
+
570
+ The documented core mailer file is:
571
+
572
+ ```txt
573
+ vendor/tsnc/prisma-php/src/PHPMailer/Mailer.php
574
+ ```
575
+
576
+ Important email rules:
577
+
578
+ - keep SMTP credentials and sender defaults in `.env`, not in route files
579
+ - the documented env vars are `SMTP_HOST`, `SMTP_USERNAME`, `SMTP_PASSWORD`, `SMTP_ENCRYPTION`, `SMTP_PORT`, `MAIL_FROM`, and `MAIL_FROM_NAME`
580
+ - validate user-provided email fields before calling the mailer
581
+ - prefer the documented fluent API such as `to(...)`, `subject(...)`, `html(...)`, `text(...)`, `attach(...)`, and `send()`
582
+ - use `raw()` only when low-level PHPMailer access is genuinely needed
583
+
584
+ ## Env rules
585
+
586
+ When the task involves `.env`, `PP\Env`, feature flags, ports, host names, timezones, API keys, numeric limits, or other runtime configuration values, read `env.md` first.
587
+
588
+ Use this env workflow:
589
+
590
+ 1. read `env.md`
591
+ 2. inspect `.env` or the deployment environment when the task depends on actual values
592
+ 3. inspect the bootstrap or server entry file that loads or consumes the environment
593
+ 4. inspect the feature-specific doc such as `email.md`, `mcp.md`, `websocket.md`, `get-started-ia.md`, or `prisma-php-orm.md` when the env values belong to that feature
594
+ 5. inspect `vendor/tsnc/prisma-php/src/Env.php` only if the docs do not answer the task
595
+
596
+ Important env rules:
597
+
598
+ - prefer `PP\Env` over repeated ad hoc `getenv()` parsing in documented Prisma PHP code paths
599
+ - use `Env::string(...)`, `Env::bool(...)`, and `Env::int(...)` for typed access with defaults
600
+ - use `Env::get(...)` when raw nullable string access is actually needed
601
+ - remember that `PP\Env` reads values from `getenv()`, `$_ENV`, and `$_SERVER`; it does not parse `.env` by itself
602
+ - keep secrets and deployment-specific settings in `.env` or the real runtime environment, not hardcoded in route files or components
603
+
604
+ ## WebSocket rules
605
+
606
+ When the task involves realtime messaging, presence, live dashboards, `Ratchet`, or browser `WebSocket`, read `websocket.md` first.
607
+
608
+ Prisma PHP websocket support follows a Ratchet-based PHP server plus a `ConnectionManager` under `src/Lib/Websocket`. Do not replace that default with Socket.IO, a separate Node server, or an unrelated hosted realtime service unless the user explicitly asks for a different architecture.
609
+
610
+ Use this websocket workflow:
611
+
612
+ 1. read `websocket.md`
613
+ 2. inspect whether websocket support is enabled in `prisma-php.json` in the target app
614
+ 3. inspect `src/Lib/Websocket`
615
+ 4. inspect the route or client script that opens the browser `WebSocket`
616
+ 5. inspect `settings/restart-websocket.ts` when local restart behavior matters
617
+ 6. inspect framework internals only when the docs do not answer the task
618
+
619
+ Important websocket rules:
620
+
621
+ - use `src/Lib/Websocket/websocket-server.php` as the source of truth for startup behavior
622
+ - use `src/Lib/Websocket/ConnectionManager.php` as the lifecycle boundary for clients and broadcasts
623
+ - preserve documented env vars and defaults: `WS_NAME`, `WS_VERSION`, `WS_HOST`, `WS_PORT`, `WS_VERBOSE`, `APP_TIMEZONE`
624
+ - preserve CLI overrides through `--host=...`, `--port=...`, and `--verbose=...`
625
+ - preserve the documented casing `src/Lib/Websocket`
626
+ - for existing apps, enable `websocket` in `prisma-php.json` and run `npx pp update project -y` before inventing manual scaffolding
627
+
628
+ ## MCP rules
629
+
630
+ When the task involves Model Context Protocol support, read `mcp.md` first.
631
+
632
+ Prisma PHP MCP support follows the documented `PhpMcp\Server` model with attribute-based tool discovery. Do not replace it with custom REST endpoints pretending to be MCP, hand-rolled JSON-RPC parsing, or unrelated agent abstractions when the documented Prisma PHP stack already fits the task.
633
+
634
+ Use this MCP workflow:
635
+
636
+ 1. read `mcp.md`
637
+ 2. inspect whether MCP support is enabled in `prisma-php.json` in the target app
638
+ 3. inspect `src/Lib/MCP`
639
+ 4. inspect tool classes and the services they call
640
+ 5. inspect auth, ORM, and env configuration when tools read protected or database-backed data
641
+ 6. inspect framework internals only when the docs do not answer the task
642
+
643
+ Important MCP rules:
644
+
645
+ - use `src/Lib/MCP/mcp-server.php` as the source of truth for startup behavior
646
+ - preserve attribute-based discovery with `#[McpTool]` and `#[Schema]`
647
+ - preserve the documented discovery model built around scanning the source tree instead of manually wiring every tool class by default
648
+ - preserve the documented casing `src/Lib/MCP`
649
+ - preserve documented env vars and defaults: `MCP_NAME`, `MCP_VERSION`, `MCP_HOST`, `MCP_PORT`, `MCP_PATH_PREFIX`, `MCP_JSON_RESPONSE`, `APP_TIMEZONE`
650
+ - for existing apps, enable `mcp` in `prisma-php.json` and run `npx pp update project -y` before inventing manual scaffolding
249
651
 
250
652
  ## Prisma ORM workflow rules
251
653
 
@@ -262,51 +664,53 @@ Use this ORM decision flow:
262
664
  7. after schema synchronization, run `npx ppo generate`
263
665
  8. only then write or update PHP code that depends on the generated Prisma classes
264
666
 
265
- Important rules:
667
+ Important ORM rules:
266
668
 
267
669
  - do **not** use `npx pp update project -y` as the normal fix for Prisma ORM schema changes
268
670
  - use `npx prisma migrate dev` for the normal development migration workflow
269
671
  - use `npx prisma migrate deploy` for production or CI/CD migration application
270
672
  - use `npx prisma db push` only for explicit prototyping or no-migration database sync
271
673
  - do **not** treat `npx ppo generate` as a migration step
272
- - `npx ppo generate` should run the first time generated PHP ORM classes are needed and whenever `schema.prisma` changes
273
- - if the task mentions Prisma ORM, `schema.prisma`, migrations, generated classes, SQLite, MySQL, or PostgreSQL, read `prisma-php-orm.md` first
274
674
 
275
675
  ## Validation rules
276
676
 
277
- When a task involves user input, form handling, search params, JSON payloads, `pp.fetchFunction(...)`, or `route.php` bodies, do not trust raw values.
677
+ When a task involves user input, form handling, search params, JSON payloads, `pp.fetchFunction(...)`, `route.php` bodies, or tool parameters, do not trust raw values.
278
678
 
279
679
  Default Prisma PHP validation rules:
280
680
 
281
- - use **`PP\Validator`** as the backend validation and normalization layer
282
- - prefer the **`Rule` builder** for rule-based validation
681
+ - use `PP\Validator` as the backend validation and normalization layer
682
+ - prefer the `Rule` builder for rule-based validation
283
683
  - validate in PHP even when the frontend already performs local checks
284
684
  - return structured validation results for expected failures
285
685
  - do not treat routine invalid input as an uncaught exception
286
686
  - in reactive flows, use PulsePoint for local state and `Validator` for authoritative server validation
287
687
 
688
+ When internals matter, the documented Prisma PHP core validator location is:
689
+
690
+ ```txt
691
+ vendor/tsnc/prisma-php/src/Validator.php
692
+ ```
693
+
288
694
  ## PulsePoint rules
289
695
 
290
696
  When a task involves reactive frontend behavior, read `pulsepoint.md` first.
291
697
 
292
698
  Also follow these rules:
293
699
 
700
+ - treat PulsePoint as the primary JavaScript authoring model for normal full-stack frontend work
701
+ - keep page and imported-partial client logic inside the boundary's plain `<script>` tag instead of building extra DOM-ready or self-executing wrappers
702
+ - prefer `pp.fetchFunction(...)` over ad hoc `fetch('/api/...')` calls for page-local PHP interactions
703
+ - reserve plain browser JavaScript outside PulsePoint for external libraries, low-level browser APIs, and reusable helpers in `ts/`
294
704
  - do not invent undocumented PulsePoint helpers or directives
295
705
  - do not write React, Vue, Alpine, or Livewire syntax and call it PulsePoint
296
706
  - keep backend concerns separate from PulsePoint runtime concerns
297
707
  - prefer simple documented runtime primitives over abstractions copied from other ecosystems
298
-
299
- ## Reactive frontend + server-call rule
300
-
301
- For frontend interactivity in Prisma PHP, prefer the documented Prisma PHP pattern:
302
-
303
- - use **PulsePoint** for reactive browser state and UI behavior
304
- - use **`pp.fetchFunction(...)`** for page-local or component-local server calls
305
- - expose callable PHP functions with **`#[Exposed]`**
306
-
307
- Do not default to handcrafted `fetch('/api/...')` calls, ad hoc AJAX endpoints, or extra `route.php` files when the task is a normal reactive UI interaction that fits `pp.fetchFunction(...)`.
308
-
309
- Use `route.php` when the user explicitly needs an API-style endpoint, webhook, JSON route, or handler that should exist independently of the current page.
708
+ - use `pp-style` for template-driven inline CSS and plain `style` for fully static inline CSS
709
+ - use `pp-spread="{...attrs}"` for dynamic attribute objects and omit nullish values from those objects
710
+ - use `pp-for` only on `<template>` with `item in items` or `(item, index) in items`
711
+ - use plain `key` for keyed diffing; do not invent `pp-key`
712
+ - use `pp.ref(...)`, `pp-ref`, `pp.portal(...)`, `pp.createContext(...)`, `Context.Provider`, and `pp.context(...)` according to `pulsepoint.md`
713
+ - use `value`, `defaultvalue`, and `defaultchecked` form bindings according to `pulsepoint.md`; do not author internal `data-pp-*` form attributes
310
714
 
311
715
  ## Component rules
312
716
 
@@ -315,94 +719,47 @@ When the task involves Prisma PHPX components, reusable UI elements, props, chil
315
719
  Also follow these rules:
316
720
 
317
721
  - do not assume React, Vue, Blade, or generic templating component behavior maps directly to Prisma PHPX
722
+ - use HTML-first `x-` tags such as `<x-button>` and `<x-search />` when generating template markup for class-based components
723
+ - use kebab-case component attributes and rely on the runtime to hydrate camelCase PHPX properties and PulsePoint props
318
724
  - keep component file names and class names aligned
319
725
  - preserve documented PHPX patterns for `$props`, `$children`, `$class`, and `getAttributes(...)`
320
726
  - follow documented component placement and grouping conventions before inspecting framework internals
321
- - use `vendor/tsnc/prisma-php/src` only when the installed docs and `components.md` do not answer the task
322
-
323
- ## Prisma PHP XML syntax rules
324
-
325
- Prisma PHP uses XML-style syntax for PHPX and template markup.
326
-
327
- AI agents must follow strict XML rules when generating tags and attributes.
328
-
329
- ### Closing tags
330
-
331
- All tags must be properly closed.
332
-
333
- Correct:
334
-
335
- ```xml
336
- <hr />
337
- <input type="text" />
338
- <div></div>
339
- ```
340
-
341
- Incorrect:
342
-
343
- ```xml
344
- <hr>
345
- <input type="text">
346
- ```
347
-
348
- ### Attributes
349
-
350
- All attributes must use double quotes.
351
-
352
- Correct:
353
-
354
- ```xml
355
- <input id="email" />
356
- <input required="true" />
357
- ```
358
-
359
- Incorrect:
360
-
361
- ```xml
362
- <input id=email />
363
- <input required />
364
- ```
365
-
366
- ### Boolean attributes
367
-
368
- Boolean attributes must be explicit.
369
-
370
- Correct:
371
-
372
- ```xml
373
- <input disabled="true" />
374
- <option selected="true">Admin</option>
375
- ```
376
-
377
- Incorrect:
378
-
379
- ```xml
380
- <input disabled />
381
- <option selected>Admin</option>
382
- ```
383
-
384
- Do not output permissive HTML shorthand in Prisma PHP UI files.
385
727
 
386
728
  ## When to inspect framework internals
387
729
 
388
- Prisma PHP core Composer package files live in:
730
+ Inspect framework internals only when the docs and current files do not answer the task.
731
+
732
+ Useful app-mode core locations include:
389
733
 
390
734
  ```txt
391
735
  vendor/tsnc/prisma-php/src
736
+ vendor/tsnc/prisma-php/src/PHPX/TemplateCompiler.php
737
+ vendor/tsnc/prisma-php/src/ImportComponent.php
738
+ vendor/tsnc/prisma-php/src/MainLayout.php
739
+ vendor/tsnc/prisma-php/src/PrismaPHPSettings.php
740
+ vendor/tsnc/prisma-php/src/Request.php
741
+ vendor/tsnc/prisma-php/src/Attributes/Exposed.php
742
+ vendor/tsnc/prisma-php/src/Attributes/ExposedRegistry.php
743
+ vendor/tsnc/prisma-php/src/Env.php
744
+ vendor/tsnc/prisma-php/src/Rule.php
745
+ vendor/tsnc/prisma-php/src/PHPMailer/Mailer.php
746
+ vendor/tsnc/prisma-php/src/FileManager/UploadFile.php
747
+ vendor/tsnc/prisma-php/src/Validator.php
748
+ vendor/tsnc/prisma-php/src/Streaming/SSE.php
749
+ vendor/tsnc/prisma-php/src/Streaming/ServerSentEvent.php
392
750
  ```
393
751
 
394
- Inspect this directory only when the task depends on framework internals not already answered by the installed docs.
395
-
396
- Use it when the task involves:
752
+ Use framework internals when the task involves:
397
753
 
398
754
  - confirming namespaces, classes, or helper names
399
755
  - understanding how a core class behaves internally
400
- - verifying available attributes such as `#[Exposed]`
756
+ - verifying available attributes such as `#[Exposed]`, `#[McpTool]`, or `#[Schema]`
401
757
  - checking PHPX compiler or template compiler behavior
402
758
  - tracing PulsePoint integration points inside Prisma PHP
403
- - debugging framework-level issues that are not explained by the docs
759
+ - confirming mailer, SSE, websocket, or MCP runtime behavior not already clear from the docs
760
+ - debugging framework-level issues that are not explained by the current docs
404
761
 
405
- For ordinary app work, prefer the installed docs and local project files first.
762
+ For ordinary app or docs work, prefer the current docs and local project files first.
406
763
 
407
764
  ## Upgrade and feature-enable workflow
408
765
 
@@ -410,20 +767,17 @@ If the task involves enabling a feature, syncing framework-managed files, or upd
410
767
 
411
768
  Important rules:
412
769
 
413
- - update `prisma-php.json` before assuming a feature is active
770
+ - update `prisma-php.json` before assuming a feature is active in a consumer app
414
771
  - do not assume Tailwind, Prisma, Swagger, WebSocket, MCP, or TypeScript support is enabled unless `prisma-php.json` says so
772
+ - keep customized framework-managed files such as `src/Lib/Auth/AuthConfig.php` in `excludeFiles` when you need project updates to preserve them
415
773
  - after changing feature flags, follow the documented project update flow
416
- - for AI-driven or scripted updates, prefer:
417
-
418
- ```bash
419
- npx pp update project -y
420
- ```
774
+ - for AI-driven or scripted updates, prefer `npx pp update project -y`
421
775
 
422
- This command is for project updates and framework-managed file refreshes. It is not the default ORM migration command.
776
+ That command is for project updates and framework-managed file refreshes. It is not the default ORM migration command.
423
777
 
424
778
  ## Final operating rule
425
779
 
426
- When Prisma PHP behavior is documented locally, read the relevant installed doc first and follow it.
780
+ When Prisma PHP behavior is documented locally, read the relevant current doc first and follow it.
427
781
 
428
782
  Do not guess.
429
783