create-prisma-php-app 5.1.0-alpha.3 → 5.1.0-alpha.5

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.
@@ -7,13 +7,14 @@
7
7
  - Treat `node_modules/prisma-php/dist/docs` as framework reference docs that teach AI how Prisma PHP works. The presence of a page in that docs folder does not mean the current workspace has that feature enabled.
8
8
  - Read the matching doc in `node_modules/prisma-php/dist/docs` before generating or editing framework-specific Prisma PHP code.
9
9
  - Expect `AGENTS.md` in the project root and keep it aligned with the installed Prisma PHP docs contract.
10
- - In the Prisma PHP package source repo, keep `AGENTS.md`, `.github/copilot-instructions.md`, any `.github/instructions/**/*.instructions.md`, and `dist/docs` aligned so the published docs remain correct after install.
10
+ - In the Prisma PHP package source repo, keep the source-repo `AGENTS.md`, `.github/copilot-instructions.md`, any `.github/instructions/**/*.instructions.md`, and source-repo `dist/docs` aligned so the published docs remain correct after install. In consumer apps, the installed docs path is `node_modules/prisma-php/dist/docs`.
11
11
  - Do not assume installed consumer apps also ship a root `.github/copilot-instructions.md` unless the generator explicitly creates one.
12
12
  - If `.github/instructions/**/*.instructions.md` exists, treat those files as workspace-local task instructions for third-party libraries, component systems, icon packs, and other implementation-specific rules.
13
13
  - Before generating or editing code, inspect `.github/instructions/` and read any `*.instructions.md` files that match the current task, named library, target files, or implementation surface.
14
- - 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.
14
+ - In the Prisma PHP package source repo, keep every `dist/docs/*.md` page AI-discoverable on its own. In consumer apps, those installed docs live at `node_modules/prisma-php/dist/docs/*.md`. The frontmatter description and opening section should clearly say when agents should read that file and which adjacent docs to consult next.
15
15
  - When a task maps to an optional feature such as `backendOnly`, `swaggerDocs`, `typescript`, `websocket`, or `mcp`, inspect `./prisma-php.json` first, then read the matching docs page to learn the implementation contract.
16
16
  - When docs and project files still leave a runtime gap, inspect the narrow core file that owns the behavior: `TemplateCompiler.php` for HTML fragment compilation and route root scoping, `ImportComponent.php` for imported partials, `MainLayout.php` for metadata and head/footer scripts, `PrismaPHPSettings.php` plus generated settings JSON for component and route maps, `Request.php` for request handling, `Validator.php`/`Rule.php` for validation, and feature-specific files such as `UploadFile.php`, `Mailer.php`, or `Streaming/SSE.php`.
17
+ - When validation or rule-builder syntax is involved, read `node_modules/prisma-php/dist/docs/validator.md` first. If method shape is still unclear after that, inspect `vendor/tsnc/prisma-php/src/Rule.php` to confirm which `Rule` methods are static entry points and which methods must be chained on a builder instance.
17
18
 
18
19
  ## Workspace Task Instructions
19
20
 
@@ -28,9 +29,11 @@
28
29
  - Keep `src/app` focused on route files, layouts, handlers, and route-scoped partials.
29
30
  - Prefer `src/Components` for reusable application UI components shared across pages or layouts.
30
31
  - Keep reusable non-UI code such as services, auth, middleware, Prisma classes, and helpers in `src/Lib`.
32
+ - Treat route-private folders such as `src/app/<route>/_components` as an implementation detail for files that stay owned by that route only.
31
33
  - Treat `./public/uploads` as the default local public upload directory for file uploads.
32
34
  - Treat generated component libraries such as `src/Lib/PHPXUI` and `src/Lib/PPIcons` as library-specific surfaces governed by their manifests and `.github/instructions/*.instructions.md` files.
33
35
  - If a partial starts as route-local but becomes shared across the app, move it from `src/app` to `src/Components`.
36
+ - Do not default to creating `src/app/<route>/_components` for app-owned section components such as `HeroSection`, `FormSection`, or `SidebarSection`; prefer `src/Components` unless the user explicitly wants route-local colocation and the files are truly private to that route.
34
37
  - Suggest this structure by default when helping users organize growing Prisma PHP apps.
35
38
 
36
39
  ## Component Tag Contract
@@ -50,7 +53,7 @@
50
53
  - 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.
51
54
  - 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.
52
55
  - Use `npm run create-swagger-docs` only when Swagger or OpenAPI output must be intentionally generated or refreshed.
53
- - 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.
56
+ - When package-script behavior matters, read `node_modules/prisma-php/dist/docs/commands.md` first and inspect the actual `package.json` in the target project before assuming which scripts exist.
54
57
 
55
58
  ## BrowserSync URL Source Of Truth
56
59
 
@@ -94,7 +97,8 @@
94
97
  - 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.
95
98
  - 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.
96
99
  - 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.
97
- - Use `pp-style` for template-driven inline CSS, `pp-spread="{...attrs}"` for dynamic attribute objects, `pp-for` only on `<template>`, and plain `key` for keyed diffing.
100
+ - Use `pp-style` whenever inline CSS contains `{...}` interpolation or any other template-driven/reactive value, reserve plain `style` for fully static inline CSS, use `pp-spread="{...attrs}"` for dynamic attribute objects, keep `pp-for` only on `<template>`, and use plain `key` for keyed diffing.
101
+ - Do not generate reactive inline CSS inside a plain `style` attribute such as `style="width: {progress}%";` use `pp-style="width: {progress}%";` instead so editor CSS validation does not flag the source markup as invalid.
98
102
  - Use `pp.ref(...)`, `pp-ref`, `pp.portal(...)`, `pp.createContext(...)`, `Context.Provider`, and `pp.context(...)` according to `pulsepoint.md`.
99
103
  - Use `value`, `defaultvalue`, and `defaultchecked` form bindings according to `pulsepoint.md`; do not author internal `data-pp-*` runtime attributes.
100
104
 
@@ -115,30 +119,42 @@
115
119
  - Do not manually add `pp-component` inside `ImportComponent` partial source; Prisma PHP injects it there.
116
120
  - 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.
117
121
 
122
+ ## Validation Rules
123
+
124
+ - Use `PP\Validator` as the backend validation and normalization layer.
125
+ - Prefer the `Rule` builder for rule-based validation.
126
+ - Start `Rule` builders with `Rule::required()`, `Rule::optional()`, or `Rule::make()`.
127
+ - Chain rule methods such as `->min(...)`, `->max(...)`, `->email()`, and `->regex(...)` on that builder instance.
128
+ - Do not generate static calls such as `Rule::max(80)` or `Rule::email()`.
129
+ - For optional constrained fields, use `Rule::optional()->max(80)` or `Rule::make()->max(80)`.
130
+ - Validate in PHP even when the frontend already performs local checks.
131
+ - Return structured validation results for expected failures instead of treating routine invalid input as an uncaught exception.
132
+ - When internals matter, inspect `vendor/tsnc/prisma-php/src/Validator.php` and `vendor/tsnc/prisma-php/src/Rule.php`.
133
+
118
134
  ## Relevant Docs
119
135
 
120
- - Project structure and feature placement: `dist/docs/project-structure.md`
121
- - CLI project creation and update commands: `dist/docs/commands.md`
122
- - First-time project installation and local setup: `dist/docs/installation.md`
123
- - Existing-project upgrades and feature refreshes: `dist/docs/upgrading.md`
124
- - TypeScript frontend tooling, the `typescript` flag, and `ts/main.ts` registration: `dist/docs/typescript.md`
125
- - Backend-only API usage and `backendOnly`: `dist/docs/backend-only.md`
126
- - Route and layout structure: `dist/docs/layouts-and-pages.md`
127
- - AI integration, provider-backed chat, streaming, and MCP boundary: `dist/docs/get-started-ia.md`
128
- - Data loading, `#[Exposed]`, and SSE streaming: `dist/docs/fetching-data.md`
129
- - Bootstrap flow, runtime init order, request initialization, and function-call protection: `dist/docs/bootstrap-runtime.md`
130
- - PulsePoint runtime rules: `dist/docs/pulsepoint.md`
131
- - Component and `ImportComponent` rules: `dist/docs/components.md`
132
- - Cache behavior and `CacheHandler`: `dist/docs/caching.md`
133
- - Validation rules: `dist/docs/validator.md`
134
- - Prisma ORM schema, migrations, and generated PHP classes: `dist/docs/prisma-php-orm.md`
135
- - Environment variables and `PP\Env` usage: `dist/docs/env.md`
136
- - File uploads and file manager behavior: `dist/docs/file-manager.md`
137
- - Email and SMTP workflows: `dist/docs/email.md`
138
- - WebSocket and realtime behavior: `dist/docs/websocket.md`
139
- - MCP server and tool rules: `dist/docs/mcp.md`
140
- - Authentication: `dist/docs/authentication.md`
141
- - Error handling, expected failures, and route error files: `dist/docs/error-handling.md`
142
- - Metadata and icons: `dist/docs/metadata-and-og-images.md`
143
- - API-style handlers and webhooks: `dist/docs/route-handlers.md`
144
- - Swagger/OpenAPI generation and `swaggerDocs`: `dist/docs/swagger-docs.md`
136
+ - Project structure and feature placement: `node_modules/prisma-php/dist/docs/project-structure.md`
137
+ - CLI project creation and update commands: `node_modules/prisma-php/dist/docs/commands.md`
138
+ - First-time project installation and local setup: `node_modules/prisma-php/dist/docs/installation.md`
139
+ - Existing-project upgrades and feature refreshes: `node_modules/prisma-php/dist/docs/upgrading.md`
140
+ - TypeScript frontend tooling, the `typescript` flag, and `ts/main.ts` registration: `node_modules/prisma-php/dist/docs/typescript.md`
141
+ - Backend-only API usage and `backendOnly`: `node_modules/prisma-php/dist/docs/backend-only.md`
142
+ - Route and layout structure: `node_modules/prisma-php/dist/docs/layouts-and-pages.md`
143
+ - AI integration, provider-backed chat, streaming, and MCP boundary: `node_modules/prisma-php/dist/docs/get-started-ia.md`
144
+ - Data loading, `#[Exposed]`, and SSE streaming: `node_modules/prisma-php/dist/docs/fetching-data.md`
145
+ - Bootstrap flow, runtime init order, request initialization, and function-call protection: `node_modules/prisma-php/dist/docs/bootstrap-runtime.md`
146
+ - PulsePoint runtime rules: `node_modules/prisma-php/dist/docs/pulsepoint.md`
147
+ - Component and `ImportComponent` rules: `node_modules/prisma-php/dist/docs/components.md`
148
+ - Cache behavior and `CacheHandler`: `node_modules/prisma-php/dist/docs/caching.md`
149
+ - Validation rules: `node_modules/prisma-php/dist/docs/validator.md`
150
+ - Prisma ORM schema, migrations, and generated PHP classes: `node_modules/prisma-php/dist/docs/prisma-php-orm.md`
151
+ - Environment variables and `PP\Env` usage: `node_modules/prisma-php/dist/docs/env.md`
152
+ - File uploads and file manager behavior: `node_modules/prisma-php/dist/docs/file-manager.md`
153
+ - Email and SMTP workflows: `node_modules/prisma-php/dist/docs/email.md`
154
+ - WebSocket and realtime behavior: `node_modules/prisma-php/dist/docs/websocket.md`
155
+ - MCP server and tool rules: `node_modules/prisma-php/dist/docs/mcp.md`
156
+ - Authentication: `node_modules/prisma-php/dist/docs/authentication.md`
157
+ - Error handling, expected failures, and route error files: `node_modules/prisma-php/dist/docs/error-handling.md`
158
+ - Metadata and icons: `node_modules/prisma-php/dist/docs/metadata-and-og-images.md`
159
+ - API-style handlers and webhooks: `node_modules/prisma-php/dist/docs/route-handlers.md`
160
+ - Swagger/OpenAPI generation and `swaggerDocs`: `node_modules/prisma-php/dist/docs/swagger-docs.md`
package/dist/AGENTS.md CHANGED
@@ -35,7 +35,8 @@ Important rules:
35
35
  - expect `./AGENTS.md` at the project root
36
36
  - when the installed docs and a habit from another framework conflict, follow Prisma PHP
37
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
38
+ - in consumer apps, use `./node_modules/prisma-php/dist/docs` as the installed docs location; do not assume a root-level `./dist/docs` directory exists
39
+ - when updating Prisma PHP package/docs sources in the Prisma PHP package source repo, keep the source-repo `AGENTS.md` and source-repo `dist/docs` aligned; if that repo also maintains `.github/copilot-instructions.md` or `.github/instructions/**/*.instructions.md`, keep those source-repo files aligned there too
39
40
 
40
41
  ## Runtime lookup for AI
41
42
 
@@ -232,8 +233,10 @@ When organizing a growing Prisma PHP app, keep route code and reusable code sepa
232
233
  - keep `src/app` focused on the route tree, route-local layouts, pages, handlers, and route-scoped partials
233
234
  - prefer `src/Components` for reusable application UI components shared across multiple routes or layouts
234
235
  - keep reusable non-UI code such as services, auth, middleware, Prisma classes, and helper libraries in `src/Lib`
236
+ - treat route-private folders such as `src/app/<route>/_components` as an implementation detail for files that stay owned by that route only
235
237
  - 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
238
  - if a partial starts in `src/app` but becomes shared across the app, promote it into `src/Components`
239
+ - do **not** default to creating `src/app/<route>/_components` for app-owned section components such as `HeroSection`, `FormSection`, or `SidebarSection`; prefer `src/Components` unless the user explicitly wants route-local colocation and the files are truly private to that route
237
240
  - do **not** default to placing app-wide reusable components under `src/app` unless the user explicitly wants route-local colocation
238
241
 
239
242
  ## HTML-first component tag contract
@@ -687,6 +690,9 @@ Default Prisma PHP validation rules:
687
690
 
688
691
  - use `PP\Validator` as the backend validation and normalization layer
689
692
  - prefer the `Rule` builder for rule-based validation
693
+ - start `Rule` builders with `Rule::required()`, `Rule::optional()`, or `Rule::make()`
694
+ - chain rule methods such as `->min(...)`, `->max(...)`, `->email()`, and `->regex(...)` on that builder instance
695
+ - do **not** generate static calls such as `Rule::max(80)`; for optional constrained fields use `Rule::optional()->max(80)` or `Rule::make()->max(80)`
690
696
  - validate in PHP even when the frontend already performs local checks
691
697
  - return structured validation results for expected failures
692
698
  - do not treat routine invalid input as an uncaught exception
@@ -696,6 +702,7 @@ When internals matter, the documented Prisma PHP core validator location is:
696
702
 
697
703
  ```txt
698
704
  vendor/tsnc/prisma-php/src/Validator.php
705
+ vendor/tsnc/prisma-php/src/Rule.php
699
706
  ```
700
707
 
701
708
  ## PulsePoint rules
@@ -712,7 +719,8 @@ Also follow these rules:
712
719
  - do not write React, Vue, Alpine, or Livewire syntax and call it PulsePoint
713
720
  - keep backend concerns separate from PulsePoint runtime concerns
714
721
  - prefer simple documented runtime primitives over abstractions copied from other ecosystems
715
- - use `pp-style` for template-driven inline CSS and plain `style` for fully static inline CSS
722
+ - use `pp-style` whenever inline CSS contains `{...}` interpolation or any other template-driven/reactive value, and reserve plain `style` for fully static inline CSS
723
+ - do **not** generate reactive inline CSS inside a plain `style` attribute such as `style="width: {progress}%";` use `pp-style="width: {progress}%";` instead so source markup stays editor-friendly
716
724
  - use `pp-spread="{...attrs}"` for dynamic attribute objects and omit nullish values from those objects
717
725
  - use `pp-for` only on `<template>` with `item in items` or `(item, index) in items`
718
726
  - use plain `key` for keyed diffing; do not invent `pp-key`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-prisma-php-app",
3
- "version": "5.1.0-alpha.3",
3
+ "version": "5.1.0-alpha.5",
4
4
  "description": "Prisma-PHP: A Revolutionary Library Bridging PHP with Prisma ORM",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",