proteum 2.1.3-1 → 2.1.7
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/AGENTS.md +22 -14
- package/README.md +109 -17
- package/agents/project/AGENTS.md +188 -25
- package/agents/project/CODING_STYLE.md +1 -0
- package/agents/project/client/AGENTS.md +13 -8
- package/agents/project/client/pages/AGENTS.md +17 -9
- package/agents/project/diagnostics.md +52 -0
- package/agents/project/optimizations.md +48 -0
- package/agents/project/server/routes/AGENTS.md +9 -6
- package/agents/project/server/services/AGENTS.md +10 -6
- package/agents/project/tests/AGENTS.md +11 -5
- package/cli/app/config.ts +13 -14
- package/cli/app/index.ts +58 -0
- package/cli/commands/connect.ts +45 -0
- package/cli/commands/dev.ts +37 -13
- package/cli/commands/diagnose.ts +286 -0
- package/cli/commands/doctor.ts +18 -5
- package/cli/commands/explain.ts +25 -0
- package/cli/commands/perf.ts +243 -0
- package/cli/commands/trace.ts +9 -1
- package/cli/commands/verify.ts +281 -0
- package/cli/compiler/artifacts/connectedProjects.ts +453 -0
- package/cli/compiler/artifacts/controllers.ts +198 -49
- package/cli/compiler/artifacts/discovery.ts +0 -34
- package/cli/compiler/artifacts/manifest.ts +95 -6
- package/cli/compiler/artifacts/routing.ts +2 -2
- package/cli/compiler/artifacts/services.ts +277 -130
- package/cli/compiler/client/index.ts +3 -0
- package/cli/compiler/common/files/style.ts +52 -0
- package/cli/compiler/common/generatedRouteModules.ts +34 -5
- package/cli/compiler/common/scripts.ts +11 -5
- package/cli/compiler/index.ts +2 -1
- package/cli/compiler/server/index.ts +3 -0
- package/cli/presentation/commands.ts +110 -7
- package/cli/presentation/devSession.ts +32 -7
- package/cli/runtime/commands.ts +165 -6
- package/cli/scaffold/index.ts +18 -27
- package/cli/scaffold/templates.ts +48 -28
- package/cli/utils/agents.ts +106 -13
- package/cli/utils/keyboard.ts +8 -0
- package/client/dev/profiler/ApexChart.tsx +66 -0
- package/client/dev/profiler/index.tsx +2508 -302
- package/client/dev/profiler/runtime.noop.ts +12 -0
- package/client/dev/profiler/runtime.ts +195 -4
- package/client/services/router/request/api.ts +6 -1
- package/common/applicationConfig.ts +173 -0
- package/common/applicationConfigLoader.ts +102 -0
- package/common/connectedProjects.ts +113 -0
- package/common/dev/connect.ts +267 -0
- package/common/dev/console.ts +31 -0
- package/common/dev/contractsDoctor.ts +128 -0
- package/common/dev/diagnostics.ts +59 -15
- package/common/dev/inspection.ts +491 -0
- package/common/dev/performance.ts +809 -0
- package/common/dev/profiler.ts +3 -0
- package/common/dev/proteumManifest.ts +31 -6
- package/common/dev/requestTrace.ts +52 -1
- package/common/env/proteumEnv.ts +176 -50
- package/common/router/index.ts +1 -0
- package/common/router/request/api.ts +2 -0
- package/config.ts +5 -0
- package/docs/dev-commands.md +5 -1
- package/docs/dev-sessions.md +90 -0
- package/docs/diagnostics.md +74 -11
- package/docs/request-tracing.md +50 -3
- package/package.json +1 -1
- package/server/app/container/config.ts +16 -87
- package/server/app/container/console/index.ts +42 -8
- package/server/app/container/index.ts +10 -2
- package/server/app/container/trace/index.ts +105 -0
- package/server/app/devDiagnostics.ts +138 -0
- package/server/app/index.ts +18 -8
- package/server/app/service/container.ts +0 -12
- package/server/app/service/index.ts +0 -2
- package/server/services/prisma/index.ts +121 -4
- package/server/services/router/http/index.ts +305 -11
- package/server/services/router/index.ts +116 -57
- package/server/services/router/request/api.ts +160 -19
- package/server/services/router/request/index.ts +8 -0
- package/server/services/router/response/index.ts +23 -1
- package/server/services/router/response/page/document.tsx +31 -14
- package/server/services/router/response/page/index.tsx +10 -0
- package/agents/framework/AGENTS.md +0 -177
- package/server/services/auth/router/service.json +0 -6
- package/server/services/auth/service.json +0 -6
- package/server/services/cron/service.json +0 -6
- package/server/services/disks/drivers/local/service.json +0 -6
- package/server/services/disks/drivers/s3/service.json +0 -6
- package/server/services/disks/service.json +0 -6
- package/server/services/fetch/service.json +0 -7
- package/server/services/prisma/service.json +0 -6
- package/server/services/router/service.json +0 -6
- package/server/services/schema/router/service.json +0 -6
- package/server/services/schema/service.json +0 -6
- package/server/services/security/encrypt/aes/service.json +0 -6
package/AGENTS.md
CHANGED
|
@@ -1,40 +1,44 @@
|
|
|
1
1
|
# Proteum Core
|
|
2
2
|
|
|
3
|
-
This file governs work in the Proteum framework repository itself. For downstream app rules, use `agents/
|
|
3
|
+
This file governs work in the Proteum framework repository itself. For downstream app rules, use `agents/project/AGENTS.md`.
|
|
4
|
+
Role: keep only framework-repo instructions here.
|
|
5
|
+
Keep here: core-repo priorities, framework change workflow, reference-app validation, and framework-specific constraints.
|
|
6
|
+
Do not put here: downstream app implementation contracts, area-specific app rules, or repeated content that belongs in `agents/project/**`.
|
|
7
|
+
Downstream app optimization source of truth: `agents/project/optimizations.md`.
|
|
8
|
+
Downstream app diagnostics source of truth: `agents/project/diagnostics.md`.
|
|
9
|
+
Downstream app coding style source of truth: `agents/project/CODING_STYLE.md`.
|
|
4
10
|
|
|
5
11
|
## Priorities
|
|
6
12
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
1. Reduce shipped client bundle size and unnecessary runtime code.
|
|
10
|
-
2. Improve build-time, server-time, and browser-time performance.
|
|
11
|
-
3. Improve SEO output and crawlable, semantic HTML.
|
|
12
|
-
4. Preserve explicit, typed, machine-readable contracts for agents.
|
|
13
|
+
Optimization priorities and rules live in `agents/project/optimizations.md`.
|
|
14
|
+
After those optimization concerns, preserve explicit, typed, machine-readable contracts for agents.
|
|
13
15
|
|
|
14
16
|
## Core Rules
|
|
15
17
|
|
|
16
18
|
- Prefer explicit typed contracts over runtime magic or hidden conventions.
|
|
17
19
|
- Keep `server/index.ts` as the canonical type root for services, router context, request context, and models.
|
|
18
20
|
- Keep generated code deterministic, auditable, and easy to map back to source.
|
|
19
|
-
- Prefer typed traces and manifest-backed diagnostics over ad hoc logging.
|
|
20
|
-
-
|
|
21
|
-
- Prefer established, flexible, well-typed packages; build custom only when packages fail on bundle size, performance, SSR behavior, typing, flexibility, or maintenance risk.
|
|
21
|
+
- Prefer typed traces, perf rollups, and manifest-backed diagnostics over ad hoc logging.
|
|
22
|
+
- Follow `agents/project/optimizations.md` when choosing packages, helpers, runtimes, plugins, or build infrastructure.
|
|
22
23
|
- Delete obsolete compatibility layers, helper indirection, and unused packages when safe.
|
|
23
24
|
|
|
24
25
|
## Workflow
|
|
25
26
|
|
|
26
27
|
- If the user pastes raw errors without asking for a fix, do not implement changes. List likely causes and, for each one, give probability, why, and how to fix it.
|
|
27
|
-
-
|
|
28
|
+
- After implementing a framework feature or change, do not stop at code edits. Boot both reference apps, exercise the affected flow with Playwright or the smallest real Proteum surface, run the relevant `proteum` diagnostics or perf commands, and confirm there is no meaningful regression in runtime behavior, performance, load size, SEO output, or coding-style expectations before finishing.
|
|
29
|
+
- When you have finished your work, summarize in one top-level short (up to 100 characters) sentence the changes you made since the beginning of the conversation. Output as "Commit message".
|
|
28
30
|
|
|
29
31
|
## Core Changes
|
|
30
32
|
|
|
31
|
-
- Validate framework changes against
|
|
33
|
+
- Validate framework changes against the reference apps:
|
|
32
34
|
- `/Users/gaetan/Desktop/Projets/crosspath/platform`
|
|
35
|
+
- `/Users/gaetan/Desktop/Projets/unique.domains/product`
|
|
33
36
|
- `/Users/gaetan/Desktop/Projets/unique.domains/website`
|
|
34
37
|
- Inspect how both apps currently use the touched feature, runtime, API, compiler behavior, or generated output before proposing or implementing changes.
|
|
35
|
-
- Keep
|
|
38
|
+
- Keep the developer-facing contract synchronized when framework work changes CLI commands, profiler capabilities, or the `proteum dev` banner. Update the live surfaces together in the same pass: CLI command/help definitions, profiler panels and dev-only endpoints, banner text/examples, and the most relevant agent docs that describe them, especially `AGENTS.md`, `agents/project/AGENTS.md`, `agents/project/diagnostics.md`, and any narrower `agents/project/**/AGENTS.md` file that mentions the changed workflow.
|
|
39
|
+
- Keep core changes aligned with the explicit controller/page architecture in `agents/project/AGENTS.md`.
|
|
36
40
|
- Prefer removing framework magic when the same result can be expressed with explicit contracts, generated code, or typed context.
|
|
37
|
-
-
|
|
41
|
+
- Apply the pruning rules from `agents/project/optimizations.md`, especially for webpack plugins, Babel plugins, aliases, helpers, runtime services, and npm packages that are not meaningfully used by both apps.
|
|
38
42
|
- Remove dead docs, flags, helper files, and compatibility branches in the same pass when safe.
|
|
39
43
|
|
|
40
44
|
## Proposals
|
|
@@ -51,7 +55,11 @@ When tradeoffs exist, optimize in this order:
|
|
|
51
55
|
Do not stop at static analysis for routing, controllers, generated code, SSR, client runtime, services, webpack, Babel, or emitted assets.
|
|
52
56
|
|
|
53
57
|
- Run `npx proteum dev --no-cache --port 3xxx` in both reference apps on explicit ports.
|
|
58
|
+
- When validating a concrete route, controller path, or failing page on a running dev server, prefer `proteum diagnose <path> --port <port>` first. Use raw `proteum trace ...` output when you need lower-level event detail beyond the diagnose summary.
|
|
59
|
+
- When the issue is latency, CPU, SQL cost, render cost, or memory drift, inspect `proteum perf top`, `proteum perf request`, `proteum perf compare`, or `proteum perf memory` against the running dev server before adding custom instrumentation.
|
|
60
|
+
- For protected browser or API flows in dev, prefer `npx proteum session <email> --role <role>` to mint a dev auth cookie instead of automating the login UI. Use the login UI only when login itself is the feature under test.
|
|
54
61
|
- For request-time behavior, arm traces with `proteum trace arm --capture deep`, reproduce once, then inspect `proteum trace latest` or `proteum trace show <requestId>`.
|
|
62
|
+
- When the framework-facing workflow itself changed, verify the CLI surface too with `proteum verify framework-change --crosspath-port <port> --product-port <port> --website-port <port>`.
|
|
55
63
|
- Open the real pages with Playwright.
|
|
56
64
|
- Inspect browser console errors and warnings.
|
|
57
65
|
- Inspect server startup and runtime errors.
|
package/README.md
CHANGED
|
@@ -28,14 +28,15 @@ Proteum combines:
|
|
|
28
28
|
- **Explicit request entrypoints.** Controllers are classes. Request access is explicit through `this.request`.
|
|
29
29
|
- **Local validation.** Validate handler input inside the handler with `this.input(schema)`.
|
|
30
30
|
- **Deterministic generation.** Proteum owns `.proteum/` and regenerates it from source.
|
|
31
|
-
- **Explainability matters.** `proteum explain`, `proteum doctor`, and `proteum trace` expose the framework view of your app and its live requests, and the profiler renders the same diagnostics surfaces for humans in dev.
|
|
31
|
+
- **Explainability matters.** `proteum explain`, `proteum doctor`, `proteum diagnose`, `proteum perf`, and `proteum trace` expose the framework view of your app and its live requests, and the profiler renders the same diagnostics and perf surfaces for humans in dev.
|
|
32
32
|
- **SEO is not an afterthought.** Identity, routes, layouts, and SSR data are part of the app contract.
|
|
33
33
|
|
|
34
34
|
## What a Proteum App Looks Like
|
|
35
35
|
|
|
36
36
|
```text
|
|
37
37
|
my-app/
|
|
38
|
-
identity.
|
|
38
|
+
identity.config.ts
|
|
39
|
+
proteum.config.ts
|
|
39
40
|
.env # optional file for required local env vars
|
|
40
41
|
package.json
|
|
41
42
|
commands/
|
|
@@ -63,8 +64,9 @@ my-app/
|
|
|
63
64
|
|
|
64
65
|
Important files:
|
|
65
66
|
|
|
66
|
-
- `identity.
|
|
67
|
-
- `
|
|
67
|
+
- `identity.config.ts`: typed app identity, naming, locale, and SEO-facing metadata defaults via `Application.identity({ ... })`
|
|
68
|
+
- `proteum.config.ts`: typed Proteum compiler and connection settings such as `transpile` and `connect` via `Application.setup({ ... })`
|
|
69
|
+
- `process.env` / optional `.env`: `PORT`, `ENV_*`, `URL`, `URL_INTERNAL`, any app-chosen variables referenced by `proteum.config.ts`, and `TRACE_*` environment variables loaded by the app
|
|
68
70
|
- `server/config/*.ts`: plain typed config exports consumed by the explicit app bootstrap
|
|
69
71
|
- `server/index.ts`: default-exported `Application` subclass that instantiates root services and router plugins
|
|
70
72
|
- `client/pages/**`: SSR page entrypoints registered through `Router.page(...)`
|
|
@@ -79,6 +81,12 @@ Required Proteum env vars:
|
|
|
79
81
|
- `ENV_PROFILE`: `dev`, `testing`, or `prod`
|
|
80
82
|
- `PORT`: default router port
|
|
81
83
|
- `URL`: canonical absolute base URL for `Router.url(..., true)`
|
|
84
|
+
- `URL_INTERNAL`: internal absolute base URL used by SSR and connected-project server calls
|
|
85
|
+
|
|
86
|
+
If `proteum.config.ts` declares `connect`, Proteum also requires:
|
|
87
|
+
|
|
88
|
+
- one explicit `connect.<Namespace>.source` value in `proteum.config.ts`
|
|
89
|
+
- one explicit `connect.<Namespace>.urlInternal` value in `proteum.config.ts`
|
|
82
90
|
|
|
83
91
|
Proteum does not provide defaults for required env vars. They must be defined explicitly in `process.env` or `.env`.
|
|
84
92
|
|
|
@@ -92,6 +100,37 @@ Optional trace env vars:
|
|
|
92
100
|
- `TRACE_CAPTURE`
|
|
93
101
|
- `TRACE_PERSIST_ON_ERROR`
|
|
94
102
|
|
|
103
|
+
Optional `proteum.config.ts` fields:
|
|
104
|
+
|
|
105
|
+
- `transpile`: array of package names that Proteum should compile from `node_modules/` instead of treating as prebuilt vendor code
|
|
106
|
+
- `connect`: connected project namespaces that should be merged into generated controller helpers
|
|
107
|
+
|
|
108
|
+
Example:
|
|
109
|
+
|
|
110
|
+
```ts
|
|
111
|
+
import { Application } from 'proteum/config';
|
|
112
|
+
|
|
113
|
+
const PRODUCT_CONNECTED_SOURCE = process.env.PRODUCT_CONNECTED_SOURCE;
|
|
114
|
+
const PRODUCT_URL_INTERNAL = process.env.PRODUCT_URL_INTERNAL;
|
|
115
|
+
|
|
116
|
+
export default Application.setup({
|
|
117
|
+
transpile: ['@acme/components'],
|
|
118
|
+
connect: {
|
|
119
|
+
Product: {
|
|
120
|
+
source: PRODUCT_CONNECTED_SOURCE,
|
|
121
|
+
urlInternal: PRODUCT_URL_INTERNAL,
|
|
122
|
+
},
|
|
123
|
+
},
|
|
124
|
+
});
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
Connected contract sources are provided explicitly through `proteum.config.ts` instead of being inferred from the namespace:
|
|
128
|
+
|
|
129
|
+
- local typed source value: `file:../product`
|
|
130
|
+
- remote runtime-only source value: `github:owner/repo?ref=<sha-or-branch>&path=proteum.connected.json`
|
|
131
|
+
|
|
132
|
+
Use this for linked or workspace-local TypeScript packages that ship source files and must flow through Proteum's alias and SSR compilation pipeline.
|
|
133
|
+
|
|
95
134
|
## Example: Server Bootstrap
|
|
96
135
|
|
|
97
136
|
Proteum app services are declared explicitly through typed config exports plus a concrete `Application` subclass.
|
|
@@ -142,7 +181,7 @@ export default class MyApp extends Application {
|
|
|
142
181
|
}
|
|
143
182
|
```
|
|
144
183
|
|
|
145
|
-
Proteum reads `server/index.ts`
|
|
184
|
+
Proteum reads `server/index.ts` as the source of truth for installed root services and router plugins, and reads `server/config/*.ts` `Services.config(...)` exports for typed config such as service priority overrides.
|
|
146
185
|
|
|
147
186
|
## Example: Page
|
|
148
187
|
|
|
@@ -285,11 +324,15 @@ Proteum ships with a compact CLI focused on the real app lifecycle:
|
|
|
285
324
|
| `proteum lint` | Run ESLint for the current app |
|
|
286
325
|
| `proteum check` | Refresh, typecheck, and lint in one command |
|
|
287
326
|
| `proteum build --prod` | Produce the production server and client bundles into `bin/` |
|
|
327
|
+
| `proteum connect` | Inspect connected-project sources, env, cached contracts, and imported controllers |
|
|
288
328
|
| `proteum doctor` | Inspect manifest diagnostics |
|
|
289
|
-
| `proteum explain` | Explain routes, controllers, services, layouts, conventions, and
|
|
329
|
+
| `proteum explain` | Explain routes, controllers, services, layouts, conventions, env, and connected projects |
|
|
330
|
+
| `proteum diagnose` | Combine owner lookup, diagnostics, trace data, and server logs for one concrete route or request target |
|
|
331
|
+
| `proteum perf` | Aggregate request-trace performance into hot paths, one-request waterfalls, regressions, and memory drift views |
|
|
290
332
|
| `proteum trace` | Inspect live dev-only request traces from the running SSR server |
|
|
291
333
|
| `proteum command` | Run a dev-only internal command locally or against a running dev server |
|
|
292
334
|
| `proteum session` | Mint a dev-only auth session token and Playwright-ready cookie payload |
|
|
335
|
+
| `proteum verify` | Validate framework-facing workflows across one or more running dev apps; `framework-change` is the built-in cross-reference-app check |
|
|
293
336
|
| `proteum init` | Scaffold a new Proteum app with built-in deterministic templates |
|
|
294
337
|
| `proteum create` | Scaffold a page, controller, command, route, or root service inside an app |
|
|
295
338
|
|
|
@@ -306,10 +349,22 @@ Useful inspection commands:
|
|
|
306
349
|
|
|
307
350
|
```bash
|
|
308
351
|
proteum doctor
|
|
352
|
+
proteum doctor --contracts
|
|
309
353
|
proteum doctor --json
|
|
354
|
+
proteum connect
|
|
355
|
+
proteum connect --controllers
|
|
356
|
+
proteum connect --strict
|
|
310
357
|
proteum explain
|
|
358
|
+
proteum explain owner /api/Auth/CurrentUser
|
|
311
359
|
proteum explain --routes --controllers --commands
|
|
360
|
+
proteum explain --connected --controllers
|
|
312
361
|
proteum explain --all --json
|
|
362
|
+
proteum diagnose /
|
|
363
|
+
proteum diagnose /dashboard --port 3101
|
|
364
|
+
proteum perf top --since today
|
|
365
|
+
proteum perf request /dashboard --port 3101
|
|
366
|
+
proteum perf compare --baseline yesterday --target today --group-by route
|
|
367
|
+
proteum perf memory --since 1h --group-by controller
|
|
313
368
|
proteum command proteum/diagnostics/ping
|
|
314
369
|
proteum command proteum/diagnostics/ping --port 3101
|
|
315
370
|
proteum session admin@example.com --role ADMIN --port 3101
|
|
@@ -329,7 +384,7 @@ proteum create controller Founder/projects --method list
|
|
|
329
384
|
proteum create service Conversion/Plans
|
|
330
385
|
```
|
|
331
386
|
|
|
332
|
-
`proteum explain` and `proteum
|
|
387
|
+
`proteum connect`, `proteum explain`, `proteum doctor`, and `proteum diagnose` share the same generated manifest and contract state. `proteum perf` uses the same dev request-trace store as the profiler `Perf` tab. For the full diagnostics and tracing model, see [docs/diagnostics.md](docs/diagnostics.md) and [docs/request-tracing.md](docs/request-tracing.md).
|
|
333
388
|
|
|
334
389
|
## Dev Commands
|
|
335
390
|
|
|
@@ -342,15 +397,36 @@ Proteum includes a dev-only command surface for internal testing, debugging, and
|
|
|
342
397
|
- `proteum command foo/bar` refreshes generated artifacts, builds the dev output, starts a temporary local dev server, runs the command, prints the result, and exits
|
|
343
398
|
- `proteum command foo/bar --port 3101` runs the same command against an existing `proteum dev` instance
|
|
344
399
|
- the dev profiler exposes the same command list and run action through the `Commands` tab
|
|
345
|
-
- the same profiler also exposes `Explain` and `
|
|
400
|
+
- the same profiler also exposes `Explain`, `Doctor`, and `Diagnose` tabs backed by the same diagnostics contract as the CLI
|
|
346
401
|
|
|
347
402
|
Proteum itself also ships a small built-in diagnostic command at `proteum/diagnostics/ping`, so the command surface is never empty in dev.
|
|
348
403
|
|
|
404
|
+
## Dev Sessions
|
|
405
|
+
|
|
406
|
+
Proteum includes a dev-only auth bootstrap command for browser automation, API probes, and protected-route debugging without driving the login UI.
|
|
407
|
+
|
|
408
|
+
- `proteum session <email>` mints a session for a known user
|
|
409
|
+
- `--role <role>` asserts that the resolved user has the expected role before returning the session
|
|
410
|
+
- `--port <port>` or `--url <baseUrl>` targets an existing `proteum dev` server
|
|
411
|
+
- without `--port` or `--url`, Proteum starts a temporary local dev server, creates the session, prints the payload, and exits
|
|
412
|
+
- output includes the raw token, a `Cookie:` header, and a Playwright-ready `cookies` payload
|
|
413
|
+
- prefer this command when an LLM or test runner needs an authenticated dev context
|
|
414
|
+
- do not use it when the login flow itself is what you are testing
|
|
415
|
+
|
|
416
|
+
Typical usage:
|
|
417
|
+
|
|
418
|
+
```bash
|
|
419
|
+
proteum session admin@example.com --role ADMIN --port 3101
|
|
420
|
+
proteum session god@example.com --role GOD --json
|
|
421
|
+
```
|
|
422
|
+
|
|
423
|
+
The CLI talks to the running app over the dev-only `__proteum/session/start` endpoint and uses the auth service registered on the current app router. For the full guide, see [docs/dev-sessions.md](docs/dev-sessions.md).
|
|
424
|
+
|
|
349
425
|
## Request Tracing
|
|
350
426
|
|
|
351
|
-
Proteum includes a dev-only in-memory request trace buffer for auth, routing, controller, context, SSR, and render debugging.
|
|
427
|
+
Proteum includes a dev-only in-memory request trace buffer for auth, routing, controller, context, SSR, API, Prisma SQL, and render debugging.
|
|
352
428
|
|
|
353
|
-
This is separate from `proteum explain` and `proteum doctor`: tracing is live request-time data, while explain/doctor are manifest-backed structure and diagnostics.
|
|
429
|
+
This is separate from `proteum explain` and `proteum doctor`: tracing is live request-time data, while explain/doctor are manifest-backed structure and diagnostics. `proteum perf` aggregates the same trace buffer into hot-path, waterfall, compare, and memory views. When you already know the failing path and want the fastest suspect list, start with `proteum diagnose`; when the issue is performance, start with `proteum perf`; then drop into raw trace output only if needed.
|
|
354
430
|
|
|
355
431
|
When diagnosing or testing against an app, first read the default port from `PORT` or `./.proteum/manifest.json` and check whether a server is already running there. If it is, inspect the existing traces before reproducing the issue so you can collect past errors and their context.
|
|
356
432
|
|
|
@@ -360,6 +436,13 @@ When diagnosing or testing against an app, first read the default port from `POR
|
|
|
360
436
|
- `proteum trace arm --capture deep`: force the next request into deep capture mode
|
|
361
437
|
- `proteum trace export <requestId>`: write one trace to disk
|
|
362
438
|
- `proteum trace latest --url http://127.0.0.1:3010`: target a non-standard dev base URL directly
|
|
439
|
+
- `proteum diagnose /dashboard --port 3101`: combine owner lookup, diagnostics, trace summary, and buffered logs for one concrete path
|
|
440
|
+
- `proteum perf top --since today`: rank the hottest traced paths in the selected window
|
|
441
|
+
- `proteum perf request /dashboard --port 3101`: inspect one traced request with stage timings, CPU, SQL, render, and memory deltas
|
|
442
|
+
- `proteum perf compare --baseline yesterday --target today --group-by route`: compare regression deltas between two windows
|
|
443
|
+
- `proteum perf memory --since 1h --group-by controller`: rank recent heap and RSS drift
|
|
444
|
+
|
|
445
|
+
Trace summaries include `sql=<count>`. Detailed trace output includes `Calls` and `SQL` sections so API/fetcher activity and Prisma queries can be inspected together.
|
|
363
446
|
|
|
364
447
|
Default behavior:
|
|
365
448
|
|
|
@@ -385,7 +468,9 @@ Capture modes:
|
|
|
385
468
|
- `resolve`: adds auth, route resolution, and controller/context steps
|
|
386
469
|
- `deep`: adds route skip reasons and deeper payload summaries for one request investigation
|
|
387
470
|
|
|
388
|
-
|
|
471
|
+
In the dev profiler, the request-trace tabs are now visual as well as textual: `Summary`, `Auth`, `Routing`, `Controller`, `SSR`, `API`, `SQL`, `Errors`, `Diagnose`, `Explain`, `Doctor`, `Commands`, and `Cron` all add focused charts over the same live contracts, while `Perf` remains the aggregated hot-path, breakdown, regression, and memory surface exposed by `proteum perf`.
|
|
472
|
+
|
|
473
|
+
The trace and perf CLIs talk to the running dev server over the dev-only `__proteum/trace` and `__proteum/perf` HTTP endpoints. Use `--port` for a different local port or `--url` when the host itself is non-standard. For the full guide, see [docs/request-tracing.md](docs/request-tracing.md).
|
|
389
474
|
|
|
390
475
|
## LLM-Friendly By Design
|
|
391
476
|
|
|
@@ -400,26 +485,33 @@ Proteum is built so an agent can answer these questions quickly and reliably:
|
|
|
400
485
|
|
|
401
486
|
Proteum answers those questions with explicit artifacts:
|
|
402
487
|
|
|
403
|
-
- `identity.
|
|
404
|
-
- `
|
|
488
|
+
- `identity.config.ts` for app identity
|
|
489
|
+
- `proteum.config.ts` for compiler and connected-project setup
|
|
490
|
+
- `PORT`, `ENV_*`, `URL`, `URL_INTERNAL`, app-chosen connected-project config values, and `TRACE_*` env vars for the environment surface
|
|
405
491
|
- `server/index.ts` for the explicit root service graph
|
|
406
492
|
- `.proteum/manifest.json` for machine-readable app structure
|
|
407
493
|
- `proteum explain --json` for structured framework introspection
|
|
408
494
|
- `proteum doctor --json` for structured diagnostics
|
|
409
|
-
-
|
|
495
|
+
- `proteum doctor --contracts --json` for generated-artifact and manifest-owned file checks
|
|
496
|
+
- `proteum explain owner <query>` for fast ownership lookup over routes, controllers, files, and generated artifacts
|
|
497
|
+
- `proteum diagnose <path>` for a one-shot request diagnosis surface
|
|
498
|
+
- `proteum perf top|request|compare|memory` for request-trace performance rollups
|
|
499
|
+
- the profiler `Explain`, `Doctor`, `Diagnose`, and `Perf` tabs for a human-readable view over the same diagnostics and trace-derived perf contracts
|
|
410
500
|
- `proteum command ...` plus the profiler `Commands` tab for dev-only internal execution
|
|
501
|
+
- `proteum session ...` for explicit authenticated dev browser or API bootstrapping without login UI automation
|
|
411
502
|
|
|
412
503
|
If you are an LLM or automation agent, start here:
|
|
413
504
|
|
|
414
|
-
1. Read `identity.
|
|
415
|
-
2. Read `PORT`, the relevant `ENV_*`, `URL`, and `TRACE_*` env vars, or run `proteum explain env`.
|
|
505
|
+
1. Read `identity.config.ts` and `proteum.config.ts`.
|
|
506
|
+
2. Read `PORT`, the relevant `ENV_*`, `URL`, `URL_INTERNAL`, any env values referenced by `proteum.config.ts`, and `TRACE_*` env vars, or run `proteum explain env`.
|
|
416
507
|
3. Inspect `server/index.ts` and `server/config/*.ts` for the explicit app bootstrap.
|
|
417
508
|
4. Read `.proteum/manifest.json` or run `proteum explain --json`.
|
|
418
509
|
5. Inspect `server/controllers/**` for request entrypoints.
|
|
419
510
|
6. Inspect `server/services/**` for business logic.
|
|
420
511
|
7. Inspect `client/pages/**` for SSR routes and page setup contracts.
|
|
512
|
+
8. If the task touches a protected route or controller in dev and login UX is not the feature under test, use `proteum session <email> --role <role>` before Playwright or direct HTTP calls.
|
|
421
513
|
|
|
422
|
-
For implementation rules in a real Proteum app, treat the local `AGENTS.md` files plus `proteum explain`, `proteum doctor`, and `proteum trace` as the task contract. This README is the framework overview, not the project-local instruction layer.
|
|
514
|
+
For implementation rules in a real Proteum app, treat the local `AGENTS.md` files plus `proteum explain`, `proteum doctor`, `proteum diagnose`, `proteum perf`, and `proteum trace` as the task contract. This README is the framework overview, not the project-local instruction layer.
|
|
423
515
|
|
|
424
516
|
## What Proteum Avoids
|
|
425
517
|
|
package/agents/project/AGENTS.md
CHANGED
|
@@ -1,22 +1,25 @@
|
|
|
1
|
-
# Project
|
|
1
|
+
# Proteum Project Contract
|
|
2
2
|
|
|
3
|
-
This
|
|
3
|
+
This is the canonical contract for Proteum-based projects shipped with Proteum. Narrower `AGENTS.md` files in this folder add area-specific rules on top of this file.
|
|
4
|
+
Role: keep only project-wide app rules here.
|
|
5
|
+
Keep here: cross-cutting project workflow, architecture contracts, shared typing rules, and rules that apply across client, server, pages, and tests.
|
|
6
|
+
Do not put here: detailed diagnostics workflow, optimization checklists, coding-style details, or narrow area-specific instructions that belong in `diagnostics.md`, `optimizations.md`, `CODING_STYLE.md`, `client/AGENTS.md`, `client/pages/AGENTS.md`, `server/routes/AGENTS.md`, `server/services/AGENTS.md`, or `tests/AGENTS.md`.
|
|
4
7
|
|
|
5
|
-
|
|
8
|
+
Optimization source of truth: project-root `optimizations.md`.
|
|
9
|
+
Diagnostics source of truth: project-root `diagnostics.md`.
|
|
10
|
+
Coding style source of truth: project-root `CODING_STYLE.md`.
|
|
6
11
|
|
|
7
|
-
|
|
8
|
-
- installed app: `./node_modules/proteum/agents/framework/AGENTS.md`
|
|
9
|
-
|
|
10
|
-
Coding style source of truth: `./CODING_STYLE.md`.
|
|
11
|
-
|
|
12
|
-
## Fast Start
|
|
12
|
+
## Workflow
|
|
13
13
|
|
|
14
|
-
-
|
|
15
|
-
-
|
|
16
|
-
-
|
|
17
|
-
- For
|
|
18
|
-
-
|
|
19
|
-
-
|
|
14
|
+
- At the beginning of every task, acknowledge the applicable optimization, diagnostics, and coding-style sources before analyzing or editing code: project-root `optimizations.md`, project-root `diagnostics.md`, project-root `CODING_STYLE.md`, and any narrower area `AGENTS.md`.
|
|
15
|
+
- If the user pastes raw errors without asking for a fix, do not implement changes. List likely causes and, for each one, give probability, why, and how to fix it.
|
|
16
|
+
- Follow project-root `diagnostics.md` for diagnosis, runtime reproduction, temporary instrumentation, error-solving workflow, and verification method selection.
|
|
17
|
+
- For new app or artifact boilerplate, prefer `npx proteum init ...` and `npx proteum create ...` before creating files by hand. Use `--dry-run --json` when an agent needs a machine-readable plan before writing files.
|
|
18
|
+
- After running `npx proteum create ...`, adapt the generated code to the real feature instead of leaving placeholder logic in place.
|
|
19
|
+
- When framework work changes Proteum CLI commands, profiler panels/features, or the `proteum dev` banners, keep this file, project-root `diagnostics.md`, and any narrower area `AGENTS.md` that mentions the same workflow aligned with the live framework behavior in the same pass.
|
|
20
|
+
- Before finishing, double-check the touched files and generated output against the applicable optimization, diagnostics, and coding-style sources: project-root `optimizations.md`, project-root `diagnostics.md`, project-root `CODING_STYLE.md`, and any narrower area `AGENTS.md`.
|
|
21
|
+
- After implementing any feature or behavior change, always verify it on a running app before finishing: start the server, exercise the affected flow with Playwright or the smallest real runtime or `npx proteum` surface, run the relevant diagnostics or perf commands, and confirm there is no meaningful regression in behavior, performance, bundle/load size, SEO output, or coding style.
|
|
22
|
+
- When you have finished your work, summarize in one top-level short (up to 100 characters) sentence ALL the changes you made since the beginning of the WHOLE conversation. Output as "Commit message".
|
|
20
23
|
|
|
21
24
|
## Project Shape
|
|
22
25
|
|
|
@@ -27,23 +30,164 @@ This is a TypeScript, Node.js, Preact, Proteum monolith:
|
|
|
27
30
|
- `/server`: catalogs, config, services, routes, lib
|
|
28
31
|
- `/tests`
|
|
29
32
|
|
|
30
|
-
##
|
|
33
|
+
## Non-Negotiable Rules
|
|
31
34
|
|
|
35
|
+
- Client pages live in `client/pages/**` and register routes with top-level `Router.page(...)` or `Router.error(...)`.
|
|
36
|
+
- Page URLs come from the explicit `Router.page('/path', ...)` call, not from the file path.
|
|
37
|
+
- Callable app APIs live only in `server/controllers/**/*.ts` files that extend `Controller`.
|
|
38
|
+
- Dev-only internal execution lives only in `commands/**/*.ts` files that extend `Commands`.
|
|
39
|
+
- Manual HTTP endpoints live only in `server/routes/**`.
|
|
40
|
+
- Controllers call `this.input(schema)` inside the method body, at most once per method.
|
|
41
|
+
- Request-scoped state lives only on `this.request` and manual-route/router context objects.
|
|
42
|
+
- Follow project-root `optimizations.md` for bundle size, performance, SEO, and SSR page-size rules.
|
|
32
43
|
- Keep one class or one React/Preact component per file.
|
|
33
44
|
- Prefer a deep tree grouped by business concern instead of long file names.
|
|
34
45
|
- Use the default `*.ts` or `*.tsx` file unless an `*.ssr.ts` or `*.ssr.tsx` variant is truly required.
|
|
35
|
-
- Never edit generated files under
|
|
46
|
+
- Never edit generated files under `.proteum`.
|
|
36
47
|
- Use `@generated/client/*`, `@generated/common/*`, and `@generated/server/*` for generated surfaces.
|
|
37
48
|
- Client context is typically imported from `@/client/context`.
|
|
38
|
-
-
|
|
39
|
-
-
|
|
49
|
+
- Normal service methods do not read request state directly.
|
|
50
|
+
- Do not import runtime values from `@models`.
|
|
51
|
+
- Do not use `@request` runtime globals.
|
|
52
|
+
- Do not use `@app` on the client.
|
|
53
|
+
- Prefer type inference rooted in the explicit application graph in `server/index.ts`.
|
|
54
|
+
|
|
55
|
+
## Source Of Truth
|
|
56
|
+
|
|
57
|
+
Proteum reads:
|
|
58
|
+
|
|
59
|
+
- `package.json`
|
|
60
|
+
- `identity.config.ts` for app identity via `Application.identity({ ... })`
|
|
61
|
+
- `proteum.config.ts` for compiler setup via `Application.setup({ transpile, connect })`
|
|
62
|
+
- `process.env` via `PORT`, `ENV_*`, `URL`, `URL_INTERNAL`, any app-chosen connected-project values referenced by `proteum.config.ts`, and `TRACE_*`
|
|
63
|
+
- `server/config/*.ts`
|
|
64
|
+
- `server/index.ts`
|
|
65
|
+
- `commands/**/*.ts`
|
|
66
|
+
- `server/controllers/**/*.ts`
|
|
67
|
+
- `server/routes/**/*.ts`
|
|
68
|
+
- `client/pages/**/*.ts(x)`
|
|
69
|
+
- `client/pages/**/_layout/index.tsx`
|
|
70
|
+
- `public/**`
|
|
71
|
+
|
|
72
|
+
Proteum owns:
|
|
73
|
+
|
|
74
|
+
- `.proteum/manifest.json`
|
|
75
|
+
- `.proteum/client/*`
|
|
76
|
+
- `.proteum/common/*`
|
|
77
|
+
- `.proteum/server/*`
|
|
78
|
+
|
|
79
|
+
Project code should consume:
|
|
80
|
+
|
|
81
|
+
- `@generated/client/*`
|
|
82
|
+
- `@generated/common/*`
|
|
83
|
+
- `@generated/server/*`
|
|
84
|
+
- `@/client/context` as the generated client context entrypoint
|
|
85
|
+
|
|
86
|
+
Prefer structured CLI surfaces over re-deriving framework facts from source:
|
|
87
|
+
|
|
88
|
+
- `npx proteum connect --json`
|
|
89
|
+
- `npx proteum connect --controllers --strict`
|
|
90
|
+
- `npx proteum explain --json`
|
|
91
|
+
- `npx proteum explain --connected --controllers`
|
|
92
|
+
- `npx proteum explain owner <query>`
|
|
93
|
+
- `npx proteum doctor --json`
|
|
94
|
+
- `npx proteum doctor --contracts --json`
|
|
95
|
+
- `npx proteum diagnose <path> --port <port>`
|
|
96
|
+
- `npx proteum perf ...`
|
|
97
|
+
- `npx proteum trace ...`
|
|
98
|
+
- `npx proteum command ...`
|
|
99
|
+
- `npx proteum session ...`
|
|
100
|
+
- `npx proteum create ... --dry-run --json`
|
|
101
|
+
|
|
102
|
+
Prefer scaffold commands before hand-writing boilerplate:
|
|
103
|
+
|
|
104
|
+
- Use `npx proteum init <directory> --name <name>` for new apps.
|
|
105
|
+
- Use `npx proteum init ... --dry-run --json` when an agent needs a machine-readable app plan before writing files.
|
|
106
|
+
- Use `npx proteum create page|controller|command|route|service <target>` for new app artifacts before creating the files manually.
|
|
107
|
+
- Use `npx proteum create ... --dry-run --json` when an agent needs a machine-readable artifact plan before writing files.
|
|
108
|
+
|
|
109
|
+
## File Contracts
|
|
110
|
+
|
|
111
|
+
### App Bootstrap And Services
|
|
112
|
+
|
|
113
|
+
- `server/index.ts` default-exports the app `Application` subclass and is the canonical type root.
|
|
114
|
+
- Root services are public class fields instantiated with `new ServiceClass(this, config, this)`.
|
|
115
|
+
- Typed root-service config lives in `server/config/*.ts` via `Services.config(ServiceClass, { ... })`.
|
|
116
|
+
- Router plugins are instantiated explicitly inside the `Router` config `plugins` object.
|
|
117
|
+
- Root business services live in `server/services/<Feature>/index.ts`.
|
|
118
|
+
- Root-service config lives in `server/config/*.ts` when the service needs config.
|
|
119
|
+
- Business logic lives in classes that extend `Service` and use `this.services`, `this.models`, and `this.app`.
|
|
120
|
+
- Keep auth, input parsing, locale, cookies, and request-derived values in controllers, then pass explicit typed arguments into services.
|
|
121
|
+
- Split growing features into explicit subservices.
|
|
122
|
+
- Companion client-callable entrypoints live in `server/controllers/**`.
|
|
123
|
+
- `proteum create service ...` scaffolds the service file, a typed config export under `server/config/*.ts`, and the root registration in `server/index.ts`; review and adapt the generated names before committing.
|
|
124
|
+
|
|
125
|
+
### Connected Projects
|
|
126
|
+
|
|
127
|
+
- Declare connected namespaces in `proteum.config.ts` with explicit values such as `connect: { Product: { source: PRODUCT_CONNECTED_SOURCE, urlInternal: PRODUCT_URL_INTERNAL } }`.
|
|
128
|
+
- Proteum does not infer connected env key names from the namespace. The source and internal URL must be provided explicitly in `proteum.config.ts`.
|
|
129
|
+
- Use `npx proteum connect` to inspect configured connect values, cached contract state, and imported controllers for the current app.
|
|
130
|
+
- `file:` connected sources point at another Proteum app root and keep strong connected typings.
|
|
131
|
+
- Non-local connected sources provide runtime helper generation but are intentionally typed loosely.
|
|
132
|
+
|
|
133
|
+
### Controllers
|
|
134
|
+
|
|
135
|
+
- Files live under `server/controllers/**/*.ts` and default-export a class extending `Controller`.
|
|
136
|
+
- Methods with bodies become generated client-callable endpoints.
|
|
137
|
+
- Route path comes from the controller file path plus the method name.
|
|
138
|
+
- `export const controllerPath = 'Custom/path'` can override the base path.
|
|
139
|
+
- Generated client calls use `POST`.
|
|
140
|
+
- Prefer `proteum create controller ...` for new controller boilerplate, then adapt the generated method to real service calls.
|
|
141
|
+
|
|
142
|
+
### Commands
|
|
143
|
+
|
|
144
|
+
- Files live under `commands/**/*.ts` and default-export a class extending `Commands` from `@server/app/commands`.
|
|
145
|
+
- Methods with bodies become generated dev commands.
|
|
146
|
+
- Command path comes from the file path plus the method name.
|
|
147
|
+
- `export const commandPath = 'Custom/path'` can override the base path.
|
|
148
|
+
- Commands are for dev-only internal execution through `proteum command ...` or the profiler `Commands` tab.
|
|
149
|
+
- Keep command logic internal; do not turn it into a normal controller unless it is a real app API.
|
|
150
|
+
- Prefer `proteum create command ...` for new command boilerplate.
|
|
151
|
+
|
|
152
|
+
### Client Pages
|
|
153
|
+
|
|
154
|
+
- Proteum scans page files for top-level `Router.page(...)` and `Router.error(...)` calls.
|
|
155
|
+
- File path controls chunk identity and layout discovery; route path comes from the explicit `Router.page(...)` string.
|
|
156
|
+
- Supported page signatures are `Router.page(path, render)`, `Router.page(path, setup, render)`, `Router.page(path, options, render)`, and `Router.page(path, options, setup, render)`.
|
|
157
|
+
- For new work, prefer `Router.page(path, setup, render)` or `Router.page(path, options, setup, render)`.
|
|
158
|
+
- `setup` returns one flat object. Reserved keys like `_auth`, `_layout`, `_static`, and `_redirectLogged` are route options; all other keys are SSR data.
|
|
159
|
+
- Controller fetchers and promises returned from `setup` resolve before render.
|
|
160
|
+
- `render` consumes resolved setup data and uses generated controller methods from render args or `@/client/context`.
|
|
161
|
+
- Use `api.reload(...)` or `api.set(...)` only when intentionally mutating active page setup state.
|
|
162
|
+
- Error pages use `Router.error(code, options, render)` in `client/pages/_messages/**`.
|
|
163
|
+
- Prefer `proteum create page ...` for new page boilerplate, then review the explicit route path and setup payload.
|
|
164
|
+
|
|
165
|
+
### Manual Routes
|
|
166
|
+
|
|
167
|
+
- Use `server/routes/**` only for explicit HTTP behavior that should not be a generated controller action.
|
|
168
|
+
- Good fits include redirects, sitemap or RSS output, OAuth callbacks, webhooks, and public resources with custom semantics.
|
|
169
|
+
- Import server-side app services from `@app` and use route handler context for `request`, `response`, router plugins, and custom router context.
|
|
170
|
+
- If the route is a normal app API, prefer a controller.
|
|
171
|
+
- Prefer `proteum create route ...` for new manual-route boilerplate.
|
|
172
|
+
|
|
173
|
+
### Models And Aliases
|
|
174
|
+
|
|
175
|
+
- Use Prisma typings from `@models/types`.
|
|
176
|
+
- Use runtime models through `this.models` or `this.app.Models.client`.
|
|
177
|
+
- Keep Prisma runtime access inside services when possible and prefer explicit `select` or narrow `include`.
|
|
178
|
+
- Do not import runtime values from `@models` or edit generated Prisma client files.
|
|
179
|
+
- Aliases:
|
|
180
|
+
- `@/client/...`, `@/server/...`, `@/common/...`: app code
|
|
181
|
+
- `@client/...`, `@server/...`, `@common/...`: Proteum core modules
|
|
182
|
+
- `@app`: server-side application services for manual routes only
|
|
183
|
+
- `@generated/*`: generated app surfaces
|
|
40
184
|
|
|
41
185
|
## Dependency Selection
|
|
42
186
|
|
|
43
187
|
- Before implementing a feature or change, first check whether the repo already includes a suitable dependency.
|
|
44
188
|
- If not, search npm before building a new utility, abstraction, component primitive, parser, formatter, or integration from scratch.
|
|
45
189
|
- Prefer the most popular, flexible, maintained packages that fit the project constraints.
|
|
46
|
-
-
|
|
190
|
+
- Follow project-root `optimizations.md` when deciding whether custom infrastructure is justified over an existing package.
|
|
47
191
|
- When you choose custom over a package, explain the reason briefly.
|
|
48
192
|
|
|
49
193
|
## Catalogs And Typing
|
|
@@ -56,12 +200,31 @@ This is a TypeScript, Node.js, Preact, Proteum monolith:
|
|
|
56
200
|
- Fix typing issues only on code you wrote.
|
|
57
201
|
- Never cast with `as any` or `as unknown`; fix the contract or add an explicit typed adapter.
|
|
58
202
|
|
|
59
|
-
##
|
|
203
|
+
## Design Rules
|
|
60
204
|
|
|
61
|
-
-
|
|
62
|
-
-
|
|
63
|
-
-
|
|
64
|
-
-
|
|
205
|
+
- Prefer explicit `server/index.ts` bootstrap over hidden registration.
|
|
206
|
+
- Prefer controller-backed app APIs over ad hoc manual `/api/...` routes.
|
|
207
|
+
- Prefer service classes over server helpers with hidden dependencies.
|
|
208
|
+
- Keep one canonical source of truth for catalogs, registries, and shared types.
|
|
209
|
+
- Reuse shared Shadcn-based UI primitives when the project already provides them.
|
|
210
|
+
|
|
211
|
+
## Discouraged Patterns
|
|
212
|
+
|
|
213
|
+
- request-scoped state inside normal service methods
|
|
214
|
+
- hiding route registration behind abstractions that remove the top-level `Router.page(...)` call
|
|
215
|
+
- editing `.proteum` directly
|
|
216
|
+
|
|
217
|
+
## Verification
|
|
218
|
+
|
|
219
|
+
Verify at the correct layer:
|
|
220
|
+
|
|
221
|
+
- route additions: boot the app and hit the real URL
|
|
222
|
+
- controller changes: exercise the generated client call or generated `/api/...` endpoint
|
|
223
|
+
- SSR changes: load the real page and inspect rendered HTML plus browser console
|
|
224
|
+
- router or plugin changes: verify request context, auth, redirects, metrics, and validation on a running app
|
|
225
|
+
- For trace-first reproduction, session-based auth setup, temporary logs, and post-fix surface checks, follow project-root `diagnostics.md`.
|
|
226
|
+
|
|
227
|
+
Useful commands: `npx proteum init <dir> --name <name>`, `npx proteum create <kind> <target>`, `proteum dev`, `npx proteum refresh`, `npx proteum typecheck`, `npx proteum lint`, `npx proteum check`, `npx proteum build prod`, `npx proteum perf top`, `npx proteum perf request <requestId|path>`, `npx proteum perf compare --baseline yesterday --target today`, `npx proteum command <path>`, `npx proteum session <email> --role <role>`.
|
|
65
228
|
|
|
66
229
|
## High-Impact Files
|
|
67
230
|
|
|
@@ -8,6 +8,7 @@ This file is the source of truth for codex coding style instructions in Proteum-
|
|
|
8
8
|
- Write clean, consistent, readable code with a tab size of 4.
|
|
9
9
|
- Keep functions and methods short.
|
|
10
10
|
- Every time possible, create reusable functions and components instead of repeating.
|
|
11
|
+
- Before finishing a feature or change, review touched files against this document and run the smallest relevant project lint or check command when available; coding-style regressions are defects, not optional cleanup.
|
|
11
12
|
|
|
12
13
|
## Formatting
|
|
13
14
|
|
|
@@ -1,22 +1,27 @@
|
|
|
1
|
-
# Frontend
|
|
1
|
+
# Frontend Contract
|
|
2
2
|
|
|
3
|
-
This
|
|
3
|
+
This is the canonical client-area contract for Proteum-based projects.
|
|
4
|
+
Role: keep only client-area rules here.
|
|
5
|
+
Keep here: client component, hook, design-system, accessibility, and client-context usage rules that apply beyond a single page.
|
|
6
|
+
Do not put here: page `setup` and route-registration details, server/service rules, or generic project workflow already covered by the project-root `AGENTS.md`.
|
|
4
7
|
|
|
5
|
-
|
|
6
|
-
|
|
8
|
+
Optimization source of truth: project-root `optimizations.md`.
|
|
9
|
+
Diagnostics source of truth: project-root `diagnostics.md`.
|
|
10
|
+
Coding style source of truth: project-root `CODING_STYLE.md`.
|
|
7
11
|
|
|
8
12
|
## Stack
|
|
9
13
|
|
|
10
14
|
- TypeScript strict
|
|
11
15
|
- Preact with SSR
|
|
12
|
-
-
|
|
13
|
-
-
|
|
16
|
+
- Follow the UI stack already used in the touched area.
|
|
17
|
+
- Many Proteum apps use Tailwind and `@/client/components/Motion`, but those are app conventions, not framework guarantees.
|
|
14
18
|
|
|
15
|
-
##
|
|
19
|
+
## Client Rules
|
|
16
20
|
|
|
17
21
|
- Page files follow the page contract in `./pages/AGENTS.md`.
|
|
18
|
-
- Components and hooks
|
|
22
|
+
- Components and hooks should reach server APIs through generated controller calls from page render args or the app client context, usually `useContext()` from `@/client/context`.
|
|
19
23
|
- Prefer direct controller calls from context or page render args.
|
|
24
|
+
- Prefer generated app surfaces over direct `.proteum` implementation imports.
|
|
20
25
|
- Never depend on legacy `@app` imports on the client.
|
|
21
26
|
- Errors from controller calls should never be silently swallowed. Rethrow or surface them clearly.
|
|
22
27
|
|